From erlanging@REDACTED Sat Sep 1 04:59:49 2007 From: erlanging@REDACTED (Jeremy Chow) Date: Sat, 1 Sep 2007 10:59:49 +0800 Subject: [erlang-questions] why erlang emulator can't display gui when calling functions like app:start()? Message-ID: <6cef17180708311959oac71eecl21a02010cb97073a@mail.gmail.com> hi list, I run a erlang instance on a CentOS-5, x86 dual core machine. when I called app:start(), the window hasnot popped , and program hanged at that time. who can tell me how to solve it, I am a newbie . Thx, Jeremy From mberrow1@REDACTED Sat Sep 1 07:07:56 2007 From: mberrow1@REDACTED (Mike Berrow) Date: Fri, 31 Aug 2007 22:07:56 -0700 Subject: [erlang-questions] Learning Erlang from the scratch References: <333875.88446.qm@web51105.mail.re2.yahoo.com> <811f2f1c0708311252ma2554ecp887858e081b380d7@mail.gmail.com> Message-ID: <002e01c7ec56$14c3fe40$6401a8c0@rubicon> ----- Original Message ----- From: "Michael Campbell" > For everyone on this thread, there's also a slew (over 1000!) of > programming exercises (not sorted by difficulty, however), here: > http://www.spoj.pl/problems/classical/ > Make sure you look at the left navbar for different categories - that > particular link goes to the "classic" ones. It's an impressive set of problems. But, Erlang is a notable exception from the list of languages that are accepted in the contest. On their list they have ... C (gcc 4.0.0-8) C99 strict (gcc 4.0.0-8) C++ (g++ 4.0.0-8) Pascal (gpc v20030830) Pascal (fpc 2.0.4) Java (j2se jdk 5.0) Nice (nicec 0.9.6) JAR (j2se jdk 5.0) C# (mcs 1.0.1) Nemerle (ncc 0.2.1) Smalltalk (gst 2.1.7) Assembler (nasm 0.98.38) D (dmd 1.007) Fortran (g77 3.3.3) ADA 95 (gnat 3.15p) Bash (bash 2.05b-15) Perl (perl 5.8.3) Python (python 2.5) Ruby (ruby 1.8.5) Lua (lua 5.0.2) Icon (iconc 9.4.2) Pike (pike 7.4.35) PHP (php 4.3.8-9) Scheme (guile 1.6) Scheme (qobi 0.9+0.10a) Common Lisp (sbcl 1.0.4.0) Common Lisp (clisp 2.33.2) Haskell (ghc 6.6.1) Ocaml (ocaml 3.08.1) Clips (clips 6.21) Prolog (swipl 5.2.7) Whitespace (wspace 0.3) Brainf**k (bf2c) Intercal (ick 0.24) Text (pure text) "pure text" ?? -- Mike Berrow From thomasl_erlang@REDACTED Sat Sep 1 14:15:19 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Sat, 1 Sep 2007 05:15:19 -0700 (PDT) Subject: [erlang-questions] Parametrized modules and the shell Message-ID: <521440.19792.qm@web38802.mail.mud.yahoo.com> I'm experimenting with parametrized modules, and have a practical question: am I doing something wrong, or do they just not work very well in the interactive shell (R11B5)? Two examples: 1. Create a concrete module, C = Mod:new(SubMod) then apply it: C:function(...) That crashed in the shell (badfun), but works in compiled code. 2. Exported functions have new arities. My f/3 is replaced by f/4 (passing the implicit parameters in the extra arg, I assume). How should I invoke them? A bit annoying when you work like I do, but I like the concept. So, should the shell be upgraded? Should I throw up my hands and go back to normal modules? Or is there a better way of working with them? Best, Thomas ____________________________________________________________________________________ Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out. http://answers.yahoo.com/dir/?link=list&sid=396545433 From michael.campbell@REDACTED Sat Sep 1 18:24:19 2007 From: michael.campbell@REDACTED (Michael Campbell) Date: Sat, 1 Sep 2007 12:24:19 -0400 Subject: [erlang-questions] Learning Erlang from the scratch In-Reply-To: <002e01c7ec56$14c3fe40$6401a8c0@rubicon> References: <333875.88446.qm@web51105.mail.re2.yahoo.com> <811f2f1c0708311252ma2554ecp887858e081b380d7@mail.gmail.com> <002e01c7ec56$14c3fe40$6401a8c0@rubicon> Message-ID: <811f2f1c0709010924g7ef99f9fl7109f46442dc7f7b@mail.gmail.com> On 9/1/07, Mike Berrow wrote: > ----- Original Message ----- > From: "Michael Campbell" > > For everyone on this thread, there's also a slew (over 1000!) of > > programming exercises (not sorted by difficulty, however), here: > > http://www.spoj.pl/problems/classical/ > > Make sure you look at the left navbar for different categories - that > > particular link goes to the "classic" ones. > > It's an impressive set of problems. > But, Erlang is a notable exception from the list of languages that are accepted > in the contest. Yes, I wasn't trying to say that you could necessarily use the site for judging your result, only that it provides a lot of exercises to practice on. Some, of course, w/o a judge, you might not know if your answers are even right, but not all are like that. From matthias@REDACTED Sat Sep 1 19:13:23 2007 From: matthias@REDACTED (Matthias Radestock) Date: Sat, 01 Sep 2007 18:13:23 +0100 Subject: [erlang-questions] bit syntax slower than bit operations Message-ID: <46D99DB3.1090105@sorted.org> I stumbled upon some unexpected performance characteristics involving bit syntax. After some experimenting, I came up with the following example to illustrate the problem: Say I want to extract bits 2-5 of a single byte of binary data into a tuple, and also, conversely, construct a single byte of binary data from such a tuple: decode_compact(<<_:2, B5:1, B4:1, B3:1, B2:1,_:2>>) -> {B2, B3, B4, B5}. encode_compact({B2, B3, B4, B5}) -> <<0:2, B5:1, B4:1, B3:1, B2:1, 0:2>>. Code doesn't get much more compact than that. Now compare this against the following: decode_verbose(<>) -> {(B band 4) bsr 2, (B band 8) bsr 3, (B band 16) bsr 4, (B band 32) bsr 5}. encode_verbose({B2, B3, B4, B5}) -> <<((B2 bsl 2) bor (B3 bsl 3) bor (B4 bsl 4) bor (B5 bsl 5)):8>>. Same result, but far more verbose. Unfortunately, my tests indicate that the latter version is about twice as fast, using R11B-5 under Linux on x86. Does the bit-syntax compilation produce rather inefficient code? Matthias From hubaghdadi@REDACTED Sat Sep 1 19:59:31 2007 From: hubaghdadi@REDACTED (Lone Wolf) Date: Sat, 1 Sep 2007 10:59:31 -0700 (PDT) Subject: [erlang-questions] Tools for Erlangers Message-ID: <42210.74588.qm@web51104.mail.re2.yahoo.com> Hi. What is your Erlang development tools? For Java, I have IntelliJ, Ant, Maven and alot of frameworks (Spring, Hibernate, Seam...). For Erlang, resources are so limited (ErlyWeb, Maven plugin and Erlide). Do you recommend any tools for Erlanger? Thanks. Deep into that darkness peering, long I stood there, wondering, fearing, Doubting, dreaming dreams no mortal ever dreamed before. E.A Poe --------------------------------- Luggage? GPS? Comic books? Check out fitting gifts for grads at Yahoo! Search. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rsaccon@REDACTED Sat Sep 1 21:15:07 2007 From: rsaccon@REDACTED (Roberto Saccon) Date: Sat, 1 Sep 2007 16:15:07 -0300 Subject: [erlang-questions] Tools for Erlangers In-Reply-To: <42210.74588.qm@web51104.mail.re2.yahoo.com> References: <42210.74588.qm@web51104.mail.re2.yahoo.com> Message-ID: The most useful tool probably is emacs (and the distel extension). However, after years of developing in Java (on those IDEs), it took me a while to get used to emacs. regards -- Roberto Saccon http://rsaccon.com From dustin@REDACTED Sat Sep 1 21:31:34 2007 From: dustin@REDACTED (Dustin Sallings) Date: Sat, 1 Sep 2007 12:31:34 -0700 Subject: [erlang-questions] Tools for Erlangers In-Reply-To: <42210.74588.qm@web51104.mail.re2.yahoo.com> References: <42210.74588.qm@web51104.mail.re2.yahoo.com> Message-ID: <8C3BCAF6-8D5B-4708-BEB9-BA5DD22C08C5@spy.net> On Sep 1, 2007, at 10:59, Lone Wolf wrote: > What is your Erlang development tools? > For Java, I have IntelliJ, Ant, Maven and alot of frameworks (Spring, > Hibernate, Seam...). > For Erlang, resources are so limited (ErlyWeb, Maven plugin and > Erlide). > Do you recommend any tools for Erlanger? They're not limited, they're just not required. It's relatively impossible to write any remotely complex java application without a large number of support tools to help you with some of the more tedious parts. For erlang, I use vi and ``erl -make'' with an Emakefile that looks like this: {"src/*", [debug_info, {outdir, "ebin"}, {i, "include"}]}. -- Dustin Sallings -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob@REDACTED Sat Sep 1 21:36:15 2007 From: bob@REDACTED (Bob Ippolito) Date: Sat, 1 Sep 2007 12:36:15 -0700 Subject: [erlang-questions] bit syntax slower than bit operations In-Reply-To: <46D99DB3.1090105@sorted.org> References: <46D99DB3.1090105@sorted.org> Message-ID: <6a36e7290709011236t308f0f33qcfac2f923207e463@mail.gmail.com> On 9/1/07, Matthias Radestock wrote: > I stumbled upon some unexpected performance characteristics involving > bit syntax. After some experimenting, I came up with the following > example to illustrate the problem: > > Say I want to extract bits 2-5 of a single byte of binary data into a > tuple, and also, conversely, construct a single byte of binary data from > such a tuple: > > decode_compact(<<_:2, B5:1, B4:1, B3:1, B2:1,_:2>>) -> > {B2, B3, B4, B5}. > > encode_compact({B2, B3, B4, B5}) -> > <<0:2, B5:1, B4:1, B3:1, B2:1, 0:2>>. > > Code doesn't get much more compact than that. > > > Now compare this against the following: > > decode_verbose(<>) -> > {(B band 4) bsr 2, (B band 8) bsr 3, (B band 16) bsr 4, (B band 32) > bsr 5}. > > encode_verbose({B2, B3, B4, B5}) -> > <<((B2 bsl 2) bor (B3 bsl 3) bor (B4 bsl 4) bor (B5 bsl 5)):8>>. > > Same result, but far more verbose. > > > Unfortunately, my tests indicate that the latter version is about twice > as fast, using R11B-5 under Linux on x86. > > Does the bit-syntax compilation produce rather inefficient code? I don't know enough about the compiler or interpreter to answer your question, but note that encode_verbose is not the same as encode_compact. Consider any of B2 through B5 being integers outside of 0 or 1. For a complete translation you'd need some extra (BN band 1) ops. -bob From bob@REDACTED Sat Sep 1 21:45:26 2007 From: bob@REDACTED (Bob Ippolito) Date: Sat, 1 Sep 2007 12:45:26 -0700 Subject: [erlang-questions] Tools for Erlangers In-Reply-To: References: <42210.74588.qm@web51104.mail.re2.yahoo.com> Message-ID: <6a36e7290709011245ta72280dq2f0060f26ccb721b@mail.gmail.com> I'd have to agree. I'm primarily a Vim user but the Emacs mode for Erlang was enough to get me to use it. I don't actually use distel very much, but I really like the electric semicolons, proper syntax highlighting and indenting, and shell integration of the Emacs mode. We ended up writing most of our own software stack beyond what's in the OTP distribution. I wasn't very happy with Yaws, so we wrote our own web server. We have an internal fork of the jungerl pgsql driver, though I'm not sure how much of the original is really left. Yaws performed fine, but I wanted something lower level that was easier to code on top of... basically a set of libraries that let you speak HTTP, rather than keeping you a whole process away from touching the TCP socket like Yaws does. We have used Tsung a little bit for testing and benchmarking. -bob On 9/1/07, Roberto Saccon wrote: > The most useful tool probably is emacs (and the distel extension). > However, after years of developing in Java (on those IDEs), it took me > a while to get used to emacs. > > regards > -- > Roberto Saccon > http://rsaccon.com > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From matthias@REDACTED Sat Sep 1 22:23:44 2007 From: matthias@REDACTED (Matthias Radestock) Date: Sat, 01 Sep 2007 21:23:44 +0100 Subject: [erlang-questions] bit syntax slower than bit operations In-Reply-To: <6a36e7290709011236t308f0f33qcfac2f923207e463@mail.gmail.com> References: <46D99DB3.1090105@sorted.org> <6a36e7290709011236t308f0f33qcfac2f923207e463@mail.gmail.com> Message-ID: <46D9CA50.7090303@sorted.org> Bob Ippolito wrote: > On 9/1/07, Matthias Radestock wrote: >> encode_compact({B2, B3, B4, B5}) -> >> <<0:2, B5:1, B4:1, B3:1, B2:1, 0:2>>. >> encode_verbose({B2, B3, B4, B5}) -> >> <<((B2 bsl 2) bor (B3 bsl 3) bor (B4 bsl 4) bor (B5 bsl 5)):8>>. >> [...] >> Unfortunately, my tests indicate that the latter version is about twice >> as fast, using R11B-5 under Linux on x86. > > I don't know enough about the compiler or interpreter to answer your > question, but note that encode_verbose is not the same as > encode_compact. Consider any of B2 through B5 being integers outside > of 0 or 1. For a complete translation you'd need some extra (BN band > 1) ops. Well spotted. Adding that mask slows down encode_verbose somewhat, but it is still substantially faster than encode_compact. Matthias. From garry@REDACTED Sat Sep 1 23:44:27 2007 From: garry@REDACTED (Garry Hodgson) Date: Sat, 1 Sep 2007 17:44:27 -0400 (EDT) Subject: [erlang-questions] Tools for Erlangers In-Reply-To: <8C3BCAF6-8D5B-4708-BEB9-BA5DD22C08C5@spy.net> References: <8C3BCAF6-8D5B-4708-BEB9-BA5DD22C08C5@spy.net> Message-ID: <2007090117441188683067@k2.sage.att.com> Dustin Sallings wrote: > For erlang, I use vi and ``erl -make'' with an Emakefile that looks > like this: > > {"src/*", [debug_info, {outdir, "ebin"}, {i, "include"}]}. but how do you manage all of the complexity in that makefile without an IDE? :-) ---- Garry Hodgson, Senior Software Geek, AT&T CSO nobody can do everything, but everybody can do something. do something. From bjorn@REDACTED Sat Sep 1 23:45:52 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 01 Sep 2007 23:45:52 +0200 Subject: [erlang-questions] bit syntax slower than bit operations In-Reply-To: <46D99DB3.1090105@sorted.org> References: <46D99DB3.1090105@sorted.org> Message-ID: Matthias Radestock writes: > > Unfortunately, my tests indicate that the latter version is about twice > as fast, using R11B-5 under Linux on x86. > > Does the bit-syntax compilation produce rather inefficient code? Yes, it could be better. In fact, I managed to optimize the BEAM instruction for matching out an integer from a binary so that decode_compact/1 now runs somewhat faster than decode_verbose/1 on my computer (Sparc/Solaris). I hope to optimize construction of binaries in the same way. Those improvements will be included in R12B, as well as other improvements and optimizations of the bit syntax that we have been working on. Thanks for pointing out the problem. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bent@REDACTED Sun Sep 2 02:14:52 2007 From: bent@REDACTED (Ben Munat) Date: Sat, 01 Sep 2007 14:14:52 -1000 Subject: [erlang-questions] Tools for Erlangers In-Reply-To: <42210.74588.qm@web51104.mail.re2.yahoo.com> References: <42210.74588.qm@web51104.mail.re2.yahoo.com> Message-ID: <46DA007C.4050007@munat.com> I'm still an erlang newbie, but I've used erlide some and have no complaints. It shows me syntax errors, has template generators for modules, etc. Well, I guess my one complaint would be that the console doesn't have up-arrow command history (like the erlang shell does). There's also Caoyuan's ErlyBird, which is a Netbeans-based erlang IDE: http://sourceforge.net/projects/erlybird I haven't tried that but will definitely do so when I get around to trying the Netbeans Ruby on Rails support. I also haven't tried the emacs support cuz I'm still too chicken to try emacs... I'm barely comfortable with VI! Out of curiosity, why did you list the Maven plugin in the list of erlang resources? Ben Lone Wolf wrote: > Hi. > What is your Erlang development tools? > For Java, I have IntelliJ, Ant, Maven and alot of frameworks (Spring, > Hibernate, Seam...). > For Erlang, resources are so limited (ErlyWeb, Maven plugin and Erlide). > Do you recommend any tools for Erlanger? > Thanks. > > */Deep into that darkness peering, long I stood there, wondering, > fearing, Doubting, dreaming dreams no mortal ever dreamed before./* > */E.A Poe/* > *//* > *//* > > ------------------------------------------------------------------------ > Luggage? GPS? Comic books? > Check out fitting gifts for grads > > at Yahoo! Search. > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From dustin@REDACTED Sun Sep 2 05:13:56 2007 From: dustin@REDACTED (Dustin Sallings) Date: Sat, 1 Sep 2007 20:13:56 -0700 Subject: [erlang-questions] Tools for Erlangers In-Reply-To: <2007090117441188683067@k2.sage.att.com> References: <8C3BCAF6-8D5B-4708-BEB9-BA5DD22C08C5@spy.net> <2007090117441188683067@k2.sage.att.com> Message-ID: <28CE44C9-81E9-4979-97C9-29E0207739BA@spy.net> On Sep 1, 2007, at 14:44, Garry Hodgson wrote: >> {"src/*", [debug_info, {outdir, "ebin"}, {i, "include"}]}. > > but how do you manage all of the complexity in that makefile > without an IDE? You know, there is some validity to that question. I found that snippet on some page that pointed out the existence of the erl make thing as it was describing a sort of standard layout for a project. If this layout is ``standard,'' it'd be great to not have the Emakefile at all. :) -- Dustin Sallings From paul-trapexit@REDACTED Sun Sep 2 05:57:27 2007 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Sat, 1 Sep 2007 20:57:27 -0700 (PDT) Subject: [erlang-questions] flow control in http client asynchronous mode Message-ID: is there any way to get flow control when using the { stream, self } option to http:request/4 ? thanks in advance, -- p From als@REDACTED Sun Sep 2 10:10:05 2007 From: als@REDACTED (Anthony Shipman) Date: Sun, 2 Sep 2007 18:10:05 +1000 Subject: [erlang-questions] string:to_lower Message-ID: <200709021810.06273.als@iinet.net.au> 13> string:to_float("0"). {error,no_float} 14> string:to_float("0.0"). {0.00000e+0,[]} That's a bit rough! -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From qrilka@REDACTED Sun Sep 2 11:12:56 2007 From: qrilka@REDACTED (Kirill Zaborski) Date: Sun, 2 Sep 2007 13:12:56 +0400 Subject: [erlang-questions] bit syntax slower than bit operations In-Reply-To: References: <46D99DB3.1090105@sorted.org> Message-ID: <337538cb0709020212q7da528fy28e7b7de3ed1d414@mail.gmail.com> And when is R12B is planned for? Best regards, Kirill. On 01 Sep 2007 23:45:52 +0200, Bjorn Gustavsson wrote: > > Matthias Radestock writes: > > > > > Unfortunately, my tests indicate that the latter version is about twice > > as fast, using R11B-5 under Linux on x86. > > > > Does the bit-syntax compilation produce rather inefficient code? > > Yes, it could be better. > > In fact, I managed to optimize the BEAM instruction for matching out > an integer from a binary so that decode_compact/1 now runs somewhat > faster than decode_verbose/1 on my computer (Sparc/Solaris). > I hope to optimize construction of binaries in the same way. > > Those improvements will be included in R12B, as well as other improvements > and optimizations of the bit syntax that we have been working on. > > Thanks for pointing out the problem. > > /Bjorn > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bjorn@REDACTED Sun Sep 2 11:14:34 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 02 Sep 2007 11:14:34 +0200 Subject: [erlang-questions] bit syntax slower than bit operations In-Reply-To: <337538cb0709020212q7da528fy28e7b7de3ed1d414@mail.gmail.com> References: <46D99DB3.1090105@sorted.org> <337538cb0709020212q7da528fy28e7b7de3ed1d414@mail.gmail.com> Message-ID: "Kirill Zaborski" writes: > And when is R12B is planned for? Before the end of this year. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From g.vishnu@REDACTED Sun Sep 2 11:36:00 2007 From: g.vishnu@REDACTED (Vishnu Gopal) Date: Sun, 2 Sep 2007 15:06:00 +0530 Subject: [erlang-questions] Emacs: Debugger buffer not showing program output Message-ID: Hi! I'm trying to learn both Emacs and erlang (newbie to both so please be gentle). I installed Distel fine and managed to connect to an erlang node. Was trying out debugging when I noticed something odd. I start a debug session with C-c C-d i and set a breakpoint C-x SPC. And when I run the function in the shell, the debug process list window pops up. I type return on the correct process and a debugger buffer pops up. As far as I understand it to work, it should show the program in a read-only buffer: with the state of execution & breakpoints, and with variables at the bottom of the window. However I get a blank buffer: all the commands (n, SPC, q, h, etc.) seem to work fine though. I'm not sure if it's because I misunderstood how it's supposed to work, so here's a screenshot: http://vish.in/temp/emacs-debug.png Shouldn't it look something like this: http://bc.tech.coop/blog/images/distel2.jpg ? (I'm using Aquamacs btw, not sure if that makes a difference). It'd be great if somebody could help. Thanks, Vish From hughperkins@REDACTED Sun Sep 2 13:04:34 2007 From: hughperkins@REDACTED (Hugh Perkins) Date: Sun, 2 Sep 2007 19:04:34 +0800 Subject: [erlang-questions] Erlang rocks... Message-ID: <837db430709020404r46de03b7qa950218f67047fb6@mail.gmail.com> Erlang rocks... Was playing around with Haskell for a while (after seeing it mentioned in an article by Tim Sweenie). Haskell was interesting, but had an "unpolished" feel about it. Erlang just rocks. Things "just work". I love how easy it is to send messages between threads. The supervisor hierarchy, and the ability to update running programs on the fly just blows my mind. Awesome! From zac@REDACTED Sun Sep 2 16:54:24 2007 From: zac@REDACTED (Zac Brown) Date: Sun, 02 Sep 2007 10:54:24 -0400 Subject: [erlang-questions] string:to_lower In-Reply-To: <200709021810.06273.als@iinet.net.au> References: <200709021810.06273.als@iinet.net.au> Message-ID: <46DACEA0.9080104@zacbrown.org> Anthony Shipman wrote: > 13> string:to_float("0"). > {error,no_float} > 14> string:to_float("0.0"). > {0.00000e+0,[]} > > That's a bit rough! > Hi Anthony: From the erlang docs for to_float(String): *Argument |String| is expected to start with a valid text represented float (the digits being ASCII values). Remaining characters in the string after the float are returned in |Rest|. * It would seem that "0" is not recognized as a float and thats probably for some management issues in the VM :). Zac From hubaghdadi@REDACTED Sun Sep 2 19:13:07 2007 From: hubaghdadi@REDACTED (Lone Wolf) Date: Sun, 2 Sep 2007 10:13:07 -0700 (PDT) Subject: [erlang-questions] Tools for Erlangers In-Reply-To: Message-ID: <242352.89961.qm@web51104.mail.re2.yahoo.com> >>Out of curiosity, why did you list the Maven plugin in the list of erlang resources? Because I found a Maven plugin for building (I think) Erlang applications. erlang-questions-request@REDACTED wrote: Send erlang-questions mailing list submissions to erlang-questions@REDACTED To subscribe or unsubscribe via the World Wide Web, visit http://www.erlang.org/mailman/listinfo/erlang-questions or, via email, send a message with subject or body 'help' to erlang-questions-request@REDACTED You can reach the person managing the list at erlang-questions-owner@REDACTED When replying, please edit your Subject line so it is more specific than "Re: Contents of erlang-questions digest..." Today's Topics: 1. Re: Tools for Erlangers (Ben Munat) 2. Re: Tools for Erlangers (Dustin Sallings) 3. flow control in http client asynchronous mode (Paul Mineiro) 4. string:to_lower (Anthony Shipman) 5. Re: bit syntax slower than bit operations (Kirill Zaborski) 6. Re: bit syntax slower than bit operations (Bjorn Gustavsson) 7. Emacs: Debugger buffer not showing program output (Vishnu Gopal) ---------------------------------------------------------------------- Message: 1 Date: Sat, 01 Sep 2007 14:14:52 -1000 From: Ben Munat Subject: Re: [erlang-questions] Tools for Erlangers To: erlang-questions@REDACTED Message-ID: <46DA007C.4050007@REDACTED> Content-Type: text/plain; charset=ISO-8859-1; format=flowed I'm still an erlang newbie, but I've used erlide some and have no complaints. It shows me syntax errors, has template generators for modules, etc. Well, I guess my one complaint would be that the console doesn't have up-arrow command history (like the erlang shell does). There's also Caoyuan's ErlyBird, which is a Netbeans-based erlang IDE: http://sourceforge.net/projects/erlybird I haven't tried that but will definitely do so when I get around to trying the Netbeans Ruby on Rails support. I also haven't tried the emacs support cuz I'm still too chicken to try emacs... I'm barely comfortable with VI! Out of curiosity, why did you list the Maven plugin in the list of erlang resources? Ben Lone Wolf wrote: > Hi. > What is your Erlang development tools? > For Java, I have IntelliJ, Ant, Maven and alot of frameworks (Spring, > Hibernate, Seam...). > For Erlang, resources are so limited (ErlyWeb, Maven plugin and Erlide). > Do you recommend any tools for Erlanger? > Thanks. > > */Deep into that darkness peering, long I stood there, wondering, > fearing, Doubting, dreaming dreams no mortal ever dreamed before./* > */E.A Poe/* > *//* > *//* > > ------------------------------------------------------------------------ > Luggage? GPS? Comic books? > Check out fitting gifts for grads > > at Yahoo! Search. > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions ------------------------------ Message: 2 Date: Sat, 1 Sep 2007 20:13:56 -0700 From: Dustin Sallings Subject: Re: [erlang-questions] Tools for Erlangers To: Garry Hodgson Cc: erlang-questions@REDACTED Message-ID: <28CE44C9-81E9-4979-97C9-29E0207739BA@REDACTED> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On Sep 1, 2007, at 14:44, Garry Hodgson wrote: >> {"src/*", [debug_info, {outdir, "ebin"}, {i, "include"}]}. > > but how do you manage all of the complexity in that makefile > without an IDE? You know, there is some validity to that question. I found that snippet on some page that pointed out the existence of the erl make thing as it was describing a sort of standard layout for a project. If this layout is ``standard,'' it'd be great to not have the Emakefile at all. :) -- Dustin Sallings ------------------------------ Message: 3 Date: Sat, 1 Sep 2007 20:57:27 -0700 (PDT) From: Paul Mineiro Subject: [erlang-questions] flow control in http client asynchronous mode To: erlang-questions@REDACTED Message-ID: Content-Type: TEXT/PLAIN; charset=US-ASCII is there any way to get flow control when using the { stream, self } option to http:request/4 ? thanks in advance, -- p ------------------------------ Message: 4 Date: Sun, 2 Sep 2007 18:10:05 +1000 From: Anthony Shipman Subject: [erlang-questions] string:to_lower To: erlang-questions@REDACTED Message-ID: <200709021810.06273.als@REDACTED> Content-Type: text/plain; charset="us-ascii" 13> string:to_float("0"). {error,no_float} 14> string:to_float("0.0"). {0.00000e+0,[]} That's a bit rough! -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. ------------------------------ Message: 5 Date: Sun, 2 Sep 2007 13:12:56 +0400 From: "Kirill Zaborski" Subject: Re: [erlang-questions] bit syntax slower than bit operations To: "Bjorn Gustavsson" Cc: erlang-questions@REDACTED Message-ID: <337538cb0709020212q7da528fy28e7b7de3ed1d414@REDACTED> Content-Type: text/plain; charset="iso-8859-1" And when is R12B is planned for? Best regards, Kirill. On 01 Sep 2007 23:45:52 +0200, Bjorn Gustavsson wrote: > > Matthias Radestock writes: > > > > > Unfortunately, my tests indicate that the latter version is about twice > > as fast, using R11B-5 under Linux on x86. > > > > Does the bit-syntax compilation produce rather inefficient code? > > Yes, it could be better. > > In fact, I managed to optimize the BEAM instruction for matching out > an integer from a binary so that decode_compact/1 now runs somewhat > faster than decode_verbose/1 on my computer (Sparc/Solaris). > I hope to optimize construction of binaries in the same way. > > Those improvements will be included in R12B, as well as other improvements > and optimizations of the bit syntax that we have been working on. > > Thanks for pointing out the problem. > > /Bjorn > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.erlang.org/pipermail/erlang-questions/attachments/20070902/962eec27/attachment-0001.html ------------------------------ Message: 6 Date: 02 Sep 2007 11:14:34 +0200 From: Bjorn Gustavsson Subject: Re: [erlang-questions] bit syntax slower than bit operations To: erlang-questions@REDACTED Message-ID: Content-Type: text/plain; charset=iso-8859-1 "Kirill Zaborski" writes: > And when is R12B is planned for? Before the end of this year. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB ------------------------------ Message: 7 Date: Sun, 2 Sep 2007 15:06:00 +0530 From: "Vishnu Gopal" Subject: [erlang-questions] Emacs: Debugger buffer not showing program output To: erlang-questions@REDACTED Message-ID: Content-Type: text/plain; charset=ISO-8859-1 Hi! I'm trying to learn both Emacs and erlang (newbie to both so please be gentle). I installed Distel fine and managed to connect to an erlang node. Was trying out debugging when I noticed something odd. I start a debug session with C-c C-d i and set a breakpoint C-x SPC. And when I run the function in the shell, the debug process list window pops up. I type return on the correct process and a debugger buffer pops up. As far as I understand it to work, it should show the program in a read-only buffer: with the state of execution & breakpoints, and with variables at the bottom of the window. However I get a blank buffer: all the commands (n, SPC, q, h, etc.) seem to work fine though. I'm not sure if it's because I misunderstood how it's supposed to work, so here's a screenshot: http://vish.in/temp/emacs-debug.png Shouldn't it look something like this: http://bc.tech.coop/blog/images/distel2.jpg ? (I'm using Aquamacs btw, not sure if that makes a difference). It'd be great if somebody could help. Thanks, Vish ------------------------------ _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions End of erlang-questions Digest, Vol 4, Issue 3 ********************************************** Deep into that darkness peering, long I stood there, wondering, fearing, Doubting, dreaming dreams no mortal ever dreamed before. E.A Poe --------------------------------- Moody friends. Drama queens. Your life? Nope! - their life, your story. Play Sims Stories at Yahoo! Games. -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Sun Sep 2 19:57:35 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Sun, 2 Sep 2007 17:57:35 +0000 Subject: [erlang-questions] Tools for Erlangers In-Reply-To: <46DA007C.4050007@munat.com> References: <42210.74588.qm@web51104.mail.re2.yahoo.com> <46DA007C.4050007@munat.com> Message-ID: <95be1d3b0709021057p393f7d8hf5d53f7f26be81a5@mail.gmail.com> On 9/2/07, Ben Munat wrote: > > I'm still an erlang newbie, but I've used erlide some and have no > complaints. It > shows me syntax errors, has template generators for modules, etc. Well, I > guess > my one complaint would be that the console doesn't have up-arrow command > history > (like the erlang shell does). > > Hi, You can use Ctrl-Up in the console input field and you will get a popup with the history, where you can navigate the arroes and enter will copy the entry to the input where it can be further edited before sending it to the shell with Ctrl-Enter. A but unwieldy, I confess, but I'm trying to come up with a better UI (suggestions are always welcome!) regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From olivier.sambourg@REDACTED Sun Sep 2 19:58:01 2007 From: olivier.sambourg@REDACTED (Olivier Sambourg) Date: Sun, 2 Sep 2007 19:58:01 +0200 Subject: [erlang-questions] Tools for Erlangers In-Reply-To: <242352.89961.qm@web51104.mail.re2.yahoo.com> References: <242352.89961.qm@web51104.mail.re2.yahoo.com> Message-ID: On 9/2/07, Lone Wolf wrote: > > >>Out of curiosity, why did you list the Maven plugin in the list of > erlang resources? > Because I found a Maven plugin for building (I think) Erlang applications. > That's exactly what it's for: building, running tests (with or without eunit), packaging (OTP style), deploying, hot loading (someday) erlang projects. If you happen to use this plugin and have any question, suggestion, or anything, I'm listening ;) -- Olivier -------------- next part -------------- An HTML attachment was scrubbed... URL: From dhbaird@REDACTED Sun Sep 2 20:08:23 2007 From: dhbaird@REDACTED (David Baird) Date: Sun, 2 Sep 2007 12:08:23 -0600 Subject: [erlang-questions] Trouble with gen_udp:fdopen Message-ID: <440abda90709021108t2a77196exc7b646c5ebcaf359@mail.gmail.com> Hi, I am using otp_src_R11B-5 and I have the following code: #!/usr/bin/env escript main(Args) -> io:fwrite("Args = ~p ~n", [Args]), case Args of [_, "-foofd", FDStr] -> FD = erlang:list_to_integer(FDStr), io:fwrite("FD = ~p ~n", [FD]), Res = gen_udp:fdopen(FD, []), io:fwrite("Res = ~p~n", [Res]) end. When I execute the script using the suid "setuid_socket_wrap.c" program (provided with the Erlang sources): /tmp/setuid_socket_wrap -d -foofd,:123 -- ./client.erl I get this result: Args = ["./client.erl","-foofd","3"] FD = 3 Res = {error,eprotonosupport} Does anyone know what is going on? I think the error is being raised in "otp_src_R11B-5/lib/kernel/src/prim_inet.erl" (but I'm not 100% sure): protocol2drv(tcp) -> tcp_inet; protocol2drv(udp) -> udp_inet; protocol2drv(sctp) -> sctp_inet; protocol2drv(_) -> erlang:error(eprotonosupport). I have a suspicion that it might be an incorrect atom ("dgram" instead of "udp") in "otp_src_R11B-5/lib/kernel/src/inet_udp.erl:" open(Port, Opts) when Port >= 0, Port =< 16#ffff -> case inet:udp_options( [{port,Port}, {recbuf, ?RECBUF} | Opts], inet) of {error, Reason} -> exit(Reason); {ok, R} -> Fd = R#udp_opts.fd, BAddr = R#udp_opts.ifaddr, BPort = R#udp_opts.port, SockOpts = R#udp_opts.opts, inet:open(Fd,BAddr,BPort,SockOpts,udp,inet,?MODULE) % <- good atom end. % fdopen(Fd, Opts) -> inet:fdopen(Fd, optuniquify([{recbuf, ?RECBUF} | Opts]), dgram, inet, ?MODULE). % <- bad atom here In "open," the "udp" atom is used as the Protocol (which matches "protocol2drv(udp)" in "prim_inet.erl"). However, "fdopen" is using a different atom: "dgram". I looked at "inet_tcp.erl" and it is consistent, unlike "inet_udp.erl": do_connect({A,B,C,D}, Port, Opts, Time) when ?ip(A,B,C,D), is_integer(Port) -> case inet:connect_options(Opts, inet) of {error, Reason} -> exit(Reason); {ok, R} -> Fd = R#connect_opts.fd, BAddr = R#connect_opts.ifaddr, BPort = R#connect_opts.port, SockOpts = R#connect_opts.opts, case inet:open(Fd,BAddr,BPort,SockOpts,tcp,inet,?MODULE) of % ... % fdopen(Fd, Opts) -> inet:fdopen(Fd, Opts, tcp, inet, ?MODULE). Any suggestions? Is this a bug or am I doing something wrong? Thanks, David From dustin@REDACTED Sun Sep 2 22:53:27 2007 From: dustin@REDACTED (Dustin Sallings) Date: Sun, 2 Sep 2007 13:53:27 -0700 Subject: [erlang-questions] string:to_float (was: string:to_lower) In-Reply-To: <46DACEA0.9080104@zacbrown.org> References: <200709021810.06273.als@iinet.net.au> <46DACEA0.9080104@zacbrown.org> Message-ID: <26C2579C-6C60-40AF-95E2-A6679CFCDBE9@spy.net> On Sep 2, 2007, at 7:54, Zac Brown wrote: > Anthony Shipman wrote: >> 13> string:to_float("0"). >> {error,no_float} >> 14> string:to_float("0.0"). >> {0.00000e+0,[]} >> >> That's a bit rough! >> > Hi Anthony: > > From the erlang docs for to_float(String): > *Argument |String| is expected to start with a > valid > text represented float (the digits being ASCII values). Remaining > characters in the string after the float are returned in |Rest|. > > * It would seem that "0" is not recognized as a float and thats > probably for some management issues in the VM :). I don't think there should be distinction here. It can definitely be made to work: to_float(S) -> case string:to_float(S) of {error, no_float} -> list_to_integer(S) * 1.0; {X,_More} -> X end. or to_float(S) -> case catch(list_to_float(S)) of {'EXIT', {badarg, _Stuff}} -> list_to_integer(S) * 1.0; X -> X end. IMO, it's a bit counterintuitive (especially for the users of my applications) that I can't read ``1'' as a float without doing weird stuff. -- Dustin Sallings From bent@REDACTED Sun Sep 2 23:22:10 2007 From: bent@REDACTED (Ben Munat) Date: Sun, 02 Sep 2007 11:22:10 -1000 Subject: [erlang-questions] Tools for Erlangers In-Reply-To: <95be1d3b0709021057p393f7d8hf5d53f7f26be81a5@mail.gmail.com> References: <42210.74588.qm@web51104.mail.re2.yahoo.com> <46DA007C.4050007@munat.com> <95be1d3b0709021057p393f7d8hf5d53f7f26be81a5@mail.gmail.com> Message-ID: <46DB2982.6060704@munat.com> Vlad Dumitrescu wrote: > On 9/2/07, *Ben Munat* > wrote: > my one complaint would be that the console doesn't have up-arrow > command history (like the erlang shell does). > > You can use Ctrl-Up in the console input field and you will get a popup > with the history, where you can navigate the arroes and enter will copy > the entry to the input where it can be further edited before sending it > to the shell with Ctrl-Enter. > > A but unwieldy, I confess, but I'm trying to come up with a better UI > (suggestions are always welcome!) > Cool, thanks... that'll come in handy. Yeah, I guess I've never really seen anyone do an interactive console view in eclipse. But this works... definitely better than typing everything again from scratch. Ben From toxicafunk@REDACTED Mon Sep 3 00:00:20 2007 From: toxicafunk@REDACTED (Eric Rodriguez) Date: Mon, 03 Sep 2007 00:00:20 +0200 Subject: [erlang-questions] Tools for Erlangers In-Reply-To: References: <42210.74588.qm@web51104.mail.re2.yahoo.com> Message-ID: <46DB3274.6010001@gmail.com> For non-Emacs users, jEdit also recognizes erlang's syntax and is more light than eclipse. Regards, Roberto Saccon wrote: > The most useful tool probably is emacs (and the distel extension). > However, after years of developing in Java (on those IDEs), it took me > a while to get used to emacs. > > regards From hughperkins@REDACTED Mon Sep 3 02:55:01 2007 From: hughperkins@REDACTED (Hugh Perkins) Date: Mon, 3 Sep 2007 08:55:01 +0800 Subject: [erlang-questions] Tools for Erlangers In-Reply-To: <46DB3274.6010001@gmail.com> References: <42210.74588.qm@web51104.mail.re2.yahoo.com> <46DB3274.6010001@gmail.com> Message-ID: <837db430709021755j24695787p7bbe6168a0f52caa@mail.gmail.com> One thing that is quite useful in an IDE is auto-completion. It's kindof like a mobile phone: you can live without it, but once you've used it, it's hard to live without it ;-) Auto-completion in Erlang should be relatively easy to implement, because the module name is always specified, so the search-space is always small. (cf C++, where one has to search every include file) From hughperkins@REDACTED Mon Sep 3 04:00:10 2007 From: hughperkins@REDACTED (Hugh Perkins) Date: Mon, 3 Sep 2007 10:00:10 +0800 Subject: [erlang-questions] Get list of module exported functions? Message-ID: <837db430709021900x22347812td84b6d04e6491e70@mail.gmail.com> Hi, how can one get a list of a module's exported functions from erlang? We can get a list of modules by doing: erlang:loaded(). ... but I couldnt find the function to get a description of a specific module? From erlangx@REDACTED Mon Sep 3 04:15:48 2007 From: erlangx@REDACTED (Michael McDaniel) Date: Sun, 2 Sep 2007 19:15:48 -0700 Subject: [erlang-questions] Get list of module exported functions? In-Reply-To: <837db430709021900x22347812td84b6d04e6491e70@mail.gmail.com> References: <837db430709021900x22347812td84b6d04e6491e70@mail.gmail.com> Message-ID: <20070903021548.GE6465@delora.autosys.us> On Mon, Sep 03, 2007 at 10:00:10AM +0800, Hugh Perkins wrote: > Hi, how can one get a list of a module's exported functions from erlang? > > We can get a list of modules by doing: > > erlang:loaded(). > > ... but I couldnt find the function to get a description of a specific module? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ if my module is named, say, maxdata, then m(maxdata). or maxdata:module_info(). ~Michael > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > !DSPAM:52,46db6ad173328422919261! > > -- Michael McDaniel Portland, Oregon, USA http://autosys.us +1 503 283 5284 From hughperkins@REDACTED Mon Sep 3 04:28:56 2007 From: hughperkins@REDACTED (Hugh Perkins) Date: Mon, 3 Sep 2007 10:28:56 +0800 Subject: [erlang-questions] Get list of module exported functions? In-Reply-To: <20070903021548.GE6465@delora.autosys.us> References: <837db430709021900x22347812td84b6d04e6491e70@mail.gmail.com> <20070903021548.GE6465@delora.autosys.us> Message-ID: <837db430709021928q4764a1a0s641d38dbe3615330@mail.gmail.com> Great, thanks :-) On 9/3/07, Michael McDaniel wrote: > On Mon, Sep 03, 2007 at 10:00:10AM +0800, Hugh Perkins wrote: > > Hi, how can one get a list of a module's exported functions from erlang? > > > > We can get a list of modules by doing: > > > > erlang:loaded(). > > > > ... but I couldnt find the function to get a description of a specific module? > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > if my module is named, say, maxdata, then > > m(maxdata). > > or > > maxdata:module_info(). > > > ~Michael > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > !DSPAM:52,46db6ad173328422919261! > > > > > > -- > 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 > From yarivsadan@REDACTED Mon Sep 3 06:48:42 2007 From: yarivsadan@REDACTED (Yariv Sadan) Date: Mon, 3 Sep 2007 00:48:42 -0400 Subject: [erlang-questions] Tools for Erlangers In-Reply-To: <42210.74588.qm@web51104.mail.re2.yahoo.com> References: <42210.74588.qm@web51104.mail.re2.yahoo.com> Message-ID: <17244f480709022148v7e4bf2e1i832a78db8eaee09d@mail.gmail.com> ErlyWeb compiles your application's code for you, and it also provides database abstraction and view-controller separation, which effectively does the job of Ant, Spring and Hibernate together (I don't claim ErlyWeb has all the features of those tools, but it probably has most if not all the features you need). For text editor, you can use emacs or TextEdit if you have a Mac and you're good to go. One thing that I find lacking is an IDE-integrated debugger. debugger:start() has its own GUI, where you have to locate the source file(s) you want to debug, which is cumbersome compared to an integrated debugger such as in Eclipse. I think Distel is supposed to have an integrated debugger but I couldn't get it to work.. Yariv On 9/1/07, Lone Wolf wrote: > Hi. > What is your Erlang development tools? > For Java, I have IntelliJ, Ant, Maven and alot of frameworks (Spring, > Hibernate, Seam...). > For Erlang, resources are so limited (ErlyWeb, Maven plugin and Erlide). > Do you recommend any tools for Erlanger? > Thanks. > > > > Deep into that darkness peering, long I stood there, wondering, fearing, > Doubting, dreaming dreams no mortal ever dreamed before. > E.A Poe > > > > ________________________________ > Luggage? GPS? Comic books? > Check out fitting gifts for grads at Yahoo! Search. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From ingela@REDACTED Mon Sep 3 08:17:14 2007 From: ingela@REDACTED (Ingela Anderton Andin) Date: Mon, 03 Sep 2007 08:17:14 +0200 Subject: [erlang-questions] flow control in http client asynchronous mode (Paul Mineiro) In-Reply-To: References: Message-ID: <46DBA6EA.8060100@erix.ericsson.se> > is there any way to get flow control when using the { stream, self } > option to http:request/4 ? No not currently, I have been thinking that we ought to add something along the lines with active once but I have not had time implement it yet. Maybe for R12 or R12-1. Regards Ingela -- OTP team From g.vishnu@REDACTED Mon Sep 3 08:27:05 2007 From: g.vishnu@REDACTED (Vishnu Gopal) Date: Mon, 3 Sep 2007 11:57:05 +0530 Subject: [erlang-questions] Emacs: Debugger buffer not showing program output In-Reply-To: References: Message-ID: Anybody? Vish On 9/2/07, Vishnu Gopal wrote: > Hi! > > I'm trying to learn both Emacs and erlang (newbie to both so please be > gentle). I installed Distel fine and managed to connect to an erlang > node. Was trying out debugging when I noticed something odd. > > I start a debug session with C-c C-d i and set a breakpoint C-x SPC. > And when I run the function in the shell, the debug process list > window pops up. I type return on the correct process and a debugger > buffer pops up. As far as I understand it to work, it should show the > program in a read-only buffer: with the state of execution & > breakpoints, and with variables at the bottom of the window. However I > get a blank buffer: all the commands (n, SPC, q, h, etc.) seem to work > fine though. I'm not sure if it's because I misunderstood how it's > supposed to work, so here's a screenshot: > > http://vish.in/temp/emacs-debug.png > > Shouldn't it look something like this: > http://bc.tech.coop/blog/images/distel2.jpg ? > > (I'm using Aquamacs btw, not sure if that makes a difference). > > It'd be great if somebody could help. > > Thanks, > Vish > From hans.bolinder@REDACTED Mon Sep 3 08:21:08 2007 From: hans.bolinder@REDACTED (Hans Bolinder) Date: Mon, 3 Sep 2007 08:21:08 +0200 Subject: [erlang-questions] Parametrized modules and the shell In-Reply-To: <521440.19792.qm@web38802.mail.mud.yahoo.com> References: <521440.19792.qm@web38802.mail.mud.yahoo.com> Message-ID: <18139.42964.968875.35859@gargle.gargle.HOWL> [Thomas Lindgren:] > I'm experimenting with parametrized modules, and have > a practical question: am I doing something wrong, or > do they just not work very well in the interactive > shell (R11B5)? > > Two examples: > > 1. Create a concrete module, C = Mod:new(SubMod) > then apply it: C:function(...) > > That crashed in the shell (badfun), but works in compiled code. There is a patch, see http://www.erlang.org/pipermail/erlang-questions/2007-July/027672.html Best regards, Hans Bolinder, Erlang/OTP team From dougedmunds@REDACTED Mon Sep 3 08:53:44 2007 From: dougedmunds@REDACTED (Doug Edmunds) Date: Sun, 2 Sep 2007 23:53:44 -0700 Subject: [erlang-questions] ets and dets examples Message-ID: I've been whacking at the ets and dets documents, trying to create simple examples of how the exported functions work (and how they don't work). If you just starting to look at ets and dets, it might help. http://www.dougedmunds.com/z_erlang_wiki -- doug edmunds -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Mon Sep 3 09:18:37 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 03 Sep 2007 09:18:37 +0200 Subject: [erlang-questions] Learning Erlang from the scratch In-Reply-To: <811f2f1c0708311154m5eeb73bdk3b5d73dfc05ac6b7@mail.gmail.com> References: <5B54D301-31CD-42C6-85E8-519FA23E5193@gmail.com> <811f2f1c0708311154m5eeb73bdk3b5d73dfc05ac6b7@mail.gmail.com> Message-ID: <46DBB54D.7020608@ericsson.com> greetings, my main problem with the alioth shootout is that it has thrown away one of the main ideas/insights from the paper(*) that was the inspiration for the original shootout. namely that it is very important to look at how the timeing changes with the size of the input. the alioth shootout takes only 3 very similar size values. to make things worse these 3 values must give results for the major languages (no timeout, etc). (*)Timing Trials, or, the Trials of Timing, http://cm.bell-labs.com/cm/cs/who/bwk/interps/pap.html) bengt Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." On 2007-08-31 20:54, Michael Campbell wrote: > On 8/31/07, G Bulmer wrote: > >> Another idea for exercises - you might take a look at "The Computer >> Language Benchmarks Game" at http://shootout.alioth.debian.org/ >> They have a bunch of small benchmarks coded in Java and Erlang (and 30 >> + other languages), so you can see how the same algorithm would be >> coded in both languages, or try coding it yourself based on the Java >> code. Who knows, you may come up with a better implementation. > > Be careful with that. Alioth's shootouts are for how quickly a > language can run a particular *algorithm*, which can at times be VERY > DIFFERENT from how you would normally do it in that language. > > So some of the code on that will be weirdly contorted to fit the > particular algorithm, rather than what the prevailing idiom is for > that language. > > A somewhat more harsh criticism can be found here: > http://yarivsblog.com/articles/2006/07/11/erlang-yaws-vs-ruby-on-rails/#comment-70 > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From raimo+erlang-questions@REDACTED Mon Sep 3 09:50:44 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Mon, 3 Sep 2007 09:50:44 +0200 Subject: [erlang-questions] Trouble with gen_udp:fdopen In-Reply-To: <440abda90709021108t2a77196exc7b646c5ebcaf359@mail.gmail.com> References: <440abda90709021108t2a77196exc7b646c5ebcaf359@mail.gmail.com> Message-ID: <20070903075044.GB2174@erix.ericsson.se> Oh, ... and thank you for pointing this out :-) On Sun, Sep 02, 2007 at 12:08:23PM -0600, David Baird wrote: > Hi, > > I am using otp_src_R11B-5 and I have the following code: > > #!/usr/bin/env escript > main(Args) -> > io:fwrite("Args = ~p ~n", [Args]), > case Args of > [_, "-foofd", FDStr] -> > FD = erlang:list_to_integer(FDStr), > io:fwrite("FD = ~p ~n", [FD]), > Res = gen_udp:fdopen(FD, []), > io:fwrite("Res = ~p~n", [Res]) > end. > > When I execute the script using the suid "setuid_socket_wrap.c" > program (provided with the Erlang sources): > > /tmp/setuid_socket_wrap -d -foofd,:123 -- ./client.erl > > I get this result: > > Args = ["./client.erl","-foofd","3"] > FD = 3 > Res = {error,eprotonosupport} > > Does anyone know what is going on? I think the error is being raised > in "otp_src_R11B-5/lib/kernel/src/prim_inet.erl" (but I'm not 100% > sure): > > protocol2drv(tcp) -> tcp_inet; > protocol2drv(udp) -> udp_inet; > protocol2drv(sctp) -> sctp_inet; > protocol2drv(_) -> > erlang:error(eprotonosupport). > > I have a suspicion that it might be an incorrect atom ("dgram" instead > of "udp") in "otp_src_R11B-5/lib/kernel/src/inet_udp.erl:" > > open(Port, Opts) when Port >= 0, Port =< 16#ffff -> > case inet:udp_options( > [{port,Port}, {recbuf, ?RECBUF} | Opts], > inet) of > {error, Reason} -> exit(Reason); > {ok, R} -> > Fd = R#udp_opts.fd, > BAddr = R#udp_opts.ifaddr, > BPort = R#udp_opts.port, > SockOpts = R#udp_opts.opts, > inet:open(Fd,BAddr,BPort,SockOpts,udp,inet,?MODULE) % > <- good atom > end. > > % > > fdopen(Fd, Opts) -> > inet:fdopen(Fd, > optuniquify([{recbuf, ?RECBUF} | Opts]), > dgram, inet, ?MODULE). % <- bad atom here > > In "open," the "udp" atom is used as the Protocol (which matches > "protocol2drv(udp)" in "prim_inet.erl"). However, "fdopen" is using a > different atom: "dgram". I looked at "inet_tcp.erl" and it is > consistent, unlike "inet_udp.erl": > > do_connect({A,B,C,D}, Port, Opts, Time) when ?ip(A,B,C,D), > is_integer(Port) -> > case inet:connect_options(Opts, inet) of > {error, Reason} -> exit(Reason); > {ok, R} -> > Fd = R#connect_opts.fd, > BAddr = R#connect_opts.ifaddr, > BPort = R#connect_opts.port, > SockOpts = R#connect_opts.opts, > case inet:open(Fd,BAddr,BPort,SockOpts,tcp,inet,?MODULE) of > % ... > > % > > fdopen(Fd, Opts) -> > inet:fdopen(Fd, Opts, tcp, inet, ?MODULE). > > Any suggestions? Is this a bug or am I doing something wrong? > > Thanks, > David > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From raimo+erlang-questions@REDACTED Mon Sep 3 09:50:16 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Mon, 3 Sep 2007 09:50:16 +0200 Subject: [erlang-questions] Trouble with gen_udp:fdopen In-Reply-To: <440abda90709021108t2a77196exc7b646c5ebcaf359@mail.gmail.com> References: <440abda90709021108t2a77196exc7b646c5ebcaf359@mail.gmail.com> Message-ID: <20070903075016.GA2174@erix.ericsson.se> You have found a bug. I changed the internals from using socket type to using protocol type sometime during R11, and thought I had found all calls, but apparently missed the ones in inet_udp.erl (and inet6_udp.erl). They should use the atom 'udp' instead of 'dgram'. It will be fixed in R12. A source patch is trivial. On Sun, Sep 02, 2007 at 12:08:23PM -0600, David Baird wrote: > Hi, > > I am using otp_src_R11B-5 and I have the following code: > > #!/usr/bin/env escript > main(Args) -> > io:fwrite("Args = ~p ~n", [Args]), > case Args of > [_, "-foofd", FDStr] -> > FD = erlang:list_to_integer(FDStr), > io:fwrite("FD = ~p ~n", [FD]), > Res = gen_udp:fdopen(FD, []), > io:fwrite("Res = ~p~n", [Res]) > end. > > When I execute the script using the suid "setuid_socket_wrap.c" > program (provided with the Erlang sources): > > /tmp/setuid_socket_wrap -d -foofd,:123 -- ./client.erl > > I get this result: > > Args = ["./client.erl","-foofd","3"] > FD = 3 > Res = {error,eprotonosupport} > > Does anyone know what is going on? I think the error is being raised > in "otp_src_R11B-5/lib/kernel/src/prim_inet.erl" (but I'm not 100% > sure): > > protocol2drv(tcp) -> tcp_inet; > protocol2drv(udp) -> udp_inet; > protocol2drv(sctp) -> sctp_inet; > protocol2drv(_) -> > erlang:error(eprotonosupport). > > I have a suspicion that it might be an incorrect atom ("dgram" instead > of "udp") in "otp_src_R11B-5/lib/kernel/src/inet_udp.erl:" > > open(Port, Opts) when Port >= 0, Port =< 16#ffff -> > case inet:udp_options( > [{port,Port}, {recbuf, ?RECBUF} | Opts], > inet) of > {error, Reason} -> exit(Reason); > {ok, R} -> > Fd = R#udp_opts.fd, > BAddr = R#udp_opts.ifaddr, > BPort = R#udp_opts.port, > SockOpts = R#udp_opts.opts, > inet:open(Fd,BAddr,BPort,SockOpts,udp,inet,?MODULE) % > <- good atom > end. > > % > > fdopen(Fd, Opts) -> > inet:fdopen(Fd, > optuniquify([{recbuf, ?RECBUF} | Opts]), > dgram, inet, ?MODULE). % <- bad atom here > > In "open," the "udp" atom is used as the Protocol (which matches > "protocol2drv(udp)" in "prim_inet.erl"). However, "fdopen" is using a > different atom: "dgram". I looked at "inet_tcp.erl" and it is > consistent, unlike "inet_udp.erl": > > do_connect({A,B,C,D}, Port, Opts, Time) when ?ip(A,B,C,D), > is_integer(Port) -> > case inet:connect_options(Opts, inet) of > {error, Reason} -> exit(Reason); > {ok, R} -> > Fd = R#connect_opts.fd, > BAddr = R#connect_opts.ifaddr, > BPort = R#connect_opts.port, > SockOpts = R#connect_opts.opts, > case inet:open(Fd,BAddr,BPort,SockOpts,tcp,inet,?MODULE) of > % ... > > % > > fdopen(Fd, Opts) -> > inet:fdopen(Fd, Opts, tcp, inet, ?MODULE). > > Any suggestions? Is this a bug or am I doing something wrong? > > Thanks, > David > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From dhbaird@REDACTED Mon Sep 3 10:17:09 2007 From: dhbaird@REDACTED (David Baird) Date: Mon, 3 Sep 2007 02:17:09 -0600 Subject: [erlang-questions] Trouble with gen_udp:fdopen In-Reply-To: <20070903075016.GA2174@erix.ericsson.se> References: <440abda90709021108t2a77196exc7b646c5ebcaf359@mail.gmail.com> <20070903075016.GA2174@erix.ericsson.se> Message-ID: <440abda90709030117x21fd2694k47437b96329ac319@mail.gmail.com> On 9/3/07, Raimo Niskanen wrote: > You have found a bug. > > I changed the internals from using socket type to using protocol type > sometime during R11, and thought I had found all calls, but > apparently missed the ones in inet_udp.erl (and inet6_udp.erl). > They should use the atom 'udp' instead of 'dgram'. > > It will be fixed in R12. A source patch is trivial. Cool! From tblachowicz@REDACTED Mon Sep 3 12:20:51 2007 From: tblachowicz@REDACTED (=?ISO-8859-2?Q?Tomasz_B=B3achowicz?=) Date: Mon, 3 Sep 2007 11:20:51 +0100 Subject: [erlang-questions] Intel Quad CPUs Message-ID: Hi, There is a bit of buzz around the erlang and its ability to utilize modern multicore CPUs. Can you confirm that erlang/OTP application should scale well if I deploy it on the machine equipped with new Intel Quad CPU? Should I expect nearly double performance gain in relation to Intel Duo CPU? Can you help my understand how the erlang way differs from other programming language/platforms approaches to this very important issue of these days? Kind Regards, Tom -------------- next part -------------- An HTML attachment was scrubbed... URL: From hughperkins@REDACTED Mon Sep 3 12:43:08 2007 From: hughperkins@REDACTED (Hugh Perkins) Date: Mon, 3 Sep 2007 18:43:08 +0800 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: References: Message-ID: <837db430709030343t766b7c48xd067dee9e8268153@mail.gmail.com> Almost on topic, what could be the benefits and the challenges of getting Erlang working on an nVidia Tesla card? These cards have between 8 and 128 cores, depending on how you look at it. (16 multiprocessors, each running warps of up to 32 threads, every 2 clock cycles). From zac@REDACTED Mon Sep 3 15:01:28 2007 From: zac@REDACTED (Zac Brown) Date: Mon, 03 Sep 2007 09:01:28 -0400 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: References: Message-ID: <46DC05A8.7010302@zacbrown.org> Tomasz B?achowicz wrote: > Hi, > > There is a bit of buzz around the erlang and its ability to utilize > modern multicore CPUs. Can you confirm that erlang/OTP application > should scale well if I deploy it on the machine equipped with new > Intel Quad CPU? Should I expect nearly double performance gain in > relation to Intel Duo CPU? Can you help my understand how the erlang > way differs from other programming language/platforms approaches to > this very important issue of these days? > > Kind Regards, > Tom > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions At some level you probably shouldn't expect "double" performance, there is something to be said for overhead and thread communication, though thats fairly minimal in erlang. In my experience, more often than not erlang can utilize your multiple processors just fine when initialize the vm with "-smp" flag. The issue at hand is not erlang's ability to utilize those processors, but rather your ability to write an algorithm that has no bottlenecks in it that can smash an parallel algo straight back to a serial algo. Assuming you have written such an algorithm, I would say you can optimistically expect between 1.5 and 1.75 times the performance going from dual core to quad core or from single core to dual core. As a side note, its often easier to notice the speed increase of an algorithm when you use multiple machines as opposed to multiple cores. Zac -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf.wiger@REDACTED Mon Sep 3 16:25:01 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Mon, 03 Sep 2007 16:25:01 +0200 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: References: Message-ID: <46DC193D.10504@ericsson.com> Tomasz B?achowicz wrote: > Hi, > > There is a bit of buzz around the erlang and its ability to utilize > modern multicore CPUs. Can you confirm that erlang/OTP application > should scale well if I deploy it on the machine equipped with new Intel > Quad CPU? Should I expect nearly double performance gain in relation to > Intel Duo CPU? Can you help my understand how the erlang way differs > from other programming language/platforms approaches to this very > important issue of these days? If you have an application with a significant number of processes executing concurrently with useful work, you will most likely be able to make good use of all the cores. The thing that sets Erlang apart is that it was built around concurrency from the start, and offers share- nothing concurrency with asynchronous message passing as a primary building block - not just as an afterthought. When I first came to Erlang (in 1992), I spent considerable time convincing myself that process-oriented modeling was every bit as powerful as OOM. At the time, I didn't fully appreciate the power of functional programming - nor was I familiar with Hoare's CSP: http://www.usingcsp.com/cspbook.pdf I was also a bit too enamored with OO in general. I'm over that now. There are other languages that offer powerful concurrency constructs: Haskell (GHC and GDH), Concurrent ML, Jocaml the E language, Termite, Mozart, ... but few can offer such a consistent focus on concurrency, nor such a large community dedicated to concurrency-oriented architectures. BR, Ulf W From tblachowicz@REDACTED Mon Sep 3 16:40:08 2007 From: tblachowicz@REDACTED (=?ISO-8859-2?Q?Tomasz_B=B3achowicz?=) Date: Mon, 3 Sep 2007 15:40:08 +0100 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <46DC193D.10504@ericsson.com> References: <46DC193D.10504@ericsson.com> Message-ID: On 9/3/07, Ulf Wiger (TN/EAB) wrote: > Tomasz B?achowicz wrote: > > Hi, > > > > There is a bit of buzz around the erlang and its ability to utilize > > modern multicore CPUs. Can you confirm that erlang/OTP application > > should scale well if I deploy it on the machine equipped with new Intel > > Quad CPU? Should I expect nearly double performance gain in relation to > > Intel Duo CPU? Can you help my understand how the erlang way differs > > from other programming language/platforms approaches to this very > > important issue of these days? > (...) > When I first came to Erlang (in 1992), I spent considerable > time convincing myself that process-oriented modeling was > every bit as powerful as OOM. At the time, I didn't fully > appreciate the power of functional programming - nor was > I familiar with Hoare's CSP: > > http://www.usingcsp.com/cspbook.pdf > > I was also a bit too enamored with OO in general. I'm over > that now. (...) This is what I'm trying to do, indeed. I'm trying convince myself that erlang way is worth further investigation. I've been Java/J2EE developer for years now and my mind is used to OO and shared memory concepts. In my case it is really hard to change well trained mind to start thinking in completely new way. It's really fascinating and beautiful process, though. This is why I ask those questions i.e. quad CPU question. I want to get practical proof the erlang apprach works. I just need the explanation and please don't laugh at me :D Regards, Tom From hughperkins@REDACTED Mon Sep 3 16:45:45 2007 From: hughperkins@REDACTED (Hugh Perkins) Date: Mon, 3 Sep 2007 22:45:45 +0800 Subject: [erlang-questions] user interface, xml, configuration files, reflection Message-ID: <837db430709030745g5b2f746es7d07c3fdea2909d3@mail.gmail.com> Erlang rocks. It makes a lot of things that are insanely hard in C# look trivial, ie threading, controlling distributed applications, updating distributed applications without restarting everything, message queuing across a network, etc ... There are some things that I'm used to being able to do in C#. What are the options for porting these to Erlang? They are: - user interface. Mostly I use a web interface, because it makes it easy to update, nothing to distribute to users' machines. Thoughts for user interfaces in Erlang? - xml and / or configuration files. In C# I store configuration in an xml file which I read at program start, and write as it changes. Reflection handles reading/writing to the xml file automatically - reflection. Reflection is *very* powerful. It takes a lot of the tedium out of programming, letting one concentrate on the interesting bits. What are the options for reflection in Erlang? The other stuff, Erlang rocks at. I'm a little wary of the lack of UTF-8, but it looks like it's in the pipe? As far as rpc, asking whether erlang can do rpc is like asking if eskimos have snow ;-) From rvirding@REDACTED Mon Sep 3 17:04:10 2007 From: rvirding@REDACTED (Robert Virding) Date: Mon, 3 Sep 2007 17:04:10 +0200 Subject: [erlang-questions] Is it worth commenting this guy? In-Reply-To: <3dbc6d1c0708280601u447395edr7a08110ea8796640@mail.gmail.com> References: <3dbc6d1c0708280601u447395edr7a08110ea8796640@mail.gmail.com> Message-ID: <3dbc6d1c0709030804t658db1e9iaade8d35090e0612@mail.gmail.com> As I commented earlier I won't bother to reply to him on his site, as everyone has said it isn't worth it. But I would like to comment one of his claims. He is extremely against algorithms and sequential languages because they are sequential. Even Erlang is too sequential for him as within each process things are done sequentially. Around the same time we were developing Erlang we were also looking at the parallel logic languages Parlog and Strand as one alternative language type to use. They are extremely parallel and communication between processes is easy using lazy lists. The trouble is that they are TOO parallel as everything, literally everything, every little computation, is a separate process. The world, however, even though it is parallel does expect things to happen in a certain order, so using these languages you had to work to sequentialise them so they did things in the right order. This was tedious and could easily lead to strange errors when you got it wrong. We found then, as now, that Erlang's level of parallelism is neither too hot nor too cold but just right. Just a little comment, Robert P.S. I must say that I liked playing with these languages and they were a lot of fun. I even did an implementation of Erlang in Strand using Strand as an "assembler language" to which Erlang was compiled. It worked but gave no benefit over the JAM. It's described in a Strand book. On 28/08/07, Robert Virding wrote: > > When scanning for references to Erlang I occasionally come across this > guy: > > http://rebelscience.blogspot.com/ > > He is advocating/developing a system called COSA and continually comparing > it to Erlang. While I appreciate the references I personally think he is a > bit bonkers and just not getting it. Do you think it is worth getting into a > discussion with him and try to correct him where he is wrong? Has anyone > tried? > > Robert > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From billclem@REDACTED Mon Sep 3 18:43:17 2007 From: billclem@REDACTED (Bill Clementson) Date: Mon, 03 Sep 2007 09:43:17 -0700 Subject: [erlang-questions] Emacs: Debugger buffer not showing program output References: Message-ID: Hi Vishnu, "Vishnu Gopal" writes: > Anybody? > > Vish > > On 9/2/07, Vishnu Gopal wrote: >> Hi! >> >> I'm trying to learn both Emacs and erlang (newbie to both so please be >> gentle). I installed Distel fine and managed to connect to an erlang >> node. Was trying out debugging when I noticed something odd. >> >> I start a debug session with C-c C-d i and set a breakpoint C-x SPC. >> And when I run the function in the shell, the debug process list >> window pops up. I type return on the correct process and a debugger >> buffer pops up. As far as I understand it to work, it should show the >> program in a read-only buffer: with the state of execution & >> breakpoints, and with variables at the bottom of the window. However I >> get a blank buffer: all the commands (n, SPC, q, h, etc.) seem to work >> fine though. I'm not sure if it's because I misunderstood how it's >> supposed to work, so here's a screenshot: >> >> http://vish.in/temp/emacs-debug.png >> >> Shouldn't it look something like this: >> http://bc.tech.coop/blog/images/distel2.jpg ? >> >> (I'm using Aquamacs btw, not sure if that makes a difference). >> >> It'd be great if somebody could help. Hmm, that's odd. From the screenshot, I see that you appear to be using Aquamacs's default one-buffer-one-frame setup. Try evaluating the following and re-trying: (setq smart-frame-positioning-mode nil one-buffer-one-frame-mode nil aquamacs-styles-mode nil) (You might need to put it in your .emacs file and restart Aquamacs) - Bill From hughperkins@REDACTED Mon Sep 3 18:39:34 2007 From: hughperkins@REDACTED (Hugh Perkins) Date: Tue, 4 Sep 2007 00:39:34 +0800 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: References: <46DC193D.10504@ericsson.com> Message-ID: <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> > This is what I'm trying to do, indeed. I'm trying convince myself that erlang way is worth further investigation. I've been Java/J2EE developer for years now and my mind is used to OO and shared memory concepts. In my case it is really hard to change well trained mind to start thinking in completely new way. It's really fascinating and beautiful process, though. Even in the absence of multicore CPUs, anything distributed really ought to rock in Erlang. I mean, I had a distributed application in C#, and it was just a nightmare to debug, maintain. OTP supervision, and the release system seems to address exactly the issues I wanted to solve. Also, rpc generally is a big time sink, and Erlang seems to make this pretty simple. The only bits that worry me slightly are: - the rather cavalier attitude to parameters, which is very evident when you call get_fun_info on a function exported from a module, and simply get told, well it takes 3 parameters. Yay! - UTF-8 support still limited There are a few nice-to-haves that would be, well, nice to have, like Reflection, and something like asp.net, but there are ways to cope with their absence. From taavi@REDACTED Mon Sep 3 18:09:58 2007 From: taavi@REDACTED (Taavi Talvik) Date: Mon, 3 Sep 2007 19:09:58 +0300 Subject: [erlang-questions] user interface, xml, configuration files, reflection In-Reply-To: <837db430709030745g5b2f746es7d07c3fdea2909d3@mail.gmail.com> References: <837db430709030745g5b2f746es7d07c3fdea2909d3@mail.gmail.com> Message-ID: On Sep 3, 2007, at 5:45 PM, Hugh Perkins wrote: > There are some things that I'm used to being able to do in C#. What > are the options for porting these to Erlang? They are: > > - user interface. Mostly I use a web interface, because it makes it > easy to update, nothing to distribute to users' machines. Thoughts > for user interfaces in Erlang? Probably thing erlang is missing is user interface builder for web (something like glide, or mac interface builder) which is integrated with erlang server side backend (yaws, yaws+ajax etc.). Backends are available - just shiny front is missing. > - xml and / or configuration files. In C# I store configuration in an > xml file which I read at program start, and write as it changes. > Reflection handles reading/writing to the xml file automatically Xml is overhyped - It's just putting things in angle brackets, after all. ;) Erlang file:consult/1, file:eval/2 and io:format/3 also accomplish reading-writing of structured information. Although no verification, but this is almost always application specific. Standard erlang application behaviour uses config files based on plain erlang terms. See app(4), application(3). In erlang you can store configuration in plain text file containing erlang data structures. > - reflection. Reflection is *very* powerful. It takes a lot of the > tedium out of programming, letting one concentrate on the interesting > bits. What are the options for reflection in Erlang? Behaviours and custom behaviours. Look for example http://ftp.csd.uu.se/pub/papers/masters-theses/0178-ekstrom.pdf paragraphs 7.2-7.6, behaviours for observer, communicator, tokenizer etc. best regards, taavi From gbulmer@REDACTED Tue Sep 4 00:01:05 2007 From: gbulmer@REDACTED (G Bulmer) Date: Mon, 3 Sep 2007 23:01:05 +0100 Subject: [erlang-questions] Intel Quad CPUs (NVIDIA Tesla & Tilera TILE64) In-Reply-To: References: Message-ID: > Date: Mon, 3 Sep 2007 18:43:08 +0800 > From: "Hugh Perkins" > Subject: Re: [erlang-questions] Intel Quad CPUs > > Almost on topic, what could be the benefits and the challenges of > getting Erlang working on an nVidia Tesla card? > > These cards have between 8 and 128 cores, depending on how you look at > it. (16 multiprocessors, each running warps of up to 32 threads, every > 2 clock cycles). I've been working with CUDA on NVIDIA 8800's, which is the same core technology as NVIDIA Tesla. I don't believe Erlang is a good fit for the underlying hardware. Erlang processes nicely map onto independent instruction streams. Erlang processes are control-stream oriented, and not data stream oriented (like 8800). An NVIDIA 8800GTX has 128 ALU's, but only concurrently executes 16 instruction streams, 1 per 'multi-processor' (8 ALU's/multi-processor). Threads and warps are an abstraction on top of the hardware created by the CUDA language and run-time to make it practical to extract the majority of the hardware performance. IMHO getting at the full 8800 performance relies on aligning with a few key hardware constraints and mechanisms: 1. All of the code on a multi-processor executes in lock-step; either all of the ALU's execute the same instruction, or a subset are idle (and you want to maximise the number of ALU's performing work). 2. Memory loads for ALU's must be to sequential addresses, to get at the full chip to memory bandwidth. 3. 'Shared' memory access should be sequential, and used a lot, to reach it's 1TB/second bandwidth 4. 'Texture memory' access should be 'spatially localised' to exploit caching. 5. 'Constant memory' access should be synchronised to exploit caching. 6. 'blocks' of computation should fit into the register set of a multi-processor. 7. Limited external communications - the 8800 rely on the host for network and disk IO, and the 'pipe' isn't as 'fat' as one might like (though fatter than GigEthernet). These are pretty low-level concepts, and I do not see any software- level (vanilla) Erlang support which could exploit these properties (we could add features like data-parallel Haskell to Erlang, of course) So, you could have Erlang, one process/multi-processor, and ignore 7 of the 8 ALU's, and ignore some of the hardware 'features'. I have no problem with that, it's just worth thinking through. I would hope that each 8800GTX would be within +/- 3x performance of an Intel quad core run in this way (Intel runs about 2x the ALU clock of a GTX, and each core of a Quad Core has multiple ALU's which an be exploited by ILP in hardware, and Quad Core's caching is managed below the instruction level, so it would 'just work'). IMHO, a Erlang processes on NVIDIA 8800/Tesla could be done (while ignore much of the specialised hardware), but NVIDIA haven't released full processor details, so we'd be restricted to programming in CUDA, or the PTX pseudo-assembler, with only partial information. So, it'd likely be noticeably slower than an Intel Quad Core for vanilla Erlang code. Having said all of that. I might be interested in having a crack at it ! IMHO, A much more interesting chip for Erlang is the Tilera TILE64: http://www.tilera.com/products/processors.php This seems like a very good fit; lots (64) of independent processors, with very high-speed mesh interconnect. If anyone would like to buy me a TILExpress-64 CARD (http://www.tilera.com/products/boards.php) I'd be very happy to investigate putting Erlang on that. Garry From bjt@REDACTED Tue Sep 4 06:24:44 2007 From: bjt@REDACTED (Benjamin Tolputt) Date: Tue, 04 Sep 2007 14:24:44 +1000 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: References: Message-ID: <46DCDE0C.9000504@pmp.com.au> I was wondering if anyone has actually made progress/headway into the "stand alone erlang" problem/feature? I am currently using Erlang for a variety of minor, yet high-concurrency tasks on our servers. I am currently looking into moving some of our more complex/CPU-intensive tasks to Erlang as well. And for these tasks, Erlang/CEAN/OTP distribution method is just fine (not my preferred, but that is only a matter of taste). However, I have been talking to a few busy individuals who (inspired by Tim Sweeney's latest talk) are looking at high-concurrency languages/executable frameworks for "client-side" game/simulation execution. They asked me which one I would recommend, and I (of course) mentioned Erlang. To which their immediate reply was "Yeah, it looks good - but the deployment is to much of a hassle for general game players". So I was wondering if I could impress them with some news on the Stand Alone Erlang front. In a related question, how easy is it to retrieve code/beams from non-file based sources (e.g. from an embedded native code database or zip file)? Thanks for any feedback you might have on this... B.J.Tolputt From jeff@REDACTED Tue Sep 4 09:15:41 2007 From: jeff@REDACTED (Jeff Hodges) Date: Tue, 4 Sep 2007 00:15:41 -0700 Subject: [erlang-questions] ei, erlang_interface, creation and deprecation Message-ID: Hey all, I've gone through the archives, but the search seems to be broken. I have two questions both concerning the ei library. The first question is, how should I be calculating the creation short that is passed to ei_connect_init (or erl_connect_xinit)? All of the code I've seen "in the wild" just set it 0 and move on, but the docs claim its used in case of node name collisions. So, what's the "right way" to get the creation number? The second is, is erl_interface still deprecated? I found a post from long ago[1] that mentioned that, but later ones mention that it and ei would be getting "cleaned up". None of the docs mention any of this. And the docs do not mention ei, much at all (no User Guide, for instance). I assume that the docs are just out of date and needing some love? Thanks for the help. [1] http://erlang.org/pipermail/erlang-questions/2003-August/ 009527.html -- Jeff From erlang@REDACTED Tue Sep 4 10:11:03 2007 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 4 Sep 2007 10:11:03 +0200 Subject: [erlang-questions] Tilera 64-core chip In-Reply-To: <71385.53197.qm@web38808.mail.mud.yahoo.com> References: <20070820214544.GF13839@wellquite.org> <71385.53197.qm@web38808.mail.mud.yahoo.com> Message-ID: <9b08084c0709040111q3d79c0e7r28dd86ecb0125684@mail.gmail.com> Does anybody know where one can buy the tile64 card? - the tilera web site has no on-line shop and a bit of googling did not find any suppliers. Who can I buy it from? - what does it cost? what is the delivery time? /Joe Armstrong On 8/23/07, Thomas Lindgren wrote: > > --- Matthew Sackman wrote: > > > On Mon, Aug 20, 2007 at 04:40:40PM +0200, Mikael > > Pettersson wrote: > > > On Mon, 20 Aug 2007 07:15:47 -0700 (PDT), Thomas > > Lindgren wrote: > > > > > Does anyone have experience with Tilera? > > > > > http://www.tilera.com/index.php > > > > It does seem to run Linux (in some sense, > > "supports" > > > > is a flexible word) so it can't be too exotic. > > That's > > > > good. I wonder what ISA the cores implement? > > MIPS? > > > > PPC? > > > > > > I had to look around quite a bit in their rather > > > superficial documentation before I found something > > > useful, but their compiler is based on SGI's > > MIPSpro, > > > so the ISA is probably MIPS. > > > > Turned up on El Reg today: > > > http://www.theregister.co.uk/2007/08/20/tilera_tile64_chip/ > > > > Anant Agarwal is the CTO ... in that case, this likely > is a continuation of the RAW project at MIT. > > http://www.cag.lcs.mit.edu/raw/ > > Best, > > Thomas > > > > > ____________________________________________________________________________________ > Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool. > http://autos.yahoo.com/carfinder/ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From dunceor@REDACTED Tue Sep 4 10:25:52 2007 From: dunceor@REDACTED (=?UTF-8?Q?Karl_Sj=C3=B6dahl_-_dunceor?=) Date: Tue, 4 Sep 2007 10:25:52 +0200 Subject: [erlang-questions] Tilera 64-core chip In-Reply-To: <9b08084c0709040111q3d79c0e7r28dd86ecb0125684@mail.gmail.com> References: <20070820214544.GF13839@wellquite.org> <71385.53197.qm@web38808.mail.mud.yahoo.com> <9b08084c0709040111q3d79c0e7r28dd86ecb0125684@mail.gmail.com> Message-ID: <5d84cb30709040125o263d7a26te7ca66cd7e1323bb@mail.gmail.com> I looked at this just for the fun of it also and only thing I can find about pricing is: "The Tile64 processor is available now in three different device variants based on frequency and I/O capabilities. Production pricing for the Tile64 family starts at $435 in 10,000 unit quantities." I can't find anything where to buy them though. BR Karl On 9/4/07, Joe Armstrong wrote: > Does anybody know where one can buy the tile64 card? - the tilera web > site has no > on-line shop and a bit of googling did not find any suppliers. > > Who can I buy it from? - what does it cost? what is the delivery time? > > /Joe Armstrong > > > On 8/23/07, Thomas Lindgren wrote: > > > > --- Matthew Sackman wrote: > > > > > On Mon, Aug 20, 2007 at 04:40:40PM +0200, Mikael > > > Pettersson wrote: > > > > On Mon, 20 Aug 2007 07:15:47 -0700 (PDT), Thomas > > > Lindgren wrote: > > > > > > Does anyone have experience with Tilera? > > > > > > http://www.tilera.com/index.php > > > > > It does seem to run Linux (in some sense, > > > "supports" > > > > > is a flexible word) so it can't be too exotic. > > > That's > > > > > good. I wonder what ISA the cores implement? > > > MIPS? > > > > > PPC? > > > > > > > > I had to look around quite a bit in their rather > > > > superficial documentation before I found something > > > > useful, but their compiler is based on SGI's > > > MIPSpro, > > > > so the ISA is probably MIPS. > > > > > > Turned up on El Reg today: > > > > > http://www.theregister.co.uk/2007/08/20/tilera_tile64_chip/ > > > > > > > Anant Agarwal is the CTO ... in that case, this likely > > is a continuation of the RAW project at MIT. > > > > http://www.cag.lcs.mit.edu/raw/ > > > > Best, > > > > Thomas > > > > > > > > > > ____________________________________________________________________________________ > > Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool. > > http://autos.yahoo.com/carfinder/ > > > > _______________________________________________ > > 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 chandrashekhar.mullaparthi@REDACTED Tue Sep 4 10:44:11 2007 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Tue, 4 Sep 2007 09:44:11 +0100 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> References: <46DC193D.10504@ericsson.com> <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> Message-ID: On 03/09/07, Hugh Perkins wrote: > > The only bits that worry me slightly are: > - the rather cavalier attitude to parameters, which is very evident > when you call get_fun_info on a function exported from a module, and > simply get told, well it takes 3 parameters. Yay! Well, it is an untyped language, so what else can it possibly return? cheers Chandru From chandrashekhar.mullaparthi@REDACTED Tue Sep 4 10:54:14 2007 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Tue, 4 Sep 2007 09:54:14 +0100 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: <46DCDE0C.9000504@pmp.com.au> References: <46DCDE0C.9000504@pmp.com.au> Message-ID: On 04/09/07, Benjamin Tolputt wrote: > So I was wondering if I could impress them with some news on the Stand > Alone Erlang front. In a related question, how easy is it to retrieve > code/beams from non-file based sources (e.g. from an embedded native > code database or zip file)? > code:load_binary/3 lets you load a module using a binary blob. This might be useful. cheers Chandru From bengt.kleberg@REDACTED Tue Sep 4 12:22:12 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 04 Sep 2007 12:22:12 +0200 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: References: <46DCDE0C.9000504@pmp.com.au> Message-ID: <46DD31D4.5030309@ericsson.com> It is easy to load a beam file from non-file based sources. i have a self-extracting-and-run-archive (i call it besea) that uses escript, if you are interested. bengt Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." On 2007-09-04 10:54, Chandru wrote: > On 04/09/07, Benjamin Tolputt wrote: >> So I was wondering if I could impress them with some news on the Stand >> Alone Erlang front. In a related question, how easy is it to retrieve >> code/beams from non-file based sources (e.g. from an embedded native >> code database or zip file)? >> > > code:load_binary/3 lets you load a module using a binary blob. This > might be useful. > > cheers > Chandru > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From hughperkins@REDACTED Tue Sep 4 15:14:26 2007 From: hughperkins@REDACTED (Hugh Perkins) Date: Tue, 4 Sep 2007 21:14:26 +0800 Subject: [erlang-questions] Tilera 64-core chip In-Reply-To: <5d84cb30709040125o263d7a26te7ca66cd7e1323bb@mail.gmail.com> References: <20070820214544.GF13839@wellquite.org> <71385.53197.qm@web38808.mail.mud.yahoo.com> <9b08084c0709040111q3d79c0e7r28dd86ecb0125684@mail.gmail.com> <5d84cb30709040125o263d7a26te7ca66cd7e1323bb@mail.gmail.com> Message-ID: <837db430709040614l175524c6p69feb96ad6eeed19@mail.gmail.com> I filled in Tilera's contact form, but no reply yet. From hughperkins@REDACTED Tue Sep 4 15:23:15 2007 From: hughperkins@REDACTED (Hugh Perkins) Date: Tue, 4 Sep 2007 21:23:15 +0800 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: References: <46DC193D.10504@ericsson.com> <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> Message-ID: <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> On 9/4/07, Chandru wrote: > On 03/09/07, Hugh Perkins wrote: > > > > The only bits that worry me slightly are: > > - the rather cavalier attitude to parameters, which is very evident > > when you call get_fun_info on a function exported from a module, and > > simply get told, well it takes 3 parameters. Yay! > > Well, it is an untyped language, so what else can it possibly return? That's the point. It's not something that can be added in a library later. It's an intrinsic part of the language specs. To be honest, I can live without the type being specified, but it would be good to be able to retrieve at least the parameter names. From hughperkins@REDACTED Tue Sep 4 16:04:27 2007 From: hughperkins@REDACTED (Hugh Perkins) Date: Tue, 4 Sep 2007 22:04:27 +0800 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <811f2f1c0709040643j7aece4efv9a85948359fa6cf4@mail.gmail.com> References: <46DC193D.10504@ericsson.com> <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <811f2f1c0709040643j7aece4efv9a85948359fa6cf4@mail.gmail.com> Message-ID: <837db430709040704h74efa8d0q24dda637427f94d4@mail.gmail.com> An anonymous reader writes: > I'm probably missing the point here (I'm new, be gentle), but what > would you have it return for functions that take a multitude of (same > arity, yet) wildly varying inputs; something like the following > contrived function? > > f([]) -> []; > f([H|T]) when H < 3 -> {low}; > f([A, B, C|Rest]) when C =:= {foo} -> [A|T]; > f(_) -> 42. > Yes, that is the challenge ;-) I dont have a good answer, but to show that it's not impossible, here's an example of one way of doing it: f :: ( StudentNames ); f(StudentNames@[]) -> []; f(StudentNames@[H|T]) when H < 3 -> {low}; f(StudentNames@[A, B, C|Rest]) when C =:= {foo} -> [A|T]; f(_StudentNames) -> 42. Basically, we optionally can declare the parameter names using "::". If we have chosen to declare the parameter names, then we must use the same parameter name in each pattern matching, otherwise we get a compilation error. For unused parameters, we prefix the name with an underscore. For compound parameters, such as lists, tuples or records, we use the "@" notation. From chsu79@REDACTED Tue Sep 4 16:09:37 2007 From: chsu79@REDACTED (Christian S) Date: Tue, 4 Sep 2007 16:09:37 +0200 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> References: <46DC193D.10504@ericsson.com> <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> Message-ID: > To be honest, I can live without the type being specified, but it > would be good to be able to retrieve at least the parameter names. Parameter names from which of the function clauses? I think the problem here is that you have a barrier towards using more development tools. We have dialyzer for types, we have edoc for quick reference. They are just not available easily from the shell in a comfortable one-liner. I suspect that anyone that leave the one-xterm-for-vi-one-xterm-for-erl-shell development environment for emacs also quickly lose interest in improving the shell. There is just so much to hack on and the immediate itch was scratched. From dot@REDACTED Tue Sep 4 16:19:47 2007 From: dot@REDACTED (Tony Finch) Date: Tue, 4 Sep 2007 15:19:47 +0100 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> References: <46DC193D.10504@ericsson.com> <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> Message-ID: On Tue, 4 Sep 2007, Hugh Perkins wrote: > > To be honest, I can live without the type being specified, but it > would be good to be able to retrieve at least the parameter names. Parameters don't have names, they have patterns. Tony. -- f.a.n.finch http://dotat.at/ IRISH SEA: SOUTHERLY, BACKING NORTHEASTERLY FOR A TIME, 3 OR 4. SLIGHT OR MODERATE. SHOWERS. MODERATE OR GOOD, OCCASIONALLY POOR. From peppe@REDACTED Tue Sep 4 16:23:19 2007 From: peppe@REDACTED (Peter Andersson) Date: Tue, 04 Sep 2007 16:23:19 +0200 Subject: [erlang-questions] ei, erlang_interface, creation and deprecation In-Reply-To: References: Message-ID: <46DD6A57.4060004@erix.ericsson.se> Hi Jeff, You choose the creation value yourself. There's no right or wrong way to do it. The problem the creation value is meant to solve is this: If a C node restarts and registers with the same node name, processes on the new node could be receiving messages that were sent to processes on the old node (if the identities/names of the processes are the same). If a C node is assigned a new creation value after restart, you can use this to verify that messages are really meant to be received by the current instance of the node. If you know this scenario can never happen in your system, you can "just set the creation to 0 and move on" as you've seen in the examples. Erl_interface isn't deprecated, but we always recommend the use of ei rather than erl_interface. The reason being that ei is more flexible and efficient. Erl_interface is perhaps more convenient to work with (slightly higher level), but ei is still the better interface. It's very unfortunate that the manual doesn't point out these things clearly (*) and I agree that since we recommend using ei, there really should be a user's guide. (For now, users have to read the erl_interface guide and translate the examples from erl_interface to ei). To give the docs some love and updates is on our to-do-list. (*) On the ei lib reference page: "The difference between |ei| and |erl_interface| is that |ei| uses the binary format directly when sending and receiving terms. It is also thread safe, and using threads, one process can handle multiple C-nodes". Peter Ericsson AB, Erlang/OTP Jeff Hodges wrote: > Hey all, > I've gone through the archives, but the search seems to be > broken. I have two questions both concerning the ei library. > > The first question is, how should I be calculating the creation > short that is passed to ei_connect_init (or erl_connect_xinit)? All > of the code I've seen "in the wild" just set it 0 and move on, but > the docs claim its used in case of node name collisions. So, what's > the "right way" to get the creation number? > > The second is, is erl_interface still deprecated? I found a post > from long ago[1] that mentioned that, but later ones mention that it > and ei would be getting "cleaned up". None of the docs mention any > of this. And the docs do not mention ei, much at all (no User Guide, > for instance). I assume that the docs are just out of date and > needing some love? > > Thanks for the help. > > [1] http://erlang.org/pipermail/erlang-questions/2003-August/ > 009527.html > -- > Jeff > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > From taavi@REDACTED Tue Sep 4 16:27:02 2007 From: taavi@REDACTED (Taavi Talvik) Date: Tue, 4 Sep 2007 17:27:02 +0300 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> References: <46DC193D.10504@ericsson.com> <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> Message-ID: On Sep 4, 2007, at 4:23 PM, Hugh Perkins wrote: > On 9/4/07, Chandru wrote: >> On 03/09/07, Hugh Perkins wrote: >>> >>> The only bits that worry me slightly are: >>> - the rather cavalier attitude to parameters, which is very evident >>> when you call get_fun_info on a function exported from a module, and >>> simply get told, well it takes 3 parameters. Yay! >> >> Well, it is an untyped language, so what else can it possibly return? > > That's the point. It's not something that can be added in a library > later. It's an intrinsic part of the language specs. > > To be honest, I can live without the type being specified, but it > would be good to be able to retrieve at least the parameter names. Hmm, strange wishes.. Parameter names are just for documentation purposes. function("abcd" ++ Rest) function([A,B,C,D|Rest]) function(List) function(_) All above are valid clause heads for function. It is quite hard to name all possible patterns consistently. However look at: Convention for type notation http://www.erlang.org/doc/apps/edoc/part_frame.html Tool for static verification using above notation http://www.erlang.org/doc/apps/dialyzer/index.html Beam files manipulations library - you get abstract code, if present in module http://erlang.org/doc/man/beam_lib.html Abstract format (even variable names are present) http://erlang.org/doc/apps/erts/absform.html best regards, taavi From chsu79@REDACTED Tue Sep 4 16:18:25 2007 From: chsu79@REDACTED (Christian S) Date: Tue, 4 Sep 2007 16:18:25 +0200 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <837db430709040704h74efa8d0q24dda637427f94d4@mail.gmail.com> References: <46DC193D.10504@ericsson.com> <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <811f2f1c0709040643j7aece4efv9a85948359fa6cf4@mail.gmail.com> <837db430709040704h74efa8d0q24dda637427f94d4@mail.gmail.com> Message-ID: 2007/9/4, Hugh Perkins : > f :: ( StudentNames ); > f(StudentNames@[]) -> []; > f(StudentNames@[H|T]) when H < 3 -> {low}; > f(StudentNames@[A, B, C|Rest]) when C =:= {foo} -> [A|T]; > f(_StudentNames) -> 42. We already have edoc for machine-extractable documentation, that would allow us to have something similar to lisp's documentation strings. From ulf.wiger@REDACTED Tue Sep 4 16:45:13 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Tue, 04 Sep 2007 16:45:13 +0200 Subject: [erlang-questions] ets:slot() on ordered_set Message-ID: <46DD6F79.9050707@ericsson.com> I had reason to look into the behaviour of ets:slot/2 on ordered_set tables. It's either really cool, or really bad, depending on what you want to do with it. The thing is that erl_db_tree.c caches the slot position from the previous operation, and the function db_slot() traverses the tree from the cached position to the new position. This is wonderful if the slot asked for is adjacent to the previous slot; otherwise - not so wonderful. Consider the sloppy benchmark below. It creates a table, and fills it with data. It then reads each slot, once in order, and once with the positions shuffled about. Eshell V5.5.5 (abort with ^G) 1> c(slots). {ok,slots} 2> slots:ordset(10). {1.70000,0.600000,2} 3> slots:ordset(100). {2.76000,0.550000,5} 4> slots:ordset(1000). {24.2180,0.533000,45} 5> slots:ordset(10000). {290.518,0.617900,470} The values are {TimeShuffled, TimeOrdered, Ratio}, and it's very obvious that jumping about using slot() in a large ordered_set table is a very bad idea. BR, Ulf W -module(slots). -compile(export_all). s([A|B],T) -> ets:slot(T, A), s(B,T); s([],_) -> ok. ordset(N) -> go(ordered_set,N). go(Type,N) -> T = ets:new(t,[Type]), L = lists:seq(1,N), [ets:insert(T, {N1}) || N1 <- lists:seq(1,N)], L1 = shuffle(L), {T1,ok} = timer:tc(?MODULE,s,[L1,T]), {T2,ok} = timer:tc(?MODULE,s,[L,T]), {T1/N, T2/N, T1 div T2}. shuffle(L) -> Mid = length(L) div 2, L1 = lists:sublist(L,1,Mid), L2 = lists:nthtail(Mid,L), splice(L1,lists:reverse(L2)). splice([H|T],[H1|T1]) -> [H,H1 | splice(T,T1)]; splice([],[H]) -> [H]; splice([H],[]) -> [H]; splice([], []) -> []. From sean.hinde@REDACTED Tue Sep 4 17:12:37 2007 From: sean.hinde@REDACTED (Sean Hinde) Date: Tue, 4 Sep 2007 16:12:37 +0100 Subject: [erlang-questions] ets:select bug Message-ID: <181413A7-72A5-4A5A-97AE-1BD03C65E806@gmail.com> Hi, We came across a bug in ets:select and related functions that can produce partial outputs. If you specify a chunk size as a multiple of 1000 you get the whole table, not just the chunk. Cue out of memory crash. 2 patches follow based on R9C-0. The second patch fixes our bug introduced by the first ;-) The fault still seems to appear in current releases. Sean diff -r -u otp_src_R9C-0-synapse-C7/erts/emulator/beam/erl_db_tree.c otp_src_R9C-0/erts/emulator/beam/erl_db_tree.c --- otp_src_R9C-0-synapse-C7/erts/emulator/beam/erl_db_tree.c 2007-05-18 16:59:53.000000000 -0700 +++ otp_src_R9C-0/erts/emulator/beam/erl_db_tree.c 2007-05-18 17:10:42.000000000 -0700 @@ -831,7 +831,7 @@ BUMP_REDS(p, 1000 - sc.max); - if (sc.max > 0) { + if (sc.max > 0 || sc.got == chunk_size) { if (chunk_size) { Eterm *hp; unsigned sz; @@ -1276,7 +1276,7 @@ } BUMP_REDS(p, 1000 - sc.max); - if (sc.max > 0) { + if (sc.max > 0 || sc.got == chunk_size) { Eterm *hp; unsigned sz; diff -u -r otp_src_R9C-0/erts/emulator/beam/erl_db_tree.c otp_src_R9C-0-new/erts/emulator/beam/erl_db_tree.c --- otp_src_R9C-0/erts/emulator/beam/erl_db_tree.c 2007-06-29 13:11:42.000000000 -0700 +++ otp_src_R9C-0-new/erts/emulator/beam/erl_db_tree.c 2007-06-29 12:57:25.000000000 -0700 @@ -831,7 +831,7 @@ BUMP_REDS(p, 1000 - sc.max); - if (sc.max > 0 || sc.got == chunk_size) { + if (sc.max > 0 || (chunk_size && sc.got == chunk_size)) { if (chunk_size) { Eterm *hp; unsigned sz; From kostis@REDACTED Tue Sep 4 17:23:37 2007 From: kostis@REDACTED (Kostis Sagonas) Date: Tue, 04 Sep 2007 17:23:37 +0200 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: References: <46DC193D.10504@ericsson.com> <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> Message-ID: <46DD7879.6090009@cs.ntua.gr> Taavi Talvik wrote: > ... > However look at: > > Convention for type notation > http://www.erlang.org/doc/apps/edoc/part_frame.html > > Tool for static verification using above notation > http://www.erlang.org/doc/apps/dialyzer/index.html This might be giving the wrong impression to some readers... Currently, dialyzer does NOT use any edoc information for finding type clashes. In fact, it most probably never will since we are designing a new language for describing type information which will not appear just in comments. Kostis From dougedmunds@REDACTED Tue Sep 4 17:35:56 2007 From: dougedmunds@REDACTED (Doug Edmunds) Date: Tue, 4 Sep 2007 08:35:56 -0700 Subject: [erlang-questions] sticky_directory Message-ID: I have the erlang mode working in emacs, but I am no emacs expert. If I load code then select erlang/compile buffer, an erlang buffer opens and compiles it file. First time, no problems. But *sometimes*, when I make changes, save them, then try to recompile in the same erlang buffer, I get this error report: =ERROR REPORT==== 4-Sep-2007::08:14:41 === Can't load module that resides in sticky dir {error,sticky_directory} I am not sure what a sticky_directory or how I triggered it. Mainly though, how do I get around this without closing and reopening emacs? Guidance, please. -dae -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthias@REDACTED Tue Sep 4 16:43:23 2007 From: matthias@REDACTED (Matthias Lang) Date: Tue, 4 Sep 2007 16:43:23 +0200 Subject: [erlang-questions] Tilera 64-core chip - full Linux on each core! In-Reply-To: <200708231648.02322.roger.larsson@norran.net> References: <200708201440.l7KEeeON001371@harpo.it.uu.se> <20070820214544.GF13839@wellquite.org> <200708231648.02322.roger.larsson@norran.net> Message-ID: <18141.28427.675007.78075@antilipe.corelatus.se> Roger Larsson writes: > http://www.videsignline.com/showArticle.jhtml?articleID=201801262 > > "Tilera's approach is straightforward. Its individual cores are full-fledged > general-purpose processors, each capable of running a symmetric > multiprocessing version of Linux. Each core also has an embedded switch for > linking to any of the other cores on the die connected on a mesh network." > > "Tilera's approach is unique in part because each of its cores has the > interrupt and cache structures needed to support a full operating system..." > > Sounds very interesting to try this chip out in interpreted mode. And > interpretion might prove better suited to cache limited architectures anyway. I sniffed around the site. It smells a bit vapourware-ish. Shipping CPUs always have pages and pages of silicon bugs. But not the Tilera. Maybe you get them from behind the secret login page. Also, compare the level of detail in their brief to one for a real, shipping product: http://www.tilera.com/pdf/ArchBrief_Arch_V1_Web.pdf http://focus.ti.com/lit/ug/spru197d/spru197d.pdf So they're being a bit shy about revealing details, though I did manage to find a bit more exposed on arse technica: http://arstechnica.com/articles/paedia/cpu/MIT-startup-raises-multicore-bar-with-new-64-core-CPU.ars which makes it sound more credible again. You never know. It does seem to be a good match for a language with relatively loosely coupled processes. Matthias From richardc@REDACTED Tue Sep 4 17:44:32 2007 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 04 Sep 2007 17:44:32 +0200 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: References: <46DC193D.10504@ericsson.com> <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <811f2f1c0709040643j7aece4efv9a85948359fa6cf4@mail.gmail.com> <837db430709040704h74efa8d0q24dda637427f94d4@mail.gmail.com> Message-ID: <46DD7D60.8070902@it.uu.se> Christian S wrote: > 2007/9/4, Hugh Perkins : >> f :: ( StudentNames ); >> f(StudentNames@[]) -> []; >> f(StudentNames@[H|T]) when H < 3 -> {low}; >> f(StudentNames@[A, B, C|Rest]) when C =:= {foo} -> [A|T]; >> f(_StudentNames) -> 42. > > We already have edoc for machine-extractable documentation, that would > allow us to have something similar to lisp's documentation strings. In case you haven't noticed, edoc does a pretty good job of looking at your clauses and extracting parameter names automatically, even if you have not written any @spec-declarations, or if you only put types in the @spec, as in "@spec (integer(), float()) -> atom()". In the following examples, edoc should select the parameter name Foo: f1(Foo) -> ... f2(42) -> ...; f2(Foo) -> ... f3([]) -> ...; f3(_Foo) -> ... % (or _foo) f4(#foo{...}) -> ... f5([Head | Foo]) -> ... (Before you ask - no, it won't choose the same name for two different parameters of the same function by accident. If it can't find a unique name from the hints in the patterns, it will generate a name like "X1".) I agree that it would be handy if the shell could report this, but that would require actually running edoc on all your code and building a dets table or similar, combined with an API for accessing the info. So there is definitely work for idle hands to do. Actually, I think that some parts of that might already be implemented in Distel. /Richard From qrilka@REDACTED Tue Sep 4 17:50:34 2007 From: qrilka@REDACTED (Kirill Zaborski) Date: Tue, 4 Sep 2007 19:50:34 +0400 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <46DD7879.6090009@cs.ntua.gr> References: <46DC193D.10504@ericsson.com> <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr> Message-ID: <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> On 9/4/07, Kostis Sagonas wrote: > > Taavi Talvik wrote: > > ... > > However look at: > > > > Convention for type notation > > http://www.erlang.org/doc/apps/edoc/part_frame.html > > > > Tool for static verification using above notation > > http://www.erlang.org/doc/apps/dialyzer/index.html > > This might be giving the wrong impression to some readers... > > Currently, dialyzer does NOT use any edoc information for finding type > clashes. > > In fact, it most probably never will since we are designing a new > language for describing type information which will not appear just in > comments. And that language will be not compatible with edoc? Maybe its better to combine them (edoc and your language)? Or I will have to write 2 different lines of comments describing the same types? Best regards, Kirill. -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardc@REDACTED Tue Sep 4 17:58:17 2007 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 04 Sep 2007 17:58:17 +0200 Subject: [erlang-questions] sticky_directory In-Reply-To: References: Message-ID: <46DD8099.9000707@it.uu.se> Doug Edmunds wrote: > I have the erlang mode working in emacs, but I am no > emacs expert. > > If I load code then select > erlang/compile buffer, an erlang buffer opens and > compiles it file. First time, no problems. > > But *sometimes*, when I make changes, save them, then > try to recompile in the same erlang buffer, > I get this error report: > > =ERROR REPORT==== 4-Sep-2007::08:14:41 === > Can't load module that resides in sticky dir > {error,sticky_directory} > > I am not sure what a sticky_directory or how I triggered it. > Mainly though, how do I get around this without closing > and reopening emacs? Some library paths (.../ebin/) are marked "sticky" by the Erlang emulator, which means that modules whose .beam object files were originally loaded from those directories are prevented from being reloaded by mistake (without "unsticking" them explicitly). You are probably just trying to use a module name that is already being used for some important system module (lists.erl is an old favourite). Be glad that it did not load your version instead. If you want to check whether a module name is already in use, you can call code:which(Module) from the Erlang shell. /Richard From dougedmunds@REDACTED Tue Sep 4 18:09:33 2007 From: dougedmunds@REDACTED (Doug Edmunds) Date: Tue, 4 Sep 2007 09:09:33 -0700 Subject: [erlang-questions] sticky_directory In-Reply-To: <46DD8099.9000707@it.uu.se> References: <46DD8099.9000707@it.uu.se> Message-ID: Thanks, that was it. I was trying some code in the "Concurrent Programming in Erlang" pdf listed on http://www.erlang.org/download.html. The sample module (on page 77) is called "timer", which apparent rubs shoulders with "timer" in the stdlib. I changed the module name to "mytimer" and the problem has gone away You are probably just trying to use a module name that is already > being used for some important system module (lists.erl is an old > favourite). Be glad that it did not load your version instead. > > /Richard > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From peter@REDACTED Tue Sep 4 18:26:19 2007 From: peter@REDACTED (Peter K Chan) Date: Tue, 4 Sep 2007 18:26:19 +0200 Subject: [erlang-questions] How to file bug for obsolete reference in email package? Message-ID: I installed the email package using CEAN, and I noticed that the actual send command uses unix:cmd, which no longer exists in recent distribution of Erlang. I changed it to os:cmd and it ran fine. It doesn't look like the email package, authored by Joe Armstrong, has been updated in the past 10 years. It's a simple 3-character change. Who and where should I file the bug for this? Do I file it at CEAN or do I email Joe? Peter From bjorn@REDACTED Tue Sep 4 18:43:48 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 04 Sep 2007 18:43:48 +0200 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> References: <46DC193D.10504@ericsson.com> <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> Message-ID: "Kirill Zaborski" writes: > On 9/4/07, Kostis Sagonas wrote: > > > > In fact, it most probably never will since we are designing a new > > language for describing type information which will not appear just in > > comments. > > > And that language will be not compatible with edoc? > Maybe its better to combine them (edoc and your language)? They will be combined at some point in the future, so that you will only have to write one type specification. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From kostis@REDACTED Tue Sep 4 19:08:21 2007 From: kostis@REDACTED (Kostis Sagonas) Date: Tue, 04 Sep 2007 19:08:21 +0200 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> References: <46DC193D.10504@ericsson.com> <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> Message-ID: <46DD9105.4050901@cs.ntua.gr> Kirill Zaborski wrote: > > > On 9/4/07, *Kostis Sagonas* > wrote: > > Currently, dialyzer does NOT use any edoc information for finding type > clashes. > > In fact, it most probably never will since we are designing a new > language for describing type information which will not appear just in > comments. > > > And that language will be not compatible with edoc? > Maybe its better to combine them (edoc and your language)? Well, the two languages are of course closely related and could in principle be combined, but currently there are some differences between them. Edoc's language is just comments after all; the new one will have to be accepted by the Erlang parser. To give you an idea, in edoc you currently write something of the form: %% @spec (integer(), float()) -> atom() to describe the types of a function foo. In the new language you would write (or preferably change the above edoc comment to be): -spec(foo/2 :: ((integer(), float()) -> atom())). > Or I will have to write 2 different lines of comments describing the > same types? The idea is that you would not have to write comments anymore. Doesn't this sound wonderful? :-) Humor aside, the point is: comments are dangerous because they suffer from code rot; type information integrated in the language will most probably not: its compatibility with the code will be checked. Kostis From gbulmer@REDACTED Tue Sep 4 19:34:54 2007 From: gbulmer@REDACTED (G Bulmer) Date: Tue, 4 Sep 2007 18:34:54 +0100 Subject: [erlang-questions] Tilera 64-core chip Message-ID: <74E63A8C-7CDD-493B-85E9-EBB33FF08C3C@gmail.com> I have filled in the web-forms yesterday, and telephoned Tilera several times today, but I haven't had a response. I have a potential commercial application, so I'm keen to get prices on the board. Other interesting comments from someone who (says they) worked on RAW are here: http://realworldtech.com/forums/index.cfm? action=detail&id=82137&threadid=82135&roomid=2 they identify several possible weaknesses (though memory is the main one that might effect my application). This person notes some of the weaknesses of RAW, and the apparent improvements. It may be quite complex to use, depends on their software development tools. GB From hubaghdadi@REDACTED Tue Sep 4 19:43:27 2007 From: hubaghdadi@REDACTED (Lone Wolf) Date: Tue, 4 Sep 2007 10:43:27 -0700 (PDT) Subject: [erlang-questions] Erlide is not working Message-ID: <285694.22761.qm@web51110.mail.re2.yahoo.com> Hi. I have the latest Eclipse version (Europa) installed on my system and I got the latest Erlide version available. But when trying to create an Erlang project, I got the following error: The selected wizard could't be started. Plug-in org.erlide.ui was unable to load class org.erlide.ui.wizards.NewErlangProject Any ideas? Thanks. Deep into that darkness peering, long I stood there, wondering, fearing, Doubting, dreaming dreams no mortal ever dreamed before. E.A Poe --------------------------------- Luggage? GPS? Comic books? Check out fitting gifts for grads at Yahoo! Search. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rsaccon@REDACTED Tue Sep 4 19:55:16 2007 From: rsaccon@REDACTED (Roberto Saccon) Date: Tue, 4 Sep 2007 14:55:16 -0300 Subject: [erlang-questions] Tilera 64-core chip In-Reply-To: <74E63A8C-7CDD-493B-85E9-EBB33FF08C3C@gmail.com> References: <74E63A8C-7CDD-493B-85E9-EBB33FF08C3C@gmail.com> Message-ID: Here is my experience: after reading Ulf's initial post I filled out the contact form at their website and asked for price and purchase proceedings for a single evaluation board. Yesterday I got a response from sales@REDACTED apologizing for the delay and asking questions I already had answered in that contact form, e.g.: you want a chip or a turnkey solution ... I guess it's just vaporware now, beside of a few prototypes .. On 9/4/07, G Bulmer wrote: > I have filled in the web-forms yesterday, and telephoned Tilera > several times today, but I haven't had a response. I have a potential > commercial application, so I'm keen to get prices on the board. > > Other interesting comments from someone who (says they) worked on RAW > are here: > http://realworldtech.com/forums/index.cfm? > action=detail&id=82137&threadid=82135&roomid=2 > they identify several possible weaknesses (though memory is the main > one that might effect my application). > > This person notes some of the weaknesses of RAW, and the apparent > improvements. It may be quite complex to use, depends on their > software development tools. > > GB > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Roberto Saccon http://rsaccon.com From qrilka@REDACTED Tue Sep 4 20:20:19 2007 From: qrilka@REDACTED (Kirill Zaborski) Date: Tue, 4 Sep 2007 22:20:19 +0400 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <46DD9105.4050901@cs.ntua.gr> References: <46DC193D.10504@ericsson.com> <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> <46DD9105.4050901@cs.ntua.gr> Message-ID: <337538cb0709041120k23ae74c4ga8de2440ef92ce7a@mail.gmail.com> On 9/4/07, Kostis Sagonas wrote: > > Kirill Zaborski wrote: > > > Or I will have to write 2 different lines of comments describing the > > same types? > > The idea is that you would not have to write comments anymore. Doesn't > this sound wonderful? :-) > > Humor aside, the point is: comments are dangerous because they suffer > from code rot; type information integrated in the language will most > probably not: its compatibility with the code will be checked. Wow it looks quite promising to me. And when it is planned for? Will there be an EEP for it? Best regards, Kirill. -------------- next part -------------- An HTML attachment was scrubbed... URL: From hubaghdadi@REDACTED Tue Sep 4 19:42:28 2007 From: hubaghdadi@REDACTED (Lone Wolf) Date: Tue, 4 Sep 2007 10:42:28 -0700 (PDT) Subject: [erlang-questions] What is wrong with this list? Message-ID: <764345.64386.qm@web51101.mail.re2.yahoo.com> Hi. I have been trying this statement: 2> [java | python] = [1, 2, 3, 4, 5, 6]. But I got the following error: =ERROR REPORT==== 4-Sep-2007::17:45:07 === Error in process <0.33.0> with exit value: {{badmatch,[1,2,3,4,5,6]},[{erl_eval, expr,3}]} Why? How to read Erlang errors? they are really obfuscated. Thank. Deep into that darkness peering, long I stood there, wondering, fearing, Doubting, dreaming dreams no mortal ever dreamed before. E.A Poe --------------------------------- Park yourself in front of a world of choices in alternative vehicles. Visit the Yahoo! Auto Green Center. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rsaccon@REDACTED Tue Sep 4 20:52:35 2007 From: rsaccon@REDACTED (Roberto Saccon) Date: Tue, 4 Sep 2007 15:52:35 -0300 Subject: [erlang-questions] What is wrong with this list? In-Reply-To: <764345.64386.qm@web51101.mail.re2.yahoo.com> References: <764345.64386.qm@web51101.mail.re2.yahoo.com> Message-ID: In your example, java and python are atoms and not variables. On 9/4/07, Lone Wolf wrote: > Hi. > I have been trying this statement: > 2> [java | python] = [1, 2, 3, 4, 5, 6]. > But I got the following error: > =ERROR REPORT==== 4-Sep-2007::17:45:07 === > Error in process <0.33.0> with exit value: > {{badmatch,[1,2,3,4,5,6]},[{erl_eval, > expr,3}]} > Why? > How to read Erlang errors? they are really obfuscated. > Thank. > > > > Deep into that darkness peering, long I stood there, wondering, fearing, > Doubting, dreaming dreams no mortal ever dreamed before. > E.A Poe > > > > ________________________________ > Park yourself in front of a world of choices in alternative vehicles. > Visit the Yahoo! Auto Green Center. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Roberto Saccon http://rsaccon.com From dking@REDACTED Tue Sep 4 20:54:51 2007 From: dking@REDACTED (David King) Date: Tue, 4 Sep 2007 11:54:51 -0700 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: References: <46DC193D.10504@ericsson.com> <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> Message-ID: >>> In fact, it most probably never will since we are designing a new >>> language for describing type information which will not appear >>> just in >>> comments. >> And that language will be not compatible with edoc? >> Maybe its better to combine them (edoc and your language)? > They will be combined at some point in the future, so that you will > only have to write one type specification. Can you give is a quick preview of what that will look like (with the understanding that it's underway and may not be static)? From dking@REDACTED Tue Sep 4 20:58:11 2007 From: dking@REDACTED (David King) Date: Tue, 4 Sep 2007 11:58:11 -0700 Subject: [erlang-questions] What is wrong with this list? In-Reply-To: <764345.64386.qm@web51101.mail.re2.yahoo.com> References: <764345.64386.qm@web51101.mail.re2.yahoo.com> Message-ID: <5CFE1BDB-C705-4D1B-A5F3-7691EBD43148@ketralnis.com> > Hi. > I have been trying this statement: > 2> [java | python] = [1, 2, 3, 4, 5, 6]. Variable names must begin with a capital letter, like 1> [Java | Python] = [1,2,3,4,5,6]. [1,2,3,4,5,6] 2> Java. 1 3> Python. [2,3,4,5,6] > But I got the following error: > =ERROR REPORT==== 4-Sep-2007::17:45:07 === > Error in process <0.33.0> with exit value: {{badmatch, > [1,2,3,4,5,6]},[{erl_eval, > expr,3}]} > Why? > How to read Erlang errors? they are really obfuscated. In that case, badmatch means that the pattern [java | python] (a list with an atom in the head and an atom in the tail) did not match the pattern [1,2,3,4,5,6] (a list with six integers and an empty list in the tail) From dustin@REDACTED Tue Sep 4 21:05:13 2007 From: dustin@REDACTED (Dustin Sallings) Date: Tue, 4 Sep 2007 12:05:13 -0700 Subject: [erlang-questions] What is wrong with this list? In-Reply-To: <764345.64386.qm@web51101.mail.re2.yahoo.com> References: <764345.64386.qm@web51101.mail.re2.yahoo.com> Message-ID: <2D4C450E-36A4-4956-881F-518812719F4A@spy.net> On Sep 4, 2007, at 10:42 , Lone Wolf wrote: > I have been trying this statement: > 2> [java | python] = [1, 2, 3, 4, 5, 6]. > But I got the following error: > =ERROR REPORT==== 4-Sep-2007::17:45:07 === > Error in process <0.33.0> with exit value: {{badmatch, > [1,2,3,4,5,6]},[{erl_eval, > expr,3}]} > Why? > How to read Erlang errors? they are really obfuscated. I wouldn't say they're obfuscated. This is actually a quite useful error. It's showing you the value you were trying to pattern match against and telling you your match failed. Regarding your statement, it's not clear what you expect it to do. If you capitalize java and python (i.e. make them variables instead of atoms), then it'd leave you with the values 1 and [2,3,4,5,6] for Java and Python respectively. Otherwise, it's just going to tell you that that list doesn't equal a two element list where the first element is the atom ``java'' and the second is the atom ``python.'' -- Dustin Sallings -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Tue Sep 4 21:18:59 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 4 Sep 2007 19:18:59 +0000 Subject: [erlang-questions] Erlide is not working In-Reply-To: <285694.22761.qm@web51110.mail.re2.yahoo.com> References: <285694.22761.qm@web51110.mail.re2.yahoo.com> Message-ID: <95be1d3b0709041218n2303f700r21548dcb199a5a17@mail.gmail.com> Hi, On 9/4/07, Lone Wolf wrote: > > Hi. > I have the latest Eclipse version (Europa) installed on my system and > I got the latest Erlide version available. > But when trying to create an Erlang project, I got the following error: > The selected wizard could't be started. > Plug-in org.erlide.ui was unable to load class > org.erlide.ui.wizards.NewErlangProject > Any ideas? The best place to ask erlide questions is on the erlide-devel@REDACTED Please attach info about your platform (OS, Java version) and an Eclipse log so that I can see what is going on. The first suspect would be that the Erlang node that powers erlide doesn't start properly. best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.hopwood@REDACTED Tue Sep 4 22:05:27 2007 From: david.hopwood@REDACTED (David Hopwood) Date: Tue, 04 Sep 2007 21:05:27 +0100 Subject: [erlang-questions] What is wrong with this list? In-Reply-To: <2D4C450E-36A4-4956-881F-518812719F4A@spy.net> References: <764345.64386.qm@web51101.mail.re2.yahoo.com> <2D4C450E-36A4-4956-881F-518812719F4A@spy.net> Message-ID: <46DDBA87.5020901@industrial-designers.co.uk> Dustin Sallings wrote: > On Sep 4, 2007, at 10:42 , Lone Wolf wrote: > >> I have been trying this statement: >> 2> [java | python] = [1, 2, 3, 4, 5, 6]. >> But I got the following error: >> =ERROR REPORT==== 4-Sep-2007::17:45:07 === >> Error in process <0.33.0> with exit value: >> {{badmatch,[1,2,3,4,5,6]},[{erl_eval, >> expr,3}]} >> Why? >> How to read Erlang errors? they are really obfuscated. > > I wouldn't say they're obfuscated. This is actually a quite useful > error. It's showing you the value you were trying to pattern match > against and telling you your match failed. I'm afraid it *is* obfuscated, compared to stack traces typically produced by other languages. It also doesn't contain enough information for debugging: ideally you would want both sides of the failed pattern match. (In this particular case, that probably wouldn't have helped the OP, because the problem was a misunderstanding of the syntax of identifiers and atoms, and "[java | python]" in the error report would probably been misunderstood in the same way. But it would help in many other cases.) > Regarding your statement, it's not clear what you expect it to do. > If you capitalize java and python (i.e. make them variables instead of > atoms), then it'd leave you with the values 1 and [2,3,4,5,6] for Java > and Python respectively. Otherwise, it's just going to tell you that > that list doesn't equal a two element list where the first element is > the atom ``java'' and the second is the atom ``python.'' Nitpick: it doesn't equal an improper list whose head is the atom ``java'' and whose tail is the (non-list) atom ``python''. Hmm -- aren't improper lists almost always an error? Why are they allowed? (Static typing isn't needed to prevent them, and the performance argument against checking that each tail is a cons cell or nil is weak; it is an O(1) tag check that can often be optimized out.) -- David Hopwood From dbt@REDACTED Tue Sep 4 22:24:14 2007 From: dbt@REDACTED (David Terrell) Date: Tue, 4 Sep 2007 15:24:14 -0500 Subject: [erlang-questions] What is wrong with this list? In-Reply-To: <46DDBA87.5020901@industrial-designers.co.uk> References: <764345.64386.qm@web51101.mail.re2.yahoo.com> <2D4C450E-36A4-4956-881F-518812719F4A@spy.net> <46DDBA87.5020901@industrial-designers.co.uk> Message-ID: <20070904202414.GB26973@sphinx.chicagopeoplez.org> On Tue, Sep 04, 2007 at 09:05:27PM +0100, David Hopwood wrote: > Hmm -- aren't improper lists almost always an error? Why are they allowed? > (Static typing isn't needed to prevent them, and the performance argument > against checking that each tail is a cons cell or nil is weak; it is an > O(1) tag check that can often be optimized out.) There was discussion last week about how binaries are allowed in the tail of an iolist, i.e. list_to_binary(["abc" | <<"def">>]) is valid. Your question is still a good one, though :) -- David Terrell dbt@REDACTED ((meatspace)) http://meat.net/ From dustin@REDACTED Tue Sep 4 22:28:09 2007 From: dustin@REDACTED (Dustin Sallings) Date: Tue, 4 Sep 2007 13:28:09 -0700 Subject: [erlang-questions] What is wrong with this list? In-Reply-To: <46DDBA87.5020901@industrial-designers.co.uk> References: <764345.64386.qm@web51101.mail.re2.yahoo.com> <2D4C450E-36A4-4956-881F-518812719F4A@spy.net> <46DDBA87.5020901@industrial-designers.co.uk> Message-ID: <3EE11514-F66E-4D6A-9E38-237DE7D1AD50@spy.net> On Sep 4, 2007, at 13:05 , David Hopwood wrote: > I'm afraid it *is* obfuscated, compared to stack traces typically > produced > by other languages. It also doesn't contain enough information for > debugging: ideally you would want both sides of the failed pattern > match. You're not going to get a very useful stack from something entered interactively in any language: >>> {}[1] Traceback (most recent call last): File "", line 1, in ? KeyError: 1 That looks very similar to me to 1> 0 = 1. ** exited: {{badmatch,1},[{erl_eval,expr,3}]} ** I'd do a java case, too, but I'm trying to keep this email short. All three roughly do the same thing. They tell you your input was wrong. If you're somewhere within code, they tell you about where you were. They very rarely tell you about what your input was trying to match (e.g. the python dict match doesn't show me the dict). -- Dustin Sallings From peter@REDACTED Tue Sep 4 22:29:37 2007 From: peter@REDACTED (Peter K Chan) Date: Tue, 4 Sep 2007 22:29:37 +0200 Subject: [erlang-questions] What is wrong with this list? In-Reply-To: <2D4C450E-36A4-4956-881F-518812719F4A@spy.net> References: <764345.64386.qm@web51101.mail.re2.yahoo.com> <2D4C450E-36A4-4956-881F-518812719F4A@spy.net> Message-ID: I think it would be nice if the compiler can output why a match fails (e.g. {number, 1} does not equal {atom, java}). When I first started learning Erlang, I was being killed by all sorts of badmatch error, mostly because I forgot that variables need to have capitalized names. Now that I am slightly more experienced, I am not confused anymore, but I am very sympathetic to people just starting the language. After all, to diagnose this error, you must be comfortable with both pattern matching and the fact that variables have to be Capitalized (a simple fact, but one that does not come to mind easily when you are starting to learn a language). Peter From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Dustin Sallings Sent: Tuesday, September 04, 2007 2:05 PM To: Lone Wolf Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] What is wrong with this list? On Sep 4, 2007, at 10:42 , Lone Wolf wrote: I have been trying this statement: 2> [java | python] = [1, 2, 3, 4, 5, 6]. But I got the following error: =ERROR REPORT==== 4-Sep-2007::17:45:07 === Error in process <0.33.0> with exit value: {{badmatch,[1,2,3,4,5,6]},[{erl_eval, expr,3}]} Why? How to read Erlang errors? they are really obfuscated. I wouldn't say they're obfuscated. This is actually a quite useful error. It's showing you the value you were trying to pattern match against and telling you your match failed. Regarding your statement, it's not clear what you expect it to do. If you capitalize java and python (i.e. make them variables instead of atoms), then it'd leave you with the values 1 and [2,3,4,5,6] for Java and Python respectively. Otherwise, it's just going to tell you that that list doesn't equal a two element list where the first element is the atom ``java'' and the second is the atom ``python.'' -- Dustin Sallings -------------- next part -------------- An HTML attachment was scrubbed... URL: From dustin@REDACTED Tue Sep 4 23:47:05 2007 From: dustin@REDACTED (Dustin Sallings) Date: Tue, 4 Sep 2007 14:47:05 -0700 Subject: [erlang-questions] What is wrong with this list? In-Reply-To: References: <764345.64386.qm@web51101.mail.re2.yahoo.com> <2D4C450E-36A4-4956-881F-518812719F4A@spy.net> Message-ID: On Sep 4, 2007, at 13:29 , Peter K Chan wrote: > I think it would be nice if the compiler can output why a match > fails (e.g. {number, 1} does not equal {atom, java}). This could work as an error string along with the badmatch for the single case discussed, but what about a case (that is contrived, but probably similar to real code I've written somewhere) like this: Pid = some_function(), Pid = other_function(). The error message wouldn't be all that useful to you either way because on the first line you're capturing a value into a variable, and on the second line you're validating the same Pid is returned. If it showed you the value, it'd probably be meaningless to you. It would basically be showing you two different values and saying they're not the same. You have the same issue in a case, receive, function definition, etc... for which you have no matching case. You don't want to list every possible pattern. -- Dustin Sallings -------------- next part -------------- An HTML attachment was scrubbed... URL: From peter@REDACTED Wed Sep 5 00:26:58 2007 From: peter@REDACTED (Peter K Chan) Date: Wed, 5 Sep 2007 00:26:58 +0200 Subject: [erlang-questions] What is wrong with this list? In-Reply-To: References: <764345.64386.qm@web51101.mail.re2.yahoo.com> <2D4C450E-36A4-4956-881F-518812719F4A@spy.net> Message-ID: Dustin, As someone who has known Erlang for a while, the error message would probably not be helpful (if even possible). But as a newbie, knowing the difference between an assignment and a match can be very helpful. Actually, if the bad match comes from some deep recursion, I think I would appreciate seeing the actual value, even if I know what badmatches in general are. I do agree that the current error message gives out enough information for debugging purpose, but having seen, more than once, where someone is confused about the matching vs. assignment, I think the more explicit error message would be "nice" to have. Peter From: Dustin Sallings [mailto:dustin@REDACTED] Sent: Tuesday, September 04, 2007 4:47 PM To: Peter K Chan Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] What is wrong with this list? On Sep 4, 2007, at 13:29 , Peter K Chan wrote: I think it would be nice if the compiler can output why a match fails (e.g. {number, 1} does not equal {atom, java}). This could work as an error string along with the badmatch for the single case discussed, but what about a case (that is contrived, but probably similar to real code I've written somewhere) like this: Pid = some_function(), Pid = other_function(). The error message wouldn't be all that useful to you either way because on the first line you're capturing a value into a variable, and on the second line you're validating the same Pid is returned. ?If it showed you the value, it'd probably be meaningless to you. ?It would basically be showing you two different values and saying they're not the same. You have the same issue in a case, receive, function definition, etc... for which you have no matching case. ?You don't want to list every possible pattern. --? Dustin Sallings From dking@REDACTED Wed Sep 5 01:30:33 2007 From: dking@REDACTED (David King) Date: Tue, 4 Sep 2007 16:30:33 -0700 Subject: [erlang-questions] gen_server and multiple workers In-Reply-To: <047C6550-339F-4D5E-BBC4-621A80570319@ketralnis.com> References: <047C6550-339F-4D5E-BBC4-621A80570319@ketralnis.com> Message-ID: Thank you Paul for your advice; I was able to get this working. I wrote a generic implementation of an N-worker supervisor/gen_server that uses an external (Perl) program, and a how-to with the relevent code (http://www.ketralnis.com/roller/dking/entry/20070903) if anyone wants a copy of it. On 30 Aug 2007, at 10:09, David King wrote: >> You could create multiple gen_servers and instead of registering >> their pids (using start_link/4) instead keep them anonymous (using >> start_link/3) and then have them joined a named process group (using >> pg2:join/2) and then issue requests using pg2:get_closest_pid/1. > > That sounds like exactly what I want. Does pg2:get_closest_pid/1 > handle balancing, or will it return the same PID every time it's > called from a given machine? (The documentation is not clear on > this.) Is a named process group accessible from any machine in a > cluster? > > Thanks for getting back to me so quickly, by the way! > >> On Thu, 30 Aug 2007, David King wrote: >> >>> I imagine that this is a problem that has been solved a hundred >>> times >>> and that I just don't have the right search terms :) >>> >>> I need to communicate with an outside program, for which I'm using a >>> port and a gen_server. However, I may be getting many requests for >>> communication to this port at a time, and I don't want to >>> introduce a >>> bottleneck in the gen_server, nor do I want to fork() a new instance >>> of the program for every request. So I think I'd like to have >>> several >>> workers, where each request grabs an available worker (blocking >>> until >>> one is available), ideally with some place to put logic to expand or >>> reduce the size of the worker-pool with load, but that's optional. >>> Having several copies of the external program open at a time isn't a >>> problem (it's just a text-transform done by a Perl program). >>> >>> My gen_server doesn't keep any state except for the Port, so that >>> could be managed another way. It seems that I can't combine this >>> with >>> gen_server, as gen_server seems to want to register() its PID, and I >>> can't have multiple workers with the same register()ed name. >>> >>> I have a supervisor watching the gen_server. supervisor's required >>> export init/1 returns (among other things) a list of processes to >>> enter the supervision, but it just calls start_link on the >>> gen_server, which registers its name. >>> >>> I could have the worker-pool managed by the single gen_server >>> instance, but I'd like them to be able to crash independently, >>> and it >>> seems that that would complicate the handle_call function (as >>> gen_server seems to assume that it's synchronous). Complication is >>> okay, but I'd like to avoid it if it turns out that there is a >>> single >>> library that already does what I want :) >>> >>> I could also have the supervisor pass in a different name to >>> register >>> to gen_server:start_link (worker1,worker2, ...) and have the >>> supervisor manage the pool, but that seems messy (which, again, is >>> okay, but is to be avoided if possible). >>> >>> Anyway, I'm sure this is a solved problem and I'm just looking in >>> the >>> wrong places. How would you do this? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From dustin@REDACTED Wed Sep 5 01:37:20 2007 From: dustin@REDACTED (Dustin Sallings) Date: Tue, 4 Sep 2007 16:37:20 -0700 Subject: [erlang-questions] What is wrong with this list? In-Reply-To: References: <764345.64386.qm@web51101.mail.re2.yahoo.com> <2D4C450E-36A4-4956-881F-518812719F4A@spy.net> Message-ID: On Sep 4, 2007, at 15:26 , Peter K Chan wrote: > As someone who has known Erlang for a while, the error message > would probably not be helpful (if even possible). But as a newbie, > knowing the difference between an assignment and a match can be > very helpful. Actually, if the bad match comes from some deep > recursion, I think I would appreciate seeing the actual value, even > if I know what badmatches in general are. > > I do agree that the current error message gives out enough > information for debugging purpose, but having seen, more than once, > where someone is confused about the matching vs. assignment, I > think the more explicit error message would be "nice" to have. I'm not arguing that it can't be better, I'm just suggesting that it might not be as simple as saying ``x != y'' as there are a lot of other cases where a badmatch may occur where that wasn't the intention. In the particular example I gave, it might be wrong because I accidentally used the same variable name twice, or it might be wrong because the function returned invalid results. It could be tricky to produce an error that helps solve each problem. It might be good enough to just format the error better in logs and shells. e.g. instead of {{badmatch,[x]},[{erl_eval,expr,3}]} something like: bad match: The following value was not expected here: [x] {erl_eval,expr,3} It means the same thing, but might help people understand it a little better. Then again, that could make it harder to know how to catch errors since it's no longer obvious that I can also match against {badmatch, X}. -- Dustin Sallings From david.hopwood@REDACTED Wed Sep 5 04:10:17 2007 From: david.hopwood@REDACTED (David Hopwood) Date: Wed, 05 Sep 2007 03:10:17 +0100 Subject: [erlang-questions] What is wrong with this list? In-Reply-To: References: <764345.64386.qm@web51101.mail.re2.yahoo.com> <2D4C450E-36A4-4956-881F-518812719F4A@spy.net> Message-ID: <46DE1009.309@industrial-designers.co.uk> Dustin Sallings wrote: > On Sep 4, 2007, at 13:29 , Peter K Chan wrote: > >> I think it would be nice if the compiler can output why a match fails >> (e.g. {number, 1} does not equal {atom, java}). > > This could work as an error string along with the badmatch for the > single case discussed, but what about a case (that is contrived, but > probably similar to real code I've written somewhere) like this: > > Pid = some_function(), > Pid = other_function(). > > The error message wouldn't be all that useful to you either way > because on the first line you're capturing a value into a variable, and > on the second line you're validating the same Pid is returned. If it > showed you the value, it'd probably be meaningless to you. It would > basically be showing you two different values and saying they're not the > same. In cases where this is a bug, it probably *is* often useful to know what the two values (Pid and other_function() in the second match) are. For process ids, it is less useful than for other values, but you can still use them to identify both processes in a debugger. At least this information can't hurt. > You have the same issue in a case, receive, function definition, > etc... for which you have no matching case. You don't want to list > every possible pattern. That's not a reason not to display the pattern in cases where there can only be one. -- David Hopwood From dustin@REDACTED Wed Sep 5 05:45:20 2007 From: dustin@REDACTED (Dustin Sallings) Date: Tue, 4 Sep 2007 20:45:20 -0700 Subject: [erlang-questions] What is wrong with this list? In-Reply-To: <46DE1009.309@industrial-designers.co.uk> References: <764345.64386.qm@web51101.mail.re2.yahoo.com> <2D4C450E-36A4-4956-881F-518812719F4A@spy.net> <46DE1009.309@industrial-designers.co.uk> Message-ID: On Sep 4, 2007, at 19:10, David Hopwood wrote: > In cases where this is a bug, it probably *is* often useful to know > what > the two values (Pid and other_function() in the second match) are. For > process ids, it is less useful than for other values, but you can > still > use them to identify both processes in a debugger. At least this > information can't hurt. > >> You have the same issue in a case, receive, function definition, >> etc... for which you have no matching case. You don't want to list >> every possible pattern. > > That's not a reason not to display the pattern in cases where there > can > only be one. I suppose I don't disagree with you enough to continue arguing. Things can certainly be better, but I don't see how you'd get both sides of the match without breaking compatibility. -- Dustin Sallings From bjt@REDACTED Wed Sep 5 06:24:28 2007 From: bjt@REDACTED (Benjamin Tolputt) Date: Wed, 05 Sep 2007 14:24:28 +1000 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: <46DD31D4.5030309@ericsson.com> References: <46DCDE0C.9000504@pmp.com.au> <46DD31D4.5030309@ericsson.com> Message-ID: <46DE2F7C.8030509@pmp.com.au> I am interested in this, yes. Does it require an installation of erlang to be present or is it "self contained" (i.e. you send the self-extracting/self-running archive and it does the rest)? SAE (discontinued since R9 I believe) has the best implementation I have seen, with the single file being all that was required in order to run an Erlang application/server. If Joe were ever to get this back into working order - he would have many grateful fans (over and above those of his book *grin*) Regards, B.J.Tolputt Bengt Kleberg wrote: > It is easy to load a beam file from non-file based sources. i have a > self-extracting-and-run-archive (i call it besea) that uses escript, if > you are interested. > > > bengt > Those were the days... > EPO guidelines 1978: "If the contribution to the known art resides > solely in a computer program then the subject matter is not > patentable in whatever manner it may be presented in the claims." > > > On 2007-09-04 10:54, Chandru wrote: > >> On 04/09/07, Benjamin Tolputt wrote: >> >>> So I was wondering if I could impress them with some news on the Stand >>> Alone Erlang front. In a related question, how easy is it to retrieve >>> code/beams from non-file based sources (e.g. from an embedded native >>> code database or zip file)? >>> >>> >> code:load_binary/3 lets you load a module using a binary blob. This >> might be useful. >> >> cheers >> Chandru >> _______________________________________________ >> 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 smangano@REDACTED Wed Sep 5 05:35:08 2007 From: smangano@REDACTED (Salvatore Mangano) Date: Tue, 4 Sep 2007 23:35:08 -0400 Subject: [erlang-questions] Tilera 64-core chip In-Reply-To: <74E63A8C-7CDD-493B-85E9-EBB33FF08C3C@gmail.com> References: <74E63A8C-7CDD-493B-85E9-EBB33FF08C3C@gmail.com> Message-ID: <00c101c7ef6d$c1bf6c50$6400a8c0@einstein> I too have tried to get them to respond. No luck yet. I guess you have to have really deep pockets to get any attention. Perhaps contating someone in mgmt directly would get better results. I miss the good ole days when the hobbiest community meant something to the industry. Sigh. -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of G Bulmer Sent: Tuesday, September 04, 2007 1:35 PM To: erlang-questions@REDACTED Subject: Re: [erlang-questions] Tilera 64-core chip I have filled in the web-forms yesterday, and telephoned Tilera several times today, but I haven't had a response. I have a potential commercial application, so I'm keen to get prices on the board. Other interesting comments from someone who (says they) worked on RAW are here: http://realworldtech.com/forums/index.cfm? action=detail&id=82137&threadid=82135&roomid=2 they identify several possible weaknesses (though memory is the main one that might effect my application). This person notes some of the weaknesses of RAW, and the apparent improvements. It may be quite complex to use, depends on their software development tools. GB _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From jeff@REDACTED Wed Sep 5 07:02:24 2007 From: jeff@REDACTED (Jeff Hodges) Date: Tue, 4 Sep 2007 22:02:24 -0700 Subject: [erlang-questions] ei, erlang_interface, creation and deprecation In-Reply-To: <46DD6A57.4060004@erix.ericsson.se> References: <46DD6A57.4060004@erix.ericsson.se> Message-ID: <89967A15-9FDE-43FC-B127-C7904D724CC5@somethingsimilar.com> Ah, I didn't say this publicly last time. Thanks Peter and thanks Roberto for your answers Got to remember to hit reply all on this mailing list. -- Jeff From mikage@REDACTED Wed Sep 5 07:27:28 2007 From: mikage@REDACTED (Mikage Sawatari) Date: Wed, 5 Sep 2007 14:27:28 +0900 Subject: [erlang-questions] I want documentation of Erlang in EDoc format Message-ID: <5e448700709042227l3e15c98bkca3606a32edabacc@mail.gmail.com> Hello, How can I get documentation of Erlang in EDoc format? Only HTML and Man pages are available on the web, but I want EDoc data to make a tool which can search for functions. Thank, you. ----------------------------------------------------------------------- SAWATARI Mikage (SANO Taku) From nic@REDACTED Wed Sep 5 07:19:08 2007 From: nic@REDACTED (nic) Date: Wed, 05 Sep 2007 17:19:08 +1200 Subject: [erlang-questions] io:format, gen_fsm, eunit Message-ID: <46DE3C4C.6010100@tymar.com> Hi all I'm yet another of the Erlang total newbies, so please be patient with what is probably a really dumb question. I've created a very basic gen_fsm-based state machine which works fine in the shell. I intend to add states and actions to it as my application evolves. At the moment, it prints a message (using io:format) at each state transition. I'm using eunit to make sure I don't break anything as I add to the FSM (and partly for the experience of using eunit). My first test creates an FSM, sends a single event (which causes a transition message to be printed) then stops the FSM. eunit says the test works OK, but I get an error message printed which _looks_ really ugly: =ERROR REPORT==== 5-Sep-2007::16:54:37 === ** State machine dll_1 terminating ** Last event in was init ** When State == in_reset ** Data == {state,0,undefined,undefined} ** Reason for termination = ** {ebadf,[{io,format, [<0.151.0>, "in_reset Event: ~p, State: ~p~n", [init,{state,0,undefined,undefined}]]}, {m27_dll_fsm,in_reset,2}, {gen_fsm,handle_msg,7}, {proc_lib,init_p,5}]} Test successful. ok I think I can see what's going on: the io:format's file descriptor has disappeared (been closed) before the write has finished, presumably because the gen_fsm process that opened it has been stopped. The test is successful, so I could just live with the ugly error message, but I can imagine that if there were a few of these it would be really easy to miss some useful error reports amongst all the noise. It's a bit like ignoring compiler warnings: I've always found it pays to make things compile clean. So (finally) is it something to do with the way I'm setting up the test, or is there a cunning (or obvious!) way around it, or should I just live with it, or what? Cheers Nic C-L From bob@REDACTED Wed Sep 5 07:58:41 2007 From: bob@REDACTED (Bob Ippolito) Date: Tue, 4 Sep 2007 22:58:41 -0700 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: <46DE2F7C.8030509@pmp.com.au> References: <46DCDE0C.9000504@pmp.com.au> <46DD31D4.5030309@ericsson.com> <46DE2F7C.8030509@pmp.com.au> Message-ID: <6a36e7290709042258j7cdec950wfd8799df8031c542@mail.gmail.com> On 9/4/07, Benjamin Tolputt wrote: > I am interested in this, yes. Does it require an installation of erlang > to be present or is it "self contained" (i.e. you send the > self-extracting/self-running archive and it does the rest)? > > SAE (discontinued since R9 I believe) has the best implementation I have > seen, with the single file being all that was required in order to run > an Erlang application/server. If Joe were ever to get this back into > working order - he would have many grateful fans (over and above those > of his book *grin*) > Out of curiosity, what's the problem with a CEAN style solution? It's a standalone environment that you can move anywhere on the filesystem and it should still work. Other than the naming of the directories, it's not much different than how Mac OS X applications are packaged, and nobody really complains about that. -bob From bengt.kleberg@REDACTED Wed Sep 5 08:03:46 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 05 Sep 2007 08:03:46 +0200 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: <46DE2F7C.8030509@pmp.com.au> References: <46DCDE0C.9000504@pmp.com.au> <46DD31D4.5030309@ericsson.com> <46DE2F7C.8030509@pmp.com.au> Message-ID: <46DE46C2.6010004@ericsson.com> besea is not self containied. it uses escript via the unix #! script hack(*). so you need a unix system with an installed escript. if this works on windows i will try to get escript into CEAN. (*) tmi: if the first 4 charactes of a file are #! / or (on most systems) the first 3 charactes are #!/, then the kernel will try to use that file as an interpreter for the file. the kernel uses 32 characters starting from /, or (on most systems) all characters until end of line. bengt Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." On 2007-09-05 06:24, Benjamin Tolputt wrote: > I am interested in this, yes. Does it require an installation of erlang > to be present or is it "self contained" (i.e. you send the > self-extracting/self-running archive and it does the rest)? > > SAE (discontinued since R9 I believe) has the best implementation I have > seen, with the single file being all that was required in order to run > an Erlang application/server. If Joe were ever to get this back into > working order - he would have many grateful fans (over and above those > of his book *grin*) > > Regards, > B.J.Tolputt > > > > Bengt Kleberg wrote: >> It is easy to load a beam file from non-file based sources. i have a >> self-extracting-and-run-archive (i call it besea) that uses escript, if >> you are interested. >> >> >> bengt >> Those were the days... >> EPO guidelines 1978: "If the contribution to the known art resides >> solely in a computer program then the subject matter is not >> patentable in whatever manner it may be presented in the claims." >> >> >> On 2007-09-04 10:54, Chandru wrote: >> >>> On 04/09/07, Benjamin Tolputt wrote: >>> >>>> So I was wondering if I could impress them with some news on the Stand >>>> Alone Erlang front. In a related question, how easy is it to retrieve >>>> code/beams from non-file based sources (e.g. from an embedded native >>>> code database or zip file)? >>>> >>>> >>> code:load_binary/3 lets you load a module using a binary blob. This >>> might be useful. >>> >>> cheers >>> Chandru >>> _______________________________________________ >>> 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 bjt@REDACTED Wed Sep 5 09:37:27 2007 From: bjt@REDACTED (Benjamin Tolputt) Date: Wed, 05 Sep 2007 17:37:27 +1000 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: <6a36e7290709042258j7cdec950wfd8799df8031c542@mail.gmail.com> References: <46DCDE0C.9000504@pmp.com.au> <46DD31D4.5030309@ericsson.com> <46DE2F7C.8030509@pmp.com.au> <6a36e7290709042258j7cdec950wfd8799df8031c542@mail.gmail.com> Message-ID: <46DE5CB7.5010600@pmp.com.au> Bob Ippolito wrote: > Out of curiosity, what's the problem with a CEAN style solution? It's > a standalone environment that you can move anywhere on the filesystem > and it should still work. Other than the naming of the directories, > it's not much different than how Mac OS X applications are packaged, > and nobody really complains about that. > > -bob > The problem is that the CEAN distribution requires the user to extract files to a directory tree THEN run a separate executable. For servers and so on (which generally require some form of "setup" to install anyway) this is not an issue, but for game development (the area of development the guys are working in) this is not so good (impatient, technically inexperienced user base). Something along the lines of a Py2EXE would be ideal. Py2EXE zips and concatenates the required Python ".pyd" (i.e. Python's equivalent to "beam" files) to the end of an executable stub. This executable stub knows that it needs to retrieve the required code files (or in our case Erlang "beam" files) from the compressed archive at the end of the file rather than from the local file-system. The way I would do it (if I were coding the solution) would be to have an Erlang BEAM VM executable which is hard-coded to look for the essential files from the end of itself (i.e the appended "BEAM" file archive). These BEAM files would then setup the internal Erlang environment to be able to load modules/beam files & DLL's from game specific locations and/or file formats (i.e. the BEAM's could be encrypted or compressed). As I am a Windows-based developer - this is a little hard for me to contemplate doing as having to setup Cygwin on my dual-boot Windows/Linux development machine seems a little redundant (but necessary to compile the Erlang runtimes). If/when Erlang is fully compilable using MSVC or GCC alone - then I will be happy to work on it. Regards, B.J.Tolputt From tobias.lindahl@REDACTED Wed Sep 5 09:49:10 2007 From: tobias.lindahl@REDACTED (Tobias Lindahl) Date: Wed, 05 Sep 2007 09:49:10 +0200 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <337538cb0709041120k23ae74c4ga8de2440ef92ce7a@mail.gmail.com> References: <46DC193D.10504@ericsson.com> <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> <46DD9105.4050901@cs.ntua.gr> <337538cb0709041120k23ae74c4ga8de2440ef92ce7a@mail.gmail.com> Message-ID: <46DE5F76.1050601@it.uu.se> Kirill Zaborski wrote: > On 9/4/07, Kostis Sagonas wrote: >> Kirill Zaborski wrote: >> >>> Or I will have to write 2 different lines of comments describing the >>> same types? >> The idea is that you would not have to write comments anymore. Doesn't >> this sound wonderful? :-) >> >> Humor aside, the point is: comments are dangerous because they suffer >> from code rot; type information integrated in the language will most >> probably not: its compatibility with the code will be checked. > > > Wow it looks quite promising to me. And when it is planned for? Will there > be an EEP for it? We will present the specification language and some of its interaction with the analysis in Dialyzer at the Erlang Workshop next month. We have a functioning system and have started to annotate the libraries in OTP for testing purposes. There will probably be an EEP at some point since we are hoping to have it included in R12B. Best, Tobias From hughperkins@REDACTED Wed Sep 5 10:05:34 2007 From: hughperkins@REDACTED (Hugh Perkins) Date: Wed, 5 Sep 2007 16:05:34 +0800 Subject: [erlang-questions] Tilera 64-core chip - full Linux on each core! In-Reply-To: <18141.28427.675007.78075@antilipe.corelatus.se> References: <200708201440.l7KEeeON001371@harpo.it.uu.se> <20070820214544.GF13839@wellquite.org> <200708231648.02322.roger.larsson@norran.net> <18141.28427.675007.78075@antilipe.corelatus.se> Message-ID: <837db430709050105g66961518h89e8a0b759b1f837@mail.gmail.com> Yeah, I was thinking vapourware-like. I mean, maybe the CPU exists, but possibly not quite at the shipping stage? From kenneth.lundin@REDACTED Wed Sep 5 10:14:17 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Wed, 5 Sep 2007 10:14:17 +0200 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: <46DCDE0C.9000504@pmp.com.au> References: <46DCDE0C.9000504@pmp.com.au> Message-ID: Hi, On 9/4/07, Benjamin Tolputt wrote: > I was wondering if anyone has actually made progress/headway into the > "stand alone erlang" problem/feature? > > I am currently using Erlang for a variety of minor, yet high-concurrency > tasks on our servers. I am currently looking into moving some of our > more complex/CPU-intensive tasks to Erlang as well. And for these tasks, > Erlang/CEAN/OTP distribution method is just fine (not my preferred, but > that is only a matter of taste). > > However, I have been talking to a few busy individuals who (inspired by > Tim Sweeney's latest talk) are looking at high-concurrency > languages/executable frameworks for "client-side" game/simulation > execution. They asked me which one I would recommend, and I (of course) > mentioned Erlang. To which their immediate reply was "Yeah, it looks > good - but the deployment is to much of a hassle for general game players". I think you and many others discussing Standalone Erlang are mixing up things here. The important thing for end user deployment is that it is easy and quick to install and uninstall a SW package and that does not imply that for example all the beam files must be packed together in one or a few bigger files. As long as the installation is distributed as e.g a self extracting and self installing exe file (Windows) it should be ok. Of course this package should only contain the beam files from OTP that are actually used plus the specific .beam files for the SW in question. > > So I was wondering if I could impress them with some news on the Stand > Alone Erlang front. In a related question, how easy is it to retrieve > code/beams from non-file based sources (e.g. from an embedded native > code database or zip file)? We have already implemented (but not released) code loading from ZIP archives. We are working on "standalone" features but I can not promise today when we will release something. Erlang/OTP as available today as open source is a DEVELOPMENT SYSTEM which the developer uses to create a TARGET SYSTEM. The target system can be a simple standalone application to be installed on many clients or it can be a complex distributed embedded server system. To create the target system you need the following: 1) Know what parts of Erlang/OTP you need in the target app. You can pick OTP components on complete application level i.e. stdlib, kernel, mnesia etc. which is easy. Or you can try to remove unused modules even from stdlib, kernel etc. which is more tricky and requires a lot more knowledge about dependencies. 2) Know your own target specific SW. Must be obvious. 3) Pack 1 and 2 together in a distribution. You can pack together all resulting files and directory hierarchies just as they are. Or you can try to create something which result in just a few files when installed (e.g. beam files packed together, one per OTP application or one for all .beam files) 4) Installation script or other SW run at install time You can for example use NSIS (free and we use it now) for Windows or something else. For other OS:es you need something else. We will primarily address 1 and 3 above and probably offer several alternatives for doing them. We will not take the SAE approach exactly as the one Joe Armstrong did because we have found several difficulties in maintaining that solution. /Kenneth (Erlang/OTP team at Ericsson) > > Thanks for any feedback you might have on this... > B.J.Tolputt > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From attila.rajmund.nohl@REDACTED Wed Sep 5 10:18:17 2007 From: attila.rajmund.nohl@REDACTED (attila.rajmund.nohl@REDACTED) Date: Wed, 5 Sep 2007 10:18:17 +0200 (CEST) Subject: [erlang-questions] What is wrong with this list? In-Reply-To: References: <764345.64386.qm@web51101.mail.re2.yahoo.com> <2D4C450E-36A4-4956-881F-518812719F4A@spy.net> Message-ID: On Tue, 4 Sep 2007, Dustin Sallings wrote: > > On Sep 4, 2007, at 13:29 , Peter K Chan wrote: > >> I think it would be nice if the compiler can output why a match fails (e.g. >> {number, 1} does not equal {atom, java}). > > This could work as an error string along with the badmatch for the > single case discussed, but what about a case (that is contrived, but probably > similar to real code I've written somewhere) like this: > > Pid = some_function(), > Pid = other_function(). > > The error message wouldn't be all that useful to you either way > because on the first line you're capturing a value into a variable, and on > the second line you're validating the same Pid is returned. This is a case where the line number information could be useful. Also a warning might be useful during compilation time, a same kind of warning that you get in C for code like if (a=b) ... Bye,NAR -- "Beware of bugs in the above code; I have only proved it correct, not tried it." From hughperkins@REDACTED Wed Sep 5 10:32:59 2007 From: hughperkins@REDACTED (Hugh Perkins) Date: Wed, 5 Sep 2007 16:32:59 +0800 Subject: [erlang-questions] Tilera 64-core chip In-Reply-To: <00c101c7ef6d$c1bf6c50$6400a8c0@einstein> References: <74E63A8C-7CDD-493B-85E9-EBB33FF08C3C@gmail.com> <00c101c7ef6d$c1bf6c50$6400a8c0@einstein> Message-ID: <837db430709050132q7d3bc5d5kaa0bb899b597080f@mail.gmail.com> Does sound vapourware-ish. Perhaps they kindof designed the chips, but dont have enough money to do an actual manufacturing run, so they're waiting for some large order to come in to do one? From hughperkins@REDACTED Wed Sep 5 10:42:23 2007 From: hughperkins@REDACTED (Hugh Perkins) Date: Wed, 5 Sep 2007 16:42:23 +0800 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <46DD9105.4050901@cs.ntua.gr> References: <46DC193D.10504@ericsson.com> <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> <46DD9105.4050901@cs.ntua.gr> Message-ID: <837db430709050142r707c0b6cybee39b672d0b95a@mail.gmail.com> On 9/5/07, Kostis Sagonas wrote: > Humor aside, the point is: comments are dangerous because they suffer > from code rot; type information integrated in the language will most > probably not: its compatibility with the code will be checked. Yes, yes, exactly! Really cool. This is why I like Erlang, it's a language created by real enterprises with real-world problems. From ulf.wiger@REDACTED Wed Sep 5 10:46:39 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 05 Sep 2007 10:46:39 +0200 Subject: [erlang-questions] What is wrong with this list? In-Reply-To: References: <764345.64386.qm@web51101.mail.re2.yahoo.com> <2D4C450E-36A4-4956-881F-518812719F4A@spy.net> Message-ID: <46DE6CEF.40309@ericsson.com> attila.rajmund.nohl@REDACTED wrote: > This is a case where the line number information could be > useful. Also a warning might be useful during compilation > time, a same kind of warning that you get in C for code like > if (a=b) ... The compiler does issue warnings whenever it can detect that a clause will not match. Specifically: -module(warns). -compile(export_all). f() -> [java|python] = [1,2,3,4,5]. results in this warning: 11> c(warns). ./warns.erl:6: Warning: no clause will ever match {ok,warns} The initial post in this thread showed a failed pattern match in the _shell_. That code would have triggered a warning if compiled. BR, Ulf W From kenneth.lundin@REDACTED Wed Sep 5 10:22:54 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Wed, 5 Sep 2007 10:22:54 +0200 Subject: [erlang-questions] I want documentation of Erlang in EDoc format In-Reply-To: <5e448700709042227l3e15c98bkca3606a32edabacc@mail.gmail.com> References: <5e448700709042227l3e15c98bkca3606a32edabacc@mail.gmail.com> Message-ID: Hi, You will never get all of the documentation in EDoc format. We are mostly using XML in files separate from the source code for the documentation and we have plans to release those XML sources. The XML format we use is documented in the DocBuilder application which is part of the OTP R11B-5 release. /Kenneth (ERlang/OTP team at Ericsson) On 9/5/07, Mikage Sawatari wrote: > Hello, > > How can I get documentation of Erlang in EDoc format? Only HTML > and Man pages are available on the web, but I want EDoc data to > make a tool which can search for functions. > > > Thank, you. > > ----------------------------------------------------------------------- > SAWATARI Mikage (SANO Taku) > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From qrilka@REDACTED Wed Sep 5 11:22:44 2007 From: qrilka@REDACTED (Kirill Zaborski) Date: Wed, 5 Sep 2007 09:22:44 +0000 Subject: [erlang-questions] I want documentation of Erlang in EDoc format In-Reply-To: References: <5e448700709042227l3e15c98bkca3606a32edabacc@mail.gmail.com> Message-ID: <337538cb0709050222i63b7116auc21a8c83c9726f5f@mail.gmail.com> May I ask what were the reasons of such separation? Are there any problems with edoc? Doctool supplied with the language and not used by the authors of this language - it seems quite suspicious to me :) Best regards, Kirill. On 9/5/07, Kenneth Lundin wrote: Hi, > > You will never get all of the documentation in EDoc format. > We are mostly using XML in files separate from the source code for the > documentation and we have plans to release those XML sources. > The XML format we use is documented in the DocBuilder application > which is part of the OTP R11B-5 release. > > /Kenneth (ERlang/OTP team at Ericsson) > > On 9/5/07, Mikage Sawatari wrote: > > Hello, > > > > How can I get documentation of Erlang in EDoc format? Only HTML > > and Man pages are available on the web, but I want EDoc data to > > make a tool which can search for functions. > > > > > > Thank, you. > > > > ----------------------------------------------------------------------- > > SAWATARI Mikage (SANO Taku) > > _______________________________________________ > > 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 Wed Sep 5 11:49:05 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 5 Sep 2007 11:49:05 +0200 Subject: [erlang-questions] testing frameworks Message-ID: <95be1d3b0709050249s6857a26fnb59bae227b3802b7@mail.gmail.com> Hi! There are a few testing frameworks around, I suppose the most mature are the OTP test server, EUnit and maybe Extreme Forge (n?e XPDojo). Which ones are used in real life? Which have the mose momentum? I am looking at integerating Erlang tests with Java tests in Eclipse (for Erlide), and I feel I can't cope with more than one framework... The OTP server isn't updated since 2004 - is this true or just the release code hasn't been refreshed? best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From qrilka@REDACTED Wed Sep 5 12:14:27 2007 From: qrilka@REDACTED (Kirill Zaborski) Date: Wed, 5 Sep 2007 10:14:27 +0000 Subject: [erlang-questions] testing frameworks In-Reply-To: <95be1d3b0709050249s6857a26fnb59bae227b3802b7@mail.gmail.com> References: <95be1d3b0709050249s6857a26fnb59bae227b3802b7@mail.gmail.com> Message-ID: <337538cb0709050314r3ce4bf59y239c70757b02a0c4@mail.gmail.com> Where is Extreme Forge used? Its wiki is a bit scarce and there is no release yet. Who are the authors of it? Trying to get user stories from http://trac.extremeforge.net/extremeforge/wiki/UserStories says: FILE_VIEW privileges are required to perform this operation Best regards, Kirill. On 9/5/07, Vlad Dumitrescu wrote: Hi! > > There are a few testing frameworks around, I suppose the most mature are the OTP test server, EUnit and maybe Extreme Forge (n?e XPDojo). > > Which ones are used in real life? Which have the mose momentum? > I am looking at integerating Erlang tests with Java tests in Eclipse (for Erlide), and I feel I can\\\'t cope with more than one framework... > > > The OTP server isn\\\'t updated since 2004 - is this true or just the release code hasn\\\'t been refreshed? > > best regards, > Vlad > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From bengt.kleberg@REDACTED Wed Sep 5 12:17:07 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 05 Sep 2007 12:17:07 +0200 Subject: [erlang-questions] testing frameworks In-Reply-To: <95be1d3b0709050249s6857a26fnb59bae227b3802b7@mail.gmail.com> References: <95be1d3b0709050249s6857a26fnb59bae227b3802b7@mail.gmail.com> Message-ID: <46DE8223.7030900@ericsson.com> do not forget yatsy ( http://code.google.com/p/yatsy ). bengt Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." On 2007-09-05 11:49, Vlad Dumitrescu wrote: > Hi! > > There are a few testing frameworks around, I suppose the most mature are > the OTP test server, EUnit and maybe Extreme Forge (n?e XPDojo). > > Which ones are used in real life? Which have the mose momentum? > I am looking at integerating Erlang tests with Java tests in Eclipse > (for Erlide), and I feel I can't cope with more than one framework... > > > The OTP server isn't updated since 2004 - is this true or just the > release code hasn't been refreshed? > > best regards, > Vlad > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From richardc@REDACTED Wed Sep 5 12:30:37 2007 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 05 Sep 2007 12:30:37 +0200 Subject: [erlang-questions] I want documentation of Erlang in EDoc format In-Reply-To: <337538cb0709050222i63b7116auc21a8c83c9726f5f@mail.gmail.com> References: <5e448700709042227l3e15c98bkca3606a32edabacc@mail.gmail.com> <337538cb0709050222i63b7116auc21a8c83c9726f5f@mail.gmail.com> Message-ID: <46DE854D.8010104@it.uu.se> Kirill Zaborski wrote: > May I ask what were the reasons of such separation? > Are there any problems with edoc? > Doctool supplied with the language and not used by the authors of this > language - it seems quite suspicious to me :) Not at all. The OTP documentation was first written (first using SGML, now XML) long before edoc was created, and there has been no reason to try to change the format. Edoc is targeted at getting the documentation into the source code right from the start, and make it easy to keep up to date. The OTP docs are written in traditional style as a large and complex set of documents, with professional writers working on them. Nowadays, OTP are using edoc to extract documentation from those source files that contain it (and then process it a bit to fit better in the OTP layout style), but most of the documentation remains in XML, and it is probably not worth the time and effort to move it into the source files. /Richard From vladdu55@REDACTED Wed Sep 5 12:48:56 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 5 Sep 2007 12:48:56 +0200 Subject: [erlang-questions] testing frameworks In-Reply-To: <337538cb0709050314r3ce4bf59y239c70757b02a0c4@mail.gmail.com> References: <95be1d3b0709050249s6857a26fnb59bae227b3802b7@mail.gmail.com> <337538cb0709050314r3ce4bf59y239c70757b02a0c4@mail.gmail.com> Message-ID: <95be1d3b0709050348j89a049cta88e84accdb3ab78@mail.gmail.com> On 9/5/07, Kirill Zaborski wrote: > > Where is Extreme Forge used? I don't know if it's used somewhere, that's what I'm trying to find out. I mentioned it because I know it's been around since 2004. Its wiki is a bit scarce and there is no release yet. > Who are the authors of it? Main authors are Dominic Williams and Nicolas Charpentier. Trying to get user stories from > http://trac.extremeforge.net/extremeforge/wiki/UserStories says: > FILE_VIEW privileges are required to perform this operation Try even http://developer.berlios.de/projects/xpdojo/, the old project's site. A quick check doesn't show much documentation... /Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From tobbe@REDACTED Wed Sep 5 13:04:21 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Wed, 05 Sep 2007 13:04:21 +0200 Subject: [erlang-questions] testing frameworks In-Reply-To: <95be1d3b0709050249s6857a26fnb59bae227b3802b7@mail.gmail.com> References: <95be1d3b0709050249s6857a26fnb59bae227b3802b7@mail.gmail.com> Message-ID: Vlad Dumitrescu wrote: > Hi! > > There are a few testing frameworks around, I suppose the most mature are > the OTP test server, EUnit and maybe Extreme Forge (n?e XPDojo). > > Which ones are used in real life? Which have the mose momentum? > I am looking at integerating Erlang tests with Java tests in Eclipse > (for Erlide), and I feel I can't cope with more than one framework... > We at Kreditor are using Yatsy ( http://code.google.com/p/yatsy ), and EUnit. I know others that are using the OTP test server. The problem with the latter is that it doesn't live in a public repository, so everyone that uses it has probably made their own changes to it. --Tobbe From vladdu55@REDACTED Wed Sep 5 13:31:36 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 5 Sep 2007 13:31:36 +0200 Subject: [erlang-questions] testing frameworks In-Reply-To: References: <95be1d3b0709050249s6857a26fnb59bae227b3802b7@mail.gmail.com> Message-ID: <95be1d3b0709050431n58c81fb3t9078916b10f31aae@mail.gmail.com> Hi Tobbe, On 9/5/07, Torbjorn Tornkvist wrote: > > > We at Kreditor are using Yatsy ( http://code.google.com/p/yatsy ), > and EUnit. > > Could you please make a quick comparison between the two? What does the one have that the other doesn't? Than main thing I see with yatsy is the report generator, but there might be others. regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From qrilka@REDACTED Wed Sep 5 13:56:33 2007 From: qrilka@REDACTED (Kirill Zaborski) Date: Wed, 5 Sep 2007 11:56:33 +0000 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <46DE5F76.1050601@it.uu.se> References: <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> <46DD9105.4050901@cs.ntua.gr> <337538cb0709041120k23ae74c4ga8de2440ef92ce7a@mail.gmail.com> <46DE5F76.1050601@it.uu.se> Message-ID: <337538cb0709050456k25ce1bfg4f1e85f036e90169@mail.gmail.com> On 9/5/07, Tobias Lindahl wrote: > We will present the specification language and some of its interaction > with the analysis in Dialyzer at the Erlang Workshop next month. We have > a functioning system and have started to annotate the libraries in OTP > for testing purposes. There will probably be an EEP at some point since > we are hoping to have it included in R12B. I can't wait one more month so I'd like to ask some questions: when will be these specifications used during compilation or in runtime? (Runtime checks will require additional CPU time but with compile-time checks you can have problems with code update at least) What will be checked: function body or the parameters I supply for it? Best regards, Kirill. From kenneth.lundin@REDACTED Wed Sep 5 11:40:02 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Wed, 5 Sep 2007 11:40:02 +0200 Subject: [erlang-questions] I want documentation of Erlang in EDoc format In-Reply-To: <337538cb0709050222i63b7116auc21a8c83c9726f5f@mail.gmail.com> References: <5e448700709042227l3e15c98bkca3606a32edabacc@mail.gmail.com> <337538cb0709050222i63b7116auc21a8c83c9726f5f@mail.gmail.com> Message-ID: Hi, We, the Erlang/OTP group at Ericsson have used SGML/XML as the source format for documentation for 5-10 years before Edoc was introduced. For the XML sources we have DocBuilder (part of the R11B-5 distibution) to build the doc with. Nowadays we actually use Edoc for some of the documentation and use a special backend to Edoc which makes it uniform with our other doc. Edoc is not well suited for all types of documentation and it is also a matter of taste if you want to clutter down the source code with very long descriptive text. I think Edoc and our DocBuilder will grow together more and more over time and that you will be able to mix separate documentation files and documentation embedded in the source code more seamlessly and with a common markup. /Kenneth (Erlang/OTP group at Ericsson) On 9/5/07, Kirill Zaborski wrote: > May I ask what were the reasons of such separation? > Are there any problems with edoc? > Doctool supplied with the language and not used by the authors of this > language - it seems quite suspicious to me :) > > Best regards, > Kirill. > > On 9/5/07, Kenneth Lundin wrote: > Hi, > > > > You will never get all of the documentation in EDoc format. > > We are mostly using XML in files separate from the source code for the > > documentation and we have plans to release those XML sources. > > The XML format we use is documented in the DocBuilder application > > which is part of the OTP R11B-5 release. > > > > /Kenneth (ERlang/OTP team at Ericsson) > > > > On 9/5/07, Mikage Sawatari wrote: > > > Hello, > > > > > > How can I get documentation of Erlang in EDoc format? Only HTML > > > and Man pages are available on the web, but I want EDoc data to > > > make a tool which can search for functions. > > > > > > > > > Thank, you. > > > > > > ----------------------------------------------------------------------- > > > SAWATARI Mikage (SANO Taku) > > > _______________________________________________ > > > 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 tobias.lindahl@REDACTED Wed Sep 5 15:00:34 2007 From: tobias.lindahl@REDACTED (Tobias Lindahl) Date: Wed, 05 Sep 2007 15:00:34 +0200 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <337538cb0709050456k25ce1bfg4f1e85f036e90169@mail.gmail.com> References: <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> <46DD9105.4050901@cs.ntua.gr> <337538cb0709041120k23ae74c4ga8de2440ef92ce7a@mail.gmail.com> <46DE5F76.1050601@it.uu.se> <337538cb0709050456k25ce1bfg4f1e85f036e90169@mail.gmail.com> Message-ID: <46DEA872.5060704@it.uu.se> Kirill Zaborski wrote: > On 9/5/07, Tobias Lindahl wrote: >> We will present the specification language and some of its interaction >> with the analysis in Dialyzer at the Erlang Workshop next month. We have >> a functioning system and have started to annotate the libraries in OTP >> for testing purposes. There will probably be an EEP at some point since >> we are hoping to have it included in R12B. > > I can't wait one more month so I'd like to ask some questions: > when will be these specifications used during compilation or in > runtime? (Runtime checks will require additional CPU time but with > compile-time checks you can have problems with code update at least) > What will be checked: function body or the parameters I supply for it? The extension we suggest is a language to write specifications (or contracts as we like to call them). The language is very similar to the language of edoc, with the difference that the contracts are parsed and live their lives as compiler attributes rather than comments. The contracts should not necessarily be used by the compiler, but rather for tools that can benefit from the kind of information that is given. Obvious examples are Edoc and Dialyzer, and since we are developing Dialyzer, our focus is slightly more aimed towards the type information we benefit from. The dynamic nature of Erlang limits the static checking of the contracts somewhat, but our idea is to use the same philosophy as Dialyzer is using. When a contract cannot hold this is reported, but otherwise it is trusted as a promise given by the user. "I promise that this function will be used in the way I specify. Please tell me if I missuse it." Checking the contracts dynamically is probably costly, but we have started a project to investigate how costly it is, and how it can be used in instrumented systems for testing purposes. Perhaps it can be used while running testsuites to find if the contracts are broken during the tests. Also, I can imagine that the specifications can be used for test case generations, it can probably be useful for QuickCheck, EUnit and any other tool that can benefit from the information about how the user intends the program to behave. To sum up. The contracts are a way for programmer to express intentions in a way that can be used for tools without having to parse human language written in comments. The tools can then use the information for whatever purposes they want, and also provide feedback to the user about the contracts. The contracts will not (at least not in our proposal) affect the semantics of Erlang, and the only effect on syntax is that you are allowed to include contracts as attributes. Best, Tobias From zac@REDACTED Wed Sep 5 14:05:16 2007 From: zac@REDACTED (Zac Brown) Date: Wed, 05 Sep 2007 08:05:16 -0400 Subject: [erlang-questions] Tilera 64-core chip In-Reply-To: <00c101c7ef6d$c1bf6c50$6400a8c0@einstein> References: <74E63A8C-7CDD-493B-85E9-EBB33FF08C3C@gmail.com> <00c101c7ef6d$c1bf6c50$6400a8c0@einstein> Message-ID: <46DE9B7C.6050609@zacbrown.org> I suspect that they may not be responding because they don't have answers for people and they know it. It seems to me they've come out a bit prematurely with this, more of a "build the excitement" press release than a "we have an actual product and would like to sell it to you" press release. Zac Salvatore Mangano wrote: > I too have tried to get them to respond. No luck yet. I guess you have to > have really deep pockets to get any attention. Perhaps contating someone in > mgmt directly would get better results. I miss the good ole days when the > hobbiest community meant something to the industry. Sigh. > > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of G Bulmer > Sent: Tuesday, September 04, 2007 1:35 PM > To: erlang-questions@REDACTED > Subject: Re: [erlang-questions] Tilera 64-core chip > > I have filled in the web-forms yesterday, and telephoned Tilera > several times today, but I haven't had a response. I have a potential > commercial application, so I'm keen to get prices on the board. > > Other interesting comments from someone who (says they) worked on RAW > are here: > http://realworldtech.com/forums/index.cfm? > action=detail&id=82137&threadid=82135&roomid=2 > they identify several possible weaknesses (though memory is the main > one that might effect my application). > > This person notes some of the weaknesses of RAW, and the apparent > improvements. It may be quite complex to use, depends on their > software development tools. > > GB > > _______________________________________________ > 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 parlar@REDACTED Wed Sep 5 15:09:44 2007 From: parlar@REDACTED (Jay Parlar) Date: Wed, 5 Sep 2007 09:09:44 -0400 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <46DEA872.5060704@it.uu.se> References: <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> <46DD9105.4050901@cs.ntua.gr> <337538cb0709041120k23ae74c4ga8de2440ef92ce7a@mail.gmail.com> <46DE5F76.1050601@it.uu.se> <337538cb0709050456k25ce1bfg4f1e85f036e90169@mail.gmail.com> <46DEA872.5060704@it.uu.se> Message-ID: On 9/5/07, Tobias Lindahl wrote: > To sum up. The contracts are a way for programmer to express intentions > in a way that can be used for tools without having to parse human > language written in comments. The tools can then use the information for > whatever purposes they want, and also provide feedback to the user about > the contracts. The contracts will not (at least not in our proposal) > affect the semantics of Erlang, and the only effect on syntax is that > you are allowed to include contracts as attributes. That sounds exactly the same as the new "Annotations" that are being added to Python 3. Interesting to see two dynamic languages going the same route at the same time. Jay P. From ulf.wiger@REDACTED Wed Sep 5 15:39:53 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 05 Sep 2007 15:39:53 +0200 Subject: [erlang-questions] Tilera 64-core chip In-Reply-To: <46DE9B7C.6050609@zacbrown.org> References: <74E63A8C-7CDD-493B-85E9-EBB33FF08C3C@gmail.com> <00c101c7ef6d$c1bf6c50$6400a8c0@einstein> <46DE9B7C.6050609@zacbrown.org> Message-ID: <46DEB1A9.6000807@ericsson.com> Zac Brown wrote: > I suspect that they may not be responding because they don't have > answers for people and they know it. It seems to me they've come out a > bit prematurely with this, more of a "build the excitement" press > release than a "we have an actual product and would like to sell it to > you" press release. One could also imagine that the response to their press release has been overwhelming, and that they simply cannot find the time to respond, esp. to individuals. Hopefully, this means that they are busy talking serious money with other people. (: Of course, I have no intel whatsoever about Tilera, so your guess is as good as mine. It would be rather silly to advertise PCIexpress cards, if they hadn't actually produced some, though... BR, Ulf W From erlang@REDACTED Wed Sep 5 16:12:41 2007 From: erlang@REDACTED (Peter Lund) Date: Wed, 05 Sep 2007 16:12:41 +0200 Subject: [erlang-questions] Tilera 64-core chip In-Reply-To: <46DEB1A9.6000807@ericsson.com> References: <74E63A8C-7CDD-493B-85E9-EBB33FF08C3C@gmail.com> <00c101c7ef6d$c1bf6c50$6400a8c0@einstein> <46DE9B7C.6050609@zacbrown.org> <46DEB1A9.6000807@ericsson.com> Message-ID: <46DEB959.5070707@lundata.se> Ulf Wiger (TN/EAB) skrev: > It would be rather silly to advertise PCIexpress > cards, if they hadn't actually produced some, > though... Isn't this exactly the way it is normally done over there on the Western hemisphere? :) /Peter From bob@REDACTED Wed Sep 5 18:13:46 2007 From: bob@REDACTED (Bob Ippolito) Date: Wed, 5 Sep 2007 09:13:46 -0700 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: <46DE5CB7.5010600@pmp.com.au> References: <46DCDE0C.9000504@pmp.com.au> <46DD31D4.5030309@ericsson.com> <46DE2F7C.8030509@pmp.com.au> <6a36e7290709042258j7cdec950wfd8799df8031c542@mail.gmail.com> <46DE5CB7.5010600@pmp.com.au> Message-ID: <6a36e7290709050913t5f9afddev2d820e6a7992f93e@mail.gmail.com> On 9/5/07, Benjamin Tolputt wrote: > Bob Ippolito wrote: > > Out of curiosity, what's the problem with a CEAN style solution? It's > > a standalone environment that you can move anywhere on the filesystem > > and it should still work. Other than the naming of the directories, > > it's not much different than how Mac OS X applications are packaged, > > and nobody really complains about that. > > > > -bob > > > The problem is that the CEAN distribution requires the user to extract > files to a directory tree THEN run a separate executable. For servers > and so on (which generally require some form of "setup" to install > anyway) this is not an issue, but for game development (the area of > development the guys are working in) this is not so good (impatient, > technically inexperienced user base). > > Something along the lines of a Py2EXE would be ideal. Py2EXE zips and > concatenates the required Python ".pyd" (i.e. Python's equivalent to > "beam" files) to the end of an executable stub. This executable stub > knows that it needs to retrieve the required code files (or in our case > Erlang "beam" files) from the compressed archive at the end of the file > rather than from the local file-system. I don't buy it. I never see files distributed online as a single ".exe" file unless it's an installer. More often it's either as a zip or a msi, either of which will carry multi-file payloads just fine. -bob From brianorourke@REDACTED Wed Sep 5 18:44:24 2007 From: brianorourke@REDACTED (Brian P O'Rourke) Date: Wed, 5 Sep 2007 09:44:24 -0700 Subject: [erlang-questions] September San Francisco Bay Area ErlLounge Message-ID: <314648e0709050944j2883e101vaa2000b6b18c18eb@mail.gmail.com> Hello all, The San Francisco Bay Area ErlLounge will be held on Wednesday, September 19th at 7:00 at the Tacit Knowledge office (244 Jackson St), a few blocks north of the Embarcadero Muni/BART station. There will be food, beer, wi-fi and whiteboards. http://groups.google.com/group/bay-area-erlangers/ RSVPs appreciated. --bpo From dougedmunds@REDACTED Wed Sep 5 19:24:37 2007 From: dougedmunds@REDACTED (Doug Edmunds) Date: Wed, 5 Sep 2007 10:24:37 -0700 Subject: [erlang-questions] error terminology Message-ID: Instead of calling all three of these 'errors' what is this correct terminology? Best I can come up with is syntax error, error message, and exit error. Are there others? A. syntax error ** 3: syntax error before " . " ** B. error message (not really an error like the other two, actually a result) {error,{type_mismatch,"testfile.dets"}} C. exit error =ERROR REPORT==== 5-Sep-2007::10:16:32 === Error in process <0.58.0> with exit value: {undef,[{det,open_file,[' woofbag.dets ',[]]},{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} ** exited: {undef,[{det,open_file,['woofbag.dets',[]]}, {erl_eval,do_apply,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** -------------- next part -------------- An HTML attachment was scrubbed... URL: From peter@REDACTED Wed Sep 5 19:36:30 2007 From: peter@REDACTED (Peter K Chan) Date: Wed, 5 Sep 2007 19:36:30 +0200 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: <6a36e7290709050913t5f9afddev2d820e6a7992f93e@mail.gmail.com> References: <46DCDE0C.9000504@pmp.com.au><46DD31D4.5030309@ericsson.com> <46DE2F7C.8030509@pmp.com.au><6a36e7290709042258j7cdec950wfd8799df8031c542@mail.gmail.com><46DE5CB7.5010600@pmp.com.au> <6a36e7290709050913t5f9afddev2d820e6a7992f93e@mail.gmail.com> Message-ID: While not strictly necessary, there is still some advantage of having a single, monolithic executable. For example, upgrading could be that much easier, and so is deployment (just run the .exe). Until the day of SAE is resurrected, I think the approach by Wings 3D works well. I installed it a few weeks ago and I think it would be a simple matter to reuse their packaging; just replacing the Wings 3D code with your own code. CEAN should work the same way too, I just haven't seen a standalone app distributed with CEAN yet. I also considered CEAN as a deployment packaging, but it seems to have a lot of files, especially on windows, and I wasn't clear to me (with my limited understanding), which was needed and which could be stripped out. Peter -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Bob Ippolito Sent: Wednesday, September 05, 2007 11:14 AM To: Benjamin Tolputt Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] Stand Alone Erlang or Equivalent On 9/5/07, Benjamin Tolputt wrote: > Bob Ippolito wrote: > > Out of curiosity, what's the problem with a CEAN style solution? It's > > a standalone environment that you can move anywhere on the filesystem > > and it should still work. Other than the naming of the directories, > > it's not much different than how Mac OS X applications are packaged, > > and nobody really complains about that. > > > > -bob > > > The problem is that the CEAN distribution requires the user to extract > files to a directory tree THEN run a separate executable. For servers > and so on (which generally require some form of "setup" to install > anyway) this is not an issue, but for game development (the area of > development the guys are working in) this is not so good (impatient, > technically inexperienced user base). > > Something along the lines of a Py2EXE would be ideal. Py2EXE zips and > concatenates the required Python ".pyd" (i.e. Python's equivalent to > "beam" files) to the end of an executable stub. This executable stub > knows that it needs to retrieve the required code files (or in our case > Erlang "beam" files) from the compressed archive at the end of the file > rather than from the local file-system. I don't buy it. I never see files distributed online as a single ".exe" file unless it's an installer. More often it's either as a zip or a msi, either of which will carry multi-file payloads just fine. -bob _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From tycho@REDACTED Wed Sep 5 19:39:09 2007 From: tycho@REDACTED (Tycho Luyben) Date: Wed, 5 Sep 2007 19:39:09 +0200 Subject: [erlang-questions] This has been asked: ECOMP VHDL Message-ID: <945847200709051039q1015a09bvea5a67392ef1940e@mail.gmail.com> Hi, I read something about it in the archived thread, but is there any concrete way of asking(/pleading :) Ericsson to opensource the VHDL for the FPGA? I am doing research on parallel programming for specialized processors with FPs. If Ericsson is not continuing this anyway why not open it; Sun even opensources production quality high perf processors, so why not follow? :) Anything we can do? Regards, Tycho -------------- next part -------------- An HTML attachment was scrubbed... URL: From icfp.publicity@REDACTED Wed Sep 5 20:57:15 2007 From: icfp.publicity@REDACTED (Matthew Fluet (ICFP Publicity Chair)) Date: Wed, 5 Sep 2007 13:57:15 -0500 Subject: [erlang-questions] ICFP07 Reminder: registration deadline Message-ID: <53ff55480709051157x1367212bnda81e538aa680a93@mail.gmail.com> ===================================================================== Final Call for Participation The 12th ACM SIGPLAN International Conference on Functional Programming (ICFP 2007) http://www.informatik.uni-bonn.de/~ralf/icfp07.html http://proglang.informatik.uni-freiburg.de/ICFP2007 Freiburg, Germany, 1-3 October 2007 ===================================================================== ***** Early Registration Deadline: September 7, 2007 ***** ICFP 2007 provides a forum for researchers and developers to hear about the latest work on the design, implementations, principles, and uses of functional programming. The conference covers the entire spectrum of work, from practice to theory, including its peripheries. Schedule including related workshops: * 30 Sep: ACM SIGPLAN Haskell Workshop * 30 Sep: ACM SIGPLAN Workshop on Scheme and Functional Programming * 1-3 Oct: ICFP07 * 4 Oct: ACM SIGPLAN Commercial Users of Functional Programming * 4 Oct: ACM SIGPLAN Workshop on Mechanizing Metatheory * 5 Oct: ACM SIGPLAN Erlang Workshop * 5 Oct: ACM SIGPLAN Workshop on ML * 5 Oct: ACM SIGPLAN Programming Languages meets Program Verification From richardc@REDACTED Wed Sep 5 21:01:07 2007 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 05 Sep 2007 21:01:07 +0200 Subject: [erlang-questions] error terminology In-Reply-To: References: Message-ID: <46DEFCF3.5090601@it.uu.se> Doug Edmunds wrote: > Instead of calling all three of these 'errors' what is this correct > terminology? Best I can come up with is syntax error, error message, > and exit error. > > Are there others? > > A. syntax error ** 3: syntax error before " . " ** Syntax error - I don't think that needs another name. > B. error message (not really an error like the other two, actually a > result) {error,{type_mismatch,"testfile.dets"}} Trickier. Error code or error value, I think. > C. exit error > =ERROR REPORT==== 5-Sep-2007::10:16:32 === Error in process < 0.58.0> with exit value: > {undef,[{det,open_file,['woofbag.dets',[]]},{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} Runtime error exception. /Richard From codeslinger@REDACTED Wed Sep 5 21:25:42 2007 From: codeslinger@REDACTED (Toby DiPasquale) Date: Wed, 5 Sep 2007 15:25:42 -0400 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: <6a36e7290709050913t5f9afddev2d820e6a7992f93e@mail.gmail.com> References: <46DCDE0C.9000504@pmp.com.au> <46DD31D4.5030309@ericsson.com> <46DE2F7C.8030509@pmp.com.au> <6a36e7290709042258j7cdec950wfd8799df8031c542@mail.gmail.com> <46DE5CB7.5010600@pmp.com.au> <6a36e7290709050913t5f9afddev2d820e6a7992f93e@mail.gmail.com> Message-ID: <876ef97a0709051225o5dfedc54v5165501fa4f2d8c1@mail.gmail.com> On 9/5/07, Bob Ippolito wrote: > I don't buy it. I never see files distributed online as a single > ".exe" file unless it's an installer. More often it's either as a zip > or a msi, either of which will carry multi-file payloads just fine. IME, most of those times, the ".exe" is a CAB file with a self-extracting header, anyway, which is another multi-file archive format from Microsoft. Almost all non-trivial applications today have multiple files that need to be distributed and installed, so I'm personally with Bob on this one. On the other hand, I do have to say that py2exe is great and easy to work with, especially for a non-Windows guy like myself. Having something like this for Erlang wouldn't suck. -- Toby DiPasquale From patrickdlogan@REDACTED Wed Sep 5 20:32:29 2007 From: patrickdlogan@REDACTED (Patrick Logan) Date: Wed, 5 Sep 2007 11:32:29 -0700 (PDT) Subject: [erlang-questions] testing frameworks Message-ID: <830177.15849.qm@web63906.mail.re1.yahoo.com> I found ErUnit to be easy to get started with, and meets my basic needs of grouping and running tests. http://bestfriendchris.com/blog/2007/04/23/erunit-unit-testing-for-erlang/ First I tried EUnit but found it difficult to get started. I am not sure how these two compare feature by feature. I don't need much out of a unit test framework, just the basics. -Patrick On 9/5/07, Torbjorn Tornkvist wrote: We at Kreditor are using Yatsy ( http://code.google.com/p/yatsy ), and EUnit. ____________________________________________________________________________________ Park yourself in front of a world of choices in alternative vehicles. Visit the Yahoo! Auto Green Center. http://autos.yahoo.com/green_center/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob@REDACTED Wed Sep 5 21:52:35 2007 From: bob@REDACTED (Bob Ippolito) Date: Wed, 5 Sep 2007 12:52:35 -0700 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: <876ef97a0709051225o5dfedc54v5165501fa4f2d8c1@mail.gmail.com> References: <46DCDE0C.9000504@pmp.com.au> <46DD31D4.5030309@ericsson.com> <46DE2F7C.8030509@pmp.com.au> <6a36e7290709042258j7cdec950wfd8799df8031c542@mail.gmail.com> <46DE5CB7.5010600@pmp.com.au> <6a36e7290709050913t5f9afddev2d820e6a7992f93e@mail.gmail.com> <876ef97a0709051225o5dfedc54v5165501fa4f2d8c1@mail.gmail.com> Message-ID: <6a36e7290709051252x1278543i595f65f3700b7e4f@mail.gmail.com> On 9/5/07, Toby DiPasquale wrote: > On 9/5/07, Bob Ippolito wrote: > > I don't buy it. I never see files distributed online as a single > > ".exe" file unless it's an installer. More often it's either as a zip > > or a msi, either of which will carry multi-file payloads just fine. > > IME, most of those times, the ".exe" is a CAB file with a > self-extracting header, anyway, which is another multi-file archive > format from Microsoft. Almost all non-trivial applications today have > multiple files that need to be distributed and installed, so I'm > personally with Bob on this one. On the other hand, I do have to say > that py2exe is great and easy to work with, especially for a > non-Windows guy like myself. Having something like this for Erlang > wouldn't suck. > Yeah, I agree that py2exe is nice. I wrote the equivalent of py2exe for Mac OS X (py2app). However, I don't think that py2exe is really measurably better now that it produces a single exe than it used to be when it produced a three (or more) file distribution (bare minimum of app exe, python dll, library zip). I know that people constantly asked for the single file feature until it eventually happened, but I really don't see very many other single file apps. -bob From xpdoka@REDACTED Wed Sep 5 22:26:48 2007 From: xpdoka@REDACTED (Dominic Williams) Date: Wed, 5 Sep 2007 22:26:48 +0200 (CEST) Subject: [erlang-questions] testing frameworks In-Reply-To: <337538cb0709050314r3ce4bf59y239c70757b02a0c4@mail.gmail.com> References: <95be1d3b0709050249s6857a26fnb59bae227b3802b7@mail.gmail.com> <337538cb0709050314r3ce4bf59y239c70757b02a0c4@mail.gmail.com> Message-ID: <27787.82.67.147.243.1189024008.squirrel@www.geekisp.com> Hi, >> There are a few testing frameworks around, I suppose the most mature >> are the OTP test server, EUnit and maybe Extreme Forge (n?e XPDojo). I suppose Extreme Forge can be called mature in the sense of having been started a long time ago, but it certainly doesn't have much momentum for the moment, due to lack of spare time, sadly. And we're actually in the middle of a sort of rewrite, so it's not even that stable. It's not really a framework which I would expect another project like Erlide to support - it's really intended to be a fully-fledged IDE and more itself, for the small intersection of people interested in Erlang and Extreme Programming. Extreme Forge currently runs tests which can be defined using any convention, and we actually plan to add support for unit tests written for Eunit, so that it's easy to use Extreme Forge when you've already got lots of Eunit tests (and habits). That's what I'd suggest for Erlide. > Where is Extreme Forge used? I'm not sure it's used anywhere serious yet. Even Nicolas and I don't use it at work yet, although we're not far from being able to. We'll let the list know when we feel it's worth giving it a try. > Trying to get user stories from > http://trac.extremeforge.net/extremeforge/wiki/UserStories says: > FILE_VIEW privileges are required to perform this operation Thanks for pointing that out, I'll look into it. Regards, Dominic Williams http://dominicwilliams.net http://extremeforge.net ---- From dmercer@REDACTED Wed Sep 5 22:47:53 2007 From: dmercer@REDACTED (David Mercer) Date: Wed, 5 Sep 2007 15:47:53 -0500 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: <6a36e7290709051252x1278543i595f65f3700b7e4f@mail.gmail.com> References: <46DCDE0C.9000504@pmp.com.au><46DD31D4.5030309@ericsson.com> <46DE2F7C.8030509@pmp.com.au><6a36e7290709042258j7cdec950wfd8799df8031c542@mail.gmail.com><46DE5CB7.5010600@pmp.com.au><6a36e7290709050913t5f9afddev2d820e6a7992f93e@mail.gmail.com><876ef97a0709051225o5dfedc54v5165501fa4f2d8c1@mail.gmail.com> <6a36e7290709051252x1278543i595f65f3700b7e4f@mail.gmail.com> Message-ID: <00f501c7effe$0867f1f0$891ea8c0@SSI.CORP> A stand-alone executable is very useful for putting on a USB thumb drive. I keep a lot of utilities on my USB drive that I can plug in wherever I go. Imagine being able to stick your USB drive into any Windows PC and firing up Erlang. Cheers, David From bjt@REDACTED Wed Sep 5 23:03:25 2007 From: bjt@REDACTED (Benjamin Tolputt) Date: Thu, 06 Sep 2007 07:03:25 +1000 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: <6a36e7290709050913t5f9afddev2d820e6a7992f93e@mail.gmail.com> References: <46DCDE0C.9000504@pmp.com.au> <46DD31D4.5030309@ericsson.com> <46DE2F7C.8030509@pmp.com.au> <6a36e7290709042258j7cdec950wfd8799df8031c542@mail.gmail.com> <46DE5CB7.5010600@pmp.com.au> <6a36e7290709050913t5f9afddev2d820e6a7992f93e@mail.gmail.com> Message-ID: <46DF199D.7070403@pmp.com.au> Bob Ippolito wrote: > I don't buy it. I never see files distributed online as a single > ".exe" file unless it's an installer. More often it's either as a zip > or a msi, either of which will carry multi-file payloads just fine. > It need not be a "single file executable" (though this is preferable given the methods of "copyright protection" employed by game publishers), but requiring a "directory tree" is a pain to manage simply for the underlying language. Take a look at the deployment/file tree of most commercially released games. They have a very simple tree usually consisting of a "root" having all executable files with their DLL's, a data directory (with generally a handful of "archive" files collating & compressing the game resources), and a save file directory. It has only been open-source (i.e. non-commercial) games & applications that have used the default "deployment directory tree" used by Python, Erlang, and other languages without compressing &/or somehow collating the files. For open-source &/or server applications needing to be easily updated, being able to access the individual files is a good thing. However, games (and a variety of other application deployments) are meant to be "solid" when delivered. This means delivering as simple & compact a deployment tree as possible. This may or may not be the best practice as far as us "server developers" go, but this is standard practice in the game development. Being able to have a single executable with one or two other files would also be good. It is just my belief (right or wrong) that if we are going this far, we may as well make it a single executable. Regards, B.J.Tolputt From tobbe@REDACTED Wed Sep 5 23:06:18 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Wed, 05 Sep 2007 23:06:18 +0200 Subject: [erlang-questions] testing frameworks In-Reply-To: <95be1d3b0709050431n58c81fb3t9078916b10f31aae@mail.gmail.com> References: <95be1d3b0709050249s6857a26fnb59bae227b3802b7@mail.gmail.com> <95be1d3b0709050431n58c81fb3t9078916b10f31aae@mail.gmail.com> Message-ID: Vlad Dumitrescu wrote: > Hi Tobbe, > > On 9/5/07, *Torbjorn Tornkvist* > wrote: > > > We at Kreditor are using Yatsy ( http://code.google.com/p/yatsy ), > and EUnit. > > > Could you please make a quick comparison between the two? What does the > one have that the other doesn't? Than main thing I see with yatsy is the > report generator, but there might be others. I'm afraid I don't know the ETS (Erlang Test Server) that well. The SUITE-files of Yatsy are almost identical with what ETS defines. Apart from that, the code doesn't have anything in common. I guess that one major benefit with Yatsy is that is has got a public repository. What is sorely lacking in Yatsy however, is proper documentation. There is a 'getting started' text at: http://blog.tornkvist.org/blog.yaws?id=1183311409264197 but more docs should/will be written. NB: We are also using Yatsy in combination with CruiseControl with good effect. Cheers, Tobbe From vladdu55@REDACTED Wed Sep 5 23:03:02 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 5 Sep 2007 21:03:02 +0000 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: <00f501c7effe$0867f1f0$891ea8c0@SSI.CORP> References: <46DD31D4.5030309@ericsson.com> <46DE2F7C.8030509@pmp.com.au> <6a36e7290709042258j7cdec950wfd8799df8031c542@mail.gmail.com> <46DE5CB7.5010600@pmp.com.au> <6a36e7290709050913t5f9afddev2d820e6a7992f93e@mail.gmail.com> <876ef97a0709051225o5dfedc54v5165501fa4f2d8c1@mail.gmail.com> <6a36e7290709051252x1278543i595f65f3700b7e4f@mail.gmail.com> <00f501c7effe$0867f1f0$891ea8c0@SSI.CORP> Message-ID: <95be1d3b0709051403t1a993674r219bbaa4d7714df7@mail.gmail.com> Hi, On 9/5/07, David Mercer wrote: > > A stand-alone executable is very useful for putting on a USB thumb > drive. I > keep a lot of utilities on my USB drive that I can plug in wherever I go. > Imagine being able to stick your USB drive into any Windows PC and firing > up > Erlang. Why can't you do that with a multi-file application? I once put the whole Eclipse installation including Erlide (and thus a full Erlang installation) on an USB and after some small tweaking it worked fine. The only trouble was that it was slow (because Eclipse needs to touch many files), but it worked. regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmercer@REDACTED Wed Sep 5 23:18:47 2007 From: dmercer@REDACTED (David Mercer) Date: Wed, 5 Sep 2007 16:18:47 -0500 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: <95be1d3b0709051403t1a993674r219bbaa4d7714df7@mail.gmail.com> References: <46DD31D4.5030309@ericsson.com> <46DE2F7C.8030509@pmp.com.au> <6a36e7290709042258j7cdec950wfd8799df8031c542@mail.gmail.com> <46DE5CB7.5010600@pmp.com.au> <6a36e7290709050913t5f9afddev2d820e6a7992f93e@mail.gmail.com> <876ef97a0709051225o5dfedc54v5165501fa4f2d8c1@mail.gmail.com> <6a36e7290709051252x1278543i595f65f3700b7e4f@mail.gmail.com> <00f501c7effe$0867f1f0$891ea8c0@SSI.CORP> <95be1d3b0709051403t1a993674r219bbaa4d7714df7@mail.gmail.com> Message-ID: <00fc01c7f002$591297a0$891ea8c0@SSI.CORP> Why can't you do that with a multi-file application? Good point. You can. I stand corrected. Cheers, David _____ From: Vlad Dumitrescu [mailto:vladdu55@REDACTED] Sent: Wednesday, September 05, 2007 16:03 To: dmercer@REDACTED Cc: Erlang Questions Subject: Re: [erlang-questions] Stand Alone Erlang or Equivalent Hi, On 9/5/07, David Mercer wrote: A stand-alone executable is very useful for putting on a USB thumb drive. I keep a lot of utilities on my USB drive that I can plug in wherever I go. Imagine being able to stick your USB drive into any Windows PC and firing up Erlang. Why can't you do that with a multi-file application? I once put the whole Eclipse installation including Erlide (and thus a full Erlang installation) on an USB and after some small tweaking it worked fine. The only trouble was that it was slow (because Eclipse needs to touch many files), but it worked. regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From bjt@REDACTED Thu Sep 6 00:21:41 2007 From: bjt@REDACTED (Benjamin Tolputt) Date: Thu, 06 Sep 2007 08:21:41 +1000 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: References: <46DCDE0C.9000504@pmp.com.au> Message-ID: <46DF2BF5.7050908@pmp.com.au> Kenneth Lundin wrote: > I think you and many others discussing Standalone Erlang are mixing up > things here. The important thing for end user deployment is that it is > easy and quick to install and uninstall a SW package and that does not > imply that for example all the beam files must be packed together in > one or a few bigger files. > As long as the installation is distributed as e.g a self extracting > and self installing exe file (Windows) it should be ok. > Of course this package should only contain the beam files from OTP > that are actually used plus the specific .beam files for the SW in > question. > I would agree that there seems to be some confusion in the discussion. On the other hand, being able to create a single executable (with perhaps one or two other files for the related beam archives) is where I am coming from. As I mentioned in an earlier email, the standard in game deployment is a single executable, with whatever necessary DLL's required (as few as possible), and a small number of (generally large) archive files for the game resources (everything from scripts & byte-code to image, models, & sound files). The primary reason I suggested having the beam files "compiled into" the executable is that the game publishing industry is quite strict about having copyright protection mechanisms embedded into the deployment. I am recommending Erlang as the "primary" development language rather than just the "scripting" language (as this would make best use of Erlang's superior concurrency) and, as such, being able to protect (if only marginally) the beam files that actually relate to how Erlang loads modules, executes, etc (i.e. the kernel, stdlib, etc) is somoewhat of a commercial (as opposed to "technical") necessity. A single executable with beams in a separate archive (ZIP or otherwise) would be suitable with some personal modifications to the Erlang VM's source code (i.e. adding in relatively useless encryption).code database or zip file)? > We have already implemented (but not released) code loading from ZIP archives. > > We are working on "standalone" features but I can not promise today when we > will release something. > I understand the need to not make promises, but could we get a "squishy" delivery time frame? That is, is this something for "soon" or planned for a more "long term" release? > Erlang/OTP as available today as open source is a DEVELOPMENT SYSTEM > which the developer uses to create a TARGET SYSTEM. The target system > can be a simple standalone application to be installed on many clients > or it can be a complex distributed embedded server system. > Again, something I completely understand. For server deployments (requiring hot-swap code updating and the like), the deployment tree as it stands works well (and is pretty much a requirement). However, there are not many applications I have seen that use Erlang outside this niche. Given the paradigm shift that has & still is occurring in the game development industry toward high concurrency / multi-threaded application structures (in order to make full use of multi-core PC's and consoles) - I think being able to deploy something that will not hot-swap (and hence does not need the large number of "real" files in the deployment) will add to Erlang's ability to be used in such an environment. > To create the target system you need the following: > 1) Know what parts of Erlang/OTP you need in the target app. > You can pick OTP components on complete application level i.e. stdlib, > kernel, mnesia etc. which is easy. > <...snip...> > 3) Pack 1 and 2 together in a distribution. > You can pack together all resulting files and directory hierarchies > just as they are. > Or you can try to create something which result in just a few files > when installed (e.g. beam files packed together, one per OTP > application or one for all .beam files) > > We will primarily address 1 and 3 above and probably offer several > alternatives for doing them (1) & (3) are pretty much the essentials for what I am looking at anyway. If the code for these deployment tools becomes available, it should be fine & dandy to use for deployments where commercial considerations require "twiddling" for copyright protection purposes. Regards, B.J.Tolputt From michael.campbell@REDACTED Thu Sep 6 01:11:01 2007 From: michael.campbell@REDACTED (Michael Campbell) Date: Wed, 5 Sep 2007 19:11:01 -0400 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: <46DF2BF5.7050908@pmp.com.au> References: <46DCDE0C.9000504@pmp.com.au> <46DF2BF5.7050908@pmp.com.au> Message-ID: <811f2f1c0709051611t7f1bbd71q372b35e36b481bb3@mail.gmail.com> On 9/5/07, Benjamin Tolputt wrote: > I would agree that there seems to be some confusion in the discussion. > On the other hand, being able to create a single executable (with > perhaps one or two other files for the related beam archives) is where I > am coming from. > > As I mentioned in an earlier email, the standard in game deployment is a > single executable, with whatever necessary DLL's required (as few as > possible), and a small number of (generally large) archive files for the > game resources (everything from scripts & byte-code to image, models, & > sound files). What kid of games are you talking about? I'll admit, I'm probably using as bad an anti-example as I can come up with, but a recent MMORPG clocks in at 6709 files. Probably 20 of those are for a custom UI I've installed. From kwilkin@REDACTED Thu Sep 6 01:31:26 2007 From: kwilkin@REDACTED (Kurt) Date: Thu, 06 Sep 2007 11:31:26 +1200 Subject: [erlang-questions] Review of Programming Erlang Message-ID: <46DF3C4E.5070506@gmail.com> http://books.slashdot.org/article.pl?sid=07/09/05/1410213 Here come the hordes :) Some highlights from the discussion: - http://books.slashdot.org/comments.pl?sid=288705&cid=20483641 contradicts 'rebelscience' rather succinctly : "5. Ok, now I'm thinking you're not just a troll but verifiably insane." - http://books.slashdot.org/comments.pl?sid=288705&cid=20485203 : "The book was outstanding--a pleasure to read." And it seems general awareness of Erlang itself is quite high. Cheers, better go get my copy, Kurt. From gbulmer@REDACTED Thu Sep 6 01:49:18 2007 From: gbulmer@REDACTED (G Bulmer) Date: Thu, 6 Sep 2007 00:49:18 +0100 Subject: [erlang-questions] Tilera 64-core chip In-Reply-To: References: Message-ID: <61FE0D2E-396A-4CA7-905F-5579408E2249@gmail.com> Ulf Wiger wrote: > From: "Ulf Wiger (TN/EAB)" > Subject: Re: [erlang-questions] Tilera 64-core chip > To: Zac Brown > Cc: erlang-questions@REDACTED > Message-ID: <46DEB1A9.6000807@REDACTED> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > Zac Brown wrote: >> I suspect that they may not be responding because they don't have >> answers for people and they know it. It seems to me they've come >> out a >> bit prematurely with this, more of a "build the excitement" press >> release than a "we have an actual product and would like to sell >> it to >> you" press release. > > One could also imagine that the response to their press > release has been overwhelming, and that they simply > cannot find the time to respond, esp. to individuals. Yup! > > Hopefully, this means that they are busy talking > serious money with other people. (: That is exactly what I would hope and expect too. > > Of course, I have no intel whatsoever about Tilera, > so your guess is as good as mine. > > It would be rather silly to advertise PCIexpress > cards, if they hadn't actually produced some, > though... Agreed. Much easier to advertise the chip and see who calls. I have no good evidence that they don't have product either, so I'm *not* going to 'see a conspiracy' when the behaviour can be explained by limited resources or incompetence. It's easy to forget that many of these companies are very focused on 'crossing the chasm', and if you don't fit their profile, you are classified as a dangerous, future-threatening distraction. I was trying to sell stuff with only two sales engineers to cover the world, and we wanted customers who looked able to pay our salaries and bonuses for the quarter (at least). I have been on the other side too. I've dealt with large technology companies in the past who wouldn't respond (actually one told us to go away until we could show them 'the money'). If they had done any checking on our company, it would have been clear that we could drive a huge, open, market sector to them. In all those cases, the product existed, they either didn't understand who we were, or were chasing other deals. I am surprised that Ericsson got no response, but there are several plausible explanations. I'll keep calling them until I get clarity. GB From gbulmer@REDACTED Thu Sep 6 02:14:57 2007 From: gbulmer@REDACTED (G Bulmer) Date: Thu, 6 Sep 2007 01:14:57 +0100 Subject: [erlang-questions] erlang-questions Digest, Vol 4, Issue 17 In-Reply-To: References: Message-ID: <17EDBC28-CAA8-4ABA-B583-98CAD60345EE@gmail.com> On 5 Sep 2007, at 19:57, Peter Lund wrote: > From: Peter Lund > Subject: Re: [erlang-questions] Tilera 64-core chip > To: erlang-questions@REDACTED > > Ulf Wiger (TN/EAB) skrev: > >> It would be rather silly to advertise PCIexpress >> cards, if they hadn't actually produced some, >> though... > > Isn't this exactly the way it is normally done over there > on the Western hemisphere? :) > > /Peter Believe it or not, it's often a *bit* more subtle ;-) I would expect an ad for vapour-ware to be something that takes more time and commitment than a PCIe board. For example, just the chip. That way it's *much* easier to filter out 'time wasters' who might imagine they'll plug in the board, load the SDK, and 'go'. The few real prospects who can show they can deal with a raw chip should be easier to spot in the crowd. Cynical, moi ?-) Of course, Tilera's investors may be getting nervous now that Intel are getting more bullish about their 80-core ... :-) [I don't expect so, really sorry guys.] GB From kip.macy@REDACTED Thu Sep 6 02:52:44 2007 From: kip.macy@REDACTED (Kip Macy) Date: Wed, 5 Sep 2007 17:52:44 -0700 Subject: [erlang-questions] Tilera 64-core chip In-Reply-To: <61FE0D2E-396A-4CA7-905F-5579408E2249@gmail.com> References: <61FE0D2E-396A-4CA7-905F-5579408E2249@gmail.com> Message-ID: > I am surprised that Ericsson got no response, but there are several > plausible explanations. > > I'll keep calling them until I get clarity. > GB It isn't uncommon for companies to "sell" something when they've only gotten 10 boards back from production. Also, at least a few chip companies want you to pay them 100,000$ before they'll even start a conversation. -Kip From gbulmer@REDACTED Thu Sep 6 03:29:58 2007 From: gbulmer@REDACTED (G Bulmer) Date: Thu, 6 Sep 2007 02:29:58 +0100 Subject: [erlang-questions] Tilera 64-core chip In-Reply-To: References: <61FE0D2E-396A-4CA7-905F-5579408E2249@gmail.com> Message-ID: On 6 Sep 2007, at 01:52, Kip Macy wrote: >> I am surprised that Ericsson got no response, but there are several >> plausible explanations. >> >> I'll keep calling them until I get clarity. >> GB > > It isn't uncommon for companies to "sell" something when they've only > gotten 10 boards back from production. Yup. But that is different from suggesting something is vapour, which is what I was reacting to. A company may have only 10 boards, and be honest about this with their real prospects, because it may be no problem to them (I worked on software for automotive manufacturers, and we didn't get new technology available *in quantity* much earlier than we needed it). > Also, at least a few chip > companies want you to pay them 100,000$ before they'll even start a > conversation. Absolutely agree, I have suffered that, but I feel that is their prerogative. It is received wisdom that spreading yourself too thin, or chasing the wrong kind of business, can kill a company just as surely as a bad product. Asking for $100,000 is a cheap, simple way of testing a prospects commitment if you have the nerve, and can live with the fallout. For better, or for worse, companies can operate any legal way they like, and they must live with the consequences of their actions. If a company keeps asking for $100,000 and no one pays, then they usually die or change. If someone pays, then ... I'll call Tilera until I feel I have clarity. I haven't got $100,000. GB From gbulmer@REDACTED Thu Sep 6 04:46:20 2007 From: gbulmer@REDACTED (G Bulmer) Date: Thu, 6 Sep 2007 03:46:20 +0100 Subject: [erlang-questions] Tilera 64-core chip - let's help them help us! Message-ID: <3F98B5CB-7EB8-4589-9A38-401D6F7C1727@gmail.com> Hopefully Tilera's marketing group have a google alert set up, and so will discover our posts soon. Maybe Erlang isn't 'on their radar'? That would be a real shame as I can imagine Erlang+specialised embedded pieces, using their 'native' technology, may be a great approach to exploiting their architecture. There may be some enormous benefits to supporting Erlang for them. So, to help Tilera, could we say what we'd need? Then maybe Tilera will consider the possible costs and benefits. I'll start: 0. Decent documentation for the architecture. The published NVIDIA 8800 documentation isn't good enough for confident design and extrapolation from tests; I feel better documentation would have helped. 1. I'd like a free or very cheap (under $50) license for an emulator and the Tilera software development kit (e.g. like NVIDIA's CUDA). I'm fine if that software is restricted to use for evaluation. I want to understand the cost and time to learn how to use Tilera's technology, and I don't *need* hardware for that. Someone may figure out, without hardware, whether it's worth porting Erlang to it, and a free Tilera emulator & SDK would enable more people to participate and tackle parts of the solution. 2. I could be satisfied with a 'cut-down' version of their PCIe board (with fewer GigE connections, no 10 GigE, fewer processors, less on- board memory, maybe running at a lower clock rate, maybe narrower PCIe) providing I could make reasonable extrapolations from it, so that I could do realistic de-risking, evaluation and development. A cut-down board should to be significantly cheaper than a 'real' board to make it a justifiable alternative because I assume I'd need 'the real thing' for production development if it all worked out. I'd offer the same suggestions to Intel; if they want to get their 80- core widely used, Erlang is the way to go, so support the community !-) Garry PS - I'd suggest we pool orders, but that's likely a nightmare to make work, and it may be too late for (my) Christmas presents ;-) From dougedmunds@REDACTED Thu Sep 6 05:24:43 2007 From: dougedmunds@REDACTED (Doug Edmunds) Date: Wed, 5 Sep 2007 20:24:43 -0700 Subject: [erlang-questions] indata Message-ID: In the design principle docs, the term "indata" is used several times, but without a definition. ( See events.html, fsm.html, gen_server.html, sup_princ.html) Can someone please define "indata" ? Thanks. dae -------------- next part -------------- An HTML attachment was scrubbed... URL: From bent@REDACTED Thu Sep 6 05:39:07 2007 From: bent@REDACTED (Ben Munat) Date: Wed, 05 Sep 2007 17:39:07 -1000 Subject: [erlang-questions] testing frameworks In-Reply-To: References: <95be1d3b0709050249s6857a26fnb59bae227b3802b7@mail.gmail.com> <95be1d3b0709050431n58c81fb3t9078916b10f31aae@mail.gmail.com> Message-ID: <46DF765B.603@munat.com> Torbjorn Tornkvist wrote: > I'm afraid I don't know the ETS (Erlang Test Server) that well. Wait... so there's "ETS: Erlang Test Server" and "ETS: Erlang Term Storage"? That's a bit confusing... Ben From nic@REDACTED Thu Sep 6 05:47:02 2007 From: nic@REDACTED (nic) Date: Thu, 06 Sep 2007 15:47:02 +1200 Subject: [erlang-questions] Tilera 64-core chip In-Reply-To: References: <61FE0D2E-396A-4CA7-905F-5579408E2249@gmail.com> Message-ID: <46DF7836.9070804@tymar.com> There's a comment in this article http://www.theregister.co.uk/2007/08/20/tilera_tile64_chip/ which says they're being made by TSMC, and they already have 10 customers (who are bound to have paid $100,000 each...) "including 3Com, GoBackTV and Codian" Nic Kip Macy wrote: >> I am surprised that Ericsson got no response, but there are several >> plausible explanations. >> >> I'll keep calling them until I get clarity. >> GB > > It isn't uncommon for companies to "sell" something when they've only > gotten 10 boards back from production. Also, at least a few chip > companies want you to pay them 100,000$ before they'll even start a > conversation. > > -Kip > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From bengt.kleberg@REDACTED Thu Sep 6 08:21:11 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 06 Sep 2007 08:21:11 +0200 Subject: [erlang-questions] indata In-Reply-To: References: Message-ID: <46DF9C57.6020403@ericsson.com> greetings, please try using ''input data'' as the definition of indata. i have not read the documents. i only base my guess on the meaning of the swedish word indata. bengt Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." On 2007-09-06 05:24, Doug Edmunds wrote: > In the design principle docs, the term "indata" is used several times, but > without a definition. ( See events.html, fsm.html, gen_server.html, > sup_princ.html) > > Can someone please define "indata" ? > > Thanks. > > > dae > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From igwan@REDACTED Thu Sep 6 08:35:56 2007 From: igwan@REDACTED (igwan) Date: Thu, 06 Sep 2007 08:35:56 +0200 Subject: [erlang-questions] indata In-Reply-To: References: Message-ID: <46DF9FCC.90409@free.fr> Hello, From the context, it seems that "indata" stands for init data, i.e. the argument passed to the init/1 function. igwan Doug Edmunds a ?crit : > In the design principle docs, the term "indata" is used several times, > but > without a definition. ( See events.html, fsm.html, gen_server.html, > sup_princ.html) > > Can someone please define "indata" ? > > Thanks. > > > dae > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From vladdu55@REDACTED Thu Sep 6 08:37:46 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Thu, 6 Sep 2007 08:37:46 +0200 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: <46DF2BF5.7050908@pmp.com.au> References: <46DCDE0C.9000504@pmp.com.au> <46DF2BF5.7050908@pmp.com.au> Message-ID: <95be1d3b0709052337i485d80d7gf1e7d0985932cff7@mail.gmail.com> Hi, On 9/6/07, Benjamin Tolputt wrote: > > The primary reason I suggested having the beam files "compiled into" the > executable is that the game publishing industry is quite strict about > having copyright protection mechanisms embedded into the deployment. I > am recommending Erlang as the "primary" development language rather than > just the "scripting" language (as this would make best use of Erlang's > superior concurrency) and, as such, being able to protect (if only > marginally) the beam files that actually relate to how Erlang loads > modules, executes, etc (i.e. the kernel, stdlib, etc) is somoewhat of a > commercial (as opposed to "technical") necessity. > Why would beam files more securely protected if packed in a zip archive as compared to unpacked in a directory? There is already a mechanism to encrypt the debug_info data that might be included in the beam files. I suppose it would be relatively easy to do the same with the actual beam code and decrypt at load time. best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From bjt@REDACTED Thu Sep 6 08:53:01 2007 From: bjt@REDACTED (Benjamin Tolputt) Date: Thu, 06 Sep 2007 16:53:01 +1000 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: <95be1d3b0709052337i485d80d7gf1e7d0985932cff7@mail.gmail.com> References: <46DCDE0C.9000504@pmp.com.au> <46DF2BF5.7050908@pmp.com.au> <95be1d3b0709052337i485d80d7gf1e7d0985932cff7@mail.gmail.com> Message-ID: <46DFA3CD.7010300@pmp.com.au> Vlad Dumitrescu wrote: > Why would beam files more securely protected if packed in a zip > archive as compared to unpacked in a directory? It is not so much "securing" the beam files from people as to stop them "replacing" the beam files easily. In an encrypted zip (or better yet, appended to a protected executable) the "core" beam files used at the "low level" of Erlang can be protected from "easy" replacement by casual users. Everyone in game development realizes that it is impossible to completely protect a product from hacking, but it is a commercial necessity (coming from the publishers) that one include SOME form of copyright protection mechanism. By adding a "standard" EXE protection mechanism to the Erlang VM executable and including the "core" Erlang beam files (i.e. kernel, stdlib, etc) in the exe file - we get enough "protection coverage" to make the publishers happy. For me, there is also the added bonus of simple "single file" deployment but I don't have to deal with third-parties in order to deploy (and so it is not a necessity for me). > There is already a mechanism to encrypt the debug_info data that might > be included in the beam files. I suppose it would be relatively easy > to do the same with the actual beam code and decrypt at load time. This is talking about something completely different. I am not particularly worried about the byte-code being readable. It is more about making it hard for them to be changed (which I realize is somewhat the opposite of an Erlang advantage we all like). Regards, B.J.Tolputt From vladdu55@REDACTED Thu Sep 6 09:16:28 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Thu, 6 Sep 2007 09:16:28 +0200 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: <46DFA3CD.7010300@pmp.com.au> References: <46DCDE0C.9000504@pmp.com.au> <46DF2BF5.7050908@pmp.com.au> <95be1d3b0709052337i485d80d7gf1e7d0985932cff7@mail.gmail.com> <46DFA3CD.7010300@pmp.com.au> Message-ID: <95be1d3b0709060016m1602ac6cia3c394bcbfc7c7ea@mail.gmail.com> Hi, On 9/6/07, Benjamin Tolputt wrote: > > Vlad Dumitrescu wrote: > > Why would beam files more securely protected if packed in a zip > > archive as compared to unpacked in a directory? > It is not so much "securing" the beam files from people as to stop them > "replacing" the beam files easily. In an encrypted zip (or better yet, > appended to a protected executable) the "core" beam files used at the > "low level" of Erlang can be protected from "easy" replacement by casual > users. > > > There is already a mechanism to encrypt the debug_info data that might > > be included in the beam files. I suppose it would be relatively easy > > to do the same with the actual beam code and decrypt at load time. > This is talking about something completely different. I am not > particularly worried about the byte-code being readable. It is more > about making it hard for them to be changed (which I realize is somewhat > the opposite of an Erlang advantage we all like). Erm, if the byte-code is encrypted, how would you replace a beam file with a different one without breaking the encryption? If the encryption is broken, then it feels about just as easy to replace a file in the file system or in a zip archive. One could also use separate schemes to ensure it's difficult to tamper with data, like for example storing the MD5 signature of files somewhere. regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From saleyn@REDACTED Thu Sep 6 12:25:56 2007 From: saleyn@REDACTED (Serge Aleynikov) Date: Thu, 06 Sep 2007 05:25:56 -0500 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <46DD9105.4050901@cs.ntua.gr> References: <46DC193D.10504@ericsson.com> <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> <46DD9105.4050901@cs.ntua.gr> Message-ID: <46DFD5B4.4030301@gmail.com> Kostis Sagonas wrote: > To give you an idea, in edoc you currently write something of the form: > > %% @spec (integer(), float()) -> atom() > > to describe the types of a function foo. In the new language you would > write (or preferably change the above edoc comment to be): > > -spec(foo/2 :: ((integer(), float()) -> atom())). > Would there be a way to specify concrete values (such as atoms 'ok' and 'error' shown below) rather than types, similar to edoc style? @spec () -> {ok, integer()} | {error, string()} Serge From kostis@REDACTED Thu Sep 6 11:27:36 2007 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 06 Sep 2007 12:27:36 +0300 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <46DFD5B4.4030301@gmail.com> References: <46DC193D.10504@ericsson.com> <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> <46DD9105.4050901@cs.ntua.gr> <46DFD5B4.4030301@gmail.com> Message-ID: <46DFC808.60503@cs.ntua.gr> Serge Aleynikov wrote: > Kostis Sagonas wrote: >> To give you an idea, in edoc you currently write something of the form: >> >> %% @spec (integer(), float()) -> atom() >> >> to describe the types of a function foo. In the new language you >> would write (or preferably change the above edoc comment to be): >> >> -spec(foo/2 :: ((integer(), float()) -> atom())). >> > > Would there be a way to specify concrete values (such as atoms 'ok' and > 'error' shown below) rather than types, similar to edoc style? > > @spec () -> {ok, integer()} | {error, string()} Yes. This exists already. Kostis From saleyn@REDACTED Thu Sep 6 12:39:06 2007 From: saleyn@REDACTED (Serge Aleynikov) Date: Thu, 06 Sep 2007 05:39:06 -0500 Subject: [erlang-questions] : Design of the Erlang VM In-Reply-To: <20070809072013.GA18285@erix.ericsson.se> References: <17B3E2BE-FAF4-4F2B-BE87-CDFC1275FEFB@gmail.com> <62B65A91-2BFE-4ADE-BBF3-624D52A9AD96@gmail.com> <20070809072013.GA18285@erix.ericsson.se> Message-ID: <46DFD8CA.20303@gmail.com> Could you shed some light on how non-tail recursive calls are being handled in the absence of use of the processor stack? Serge Raimo Niskanen wrote: > No, they are not C function calls. C function calls push > the arguments (that may come not only from the calling > code, but also from other places, nevertheless there > is explicit code to place them ---) on the processor stack, > pushes the return addresss on the processor stack and then > jumps to the function address. When the function returns > the return instruction pops the return address from the > stack and jumps back to where it came from. Then the > calling code restores the stack pointer to remove the > call arguments from the processor stack. > > BEAM instructions are the instruction word followed by > zero or more operand words. The instruction word is > an address to the processor instruction sequence that > implements the BEAM instruction, as Bjorn said below. > > The BEAM instructions are just straight processor code > that do not expect arguments on the processor stack > and do not end in a processor return instruction. > > The BEAM instructions themselves increment the BEAM > instruction pointer and pick up operand words into > processor registers. They end by reading the next > instruction and since it is a jump address - jump > to that address and then BEAM is performing the next > BEAM instruction. > > If the BEAM instruction is a (conditional) jump or call > et.al, the instruction just sets the BEAM instruction > pointer to point to the next BEAM instruction to > actually perform, reads it and jumps. > > So there is no call setup overhead per instruction. > > > On Wed, Aug 08, 2007 at 08:03:46PM +0100, Joel Reymont wrote: >> On Aug 8, 2007, at 6:26 AM, Bjorn Gustavsson wrote: >> >>> The first word in each instruction points to the executable C code >>> for the instruction. That first instruction word is followed by >>> zero or more operand words. >> Would it be right to say that Erlang VM instructions are C function >> calls? This is my understanding of the above. >> >> Is there significant overhead of function call setup per instruction? >> >> Thanks, Joel >> >> -- >> http://wagerlabs.com >> >> >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > From richardc@REDACTED Thu Sep 6 12:10:44 2007 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 06 Sep 2007 12:10:44 +0200 Subject: [erlang-questions] Design of the Erlang VM In-Reply-To: <46BAB2BE.1060601@bitfurnace.com> References: <17B3E2BE-FAF4-4F2B-BE87-CDFC1275FEFB@gmail.com> <62B65A91-2BFE-4ADE-BBF3-624D52A9AD96@gmail.com> <46BAB2BE.1060601@bitfurnace.com> Message-ID: <46DFD224.2070505@it.uu.se> Damien Morton wrote: > It turns out that there are some sequences of bytecodes that occur more > frequently than others, and that you can structure the main interpreter > loop so that common traces will result in straight through execution, > that is, you test to see if the next instruction is the same as for the > following code block, and either fall through or jump to the appropriate > label. The Erlang bytecode loader does a large amount of work rewriting the generic "transport format" bytecode in the object files into the concrete internal bytecode operations that are actually executed. This recognizes common sequences and replaces them with optimized single-opcode versions. (I don't know if the fallthrough trick is also used, but it wouldn't surprise me.) /Richard From gbulmer@REDACTED Thu Sep 6 12:33:42 2007 From: gbulmer@REDACTED (G Bulmer) Date: Thu, 6 Sep 2007 11:33:42 +0100 Subject: [erlang-questions] Tilera 64-core chip - let's help them help us! In-Reply-To: References: <3F98B5CB-7EB8-4589-9A38-401D6F7C1727@gmail.com> Message-ID: <1F6572CB-97F0-44DF-8E34-5A2CF68C12C1@gmail.com> On 6 Sep 2007, at 03:59, Kip Macy wrote: >> I'd offer the same suggestions to Intel; if they want to get their >> 80- >> core widely used, Erlang is the way to go, so support the >> community !-) > > Its coming, but will be targeted largely at graphics. ... > I meant to say "to start off with". > Targeting at graphics doesn't mean ignore Erlang. Several things worth considering: 1. Tim Sweeney's POPL 2006 talk about the 'next language for game playing' http://www.cs.princeton.edu/~dpw/popl/06/Tim-POPL.ppt I must be clear, much of that is about *statically* typed functional languages, like Haskell, and not Erlang-style dynamic typing, but part is also concerned with concurrency. 2. erlang-questions Digest, Vol 4, Issue 8, 4. Stand Alone Erlang or Equivalent (Benjamin Tolputt) I believe this is for the games industry. 3. NVIDIA and ATI are targeted on graphics, but they can see the value of supporting other industries through CUDA and CTM. Both are putting resources into non-graphic application areas. A view of challenges for non-graphics uses for many-core chips comes from "The view from Berkeley" http://www.eecs.berkeley.edu/Pubs/ TechRpts/2006/EECS-2006-158.pdf and also http://view.eecs.berkeley.edu/wiki/Main_Page as relevant. One key point for Berkeley is "To maximize programmer productivity, programming models should be independent of the number of processors.", which also seems to agree with Tim Sweeney, and is a pretty good fit to Erlang. Erlang is a practical tool available *now* which should map onto many independent cores (which seems to be Tilera's architecture) better than it maps onto e.g. NVIDIA 8800. Providing it's a good fit , Tilera and Intel could broaden their technologies appeal and usefulness, by helping the community port Erlang. A good Erlang port could bring production-quality technology with an outstanding reputation early in their products lifecycle. IMHO, getting a book as good as Joe Armstrong's will take significant time (which is precious right now for Tilera); it'd almost be worth supporting an Erlang port just to leverage Joe's book and the new interest in Erlang stimulated by it. Further, if Tilera can do it right, they could cover there costs. Intel have benefits to gain from a good Erlang port too, and HiPE may even work on the i80-core! What's not to like? GB From richardc@REDACTED Thu Sep 6 12:52:25 2007 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 06 Sep 2007 12:52:25 +0200 Subject: [erlang-questions] : Design of the Erlang VM In-Reply-To: <46DFD8CA.20303@gmail.com> References: <17B3E2BE-FAF4-4F2B-BE87-CDFC1275FEFB@gmail.com> <62B65A91-2BFE-4ADE-BBF3-624D52A9AD96@gmail.com> <20070809072013.GA18285@erix.ericsson.se> <46DFD8CA.20303@gmail.com> Message-ID: <46DFDBE9.9040606@it.uu.se> Serge Aleynikov wrote: > Could you shed some light on how non-tail recursive calls are being > handled in the absence of use of the processor stack? Every Erlang process has its own stack, for storing Erlang function call frames. It's just that it's not the same as the C call stack (which is used by the emulator itself). The emulator code explicitly handles the processes' stacks, storing and retreiving local variables, saving and restoring the Beam-code program counter, incrementing and decrementing the process' stack pointer, etc. The process stack is basically just an array of words, to be manipulated at will. /Richard From hughperkins@REDACTED Thu Sep 6 12:51:37 2007 From: hughperkins@REDACTED (Hugh Perkins) Date: Thu, 6 Sep 2007 18:51:37 +0800 Subject: [erlang-questions] Tilera 64-core chip - let's help them help us! In-Reply-To: <1F6572CB-97F0-44DF-8E34-5A2CF68C12C1@gmail.com> References: <3F98B5CB-7EB8-4589-9A38-401D6F7C1727@gmail.com> <1F6572CB-97F0-44DF-8E34-5A2CF68C12C1@gmail.com> Message-ID: <837db430709060351i34ba6b54x3872c5bec24e19d6@mail.gmail.com> > One key point for Berkeley is "To maximize programmer productivity, > programming models should be independent of the number of > processors." What are good resources I can read to find out how Erlang programs get split across different processors? What about things like maps? To what extent can/will Erlang map them across different processors? From zac@REDACTED Thu Sep 6 13:55:25 2007 From: zac@REDACTED (Zac Brown) Date: Thu, 06 Sep 2007 07:55:25 -0400 Subject: [erlang-questions] This seems an unfair benchmark Message-ID: <46DFEAAD.80906@zacbrown.org> http://weblog.plexobject.com/?p=1576 I was surfing reddit.com this morning and found this benchmark. The problem with it is Erlang is the only one actually using concurrency in it, and I suspect his Erlang wasn't written very well. He was comparing Erlang using threads to Java/C++/Ruby only using method invocations. Seems a bit biased eh? Zac From kenneth.lundin@REDACTED Thu Sep 6 16:00:48 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Thu, 6 Sep 2007 16:00:48 +0200 Subject: [erlang-questions] Tilera 64-core chip - let's help them help us! In-Reply-To: <837db430709060351i34ba6b54x3872c5bec24e19d6@mail.gmail.com> References: <3F98B5CB-7EB8-4589-9A38-401D6F7C1727@gmail.com> <1F6572CB-97F0-44DF-8E34-5A2CF68C12C1@gmail.com> <837db430709060351i34ba6b54x3872c5bec24e19d6@mail.gmail.com> Message-ID: On 9/6/07, Hugh Perkins wrote: > > One key point for Berkeley is "To maximize programmer productivity, > > programming models should be independent of the number of > > processors." > > What are good resources I can read to find out how Erlang programs get > split across different processors? > Erlang programs don't get split across different processors by automatic. You use the builtin very lightweight Erlang processes to solve your problem, you use message passing between the processes. This the typical way to structure an Erlang program which is used regardless of how many processors or cores there are. When you run on an SMP system with separate CPU's or with a multicore CPU the Erlang VM can use many schedulers running as OS threads to achieve true parallell execution. Typically you use 2 schedulers on a dual core system, 4 on a quad core system and so on. Each of the scheduler threads will pick Erlang-processes from a common run-queue and execute them. A typical system can have thousands of Erlang processes running simultaneously. A WEB-server implemented in Erlang will typically create one or sometimes several Erlang processes per request. This approach will mostly scale well with the number of processors/cores in an SMP system. > What about things like maps? To what extent can/will Erlang map them > across different processors? If you implement a parallell map function your self, which is really easy you can take advantage of many processors. As said Earlier nothing will be parallell by automatic. The nice thing with Erlang is that it is so easy and natural to implement explicit parallellism. /Kenneth (Erlang/OTP team at Ericsson) From gbulmer@REDACTED Thu Sep 6 16:10:24 2007 From: gbulmer@REDACTED (G Bulmer) Date: Thu, 6 Sep 2007 15:10:24 +0100 Subject: [erlang-questions] Tilera 64-core chip - let's help them help us! In-Reply-To: <837db430709060351i34ba6b54x3872c5bec24e19d6@mail.gmail.com> References: <3F98B5CB-7EB8-4589-9A38-401D6F7C1727@gmail.com> <1F6572CB-97F0-44DF-8E34-5A2CF68C12C1@gmail.com> <837db430709060351i34ba6b54x3872c5bec24e19d6@mail.gmail.com> Message-ID: On 6 Sep 2007, at 11:51, Hugh Perkins wrote: >> One key point for Berkeley is "To maximize programmer productivity, >> programming models should be independent of the number of >> processors." > > What are good resources I can read to find out how Erlang programs get > split across different processors? I'd like to know that too, please. I've failed to find documentation on the underlying architecture. AFAIK the unit of Erlang program distribution is the Erlang process, i.e. an Erlang process is not split to run in parallel across CPU cores. > > What about things like maps? To what extent can/will Erlang map them > across different processors? I don't know for sure. My understanding from "Programming Erlang", and especially page 366 '20.2 Parallelizing Sequential Code' is map executes within a single Erlang process and therefore on a single CPU processor, without parallel execution. The pmap example of 20.2 shows an approach to parallelization (or parallelisation for the Brits :-) For very interesting alternatives, 'nested data parallelism', have a look at: http://haskell.org/haskellwiki/GHC/Data_Parallel_Haskell or http://www.cse.unsw.edu.au/~chak/papers/CLPKM06.html or GB From thomasl_erlang@REDACTED Thu Sep 6 15:25:23 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Thu, 6 Sep 2007 06:25:23 -0700 (PDT) Subject: [erlang-questions] Tilera 64-core chip - let's help them help us! In-Reply-To: <1F6572CB-97F0-44DF-8E34-5A2CF68C12C1@gmail.com> Message-ID: <203659.66003.qm@web38809.mail.mud.yahoo.com> --- G Bulmer wrote: > IMHO, getting a book as good as Joe Armstrong's will > take significant > time (which is precious right now for Tilera); it'd > almost be worth > supporting an Erlang port just to leverage Joe's > book and the new > interest in Erlang stimulated by it. Further, if > Tilera can do it > right, they could cover there costs. Intel have > benefits to gain from > a good Erlang port too, and HiPE may even work on > the i80-core! > What's not to like? I would strongly suspect the chip is intended for performance-conscious embedded C/C++ applications (like so many other similar chips). Surely Tilera's main marketing and sales effort has to be in that direction, and turning from that mainstream to emphasizing Erlang would then seem a pretty risky move. What if the customers shrug and turn elsewhere? (I'm not convinced this view is entirely correct, but some strong examples are probably needed to start addressing that market. As a startup, you can't vary too many parameters at the same time. Better let other people take most of the bullets :-) Regarding the advancement of Erlang as a development environment for these chips, I do think it would be interesting to see the people in this thread getting their PCI cards and start hacking away. But it's probably best seen as cutting-edge R&D at this point. Best, Thomas ____________________________________________________________________________________ Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase. http://farechase.yahoo.com/ From thomasl_erlang@REDACTED Thu Sep 6 15:37:54 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Thu, 6 Sep 2007 06:37:54 -0700 (PDT) Subject: [erlang-questions] Tilera 64-core chip - let's help them help us! In-Reply-To: <837db430709060351i34ba6b54x3872c5bec24e19d6@mail.gmail.com> Message-ID: <291037.68853.qm@web38805.mail.mud.yahoo.com> --- Hugh Perkins wrote: > What are good resources I can read to find out how > Erlang programs get > split across different processors? > > What about things like maps? To what extent > can/will Erlang map them > across different processors? Here is the 5,000 ft view of how it works in Erlang/OTP on Unix: An Erlang node is basically a Unix heavyweight process. If you are using SMP, then the Erlang processes ready to run on that node are scheduled onto the available threads from a global run queue. (Without SMP, the ready processes are handled by the main thread only.) Port programs and suchlike may additionally run in a separate thread pool. There are variations on the details in the literature, but this is also a fairly 'standard' way of implementing these things. You can use a number of libraries, such as rpc or slave, to map computations onto nodes. Or roll your own. Hope this helps. Best, Thomas ____________________________________________________________________________________ Need a vacation? Get great deals to amazing places on Yahoo! Travel. http://travel.yahoo.com/ From me@REDACTED Thu Sep 6 17:05:37 2007 From: me@REDACTED (KatolaZ) Date: Thu, 6 Sep 2007 17:05:37 +0200 Subject: [erlang-questions] This seems an unfair benchmark In-Reply-To: <46DFEAAD.80906@zacbrown.org> References: <46DFEAAD.80906@zacbrown.org> Message-ID: <20070906150537.GK4287@katolaz.homeunix.net> On Thu, Sep 06, 2007 at 07:55:25AM -0400, Zac Brown wrote: > http://weblog.plexobject.com/?p=1576 > > I was surfing reddit.com this morning and found this benchmark. The > problem with it is Erlang is the only one actually using concurrency in > it, and I suspect his Erlang wasn't written very well. He was comparing > Erlang using threads to Java/C++/Ruby only using method invocations. > Seems a bit biased eh? > It is not a news :-) All benchmarks are biased. All benchmarks usually demonstrate what the author of the benchmark himself want to be considered as "true" :-) HND Enzo -- [ Enzo Nicosia aka KatolaZ --- GLUG Catania -- Freaknet Medialab ] [ me [at] katolaz.homeunix.net -- http://katolaz.homeunix.net -- ] [ GNU/Linux User:#325780/ICQ UIN: #258332181/GPG key ID 0B5F062F ] [ Fingerprint: 8E59 D6AA 445E FDB4 A153 3D5A 5F20 B3AE 0B5F 062F ] From dking@REDACTED Thu Sep 6 17:46:04 2007 From: dking@REDACTED (David King) Date: Thu, 6 Sep 2007 08:46:04 -0700 Subject: [erlang-questions] This seems an unfair benchmark In-Reply-To: <46DFEAAD.80906@zacbrown.org> References: <46DFEAAD.80906@zacbrown.org> Message-ID: > http://weblog.plexobject.com/?p=1576 > I was surfing reddit.com this morning and found this benchmark. The > problem with it is Erlang is the only one actually using > concurrency in > it, and I suspect his Erlang wasn't written very well. He was > comparing > Erlang using threads to Java/C++/Ruby only using method invocations. > Seems a bit biased eh? From the article: "As far as mapping algorithm to the language, I found that Erlang fit very nicely for distributed algorithms that involve a lot of communications. I left the C++, Java and Ruby version very simple and didn?t try to implement truly indpendent processes and communication because that would have required a lot more effort". From hughperkins@REDACTED Thu Sep 6 18:17:37 2007 From: hughperkins@REDACTED (Hugh Perkins) Date: Fri, 7 Sep 2007 00:17:37 +0800 Subject: [erlang-questions] Tilera 64-core chip - let's help them help us! In-Reply-To: <291037.68853.qm@web38805.mail.mud.yahoo.com> References: <837db430709060351i34ba6b54x3872c5bec24e19d6@mail.gmail.com> <291037.68853.qm@web38805.mail.mud.yahoo.com> Message-ID: <837db430709060917x1c069413hf0aea0a4fd89e342@mail.gmail.com> > > What about things like maps? To what extent can/will Erlang map them > > across different processors? > If you implement a parallell map function your self, which is really easy > you can take advantage of many processors. Ok. Of course, this gets away from a desirable abstraction, stated by Garry, where we dont have to look up how many processor cores we are running on, how many are free at the moment, and then split our map(s) accordingly. On a related note, I get the impression that Erlang runs in a VM? What documentation is available on how this works? To what extent is information about maps and so on available from within the bytecode? And, the ten thousand dollar question: to what extent could it be feasible to modify the VM to automatically split maps across available processor cores? From sean.hinde@REDACTED Thu Sep 6 18:53:22 2007 From: sean.hinde@REDACTED (Sean Hinde) Date: Thu, 6 Sep 2007 17:53:22 +0100 Subject: [erlang-questions] Tilera 64-core chip - let's help them help us! In-Reply-To: <837db430709060917x1c069413hf0aea0a4fd89e342@mail.gmail.com> References: <837db430709060351i34ba6b54x3872c5bec24e19d6@mail.gmail.com> <291037.68853.qm@web38805.mail.mud.yahoo.com> <837db430709060917x1c069413hf0aea0a4fd89e342@mail.gmail.com> Message-ID: On 6 Sep 2007, at 17:17, Hugh Perkins wrote: >>> What about things like maps? To what extent can/will Erlang map >>> them >>> across different processors? >> If you implement a parallell map function your self, which is >> really easy >> you can take advantage of many processors. > > Ok. Of course, this gets away from a desirable abstraction, stated by > Garry, where we dont have to look up how many processor cores we are > running on, how many are free at the moment, and then split our map(s) > accordingly. You don't need to care about how many cores you have to make a parallel map function in erlang, you only need to care about cores when you start the emulator. Parallel map is really really simple in erlang. No loss of abstraction at all. Just stick this function in a small library file and away you go (code lifted from Luke Gorries blog: http:// lukego.livejournal.com/). pmap(F,List) -> [wait_result(Worker) || Worker <- [spawn_worker(self(),F,E) || E <- List]]. spawn_worker(Parent, F, E) -> erlang:spawn_monitor(fun() -> Parent ! {self(), F(E)} end). wait_result({Pid,Ref}) -> receive {'DOWN', Ref, _, _, normal} -> receive {Pid,Result} -> Result end; {'DOWN', Ref, _, _, Reason} -> exit(Reason) end. The VM will take care of passing out the work around the cores as described by Kenneth a few posts ago. Sean From puzza007@REDACTED Thu Sep 6 18:46:40 2007 From: puzza007@REDACTED (Paul Oliver) Date: Thu, 6 Sep 2007 17:46:40 +0100 Subject: [erlang-questions] erl_interface question Message-ID: Hi, I'm trying to link erl_interface code with non-threaded libs and get the following: poliver@REDACTED:~/foo$ make gcc -fPIC -O2 -fomit-frame-pointer -Wall -g -Wno-pointer-sign -I. -I/opt/informix/incl/esql -I/tmp/appserv/incl -c arse.c -o ix86/arse.o arse.c: In function 'main': arse.c:33: warning: 'e' is used uninitialized in this function gcc -L/opt/informix/lib -L/opt/informix/lib/esql -L/usr/lib/erlang/lib/erl_interface-3.5.5.3/lib -L/tmp/appserv/lib/ix86 ix86/arse.o -lerl_interface_st -lei_st -lOT_InfTcl -lc -o arse /usr/lib/erlang/lib/erl_interface- 3.5.5.3/lib/liberl_interface_st.a(erl_eterm.o): In function `erl_copy_term': (.text+0xfba): undefined reference to `__erl_errno' /usr/lib/erlang/lib/erl_interface- 3.5.5.3/lib/liberl_interface_st.a(erl_eterm.o): In function `erl_mk_var': (.text+0x12b8): undefined reference to `__erl_errno' /usr/lib/erlang/lib/erl_interface- 3.5.5.3/lib/liberl_interface_st.a(erl_eterm.o): In function `__erl_mk_reference': (.text+0x1362): undefined reference to `__erl_errno' /usr/lib/erlang/lib/erl_interface- 3.5.5.3/lib/liberl_interface_st.a(erl_eterm.o): In function `erl_mk_atom': (.text+0x1481): undefined reference to `__erl_errno' /usr/lib/erlang/lib/erl_interface- 3.5.5.3/lib/liberl_interface_st.a(erl_eterm.o): In function `erl_mk_port': (.text+0x1699): undefined reference to `__erl_errno' /usr/lib/erlang/lib/erl_interface- 3.5.5.3/lib/liberl_interface_st.a(erl_eterm.o):(.text+0x175b): more undefined references to `__erl_errno' follow collect2: ld returned 1 exit status make: *** [arse] Error 1 I've seen thispost. Can anyone tell me what I'm doing wrong? Thanks in advance, Paul. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gbulmer@REDACTED Thu Sep 6 19:20:38 2007 From: gbulmer@REDACTED (G Bulmer) Date: Thu, 6 Sep 2007 18:20:38 +0100 Subject: [erlang-questions] This seems an unfair benchmark In-Reply-To: References: Message-ID: <9700D073-40CF-484A-AEBC-13092F43CB53@gmail.com> On 6 Sep 2007, at 16:46, David King wrote: > Subject: Re: [erlang-questions] This seems an unfair benchmark >> http://weblog.plexobject.com/?p=1576 >> I was surfing reddit.com this morning and found this benchmark. The >> problem with it is Erlang is the only one actually using >> concurrency in >> it, and I suspect his Erlang wasn't written very well. He was >> comparing >> Erlang using threads to Java/C++/Ruby only using method invocations. >> Seems a bit biased eh? > > From the article: > "As far as mapping algorithm to the language, I found that Erlang fit > very nicely for distributed algorithms that involve a lot of > communications. I left the C++, Java and Ruby version very simple and > didn?t try to implement truly indpendent processes and communication > because that would have required a lot more effort". Oh, don't ya just lurv this stuff !-) I notice comments are disabled! I wonder why :-) Summary. Here's some code in Java, C++, Ruby and Erlang. Only Erlang implements the distributed Byzantine Generals Problem algorithm, because the other languages required too much effort. I am not going to stop and conclude anything from this simple fact, and I am not going to explain why, or how I can continue. The Java and Erlang programs break, so lets ignore that. The Ruby program looked broken so I killed it off. I'll compare these programs, which don't actually implement the algorithm, with this Erlang program that does work mostly, and conclude that one of the programs that doesn't actually work, and which crashes, is the performance leader over the one program that does work! I remember a story in the original "The Psychology of Computer Programming" by Gerald Weinberg (I read it around 1980, so sorry for errors). Weinberg was asked to help a project which had failed badly to deliver. He came up with a solution, but the projects technical lead complained that Weinbergs working solution was much slower than his broken solution. Weinberg, approximately, said "if the requirement to give the correct answer was removed from my solution, it could go many, many times faster". Ho, hum, how times have changed :-) I clicked on the 'chart' and threw away the weird Erlang value, and the graph looks much more interesting. Has anyone got a proper implementation of the distributed Byzantine Generals Problem algorithm in Erlang? GB From dineshbvadhia@REDACTED Thu Sep 6 18:50:31 2007 From: dineshbvadhia@REDACTED (Dinesh B Vadhia) Date: Thu, 6 Sep 2007 09:50:31 -0700 Subject: [erlang-questions] Seeking guidance Message-ID: We are a startup in the US considering the use of Erlang for an API-based server product. Customers will use the product to build web-based applications that will call the API's on the server. The Erlang concurrent and distributed facilities would be significant pluses for us. What we are unclear about is Erlang's support for different languages calling our API's ie. can customers building web-based applications with Java, C, C++, C#, Ruby or Python call the API's? Thank-you. Dinesh -------------- next part -------------- An HTML attachment was scrubbed... URL: From dot@REDACTED Thu Sep 6 21:00:14 2007 From: dot@REDACTED (Tony Finch) Date: Thu, 6 Sep 2007 20:00:14 +0100 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <46DD9105.4050901@cs.ntua.gr> References: <46DC193D.10504@ericsson.com> <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> <46DD9105.4050901@cs.ntua.gr> Message-ID: On Tue, 4 Sep 2007, Kostis Sagonas wrote: > > In the new language you would write (or preferably change the above edoc > comment to be): > > -spec(foo/2 :: ((integer(), float()) -> atom())). What is the reason for the trailing ()s? It would be nice if the syntax had less redundant visual noise. Tony. -- f.a.n.finch http://dotat.at/ IRISH SEA: SOUTHERLY, BACKING NORTHEASTERLY FOR A TIME, 3 OR 4. SLIGHT OR MODERATE. SHOWERS. MODERATE OR GOOD, OCCASIONALLY POOR. From dmorton@REDACTED Thu Sep 6 22:14:21 2007 From: dmorton@REDACTED (Damien Morton) Date: Thu, 06 Sep 2007 16:14:21 -0400 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: References: <46DC193D.10504@ericsson.com> <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> <46DD9105.4050901@cs.ntua.gr> Message-ID: <46E05F9D.9050108@bitfurnace.com> +1 on less syntactic clutter. The /2-ness of foo is clear from the remainder of the type specification There are redundant parentheses too - are they neeed? -spec(foo :: (integer, float) -> atom) just reads better to me > On Tue, 4 Sep 2007, Kostis Sagonas wrote: > >> In the new language you would write (or preferably change the above edoc >> comment to be): >> >> -spec(foo/2 :: ((integer(), float()) -> atom())). >> > > What is the reason for the trailing ()s? It would be nice if the syntax > had less redundant visual noise. > > Tony. > From kostis@REDACTED Thu Sep 6 22:54:01 2007 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 06 Sep 2007 23:54:01 +0300 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <46E05F9D.9050108@bitfurnace.com> References: <46DC193D.10504@ericsson.com> <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> <46DD9105.4050901@cs.ntua.gr> <46E05F9D.9050108@bitfurnace.com> Message-ID: <46E068E9.5030809@cs.ntua.gr> Damien Morton wrote: > +1 on less syntactic clutter. > > The /2-ness of foo is clear from the remainder of the type specification > > There are redundant parentheses too - are they neeed? > > -spec(foo :: (integer, float) -> atom) > > just reads better to me >> On Tue, 4 Sep 2007, Kostis Sagonas wrote: >> >>> In the new language you would write (or preferably change the above edoc >>> comment to be): >>> >>> -spec(foo/2 :: ((integer(), float()) -> atom())). >>> >> >> What is the reason for the trailing ()s? It would be nice if the syntax >> had less redundant visual noise. I very much agree with this wish, but: 1. As mentioned in some other post in this thread, types like the following one are also allowed {ok, integer()} | {error, string()} and there needs to be way to distinguish between atoms (i.e. singleton types) and type names. 2. We want to be as much as possible compatible with edoc. 3. Some types can also take parameters. For example, the user might define lists of integers and atoms as: list(integer() | atom()) Kostis From erik.stenman@REDACTED Thu Sep 6 23:15:41 2007 From: erik.stenman@REDACTED (Erik Stenman) Date: Thu, 6 Sep 2007 23:15:41 +0200 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <46E05F9D.9050108@bitfurnace.com> References: <46DC193D.10504@ericsson.com> <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> <46DD9105.4050901@cs.ntua.gr> <46E05F9D.9050108@bitfurnace.com> Message-ID: On 6 sep 2007, at 22.14, Damien Morton wrote: > +1 on less syntactic clutter. > > The /2-ness of foo is clear from the remainder of the type > specification > > There are redundant parentheses too - are they neeed? > > -spec(foo :: (integer, float) -> atom) > > just reads better to me The parentheses are needed to distinguish between a literal and a type. integer() means any integer. integer means the atom 'integer' /Erik >> On Tue, 4 Sep 2007, Kostis Sagonas wrote: >> >>> In the new language you would write (or preferably change the >>> above edoc >>> comment to be): >>> >>> -spec(foo/2 :: ((integer(), float()) -> atom())). >>> >> >> What is the reason for the trailing ()s? It would be nice if the >> syntax >> had less redundant visual noise. >> >> Tony. >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From dmercer@REDACTED Thu Sep 6 23:16:10 2007 From: dmercer@REDACTED (David Mercer) Date: Thu, 6 Sep 2007 16:16:10 -0500 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: References: <46DC193D.10504@ericsson.com><837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr><337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com><46DD9105.4050901@cs.ntua.gr> Message-ID: <013d01c7f0cb$26938d60$891ea8c0@SSI.CORP> On Thursday, September 06, 2007, Tony Finch wrote: > What is the reason for the trailing ()s? It would be nice if the syntax > had less redundant visual noise. So it can tell the difference between an integer and the atom 'integer'? Cheers, David -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Sent: 14:00 To: Kostis Sagonas Cc: Erlang Subject: Re: [erlang-questions] Intel Quad CPUs On Tue, 4 Sep 2007, Kostis Sagonas wrote: > > In the new language you would write (or preferably change the above edoc > comment to be): > > -spec(foo/2 :: ((integer(), float()) -> atom())). What is the reason for the trailing ()s? It would be nice if the syntax had less redundant visual noise. Tony. -- f.a.n.finch http://dotat.at/ IRISH SEA: SOUTHERLY, BACKING NORTHEASTERLY FOR A TIME, 3 OR 4. SLIGHT OR MODERATE. SHOWERS. MODERATE OR GOOD, OCCASIONALLY POOR. _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From dustin@REDACTED Thu Sep 6 23:33:08 2007 From: dustin@REDACTED (Dustin Sallings) Date: Thu, 6 Sep 2007 14:33:08 -0700 Subject: [erlang-questions] Seeking guidance In-Reply-To: References: Message-ID: <927EA926-806E-43B5-9CE5-CA874759E2BC@spy.net> On Sep 6, 2007, at 9:50 , Dinesh B Vadhia wrote: > The Erlang concurrent and distributed facilities would be > significant pluses for us. What we are unclear about is Erlang's > support for different languages calling our API's ie. can customers > building web-based applications with Java, C, C++, C#, Ruby or > Python call the API's? The languages don't matter, it's just the protocols. I've seen a lot of SOAP-based protocols that you pretty much couldn't use outside of java, and I've implemented custom binary protocols for which I've got implementations in at least three languages. If the goal of the protocol is interoperability, and you actually try to achieve that goal, then you should be fine. -- Dustin Sallings -------------- next part -------------- An HTML attachment was scrubbed... URL: From zac@REDACTED Thu Sep 6 22:38:28 2007 From: zac@REDACTED (Zac Brown) Date: Thu, 06 Sep 2007 16:38:28 -0400 Subject: [erlang-questions] This seems an unfair benchmark In-Reply-To: <9700D073-40CF-484A-AEBC-13092F43CB53@gmail.com> References: <9700D073-40CF-484A-AEBC-13092F43CB53@gmail.com> Message-ID: <46E06544.2060103@zacbrown.org> An HTML attachment was scrubbed... URL: From gbulmer@REDACTED Thu Sep 6 23:56:18 2007 From: gbulmer@REDACTED (G Bulmer) Date: Thu, 6 Sep 2007 22:56:18 +0100 Subject: [erlang-questions] Tilera 64-core chip - ... In-Reply-To: References: Message-ID: <91E729C7-68FE-43C1-8C78-5558DA77B62A@gmail.com> On 6 Sep 2007, at 16:46, Thomas Lindgren wrote: > --- G Bulmer wrote: >> IMHO, getting a book as good as Joe Armstrong's will >> take significant >> time (which is precious right now for Tilera); it'd >> almost be worth >> supporting an Erlang port just to leverage Joe's >> book and the new >> interest in Erlang stimulated by it. Further, if >> Tilera can do it >> right, they could cover there costs. Intel have >> benefits to gain from >> a good Erlang port too, and HiPE may even work on >> the i80-core! >> What's not to like? > > I would strongly suspect the chip is intended for > performance-conscious embedded C/C++ applications > (like so many other similar chips). Yes, I believe that is how they are describing it too. On the other hand, 80% of the performance is in 20% of the code (or 96% in 4% :-), so using Erlang for the 80% of the code, and 20% in their own C-ish language may be fine. With this approach, I get some of Erlang's benefits for those less performance-critical parts. My perception is many of Erlangs benefits are expensive to write for one- off solutions. For example, I might write e.g. codecs in Tilera-C, but do all of the server monitoring, management, availability, etc in Erlang. > Surely Tilera's > main marketing and sales effort has to be in that > direction, and turning from that mainstream to > emphasizing Erlang would then seem a pretty risky > move. What if the customers shrug and turn elsewhere? I', not advocating Tilera spend much effort on it. I am a believer in Moores "Crossing the Chasm"; I don't expect them to distract themselves. I am suggesting a small investment on a 'spread bet'. A small amount of support for self-motivated external communities, with no hard deadlines. Specifically, I am suggesting Tilera support a few external open source groups working with different, but applicable technologies, and do it at a relatively low cost. The goal isn't main-stream, business critical outcomes. It is growing a skill base, getting more brain-power applied to their products, and hence improve their near term appeal, and broaden their long term market base. Even Intel 80- core may benefit from this too. > > (I'm not convinced this view is entirely correct, but > some strong examples are probably needed to start > addressing that market. As a startup, you can't vary > too many parameters at the same time. Better let other > people take most of the bullets :-) I would agree with you unequivocally *except* Tilera don't have a clear field. They are playing against established companies like Intel, Sun, IBM, NVIDIA, AMD/ATI, MIPS licensees, ... who already have commercial and technology e-co systems. After all, we have to agree x86 was not the best CPU for much of the 90's, but Intel puled through to their dominant position. I feel that working with a few, well chosen, Open Source communities makes sense for many-core chip producers, while there is a window of opportunity. I think I'm suggesting initial steps (documentation, cheap SDK's) that they likely need to go through anyway. > > Regarding the advancement of Erlang as a development > environment for these chips, I do think it would be > interesting to see the people in this thread getting > their PCI cards and start hacking away. But it's > probably best seen as cutting-edge R&D at this point. Yes. That's a great way to look at it. They won't get full attention or control, but they avoid the major problem of building and retaining talented R&D groups; Hackers who take part are 'self selecting'. I could justify a few hundred $'s for a few months interesting hacking (just on the basis of not eating out, or going down the pub as often :-) Success may be very useful to the smarter many-core companies! GB From bhatti_shahzad@REDACTED Thu Sep 6 23:47:53 2007 From: bhatti_shahzad@REDACTED (shahzad bhatti) Date: Thu, 6 Sep 2007 14:47:53 -0700 (PDT) Subject: [erlang-questions] Performance Testing with C++, Java, Ruby and Erlang Message-ID: <357715.22773.qm@web81103.mail.mud.yahoo.com> I posted that blog entry yesterday and didn't expect that much controversy. I am learning Erlang and just trying any interesting distributed problems I see. This was not meant as Erlang bashing, in fact I like Erlang a lot. I mentioned several times in my blog that the comparison was not fair because I didn't implement Java and Ruby versions with multiple threads and message communication. The original algorithm that Mark Nelson posted was sequential algorithm, which mapped pretty easily to Java and Ruby. The Erlang gives you simple and quick multi-threading and message communication so I used those primitives. Ideally, I would like to compare real implementation of distributed problem in these languages and I might try next time. As far as comments are disabled, I had disabled them while ago because I get a lot of spam, but you are welcome to contact me directly. Regards, Shahzad Bhatti Email: bhatti@REDACTED YIM: bhatti_shahzad@REDACTED URL: http://bhatti.plexobject.com Blog: http://weblog.plexobject.com Company: http://www.plexobject.com --------------------------------- Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel and lay it on us. -------------- next part -------------- An HTML attachment was scrubbed... URL: From hughperkins@REDACTED Fri Sep 7 00:51:45 2007 From: hughperkins@REDACTED (Hugh Perkins) Date: Fri, 7 Sep 2007 06:51:45 +0800 Subject: [erlang-questions] Tilera 64-core chip - let's help them help us! In-Reply-To: References: <837db430709060351i34ba6b54x3872c5bec24e19d6@mail.gmail.com> <291037.68853.qm@web38805.mail.mud.yahoo.com> <837db430709060917x1c069413hf0aea0a4fd89e342@mail.gmail.com> Message-ID: <837db430709061551s21a113ceh85d53d0c90eeaf43@mail.gmail.com> On 9/7/07, Sean Hinde wrote: > You don't need to care about how many cores you have to make a > parallel map function in erlang, you only need to care about cores > when you start the emulator. > > Parallel map is really really simple in erlang. No loss of > abstraction at all. Just stick this function in a small library file > and away you go (code lifted from Luke Gorries blog: http:// > lukego.livejournal.com/). > > pmap(F,List) -> > [wait_result(Worker) || Worker <- [spawn_worker(self(),F,E) || > E <- List]]. > > spawn_worker(Parent, F, E) -> > erlang:spawn_monitor(fun() -> Parent ! {self(), F(E)} end). > > wait_result({Pid,Ref}) -> > receive > {'DOWN', Ref, _, _, normal} -> receive {Pid,Result} -> Result end; > {'DOWN', Ref, _, _, Reason} -> exit(Reason) > end. > > The VM will take care of passing out the work around the cores as > described by Kenneth a few posts ago. Well... this will spawn a process for every item in the map. How efficient would that be if there are, say, 10 million elements in the map and only 64 processor cores? From hughperkins@REDACTED Fri Sep 7 00:57:40 2007 From: hughperkins@REDACTED (Hugh Perkins) Date: Fri, 7 Sep 2007 06:57:40 +0800 Subject: [erlang-questions] This seems an unfair benchmark In-Reply-To: <46E06544.2060103@zacbrown.org> References: <9700D073-40CF-484A-AEBC-13092F43CB53@gmail.com> <46E06544.2060103@zacbrown.org> Message-ID: <837db430709061557m27498d46hb16721ae8689a49e@mail.gmail.com> On 9/7/07, Zac Brown wrote: > > I think I'm less irritated with the inaccurate results than I am with the > fact that "method invocation" has suddenly become equivalent to > multi-threading/parallel execution. > > Odd how simple it is to bend our tests to our whim eh? Presumably the issue is that the tests were on a single-core system, where true threading doesnt give any speed advantage? If one tested on a 64-core system, presumably the Erlang solution would be obviously better, and the other solutions would need to use threading too to get somewhere close? From dmorton@REDACTED Fri Sep 7 01:26:37 2007 From: dmorton@REDACTED (Damien Morton) Date: Thu, 06 Sep 2007 19:26:37 -0400 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <013d01c7f0cb$26938d60$891ea8c0@SSI.CORP> References: <46DC193D.10504@ericsson.com><837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr><337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com><46DD9105.4050901@cs.ntua.gr> <013d01c7f0cb$26938d60$891ea8c0@SSI.CORP> Message-ID: <46E08CAD.7090802@bitfurnace.com> Why does the integer type look like a function call? On 9/6/2007 5:16 PM, David Mercer wrote: > On Thursday, September 06, 2007, Tony Finch wrote: > >> What is the reason for the trailing ()s? It would be nice if the syntax >> had less redundant visual noise. >> > > So it can tell the difference between an integer and the atom 'integer'? > > Cheers, > > David > > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of > Sent: 14:00 > To: Kostis Sagonas > Cc: Erlang > Subject: Re: [erlang-questions] Intel Quad CPUs > > On Tue, 4 Sep 2007, Kostis Sagonas wrote: > >> In the new language you would write (or preferably change the above edoc >> comment to be): >> >> -spec(foo/2 :: ((integer(), float()) -> atom())). >> > > What is the reason for the trailing ()s? It would be nice if the syntax > had less redundant visual noise. > > Tony. > From zac@REDACTED Fri Sep 7 01:26:27 2007 From: zac@REDACTED (Zac Brown) Date: Thu, 06 Sep 2007 19:26:27 -0400 Subject: [erlang-questions] This seems an unfair benchmark In-Reply-To: <837db430709061557m27498d46hb16721ae8689a49e@mail.gmail.com> References: <9700D073-40CF-484A-AEBC-13092F43CB53@gmail.com> <46E06544.2060103@zacbrown.org> <837db430709061557m27498d46hb16721ae8689a49e@mail.gmail.com> Message-ID: <46E08CA3.5020006@zacbrown.org> Thats the idea. If one is to scale a system across a network, then you'll see performance increase, not to mention code complexity will roughly increase linearly (in my experience) with erlang and exponentially with traditionally imperative languages like C++ or Java. Zac Hugh Perkins wrote: > On 9/7/07, Zac Brown wrote: > >> I think I'm less irritated with the inaccurate results than I am with the >> fact that "method invocation" has suddenly become equivalent to >> multi-threading/parallel execution. >> >> Odd how simple it is to bend our tests to our whim eh? >> > > Presumably the issue is that the tests were on a single-core system, > where true threading doesnt give any speed advantage? > > If one tested on a 64-core system, presumably the Erlang solution > would be obviously better, and the other solutions would need to use > threading too to get somewhere close? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zac@REDACTED Fri Sep 7 01:27:57 2007 From: zac@REDACTED (Zac Brown) Date: Thu, 06 Sep 2007 19:27:57 -0400 Subject: [erlang-questions] This seems an unfair benchmark] Message-ID: <46E08CFD.1060905@zacbrown.org> Thats the idea. If one is to scale a system across a network, then you'll see performance increase, not to mention code complexity will roughly increase linearly (in my experience) with erlang and exponentially with traditionally imperative languages like C++ or Java. Zac Hugh Perkins wrote: > On 9/7/07, Zac Brown wrote: > >> I think I'm less irritated with the inaccurate results than I am with the >> fact that "method invocation" has suddenly become equivalent to >> multi-threading/parallel execution. >> >> Odd how simple it is to bend our tests to our whim eh? >> > > Presumably the issue is that the tests were on a single-core system, > where true threading doesnt give any speed advantage? > > If one tested on a 64-core system, presumably the Erlang solution > would be obviously better, and the other solutions would need to use > threading too to get somewhere close? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob@REDACTED Fri Sep 7 03:47:17 2007 From: bob@REDACTED (Bob Ippolito) Date: Thu, 6 Sep 2007 18:47:17 -0700 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <46E08CAD.7090802@bitfurnace.com> References: <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> <46DD9105.4050901@cs.ntua.gr> <013d01c7f0cb$26938d60$891ea8c0@SSI.CORP> <46E08CAD.7090802@bitfurnace.com> Message-ID: <6a36e7290709061847s687fc7b1wdb1c11d78958cc53@mail.gmail.com> That's what edoc type specifications look like... On 9/6/07, Damien Morton wrote: > Why does the integer type look like a function call? > > On 9/6/2007 5:16 PM, David Mercer wrote: > > On Thursday, September 06, 2007, Tony Finch wrote: > > > >> What is the reason for the trailing ()s? It would be nice if the syntax > >> had less redundant visual noise. > >> > > > > So it can tell the difference between an integer and the atom 'integer'? > > > > Cheers, > > > > David > > > > -----Original Message----- > > From: erlang-questions-bounces@REDACTED > > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of > > Sent: 14:00 > > To: Kostis Sagonas > > Cc: Erlang > > Subject: Re: [erlang-questions] Intel Quad CPUs > > > > On Tue, 4 Sep 2007, Kostis Sagonas wrote: > > > >> In the new language you would write (or preferably change the above edoc > >> comment to be): > >> > >> -spec(foo/2 :: ((integer(), float()) -> atom())). > >> > > > > What is the reason for the trailing ()s? It would be nice if the syntax > > had less redundant visual noise. > > > > Tony. > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From dmorton@REDACTED Fri Sep 7 08:38:12 2007 From: dmorton@REDACTED (Damien Morton) Date: Fri, 07 Sep 2007 02:38:12 -0400 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <6a36e7290709061847s687fc7b1wdb1c11d78958cc53@mail.gmail.com> References: <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> <46DD9105.4050901@cs.ntua.gr> <013d01c7f0cb$26938d60$891ea8c0@SSI.CORP> <46E08CAD.7090802@bitfurnace.com> <6a36e7290709061847s687fc7b1wdb1c11d78958cc53@mail.gmail.com> Message-ID: <46E0F1D4.5020005@bitfurnace.com> Allow me to apologise in advance for my ignorance, but why do edoc type specifications look like function calls? On 9/6/2007 9:47 PM, Bob Ippolito wrote: > That's what edoc type specifications look like... > > On 9/6/07, Damien Morton wrote: > >> Why does the integer type look like a function call? >> >> On 9/6/2007 5:16 PM, David Mercer wrote: >> >>> On Thursday, September 06, 2007, Tony Finch wrote: >>> >>> >>>> What is the reason for the trailing ()s? It would be nice if the syntax >>>> had less redundant visual noise. >>>> >>>> >>> So it can tell the difference between an integer and the atom 'integer'? >>> >>> Cheers, >>> >>> David >>> >>> -----Original Message----- >>> From: erlang-questions-bounces@REDACTED >>> [mailto:erlang-questions-bounces@REDACTED] On Behalf Of >>> Sent: 14:00 >>> To: Kostis Sagonas >>> Cc: Erlang >>> Subject: Re: [erlang-questions] Intel Quad CPUs >>> >>> On Tue, 4 Sep 2007, Kostis Sagonas wrote: >>> >>> >>>> In the new language you would write (or preferably change the above edoc >>>> comment to be): >>>> >>>> -spec(foo/2 :: ((integer(), float()) -> atom())). >>>> >>>> >>> What is the reason for the trailing ()s? It would be nice if the syntax >>> had less redundant visual noise. >>> >>> Tony. >>> >>> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> > > > From tobias.lindahl@REDACTED Fri Sep 7 09:30:54 2007 From: tobias.lindahl@REDACTED (Tobias Lindahl) Date: Fri, 07 Sep 2007 09:30:54 +0200 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <46E0F1D4.5020005@bitfurnace.com> References: <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> <46DD9105.4050901@cs.ntua.gr> <013d01c7f0cb$26938d60$891ea8c0@SSI.CORP> <46E08CAD.7090802@bitfurnace.com> <6a36e7290709061847s687fc7b1wdb1c11d78958cc53@mail.gmail.com> <46E0F1D4.5020005@bitfurnace.com> Message-ID: <46E0FE2E.3070704@it.uu.se> Damien Morton wrote: > Allow me to apologise in advance for my ignorance, but why do edoc type > specifications look like function calls? I am not sure if I misunderstand your question, but as others have already explained, the parenthesis that make the types look like function calls are necessary to distinguish between types and singleton atoms. The notation of a type with an atom followed by the closed parenthesis represents a set of terms. The type integer() is the infinite set of all possible integers. The type integer is the singleton type that only consists of the atom 'integer'. In the same way the type atom() is the infinite set consisting of all possible atoms, while the type atom is the type consisting only of the atom 'integer'. Consider the function f(X) when is_atom(X) -> {atom, X}; f(X) when is_integer(X) -> {integer, X}. This function has the type (atom()|integer())-> {atom, atom()}|{integer, integer()} Hope this sheds more light on the syntax with closed parenthesis. If you are really asking something else, then please try to specify your question more. Best, Tobias > > On 9/6/2007 9:47 PM, Bob Ippolito wrote: >> That's what edoc type specifications look like... >> >> On 9/6/07, Damien Morton wrote: >> >>> Why does the integer type look like a function call? >>> >>> On 9/6/2007 5:16 PM, David Mercer wrote: >>> >>>> On Thursday, September 06, 2007, Tony Finch wrote: >>>> >>>> >>>>> What is the reason for the trailing ()s? It would be nice if the syntax >>>>> had less redundant visual noise. >>>>> >>>>> >>>> So it can tell the difference between an integer and the atom 'integer'? >>>> >>>> Cheers, >>>> >>>> David >>>> >>>> -----Original Message----- >>>> From: erlang-questions-bounces@REDACTED >>>> [mailto:erlang-questions-bounces@REDACTED] On Behalf Of >>>> Sent: 14:00 >>>> To: Kostis Sagonas >>>> Cc: Erlang >>>> Subject: Re: [erlang-questions] Intel Quad CPUs >>>> >>>> On Tue, 4 Sep 2007, Kostis Sagonas wrote: >>>> >>>> >>>>> In the new language you would write (or preferably change the above edoc >>>>> comment to be): >>>>> >>>>> -spec(foo/2 :: ((integer(), float()) -> atom())). >>>>> >>>>> >>>> What is the reason for the trailing ()s? It would be nice if the syntax >>>> had less redundant visual noise. >>>> >>>> Tony. >>>> >>>> >>> _______________________________________________ >>> 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 bob@REDACTED Fri Sep 7 09:33:41 2007 From: bob@REDACTED (Bob Ippolito) Date: Fri, 7 Sep 2007 00:33:41 -0700 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <46E0F1D4.5020005@bitfurnace.com> References: <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> <46DD9105.4050901@cs.ntua.gr> <013d01c7f0cb$26938d60$891ea8c0@SSI.CORP> <46E08CAD.7090802@bitfurnace.com> <6a36e7290709061847s687fc7b1wdb1c11d78958cc53@mail.gmail.com> <46E0F1D4.5020005@bitfurnace.com> Message-ID: <6a36e7290709070033p52094fc2ieb21c6d4c64539f1@mail.gmail.com> Probably because if they didn't look like function calls, then they'd look like atoms... On 9/6/07, Damien Morton wrote: > Allow me to apologise in advance for my ignorance, but why do edoc type > specifications look like function calls? > > On 9/6/2007 9:47 PM, Bob Ippolito wrote: > > That's what edoc type specifications look like... > > > > On 9/6/07, Damien Morton wrote: > > > >> Why does the integer type look like a function call? > >> > >> On 9/6/2007 5:16 PM, David Mercer wrote: > >> > >>> On Thursday, September 06, 2007, Tony Finch wrote: > >>> > >>> > >>>> What is the reason for the trailing ()s? It would be nice if the syntax > >>>> had less redundant visual noise. > >>>> > >>>> > >>> So it can tell the difference between an integer and the atom 'integer'? > >>> > >>> Cheers, > >>> > >>> David > >>> > >>> -----Original Message----- > >>> From: erlang-questions-bounces@REDACTED > >>> [mailto:erlang-questions-bounces@REDACTED] On Behalf Of > >>> Sent: 14:00 > >>> To: Kostis Sagonas > >>> Cc: Erlang > >>> Subject: Re: [erlang-questions] Intel Quad CPUs > >>> > >>> On Tue, 4 Sep 2007, Kostis Sagonas wrote: > >>> > >>> > >>>> In the new language you would write (or preferably change the above edoc > >>>> comment to be): > >>>> > >>>> -spec(foo/2 :: ((integer(), float()) -> atom())). > >>>> > >>>> > >>> What is the reason for the trailing ()s? It would be nice if the syntax > >>> had less redundant visual noise. > >>> > >>> Tony. > >>> > >>> > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://www.erlang.org/mailman/listinfo/erlang-questions > >> > >> > > > > > > > > From pacini@REDACTED Fri Sep 7 09:41:09 2007 From: pacini@REDACTED (Filippo Pacini) Date: Fri, 07 Sep 2007 09:41:09 +0200 Subject: [erlang-questions] eunit setup and cleanup Message-ID: <46E10095.7030400@sgconsulting.it> Hi all, I'm trying to write some tests using eunit. I have to do some setup before executing a group of tests (e.g start an OTP application, or to prepare data in a mnesia table). Is it possible with eunit? Are there examples somewhere I can look at? I found in the doc a reference to fixtures, but couldn't figure out how they works. thanks, filippo From sean.hinde@REDACTED Fri Sep 7 10:39:15 2007 From: sean.hinde@REDACTED (Sean Hinde) Date: Fri, 7 Sep 2007 09:39:15 +0100 Subject: [erlang-questions] Tilera 64-core chip - let's help them help us! In-Reply-To: <837db430709061551s21a113ceh85d53d0c90eeaf43@mail.gmail.com> References: <837db430709060351i34ba6b54x3872c5bec24e19d6@mail.gmail.com> <291037.68853.qm@web38805.mail.mud.yahoo.com> <837db430709060917x1c069413hf0aea0a4fd89e342@mail.gmail.com> <837db430709061551s21a113ceh85d53d0c90eeaf43@mail.gmail.com> Message-ID: On 6 Sep 2007, at 23:51, Hugh Perkins wrote: > On 9/7/07, Sean Hinde wrote: >> You don't need to care about how many cores you have to make a >> parallel map function in erlang, you only need to care about cores >> when you start the emulator. >> > > Well... this will spawn a process for every item in the map. How > efficient would that be if there are, say, 10 million elements in the > map and only 64 processor cores? If your problem domain really produces Erlang lists with 10 million elements, and you want to run a map, you could sensibly change the algorithm to manage pool of erlang processes and handle the list in chunks. Mostly so you don't run out of memory. In a more realistic case, with say 1000 elements in the list there is no significant penalty to spawning 1000 erlang processes over 64 cores instead of 64 erlang processes. The erlang scheduler will distribute the load among its pool of OS threads. It might actually be more efficient, because the VM will have a chance to spread more load to CPUs (OS threads) that are less busy. Sean From puzza007@REDACTED Fri Sep 7 10:39:53 2007 From: puzza007@REDACTED (Paul Oliver) Date: Fri, 7 Sep 2007 09:39:53 +0100 Subject: [erlang-questions] erl_interface question In-Reply-To: References: Message-ID: Hmm, seems to have changed between R10B-10 and the current release: poliver@REDACTED:/tmp$ diff ./otp_src_R10B-10/lib/erl_interface/include/ei.h /usr/include/ei.h 139,143d138 < /* MS C uses __declspec() to do its magic */ < #if !defined(__WIN32__) < # define __declspec(foo) /* nothing */ < #endif < 162,167d156 < /* 'erl_errno' as a variable. */ < extern __declspec(thread) volatile int __erl_errno; < < /* FIXME merge with erl_init defines below and maybe not use function < if not threaded */ < 172d160 < /* FIXME need to be volatile? */ poliver@REDACTED:/tmp$ On 9/6/07, Paul Oliver wrote: > Hi, > > I'm trying to link erl_interface code with non-threaded libs and get the > following: > > poliver@REDACTED:~/foo$ make > gcc -fPIC -O2 -fomit-frame-pointer -Wall -g -Wno-pointer-sign -I. > -I/opt/informix/incl/esql -I/tmp/appserv/incl -c arse.c -o ix86/arse.o > arse.c: In function 'main': > arse.c:33: warning: 'e' is used uninitialized in this function > gcc -L/opt/informix/lib -L/opt/informix/lib/esql > -L/usr/lib/erlang/lib/erl_interface- 3.5.5.3/lib > -L/tmp/appserv/lib/ix86 ix86/arse.o -lerl_interface_st -lei_st -lOT_InfTcl > -lc -o arse > /usr/lib/erlang/lib/erl_interface-3.5.5.3/lib/liberl_interface_st.a(erl_eterm.o) > : In function `erl_copy_term': > (.text+0xfba): undefined reference to `__erl_errno' > /usr/lib/erlang/lib/erl_interface-3.5.5.3/lib/liberl_interface_st.a(erl_eterm.o) > : In function `erl_mk_var': > (.text+0x12b8): undefined reference to `__erl_errno' > /usr/lib/erlang/lib/erl_interface-3.5.5.3/lib/liberl_interface_st.a(erl_eterm.o) > : In function `__erl_mk_reference': > (.text+0x1362): undefined reference to `__erl_errno' > /usr/lib/erlang/lib/erl_interface-3.5.5.3/lib/liberl_interface_st.a(erl_eterm.o) > : In function `erl_mk_atom': > (.text+0x1481): undefined reference to `__erl_errno' > /usr/lib/erlang/lib/erl_interface-3.5.5.3/lib/liberl_interface_st.a(erl_eterm.o) > : In function `erl_mk_port': > (.text+0x1699): undefined reference to `__erl_errno' > /usr/lib/erlang/lib/erl_interface-3.5.5.3/lib/liberl_interface_st.a(erl_eterm.o):(.text+0x175b) > : more undefined references to `__erl_errno' follow > collect2: ld returned 1 exit status > make: *** [arse] Error 1 > > I've seen this post. Can anyone tell me what I'm doing wrong? > > Thanks in advance, > Paul. > > -- http://mosangeles.net From richardc@REDACTED Fri Sep 7 11:18:37 2007 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 07 Sep 2007 11:18:37 +0200 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <46E0F1D4.5020005@bitfurnace.com> References: <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> <46DD9105.4050901@cs.ntua.gr> <013d01c7f0cb$26938d60$891ea8c0@SSI.CORP> <46E08CAD.7090802@bitfurnace.com> <6a36e7290709061847s687fc7b1wdb1c11d78958cc53@mail.gmail.com> <46E0F1D4.5020005@bitfurnace.com> Message-ID: <46E1176D.4020509@it.uu.se> Damien Morton wrote: > Allow me to apologise in advance for my ignorance, but why do edoc type > specifications look like function calls? The notation actually goes back to some early work on types in Erlang by Phil Wadler and Simon Marlow ("A practical subtyping system for Erlang", ICFP '97) - their ideas didn't fly, because they would cause a lot of existing code (already in '97) to be simply rejected by the compiler, and that just wasn't realistic. But the notation lives on, and has been used both in edoc and in every other work on typing in Erlang that I know of. Apart from separating atoms from types, note that it also easily extends to parameterized types, such as ordset(integer()), or dict(atom(), string()), so that it looks like function calls is quite natural when you think about it. /Richard From richardc@REDACTED Fri Sep 7 11:29:30 2007 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 07 Sep 2007 11:29:30 +0200 Subject: [erlang-questions] eunit setup and cleanup In-Reply-To: <46E10095.7030400@sgconsulting.it> References: <46E10095.7030400@sgconsulting.it> Message-ID: <46E119FA.7080302@it.uu.se> Filippo Pacini wrote: > I'm trying to write some tests using eunit. > > I have to do some setup before executing a group of tests (e.g start an > OTP application, or to prepare data in a mnesia table). Is it possible > with eunit? Are there examples somewhere I can look at? > > I found in the doc a reference to fixtures, but couldn't figure out how > they works. Have you read though this?: http://svn.process-one.net/contribs/trunk/eunit/doc/overview-summary.html#Fixtures /Richard From pacini@REDACTED Fri Sep 7 12:19:42 2007 From: pacini@REDACTED (Filippo Pacini) Date: Fri, 07 Sep 2007 12:19:42 +0200 Subject: [erlang-questions] eunit setup and cleanup In-Reply-To: <46E119FA.7080302@it.uu.se> References: <46E10095.7030400@sgconsulting.it> <46E119FA.7080302@it.uu.se> Message-ID: <46E125BE.3090005@sgconsulting.it> Hi, I've read it, but I don't understand how to specify the test. Here's a small example: -module(eunit_simple). -include_lib("eunit/include/eunit.hrl"). setup() -> io:format("Setup called", []). do_test_() -> {setup, fun setup_test/0, [?_assert(1=:=0)]}. And running it: 1> eunit_simple:test(). Test successful. ok It seems setup is not called, nor the assertion. I've tryed several variants for writing do_test_ but nothing seems works. filippo Richard Carlsson wrote: > Filippo Pacini wrote: >> I'm trying to write some tests using eunit. >> >> I have to do some setup before executing a group of tests (e.g start an >> OTP application, or to prepare data in a mnesia table). Is it possible >> with eunit? Are there examples somewhere I can look at? >> >> I found in the doc a reference to fixtures, but couldn't figure out how >> they works. > > Have you read though this?: > http://svn.process-one.net/contribs/trunk/eunit/doc/overview-summary.html#Fixtures > > From bjt@REDACTED Fri Sep 7 12:19:07 2007 From: bjt@REDACTED (Benjamin Tolputt) Date: Fri, 07 Sep 2007 20:19:07 +1000 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: <95be1d3b0709060016m1602ac6cia3c394bcbfc7c7ea@mail.gmail.com> References: <46DCDE0C.9000504@pmp.com.au> <46DF2BF5.7050908@pmp.com.au> <95be1d3b0709052337i485d80d7gf1e7d0985932cff7@mail.gmail.com> <46DFA3CD.7010300@pmp.com.au> <95be1d3b0709060016m1602ac6cia3c394bcbfc7c7ea@mail.gmail.com> Message-ID: <46E1259B.8030000@pmp.com.au> Vlad Dumitrescu wrote: > Erm, if the byte-code is encrypted, how would you replace a beam file > with a different one without breaking the encryption? You wouldn't. Like most "single player" games, you would simply "patch" the archive containing the beam files "as a whole" (i.e. as a binary patch to the archive file rather than individual patches to the files contained therein). > If the encryption is broken, then it feels about just as easy to > replace a file in the file system or in a zip archive. > > One could also use separate schemes to ensure it's difficult to tamper > with data, like for example storing the MD5 signature of files somewhere. I think the actual problem here is being misunderstood (i.e. I am not explaining it well enough). We know that DRM (which is what client-side encryption amounts to) is not "true" protection. It is, however, a necessity to get a deal through the established game publishing firms. The fact that it ties into one of my desired features is (believe it or not) a coincidence in this situation. Erlang as a game development language came out of a discussion based around Tim Sweeney's presentation on multi-core enabled game engines (funnily enough, not simply a plug for the new Unreal Engine). Being a "high concurrency" language/virtual machine with SMP support now on most platforms - I thought Erlang was a perfect fit. The problems did not come up from the language itself (as functional languages such as Lisp have already been used successfully in console games) but from the actual deployment features of Erlang (which was designed for easy, hot-swappable upgrading). In summary, we KNOW DRM (i.e. "client side" encryption & single archive deployments) are not the best (or even a completely successful) method of protecting the application from unauthorized copying/changing. It, however, is necessary to get the publishing deals for PC games (the target market). Regards, B.J.Tolputt From vladdu55@REDACTED Fri Sep 7 12:33:23 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 7 Sep 2007 12:33:23 +0200 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: <46E1259B.8030000@pmp.com.au> References: <46DCDE0C.9000504@pmp.com.au> <46DF2BF5.7050908@pmp.com.au> <95be1d3b0709052337i485d80d7gf1e7d0985932cff7@mail.gmail.com> <46DFA3CD.7010300@pmp.com.au> <95be1d3b0709060016m1602ac6cia3c394bcbfc7c7ea@mail.gmail.com> <46E1259B.8030000@pmp.com.au> Message-ID: <95be1d3b0709070333u58b09451k519b7974ef103b34@mail.gmail.com> Hi, The explanation this time is clearer, thanks. On 9/7/07, Benjamin Tolputt wrote: > > Vlad Dumitrescu wrote: > > Erm, if the byte-code is encrypted, how would you replace a beam file > > with a different one without breaking the encryption? > You wouldn't. Like most "single player" games, you would simply "patch" > the archive containing the beam files "as a whole" (i.e. as a binary > patch to the archive file rather than individual patches to the files > contained therein). I'm not sure where the misunderstanding lies. Here's how I understand this: You say some kind of DRM is necessary in order to get a deal. Sure, that's agreed. You say it's easier/safer to put all beam files in an archive and protect it, as compared to protect each beam file. I may be wrong, but I think there's no difference. If the code loader is extended so that it can load from an encrypted archive, then it can just as easily load from separately encrypted beam files. A cracker can do something about it if it cracks the encryption, and in that case both alternatives are just as easy to tamper with. Without the encryption key, a modified beam file would useless in both cases. What am I missing? What is a packaging into a smaller set of files adding to the security level? regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From saleyn@REDACTED Fri Sep 7 14:23:34 2007 From: saleyn@REDACTED (Serge Aleynikov) Date: Fri, 07 Sep 2007 07:23:34 -0500 Subject: [erlang-questions] now/0 resolution Message-ID: <46E142C6.9010804@gmail.com> Since according to documentation consecutive executions of now/0 will return different values (with microsecond precision) I have two questions: 1. Does it mean that inserting now/0 calls in code will slow down execution to 1mks per execution? If not, then performance of function call measured using now/0 time stamping would be inaccurate. 2. Is it possible to measure execution time more accurately (with nanosecond precision) using current Erlang distribution? (*) Serge (*) Since VM uses gettimeofday() to bump timer, it's limited by getimeofday's precision. Additionally each invocation of gettimeofday takes about 15mks (OS dependent). I believe that there's no code to take advantage of a high resolution timer. Such a timer can give nanosecond precision, and presently the only way it can be implemented is in a linked-in driver. The only problem that calling functions inside the driver with erlang:port_call/3 incurs some cost that would be better to avoid if a bif (such as hrnow/0) was available. From vladdu55@REDACTED Fri Sep 7 13:25:08 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 7 Sep 2007 13:25:08 +0200 Subject: [erlang-questions] eunit setup and cleanup In-Reply-To: <46E125BE.3090005@sgconsulting.it> References: <46E10095.7030400@sgconsulting.it> <46E119FA.7080302@it.uu.se> <46E125BE.3090005@sgconsulting.it> Message-ID: <95be1d3b0709070425w346a5a35q9c0d91e9f61c4be8@mail.gmail.com> Hi, On 9/7/07, Filippo Pacini wrote: > > > -module(eunit_simple). > -include_lib("eunit/include/eunit.hrl"). > > setup() -> > io:format("Setup called", []). > > do_test_() -> > {setup, fun setup_test/0, [?_assert(1=:=0)]}. I suppose you meant {setup, fun setup/0, [?_assert(1=:=0)]}. The problem is that the output of io:format goes to the test process' group_leader, which in normal cases is printing it to the console, but in this case the eunit framework replaces it so that the output can be handled by test's parent, if necessary. Try replacing it with erlang:display("Setup called") and you will see the message as expected. BTW your test should fail, so make sure that if you make changes you reload it after recompiling before re-running the tests. best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From pacini@REDACTED Fri Sep 7 15:16:04 2007 From: pacini@REDACTED (Filippo Pacini) Date: Fri, 07 Sep 2007 15:16:04 +0200 Subject: [erlang-questions] eunit setup and cleanup In-Reply-To: <95be1d3b0709070425w346a5a35q9c0d91e9f61c4be8@mail.gmail.com> References: <46E10095.7030400@sgconsulting.it> <46E119FA.7080302@it.uu.se> <46E125BE.3090005@sgconsulting.it> <95be1d3b0709070425w346a5a35q9c0d91e9f61c4be8@mail.gmail.com> Message-ID: <46E14F14.2020501@sgconsulting.it> Thanks Vlad, now it works. As you found I had a typo and I hadn't noticed the error compiling in emacs :-( filippo Vlad Dumitrescu wrote: > Hi, > > On 9/7/07, *Filippo Pacini* > wrote: > > > -module(eunit_simple). > -include_lib("eunit/include/eunit.hrl"). > > setup() -> > io:format("Setup called", []). > > do_test_() -> > {setup, fun setup_test/0, [?_assert(1=:=0)]}. > > > I suppose you meant > {setup, fun setup/0, [?_assert(1=:=0)]}. > > The problem is that the output of io:format goes to the test process' > group_leader, which in normal cases is printing it to the console, but > in this case the eunit framework replaces it so that the output can be > handled by test's parent, if necessary. > > Try replacing it with erlang:display("Setup called") and you will see > the message as expected. > > BTW your test should fail, so make sure that if you make changes you > reload it after recompiling before re-running the tests. > > best regards, > Vlad > From ulf.wiger@REDACTED Fri Sep 7 15:22:41 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Fri, 07 Sep 2007 15:22:41 +0200 Subject: [erlang-questions] Performance Testing with C++, Java, Ruby and Erlang In-Reply-To: <357715.22773.qm@web81103.mail.mud.yahoo.com> References: <357715.22773.qm@web81103.mail.mud.yahoo.com> Message-ID: <46E150A1.809@ericsson.com> shahzad bhatti wrote: > I posted that blog entry yesterday and didn't expect that much > controversy. I am learning Erlang and just trying any interesting > distributed problems I see. This was not meant as Erlang bashing, > in fact I like Erlang a lot. With comments enabled, you might have received a lot of helpful pointers on how to improve the code, but this forum will also work. I've not spent much time trying to understand the outline of your code, but some comments about programming style might be in order: You should strive to eliminate the get() and put() operations, and have the functions return all the structures that were modified. For example: 355 set_node_value(Round) -> 356 Config = get(config), 357 ProcIds = lists:seq(0, config:get_num_procs(Config)-1), 358 lists:foreach( 359 fun(Id) -> 360 set_node_value(Round, Id) end, ProcIds). 361 362 set_node_value(Round, Id) -> 363 L = repository:get_rank_list(Round, Id), 364 lists:foreach( 365 fun(Path) -> 366 set_node_value(Round, Id, Path) end, L). 367 368 set_node_value(_Round, _Id, Path) -> 369 Nodes = get(nodes), 370 Node = get_node(Path), 371 Value = find_majority(Path), 372 Nodes1 = dict:store(Path, node:set_output(Node, Value), Nodes), 373 put(nodes, Nodes1). The set_node_value/1 function is called from within a lists:foreach(), when you should rather use e.g. lists:foldl() with Nodes as an accumulator. That would eliminate all the get() and put() operations, as the updated Nodes variable is passed on to the next iteration. set_node_value(Round, #config{proc_ids = Proc_ids, nodes = Nodes}) -> lists:foldl( fun(Id, Ns) -> set_node_value(Round, Id, Nodes) end, Nodes, ProcIds). set_node_value(Round, Id, Nodes) -> L = repository:get_rank_list(Round, Id), lists:foldl( fun(Path, Ns) -> Node = get_node(Path), Value = find_majority(Path), dict:store(Path, node:set_output(Node, Value), Ns). end, Nodes, L). These are just minor changes, to illustrate the point: - No need to build Proc_ids in every iteration. Do it once, since it's static, and store it in your record. Also, keep nodes in the record, rather than in the process dictionary. Besides, each Erlang process has a unique Id - no need to invent a corresponding value, when the Pid will do nicely. - No need to have a separate module that selects attributes from a record. It's much faster to do it inline, using record syntax. You can apply this to many places in the code. And if you then look at find_majority/1: 393 find_majority(Path) -> 394 Counts = dict:new(), 395 Counts1 = dict:store(?ONE, 0, Counts), 396 Counts2 = dict:store(?ZERO, 0, Counts1), 397 Counts3 = dict:store(?UNKNOWN, 0, Counts2), 398 put(counts, Counts3), 399 L = repository:get_children_path(Path), 400 N = length(L), 401 lists:foreach(fun(Child) -> 402 increment_count(Child) end, L), 403 Counts4 = get(counts), 404 OneCount = dict:fetch(?ONE, Counts4), 405 ZeroCount = dict:fetch(?ZERO, Counts4), Here, you rely on the process dictionary to save the side-effect of increment_count/1, so that you can retrieve Counts4 right afterwards. You also use dict to keep track of the only three counters that increment_count/1 can update. It would be _much_ more efficient to simply fold over the list with the counters as an accumulator: lists:foldl(fun(Child, {C1,C2,C3}) -> Node = get_node(Child), Node of ?ONE -> {C1+1,C2,C3}; ?ZERO -> {C1,C2+1,C3}; ?UNKNOWN -> {C1,C2,C3+1} end, {0,0,0}, L) (There are several other ways to write this, achieving the same effect.) Finally, in repository.erl: 519 table_lookup(Tab, Key) -> 520 Result = ets:lookup(Tab, Key), 521 case Result of 522 [] -> 523 []; 524 error -> 525 []; 526 {ok, Value} -> 527 lists:reverse(Value); 528 [{Key, Value}] -> 529 lists:reverse(Value) 530 end. ets:lookup/2 _only_ returns a (possibly empty) list of objects. error and {ok,Value} are not possible return values. Also, it seems odd that you reverse Value at every lookup, but prepend to the (reversed) list at insert. The insert sequence [1,2,3,4,5] would then give the value list [5,3,1,2,4]. Is this really what you want? If so, you should write a comment explaining the virtues of the arrangement. BR, Ulf W From dbt@REDACTED Fri Sep 7 15:46:28 2007 From: dbt@REDACTED (David Terrell) Date: Fri, 7 Sep 2007 08:46:28 -0500 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <46E1176D.4020509@it.uu.se> References: <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> <46DD9105.4050901@cs.ntua.gr> <013d01c7f0cb$26938d60$891ea8c0@SSI.CORP> <46E08CAD.7090802@bitfurnace.com> <6a36e7290709061847s687fc7b1wdb1c11d78958cc53@mail.gmail.com> <46E0F1D4.5020005@bitfurnace.com> <46E1176D.4020509@it.uu.se> Message-ID: <20070907134628.GA3555@sphinx.chicagopeoplez.org> On Fri, Sep 07, 2007 at 11:18:37AM +0200, Richard Carlsson wrote: > Damien Morton wrote: > > Allow me to apologise in advance for my ignorance, but why do edoc type > > specifications look like function calls? > > The notation actually goes back to some early work on types in Erlang > by Phil Wadler and Simon Marlow ("A practical subtyping system for > Erlang", ICFP '97) - their ideas didn't fly, because they would cause > a lot of existing code (already in '97) to be simply rejected by the > compiler, and that just wasn't realistic. But the notation lives on, > and has been used both in edoc and in every other work on typing in > Erlang that I know of. Interesting. For those of us who like to bore everybody else with historical questions... Was this the motivation for the change from integer(X) to is_integer(X) in guards? Thanks. -- David Terrell dbt@REDACTED ((meatspace)) http://meat.net/ From gbulmer@REDACTED Fri Sep 7 15:52:58 2007 From: gbulmer@REDACTED (G Bulmer) Date: Fri, 7 Sep 2007 14:52:58 +0100 Subject: [erlang-questions] Seeking guidance In-Reply-To: References: Message-ID: <6A8E3467-32C9-4EEE-9199-49FBA1EF442B@gmail.com> On 6 Sep 2007, at 22:15, Dinesh B Vadhia wrote: > We are a startup in the US considering the use of Erlang for an API- > based server product. Customers will use the product to build web- > based applications that will call the API's on the server. > > The Erlang concurrent and distributed facilities would be > significant pluses for us. What we are unclear about is Erlang's > support for different languages calling our API's ie. can customers > building web-based applications with Java, C, C++, C#, Ruby or > Python call the API's? Can you give us more information? What is the architecture? Without revealing proprietary information, what is technically important Erlang qualities you are looking for, is it availability, scalability, performance, security, distribution? Example architecture questions: Are the services and the clients web-based applications (apps) running on the same machines, or are they remote from each other? If services and apps are remote, what is the goal of the API, are you trying to make the services easy to use, or is there some other goal? If services and apps are local (both parts on the same machine), do you need the Erlang based services to be *in* the same address space as the apps. Are are you keeping customer apps segregated from the services in some way, eg. using VM technology (e.g. VMWare). Erlang has a bunch of approaches to integrating with 'other' programming languages, but I expect others can give better answers than me. My understanding, to get you started, is: 1) talk to Erlang over a port, you invent a protocol to talk to your services, 2) embed your functionality within the Erlang VM, 3) Use CORBA, which is available for lots of programming languages, to create language stubs for a client, and is available for Erlang, 4) Adapt an existing, well-understood protocol, like web services, REST, .. If you need to make API's available to several languages, especially where the services run on the same machine as the customer apps, you might want to have look at swig at http://www.swig.org If swig looks like a blind alley, maybe you could explain why it isn't adequate? Hope This Helps GB From dot@REDACTED Fri Sep 7 16:12:00 2007 From: dot@REDACTED (Tony Finch) Date: Fri, 7 Sep 2007 15:12:00 +0100 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <46E068E9.5030809@cs.ntua.gr> References: <46DC193D.10504@ericsson.com> <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> <46DD9105.4050901@cs.ntua.gr> <46E05F9D.9050108@bitfurnace.com> <46E068E9.5030809@cs.ntua.gr> Message-ID: On Thu, 6 Sep 2007, Kostis Sagonas wrote: > > there needs to be way to distinguish between atoms (i.e. > singleton types) and type names. > > Some types can also take parameters. I'd suggest using initial caps for type names, and omit the () except when the type parameter is non-trivial. (That is somewhat like the Haskell type syntax.) > We want to be as much as possible compatible with edoc. I understand :-/ Tony. -- f.a.n.finch http://dotat.at/ IRISH SEA: SOUTHERLY, BACKING NORTHEASTERLY FOR A TIME, 3 OR 4. SLIGHT OR MODERATE. SHOWERS. MODERATE OR GOOD, OCCASIONALLY POOR. From kostis@REDACTED Fri Sep 7 16:21:47 2007 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 07 Sep 2007 17:21:47 +0300 Subject: [erlang-questions] Type contracts [WAS: Re: Intel Quad CPUs] In-Reply-To: References: <46DC193D.10504@ericsson.com> <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> <46DD9105.4050901@cs.ntua.gr> <46E05F9D.9050108@bitfurnace.com> <46E068E9.5030809@cs.ntua.gr> Message-ID: <46E15E7B.5080705@cs.ntua.gr> Tony Finch wrote: > On Thu, 6 Sep 2007, Kostis Sagonas wrote: >> there needs to be way to distinguish between atoms (i.e. >> singleton types) and type names. >> >> Some types can also take parameters. > > I'd suggest using initial caps for type names... This does not work since the contracts will also be able to take type variables. For example, this is the type of lists:map/2: -spec(map/2 :: (((A) -> B), list(A)) -> list(B))). also written more simply as: -spec(map/2 :: (((A) -> B), [A]) -> [B])). Kostis From dmercer@REDACTED Fri Sep 7 16:27:33 2007 From: dmercer@REDACTED (David Mercer) Date: Fri, 7 Sep 2007 09:27:33 -0500 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: References: <46DC193D.10504@ericsson.com><837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr><337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com><46DD9105.4050901@cs.ntua.gr><46E05F9D.9050108@bitfurnace.com> <46E068E9.5030809@cs.ntua.gr> Message-ID: <017501c7f15b$3b431b00$891ea8c0@SSI.CORP> Isn't initial-caps a conflict with expressions like this: map/2: list(T1), (T1 -> T2) -> list(T2) ? Cheers, David -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Tony Finch Sent: Friday, September 07, 2007 09:12 To: Kostis Sagonas Cc: damien.morton@REDACTED; Erlang Subject: Re: [erlang-questions] Intel Quad CPUs On Thu, 6 Sep 2007, Kostis Sagonas wrote: > > there needs to be way to distinguish between atoms (i.e. > singleton types) and type names. > > Some types can also take parameters. I'd suggest using initial caps for type names, and omit the () except when the type parameter is non-trivial. (That is somewhat like the Haskell type syntax.) > We want to be as much as possible compatible with edoc. I understand :-/ Tony. -- f.a.n.finch http://dotat.at/ IRISH SEA: SOUTHERLY, BACKING NORTHEASTERLY FOR A TIME, 3 OR 4. SLIGHT OR MODERATE. SHOWERS. MODERATE OR GOOD, OCCASIONALLY POOR. _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From richardc@REDACTED Fri Sep 7 16:31:47 2007 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 07 Sep 2007 16:31:47 +0200 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <20070907134628.GA3555@sphinx.chicagopeoplez.org> References: <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> <46DD9105.4050901@cs.ntua.gr> <013d01c7f0cb$26938d60$891ea8c0@SSI.CORP> <46E08CAD.7090802@bitfurnace.com> <6a36e7290709061847s687fc7b1wdb1c11d78958cc53@mail.gmail.com> <46E0F1D4.5020005@bitfurnace.com> <46E1176D.4020509@it.uu.se> <20070907134628.GA3555@sphinx.chicagopeoplez.org> Message-ID: <46E160D3.5020909@it.uu.se> David Terrell wrote: > Interesting. For those of us who like to bore everybody else with > historical questions... Was this the motivation for the change > from integer(X) to is_integer(X) in guards? No, that's a different story. When Erlang was a very new language, the authors had the idea that guards were very different from normal expressions (since the theoretical basis was stuff like Guarded Horn Clauses). They chose to give guards a special scope, so that you could write things like integer(X) and atom(X) and that would be recognized as type tests. This was easy and compact. The main drawbacks, which were mostly realized after a few years of practical experience, were: - you couldn't just cut out a guard and paste it in somewhere, because the scope wasn't the same - atom(X) and the other tests were not defined outside guards - you couldn't access the type tests directly as a boolean value, as in "Bool = atom(A)" - you'd have to write "Bool = (if atom(A) -> true; true -> false end)", which is not exactly elegant - some names could have different meaning depending on whether they were used as guard tests or as normal expressions - float(X) is a boolean test for float-ness if it's a guard, but if it's a normal expression then it refers to the int-to-float conversion function The is_... names were chosen both for clarity and to avoid the name collision issue. They can be used everywhere. /Richard From dmorton@REDACTED Fri Sep 7 15:50:39 2007 From: dmorton@REDACTED (Damien Morton) Date: Fri, 07 Sep 2007 09:50:39 -0400 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <46E1176D.4020509@it.uu.se> References: <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> <46DD9105.4050901@cs.ntua.gr> <013d01c7f0cb$26938d60$891ea8c0@SSI.CORP> <46E08CAD.7090802@bitfurnace.com> <6a36e7290709061847s687fc7b1wdb1c11d78958cc53@mail.gmail.com> <46E0F1D4.5020005@bitfurnace.com> <46E1176D.4020509@it.uu.se> Message-ID: <46E1572F.1070006@bitfurnace.com> Ok, makes more sense to me now. Thanks. > Damien Morton wrote: > >> Allow me to apologise in advance for my ignorance, but why do edoc type >> specifications look like function calls? >> > > The notation actually goes back to some early work on types in Erlang > by Phil Wadler and Simon Marlow ("A practical subtyping system for > Erlang", ICFP '97) - their ideas didn't fly, because they would cause > a lot of existing code (already in '97) to be simply rejected by the > compiler, and that just wasn't realistic. But the notation lives on, > and has been used both in edoc and in every other work on typing in > Erlang that I know of. > > Apart from separating atoms from types, note that it also easily > extends to parameterized types, such as ordset(integer()), or > dict(atom(), string()), so that it looks like function calls > is quite natural when you think about it. > > /Richard > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > From bob@REDACTED Fri Sep 7 16:34:56 2007 From: bob@REDACTED (Bob Ippolito) Date: Fri, 7 Sep 2007 07:34:56 -0700 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: References: <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> <46DD9105.4050901@cs.ntua.gr> <46E05F9D.9050108@bitfurnace.com> <46E068E9.5030809@cs.ntua.gr> Message-ID: <6a36e7290709070734q4ca0f879q38e82d0c6e04e386@mail.gmail.com> On 9/7/07, Tony Finch wrote: > On Thu, 6 Sep 2007, Kostis Sagonas wrote: > > > > there needs to be way to distinguish between atoms (i.e. > > singleton types) and type names. > > > > Some types can also take parameters. > > I'd suggest using initial caps for type names, and omit the () except > when the type parameter is non-trivial. (That is somewhat like the Haskell > type syntax.) > So type names should be indistinguishable from variables? That sounds far more confusing than having them look like function calls. -bob From david.hopwood@REDACTED Fri Sep 7 17:21:56 2007 From: david.hopwood@REDACTED (David Hopwood) Date: Fri, 07 Sep 2007 16:21:56 +0100 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: <46E1259B.8030000@pmp.com.au> References: <46DCDE0C.9000504@pmp.com.au> <46DF2BF5.7050908@pmp.com.au> <95be1d3b0709052337i485d80d7gf1e7d0985932cff7@mail.gmail.com> <46DFA3CD.7010300@pmp.com.au> <95be1d3b0709060016m1602ac6cia3c394bcbfc7c7ea@mail.gmail.com> <46E1259B.8030000@pmp.com.au> Message-ID: <46E16C94.8090604@industrial-designers.co.uk> Benjamin Tolputt wrote: > Vlad Dumitrescu wrote: >> Erm, if the byte-code is encrypted, how would you replace a beam file >> with a different one without breaking the encryption? > > You wouldn't. Like most "single player" games, you would simply "patch" > the archive containing the beam files "as a whole" (i.e. as a binary > patch to the archive file rather than individual patches to the files > contained therein). I think you missed Vlad's point: it is the encryption, alone, that puts obstacles in the way of "unauthorized" changes. Whether the files are stored in a single archive or separately has nothing to do with it. > In summary, we KNOW DRM (i.e. "client side" encryption & single archive > deployments) are not the best (or even a completely successful) method > of protecting the application from unauthorized copying/changing. Any generic support for copy protection in the VM could easily be *generically* bypassed, for all applications that used it. If you want to obtain security through obscurity, it has to be done for each application independently, otherwise it is not "obscure" in the sense required. So, why are you asking for this as a generic feature? (The VM is open source; encryption of beam files is easy to add.) > It, however, is necessary to get the publishing deals for PC games (the > target market). It would also add complexity to the VM and have a performance cost. -- David Hopwood From david.hopwood@REDACTED Fri Sep 7 18:11:26 2007 From: david.hopwood@REDACTED (David Hopwood) Date: Fri, 07 Sep 2007 17:11:26 +0100 Subject: [erlang-questions] Type syntax In-Reply-To: <46E068E9.5030809@cs.ntua.gr> References: <46DC193D.10504@ericsson.com> <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> <46DD9105.4050901@cs.ntua.gr> <46E05F9D.9050108@bitfurnace.com> <46E068E9.5030809@cs.ntua.gr> Message-ID: <46E1782E.9030004@industrial-designers.co.uk> Kostis Sagonas wrote: > Damien Morton wrote: >> +1 on less syntactic clutter. >> >> The /2-ness of foo is clear from the remainder of the type specification >> >> There are redundant parentheses too - are they neeed? >> >> -spec(foo :: (integer, float) -> atom) >> >> just reads better to me >>> On Tue, 4 Sep 2007, Kostis Sagonas wrote: >>> >>>> In the new language you would write (or preferably change the above edoc >>>> comment to be): >>>> >>>> -spec(foo/2 :: ((integer(), float()) -> atom())). >>>> >>> What is the reason for the trailing ()s? It would be nice if the syntax >>> had less redundant visual noise. > > I very much agree with this wish, but: > > 1. As mentioned in some other post in this thread, types like the > following one are also allowed > > {ok, integer()} | {error, string()} > > and there needs to be way to distinguish between atoms (i.e. > singleton types) and type names. I'm not necessarily arguing against the current syntax, but I think that other ways to achieve this should be considered: a) {atom(ok), integer} | {atom(error), string} b) {'ok', integer} | {'error', string} c) {ok, Integer} | {error, String} Note that c) does not collide with the existing edoc type syntax, e.g. it would be possible to allow either "Integer" or "integer()" as synonyms (and "List(...)" or "list(...)" as synonyms in the example below). There is also some sense to using the same case convention for non-singleton types as for variables (since a variable is needed to hold any member of a non-singleton type). OTOH, an advantage of the existing edoc syntax that is shared by a) but not by b) or c) (unless "Integer" etc. were reserved variable names, which would break too much code), is that each type specification corresponds to a unique Erlang term, which could be used to represent the type in APIs that require first-class types. (integer/1, for example, is a conversion function, but that does not prevent integer/0 from being a function that returns a term representing the type.) > 2. We want to be as much as possible compatible with edoc. After the dialyzer type declarations come into use, there won't be any more opportunities to change the type syntax incompatibly (although as noted above, some changes could be made compatibly). So possible changes should be given careful consideration now. > 3. Some types can also take parameters. For example, the user might > define lists of integers and atoms as: > > list(integer() | atom()) a) or b) list(integer | atom) c) List(Integer | Atom) -- David Hopwood From bazil@REDACTED Fri Sep 7 21:55:28 2007 From: bazil@REDACTED (Dmitriy Gorbenko) Date: Fri, 07 Sep 2007 19:55:28 +0000 Subject: [erlang-questions] Problem with using Port drivers - need advice Message-ID: <46E1ACB0.4030108@agenstvo.com> Hi all. I am a beginner in erlang, so I go to http://erlang.org//doc/tutorial/part_frame.html, find there chapter "6 Port drivers", and tries to compile entire chain. At first, I guess it is a mistake: unix> gcc -o exampledrv -fpic -shared complex.c port_driver.c I think must be wrote like this: unix> gcc -o example_drv -fpic -shared complex.c port_driver.c Well, I create C source file, and tries to compile it: -----------8<---------------------------------------------------------------- bazil@REDACTED ~/try/erl $ cat so_file.c #include #include "erl_driver.h" int foo(int x) { return x+1; } int bar(int y) { return y*2; } typedef struct { ErlDrvPort port; } example_data; static ErlDrvData example_drv_start(ErlDrvPort port, char *buff) { example_data* d = (example_data*)driver_alloc(sizeof(example_data)); d->port = port; return (ErlDrvData)d; } static void example_drv_stop(ErlDrvData handle) { driver_free((char*)handle); } static void example_drv_output(ErlDrvData handle, char *buff, int bufflen) { example_data* d = (example_data*)handle; char fn = buff[0], arg = buff[1], res; if (fn == 1) { res = foo(arg); } else if (fn == 2) { res = bar(arg); } driver_output(d->port, &res, 1); } ErlDrvEntry example_driver_entry = { NULL, // F_PTR init, N/A example_drv_start, // L_PTR start, called when port is opened example_drv_stop, // F_PTR stop, called when port is closed example_drv_output, // F_PTR output, called when erlang has sent NULL, // F_PTR ready_input, called when input descriptor ready NULL, // F_PTR ready_output, called when output descriptor ready "example_drv", // char *driver_name, the argument to open_port NULL, // F_PTR finish, called when unloaded NULL, // F_PTR control, port_command callback NULL, // F_PTR timeout, reserved NULL // F_PTR outputv, reserved }; DRIVER_INIT(example_drv) // must match name in driver_entry { return &example_driver_entry; } bazil@REDACTED ~/try/erl $ gcc -o example_drv -fpic -shared so_file.c -I/usr/lib64/erlang/usr/include bazil@REDACTED ~/try/erl $ -----------8<---------------------------------------------------------------- Next, goes Erlang code: -----------8<---------------------------------------------------------------- bazil@REDACTED ~/try/erl $ cat test.erl -module(test). -export([start/1, stop/0, init/1]). -export([foo/1, bar/1]). start(SharedLib) -> case erl_ddll:load_driver(".", SharedLib) of ok -> ok; {error, already_loaded} -> ok; _ -> exit({error, could_not_load_driver}) end, spawn(?MODULE, init, [SharedLib]). init(SharedLib) -> register(complex, self()), Port = open_port({spawn, SharedLib}, []), loop(Port). stop() -> complex ! stop. foo(X) -> call_port({foo, X}). bar(Y) -> call_port({bar, Y}). call_port(Msg) -> complex ! {call, self(), Msg}, receive {complex, Result} -> Result end. loop(Port) -> receive {call, Caller, Msg} -> Port ! {self(), {command, encode(Msg)}}, receive {Port, {data, Data}} -> Caller ! {complex, decode(Data)} end, loop(Port); stop -> Port ! {self(), close}, receive {Port, closed} -> exit(normal) end; {'EXIT', Port, Reason} -> io:format("~p ~n", [Reason]), exit(port_terminated) end. encode({foo, X}) -> [1, X]; encode({bar, Y}) -> [2, Y]. decode([Int]) -> Int. bazil@REDACTED ~/try/erl $ -----------8<---------------------------------------------------------------- Then, running test.erl: -----------8<---------------------------------------------------------------- bazil@REDACTED ~/try/erl $ erl -name f3t@REDACTED Erlang (BEAM) emulator version 5.5.5 [source] [64-bit] [async-threads:0] [kernel-poll:false] Eshell V5.5.5 (abort with ^G) (f3t@REDACTED)1> c(test). {ok,test} (f3t@REDACTED)2> test:start("example_drv"). ** exited: {error,could_not_load_driver} ** (f3t@REDACTED)3> User switch command --> q bazil@REDACTED ~/try/erl $ -----------8<---------------------------------------------------------------- Could anyone help me ? Thanks. -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 2244 bytes Desc: S/MIME Cryptographic Signature URL: From bent@REDACTED Fri Sep 7 19:43:10 2007 From: bent@REDACTED (Ben Munat) Date: Fri, 07 Sep 2007 07:43:10 -1000 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: <46E16C94.8090604@industrial-designers.co.uk> References: <46DCDE0C.9000504@pmp.com.au> <46DF2BF5.7050908@pmp.com.au> <95be1d3b0709052337i485d80d7gf1e7d0985932cff7@mail.gmail.com> <46DFA3CD.7010300@pmp.com.au> <95be1d3b0709060016m1602ac6cia3c394bcbfc7c7ea@mail.gmail.com> <46E1259B.8030000@pmp.com.au> <46E16C94.8090604@industrial-designers.co.uk> Message-ID: <46E18DAE.4080907@munat.com> David Hopwood wrote: > It would also add complexity to the VM and have a performance cost. Running out of a compressed archive is extremely common in the Java world. I've always wondered if there is a performance hit there... but if so, no one seems to be worried about it. Ben From dking@REDACTED Fri Sep 7 20:29:29 2007 From: dking@REDACTED (David King) Date: Fri, 7 Sep 2007 11:29:29 -0700 Subject: [erlang-questions] Message-sending performance Message-ID: <97F91CA1-E11A-4B2F-B706-C0E8766209EC@ketralnis.com> I've noticed that I can send 100,000 messages from one process to another very quickly (less than a second), but if I have two process send 50,000 messages each to a given process, it receives them very slowly (in my test, 36s). I found this using the mapreduce implementation in Joe's book where potentially thousands of processes are spawned and many (potentially very small) messages are sent. I assume that this is because the message queue is locked while sending and receiving messages. Is there any way to work around this so that having multiple processes sending many messages each isn't so slow? In my case I'd like the sender and receiver to be working simultaneously, so having each sender process send one large list isn't quite as efficient Here it is with one process: (nodename@REDACTED)11> message_streamer:stream_messages(100000). Receiving 10000 at 63356401790 Receiving 20000 at 63356401790 Receiving 30000 at 63356401790 Receiving 40000 at 63356401790 Receiving 50000 at 63356401790 Receiving 60000 at 63356401790 Receiving 70000 at 63356401790 Receiving 80000 at 63356401790 Receiving 90000 at 63356401790 Done sending 100000 messages Receiving 100000 at 63356401790 100000 messages in 1s, 1.00000e+5 msg/s And here it is with two processes: (nodename@REDACTED)9> message_streamer:stream_messages(100000). Receiving 10000 at 63356401639 Receiving 20000 at 63356401643 Receiving 30000 at 63356401650 Receiving 40000 at 63356401660 Receiving 50000 at 63356401673 Done sending 50000 messages Receiving 60000 at 63356401673 Receiving 70000 at 63356401673 Receiving 80000 at 63356401673 Receiving 90000 at 63356401673 Receiving 100000 at 63356401673 Done sending 50000 messages 100000 messages in 36s, 2777.78 msg/s In the multiple-process case, it actually slows down as more messages are sent until one of the processes completes, and then it receives them all very quickly. Here's the code: --- code begins --- -module(message_streamer). -compile(export_all). stream_messages(N) -> Self=self(), Start=myapp_util:now(), List=lists:seq(1,N), Split_List=split_list(List,erlang:system_info(schedulers)), lists:foreach(fun(Sublist) -> spawn_link(fun() -> lists:foreach(fun(Which) -> Self ! {msg,Which} end, Sublist), io:format("Done sending ~p messages~n", [length(Sublist)]) end) end, Split_List), lists:foreach(fun(Which) -> case Which rem (N div 10) of 0 -> io:format("Receiving ~p at ~p ~n", [Which,myapp_util:now()]); _ -> ok end, receive {msg,Which} -> ok end end, List), Time=case myapp_util:now()-Start of 0 -> 1; X -> X end, io:format("~p messages in ~ps, ~p msg/s~n",[N,Time,N/Time]). %% splits a list into equal parts %% split_list([1,2,3,4,5,6],2) -> [[1,2,3],[4,5,6]] split_list(List,Pieces) -> Length=length(List), lists:reverse(split_list(List,Length div Pieces,Length,[])). split_list([], _Per_Piece, 0, Acc) -> Acc; split_list(List, Per_Piece, Length, Acc) when Length>=Per_Piece -> {Short,Long} = lists:split(Per_Piece,List), split_list(Long, Per_Piece, Length-Per_Piece, [ Short | Acc ]); split_list(List, Per_Piece, Length, Acc) when Length {Short,Long} = lists:split(Length, List), split_list(Long, Per_Piece, Length-Length, [ Short | Acc ]). --- code ends --- myapp_util:now() just looks like: now() -> calendar:datetime_to_gregorian_seconds(calendar:universal_time()). From bob@REDACTED Fri Sep 7 21:58:54 2007 From: bob@REDACTED (Bob Ippolito) Date: Fri, 7 Sep 2007 12:58:54 -0700 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: <46E18DAE.4080907@munat.com> References: <46DCDE0C.9000504@pmp.com.au> <46DF2BF5.7050908@pmp.com.au> <95be1d3b0709052337i485d80d7gf1e7d0985932cff7@mail.gmail.com> <46DFA3CD.7010300@pmp.com.au> <95be1d3b0709060016m1602ac6cia3c394bcbfc7c7ea@mail.gmail.com> <46E1259B.8030000@pmp.com.au> <46E16C94.8090604@industrial-designers.co.uk> <46E18DAE.4080907@munat.com> Message-ID: <6a36e7290709071258n5aea154awb10b8c1e67c48b44@mail.gmail.com> On 9/7/07, Ben Munat wrote: > David Hopwood wrote: > > It would also add complexity to the VM and have a performance cost. > > Running out of a compressed archive is extremely common in the Java world. I've > always wondered if there is a performance hit there... but if so, no one seems > to be worried about it. > I'd imagine that it's measurably faster actually. All of the bytecode lives in RAM once it's loaded, and disk is the bottleneck for loading from compressed archives. Not only are you reading less blocks, but there's less wasted space and less seeks with reading one file as opposed to many. -bob From dking@REDACTED Fri Sep 7 23:04:59 2007 From: dking@REDACTED (David King) Date: Fri, 7 Sep 2007 14:04:59 -0700 Subject: [erlang-questions] Tilera 64-core chip - let's help them help us! In-Reply-To: <837db430709061551s21a113ceh85d53d0c90eeaf43@mail.gmail.com> References: <837db430709060351i34ba6b54x3872c5bec24e19d6@mail.gmail.com> <291037.68853.qm@web38805.mail.mud.yahoo.com> <837db430709060917x1c069413hf0aea0a4fd89e342@mail.gmail.com> <837db430709061551s21a113ceh85d53d0c90eeaf43@mail.gmail.com> Message-ID: > Well... this will spawn a process for every item in the map. How > efficient would that be if there are, say, 10 million elements in the > map and only 64 processor cores? If you have that many lists, chunk it up into the number of cores available, and run that many processes. See the code at http:// www.trapexit.org/forum/viewtopic.php? t=9630&sid=9958dd64b35126d8775355a24dfefc47 where it splits the (potentially very large) list using a split_list/2 function. It could probably be made more efficient, but the idiom would be the same. From david.hopwood@REDACTED Fri Sep 7 21:37:38 2007 From: david.hopwood@REDACTED (David Hopwood) Date: Fri, 07 Sep 2007 20:37:38 +0100 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: <46E18DAE.4080907@munat.com> References: <46DCDE0C.9000504@pmp.com.au> <46DF2BF5.7050908@pmp.com.au> <95be1d3b0709052337i485d80d7gf1e7d0985932cff7@mail.gmail.com> <46DFA3CD.7010300@pmp.com.au> <95be1d3b0709060016m1602ac6cia3c394bcbfc7c7ea@mail.gmail.com> <46E1259B.8030000@pmp.com.au> <46E16C94.8090604@industrial-designers.co.uk> <46E18DAE.4080907@munat.com> Message-ID: <46E1A882.4070706@industrial-designers.co.uk> Ben Munat wrote: > David Hopwood wrote: >> It would also add complexity to the VM and have a performance cost. > > Running out of a compressed archive is extremely common in the Java world. It was encryption that I was referring to as having a performance cost. Compression adds complexity, but not usually a significant performance cost. It can result in a performance gain if the decompression algorithm is fast enough, and if there was enough redundancy in the original format that we are doing substantially less I/O to read the compressed file. So compression might be beneficial, but that is independent of any desire for copy protection. -- David Hopwood From jim.mccoy@REDACTED Sat Sep 8 06:48:14 2007 From: jim.mccoy@REDACTED (Jim McCoy) Date: Fri, 7 Sep 2007 21:48:14 -0700 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: <46E1A882.4070706@industrial-designers.co.uk> References: <46DF2BF5.7050908@pmp.com.au> <95be1d3b0709052337i485d80d7gf1e7d0985932cff7@mail.gmail.com> <46DFA3CD.7010300@pmp.com.au> <95be1d3b0709060016m1602ac6cia3c394bcbfc7c7ea@mail.gmail.com> <46E1259B.8030000@pmp.com.au> <46E16C94.8090604@industrial-designers.co.uk> <46E18DAE.4080907@munat.com> <46E1A882.4070706@industrial-designers.co.uk> Message-ID: What is probably needed here is a custom beam loader that can check signatures on the beam files. This variant would replace the bit that loads a beam from disk with a function that first scans the beam to generate a hash and then compares the hash to a manifest that has been signed by the publisher's pubkey. It would deter casual attacks and any additional security you want to add would probably be best handled in the beam loading mechanism anyway, so this would also be the logical place to start if you wanted to later add beam encryption, etc. jim From bjt@REDACTED Sat Sep 8 07:36:34 2007 From: bjt@REDACTED (Benjamin Tolputt) Date: Sat, 08 Sep 2007 15:36:34 +1000 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: <95be1d3b0709070333u58b09451k519b7974ef103b34@mail.gmail.com> References: <46DCDE0C.9000504@pmp.com.au> <46DF2BF5.7050908@pmp.com.au> <95be1d3b0709052337i485d80d7gf1e7d0985932cff7@mail.gmail.com> <46DFA3CD.7010300@pmp.com.au> <95be1d3b0709060016m1602ac6cia3c394bcbfc7c7ea@mail.gmail.com> <46E1259B.8030000@pmp.com.au> <95be1d3b0709070333u58b09451k519b7974ef103b34@mail.gmail.com> Message-ID: <46E234E2.5090803@pmp.com.au> Vlad Dumitrescu wrote: > The explanation this time is clearer, thanks. OK, cool. > You say some kind of DRM is necessary in order to get a deal. Sure, > that's agreed. > > You say it's easier/safer to put all beam files in an archive and > protect it, as compared to protect each beam file. I may be wrong, but > I think there's no difference. If the code loader is extended so that > it can load from an encrypted archive, then it can just as easily load > from separately encrypted beam files. A cracker can do something about > it if it cracks the encryption, and in that case both alternatives are > just as easy to tamper with. Without the encryption key, a modified > beam file would useless in both cases. > > What am I missing? What is a packaging into a smaller set of files > adding to the security level? A couple of things here. Firstly, by having the files "out in the open" (i.e. same filename, etc) - it makes it REALLY easy to compare to the original. It is pretty easy to work out how to the encryption used (& the key) when you have the original file to compare to. Game software DRM is all about _inconveniencing_ the hackers. It is an axiom that having both the encrypted file & encryption key in the hands of the client is not 100% secure. So arguments on that will only get agreement from me. We cannot really raise the security level by putting the files into a single archive, but we can raise the "inconvenience level" making it more difficult There is also "standard practice" to consider. As I mentioned in another email - the standard practice for game deployment is a small number of large archive files. By enabling the code to be extracted from a zip or other archive - there is a single "bottleneck" in the code that can be altered to other archive file formats (encrypted or otherwise). The point *I* am trying to make is that enabling a single file (or perhaps double "exe + archive" file) distribution enables the game developers to get past the above "commercial hurdles", while also giving the other developers asking for single/dual file deployments what they desire. Please note, this is not a demand or even a pushy request (contrary to what I am sure it appears to be). I am simply trying to explain WHY some of us desire the deployment characteristics we are asking for. Regards, B.J.Tolputt From bjt@REDACTED Sat Sep 8 07:38:41 2007 From: bjt@REDACTED (Benjamin Tolputt) Date: Sat, 08 Sep 2007 15:38:41 +1000 Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: References: <46DF2BF5.7050908@pmp.com.au> <95be1d3b0709052337i485d80d7gf1e7d0985932cff7@mail.gmail.com> <46DFA3CD.7010300@pmp.com.au> <95be1d3b0709060016m1602ac6cia3c394bcbfc7c7ea@mail.gmail.com> <46E1259B.8030000@pmp.com.au> <46E16C94.8090604@industrial-designers.co.uk> <46E18DAE.4080907@munat.com> <46E1A882.4070706@industrial-designers.co.uk> Message-ID: <46E23561.1090309@pmp.com.au> Jim McCoy wrote: > What is probably needed here is a custom beam loader that can check > signatures on the beam files. This variant would replace the bit that > loads a beam from disk with a function that first scans the beam to > generate a hash and then compares the hash to a manifest that has been > signed by the publisher's pubkey. It would deter casual attacks and > any additional security you want to add would probably be best handled > in the beam loading mechanism anyway, so this would also be the > logical place to start if you wanted to later add beam encryption, > etc. > That would be one essential step. The other would be being able to load beams from an archive file of some form. If I understand Kenneth Lundin's email correctly - this is in the works but without a "delivery date". Regards, B.J.Tolputt From james.laken@REDACTED Sat Sep 8 09:43:16 2007 From: james.laken@REDACTED (James Laken) Date: Sat, 08 Sep 2007 09:43:16 +0200 Subject: [erlang-questions] Mnesia k-safetey Message-ID: <46E25294.7000908@gmail.com> Hi All, I am trying to implement automatic k-safety with mnesia tables and fragments. In this context the k-safety means that each table or fragments have at least K number of replica across N number of machines. - On node crash each remaining and non-overloaded node should "pick" 1/N of the data from the crashed node replicas. - On node join, some tables (fragments) replicas migrated to the new node, to provide load-balancing. At first sight it may looks easy, because Mnesia support online node and fragment addition/deletion - but doing it in automatic way, with error handling and fault tolerance and without race condition that makes it difficult (or at least, to me). What is the correct way to implement this kind of setup? Any experience or advice? Regards, James From ulf@REDACTED Sat Sep 8 11:31:56 2007 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 8 Sep 2007 11:31:56 +0200 Subject: [erlang-questions] Mnesia k-safetey In-Reply-To: <46E25294.7000908@gmail.com> References: <46E25294.7000908@gmail.com> Message-ID: <8209f740709080231v7b7e7154j3d15188b4865d0d2@mail.gmail.com> To begin with, you can subscribe to mnesia events. Race conditions can be avoided by calling mnesia_schema:schema_transaction/1, and using the mnesia_schema:do_xxx() functions to rearrange fragments and copies. If you want to make sure that only one node reacts to mnesia events at any given time, gen_leader might be of some use. You will find it in jungerl. BR, Ulf W 2007/9/8, James Laken : > Hi All, > > I am trying to implement automatic k-safety with mnesia tables and > fragments. In this context the k-safety means that each table or > fragments have at least K number of replica across N number of machines. > - On node crash each remaining and non-overloaded node should "pick" 1/N > of the data from the crashed node replicas. > - On node join, some tables (fragments) replicas migrated to the new > node, to provide load-balancing. > At first sight it may looks easy, because Mnesia support online node and > fragment addition/deletion - but doing it in automatic way, with error > handling and fault tolerance and without race condition that makes it > difficult (or at least, to me). > > What is the correct way to implement this kind of setup? Any experience > or advice? > > Regards, > James > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From psa@REDACTED Sat Sep 8 11:52:38 2007 From: psa@REDACTED (=?ISO-8859-1?Q?Paulo_S=E9rgio_Almeida?=) Date: Sat, 08 Sep 2007 10:52:38 +0100 Subject: [erlang-questions] Message-sending performance In-Reply-To: <97F91CA1-E11A-4B2F-B706-C0E8766209EC@ketralnis.com> References: <97F91CA1-E11A-4B2F-B706-C0E8766209EC@ketralnis.com> Message-ID: <46E270E6.90808@di.uminho.pt> Hi David, The problem here is that you are insisting on receiving messages by a given order: {msg, X} with X <- [1..N]. Messages sent become interleaved in the mailbox; when you try to remove, say {msg, 40000} from the 1st process, there are already 10000s of messages in the mailbox from the other process before that one, that must be scanned; receive becomes very slow. This is one of the problems one must be keeping an eye on: beware the size of the mailbox. In your problem you will see that if you replace receive by receive {msg, _} -> ok end the program will execute extremely fast, as with 1 process. Regards, Paulo David King wrote: > I've noticed that I can send 100,000 messages from one process to > another very quickly (less than a second), but if I have two process > send 50,000 messages each to a given process, it receives them very > slowly (in my test, 36s). I found this using the mapreduce > implementation in Joe's book where potentially thousands of processes > are spawned and many (potentially very small) messages are sent. > > I assume that this is because the message queue is locked while > sending and receiving messages. Is there any way to work around this > so that having multiple processes sending many messages each isn't so > slow? In my case I'd like the sender and receiver to be working > simultaneously, so having each sender process send one large list > isn't quite as efficient > > Here it is with one process: > > (nodename@REDACTED)11> message_streamer:stream_messages(100000). > Receiving 10000 at 63356401790 > Receiving 20000 at 63356401790 > Receiving 30000 at 63356401790 > Receiving 40000 at 63356401790 > Receiving 50000 at 63356401790 > Receiving 60000 at 63356401790 > Receiving 70000 at 63356401790 > Receiving 80000 at 63356401790 > Receiving 90000 at 63356401790 > Done sending 100000 messages > Receiving 100000 at 63356401790 > 100000 messages in 1s, 1.00000e+5 msg/s > > And here it is with two processes: > > (nodename@REDACTED)9> message_streamer:stream_messages(100000). > Receiving 10000 at 63356401639 > Receiving 20000 at 63356401643 > Receiving 30000 at 63356401650 > Receiving 40000 at 63356401660 > Receiving 50000 at 63356401673 > Done sending 50000 messages > Receiving 60000 at 63356401673 > Receiving 70000 at 63356401673 > Receiving 80000 at 63356401673 > Receiving 90000 at 63356401673 > Receiving 100000 at 63356401673 > Done sending 50000 messages > 100000 messages in 36s, 2777.78 msg/s > > In the multiple-process case, it actually slows down as more messages > are sent until one of the processes completes, and then it receives > them all very quickly. Here's the code: > > --- code begins --- > -module(message_streamer). > > -compile(export_all). > > stream_messages(N) -> > Self=self(), > Start=myapp_util:now(), > > List=lists:seq(1,N), > Split_List=split_list(List,erlang:system_info(schedulers)), > > lists:foreach(fun(Sublist) -> > spawn_link(fun() -> > lists:foreach(fun(Which) -> > Self ! {msg,Which} > end, > Sublist), > io:format("Done sending ~p messages~n", > [length(Sublist)]) > end) > end, Split_List), > lists:foreach(fun(Which) -> > case Which rem (N div 10) of > 0 -> > io:format("Receiving ~p at ~p ~n", > [Which,myapp_util:now()]); > _ -> ok > end, > receive {msg,Which} -> ok end > end, > List), > Time=case myapp_util:now()-Start of > 0 -> 1; > X -> X > end, > io:format("~p messages in ~ps, ~p msg/s~n",[N,Time,N/Time]). > > %% splits a list into equal parts > %% split_list([1,2,3,4,5,6],2) -> [[1,2,3],[4,5,6]] > split_list(List,Pieces) -> > Length=length(List), > lists:reverse(split_list(List,Length div Pieces,Length,[])). > > split_list([], _Per_Piece, 0, Acc) -> > Acc; > split_list(List, Per_Piece, Length, Acc) when Length>=Per_Piece -> > {Short,Long} = lists:split(Per_Piece,List), > split_list(Long, Per_Piece, Length-Per_Piece, [ Short | Acc ]); > split_list(List, Per_Piece, Length, Acc) when Length > {Short,Long} = lists:split(Length, List), > split_list(Long, Per_Piece, Length-Length, [ Short | Acc ]). > --- code ends --- > > myapp_util:now() just looks like: > now() -> > calendar:datetime_to_gregorian_seconds(calendar:universal_time()). > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Paulo S?rgio Almeida Email: psa@REDACTED Dep. Informatica - Universidade do Minho Phone: +351 253 604451 Campus de Gualtar - 4710-057 Braga - PORTUGAL Fax : +351 253 604471 From thomasl_erlang@REDACTED Sat Sep 8 13:13:01 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Sat, 8 Sep 2007 04:13:01 -0700 (PDT) Subject: [erlang-questions] Stand Alone Erlang or Equivalent In-Reply-To: <46E234E2.5090803@pmp.com.au> Message-ID: <816964.14345.qm@web38802.mail.mud.yahoo.com> --- Benjamin Tolputt wrote: > There is also "standard practice" to consider. As I > mentioned in another > email - the standard practice for game deployment is > a small number of > large archive files. By enabling the code to be > extracted from a zip or > other archive - there is a single "bottleneck" in > the code that can be > altered to other archive file formats (encrypted or > otherwise). > > The point *I* am trying to make is that enabling a > single file (or > perhaps double "exe + archive" file) distribution > enables the game > developers to get past the above "commercial > hurdles", while also giving > the other developers asking for single/dual file > deployments what they > desire. Storing multiple beam files in a single archive has been done at least three times that I know of. Here is a simple fourth approach (untested, of course): * compile your modules into binaries M1,...,Mn (compile:file(...,[...,binary,...]) should do it) * create an archive: Bin = term_to_binary([{mod1,"file1",M1},...]), file:write("archive", Bin) * at startup, load the code manually: {ok, Archive} = file:read_file("archive"), [ code:load_binary(Mod, File, Code) || {Mod, File, Code} <- binary_to_term(Archive) ] Note that this requires some code to be present to bootstrap, and sucks a big binary into the system. But you can see the principle. The beam emulator contains some precompiled bytecode too, if memory serves. I'm not sure how that is generated in detail, but you might be able to use the same mechanism. Best, Thomas ____________________________________________________________________________________ Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more. http://mobile.yahoo.com/go?refer=1GNXIC From richardc@REDACTED Sat Sep 8 14:52:30 2007 From: richardc@REDACTED (Richard Carlsson) Date: Sat, 08 Sep 2007 14:52:30 +0200 Subject: [erlang-questions] Error in erl_tidy (syntax tools) any fix? In-Reply-To: <46CBDDC3.8040004@Kreditor.se> References: <46CBD7B0.7000203@ituniv.se> <46CBDC5C.9030409@Kreditor.se> <46CBDDC3.8040004@Kreditor.se> Message-ID: <46E29B0E.3080302@it.uu.se> Erik Stenman wrote: > I wrote that I had received a patch from Richard which might > solve the problem. But on second thought I think the patch > only solves the problem when the type is given as binary, > as in: > <<(foo(X))/binary>> > > So I guess Richard needs to take a deeper look at the whole > handling of expressions inside binaries in syntax_tools. I haven't had time to test this until now, but no, the patch works in both cases. /Richard -- "Having users is like optimization: the wise course is to delay it." -- Paul Graham From smangano@REDACTED Sat Sep 8 15:56:03 2007 From: smangano@REDACTED (Salvatore Mangano) Date: Sat, 8 Sep 2007 09:56:03 -0400 Subject: [erlang-questions] Tilera responds Message-ID: <024801c7f21f$feee3340$6400a8c0@einstein> Here is an email I just received from them: Hi Salvatore, Thanks for your interest in Tilera and the TILE64 processor. We have received a large volume of requests following our launch at Hot Chips, so we apologize for the delay in contacting you and appreciate your patience. Currently, we are focused on supporting large enterprise OEMs. We definitely recognize that there are benefits in working with groups such as the Erlang community. Once we broaden our business engagement model, we will explore such opportunities. If there are other ways we can engage, at a high level, in order to assist you with your book, we will be happy to explore such opportunities. Thanks once again for your interest and please feel free to check back with us as we broaden our business engagement model in the future. Best regards, Tilera Sales From richardc@REDACTED Sat Sep 8 15:37:41 2007 From: richardc@REDACTED (Richard Carlsson) Date: Sat, 08 Sep 2007 15:37:41 +0200 Subject: [erlang-questions] Parametrized modules and the shell In-Reply-To: <521440.19792.qm@web38802.mail.mud.yahoo.com> References: <521440.19792.qm@web38802.mail.mud.yahoo.com> Message-ID: <46E2A5A5.3030801@it.uu.se> Thomas Lindgren wrote: > I'm experimenting with parametrized modules, > [...] > 2. Exported functions have new arities. My f/3 is > replaced by f/4 (passing the implicit parameters in > the extra arg, I assume). How should I invoke them? After applying the patch for R115B that Hans B pointed out, it should work just like you tried to do it, i.e.: 1> M = myabstractmod:new(...). 2> M:function(...). The exported functions now have an extra parameter, as you noted, which can be seen in module_info(), but that should be ignored when you call the functions - the 'THIS'-parameter is passed automatically (also by apply/3 and friends). The module_info() will contain an attribute {abstract,true} if the module is parameterized, so that tools can be aware of the extra parameters in exported functions. There ought to be support for user-defined static functions (without an extra parameter), but currently only the autogenerated 'new' function is static. Feel free to work on it: the expansion is handled in lib/compiler/src/sys_pre_expand.erl, in expand_pmod/2. /Richard -- "Having users is like optimization: the wise course is to delay it." -- Paul Graham From thomas.arts@REDACTED Sat Sep 8 18:46:31 2007 From: thomas.arts@REDACTED (Thomas Arts) Date: Sat, 08 Sep 2007 18:46:31 +0200 Subject: [erlang-questions] Test coverage -- propose patch of cover.erl Message-ID: <46E2D1E7.4020101@ituniv.se> I'm probably alone in this, but I sometimes use another directory than "src" to put my source files in, mainly because the sources are automatically generated and I don't want to mix them with sources manually written. Anyway, if you test your code and you use cover to find out which lines were visited, then cover will nicely format your output in a file found in the "src" directory. Even if the beam file contains the source! I would eventually like to see that that source is used, but I am already content if the correct source code directory (also in .beam) is used. Therefore, I propose the following patch to cover.erl %% Given a .beam file, find the .erl file. %% Try to extract the path from .beam file, otherwise, %% look first in same directory as the .beam file, then in /../src %% %% Actually would be better to use the code in the .beam file, if included. find_source(File0) -> case path_in_beam(File0) of {ok,Path} -> Dir = filename:dirname(File0), filename:join([Dir,Path]); _ -> case filename:rootname(File0,".beam") of File0 -> File0; File -> InSameDir = File++".erl", case filelib:is_file(InSameDir) of true -> InSameDir; false -> Dir = filename:dirname(File), Mod = filename:basename(File), InDotDotSrc = filename:join([Dir,"..","src",Mod++".erl"]), case filelib:is_file(InDotDotSrc) of true -> InDotDotSrc; false -> {beam,File0} end end end end. path_in_beam(File) -> case beam_lib:chunks(File,[abstract_code]) of {ok,{_,[{abstract_code,{_,AC}}]}} -> case [ F || {attribute,1,file,{F,_}}<-AC] of [ Main | _ ] -> {ok,Main}; _ -> no_file_info_in_abstract_code end; _ -> no_abstract_code end. /Thomas From thomas.arts@REDACTED Sat Sep 8 18:53:01 2007 From: thomas.arts@REDACTED (Thomas Arts) Date: Sat, 08 Sep 2007 18:53:01 +0200 Subject: [erlang-questions] Test Coverage -- proposed patch in erl_pp Message-ID: <46E2D36D.4070509@ituniv.se> For cover analysis during testing it is important to see each clause in a case statement on a separate line. In fact, coverage should not be done by lines, but by statements, clauses, etc, but assume you use the test server, then line coverage is what you get. You do not want to write a function like this: case X of true -> 12; false -> 14 end. when testing for coverage and using line coverage. You can get rather strange results. Instead you want: case X of true -> 12; false -> 14 end. If you write the code yourself, you will take care of this. However, erl_pp typesets code a bit differently. Sometimes it likes it better as the clause given above. I patched my erl_pp to contain: clauses(Type, Hook, Cs) -> {prefer_nl,[$;],lexprs(Cs, Type, Hook)}. from the original clauses(Type, Hook, Cs) -> expr_list(Cs, [$;], Type, Hook). Would that be a good patch or are there arguments against it that I haven't considered? /Thomas From mike.hales@REDACTED Sat Sep 8 19:00:22 2007 From: mike.hales@REDACTED (Mike Hales) Date: Sat, 8 Sep 2007 11:00:22 -0600 Subject: [erlang-questions] erl_interface shared libraries Message-ID: <689183f90709081000r7b1b8657g3bd32abb06013884@mail.gmail.com> I am interested in using the erl_interface libraries to make a Smalltalk virtual machine act as a C-node, for communicating with other erlang processes. The libraries generated when building erlang are static libraries (ei.a and friends). Has anybody out there sucessfully compiled the erl_interface code as shared libraries? It seems like it shouldn't be too difficult, but my skills with gcc and make are only recently developing, maybe someone else has a makefile to do this already? It would be easy to share a Smalltalk bridge if the erl_interface could be linked dynamically to the Smalltalk virtual machine. While linking statically is a possibility, compiling the Smalltalk virtual machine from source is a much more difficult task and would be a barrier to entry for many. Any help, experience or pointers would be greatly appreciated. Initially I want to do this on Linux, then eventually Windows and OSX too. Thanks, Mike -- Mike Hales Engineering Manager KnowledgeScape www.kscape.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From taavi@REDACTED Sat Sep 8 20:37:11 2007 From: taavi@REDACTED (Taavi Talvik) Date: Sat, 8 Sep 2007 21:37:11 +0300 Subject: [erlang-questions] erl_interface shared libraries In-Reply-To: <689183f90709081000r7b1b8657g3bd32abb06013884@mail.gmail.com> References: <689183f90709081000r7b1b8657g3bd32abb06013884@mail.gmail.com> Message-ID: <71545980-E139-4F20-81FD-39F1DD07B8F3@uninet.ee> On Sep 8, 2007, at 8:00 PM, Mike Hales wrote: > I am interested in using the erl_interface libraries to make a > Smalltalk virtual machine act as a C-node, for communicating with > other erlang processes. The libraries generated when building > erlang are static libraries (ei.a and friends). Has anybody out > there sucessfully compiled the erl_interface code as shared > libraries? It seems like it shouldn't be too difficult, but my > skills with gcc and make are only recently developing, maybe > someone else has a makefile to do this already? > > It would be easy to share a Smalltalk bridge if the erl_interface > could be linked dynamically to the Smalltalk virtual machine. > While linking statically is a possibility, compiling the Smalltalk > virtual machine from source is a much more difficult task and would > be a barrier to entry for many. Any help, experience or pointers > would be greatly appreciated. Initially I want to do this on > Linux, then eventually Windows and OSX too. If you are well versed in Smalltalk, then probably one possibility is to write naitive Smalltalk interface for Erlang. Basicly there are only fiew tasks: 1) encode/decode Erlang data types in external format (atom big bignum binary boolean char double fun intlist list_header long longlong pid port ref trace tuple_header ulong ulonglong version) 2) Create nodes, connections, communication with the other node etc. handle connection setup and authorization. 3) Handle communication with epmd 4) some higher level concepts like tracing, mapping processes, links to Smalltalk model. If you start from 1) you are able to communicate to erlang with via Port mechanisms over file descriptor. best regards, taavi From vladdu55@REDACTED Sat Sep 8 21:49:06 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Sat, 8 Sep 2007 19:49:06 +0000 Subject: [erlang-questions] supercomputer Message-ID: <95be1d3b0709081249r4d1c04dam7953cfe47358633d@mail.gmail.com> Hi all, I just read this http://www.eng.umd.edu/media/pressreleases/pr062607_supercomputer.html, and it seems not very off-topic here. best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob@REDACTED Sat Sep 8 22:41:16 2007 From: bob@REDACTED (Bob Ippolito) Date: Sat, 8 Sep 2007 13:41:16 -0700 Subject: [erlang-questions] erl_interface shared libraries In-Reply-To: <71545980-E139-4F20-81FD-39F1DD07B8F3@uninet.ee> References: <689183f90709081000r7b1b8657g3bd32abb06013884@mail.gmail.com> <71545980-E139-4F20-81FD-39F1DD07B8F3@uninet.ee> Message-ID: <6a36e7290709081341o5622fce0l61e03247bc2b3c56@mail.gmail.com> On 9/8/07, Taavi Talvik wrote: > > On Sep 8, 2007, at 8:00 PM, Mike Hales wrote: > > > I am interested in using the erl_interface libraries to make a > > Smalltalk virtual machine act as a C-node, for communicating with > > other erlang processes. The libraries generated when building > > erlang are static libraries (ei.a and friends). Has anybody out > > there sucessfully compiled the erl_interface code as shared > > libraries? It seems like it shouldn't be too difficult, but my > > skills with gcc and make are only recently developing, maybe > > someone else has a makefile to do this already? > > > > It would be easy to share a Smalltalk bridge if the erl_interface > > could be linked dynamically to the Smalltalk virtual machine. > > While linking statically is a possibility, compiling the Smalltalk > > virtual machine from source is a much more difficult task and would > > be a barrier to entry for many. Any help, experience or pointers > > would be greatly appreciated. Initially I want to do this on > > Linux, then eventually Windows and OSX too. > > If you are well versed in Smalltalk, then probably one possibility is to > write naitive Smalltalk interface for Erlang. > > Basicly there are only fiew tasks: > 1) encode/decode Erlang data types in external format > (atom big bignum binary boolean char double > fun intlist list_header long longlong pid port ref trace > tuple_header ulong ulonglong version) > > 2) Create nodes, connections, communication with the other node etc. > handle connection setup and authorization. > > 3) Handle communication with epmd > > 4) some higher level concepts like tracing, mapping processes, links > to Smalltalk model. > > If you start from 1) you are able to communicate to erlang with > via Port mechanisms over file descriptor. The point of a shared library is probably to load erl_interface and use it via some kind of FFI, rather than bothering to write all of that code in C. -bob From taavi@REDACTED Sat Sep 8 23:05:24 2007 From: taavi@REDACTED (Taavi Talvik) Date: Sun, 9 Sep 2007 00:05:24 +0300 Subject: [erlang-questions] erl_interface shared libraries In-Reply-To: <6a36e7290709081341o5622fce0l61e03247bc2b3c56@mail.gmail.com> References: <689183f90709081000r7b1b8657g3bd32abb06013884@mail.gmail.com> <71545980-E139-4F20-81FD-39F1DD07B8F3@uninet.ee> <6a36e7290709081341o5622fce0l61e03247bc2b3c56@mail.gmail.com> Message-ID: <0FE321BF-B14B-46E2-A1DB-3F5B180AD0E0@uninet.ee> On Sep 8, 2007, at 11:41 PM, Bob Ippolito wrote: ... > > The point of a shared library is probably to load erl_interface and > use it via some kind of FFI, rather than bothering to write all of > that code in C. There is no need to do anything in C. Erlang distribution has "defined" wire protocol (in erlang, C and java source code, unfortunately no documents). Doing it directly in Smalltalk will probably (just probably) give better mach between Erlang and Smalltalk models world orders. Mapping through C means mapping concepts into one foreign context and mapping that foreign context to next foreign context. best regards, taavi From vances@REDACTED Sat Sep 8 23:45:43 2007 From: vances@REDACTED (Vance Shipley) Date: Sat, 8 Sep 2007 17:45:43 -0400 Subject: [erlang-questions] erl_interface shared libraries In-Reply-To: <689183f90709081000r7b1b8657g3bd32abb06013884@mail.gmail.com> References: <689183f90709081000r7b1b8657g3bd32abb06013884@mail.gmail.com> Message-ID: <20070908214542.GB304@little-black-book.motivity.ca> Mike, I've done this many times. You can have at look at this project: http://code.google.com/p/netaccess-erldrv That's a example using the GNU autotools. -Vance On Sat, Sep 08, 2007 at 11:00:22AM -0600, Mike Hales wrote: } [...] Has anybody out there sucessfully compiled the erl_interface } code as shared libraries? [...] From mike.hales@REDACTED Sun Sep 9 00:55:54 2007 From: mike.hales@REDACTED (Mike Hales) Date: Sat, 8 Sep 2007 16:55:54 -0600 Subject: [erlang-questions] erl_interface shared libraries In-Reply-To: <0FE321BF-B14B-46E2-A1DB-3F5B180AD0E0@uninet.ee> References: <689183f90709081000r7b1b8657g3bd32abb06013884@mail.gmail.com> <71545980-E139-4F20-81FD-39F1DD07B8F3@uninet.ee> <6a36e7290709081341o5622fce0l61e03247bc2b3c56@mail.gmail.com> <0FE321BF-B14B-46E2-A1DB-3F5B180AD0E0@uninet.ee> Message-ID: <5F5EEFE7-9BF4-48B6-B03F-59C760DAE358@kscape.com> I was thinking of using the Smalltalk FFI. Although I would not be opposed to writing a pure Smalltalk implementation, as this would then be portable across platforms, and the easiest to distribute to the Smalltalk community. (Also, I would probably be faster in Smalltalk, than fumbling around with C.) If one were to look for this "defined" wire protocol in the erlang code, where would one do it? Thanks, Mike On Sep 8, 2007, at 3:05 PM, Taavi Talvik wrote: >> >> The point of a shared library is probably to load erl_interface and >> use it via some kind of FFI, rather than bothering to write all of >> that code in C. > > There is no need to do anything in C. Erlang distribution has > "defined" > wire protocol (in erlang, C and java source code, unfortunately no > documents). -------------- next part -------------- An HTML attachment was scrubbed... URL: From eokyere@REDACTED Sun Sep 9 11:25:48 2007 From: eokyere@REDACTED (Emmanuel Okyere) Date: Sun, 9 Sep 2007 05:25:48 -0400 Subject: [erlang-questions] erlang-questions Digest, Vol 4, Issue 13 In-Reply-To: References: Message-ID: On 5 Sep 2007, at 01:49, erlang-questions-request@REDACTED wrote: > But as a newbie, knowing the difference between an assignment and a > match can be very helpful. Read it in a book. Don't expect your compiler to babysit you. Emmanuel --- Those who are incapable of committing great crimes do not readily suspect them in others. - Francois De La Rochefoucauld -------------- next part -------------- An HTML attachment was scrubbed... URL: From kenneth.lundin@REDACTED Sun Sep 9 12:13:52 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Sun, 9 Sep 2007 12:13:52 +0200 Subject: [erlang-questions] erl_interface shared libraries In-Reply-To: <5F5EEFE7-9BF4-48B6-B03F-59C760DAE358@kscape.com> References: <689183f90709081000r7b1b8657g3bd32abb06013884@mail.gmail.com> <71545980-E139-4F20-81FD-39F1DD07B8F3@uninet.ee> <6a36e7290709081341o5622fce0l61e03247bc2b3c56@mail.gmail.com> <0FE321BF-B14B-46E2-A1DB-3F5B180AD0E0@uninet.ee> <5F5EEFE7-9BF4-48B6-B03F-59C760DAE358@kscape.com> Message-ID: Hi Mike, I think it would be quite stupid not to implement this protocol directly in Smalltalk. Implementing with use of Erlinterface will not save you any work compared to the other solution and it will be less portable and less efficient. In the open source distribution of Erlang/OTP you should find a file erts/emulator/internal_doc/erl_ext_dist.txt which describes the protocol. You can also look ath the Jinterface in that distribution and read the doc and code for the same thing written in Java. Regards Kenneth Erlang/OTP team at Ericsson On 9/9/07, Mike Hales wrote: > I was thinking of using the Smalltalk FFI. Although I would not be opposed > to writing a pure Smalltalk implementation, as this would then be portable > across platforms, and the easiest to distribute to the Smalltalk community. > (Also, I would probably be faster in Smalltalk, than fumbling around with > C.) If one were to look for this "defined" wire protocol in the erlang > code, where would one do it? > > Thanks, > > Mike > > > On Sep 8, 2007, at 3:05 PM, Taavi Talvik wrote: > > > > > > > The point of a shared library is probably to load erl_interface and > > use it via some kind of FFI, rather than bothering to write all of > > that code in C. > > > > > There is no need to do anything in C. Erlang distribution has "defined" > > wire protocol (in erlang, C and java source code, unfortunately no > documents). > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From alex.arnon@REDACTED Sun Sep 9 13:38:41 2007 From: alex.arnon@REDACTED (Alex Arnon) Date: Sun, 9 Sep 2007 14:38:41 +0300 Subject: [erlang-questions] erl_interface shared libraries In-Reply-To: References: <689183f90709081000r7b1b8657g3bd32abb06013884@mail.gmail.com> <71545980-E139-4F20-81FD-39F1DD07B8F3@uninet.ee> <6a36e7290709081341o5622fce0l61e03247bc2b3c56@mail.gmail.com> <0FE321BF-B14B-46E2-A1DB-3F5B180AD0E0@uninet.ee> <5F5EEFE7-9BF4-48B6-B03F-59C760DAE358@kscape.com> Message-ID: <944da41d0709090438u4e8e8f28o485cec3711299d80@mail.gmail.com> Implementing a ST-native interface sounds like a better idea, IMVHO. Manipulating processes, lists, tuples and atoms (and performing possibly automatic conversions from ST objects) can be a cool and useful thing. And building an Erlang-like interface to message queues (with selective receive) would certainly provide some kudos :) -------------- next part -------------- An HTML attachment was scrubbed... URL: From mike.hales@REDACTED Sun Sep 9 20:42:37 2007 From: mike.hales@REDACTED (Mike Hales) Date: Sun, 9 Sep 2007 12:42:37 -0600 Subject: [erlang-questions] erl_interface shared libraries In-Reply-To: References: <689183f90709081000r7b1b8657g3bd32abb06013884@mail.gmail.com> <71545980-E139-4F20-81FD-39F1DD07B8F3@uninet.ee> <6a36e7290709081341o5622fce0l61e03247bc2b3c56@mail.gmail.com> <0FE321BF-B14B-46E2-A1DB-3F5B180AD0E0@uninet.ee> <5F5EEFE7-9BF4-48B6-B03F-59C760DAE358@kscape.com> Message-ID: I'll take a look thanks. I was reading the Java source for Jinterface last night, and I think I am convinced that the pure Smalltalk way is the best too. The Java code was very well documented with comments, so I should be able to build a similar interface for Smalltalk. Thanks for the answers, I'm sure I'll have more questions as I progress. On a separate subject, are there any annual erlang user conferences? There is something coming up in October in Europe, anything in the US? Anybody on the list live in Utah? Thanks, Mike On Sep 9, 2007, at 4:13 AM, Kenneth Lundin wrote: > In the open source distribution of Erlang/OTP you should find a file > erts/emulator/internal_doc/erl_ext_dist.txt > > which describes the protocol. > You can also look ath the Jinterface in that distribution and read the > doc and code > for the same thing written in Java. -------------- next part -------------- An HTML attachment was scrubbed... URL: From Bob.Cowdery@REDACTED Sun Sep 9 20:00:33 2007 From: Bob.Cowdery@REDACTED (Bob Cowdery) Date: Sun, 9 Sep 2007 19:00:33 +0100 Subject: [erlang-questions] Yaws, ErlyWeb and Windows. Message-ID: <3A76756EED583B43A4AD704E29CCD079741252@mail.smartlogic.com> Hi All Can someone give me the picture on Yaws and ErlyWeb under Windows please. Firstly I've failed pretty dismally to get Yaws working on Windows. I compiled and run it on Linux no problem. I found some info on building under cygwin and also some batch files to compile natively but both fail me right now. I did download the erlang repository (Erlang-Projects.Org) and that runs up Yaws fine but it seems to use some tricks to do it and I can't see how to just copy the Yaws directory and use it with my existing erlang system. If you have successfully got Yaws working what route did you use - I'd rather not run it under cygwin because nothing else in my erlang systems need to and I don't see why Yaws should be diferent. I've also read some posts that suggest ErlyWeb does not work under Windows. Does anyone know of any issues? Thanks for any help. Bob From francesco@REDACTED Sun Sep 9 21:38:41 2007 From: francesco@REDACTED (Francesco Cesarini) Date: Sun, 09 Sep 2007 20:38:41 +0100 Subject: [erlang-questions] Erlang the New Ruby... Message-ID: <46E44BC1.10207@erlang-consulting.com> This blog post made me laugh and brought back memories of endless Erlang vs Java conversations throughout the years. http://ravimohan.blogspot.com/2007/09/erlang-is-new-ruby.html Enjoy, Francesco -- http://www.erlang-consulting.com From zac@REDACTED Sun Sep 9 21:52:11 2007 From: zac@REDACTED (Zac Brown) Date: Sun, 09 Sep 2007 15:52:11 -0400 Subject: [erlang-questions] Erlang the New Ruby... In-Reply-To: <46E44BC1.10207@erlang-consulting.com> References: <46E44BC1.10207@erlang-consulting.com> Message-ID: <46E44EEB.9020306@zacbrown.org> Hah, thats pretty good. I've noticed that kind of thing developing too. I suspect part of the reason we garner more attention than a few other languages (ie: Haskell, lisp is back on the rise, etc) is well... initially learning Erlang is not particularly hard in comparison to other "functional" languages, though I don't really put Erlang and Haskell/Scheme/*ML in the same playing field. It would seem the ease of getting into the language fools those who don't understand what they're attempting into thinking that its going to be an easy language to pick up, which in my opinion, to really understand erlang, its not easy. (Takes a lot of work to understand proper implementation of parallelism ;)). Zac Francesco Cesarini wrote: > This blog post made me laugh and brought back memories of endless Erlang > vs Java conversations throughout the years. > > http://ravimohan.blogspot.com/2007/09/erlang-is-new-ruby.html > > > Enjoy, > Francesco > -- > http://www.erlang-consulting.com > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From francesco@REDACTED Sun Sep 9 23:32:50 2007 From: francesco@REDACTED (Francesco Cesarini) Date: Sun, 09 Sep 2007 22:32:50 +0100 Subject: [erlang-questions] Erlounge Seattle 17/9 @ 19.30 Message-ID: <46E46682.7080802@erlang-consulting.com> A few of us are getting together to drink beer, have a bite and discuss Erlang (In that order) on Monday the 17th of September in Seattle, WA. The venue is Barca, 1510 11th Avenue on Capitol Hill. More info on their site http://www.barcaseattle.com/ Let me know if you plan to attend so we can book either their mezzanine or a table large enough for everyone. The first round is on Erlang Training and Consulting. See you there, Francesco -- http://www.erlang-consulting.com From dking@REDACTED Mon Sep 10 01:26:00 2007 From: dking@REDACTED (David King) Date: Sun, 9 Sep 2007 16:26:00 -0700 Subject: [erlang-questions] Message-sending performance In-Reply-To: <46E270E6.90808@di.uminho.pt> References: <97F91CA1-E11A-4B2F-B706-C0E8766209EC@ketralnis.com> <46E270E6.90808@di.uminho.pt> Message-ID: > The problem here is that you are insisting on receiving messages by > a given order: {msg, X} with X <- [1..N]. Messages sent become > interleaved in the mailbox; when you try to remove, say {msg, > 40000} from the 1st process, there are already 10000s of messages > in the mailbox from the other process before that one, that must be > scanned; receive becomes very slow. Ah, I can see that, and I can see why, as now it is the messages out of order, so expecting to be able to receive them in order is silly > This is one of the problems one must be keeping an eye on: beware > the size of the mailbox. In your problem you will see that if you > replace receive by > receive {msg, _} -> ok end > the program will execute extremely fast, as with 1 process. Yes, it does, now sending with two processes is just as fast as sending with one (and when I actually have work to do as I receive them, it will be faster). And in my use-case, receiving the messages out-of-order isn't a problem at all. Thank you for the advice. > David King wrote: >> I've noticed that I can send 100,000 messages from one process to >> another very quickly (less than a second), but if I have two >> process send 50,000 messages each to a given process, it receives >> them very slowly (in my test, 36s). I found this using the >> mapreduce implementation in Joe's book where potentially >> thousands of processes are spawned and many (potentially very >> small) messages are sent. >> I assume that this is because the message queue is locked while >> sending and receiving messages. Is there any way to work around >> this so that having multiple processes sending many messages each >> isn't so slow? In my case I'd like the sender and receiver to be >> working simultaneously, so having each sender process send one >> large list isn't quite as efficient >> Here it is with one process: >> (nodename@REDACTED)11> message_streamer:stream_messages(100000). >> Receiving 10000 at 63356401790 >> Receiving 20000 at 63356401790 >> Receiving 30000 at 63356401790 >> Receiving 40000 at 63356401790 >> Receiving 50000 at 63356401790 >> Receiving 60000 at 63356401790 >> Receiving 70000 at 63356401790 >> Receiving 80000 at 63356401790 >> Receiving 90000 at 63356401790 >> Done sending 100000 messages >> Receiving 100000 at 63356401790 >> 100000 messages in 1s, 1.00000e+5 msg/s >> And here it is with two processes: >> (nodename@REDACTED)9> message_streamer:stream_messages(100000). >> Receiving 10000 at 63356401639 >> Receiving 20000 at 63356401643 >> Receiving 30000 at 63356401650 >> Receiving 40000 at 63356401660 >> Receiving 50000 at 63356401673 >> Done sending 50000 messages >> Receiving 60000 at 63356401673 >> Receiving 70000 at 63356401673 >> Receiving 80000 at 63356401673 >> Receiving 90000 at 63356401673 >> Receiving 100000 at 63356401673 >> Done sending 50000 messages >> 100000 messages in 36s, 2777.78 msg/s >> In the multiple-process case, it actually slows down as more >> messages are sent until one of the processes completes, and then >> it receives them all very quickly. Here's the code: >> --- code begins --- >> -module(message_streamer). >> -compile(export_all). >> stream_messages(N) -> >> Self=self(), >> Start=myapp_util:now(), >> List=lists:seq(1,N), >> Split_List=split_list(List,erlang:system_info(schedulers)), >> lists:foreach(fun(Sublist) -> >> spawn_link(fun() -> >> lists:foreach(fun(Which) -> >> Self ! {msg,Which} >> end, >> Sublist), >> io:format("Done sending ~p messages~n", >> [length(Sublist)]) >> end) >> end, Split_List), >> lists:foreach(fun(Which) -> >> case Which rem (N div 10) of >> 0 -> >> io:format("Receiving ~p at ~p ~n", >> [Which,myapp_util:now()]); >> _ -> ok >> end, >> receive {msg,Which} -> ok end >> end, >> List), >> Time=case myapp_util:now()-Start of >> 0 -> 1; >> X -> X >> end, >> io:format("~p messages in ~ps, ~p msg/s~n",[N,Time,N/Time]). >> %% splits a list into equal parts >> %% split_list([1,2,3,4,5,6],2) -> [[1,2,3],[4,5,6]] >> split_list(List,Pieces) -> >> Length=length(List), >> lists:reverse(split_list(List,Length div Pieces,Length,[])). >> split_list([], _Per_Piece, 0, Acc) -> >> Acc; >> split_list(List, Per_Piece, Length, Acc) when Length>=Per_Piece -> >> {Short,Long} = lists:split(Per_Piece,List), >> split_list(Long, Per_Piece, Length-Per_Piece, [ Short | Acc ]); >> split_list(List, Per_Piece, Length, Acc) when Length >> {Short,Long} = lists:split(Length, List), >> split_list(Long, Per_Piece, Length-Length, [ Short | Acc ]). >> --- code ends --- >> myapp_util:now() just looks like: >> now() -> >> calendar:datetime_to_gregorian_seconds(calendar:universal_time()). >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > > -- > Paulo S?rgio Almeida Email: > psa@REDACTED > Dep. Informatica - Universidade do Minho Phone: +351 253 > 604451 > Campus de Gualtar - 4710-057 Braga - PORTUGAL Fax : +351 253 > 604471 From rvirding@REDACTED Mon Sep 10 02:25:24 2007 From: rvirding@REDACTED (Robert Virding) Date: Mon, 10 Sep 2007 02:25:24 +0200 Subject: [erlang-questions] What is wrong with this list? In-Reply-To: References: <764345.64386.qm@web51101.mail.re2.yahoo.com> <2D4C450E-36A4-4956-881F-518812719F4A@spy.net> Message-ID: <3dbc6d1c0709091725i789b4e53o43eec45130fb9376@mail.gmail.com> I think the problem is to realise that there is NO difference between assignment and matching. In fact there is no assignment, only matching. Therefore having different errors for them is plain wrong. Also how would you handle the case of say: {X,Y} = some_call(...) where both X and Y are unbound? In one respect it is an assignment to multiple values, but it is also definitely a match pulling apart a value. Even if you were to say that if there were unbound variables then it is an assignment you would still get into problems with code like: {ok,X} = ... or if you had patterns with some variables bound and some unbound. Sorry if this answer seems a little harsh, but I wouldn't want to introduce a concept which doesn't exist into an error message. Robert On 05/09/07, Peter K Chan wrote: > > Dustin, > > As someone who has known Erlang for a while, the error message would > probably not be helpful (if even possible). But as a newbie, knowing the > difference between an assignment and a match can be very helpful. Actually, > if the bad match comes from some deep recursion, I think I would appreciate > seeing the actual value, even if I know what badmatches in general are. > > I do agree that the current error message gives out enough information for > debugging purpose, but having seen, more than once, where someone is > confused about the matching vs. assignment, I think the more explicit error > message would be "nice" to have. > > Peter > > From: Dustin Sallings [mailto:dustin@REDACTED] > Sent: Tuesday, September 04, 2007 4:47 PM > To: Peter K Chan > Cc: erlang-questions@REDACTED > Subject: Re: [erlang-questions] What is wrong with this list? > > > On Sep 4, 2007, at 13:29 , Peter K Chan wrote: > > > I think it would be nice if the compiler can output why a match fails (e.g. > {number, 1} does not equal {atom, java}). > > This could work as an error string along with the badmatch for the > single case discussed, but what about a case (that is contrived, but > probably similar to real code I've written somewhere) like this: > > Pid = some_function(), > Pid = other_function(). > > The error message wouldn't be all that useful to you either way > because on the first line you're capturing a value into a variable, and on > the second line you're validating the same Pid is returned. If it showed you > the value, it'd probably be meaningless to you. It would basically be > showing you two different values and saying they're not the same. > > You have the same issue in a case, receive, function definition, > etc... for which you have no matching case. You don't want to list every > possible pattern. > > -- > Dustin Sallings > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Mon Sep 10 03:14:05 2007 From: ok@REDACTED (ok) Date: Mon, 10 Sep 2007 13:14:05 +1200 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: References: <46DC193D.10504@ericsson.com> <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> <46DD9105.4050901@cs.ntua.gr> <46E05F9D.9050108@bitfurnace.com> <46E068E9.5030809@cs.ntua.gr> Message-ID: <49BA939F-7E83-41B9-A1AC-87AD4672DC44@cs.otago.ac.nz> On 8 Sep 2007, at 2:12 am, Tony Finch wrote: > I'd suggest using initial caps for type names, and omit the () except > when the type parameter is non-trivial. (That is somewhat like the > Haskell type syntax.) It would be more accurate to describe it as "as unlike the Haskell syntax as possible". Haskell uses the same conventions for type (constructors/variables) as for data (constructors/variables), so to be close to Haskell syntax, you have to use the same spelling for type constructors as you do for constants, namely, LOWER case. Also, in Haskell, every type constructor is a function, so to be close to Haskell syntax, you would have to use function notation for all Erlang type constructors. And behold, that's exactly what Erlang does! The *existing* type syntax is precisely what you get when you apply the *principles* behind Haskell type syntax to a language with Erlang's lexical conventions. From ok@REDACTED Mon Sep 10 03:22:44 2007 From: ok@REDACTED (ok) Date: Mon, 10 Sep 2007 13:22:44 +1200 Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <46E160D3.5020909@it.uu.se> References: <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> <46DD9105.4050901@cs.ntua.gr> <013d01c7f0cb$26938d60$891ea8c0@SSI.CORP> <46E08CAD.7090802@bitfurnace.com> <6a36e7290709061847s687fc7b1wdb1c11d78958cc53@mail.gmail.com> <46E0F1D4.5020005@bitfurnace.com> <46E1176D.4020509@it.uu.se> <20070907134628.GA3555@sphinx.chicagopeoplez.org> <46E160D3.5020909@it.uu.se> Message-ID: <99BA4333-32ED-40EB-86EE-AD9FD14B2F97@cs.otago.ac.nz> On 8 Sep 2007, at 2:31 am, Richard Carlsson wrote: > - you couldn't just cut out a guard and paste it in somewhere, > because the scope wasn't the same - atom(X) and the other tests > were not defined outside guards You *still* can't do that because the *semantics* is different. Consider atom(X), integer(Y) or, if you prefer to be long-winded, is_atom(X), is_integer(Y). As a guard, this asserts the conjunction "X is an atom (and) Y is an integer". As an expression, it says "determine whether X is an atom or not but forget the answer; now tell me whether Y is an integer". With comma having different semantics in the two environments, it is actually a very useful protection when a guard test uses a name that is not available in expression. atom(X), integer(Y) has the decency to raise an exception if you try to use it in an expression, instead of quietly giving you the wrong answer. > > - you couldn't access the type tests directly as a boolean value, > as in "Bool = atom(A)" - you'd have to write "Bool = (if atom > (A) -> > true; true -> false end)", which is not exactly elegant This was trivially fixable with a macro: ?G(X) ===> if X => true ; true => false end Note that the semantics of 'length', amongst others, is subtly different between guard and expression contexts, so ?G(length(X) < 10) is *not* the same as length(X) < 10 > > - some names could have different meaning depending on whether they > were used as guard tests or as normal expressions - float(X) is > a boolean test for float-ness if it's a guard, but if it's a > normal expression then it refers to the int-to-float conversion > function That is the only persuasive argument I've ever heard, and in light of the other semantic differences, it would have been better to rename the convert-to-float function to as_float/1. From ulf.wiger@REDACTED Mon Sep 10 09:30:23 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Mon, 10 Sep 2007 09:30:23 +0200 Subject: [erlang-questions] Performance Testing with C++, Java, Ruby and Erlang In-Reply-To: <46E150A1.809@ericsson.com> References: <357715.22773.qm@web81103.mail.mud.yahoo.com> <46E150A1.809@ericsson.com> Message-ID: <46E4F28F.1090809@ericsson.com> Ulf Wiger (TN/EAB) wrote: > > The set_node_value/1 function is called from within a lists:foreach(), > when you should rather use e.g. lists:foldl() with Nodes as an > accumulator. That would eliminate all the get() and put() operations, > as the updated Nodes variable is passed on to the next iteration. > > set_node_value(Round, #config{proc_ids = Proc_ids, nodes = Nodes}) -> > lists:foldl( > fun(Id, Ns) -> > set_node_value(Round, Id, Nodes) > end, Nodes, ProcIds). This is of course wrong, and a compiler warning would have indicated the problem, had I bothered to actually compile the proposed changes. The call to set_node_value/3 must be done using Ns rather than Nodes: set_node_value(Round, #config{proc_ids = Proc_ids, nodes = Nodes}) -> lists:foldl( fun(Id, Ns) -> set_node_value(Round, Id, Ns) end, Nodes, ProcIds). BR, Ulf W From tblachowicz@REDACTED Mon Sep 10 11:18:44 2007 From: tblachowicz@REDACTED (=?ISO-8859-2?Q?Tomasz_B=B3achowicz?=) Date: Mon, 10 Sep 2007 10:18:44 +0100 Subject: [erlang-questions] Newbie training project proposal Message-ID: Hi all, I'm looking for wannabe/newbie erlang developers who'd like to learn that language in practice. I'm going to create new open source project from scratch that will aim to implement STOMP messaging protocol [1] in erlang. I've been considering both client and server side implementation. The STOMP protocol is a quite interesting proposal of simple text-oriented messaging protocol. While coding we could probably explore such erlang areas like socket programming, possibly gen_server framework, Mnesia, ETS, not to mention basic concepts of the language. I believe STOMP protocol is kind of ideal candidate for that exercise, bacause it's simple enough (I mean not so complex) and contains some non-trivial aspects e.g. transactions, full-duplex socket traffic, etc. I personally believe that is could be good opportunity to learn erlang by coding instead of only by reading books, articles and tutorials, etc. If you are interested in participation, please contact me directly. References: [1] http://stomp.codehaus.org/Protocol Take care, Tom From rsaccon@REDACTED Mon Sep 10 12:50:07 2007 From: rsaccon@REDACTED (Roberto Saccon) Date: Mon, 10 Sep 2007 07:50:07 -0300 Subject: [erlang-questions] Newbie training project proposal In-Reply-To: References: Message-ID: Interesting porject, but you should also clarify what will be your role and what is your skill level otherwise people might think either you are looking for somebody who does your work or the opposite, that your are volunteering as Erlang tutor and mentor. On 9/10/07, Tomasz B?achowicz wrote: > Hi all, > > I'm looking for wannabe/newbie erlang developers who'd like to learn > that language in practice. I'm going to create new open source project > from scratch that will aim to implement STOMP messaging protocol [1] > in erlang. I've been considering both client and server side > implementation. > > The STOMP protocol is a quite interesting proposal of simple > text-oriented messaging protocol. While coding we could probably > explore such erlang areas like socket programming, possibly gen_server > framework, Mnesia, ETS, not to mention basic concepts of the language. > I believe STOMP protocol is kind of ideal candidate for that exercise, > bacause it's simple enough (I mean not so complex) and contains some > non-trivial aspects e.g. transactions, full-duplex socket traffic, > etc. > > I personally believe that is could be good opportunity to learn erlang > by coding instead of only by reading books, articles and tutorials, > etc. If you are interested in participation, please contact me > directly. > > References: > [1] http://stomp.codehaus.org/Protocol > > Take care, > Tom > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Roberto Saccon http://rsaccon.com From raimo+erlang-questions@REDACTED Mon Sep 10 13:26:42 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Mon, 10 Sep 2007 13:26:42 +0200 Subject: [erlang-questions] now/0 resolution In-Reply-To: <46E142C6.9010804@gmail.com> References: <46E142C6.9010804@gmail.com> Message-ID: <20070910112642.GB27329@erix.ericsson.se> On Fri, Sep 07, 2007 at 07:23:34AM -0500, Serge Aleynikov wrote: > Since according to documentation consecutive executions of now/0 will > return different values (with microsecond precision) I have two questions: > > 1. Does it mean that inserting now/0 calls in code will slow down > execution to 1mks per execution? If not, then performance of function > call measured using now/0 time stamping would be inaccurate. > Well, no on both alternatives. The return value from now/0 is bumped with 1 us for every call to always return an incrementing value. But it is hardly a problem - it will not be noticabely inaccurate. To make now/0 off by more than 1 us you will have to call it so often, more than once per us, that it becomes impractical. With faster and faster computers it might become a problem one day. To time a function call you also can use call trace with timestamps. Then on some platforms (Solaris (and Linux?)) you have the option to count CPU time instead. > 2. Is it possible to measure execution time more accurately (with > nanosecond precision) using current Erlang distribution? (*) > > Serge > > (*) Since VM uses gettimeofday() to bump timer, it's limited by > getimeofday's precision. Additionally each invocation of gettimeofday > takes about 15mks (OS dependent). I believe that there's no code to > take advantage of a high resolution timer. Such a timer can give The high resolution timer is actually used for timekeeping by now/0 and tracing, but the nanoseconds are not available in any API. > nanosecond precision, and presently the only way it can be implemented > is in a linked-in driver. The only problem that calling functions > inside the driver with erlang:port_call/3 incurs some cost that would be > better to avoid if a bif (such as hrnow/0) was available. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From tblachowicz@REDACTED Mon Sep 10 13:33:19 2007 From: tblachowicz@REDACTED (=?ISO-8859-2?Q?Tomasz_B=B3achowicz?=) Date: Mon, 10 Sep 2007 12:33:19 +0100 Subject: [erlang-questions] Newbie training project proposal In-Reply-To: References: Message-ID: On 9/10/07, Roberto Saccon wrote: > Interesting porject, but you should also clarify what will be your > role and what is your skill level otherwise people might think either > you are looking for somebody who does your work or the opposite, that > your are volunteering as Erlang tutor and mentor. You are right. I should mention that I'm not any erlang mentor :) I wish I were, but I'm not. I've been senior Java/J2EE fellow for more than 5 years now. I'm really keen to learn some new programming techniques to broaden my mind and also improve my skill set. I came across erlang recently, really like Joe's book and decided to give erlang a try. I don't have any requirements in relation to participants, I was just wondering if there are any pragmatic guys like myself, who would like to learn by practice i.e. coding but not only theory. I think OO background would be good, because we then would easier understand each other :) I imagine that any help from experienced erlang programmers would be appreciated as well if someone would be interested in correct mistakes or clarify things. In other words, the purpose of the project is education and anyone interested in getting speed in erlang is welcome. Cheers, Tom From thomasl_erlang@REDACTED Mon Sep 10 14:08:19 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 10 Sep 2007 05:08:19 -0700 (PDT) Subject: [erlang-questions] Intel Quad CPUs In-Reply-To: <99BA4333-32ED-40EB-86EE-AD9FD14B2F97@cs.otago.ac.nz> Message-ID: <166581.13472.qm@web38804.mail.mud.yahoo.com> --- ok wrote: > > - some names could have different meaning > depending on whether they > > were used as guard tests or as normal > expressions - float(X) is > > a boolean test for float-ness if it's a guard, > but if it's a > > normal expression then it refers to the > int-to-float conversion > > function > > That is the only persuasive argument I've ever > heard, and in > light of the other semantic differences, it would > have been better > to rename the convert-to-float function to > as_float/1. For what it's worth, that's my conclusion too. (Guards and booleans are a bit of a mess anyway, with three somewhat different and/or operations, two sets of guards, and so on. The joy of backwards compatibility, I guess ...) (And when the dust has settled, we still didn't get general guards ... Yes, yes, I know. The language designers like guards just the way they are.) Best, Thomas ____________________________________________________________________________________ Shape Yahoo! in your own image. Join our Network Research Panel today! http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 From alex.arnon@REDACTED Mon Sep 10 14:20:11 2007 From: alex.arnon@REDACTED (Alex Arnon) Date: Mon, 10 Sep 2007 15:20:11 +0300 Subject: [erlang-questions] Message-sending performance In-Reply-To: References: <97F91CA1-E11A-4B2F-B706-C0E8766209EC@ketralnis.com> <46E270E6.90808@di.uminho.pt> Message-ID: <944da41d0709100520u43a97acbr88bf3e2103e5cbb3@mail.gmail.com> What are the numbers on an SMP VM with >2 schedulers? On 9/10/07, David King wrote: > > > The problem here is that you are insisting on receiving messages by > > a given order: {msg, X} with X <- [1..N]. Messages sent become > > interleaved in the mailbox; when you try to remove, say {msg, > > 40000} from the 1st process, there are already 10000s of messages > > in the mailbox from the other process before that one, that must be > > scanned; receive becomes very slow. > > Ah, I can see that, and I can see why, as now it is the messages out > of order, so expecting to be able to receive them in order is silly > > > This is one of the problems one must be keeping an eye on: beware > > the size of the mailbox. In your problem you will see that if you > > replace receive by > > receive {msg, _} -> ok end > > the program will execute extremely fast, as with 1 process. > > Yes, it does, now sending with two processes is just as fast as > sending with one (and when I actually have work to do as I receive > them, it will be faster). And in my use-case, receiving the messages > out-of-order isn't a problem at all. > > Thank you for the advice. > > > > David King wrote: > >> I've noticed that I can send 100,000 messages from one process to > >> another very quickly (less than a second), but if I have two > >> process send 50,000 messages each to a given process, it receives > >> them very slowly (in my test, 36s). I found this using the > >> mapreduce implementation in Joe's book where potentially > >> thousands of processes are spawned and many (potentially very > >> small) messages are sent. > >> I assume that this is because the message queue is locked while > >> sending and receiving messages. Is there any way to work around > >> this so that having multiple processes sending many messages each > >> isn't so slow? In my case I'd like the sender and receiver to be > >> working simultaneously, so having each sender process send one > >> large list isn't quite as efficient > >> Here it is with one process: > >> (nodename@REDACTED)11> message_streamer:stream_messages(100000). > >> Receiving 10000 at 63356401790 > >> Receiving 20000 at 63356401790 > >> Receiving 30000 at 63356401790 > >> Receiving 40000 at 63356401790 > >> Receiving 50000 at 63356401790 > >> Receiving 60000 at 63356401790 > >> Receiving 70000 at 63356401790 > >> Receiving 80000 at 63356401790 > >> Receiving 90000 at 63356401790 > >> Done sending 100000 messages > >> Receiving 100000 at 63356401790 > >> 100000 messages in 1s, 1.00000e+5 msg/s > >> And here it is with two processes: > >> (nodename@REDACTED)9> message_streamer:stream_messages(100000). > >> Receiving 10000 at 63356401639 > >> Receiving 20000 at 63356401643 > >> Receiving 30000 at 63356401650 > >> Receiving 40000 at 63356401660 > >> Receiving 50000 at 63356401673 > >> Done sending 50000 messages > >> Receiving 60000 at 63356401673 > >> Receiving 70000 at 63356401673 > >> Receiving 80000 at 63356401673 > >> Receiving 90000 at 63356401673 > >> Receiving 100000 at 63356401673 > >> Done sending 50000 messages > >> 100000 messages in 36s, 2777.78 msg/s > >> In the multiple-process case, it actually slows down as more > >> messages are sent until one of the processes completes, and then > >> it receives them all very quickly. Here's the code: > >> --- code begins --- > >> -module(message_streamer). > >> -compile(export_all). > >> stream_messages(N) -> > >> Self=self(), > >> Start=myapp_util:now(), > >> List=lists:seq(1,N), > >> Split_List=split_list(List,erlang:system_info(schedulers)), > >> lists:foreach(fun(Sublist) -> > >> spawn_link(fun() -> > >> lists:foreach(fun(Which) -> > >> Self ! {msg,Which} > >> end, > >> Sublist), > >> io:format("Done sending ~p messages~n", > >> [length(Sublist)]) > >> end) > >> end, Split_List), > >> lists:foreach(fun(Which) -> > >> case Which rem (N div 10) of > >> 0 -> > >> io:format("Receiving ~p at ~p ~n", > >> [Which,myapp_util:now()]); > >> _ -> ok > >> end, > >> receive {msg,Which} -> ok end > >> end, > >> List), > >> Time=case myapp_util:now()-Start of > >> 0 -> 1; > >> X -> X > >> end, > >> io:format("~p messages in ~ps, ~p msg/s~n",[N,Time,N/Time]). > >> %% splits a list into equal parts > >> %% split_list([1,2,3,4,5,6],2) -> [[1,2,3],[4,5,6]] > >> split_list(List,Pieces) -> > >> Length=length(List), > >> lists:reverse(split_list(List,Length div Pieces,Length,[])). > >> split_list([], _Per_Piece, 0, Acc) -> > >> Acc; > >> split_list(List, Per_Piece, Length, Acc) when Length>=Per_Piece -> > >> {Short,Long} = lists:split(Per_Piece,List), > >> split_list(Long, Per_Piece, Length-Per_Piece, [ Short | Acc ]); > >> split_list(List, Per_Piece, Length, Acc) when Length > >> {Short,Long} = lists:split(Length, List), > >> split_list(Long, Per_Piece, Length-Length, [ Short | Acc ]). > >> --- code ends --- > >> myapp_util:now() just looks like: > >> now() -> > >> calendar:datetime_to_gregorian_seconds(calendar:universal_time()). > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > -- > > Paulo S?rgio Almeida Email: > > psa@REDACTED > > Dep. Informatica - Universidade do Minho Phone: +351 253 > > 604451 > > Campus de Gualtar - 4710-057 Braga - PORTUGAL Fax : +351 253 > > 604471 > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zac@REDACTED Mon Sep 10 14:58:08 2007 From: zac@REDACTED (Zac Brown) Date: Mon, 10 Sep 2007 08:58:08 -0400 Subject: [erlang-questions] Newbie training project proposal In-Reply-To: References: Message-ID: <46E53F60.8090903@zacbrown.org> Hi Tom: I'd be interested in participating. I have a small amount of Erlang experience, that is I understand the language and the practices, though not necessarily the best way to do things :). Email me off list if you're interested. Zac Tomasz B?achowicz wrote: > Hi all, > > I'm looking for wannabe/newbie erlang developers who'd like to learn > that language in practice. I'm going to create new open source project > from scratch that will aim to implement STOMP messaging protocol [1] > in erlang. I've been considering both client and server side > implementation. > > The STOMP protocol is a quite interesting proposal of simple > text-oriented messaging protocol. While coding we could probably > explore such erlang areas like socket programming, possibly gen_server > framework, Mnesia, ETS, not to mention basic concepts of the language. > I believe STOMP protocol is kind of ideal candidate for that exercise, > bacause it's simple enough (I mean not so complex) and contains some > non-trivial aspects e.g. transactions, full-duplex socket traffic, > etc. > > I personally believe that is could be good opportunity to learn erlang > by coding instead of only by reading books, articles and tutorials, > etc. If you are interested in participation, please contact me > directly. > > References: > [1] http://stomp.codehaus.org/Protocol > > Take care, > Tom > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From lenartlad@REDACTED Mon Sep 10 15:08:51 2007 From: lenartlad@REDACTED (Ladislav Lenart) Date: Mon, 10 Sep 2007 15:08:51 +0200 Subject: [erlang-questions] [Q] Mnesia is overloaded Message-ID: <46E541E3.30000@volny.cz> Hello, we encountered the following mnesia warning report in our system log: Mnesia is overloaded: {dump_log, write_threshold} The log contains several such reports within one second and then nothing for a while. Our setup: * The core is one mnesia table of type disc_copies that contains persistent state of all entities (concurrent processes) in our system (one table row for one entity). * The system consists of 20 such entities. * Each entity is responsible for updating its state in the table whenever it changes. * We use mnesia:dirty_write/2, because we have no dependency among tables and each entity updates its state only. In the worst case, there is 20 processes that want to write to the table but each to a different row. Our questions: * What precisely does the report mean? * Can we do something about it? * We plan to scale from units to thousands of entities. Will this be a problem? If so, how can we overcome it? If not, why not? Thanks in advance, Ladislav Lenart From lestat@REDACTED Mon Sep 10 15:08:59 2007 From: lestat@REDACTED (lestat) Date: Mon, 10 Sep 2007 15:08:59 +0200 Subject: [erlang-questions] RefactorErl released Message-ID: <288BB31F-6ECC-41C6-BDE3-0834FC81CA99@elte.hu> Hi! Our research team has released RefactorErl (a refactoring system for Erlang) under EPL with seven working refactorings. It is available from the projects site: http://plc.inf.elte.hu/erlang/ An installer package for Windows, and a source package for Linux, Windows and Mac OS X are available for download. Questions, suggestions, bug reports, or feature requests are welcome at erlang@REDACTED Regards, Tamas Nagy and the Team From qrilka@REDACTED Mon Sep 10 15:19:03 2007 From: qrilka@REDACTED (Kirill Zaborski) Date: Mon, 10 Sep 2007 13:19:03 +0000 Subject: [erlang-questions] RefactorErl released In-Reply-To: <288BB31F-6ECC-41C6-BDE3-0834FC81CA99@elte.hu> References: <288BB31F-6ECC-41C6-BDE3-0834FC81CA99@elte.hu> Message-ID: <337538cb0709100619u21227387jc24de3f2651920ab@mail.gmail.com> I wonder - why does it require MySQL? Best regards, Kirill. On 9/10/07, lestat wrote: Hi! > > Our research team has released RefactorErl (a refactoring system for > Erlang) under EPL with seven working refactorings. > > It is available from the projects site: http://plc.inf.elte.hu/erlang/ > > An installer package for Windows, and a source package for Linux, > Windows and Mac OS X are available for download. > > Questions, suggestions, bug reports, or feature requests are welcome > at erlang@REDACTED > > Regards, > Tamas Nagy and the Team > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From rsaccon@REDACTED Mon Sep 10 15:20:40 2007 From: rsaccon@REDACTED (Roberto Saccon) Date: Mon, 10 Sep 2007 10:20:40 -0300 Subject: [erlang-questions] [Q] Mnesia is overloaded In-Reply-To: <46E541E3.30000@volny.cz> References: <46E541E3.30000@volny.cz> Message-ID: on my development laptop I see this each time the laptop "wakes up". Anyway this was very recently discussed on this list, including suggestions how to deal with it, hope that helps Roberto On 9/10/07, Ladislav Lenart wrote: > Hello, > > we encountered the following mnesia warning report in our system log: > > Mnesia is overloaded: {dump_log, write_threshold} > > The log contains several such reports within one second and then > nothing for a while. > > Our setup: > * The core is one mnesia table of type disc_copies that contains > persistent state of all entities (concurrent processes) in our > system (one table row for one entity). > * The system consists of 20 such entities. > * Each entity is responsible for updating its state in the table > whenever it changes. > * We use mnesia:dirty_write/2, because we have no dependency > among tables and each entity updates its state only. > > In the worst case, there is 20 processes that want to write to the > table but each to a different row. > > Our questions: > * What precisely does the report mean? > * Can we do something about it? > * We plan to scale from units to thousands of entities. Will this > be a problem? If so, how can we overcome it? If not, why not? > > Thanks in advance, > > Ladislav Lenart > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Roberto Saccon http://rsaccon.com From lestat@REDACTED Mon Sep 10 15:58:06 2007 From: lestat@REDACTED (lestat) Date: Mon, 10 Sep 2007 15:58:06 +0200 Subject: [erlang-questions] RefactorErl released In-Reply-To: <337538cb0709100619u21227387jc24de3f2651920ab@mail.gmail.com> References: <288BB31F-6ECC-41C6-BDE3-0834FC81CA99@elte.hu> <337538cb0709100619u21227387jc24de3f2651920ab@mail.gmail.com> Message-ID: <0BB33E9A-BE67-4B0B-A993-A2998640C4BB@elte.hu> Hi! The main idea behind the system is that we store the AST and the statical semantical information(like visibility, scope) - required by the refactorings - in the database. The refactorings work directly on the database keeping it's consistency. This way you do not have to reparse the code after every refactoring. As another option this way you can easily create a batch of refactorings and check out the files just after the last one. Regards, Tamas Nagy On Sep 10, 2007, at 3:19 PM, Kirill Zaborski wrote: > I wonder - why does it require MySQL? > > Best regards, > Kirill. > > On 9/10/07, lestat wrote: > Hi! >> >> Our research team has released RefactorErl (a refactoring system for >> Erlang) under EPL with seven working refactorings. >> >> It is available from the projects site: http://plc.inf.elte.hu/ >> erlang/ >> >> An installer package for Windows, and a source package for Linux, >> Windows and Mac OS X are available for download. >> >> Questions, suggestions, bug reports, or feature requests are welcome >> at erlang@REDACTED >> >> Regards, >> Tamas Nagy and the Team >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> From vladdu55@REDACTED Mon Sep 10 16:05:06 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 10 Sep 2007 16:05:06 +0200 Subject: [erlang-questions] RefactorErl released In-Reply-To: <288BB31F-6ECC-41C6-BDE3-0834FC81CA99@elte.hu> References: <288BB31F-6ECC-41C6-BDE3-0834FC81CA99@elte.hu> Message-ID: <95be1d3b0709100705t6909fc4ag36b1a4eec6e60053@mail.gmail.com> Hi, On 9/10/07, lestat wrote: > > Our research team has released RefactorErl (a refactoring system for > Erlang) under EPL with seven working refactorings. Cool! I haven't had the time to check the code, but do the refactorings work across modules too? Of course, only modules loaded into the database could be affected. Also, how can I work with several databases (for example if having several projects)? I also second Kirill's question: why mysql and not mnesia? best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From qrilka@REDACTED Mon Sep 10 16:05:54 2007 From: qrilka@REDACTED (Kirill Zaborski) Date: Mon, 10 Sep 2007 14:05:54 +0000 Subject: [erlang-questions] RefactorErl released In-Reply-To: <0BB33E9A-BE67-4B0B-A993-A2998640C4BB@elte.hu> References: <288BB31F-6ECC-41C6-BDE3-0834FC81CA99@elte.hu> <337538cb0709100619u21227387jc24de3f2651920ab@mail.gmail.com> <0BB33E9A-BE67-4B0B-A993-A2998640C4BB@elte.hu> Message-ID: <337538cb0709100705r31b32997h4dcf49a4902ca51@mail.gmail.com> So the question arises: Why do we need separate RDBMS installed when we have Mnesia in OTP distribution? And if the tool is implemented in Erlang (at the moment I can't access your website I receive connection timeout error) it is twice as strange. Best regards Kirill. On 9/10/07, lestat wrote: Hi! > > The main idea behind the system is that we store the AST and the > statical semantical information(like visibility, scope) - required by > the refactorings - in the database. > The refactorings work directly on the database keeping it's consistency. > This way you do not have to reparse the code after every refactoring. > As another option this way you can easily create a batch of > refactorings and check out the files just after the last one. > > Regards, > Tamas Nagy > > On Sep 10, 2007, at 3:19 PM, Kirill Zaborski wrote: > > > I wonder - why does it require MySQL? > > > > Best regards, > > Kirill. > > > > On 9/10/07, lestat wrote: > > Hi! > >> > >> Our research team has released RefactorErl (a refactoring system for > >> Erlang) under EPL with seven working refactorings. > >> > >> It is available from the projects site: http://plc.inf.elte.hu/ > >> erlang/ > >> > >> An installer package for Windows, and a source package for Linux, > >> Windows and Mac OS X are available for download. > >> > >> Questions, suggestions, bug reports, or feature requests are welcome > >> at erlang@REDACTED > >> > >> Regards, > >> Tamas Nagy and the Team > >> > >> > >> > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://www.erlang.org/mailman/listinfo/erlang-questions > >> > > From kenneth.lundin@REDACTED Mon Sep 10 17:44:31 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Mon, 10 Sep 2007 17:44:31 +0200 Subject: [erlang-questions] RefactorErl released In-Reply-To: <337538cb0709100705r31b32997h4dcf49a4902ca51@mail.gmail.com> References: <288BB31F-6ECC-41C6-BDE3-0834FC81CA99@elte.hu> <337538cb0709100619u21227387jc24de3f2651920ab@mail.gmail.com> <0BB33E9A-BE67-4B0B-A993-A2998640C4BB@elte.hu> <337538cb0709100705r31b32997h4dcf49a4902ca51@mail.gmail.com> Message-ID: I agree with Kirill that the dependency to MySQL is a major obstacle for making your tool popular, at least that's what I think. It should be possible to implement to complete tool including data-base in pure Erlang and thus making it much more portable etc. /Kenneth On 9/10/07, Kirill Zaborski wrote: > So the question arises: > Why do we need separate RDBMS installed when we have Mnesia in OTP > distribution? And if the tool is implemented in Erlang (at the moment > I can't access your website I receive connection timeout error) it is > twice as strange. > > Best regards > Kirill. > > On 9/10/07, lestat wrote: > Hi! > > > > The main idea behind the system is that we store the AST and the > > statical semantical information(like visibility, scope) - required by > > the refactorings - in the database. > > The refactorings work directly on the database keeping it's consistency. > > This way you do not have to reparse the code after every refactoring. > > As another option this way you can easily create a batch of > > refactorings and check out the files just after the last one. > > > > Regards, > > Tamas Nagy > > > > On Sep 10, 2007, at 3:19 PM, Kirill Zaborski wrote: > > > > > I wonder - why does it require MySQL? > > > > > > Best regards, > > > Kirill. > > > > > > On 9/10/07, lestat wrote: > > > Hi! > > >> > > >> Our research team has released RefactorErl (a refactoring system for > > >> Erlang) under EPL with seven working refactorings. > > >> > > >> It is available from the projects site: http://plc.inf.elte.hu/ > > >> erlang/ > > >> > > >> An installer package for Windows, and a source package for Linux, > > >> Windows and Mac OS X are available for download. > > >> > > >> Questions, suggestions, bug reports, or feature requests are welcome > > >> at erlang@REDACTED > > >> > > >> Regards, > > >> Tamas Nagy and the Team > > >> > > >> > > >> > > >> _______________________________________________ > > >> erlang-questions mailing list > > >> erlang-questions@REDACTED > > >> http://www.erlang.org/mailman/listinfo/erlang-questions > > >> > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From ulf@REDACTED Mon Sep 10 18:15:28 2007 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 10 Sep 2007 18:15:28 +0200 Subject: [erlang-questions] RefactorErl released In-Reply-To: <337538cb0709100705r31b32997h4dcf49a4902ca51@mail.gmail.com> References: <288BB31F-6ECC-41C6-BDE3-0834FC81CA99@elte.hu> <337538cb0709100619u21227387jc24de3f2651920ab@mail.gmail.com> <0BB33E9A-BE67-4B0B-A993-A2998640C4BB@elte.hu> <337538cb0709100705r31b32997h4dcf49a4902ca51@mail.gmail.com> Message-ID: <8209f740709100915x68866c52o12e8874e701f2ad3@mail.gmail.com> Granted, there are a handful of SQL queries that to complex relational joins, but QLC handles such things quite elegantly, and even though joins in QLC have not yet been optimized, I'm not at all sure that it would be visibly slower than MySql here. It looks as one of those decisions made early: since we're going to do relational joins, we need a relational database; Mnesia isn't a relational database. Practially all of the 415 lines of code in refactor_db would simply go away if mnesia were used. I agree that it would be a good thing to port the database handling to mnesia. It shouldn't take too long. BR, Ulf W 2007/9/10, Kirill Zaborski : > So the question arises: > Why do we need separate RDBMS installed when we have Mnesia in OTP > distribution? And if the tool is implemented in Erlang (at the moment > I can't access your website I receive connection timeout error) it is > twice as strange. > > Best regards > Kirill. > > On 9/10/07, lestat wrote: > Hi! > > > > The main idea behind the system is that we store the AST and the > > statical semantical information(like visibility, scope) - required by > > the refactorings - in the database. > > The refactorings work directly on the database keeping it's consistency. > > This way you do not have to reparse the code after every refactoring. > > As another option this way you can easily create a batch of > > refactorings and check out the files just after the last one. > > > > Regards, > > Tamas Nagy > > > > On Sep 10, 2007, at 3:19 PM, Kirill Zaborski wrote: > > > > > I wonder - why does it require MySQL? > > > > > > Best regards, > > > Kirill. > > > > > > On 9/10/07, lestat wrote: > > > Hi! > > >> > > >> Our research team has released RefactorErl (a refactoring system for > > >> Erlang) under EPL with seven working refactorings. > > >> > > >> It is available from the projects site: http://plc.inf.elte.hu/ > > >> erlang/ > > >> > > >> An installer package for Windows, and a source package for Linux, > > >> Windows and Mac OS X are available for download. > > >> > > >> Questions, suggestions, bug reports, or feature requests are welcome > > >> at erlang@REDACTED > > >> > > >> Regards, > > >> Tamas Nagy and the Team > > >> > > >> > > >> > > >> _______________________________________________ > > >> 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 als@REDACTED Mon Sep 10 19:13:28 2007 From: als@REDACTED (Anthony Shipman) Date: Tue, 11 Sep 2007 03:13:28 +1000 Subject: [erlang-questions] terminating a gen_server Message-ID: <200709110313.28109.als@iinet.net.au> I've found that I can do exit(Pid, shutdown) where Pid is a gen_server and it will nicely shut down, calling Mod:terminate. I can't see how this works. The server is not trapping exit signals so I would expect it to just exit without calling Mod:terminate. The code in gen_server:loop seems to be deliberately written to support this behaviour. Can we rely on it? -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From g.vishnu@REDACTED Mon Sep 10 20:44:38 2007 From: g.vishnu@REDACTED (Vishnu Gopal) Date: Tue, 11 Sep 2007 00:14:38 +0530 Subject: [erlang-questions] Emacs: Debugger buffer not showing program output In-Reply-To: References: Message-ID: For people stumbling on this, the distel trunk seems to be broken. Try it with: svn co -r {2007-07-01} http://distel.googlecode.com/svn/trunk/ distel Thanks a bunch to Bill Clementson for helping and to Vladmir Piskarev for coming up with the solution. Regards, Vish On 9/2/07, Vishnu Gopal wrote: > Hi! > > I'm trying to learn both Emacs and erlang (newbie to both so please be > gentle). I installed Distel fine and managed to connect to an erlang > node. Was trying out debugging when I noticed something odd. > > I start a debug session with C-c C-d i and set a breakpoint C-x SPC. > And when I run the function in the shell, the debug process list > window pops up. I type return on the correct process and a debugger > buffer pops up. As far as I understand it to work, it should show the > program in a read-only buffer: with the state of execution & > breakpoints, and with variables at the bottom of the window. However I > get a blank buffer: all the commands (n, SPC, q, h, etc.) seem to work > fine though. I'm not sure if it's because I misunderstood how it's > supposed to work, so here's a screenshot: > > http://vish.in/temp/emacs-debug.png > > Shouldn't it look something like this: > http://bc.tech.coop/blog/images/distel2.jpg ? > > (I'm using Aquamacs btw, not sure if that makes a difference). > > It'd be great if somebody could help. > > Thanks, > Vish > From fig@REDACTED Mon Sep 10 21:19:52 2007 From: fig@REDACTED (Michael FIG) Date: Mon, 10 Sep 2007 13:19:52 -0600 (CST) Subject: [erlang-questions] erl_interface shared libraries In-Reply-To: Message-ID: <15109376.6731189451992574.JavaMail.root@zimbra> I'd be interested in helping with this work, too. The Smalltalk I'm using is idst by Ian Piumarta. You can see it at http://piumarta.com/pepsi/ or on the FONC mailing list, http://vpri.org/mailman/listinfo/fonc -- Michael FIG , PMP MarkeTel Multi-Line Dialing Systems, Ltd. Phone: (306) 359-6893 ext. 528 From klacke@REDACTED Mon Sep 10 21:33:17 2007 From: klacke@REDACTED (Claes Wikstrom) Date: Mon, 10 Sep 2007 21:33:17 +0200 Subject: [erlang-questions] Yaws, ErlyWeb and Windows. In-Reply-To: <3A76756EED583B43A4AD704E29CCD079741252@mail.smartlogic.com> References: <3A76756EED583B43A4AD704E29CCD079741252@mail.smartlogic.com> Message-ID: <46E59BFD.3050808@hyber.org> Bob Cowdery wrote: > Hi All > > Can someone give me the picture on Yaws and ErlyWeb under Windows please I'm sorry about that - to my knowledge there is quite a lot of people running yaws under windows. I don't run windows at all any longer - and I'll just have to leave it up to the yaws/windows community to write e.g. a proper wiki entry on how to do it. I know for sure that it atleast used to work - I made sure it worked once, but it might have gone bad. /klacke From lestat@REDACTED Mon Sep 10 22:17:43 2007 From: lestat@REDACTED (Tamas Nagy) Date: Mon, 10 Sep 2007 22:17:43 +0200 Subject: [erlang-questions] RefactorErl released In-Reply-To: <95be1d3b0709100705t6909fc4ag36b1a4eec6e60053@mail.gmail.com> References: <288BB31F-6ECC-41C6-BDE3-0834FC81CA99@elte.hu> <95be1d3b0709100705t6909fc4ag36b1a4eec6e60053@mail.gmail.com> Message-ID: <3F787862-E91F-4F4B-8D40-4A4C7FBD13A5@elte.hu> On Sep 10, 2007, at 4:05 PM, Vlad Dumitrescu wrote: > Hi, > > On 9/10/07, lestat wrote: > Our research team has released RefactorErl (a refactoring system for > Erlang) under EPL with seven working refactorings. > > Cool! > > I haven't had the time to check the code, but do the refactorings > work across modules too? Of course, only modules loaded into the > database could be affected. Yes, it works across modules. > > Also, how can I work with several databases (for example if having > several projects)? I think that's a feature request, and a good one. :) > > I also second Kirill's question: why mysql and not mnesia? When we designed the whole system we thought that we will use complex queries, which are hard to express in mnesia qlc-s. In the end this idea proved to be wrong. The truth is the mysql connection right now is the bottleneck of the system. The new version we are currently working on will use mnesia and the structure of the system will be different. It will be able to support - if all goes well - code with any kind of macros even non parseable ones, and will be able to preserve the original indentation of it. Our current release is just the prototype of the system where we tried our ideas out. But we still thought that it is mature enough to release it and have some people try it out to get some feedback. A few members will be at the Erlang Workshop. The talk will be about the tuple to record refactoring, but I'm sure they will be more than happy to answer your questions about the whole system. Best regards, Tamas Nagy > > best regards, > Vlad > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lestat@REDACTED Mon Sep 10 22:36:00 2007 From: lestat@REDACTED (Tamas Nagy) Date: Mon, 10 Sep 2007 22:36:00 +0200 Subject: [erlang-questions] RefactorErl released In-Reply-To: <3F787862-E91F-4F4B-8D40-4A4C7FBD13A5@elte.hu> References: <288BB31F-6ECC-41C6-BDE3-0834FC81CA99@elte.hu> <95be1d3b0709100705t6909fc4ag36b1a4eec6e60053@mail.gmail.com> <3F787862-E91F-4F4B-8D40-4A4C7FBD13A5@elte.hu> Message-ID: On Sep 10, 2007, at 10:17 PM, Tamas Nagy wrote: > > On Sep 10, 2007, at 4:05 PM, Vlad Dumitrescu wrote: > >> Hi, >> >> On 9/10/07, lestat wrote: >> Our research team has released RefactorErl (a refactoring system for >> Erlang) under EPL with seven working refactorings. >> >> Cool! >> >> I haven't had the time to check the code, but do the refactorings >> work across modules too? Of course, only modules loaded into the >> database could be affected. > Yes, it works across modules. >> >> Also, how can I work with several databases (for example if having >> several projects)? > I think that's a feature request, and a good one. :) >> >> I also second Kirill's question: why mysql and not mnesia? > When we designed the whole system we thought that we will use > complex queries, which are hard to express in mnesia qlc-s. > In the end this idea proved to be wrong. The truth is the mysql > connection right now is the bottleneck of the system. > > The new version we are currently working on will use mnesia and the > structure of the system will be different. > It will be able to support - if all goes well - code with any kind > of macros even non parseable ones, and will be able to preserve the > original indentation of it. > > Our current release is just the prototype of the system where we > tried our ideas out. > But we still thought that it is mature enough to release it and > have some people try it out to get some feedback. > > A few members will be at the Erlang Workshop. The talk will be > about the tuple to record refactoring, but I'm sure they will be > more than happy to answer your questions about the whole system. > I mean if you would like to ask some questions in person. I'm here to answer all your questions. Best regards, Tamas Nagy > Best regards, > Tamas Nagy >> >> best regards, >> Vlad >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From peter@REDACTED Mon Sep 10 18:54:49 2007 From: peter@REDACTED (Peter K Chan) Date: Mon, 10 Sep 2007 18:54:49 +0200 Subject: [erlang-questions] What is wrong with this list? In-Reply-To: <3dbc6d1c0709091725i789b4e53o43eec45130fb9376@mail.gmail.com> Message-ID: Good point. I just ran some examples myself and I see that it may be fundamentally difficult to give straightforward error message in a language that does assignment as side effect of matching. I think the dichotomy stamps from the fact that the compiler wants to bind values as part of pattern matching, where as the programmer, coming from another mainstream programming language, thinks of the statement as assignment-oriented, with the possibility of failing a pattern match. I don't know of a good way to give more intelligent error message, especially in the current highly-compacted error message format (i.e. {{badmatch, error, ...}}). To give a good explanation, the compiler will probably have to give out a full paragraph of text, explaining which part of the match failed and what variable cannot be assigned. Peter ________________________________________ From: Robert Virding [mailto:rvirding@REDACTED] Sent: Sunday, September 09, 2007 7:25 PM To: Peter K Chan Cc: Dustin Sallings; erlang-questions@REDACTED Subject: Re: [erlang-questions] What is wrong with this list? I think the problem is to realise that there is NO difference between assignment and matching. In fact there is no assignment, only matching. Therefore having different errors for them is plain wrong. Also how would you handle the case of say: {X,Y} = some_call(...) where both X and Y are unbound? In one respect it is an assignment to multiple values, but it is also definitely a match pulling apart a value. Even if you were to say that if there were unbound variables then it is an assignment you would still get into problems with code like: {ok,X} = ... or if you had patterns with some variables bound and some unbound. Sorry if this answer seems a little harsh, but I wouldn't want to introduce a concept which doesn't exist into an error message. Robert On 05/09/07, Peter K Chan wrote: Dustin, As someone who has known Erlang for a while, the error message would probably not be helpful (if even possible). But as a newbie, knowing the difference between an assignment and a match can be very helpful. Actually, if the bad match comes from some deep recursion, I think I would appreciate seeing the actual value, even if I know what badmatches in general are. I do agree that the current error message gives out enough information for debugging purpose, but having seen, more than once, where someone is confused about the matching vs. assignment, I think the more explicit error message would be "nice" to have. Peter From: Dustin Sallings [mailto:dustin@REDACTED] Sent: Tuesday, September 04, 2007 4:47 PM To: Peter K Chan Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] What is wrong with this list? On Sep 4, 2007, at 13:29 , Peter K Chan wrote: I think it would be nice if the compiler can output why a match fails (e.g. {number, 1} does not equal {atom, java}). ????????This could work as an error string along with the badmatch for the single case discussed, but what about a case (that is contrived, but probably similar to real code I've written somewhere) like this: ????????Pid = some_function(), ????????Pid = other_function(). ????????The error message wouldn't be all that useful to you either way because on the first line you're capturing a value into a variable, and on the second line you're validating the same Pid is returned. If it showed you the value, it'd probably be meaningless to you. It would basically be showing you two different values and saying they're not the same. ????????You have the same issue in a case, receive, function definition, etc... for which you have no matching case. You don't want to list every possible pattern. -- Dustin Sallings _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From Bob.Cowdery@REDACTED Mon Sep 10 23:20:13 2007 From: Bob.Cowdery@REDACTED (Bob Cowdery) Date: Mon, 10 Sep 2007 22:20:13 +0100 Subject: [erlang-questions] Yaws, ErlyWeb and Windows. Message-ID: <3A76756EED583B43A4AD704E29CCD079741256@mail.smartlogic.com> Hi Jan Thanks for the response. I'm probably being really thick here but I don't have that much experience with the way these extensions are added to erlang. I didn't really understand much of what you said. The first reply you sent some files, unfortunately yaws.app was blocked. Your first email suggested it should just run so I copied yaws from the repository (which was pre-built) into lib, but how do I start yaws? I'm about to start on a management console for my project and yaws/erlyweb/mnesia is a preferable approach but I also have a good set of Java API's to my erlang core and Java/Spring/MySQL is another approach. I don't know how much pain I will have to go through to get yaws etc working and build up enough knowledge to use it effectively. The fact that there was little response does worry me. The project needs to run on Windows, Linux and OSX but I develop on Windows because that's where I am most of the time. Sorry to ramble on, just thinking aloud. I'm sure it does work (in fact it does because the repository version runs in the special erl runtime) but right now I see a few individuals that have managed to get things working in their very individual ways. It would be 'nice' to have one official way that is properly explained and works. If you could explain in a little more detail what each step does and how to perform it, it would be greatly appreciated. Thanks Bob -----Original Message----- From: Jan Jacobs [mailto:hpjcon@REDACTED] Sent: 09 September 2007 21:30 To: Bob Cowdery Subject: Re: [erlang-questions] Yaws, ErlyWeb and Windows. Hi Bob I have been using YAWS on the Windows platfrom for all my projects and applications and it works well. Here is a short list of steps to get yaws to comiple on a Windows box: Compiling YAWS for Win32 ------------------------------ 1 Copy yaws-X.XX into lib directory of Erlang 2 Create the following files using the templates in the src direcory of YAWS - yaws_vsn.erl - yaws_generated.erl 3 Create the mime_types.erl file from mime_type_c.erl - Create a file charset.def in the src directory of YAWS - Compile mime_type_c.erl - Use the compiled mime_type_c:compile(). to generage mime_types.erl 4 Create yaws.app file 5 Create an Emakefile I hope this helps. Cheers Jan Jacobs www.econsys.co.za ----- Original Message ----- From: "Bob Cowdery" To: "Erlang-Questions (E-mail)" Sent: Sunday, September 09, 2007 8:00 PM Subject: [erlang-questions] Yaws, ErlyWeb and Windows. > > Hi All > > Can someone give me the picture on Yaws and ErlyWeb under Windows please. > Firstly I've failed pretty dismally to get Yaws working on Windows. I > compiled and run it on Linux no problem. I found some info on building > under cygwin and also some batch files to compile natively but both fail > me right now. I did download the erlang repository (Erlang-Projects.Org) > and that runs up Yaws fine but it seems to use some tricks to do it and I > can't see how to just copy the Yaws directory and use it with my existing > erlang system. > > If you have successfully got Yaws working what route did you use - I'd > rather not run it under cygwin because nothing else in my erlang systems > need to and I don't see why Yaws should be diferent. > > I've also read some posts that suggest ErlyWeb does not work under > Windows. Does anyone know of any issues? > > Thanks for any help. > > Bob > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > -- > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.5.485 / Virus Database: 269.13.10/995 - Release Date: > 2007/09/08 01:24 PM > > From g.vishnu@REDACTED Mon Sep 10 23:45:36 2007 From: g.vishnu@REDACTED (Vishnu Gopal) Date: Tue, 11 Sep 2007 03:15:36 +0530 Subject: [erlang-questions] Emacs: Debugger buffer not showing program output In-Reply-To: References: Message-ID: Sorry, perhaps I wasn't clear. The solution IS to check out an older version of the code since the trunk is broken. i.e. the trunk exhibits the symptoms above, the revision on july 1 doesn't. I don't know why this is tho :-) [kind of unrelated, but by not reply-munging, this thread is probably losing lots of valuable conversation since the majority of people hit reply instead of reply-all]. Vish On 9/11/07, Bill Clementson wrote: > Hi Vishnu, > > "Vishnu Gopal" writes: > > > For people stumbling on this, the distel trunk seems to be broken. > > > > Try it with: > > > > svn co -r {2007-07-01} http://distel.googlecode.com/svn/trunk/ distel > > Works for me - maybe the server was down when you tried? > > > Thanks a bunch to Bill Clementson for helping and to Vladmir Piskarev > > for coming up with the solution. > > I didn't see any replies from Vladmir Piskarev on the thread. Could > you please post here what his solution was? > > Thanks, > Bill > > > Regards, > > Vish > > > > On 9/2/07, Vishnu Gopal wrote: > >> Hi! > >> > >> I'm trying to learn both Emacs and erlang (newbie to both so please be > >> gentle). I installed Distel fine and managed to connect to an erlang > >> node. Was trying out debugging when I noticed something odd. > >> > >> I start a debug session with C-c C-d i and set a breakpoint C-x SPC. > >> And when I run the function in the shell, the debug process list > >> window pops up. I type return on the correct process and a debugger > >> buffer pops up. As far as I understand it to work, it should show the > >> program in a read-only buffer: with the state of execution & > >> breakpoints, and with variables at the bottom of the window. However I > >> get a blank buffer: all the commands (n, SPC, q, h, etc.) seem to work > >> fine though. I'm not sure if it's because I misunderstood how it's > >> supposed to work, so here's a screenshot: > >> > >> http://vish.in/temp/emacs-debug.png > >> > >> Shouldn't it look something like this: > >> http://bc.tech.coop/blog/images/distel2.jpg ? > >> > >> (I'm using Aquamacs btw, not sure if that makes a difference). > >> > >> It'd be great if somebody could help. > >> > >> Thanks, > >> Vish > >> > From sean.hinde@REDACTED Tue Sep 11 00:14:20 2007 From: sean.hinde@REDACTED (Sean Hinde) Date: Mon, 10 Sep 2007 23:14:20 +0100 Subject: [erlang-questions] Emacs: Debugger buffer not showing program output In-Reply-To: References: Message-ID: On 10 Sep 2007, at 22:45, Vishnu Gopal wrote: > > [kind of unrelated, but by not reply-munging, this thread is probably > losing lots of valuable conversation since the majority of people hit > reply instead of reply-all]. Think of it as part of the Erlang learning curve. Learning how to operate the mailing list is just as much a part of the process as learning to use distel ;-) Sean From g.vishnu@REDACTED Tue Sep 11 00:23:29 2007 From: g.vishnu@REDACTED (Vishnu Gopal) Date: Tue, 11 Sep 2007 03:53:29 +0530 Subject: [erlang-questions] Emacs: Debugger buffer not showing program output In-Reply-To: References: Message-ID: On 9/11/07, Sean Hinde wrote: > > On 10 Sep 2007, at 22:45, Vishnu Gopal wrote: > > > > [kind of unrelated, but by not reply-munging, this thread is probably > > losing lots of valuable conversation since the majority of people hit > > reply instead of reply-all]. > > Think of it as part of the Erlang learning curve. Learning how to > operate the mailing list is just as much a part of the process as > learning to use distel ;-) > :-) It's not the norm afaik (I know it is the 'correct' way - there was an earlier thread). I'm subscribed to around a dozen lists, and every one of them does munging. Google/Yahoo groups does it by default. It's interesting to wonder why. [Perhaps because replying to the list is the norm, replying to a person is the exception?] Vish > Sean > > From dmercer@REDACTED Mon Sep 10 22:18:57 2007 From: dmercer@REDACTED (David Mercer) Date: Mon, 10 Sep 2007 15:18:57 -0500 Subject: [erlang-questions] Yaws, ErlyWeb and Windows. In-Reply-To: <46E59BFD.3050808@hyber.org> References: <3A76756EED583B43A4AD704E29CCD079741252@mail.smartlogic.com> <46E59BFD.3050808@hyber.org> Message-ID: <006701c7f3e7$d1e99690$891ea8c0@SSI.CORP> My post ain't gonna be much help other than to let you know Windows Yaws is not a mirage: I got it working a few months ago with minimal problems. I cannot say exactly how I did it, but I would guess I just installed it from CEAN, because my mind has no recollection that there was any trick to it. Cheers, DBM -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Claes Wikstrom Sent: Monday, September 10, 2007 14:33 To: Bob Cowdery Cc: Erlang-Questions (E-mail) Subject: Re: [erlang-questions] Yaws, ErlyWeb and Windows. Bob Cowdery wrote: > Hi All > > Can someone give me the picture on Yaws and ErlyWeb under Windows please I'm sorry about that - to my knowledge there is quite a lot of people running yaws under windows. I don't run windows at all any longer - and I'll just have to leave it up to the yaws/windows community to write e.g. a proper wiki entry on how to do it. I know for sure that it atleast used to work - I made sure it worked once, but it might have gone bad. /klacke _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From chandrashekhar.mullaparthi@REDACTED Tue Sep 11 01:32:47 2007 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Tue, 11 Sep 2007 00:32:47 +0100 Subject: [erlang-questions] terminating a gen_server In-Reply-To: <200709110313.28109.als@iinet.net.au> References: <200709110313.28109.als@iinet.net.au> Message-ID: On 10/09/2007, Anthony Shipman wrote: > I've found that I can do exit(Pid, shutdown) where Pid is a gen_server and it > will nicely shut down, calling Mod:terminate. > > I can't see how this works. The server is not trapping exit signals so I would > expect it to just exit without calling Mod:terminate. > > The code in gen_server:loop seems to be deliberately written to support this > behaviour. Can we rely on it? > This should not be possible. Can you post your code? If not, what version of erlang are you using? The Mod:terminate function should only be called if the gen_server is trapping exits. According to the gen_server documentation; Note that a gen_server does not trap exit signals automatically, this must be explicitly initiated in the callback module. ... If the gen_server is part of a supervision tree and is ordered by its supervisor to terminate, this function will be called with Reason=shutdown if the following conditions apply: * the gen_server has been set to trap exit signals, and * the shutdown strategy as defined in the supervisor's child specification is an integer timeout value, not brutal_kill. I've tested this with R11B-1 and it does what it says on the tin. cheers Chandru From fig@REDACTED Tue Sep 11 02:07:26 2007 From: fig@REDACTED (Michael FIG) Date: Mon, 10 Sep 2007 18:07:26 -0600 (CST) Subject: [erlang-questions] bad links in OTP Design Principles html doc Message-ID: <29292211.7081189469246463.JavaMail.root@zimbra> I sent this a couple of times to webmaster@REDACTED, but they haven't corrected it yet. Could somebody please correct the links in the table of contents for OTP Design Principles? In: http://www.erlang.org/doc/design_principles/part_frame.html the entire chapter on the Gen_server behaviour incorrectly links to doc/man/gen_server.html instead of doc/design_principles/gen_server.html This can be quite confusing, and naive readers would not have the benefit of the excellent examples and high-level overview of gen_server. Please fix this soon. If I don't hear anything back in the next few days, I'll try investigating the document source and writing a patch for the incorrect table of contents. Thanks, -- Michael FIG , PMP MarkeTel Multi-Line Dialing Systems, Ltd. Phone: (306) 359-6893 ext. 528 From tblachowicz@REDACTED Tue Sep 11 02:18:33 2007 From: tblachowicz@REDACTED (=?ISO-8859-2?Q?Tomasz_B=B3achowicz?=) Date: Tue, 11 Sep 2007 01:18:33 +0100 Subject: [erlang-questions] Newbie training project proposal In-Reply-To: References: Message-ID: Hello, I've just created discussion group and the site for the project. Feel free to visit erlstomp project :) http://groups.google.com/group/erlstomp http://code.google.com/p/erlstomp Regards, Tom On 9/10/07, Tomasz B?achowicz wrote: > Hi all, > > I'm looking for wannabe/newbie erlang developers who'd like to learn > that language in practice. I'm going to create new open source project > from scratch that will aim to implement STOMP messaging protocol [1] > in erlang. I've been considering both client and server side > implementation. > > The STOMP protocol is a quite interesting proposal of simple > text-oriented messaging protocol. While coding we could probably > explore such erlang areas like socket programming, possibly gen_server > framework, Mnesia, ETS, not to mention basic concepts of the language. > I believe STOMP protocol is kind of ideal candidate for that exercise, > bacause it's simple enough (I mean not so complex) and contains some > non-trivial aspects e.g. transactions, full-duplex socket traffic, > etc. > > I personally believe that is could be good opportunity to learn erlang > by coding instead of only by reading books, articles and tutorials, > etc. If you are interested in participation, please contact me > directly. > > References: > [1] http://stomp.codehaus.org/Protocol > > Take care, > Tom > From saleyn@REDACTED Tue Sep 11 04:49:22 2007 From: saleyn@REDACTED (Serge Aleynikov) Date: Mon, 10 Sep 2007 21:49:22 -0500 Subject: [erlang-questions] now/0 resolution In-Reply-To: <20070910112642.GB27329@erix.ericsson.se> References: <46E142C6.9010804@gmail.com> <20070910112642.GB27329@erix.ericsson.se> Message-ID: <46E60232.6020708@gmail.com> Raimo Niskanen wrote: > On Fri, Sep 07, 2007 at 07:23:34AM -0500, Serge Aleynikov wrote: >> Since according to documentation consecutive executions of now/0 will >> return different values (with microsecond precision) I have two questions: >> >> 1. Does it mean that inserting now/0 calls in code will slow down >> execution to 1mks per execution? If not, then performance of function >> call measured using now/0 time stamping would be inaccurate. >> > > Well, no on both alternatives. The return value from now/0 is bumped > with 1 us for every call to always return an incrementing value. But > it is hardly a problem - it will not be noticabely inaccurate. > > To make now/0 off by more than 1 us you will have to call it so often, > more than once per us, that it becomes impractical. I need to measure the time it takes for a UDP packet to get delivered to the application space from the point it's received by the kernel (using SO_TIMESTAMP socket option) as accurately as possible (~ 1 us resolution). > To time a function call you also can use call trace with > timestamps. Then on some platforms (Solaris (and Linux?)) > you have the option to count CPU time instead. So far I've been using successive now/0 calls in selected parts of function to measure execution times. Doesn't the call trace slow down execution? > The high resolution timer is actually used for timekeeping by now/0 > and tracing, but the nanoseconds are not available in any API. If I wanted to take advantage of the hr timer in a linked-in driver which function would you recommend to call? Serge From brianm@REDACTED Tue Sep 11 04:18:28 2007 From: brianm@REDACTED (Brian McCallister) Date: Mon, 10 Sep 2007 19:18:28 -0700 Subject: [erlang-questions] Newbie training project proposal In-Reply-To: References: Message-ID: <44FCCF2C-4478-4BA3-BA02-9C64154475BF@skife.org> On Sep 10, 2007, at 2:18 AM, Tomasz B?achowicz wrote: > Hi all, > > I'm looking for wannabe/newbie erlang developers who'd like to learn > that language in practice. I'm going to create new open source project > from scratch that will aim to implement STOMP messaging protocol [1] > in erlang. I've been considering both client and server side > implementation. I'd like to jump in too. Am an okay general programmer, but quite new to erlang. -Brian From david.hopwood@REDACTED Mon Sep 10 20:59:38 2007 From: david.hopwood@REDACTED (David Hopwood) Date: Mon, 10 Sep 2007 19:59:38 +0100 Subject: [erlang-questions] [Off-topic] Haskell type constructor syntax In-Reply-To: <49BA939F-7E83-41B9-A1AC-87AD4672DC44@cs.otago.ac.nz> References: <46DC193D.10504@ericsson.com> <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> <46DD9105.4050901@cs.ntua.gr> <46E05F9D.9050108@bitfurnace.com> <46E068E9.5030809@cs.ntua.gr> <49BA939F-7E83-41B9-A1AC-87AD4672DC44@cs.otago.ac.nz> Message-ID: <46E5941A.40909@industrial-designers.co.uk> ok wrote: > On 8 Sep 2007, at 2:12 am, Tony Finch wrote: >> I'd suggest using initial caps for type names, and omit the () except >> when the type parameter is non-trivial. (That is somewhat like the >> Haskell type syntax.) > > It would be more accurate to describe it as "as unlike the Haskell > syntax as possible". Haskell uses the same conventions for type > (constructors/variables) as for data (constructors/variables), so to > be close to Haskell syntax, you have to use the same spelling for > type constructors as you do for constants, namely, LOWER case. You're mistaken about Haskell syntax -- it does use initial uppercase for type constructors. See , or section 4.1.2. -- David Hopwood From Fawad@REDACTED Tue Sep 11 06:08:31 2007 From: Fawad@REDACTED (Fawad Irfan) Date: Tue, 11 Sep 2007 08:08:31 +0400 Subject: [erlang-questions] help In-Reply-To: Message-ID: <009e01c7f429$6a6a3410$8900a8c0@AUH0025928> Hi Do any archive of previous emails is maintained. I'm new to ErLang and have lot of questions. I want to go through the already answered question then asking these again. Thanks Foad Sheikh -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of erlang-questions-request@REDACTED Sent: Monday, September 10, 2007 2:00 PM To: erlang-questions@REDACTED Subject: erlang-questions Digest, Vol 4, Issue 34 Send erlang-questions mailing list submissions to erlang-questions@REDACTED To subscribe or unsubscribe via the World Wide Web, visit http://www.erlang.org/mailman/listinfo/erlang-questions or, via email, send a message with subject or body 'help' to erlang-questions-request@REDACTED You can reach the person managing the list at erlang-questions-owner@REDACTED When replying, please edit your Subject line so it is more specific than "Re: Contents of erlang-questions digest..." Today's Topics: 1. Re: Intel Quad CPUs (ok) 2. Re: Intel Quad CPUs (ok) 3. Re: Performance Testing with C++, Java, Ruby and Erlang (Ulf Wiger (TN/EAB)) 4. Newbie training project proposal ( Tomasz B?achowicz ) ---------------------------------------------------------------------- Message: 1 Date: Mon, 10 Sep 2007 13:14:05 +1200 From: ok Subject: Re: [erlang-questions] Intel Quad CPUs To: Erlang Message-ID: <49BA939F-7E83-41B9-A1AC-87AD4672DC44@REDACTED> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On 8 Sep 2007, at 2:12 am, Tony Finch wrote: > I'd suggest using initial caps for type names, and omit the () except > when the type parameter is non-trivial. (That is somewhat like the > Haskell type syntax.) It would be more accurate to describe it as "as unlike the Haskell syntax as possible". Haskell uses the same conventions for type (constructors/variables) as for data (constructors/variables), so to be close to Haskell syntax, you have to use the same spelling for type constructors as you do for constants, namely, LOWER case. Also, in Haskell, every type constructor is a function, so to be close to Haskell syntax, you would have to use function notation for all Erlang type constructors. And behold, that's exactly what Erlang does! The *existing* type syntax is precisely what you get when you apply the *principles* behind Haskell type syntax to a language with Erlang's lexical conventions. ------------------------------ Message: 2 Date: Mon, 10 Sep 2007 13:22:44 +1200 From: ok Subject: Re: [erlang-questions] Intel Quad CPUs To: erlang-questions Message-ID: <99BA4333-32ED-40EB-86EE-AD9FD14B2F97@REDACTED> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On 8 Sep 2007, at 2:31 am, Richard Carlsson wrote: > - you couldn't just cut out a guard and paste it in somewhere, > because the scope wasn't the same - atom(X) and the other tests > were not defined outside guards You *still* can't do that because the *semantics* is different. Consider atom(X), integer(Y) or, if you prefer to be long-winded, is_atom(X), is_integer(Y). As a guard, this asserts the conjunction "X is an atom (and) Y is an integer". As an expression, it says "determine whether X is an atom or not but forget the answer; now tell me whether Y is an integer". With comma having different semantics in the two environments, it is actually a very useful protection when a guard test uses a name that is not available in expression. atom(X), integer(Y) has the decency to raise an exception if you try to use it in an expression, instead of quietly giving you the wrong answer. > > - you couldn't access the type tests directly as a boolean value, > as in "Bool = atom(A)" - you'd have to write "Bool = (if atom > (A) -> > true; true -> false end)", which is not exactly elegant This was trivially fixable with a macro: ?G(X) ===> if X => true ; true => false end Note that the semantics of 'length', amongst others, is subtly different between guard and expression contexts, so ?G(length(X) < 10) is *not* the same as length(X) < 10 > > - some names could have different meaning depending on whether they > were used as guard tests or as normal expressions - float(X) is > a boolean test for float-ness if it's a guard, but if it's a > normal expression then it refers to the int-to-float conversion > function That is the only persuasive argument I've ever heard, and in light of the other semantic differences, it would have been better to rename the convert-to-float function to as_float/1. ------------------------------ Message: 3 Date: Mon, 10 Sep 2007 09:30:23 +0200 From: "Ulf Wiger (TN/EAB)" Subject: Re: [erlang-questions] Performance Testing with C++, Java, Ruby and Erlang To: shahzad bhatti Cc: erlang-questions@REDACTED Message-ID: <46E4F28F.1090809@REDACTED> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Ulf Wiger (TN/EAB) wrote: > > The set_node_value/1 function is called from within a lists:foreach(), > when you should rather use e.g. lists:foldl() with Nodes as an > accumulator. That would eliminate all the get() and put() operations, > as the updated Nodes variable is passed on to the next iteration. > > set_node_value(Round, #config{proc_ids = Proc_ids, nodes = Nodes}) -> > lists:foldl( > fun(Id, Ns) -> > set_node_value(Round, Id, Nodes) > end, Nodes, ProcIds). This is of course wrong, and a compiler warning would have indicated the problem, had I bothered to actually compile the proposed changes. The call to set_node_value/3 must be done using Ns rather than Nodes: set_node_value(Round, #config{proc_ids = Proc_ids, nodes = Nodes}) -> lists:foldl( fun(Id, Ns) -> set_node_value(Round, Id, Ns) end, Nodes, ProcIds). BR, Ulf W ------------------------------ Message: 4 Date: Mon, 10 Sep 2007 10:18:44 +0100 From: " Tomasz B?achowicz " Subject: [erlang-questions] Newbie training project proposal To: erlang-questions@REDACTED Message-ID: Content-Type: text/plain; charset=ISO-8859-1 Hi all, I'm looking for wannabe/newbie erlang developers who'd like to learn that language in practice. I'm going to create new open source project from scratch that will aim to implement STOMP messaging protocol [1] in erlang. I've been considering both client and server side implementation. The STOMP protocol is a quite interesting proposal of simple text-oriented messaging protocol. While coding we could probably explore such erlang areas like socket programming, possibly gen_server framework, Mnesia, ETS, not to mention basic concepts of the language. I believe STOMP protocol is kind of ideal candidate for that exercise, bacause it's simple enough (I mean not so complex) and contains some non-trivial aspects e.g. transactions, full-duplex socket traffic, etc. I personally believe that is could be good opportunity to learn erlang by coding instead of only by reading books, articles and tutorials, etc. If you are interested in participation, please contact me directly. References: [1] http://stomp.codehaus.org/Protocol Take care, Tom ------------------------------ _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions End of erlang-questions Digest, Vol 4, Issue 34 *********************************************** ##################################################################################### Note: The content of this email together with any attachments, statements and opinions expressed herein contains information that is private and confidential, are intended for the named addressee/s only. If you are not the addressee of this email you may not copy, forward, disclose or otherwise use it or any part of it in any form whatsoever. If you have received this message in error, please notify postmaster@REDACTED by email immediately and delete the message without making any copies. ##################################################################################### From hughperkins@REDACTED Tue Sep 11 07:47:29 2007 From: hughperkins@REDACTED (Hugh Perkins) Date: Tue, 11 Sep 2007 12:47:29 +0700 Subject: [erlang-questions] Tilera 64-core chip - let's help them help us! In-Reply-To: References: <837db430709060351i34ba6b54x3872c5bec24e19d6@mail.gmail.com> <291037.68853.qm@web38805.mail.mud.yahoo.com> <837db430709060917x1c069413hf0aea0a4fd89e342@mail.gmail.com> <837db430709061551s21a113ceh85d53d0c90eeaf43@mail.gmail.com> Message-ID: <837db430709102247j3c594c73u877044707c3f8bc0@mail.gmail.com> On 9/8/07, David King wrote: > If you have that many lists, chunk it up into the number of cores > available, and run that many processes. Yes, exactly: you need to calculate the number of available cores for the algorithm to be efficient, so the program is not independent of the number of cores. Note that I'm not proposing that other people modify Erlang to provide automatic threading; I'm pondering to what extent Erlang already provides automatic threading (it doesnt seem to), and how easy it would be to add it. Automatic threading really ought to be dynamic, so Erlang's having a VM makes that somewhat easier. Going back to my earlier question ;-), I get the impression that Erlang runs in a VM? What documentation is available on how this works? To what extent is information about maps and so on available from within the bytecode? And, the ten thousand dollar question: to what extent could it be feasible to modify the VM to automatically split maps across available processor cores? From matthias@REDACTED Tue Sep 11 07:56:01 2007 From: matthias@REDACTED (Matthias Lang) Date: Tue, 11 Sep 2007 07:56:01 +0200 Subject: [erlang-questions] help In-Reply-To: <009e01c7f429$6a6a3410$8900a8c0@AUH0025928> References: <009e01c7f429$6a6a3410$8900a8c0@AUH0025928> Message-ID: <18150.11761.615719.288145@antilipe.corelatus.se> Fawad Irfan writes: > Do any archive of previous emails is maintained. http://www.erlang.org/pipermail/erlang-questions/ > I'm new to ErLang and have lot of questions. I want to go through > the already answered question then asking these again. There's also the FAQ, which is an attempt at collecting and condensing answers to some of the common questions: http://www.erlang.org/faq/faq.html Matthias From erlang@REDACTED Tue Sep 11 09:29:45 2007 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 11 Sep 2007 09:29:45 +0200 Subject: [erlang-questions] Newbie training project proposal In-Reply-To: <44FCCF2C-4478-4BA3-BA02-9C64154475BF@skife.org> References: <44FCCF2C-4478-4BA3-BA02-9C64154475BF@skife.org> Message-ID: <9b08084c0709110029v3c06c6fbt788d4490892190c9@mail.gmail.com> This project (and actually the way of working) sounds like a good way to learn Erlang. If you like I can act as a "mentor" and give you some advice with your code now and then. I'll start with a little rant about the architecture of STOMP :-) Here beginneth the lesson One fun thing might be to *extend* the protocol with a layer that allows the end-points to negociate the transport format. Here's the idea: Client -> Server HELLO ICanSpeak: Stomp,erlangTerms Server->Client: HELLO_RESPONSE erlangTerms Thereafter the two sides could communicate using serialised Erlang terms (made by term_to_binary(Term)) and its inverse. Then you just use the lib_chan in appendix D of the Erlang book (shameless plug) Do protocol designers turn off their brains when they design protocols? I see a lot of the following: - text protocols with are "easy" to understand and parse (false - most text protocols are inadequately specified) - XML protocols (crazy - did anybody think how long it would take to parse this crap) The two most obvious methods for building protocols are: - define a packed bit-byte-word structure appropriate to you needs - use serialised lisp S expressions, or Erlang terms (whatever) Are rarely used. A pure Erlang version of Stomp would look like this: Server ! {connect, user, PassWord}, receive {Server, {connected, SessionId}} -> ... end. Now when you write your code you should use the technique of a "middle man" this is a process that converts Erlang terms to the format of data you will see "on the wire" If you send the message {connect, User, Pass} to the middle man it will send a CONNECT login: passcode: message to the socket Something like middle_man(SourcePid, DestSocket) -> receive {SourcePid, {connect, User, Pass}} -> DestSocket ! [<<"CONNECT\nlogin:">>,User, <<"\npasscode:">>,Pass,["\^@"], middle_man(SourePid, DestSocket); ... This method (by extension) gives you a modular way to swap out the code in the back-end (you could use erlang terms, xml, or even STOMP :-) Here endeth the lesson Secondly documentation - code is NOT documentation - never was never will be. Code is what the machine does - documentation is what it is *supposed* to do. In a well written system the code does what the documentation says it is supposed to do. In a badly written system there is no documentation and we have no idea what the code is supposed to do since we only know what it actually does - then we have to guess what it was supposed to do. Have fun /Joe Armstrong On 9/11/07, Brian McCallister wrote: > > On Sep 10, 2007, at 2:18 AM, Tomasz B?achowicz wrote: > > > Hi all, > > > > I'm looking for wannabe/newbie erlang developers who'd like to learn > > that language in practice. I'm going to create new open source project > > from scratch that will aim to implement STOMP messaging protocol [1] > > in erlang. I've been considering both client and server side > > implementation. > > I'd like to jump in too. Am an okay general programmer, but quite new > to erlang. > > -Brian > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From mats.cronqvist@REDACTED Tue Sep 11 09:38:13 2007 From: mats.cronqvist@REDACTED (mats cronqvist) Date: Tue, 11 Sep 2007 09:38:13 +0200 Subject: [erlang-questions] Emacs: Debugger buffer not showing program output In-Reply-To: References: Message-ID: <1189496293.13743.43.camel@seasc0498.dyn.rnd.as.sw.ericsson.se> On Tue, 2007-09-11 at 03:15 +0530, Vishnu Gopal wrote: > Sorry, perhaps I wasn't clear. The solution IS to check out an older > version of the code since the trunk is broken. i.e. the trunk exhibits > the symptoms above, the revision on july 1 doesn't. > > I don't know why this is tho :-) some doofus (i.e. myself) checked in some bad code back in 2007-07-05. i fixed it yesterday, will commit today. mats From erlang@REDACTED Tue Sep 11 09:41:39 2007 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 11 Sep 2007 09:41:39 +0200 Subject: [erlang-questions] Newbie training project proposal In-Reply-To: <9b08084c0709110029v3c06c6fbt788d4490892190c9@mail.gmail.com> References: <44FCCF2C-4478-4BA3-BA02-9C64154475BF@skife.org> <9b08084c0709110029v3c06c6fbt788d4490892190c9@mail.gmail.com> Message-ID: <9b08084c0709110041x805a21egb3e5744e6d2d046f@mail.gmail.com> Exercise 0) Divide yourself into groups to solve 1 2 3 ... Exercise 1) make an Erlang equivalent of all the terms in the STOMP protocol For example: SEND destination: /queue/a transaction: tx1 hello queue a! ^@ is represented by {send,"/queue/a","tx1","hello queue a!"}. Write down the Erlang equivalents of all the messages in the protocol. Write the functions erl2stop(Term) and stomp2erl(String) That converts between the two forms of the message. Exercise 2) Write a function is_complete_stomp_message(Str) -> Bool that figures out if we have received an entire STOMP message Exercise 3) Write documentation - define the directory structure of your project the names of the major modules, who writes what. Exercise 4) Write the socket stuff to glue 1 and 2 together (hint - read the Erlang book) Exercise 5) Think about how to implement transactions (I won't tell you) Cheers /Joe On 9/11/07, Joe Armstrong wrote: > This project (and actually the way of working) sounds like a > good way to learn Erlang. If you like I can act as a "mentor" and > give you some advice with your code now and then. > > I'll start with a little rant about the architecture of STOMP :-) > > Here beginneth the lesson > > One fun thing might be to *extend* the protocol with a layer that > allows the end-points to > negociate the transport format. > > Here's the idea: > > Client -> Server > HELLO > ICanSpeak: Stomp,erlangTerms > > Server->Client: > HELLO_RESPONSE > erlangTerms > > Thereafter the two sides could communicate using serialised Erlang terms > (made by term_to_binary(Term)) and its inverse. > > Then you just use the lib_chan in appendix D of the Erlang book (shameless plug) > > > > Do protocol designers turn off their brains when they design protocols? > > I see a lot of the following: > > - text protocols with are "easy" to understand and parse > (false - most text protocols are inadequately specified) > - XML protocols > (crazy - did anybody think how long it would take to parse this crap) > > The two most obvious methods for building protocols are: > > - define a packed bit-byte-word structure appropriate to you needs > - use serialised lisp S expressions, or Erlang terms (whatever) > > Are rarely used. > > A pure Erlang version of Stomp would look like this: > > Server ! {connect, user, PassWord}, > receive > {Server, {connected, SessionId}} -> > ... > end. > > Now when you write your code you should use the technique of a "middle man" > this is a process that converts Erlang terms to the format of data you > will see "on the wire" > > If you send the message {connect, User, Pass} to the middle man > it will send a > > CONNECT > login: > passcode: > > message to the socket > > Something like > > middle_man(SourcePid, DestSocket) -> > receive > {SourcePid, {connect, User, Pass}} -> > DestSocket ! [<<"CONNECT\nlogin:">>,User, > > <<"\npasscode:">>,Pass,["\^@"], > middle_man(SourePid, DestSocket); > ... > > This method (by extension) gives you a modular way to swap out the code in the > back-end (you could use erlang terms, xml, or even STOMP :-) > > > > Here endeth the lesson > > Secondly documentation - code is NOT documentation - never was never will be. > > Code is what the machine does - documentation is what it is *supposed* to do. > > In a well written system the code does what the documentation says it > is supposed to do. > > In a badly written system there is no documentation and we have no > idea what the code is supposed to do since we only know what it > actually does - then we have to guess > what it was supposed to do. > > Have fun > > /Joe Armstrong > > > On 9/11/07, Brian McCallister wrote: > > > > On Sep 10, 2007, at 2:18 AM, Tomasz B?achowicz wrote: > > > > > Hi all, > > > > > > I'm looking for wannabe/newbie erlang developers who'd like to learn > > > that language in practice. I'm going to create new open source project > > > from scratch that will aim to implement STOMP messaging protocol [1] > > > in erlang. I've been considering both client and server side > > > implementation. > > > > I'd like to jump in too. Am an okay general programmer, but quite new > > to erlang. > > > > -Brian > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > From sean.hinde@REDACTED Tue Sep 11 09:57:14 2007 From: sean.hinde@REDACTED (Sean Hinde) Date: Tue, 11 Sep 2007 08:57:14 +0100 Subject: [erlang-questions] Tilera 64-core chip - let's help them help us! In-Reply-To: <837db430709102247j3c594c73u877044707c3f8bc0@mail.gmail.com> References: <837db430709060351i34ba6b54x3872c5bec24e19d6@mail.gmail.com> <291037.68853.qm@web38805.mail.mud.yahoo.com> <837db430709060917x1c069413hf0aea0a4fd89e342@mail.gmail.com> <837db430709061551s21a113ceh85d53d0c90eeaf43@mail.gmail.com> <837db430709102247j3c594c73u877044707c3f8bc0@mail.gmail.com> Message-ID: <15AC8D86-CA23-46F2-BEF0-5AB0CFEA5F6A@gmail.com> On 11 Sep 2007, at 06:47, Hugh Perkins wrote: > On 9/8/07, David King wrote: >> If you have that many lists, chunk it up into the number of cores >> available, and run that many processes. > > Yes, exactly: you need to calculate the number of available cores for > the algorithm to be efficient, so the program is not independent of > the number of cores. No. All David is saying is that processing lists of 10M entries is a special case that can benefit from some specialised algorithm (memory limitations etc will dominate). For "normal" erlang programs you do NOT need to care about how many CPU cores - just spawn one process per parallel activity and let the scheduler use as many cores as it can. Sean From matthias@REDACTED Tue Sep 11 09:36:52 2007 From: matthias@REDACTED (Matthias Lang) Date: Tue, 11 Sep 2007 09:36:52 +0200 Subject: [erlang-questions] Tilera 64-core chip - let's help them help us! In-Reply-To: <837db430709102247j3c594c73u877044707c3f8bc0@mail.gmail.com> References: <837db430709060351i34ba6b54x3872c5bec24e19d6@mail.gmail.com> <291037.68853.qm@web38805.mail.mud.yahoo.com> <837db430709060917x1c069413hf0aea0a4fd89e342@mail.gmail.com> <837db430709061551s21a113ceh85d53d0c90eeaf43@mail.gmail.com> <837db430709102247j3c594c73u877044707c3f8bc0@mail.gmail.com> Message-ID: <18150.17812.847860.760451@antilipe.corelatus.se> Hugh Perkins writes: > Yes, exactly: you need to calculate the number of available cores for > the algorithm to be efficient, so the program is not independent of > the number of cores. Which is a problem because...? (Sean already pointed out that having a loose upper bound on the number of cores is sufficient.) > Automatic threading really ought to be dynamic, Erlang automatically distributes Erlang processes across OS threads. That's uncontroversial in a language which isn't attempting hard real time. But you seem to want more things hidden. > Going back to my earlier question ;-), I get the impression that > Erlang runs in a VM? Correct. > What documentation is available on how this works? Very little, apart from full source code. Everything I know of is collected in the FAQ, here: http://www.erlang.org/faq/faq.html#AEN271 Historically, few people have been brave enough to modify the VM. > And, the ten thousand dollar question: to what extent could it be > feasible to modify the VM to automatically split maps across available > processor cores? The million dollar question is "is the VM the right place to do this". And the billion dollar question is "can you come up with an automatic way of doing it which is significantly better than Sean's approach---which has the great virtue of being simple"? Matthias From rvirding@REDACTED Tue Sep 11 11:21:38 2007 From: rvirding@REDACTED (Robert Virding) Date: Tue, 11 Sep 2007 11:21:38 +0200 Subject: [erlang-questions] (no subject) Message-ID: <3dbc6d1c0709110221h6b7db77eue0466a31dbe963f6@mail.gmail.com> An interesting link on parallel programming: http://www.ddj.com/hpc-high-performance-computing/201804248;jsessionid=3DFMR5QISM4PCQSNDLRSKH0CJUNN2JVN?_requestid=1101622 Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From tblachowicz@REDACTED Tue Sep 11 12:32:56 2007 From: tblachowicz@REDACTED (Tomasz Blachowicz) Date: Tue, 11 Sep 2007 11:32:56 +0100 Subject: [erlang-questions] Newbie training project proposal In-Reply-To: <9b08084c0709110029v3c06c6fbt788d4490892190c9@mail.gmail.com> References: <44FCCF2C-4478-4BA3-BA02-9C64154475BF@skife.org> <9b08084c0709110029v3c06c6fbt788d4490892190c9@mail.gmail.com> Message-ID: Hi Joe, On 9/11/07, Joe Armstrong wrote: > This project (and actually the way of working) sounds like a > good way to learn Erlang. If you like I can act as a "mentor" and > give you some advice with your code now and then. That's really cool! Frankly speaking I couldn't imagine better "mentor" than language creator :) Thanks a lot for volunteering. > I'll start with a little rant about the architecture of STOMP :-) > > Here beginneth the lesson > > One fun thing might be to *extend* the protocol with a layer that > allows the end-points to > negociate the transport format. > > Here's the idea: > > Client -> Server > HELLO > ICanSpeak: Stomp,erlangTerms > > Server->Client: > HELLO_RESPONSE > erlangTerms > > Thereafter the two sides could communicate using serialised Erlang terms > (made by term_to_binary(Term)) and its inverse. > > Then you just use the lib_chan in appendix D of the Erlang book (shameless plug) I haven't even considered to use erlang terms internally. My OO brain need some more exercises :) I need some time to get the idea, to be honest. But the idea seams pretty clear to me. My background is Java, so I didn't considered native 'serialization' which is discouraged in such cases in Java world. > > > Do protocol designers turn off their brains when they design protocols? > > I see a lot of the following: > > - text protocols with are "easy" to understand and parse > (false - most text protocols are inadequately specified) > - XML protocols > (crazy - did anybody think how long it would take to parse this crap) > > The two most obvious methods for building protocols are: > > - define a packed bit-byte-word structure appropriate to you needs > - use serialised lisp S expressions, or Erlang terms (whatever) I'm not a big fan of STOMP design, either. I believe its String-orientation is the main flaw. On the other side I understand that STOMP is designed as general purpose protocol with interoperability in mind. I recon, binary application layer protocols are hard in terms of interoperability, because Java or Python client don't understand Erlang or lisp serialised structures. > Are rarely used. > > A pure Erlang version of Stomp would look like this: > > Server ! {connect, user, PassWord}, > receive > {Server, {connected, SessionId}} -> > ... > end. > > Now when you write your code you should use the technique of a "middle man" > this is a process that converts Erlang terms to the format of data you > will see "on the wire" > > If you send the message {connect, User, Pass} to the middle man > it will send a > > CONNECT > login: > passcode: > > message to the socket > > Something like > > middle_man(SourcePid, DestSocket) -> > receive > {SourcePid, {connect, User, Pass}} -> > DestSocket ! [<<"CONNECT\nlogin:">>,User, > > <<"\npasscode:">>,Pass,["\^@"], > middle_man(SourePid, DestSocket); > ... > > This method (by extension) gives you a modular way to swap out the code in the > back-end (you could use erlang terms, xml, or even STOMP :-) Good point. I believe we have to adopt your idea. I need write some code to see how it works, any way :) > > > Here endeth the lesson > > Secondly documentation - code is NOT documentation - never was never will be. > > Code is what the machine does - documentation is what it is *supposed* to do. > > In a well written system the code does what the documentation says it > is supposed to do. > > In a badly written system there is no documentation and we have no > idea what the code is supposed to do since we only know what it > actually does - then we have to guess > what it was supposed to do. This is what every mentor should include in the his or her introductionary post :) > Have fun I do have a lot fun coding this stuff :) Thanks again, Tom From Bob.Cowdery@REDACTED Tue Sep 11 14:23:33 2007 From: Bob.Cowdery@REDACTED (Bob Cowdery) Date: Tue, 11 Sep 2007 13:23:33 +0100 Subject: [erlang-questions] Yaws, ErlyWeb and Windows. Message-ID: <3A76756EED583B43A4AD704E29CCD079715E3F@mail.smartlogic.com> Thanks Jan, So many different ways. Before trying this I tried CEAN. It seems to work! I might be on my way. Bob -----Original Message----- From: Jan Jacobs [mailto:hpjcon@REDACTED] Sent: 10 September 2007 23:12 To: Bob Cowdery Subject: Re: [erlang-questions] Yaws, ErlyWeb and Windows. Hi Bob, I agree on the official way it was hit and miss for me to before I got it started. Step 1 If you have a pre-compiled version of YAWS you need to copy it in the lib directory of the your erlang runtime. C:\pack\erl5.5.5\lib\yaws-1.68\ Step 2 Create a yaws config file for yaws and place it in the following directory C:\pack\erl5.5.5\lib\yaws-1.68\ebin\ Step 3 Start a runtime in the following direcoty C:\pack\erl5.5.5\lib\yaws-1.68\ebin>erl Step 4 Start yaws application:start(yaws). Step 5 Open explore and navigate to http://127.0.0.1:8001/ This should open the YAWS documentation. simular to the web site. This indicates that yaws is working. The steps in the other email is to compile yaws on a windows platfrom. It is steps from me when I update erlang runtimes or yaws versions. If you need more information on it I will exlain it in more detail. Cheers Jan ----- Original Message ----- From: "Bob Cowdery" To: "Jan Jacobs" Cc: "Erlang-Questions (E-mail)" Sent: Monday, September 10, 2007 11:20 PM Subject: RE: [erlang-questions] Yaws, ErlyWeb and Windows. Hi Jan Thanks for the response. I'm probably being really thick here but I don't have that much experience with the way these extensions are added to erlang. I didn't really understand much of what you said. The first reply you sent some files, unfortunately yaws.app was blocked. Your first email suggested it should just run so I copied yaws from the repository (which was pre-built) into lib, but how do I start yaws? I'm about to start on a management console for my project and yaws/erlyweb/mnesia is a preferable approach but I also have a good set of Java API's to my erlang core and Java/Spring/MySQL is another approach. I don't know how much pain I will have to go through to get yaws etc working and build up enough knowledge to use it effectively. The fact that there was little response does worry me. The project needs to run on Windows, Linux and OSX but I develop on Windows because that's where I am most of the time. Sorry to ramble on, just thinking aloud. I'm sure it does work (in fact it does because the repository version runs in the special erl runtime) but right now I see a few individuals that have managed to get things working in their very individual ways. It would be 'nice' to have one official way that is properly explained and works. If you could explain in a little more detail what each step does and how to perform it, it would be greatly appreciated. Thanks Bob -----Original Message----- From: Jan Jacobs [mailto:hpjcon@REDACTED] Sent: 09 September 2007 21:30 To: Bob Cowdery Subject: Re: [erlang-questions] Yaws, ErlyWeb and Windows. Hi Bob I have been using YAWS on the Windows platfrom for all my projects and applications and it works well. Here is a short list of steps to get yaws to comiple on a Windows box: Compiling YAWS for Win32 ------------------------------ 1 Copy yaws-X.XX into lib directory of Erlang 2 Create the following files using the templates in the src direcory of YAWS - yaws_vsn.erl - yaws_generated.erl 3 Create the mime_types.erl file from mime_type_c.erl - Create a file charset.def in the src directory of YAWS - Compile mime_type_c.erl - Use the compiled mime_type_c:compile(). to generage mime_types.erl 4 Create yaws.app file 5 Create an Emakefile I hope this helps. Cheers Jan Jacobs www.econsys.co.za ----- Original Message ----- From: "Bob Cowdery" To: "Erlang-Questions (E-mail)" Sent: Sunday, September 09, 2007 8:00 PM Subject: [erlang-questions] Yaws, ErlyWeb and Windows. > > Hi All > > Can someone give me the picture on Yaws and ErlyWeb under Windows please. > Firstly I've failed pretty dismally to get Yaws working on Windows. I > compiled and run it on Linux no problem. I found some info on building > under cygwin and also some batch files to compile natively but both fail > me right now. I did download the erlang repository (Erlang-Projects.Org) > and that runs up Yaws fine but it seems to use some tricks to do it and I > can't see how to just copy the Yaws directory and use it with my existing > erlang system. > > If you have successfully got Yaws working what route did you use - I'd > rather not run it under cygwin because nothing else in my erlang systems > need to and I don't see why Yaws should be diferent. > > I've also read some posts that suggest ErlyWeb does not work under > Windows. Does anyone know of any issues? > > Thanks for any help. > > Bob > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > -- > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.5.485 / Virus Database: 269.13.10/995 - Release Date: > 2007/09/08 01:24 PM > > -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.485 / Virus Database: 269.13.12/997 - Release Date: 2007/09/09 10:17 AM From Bob.Cowdery@REDACTED Tue Sep 11 14:28:11 2007 From: Bob.Cowdery@REDACTED (Bob Cowdery) Date: Tue, 11 Sep 2007 13:28:11 +0100 Subject: [erlang-questions] Yaws, ErlyWeb and Windows. Message-ID: <3A76756EED583B43A4AD704E29CCD07974125E@mail.smartlogic.com> Well, actually it was. I wasn't really aware of CEAN. I followed the instructions to put it in an existing system and it worked and installed Yaws. After a bit of fiddling with the config it fired up and worked. I put ErlyWeb on and again after a bit of config fiddling I think it works. Now to start the real app and see how far I get... Bob -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED]On Behalf Of David Mercer Sent: 10 September 2007 21:19 To: 'Erlang-Questions (E-mail)' Subject: Re: [erlang-questions] Yaws, ErlyWeb and Windows. My post ain't gonna be much help other than to let you know Windows Yaws is not a mirage: I got it working a few months ago with minimal problems. I cannot say exactly how I did it, but I would guess I just installed it from CEAN, because my mind has no recollection that there was any trick to it. Cheers, DBM -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Claes Wikstrom Sent: Monday, September 10, 2007 14:33 To: Bob Cowdery Cc: Erlang-Questions (E-mail) Subject: Re: [erlang-questions] Yaws, ErlyWeb and Windows. Bob Cowdery wrote: > Hi All > > Can someone give me the picture on Yaws and ErlyWeb under Windows please I'm sorry about that - to my knowledge there is quite a lot of people running yaws under windows. I don't run windows at all any longer - and I'll just have to leave it up to the yaws/windows community to write e.g. a proper wiki entry on how to do it. I know for sure that it atleast used to work - I made sure it worked once, but it might have gone bad. /klacke _______________________________________________ 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 alceste@REDACTED Tue Sep 11 14:29:05 2007 From: alceste@REDACTED (Alceste Scalas) Date: Tue, 11 Sep 2007 14:29:05 +0200 Subject: [erlang-questions] FFI for Erlang: patches and draft EEP Message-ID: <1189513745.8590.43.camel@gnatziu.crs4.it> Hello, some time ago [1] I asked for comments about extending Erlang/OTP with a Foreign Function Interface (FFI) --- i.e. some new BIFs for calling external C code, with automatic Erlang/C type translations. The response was pretty good. After some cleanup, testing and bugfixing (and vacations...), I've prepared a draft EEP (Erlang Enhancement Proposal) and a series of patches that implement the proposal. Everything is available at the following URL: http://muvara.org/crs4/erlang/ffi The implementation is based on OTP R11B-5, and has been tested on i386 and x86_64 (on GNU/Linux). A simple test suite is also available. Comments, bug reports and patches are more than welcome. Have fun! Regards, alceste P.S.: the URL above is temporary, and will redirect on www.crs4.it when some technical issues are resolved. Notes: [1] First discussion about the Erlang FFI proposal: http://www.erlang.org/pipermail/erlang-questions/2007-August/028346.html -- Alceste Scalas CRS4 - http://www.crs4.it/ From klacke@REDACTED Tue Sep 11 15:05:40 2007 From: klacke@REDACTED (Claes Wikstrom) Date: Tue, 11 Sep 2007 15:05:40 +0200 Subject: [erlang-questions] FFI for Erlang: patches and draft EEP In-Reply-To: <1189513745.8590.43.camel@gnatziu.crs4.it> References: <1189513745.8590.43.camel@gnatziu.crs4.it> Message-ID: <46E692A4.5040008@hyber.org> Alceste Scalas wrote: > Hello, > > some time ago [1] I asked for comments about extending Erlang/OTP with a > Foreign Function Interface (FFI) --- i.e. some new BIFs for calling > external C code, with automatic Erlang/C type translations. The > response was pretty good. > Nice work - two questions. call erlang--> C and binary() data: Is the binary data copied or does the C function get a pointer/size pair - the latter would be optimal. return C --> erlang - I can't seem to find any ways for the C code to return a binary() back to erlang ?? This is IMHO necessary /klacke From vladdu55@REDACTED Tue Sep 11 15:11:37 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 11 Sep 2007 15:11:37 +0200 Subject: [erlang-questions] FFI for Erlang: patches and draft EEP In-Reply-To: <1189513745.8590.43.camel@gnatziu.crs4.it> References: <1189513745.8590.43.camel@gnatziu.crs4.it> Message-ID: <95be1d3b0709110611y62b851cdj1fe40bbff89c404a@mail.gmail.com> Hi! On 9/11/07, Alceste Scalas wrote: > > After some cleanup, testing and bugfixing (and vacations...), I've > prepared a draft EEP (Erlang Enhancement Proposal) and a series of > patches that implement the proposal. Everything is available at the > following URL: > > http://muvara.org/crs4/erlang/ffi This looks very interesting! I think there are some things that would need to be clarified (possibly they are in the code, but from a brief review I couldn't find that). When it comes to allocating memory, is the idea that the Erlang program will call malloc and free? Filling buffers would be done by calling memcpy from a binary term? How about returned buffers, how to convert them to Erlang binaries? best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Tue Sep 11 15:14:47 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 11 Sep 2007 15:14:47 +0200 Subject: [erlang-questions] FFI for Erlang: patches and draft EEP In-Reply-To: <46E692A4.5040008@hyber.org> References: <1189513745.8590.43.camel@gnatziu.crs4.it> <46E692A4.5040008@hyber.org> Message-ID: <95be1d3b0709110614l2fda5774j7cf40111e2e7f033@mail.gmail.com> On 9/11/07, Claes Wikstrom wrote: > > Alceste Scalas wrote: > > Hello, > > > > some time ago [1] I asked for comments about extending Erlang/OTP with a > > Foreign Function Interface (FFI) --- i.e. some new BIFs for calling > > external C code, with automatic Erlang/C type translations. The > > response was pretty good. > > > > Nice work - two questions. > > call erlang--> C and binary() data: Is the binary data copied > or does the C function get a pointer/size pair - the latter > would be optimal. > > return C --> erlang - I can't seem to find any ways for the > C code to return a binary() back to erlang ?? This is IMHO > necessary > > :-) You beat me to it! If the C side uses pointers to the internals of the Erlang binaries, aren't there going to be some nasty interactions with the garbage collector? regards, /Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From alceste@REDACTED Tue Sep 11 15:52:10 2007 From: alceste@REDACTED (Alceste Scalas) Date: Tue, 11 Sep 2007 15:52:10 +0200 Subject: [erlang-questions] FFI for Erlang: patches and draft EEP In-Reply-To: <46E692A4.5040008@hyber.org> References: <1189513745.8590.43.camel@gnatziu.crs4.it> <46E692A4.5040008@hyber.org> Message-ID: <1189518730.8590.71.camel@gnatziu.crs4.it> Il giorno mar, 11/09/2007 alle 15.05 +0200, Claes Wikstrom ha scritto: > call erlang--> C and binary() data: Is the binary data copied > or does the C function get a pointer/size pair - the latter > would be optimal. The C side just gets a pointer to the beginning of the binary data, that is never copied. If the binary size is also required, you could pass size(Binary) as a function call argument. > return C --> erlang - I can't seem to find any ways for the > C code to return a binary() back to erlang ?? This is IMHO > necessary The current FFI implementation, taken alone, does *not* allow the C side to fiddle with the Erlang VM (e.g. by allocating binaries or other terms). This issue could be overcomed in three ways: 1. using a complete API for handling Erlang terms on the C side (not existing yet for linked-in drivers); 2. developing a small linked-in driver, that uses erlang:port_control/3 for stuff like returning binaries (allocated with driver_alloc_binary()). Other functions that don't play with Erlang terms may be called directly with ffi:call/2 and ffi:call/3, without having to increase the driver glue code; 3. another way I didn't think about :-) The ideal solution would be (1), and it could even be an extension of the Erlang FFI draft EEP [1]. My idea, however, was to do one thing a time. Regards, alceste Notes: [1] Indeed, it would be trivial to extend the FFI interface to pass Erlang terms to the C side, thus allowing to develop functions with the power of BIFs. These functions, however, would need to be compiled against the Erlang VM header files; and since they are not "public", they would need to be recompiled in order to match the Erlang/OTP version in use. This is a complex issue, that is probably worth a dedicated EEP. -- Alceste Scalas CRS4 - http://www.crs4.it/ From alceste@REDACTED Tue Sep 11 16:07:54 2007 From: alceste@REDACTED (Alceste Scalas) Date: Tue, 11 Sep 2007 16:07:54 +0200 Subject: [erlang-questions] FFI for Erlang: patches and draft EEP In-Reply-To: <95be1d3b0709110611y62b851cdj1fe40bbff89c404a@mail.gmail.com> References: <1189513745.8590.43.camel@gnatziu.crs4.it> <95be1d3b0709110611y62b851cdj1fe40bbff89c404a@mail.gmail.com> Message-ID: <1189519674.8590.81.camel@gnatziu.crs4.it> Il giorno mar, 11/09/2007 alle 15.11 +0200, Vlad Dumitrescu ha scritto: > When it comes to allocating memory, is the idea that the Erlang > program will call malloc and free? It is possible to do so, but it ultimately depends on how the external code is interfaced to Erlang. When creating a C library binding, the FFI calls could (and should) be hidden in the guts of a nice, Erlang-ish API. However, if one wants to develop something like ESDL [1], (i.e. an almost direct mapping between C and Erlang functions calls), then it is possible (and easy) to do it. > Filling buffers would be done by calling memcpy from a binary term? Yes (on the C side, you get the pointer to the beginning of binary data). > How about returned buffers, how to convert them to Erlang binaries? See my previous answer to Claes Wikstrom. Regards, alceste Notes: [1] ESDL: http://esdl.sourceforge.net/ -- Alceste Scalas CRS4 - http://www.crs4.it/ From alceste@REDACTED Tue Sep 11 16:21:03 2007 From: alceste@REDACTED (Alceste Scalas) Date: Tue, 11 Sep 2007 16:21:03 +0200 Subject: [erlang-questions] FFI for Erlang: patches and draft EEP In-Reply-To: <95be1d3b0709110614l2fda5774j7cf40111e2e7f033@mail.gmail.com> References: <1189513745.8590.43.camel@gnatziu.crs4.it> <46E692A4.5040008@hyber.org> <95be1d3b0709110614l2fda5774j7cf40111e2e7f033@mail.gmail.com> Message-ID: <1189520463.8590.93.camel@gnatziu.crs4.it> Il giorno mar, 11/09/2007 alle 15.14 +0200, Vlad Dumitrescu ha scritto: > If the C side uses pointers to the internals of the Erlang binaries, > aren't there going to be some nasty interactions with the garbage > collector? If the pointers are kept on some internal C structure *after* the function call returns, then they may become "obsolete" if the GC decides to move the binaries around. In these cases, the C side should take care of copying the data in a safe place. The pointers, however, are safe during the function call itself [1]. Regards, alceste Notes: [1] If it's needed, the FFI BIFs could ensure that the binary is not moved during the call, e.g. if the GC runs on another processor/thread. However, I was not able to spot any existing BIF that does something like that: binary data is just accessed without worries. Maybe the Erlang Master Developers could say whether I'm wrong :-) -- Alceste Scalas CRS4 - http://www.crs4.it/ From rvirding@REDACTED Tue Sep 11 16:15:02 2007 From: rvirding@REDACTED (Robert Virding) Date: Tue, 11 Sep 2007 16:15:02 +0200 Subject: [erlang-questions] We even have our own building ... Message-ID: <3dbc6d1c0709110715r5b843031w8dfcd47074a8e3cb@mail.gmail.com> I saw this while scanning for a conference. We even have our own building now. :-) Look down the page a bit: http://www.lsbu.ac.uk/about/maps.shtml#map Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From dking@REDACTED Tue Sep 11 16:57:11 2007 From: dking@REDACTED (David King) Date: Tue, 11 Sep 2007 07:57:11 -0700 Subject: [erlang-questions] Message-sending performance In-Reply-To: <944da41d0709100520u43a97acbr88bf3e2103e5cbb3@mail.gmail.com> References: <97F91CA1-E11A-4B2F-B706-C0E8766209EC@ketralnis.com> <46E270E6.90808@di.uminho.pt> <944da41d0709100520u43a97acbr88bf3e2103e5cbb3@mail.gmail.com> Message-ID: <27ED2853-3147-42A9-A8C2-2F86E5A7B097@ketralnis.com> > What are the numbers on an SMP VM with >2 schedulers? For 100,000 messages, it's now instantaneous when accepting them out of order. Now there doesn't appear to be a difference between one scheduler or two until approximately 100,000,000 messages. > > On 9/10/07, David King wrote: > The problem > here is that you are insisting on receiving messages by > > a given order: {msg, X} with X <- [1..N]. Messages sent become > > interleaved in the mailbox; when you try to remove, say {msg, > > 40000} from the 1st process, there are already 10000s of messages > > in the mailbox from the other process before that one, that must be > > scanned; receive becomes very slow. > > Ah, I can see that, and I can see why, as now it is the messages out > of order, so expecting to be able to receive them in order is silly > > > This is one of the problems one must be keeping an eye on: beware > > the size of the mailbox. In your problem you will see that if you > > replace receive by > > receive {msg, _} -> ok end > > the program will execute extremely fast, as with 1 process. > > Yes, it does, now sending with two processes is just as fast as > sending with one (and when I actually have work to do as I receive > them, it will be faster). And in my use-case, receiving the messages > out-of-order isn't a problem at all. > > Thank you for the advice. > > > > David King wrote: > >> I've noticed that I can send 100,000 messages from one process to > >> another very quickly (less than a second), but if I have two > >> process send 50,000 messages each to a given process, it receives > >> them very slowly (in my test, 36s). I found this using the > >> mapreduce implementation in Joe's book where potentially > >> thousands of processes are spawned and many (potentially very > >> small) messages are sent. > >> I assume that this is because the message queue is locked while > >> sending and receiving messages. Is there any way to work around > >> this so that having multiple processes sending many messages each > >> isn't so slow? In my case I'd like the sender and receiver to be > >> working simultaneously, so having each sender process send one > >> large list isn't quite as efficient > >> Here it is with one process: > >> (nodename@REDACTED)11> message_streamer:stream_messages(100000). > >> Receiving 10000 at 63356401790 > >> Receiving 20000 at 63356401790 > >> Receiving 30000 at 63356401790 > >> Receiving 40000 at 63356401790 > >> Receiving 50000 at 63356401790 > >> Receiving 60000 at 63356401790 > >> Receiving 70000 at 63356401790 > >> Receiving 80000 at 63356401790 > >> Receiving 90000 at 63356401790 > >> Done sending 100000 messages > >> Receiving 100000 at 63356401790 > >> 100000 messages in 1s, 1.00000e+5 msg/s > >> And here it is with two processes: > >> (nodename@REDACTED)9> message_streamer:stream_messages(100000). > >> Receiving 10000 at 63356401639 > >> Receiving 20000 at 63356401643 > >> Receiving 30000 at 63356401650 > >> Receiving 40000 at 63356401660 > >> Receiving 50000 at 63356401673 > >> Done sending 50000 messages > >> Receiving 60000 at 63356401673 > >> Receiving 70000 at 63356401673 > >> Receiving 80000 at 63356401673 > >> Receiving 90000 at 63356401673 > >> Receiving 100000 at 63356401673 > >> Done sending 50000 messages > >> 100000 messages in 36s, 2777.78 msg/s > >> In the multiple-process case, it actually slows down as more > >> messages are sent until one of the processes completes, and then > >> it receives them all very quickly. Here's the code: > >> --- code begins --- > >> -module(message_streamer). > >> -compile(export_all). > >> stream_messages(N) -> > >> Self=self(), > >> Start=myapp_util:now(), > >> List=lists:seq(1,N), > >> Split_List=split_list(List,erlang:system_info(schedulers)), > >> lists:foreach(fun(Sublist) -> > >> spawn_link(fun() -> > >> lists:foreach(fun(Which) -> > >> Self ! {msg,Which} > >> end, > >> Sublist), > >> io:format("Done sending ~p messages~n", > >> [length(Sublist)]) > >> end) > >> end, Split_List), > >> lists:foreach(fun(Which) -> > >> case Which rem (N div 10) of > >> 0 -> > >> io:format("Receiving ~p at ~p ~n", > >> [Which,myapp_util:now()]); > >> _ -> ok > >> end, > >> receive {msg,Which} -> ok end > >> end, > >> List), > >> Time=case myapp_util:now()-Start of > >> 0 -> 1; > >> X -> X > >> end, > >> io:format("~p messages in ~ps, ~p msg/s~n",[N,Time,N/Time]). > >> %% splits a list into equal parts > >> %% split_list([1,2,3,4,5,6],2) -> [[1,2,3],[4,5,6]] > >> split_list(List,Pieces) -> > >> Length=length(List), > >> lists:reverse(split_list(List,Length div Pieces,Length,[])). > >> split_list([], _Per_Piece, 0, Acc) -> > >> Acc; > >> split_list(List, Per_Piece, Length, Acc) when Length>=Per_Piece -> > >> {Short,Long} = lists:split(Per_Piece,List), > >> split_list(Long, Per_Piece, Length-Per_Piece, [ Short | Acc ]); > >> split_list(List, Per_Piece, Length, Acc) when Length > >> {Short,Long} = lists:split(Length, List), > >> split_list(Long, Per_Piece, Length-Length, [ Short | Acc ]). > >> --- code ends --- > >> myapp_util:now() just looks like: > >> now() -> > >> calendar:datetime_to_gregorian_seconds(calendar:universal_time > ()). > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > -- > > Paulo S?rgio Almeida Email: > > psa@REDACTED > > Dep. Informatica - Universidade do Minho Phone: +351 253 > > 604451 > > Campus de Gualtar - 4710-057 Braga - PORTUGAL Fax : +351 253 > > 604471 > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From klacke@REDACTED Tue Sep 11 17:12:51 2007 From: klacke@REDACTED (Claes Wikstrom) Date: Tue, 11 Sep 2007 17:12:51 +0200 Subject: [erlang-questions] FFI for Erlang: patches and draft EEP In-Reply-To: <1189518730.8590.71.camel@gnatziu.crs4.it> References: <1189513745.8590.43.camel@gnatziu.crs4.it> <46E692A4.5040008@hyber.org> <1189518730.8590.71.camel@gnatziu.crs4.it> Message-ID: <46E6B073.6060407@hyber.org> Alceste Scalas wrote: >> return C --> erlang - I can't seem to find any ways for the >> C code to return a binary() back to erlang ?? This is IMHO >> necessary > > The current FFI implementation, taken alone, does *not* allow the C side > to fiddle with the Erlang VM (e.g. by allocating binaries or other > terms). > My question was that I couldn't find any way for the C code to return e.g. a string back to the erlang caller, a string on the C side would then typically be represented as a binary() on the erlang side. /klacke From als@REDACTED Tue Sep 11 17:31:34 2007 From: als@REDACTED (Anthony Shipman) Date: Wed, 12 Sep 2007 01:31:34 +1000 Subject: [erlang-questions] terminating a gen_server In-Reply-To: References: <200709110313.28109.als@iinet.net.au> Message-ID: <200709120131.34451.als@iinet.net.au> On Tuesday 11 September 2007 09:32, Chandru wrote: > On 10/09/2007, Anthony Shipman wrote: > > I've found that I can do exit(Pid, shutdown) where Pid is a gen_server > > and it will nicely shut down, calling Mod:terminate. > > > > I can't see how this works. The server is not trapping exit signals so I > > would expect it to just exit without calling Mod:terminate. > > > > The code in gen_server:loop seems to be deliberately written to support > > this behaviour. Can we rely on it? > > This should not be possible. Can you post your code? If not, what > version of erlang are you using? The Mod:terminate function should > only be called if the gen_server is trapping exits. According to the > gen_server documentation; This appears to be a false alarm. A trap_exit has crept in to my server so it must be the cause of it working. I can't reproduce it without the trap_exit. -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From alceste@REDACTED Tue Sep 11 17:46:35 2007 From: alceste@REDACTED (Alceste Scalas) Date: Tue, 11 Sep 2007 17:46:35 +0200 Subject: [erlang-questions] FFI for Erlang: patches and draft EEP In-Reply-To: <46E6B073.6060407@hyber.org> References: <1189513745.8590.43.camel@gnatziu.crs4.it> <46E692A4.5040008@hyber.org> <1189518730.8590.71.camel@gnatziu.crs4.it> <46E6B073.6060407@hyber.org> Message-ID: <1189525595.8590.122.camel@gnatziu.crs4.it> Il giorno mar, 11/09/2007 alle 17.12 +0200, Claes Wikstrom ha scritto: > Alceste Scalas wrote: > > The current FFI implementation, taken alone, does *not* allow the > > C side to fiddle with the Erlang VM (e.g. by allocating binaries > > or other terms). > > My question was that I couldn't find any way for the C code > to return e.g. a string back to the erlang caller, a string > on the C side would then typically be represented as a binary() > on the erlang side. Well, I considered about adding a "string" type to the ones supported by the FFI extension. However, it would introduce some complications with returned strings: should the string data be copied in a binary? Or should the new binary point *directly* to the string data (if possible)? And in the latter case, how should the allocated memory be freed? And if the data is always copied, how to return string data? Maybe as a {StringBinary, OriginalPointer} tuple? In the current FFI implementation, strings are just pointers, and the caller should know what to do with them. A binary may be obtained from a string with a bit of Erlang and side-effects: StrPtr = ffi:call(Port, {give_me_a_string}, {pointer}), StrLen = ffi:call(Port, {strlen, StrPtr}, {size_t, pointer})+1, StrBin = <<0:StrLen>>, ffi:call(Port, {strcpy, StrBin, StrPtr}, {pointer,pointer,pointer}) Then the original StrPtr may be handled as needed. These 4 lines may be hidden in the depths of a library binding (so users would never care about them), and the complications on the FFI side are avoided. Alternative approaches and suggestions are welcome, of course (no, I don't like overwriting binaries, either :-) Regards, alceste -- Alceste Scalas CRS4 - http://www.crs4.it/ From klacke@REDACTED Tue Sep 11 18:11:04 2007 From: klacke@REDACTED (Claes Wikstrom) Date: Tue, 11 Sep 2007 18:11:04 +0200 Subject: [erlang-questions] FFI for Erlang: patches and draft EEP In-Reply-To: <1189525595.8590.122.camel@gnatziu.crs4.it> References: <1189513745.8590.43.camel@gnatziu.crs4.it> <46E692A4.5040008@hyber.org> <1189518730.8590.71.camel@gnatziu.crs4.it> <46E6B073.6060407@hyber.org> <1189525595.8590.122.camel@gnatziu.crs4.it> Message-ID: <46E6BE18.70203@hyber.org> Alceste Scalas wrote: > In the current FFI implementation, strings are just pointers, and the > caller should know what to do with them. A binary may be obtained from > a string with a bit of Erlang and side-effects: > > StrPtr = ffi:call(Port, {give_me_a_string}, {pointer}), > StrLen = ffi:call(Port, {strlen, StrPtr}, {size_t, pointer})+1, > StrBin = <<0:StrLen>>, > ffi:call(Port, {strcpy, StrBin, StrPtr}, > {pointer,pointer,pointer}) > ok - a bit ugly - but ok. /klacke From andre@REDACTED Mon Sep 10 15:29:33 2007 From: andre@REDACTED (Andre Nathan) Date: Mon, 10 Sep 2007 10:29:33 -0300 Subject: [erlang-questions] Code review request Message-ID: <1189430973.3637.14.camel@andre.mz.digirati.com.br> Hello This is my first post to the list. I hope it's ok to ask this here. I just wrote my first almost-non-trivial erlang program :) It creates a distributed graph (one node per process), and a simple flooding algorithm with feedback allows a node (triggered by an external message sent to that node) to count the number of nodes in the graph. The main code is in the "node" module, pasted here: http://pastie.caboo.se/95729 Since this is the first thing I write in erlang that isn't a tutorial example, it probably has parts that could be better written, so before implementing more stuff, it would be cool to get some advice or suggestions on how to improve this code. For example, I'm using a "state" record to avoid lots of parameter passing, but maybe there's a better solution. Also, I would like to move the code for this algorithm to a separate module for better organization, since the "node" code will become cluttered when I add more functionality. Is there anything there that could be rewritten in a more erlangish way? Thanks in advance, Andre From klacke@REDACTED Tue Sep 11 21:17:29 2007 From: klacke@REDACTED (=?ISO-8859-1?Q?Claes_Wikstr=F6m?=) Date: Tue, 11 Sep 2007 21:17:29 +0200 Subject: [erlang-questions] FFI for Erlang: patches and draft EEP In-Reply-To: <1189513745.8590.43.camel@gnatziu.crs4.it> References: <1189513745.8590.43.camel@gnatziu.crs4.it> Message-ID: <46E6E9C9.6060907@hyber.org> Alceste Scalas wrote: > Hello, > > some time ago [1] I asked for comments about extending Erlang/OTP with a > Foreign Function Interface (FFI) Next step here is obviously to make the OTP crew say thumbs up/down/later or anything on this. /klacke From ok@REDACTED Wed Sep 12 01:13:03 2007 From: ok@REDACTED (ok) Date: Wed, 12 Sep 2007 11:13:03 +1200 Subject: [erlang-questions] [Off-topic] Haskell type constructor syntax In-Reply-To: <46E5941A.40909@industrial-designers.co.uk> References: <46DC193D.10504@ericsson.com> <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> <46DD9105.4050901@cs.ntua.gr> <46E05F9D.9050108@bitfurnace.com> <46E068E9.5030809@cs.ntua.gr> <49BA939F-7E83-41B9-A1AC-87AD4672DC44@cs.otago.ac.nz> <46E5941A.40909@industrial-designers.co.uk> Message-ID: <4DF92C53-37FB-4AB2-B148-E9586D34F15D@cs.otago.ac.nz> On 11 Sep 2007, at 6:59 am, David Hopwood wrote: > ok wrote: >> On 8 Sep 2007, at 2:12 am, Tony Finch wrote: >>> I'd suggest using initial caps for type names, and omit the () >>> except >>> when the type parameter is non-trivial. (That is somewhat like the >>> Haskell type syntax.) >> >> It would be more accurate to describe it as "as unlike the Haskell >> syntax as possible". Haskell uses the same conventions for type >> (constructors/variables) as for data (constructors/variables), so to >> be close to Haskell syntax, you have to use the same spelling for >> type constructors as you do for constants, namely, LOWER case. > > You're mistaken about Haskell syntax -- it does use initial > uppercase for type constructors. How can I be mistaken about that when THAT'S WHAT I SAID? Haskell uses the same convention for type variables as for data variables: initial lower case. To follow Haskell *principles*, Erlang type variables (should it have any) would use the same convention as Erlang data variables, namely initial capital letters. Haskell uses the same convention for type constructors as for data constructors. It uses initial capitals for both. To follow the Haskell *principles* then, one would have to use the same convention for Erlang type constructors as for Erlang data constructors (= atoms), which is initial lower case. From david.hopwood@REDACTED Wed Sep 12 02:10:22 2007 From: david.hopwood@REDACTED (David Hopwood) Date: Wed, 12 Sep 2007 01:10:22 +0100 Subject: [erlang-questions] [Off-topic] Haskell type constructor syntax In-Reply-To: <4DF92C53-37FB-4AB2-B148-E9586D34F15D@cs.otago.ac.nz> References: <46DC193D.10504@ericsson.com> <837db430709030939k6843ce47q15cb2f1795fd8929@mail.gmail.com> <837db430709040623w2890fd90ycb13bfc70364e1f1@mail.gmail.com> <46DD7879.6090009@cs.ntua.gr> <337538cb0709040850p260c9ac7gd90acb8b55a6416a@mail.gmail.com> <46DD9105.4050901@cs.ntua.gr> <46E05F9D.9050108@bitfurnace.com> <46E068E9.5030809@cs.ntua.gr> <49BA939F-7E83-41B9-A1AC-87AD4672DC44@cs.otago.ac.nz> <46E5941A.40909@industrial-designers.co.uk> <4DF92C53-37FB-4AB2-B148-E9586D34F15D@cs.otago.ac.nz> Message-ID: <46E72E6E.3090608@industrial-designers.co.uk> ok wrote: > On 11 Sep 2007, at 6:59 am, David Hopwood wrote: >> ok wrote: >>> On 8 Sep 2007, at 2:12 am, Tony Finch wrote: >>>> I'd suggest using initial caps for type names, and omit the () >>>> except >>>> when the type parameter is non-trivial. (That is somewhat like the >>>> Haskell type syntax.) >>> It would be more accurate to describe it as "as unlike the Haskell >>> syntax as possible". Haskell uses the same conventions for type >>> (constructors/variables) as for data (constructors/variables), so to >>> be close to Haskell syntax, you have to use the same spelling for >>> type constructors as you do for constants, namely, LOWER case. >> You're mistaken about Haskell syntax -- it does use initial >> uppercase for type constructors. > > How can I be mistaken about that when THAT'S WHAT I SAID? I misinterpreted what you said. Sorry for the noise. -- David Hopwood From bbmaj7@REDACTED Wed Sep 12 02:04:48 2007 From: bbmaj7@REDACTED (Richard Andrews) Date: Wed, 12 Sep 2007 10:04:48 +1000 (EST) Subject: [erlang-questions] Code review request In-Reply-To: <1189430973.3637.14.camel@andre.mz.digirati.com.br> Message-ID: <86869.41807.qm@web52004.mail.re2.yahoo.com> --- Andre Nathan wrote: > Is there anything there that could be rewritten in a more erlangish way? I think this might be suited to a trapexit.org forum discussion. That would allow the resulting critique to be available for future newbies and be searchable via google etc. rather than languishing in some inbox. I'm relatively new to erlang and I think it would be useful to have such a critique online so intermediate level developers can learn the *why* of erlang best-practices and get exposure to new syntax tricks and patterns that don't appear in the getting-started level tutorials. ____________________________________________________________________________________ Sick of deleting your inbox? Yahoo!7 Mail has free unlimited storage. http://au.docs.yahoo.com/mail/unlimitedstorage.html From saleyn@REDACTED Wed Sep 12 05:47:22 2007 From: saleyn@REDACTED (Serge Aleynikov) Date: Tue, 11 Sep 2007 22:47:22 -0500 Subject: [erlang-questions] : now/0 resolution In-Reply-To: <20070911072837.GC19266@erix.ericsson.se> References: <46E142C6.9010804@gmail.com> <20070910112642.GB27329@erix.ericsson.se> <46E60232.6020708@gmail.com> <20070911072837.GC19266@erix.ericsson.se> Message-ID: <46E7614A.1070808@gmail.com> Raimo Niskanen wrote: >> So far I've been using successive now/0 calls in selected parts of >> function to measure execution times. Doesn't the call trace slow down >> execution? > > So does calls to now/0. If the number of call trace messages is the same > as the number of calls to now/0, I do not know which is more expensive. > I was thinking to measure the time for a call you could set > trace flags [call,arity,timestamp] on the process and trace pattern > [{'_',[],[{return_trace}]}] on the function to time to conveniently > get the entry and exit time. This could be combined with trace > flag cpu_timestamp on 'all' processes. This seems like a good way to profile function calls, however, I just need to record processing time together with incoming data packets coming at a very high rate (20-60k msgs/s). I looked at implementation of now/0 and it indeed calls the HR timer, but the call is protected by a mutex, which adds some overhead to the call. I guess this is done so that now/0 can safely return incrementing values on consecutive calls with SMP (this perhaps could be optimized using atomic increment). It still seems to me that for packet latency analysis it would be helpful if HR timer was directly exposed as a BIF. >> If I wanted to take advantage of the hr timer in a linked-in driver >> which function would you recommend to call? > > I do not know. We use gethrvtime() on Solaris but can not find what > we use on Linux. If erlang:trace(all, true, [cpu_timestamp]) does > not badarg, the emulator has found a high resolution timer. I examined the sources and using your hint found that HR timer is utilized on Linux via clock_gettime() OS call. Serge From per@REDACTED Wed Sep 12 08:11:39 2007 From: per@REDACTED (Per Hedeland) Date: Wed, 12 Sep 2007 08:11:39 +0200 (CEST) Subject: [erlang-questions] Message-sending performance In-Reply-To: <27ED2853-3147-42A9-A8C2-2F86E5A7B097@ketralnis.com> Message-ID: <200709120611.l8C6Bd4o013233@pluto.hedeland.org> David King wrote: > >For 100,000 messages, it's now instantaneous when accepting them out >of order. Now there doesn't appear to be a difference between one >scheduler or two until approximately 100,000,000 messages. Maybe just a nitpick, but you aren't receiving the messages "out of order", only interleaved - i.e. between each sender-receiver pair of processes, messages are received in the order they were sent. You would get approximately the same result if you via selective receive first accepted message 1 from all senders, then message 2 from all, and so on - your problem earlier was that you insisted on receiving *all* messages from one process before accepting *any* from the other, causing the latter to be queued up in your message queue. --Per Hedeland From alceste@REDACTED Wed Sep 12 09:21:45 2007 From: alceste@REDACTED (Alceste Scalas) Date: Wed, 12 Sep 2007 09:21:45 +0200 Subject: [erlang-questions] Strings, buffers and FFI calls In-Reply-To: <46E6BE18.70203@hyber.org> References: <1189513745.8590.43.camel@gnatziu.crs4.it> <46E692A4.5040008@hyber.org> <1189518730.8590.71.camel@gnatziu.crs4.it> <46E6B073.6060407@hyber.org> <1189525595.8590.122.camel@gnatziu.crs4.it> <46E6BE18.70203@hyber.org> Message-ID: <1189581705.6081.17.camel@gnatziu.crs4.it> Il giorno mar, 11/09/2007 alle 18.11 +0200, Claes Wikstrom ha scritto: > Alceste Scalas wrote: > > In the current FFI implementation, strings are just pointers, and the > > caller should know what to do with them. A binary may be obtained from > > a string with a bit of Erlang and side-effects: > > > > StrPtr = ffi:call(Port, {give_me_a_string}, {pointer}), > > StrLen = ffi:call(Port, {strlen, StrPtr}, {size_t, pointer})+1, > > StrBin = <<0:StrLen>>, > > ffi:call(Port, {strcpy, StrBin, StrPtr}, {pointer,pointer,pointer}) > > ok - a bit ugly - but ok. Well, thinking more about it, it's ugly enough to be avoided whenever possible --- and since strings and buffers are quite a common return type, some support should definitely exist. Here are some ideas (their implementation would be trivial): 'cstring' type for FFI calls: * when used for function arguments, it would work like 'pointer'; * when used as function return type, it would cause the FFI call to return a {StringBin, StringPtr} tuple, where: * StringBin is a binary() containing a *copy* of the string (with the trailing \0); * StringPtr is an integer with the string pointer (as returned by the C call). These two auxiliary BIFs could also be very useful: * ffi:cstring_to_binary(StringPtr) would return a new binary() with a copy of the given NULL-terminated string (including the trailing \0); * ffi:pointer_to_binary(Pointer, Size) would return a new binary() with a copy of Size bytes read from Pointer. These additions would give an easier and functional interface for handling strings and buffers --- but at the same time, the original pointers would be available when needed. What do you think? Regards, alceste -- Alceste Scalas CRS4 - http://www.crs4.it/ From mbj@REDACTED Wed Sep 12 09:27:53 2007 From: mbj@REDACTED (Martin Bjorklund) Date: Wed, 12 Sep 2007 09:27:53 +0200 (CEST) Subject: [erlang-questions] FFI for Erlang: patches and draft EEP In-Reply-To: <1189513745.8590.43.camel@gnatziu.crs4.it> References: <1189513745.8590.43.camel@gnatziu.crs4.it> Message-ID: <20070912.092753.231649494.mbj@tail-f.com> Alceste Scalas wrote: > Hello, > > some time ago [1] I asked for comments about extending Erlang/OTP with a > Foreign Function Interface (FFI) --- i.e. some new BIFs for calling > external C code, with automatic Erlang/C type translations. The > response was pretty good. > > After some cleanup, testing and bugfixing (and vacations...), I've > prepared a draft EEP (Erlang Enhancement Proposal) and a series of > patches that implement the proposal. Everything is available at the > following URL: > > http://muvara.org/crs4/erlang/ffi > > The implementation is based on OTP R11B-5, and has been tested on i386 > and x86_64 (on GNU/Linux). A simple test suite is also available. > > Comments, bug reports and patches are more than welcome. Have fun! Very nice work!! Let's hope the OTP maintainers can be convinced to have a look at this. /martin From raimo+erlang-questions@REDACTED Wed Sep 12 09:42:08 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Wed, 12 Sep 2007 09:42:08 +0200 Subject: [erlang-questions] hrtime/0, Was: now/0 resolution In-Reply-To: <46E142C6.9010804@gmail.com> References: <46E142C6.9010804@gmail.com> Message-ID: <20070912074208.GA8189@erix.ericsson.se> So, to conclude this thread, there is no much better way today. Call trace may in some cases be more convenient but not much more efficient and has no better precision. New question: Serge apparently want a new BIF e.g hrtime/0 that would return the best high resolution time the implementation knows on the running OS. The precision would be OS dependant, but the best known to the emulator, and it would be the fastest way to get it. This BIF could also be suitable for getting high resolution CPU time as well as wallclock time. How much interest for such a BIF is there from the community? This would perhaps better be asked for in an EEP, but this is a first poll. Came to think about it. The current suggestion for FFI (Forein Function Interface) could be used to call the OS high resolution time functions, but then you would have to know the right call on every OS, and I do not know how efficient that call interface would be. On Fri, Sep 07, 2007 at 07:23:34AM -0500, Serge Aleynikov wrote: > Since according to documentation consecutive executions of now/0 will > return different values (with microsecond precision) I have two questions: > > 1. Does it mean that inserting now/0 calls in code will slow down > execution to 1mks per execution? If not, then performance of function > call measured using now/0 time stamping would be inaccurate. > > 2. Is it possible to measure execution time more accurately (with > nanosecond precision) using current Erlang distribution? (*) > > Serge > > (*) Since VM uses gettimeofday() to bump timer, it's limited by > getimeofday's precision. Additionally each invocation of gettimeofday > takes about 15mks (OS dependent). I believe that there's no code to > take advantage of a high resolution timer. Such a timer can give > nanosecond precision, and presently the only way it can be implemented > is in a linked-in driver. The only problem that calling functions > inside the driver with erlang:port_call/3 incurs some cost that would be > better to avoid if a bif (such as hrnow/0) was available. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From erik.stenman@REDACTED Wed Sep 12 10:23:18 2007 From: erik.stenman@REDACTED (Erik Stenman) Date: Wed, 12 Sep 2007 10:23:18 +0200 Subject: [erlang-questions] hrtime/0, Was: now/0 resolution In-Reply-To: <20070912074208.GA8189@erix.ericsson.se> References: <46E142C6.9010804@gmail.com> <20070912074208.GA8189@erix.ericsson.se> Message-ID: There is support in Hipe for accessing performance counters in the CPU. These has been used to great advantage while benchmarking and finding bottlenecks in HiPE. Take a look at erts/emulator/hipe/hipe_perfctr.c Perhaps it is time to make them official... /Erik On 12 sep 2007, at 09.42, Raimo Niskanen wrote: > So, to conclude this thread, there is no much better way today. > Call trace may in some cases be more convenient but not > much more efficient and has no better precision. > > New question: > > Serge apparently want a new BIF e.g hrtime/0 that would return > the best high resolution time the implementation knows on the > running OS. The precision would be OS dependant, but the best > known to the emulator, and it would be the fastest way to get it. > This BIF could also be suitable for getting high resolution > CPU time as well as wallclock time. > > How much interest for such a BIF is there from the community? > > This would perhaps better be asked for in an EEP, but > this is a first poll. > > > > Came to think about it. The current suggestion for FFI > (Forein Function Interface) could be used to call the OS > high resolution time functions, but then you would have > to know the right call on every OS, and I do not know > how efficient that call interface would be. > > > > On Fri, Sep 07, 2007 at 07:23:34AM -0500, Serge Aleynikov wrote: >> Since according to documentation consecutive executions of now/0 will >> return different values (with microsecond precision) I have two >> questions: >> >> 1. Does it mean that inserting now/0 calls in code will slow down >> execution to 1mks per execution? If not, then performance of >> function >> call measured using now/0 time stamping would be inaccurate. >> >> 2. Is it possible to measure execution time more accurately (with >> nanosecond precision) using current Erlang distribution? (*) >> >> Serge >> >> (*) Since VM uses gettimeofday() to bump timer, it's limited by >> getimeofday's precision. Additionally each invocation of >> gettimeofday >> takes about 15mks (OS dependent). I believe that there's no code to >> take advantage of a high resolution timer. Such a timer can give >> nanosecond precision, and presently the only way it can be >> implemented >> is in a linked-in driver. The only problem that calling functions >> inside the driver with erlang:port_call/3 incurs some cost that >> would be >> better to avoid if a bif (such as hrnow/0) was available. >> >> _______________________________________________ >> 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 alceste@REDACTED Wed Sep 12 10:39:30 2007 From: alceste@REDACTED (Alceste Scalas) Date: Wed, 12 Sep 2007 10:39:30 +0200 Subject: [erlang-questions] hrtime/0, Was: now/0 resolution In-Reply-To: <20070912074208.GA8189@erix.ericsson.se> References: <46E142C6.9010804@gmail.com> <20070912074208.GA8189@erix.ericsson.se> Message-ID: <1189586370.6081.41.camel@gnatziu.crs4.it> Il giorno mer, 12/09/2007 alle 09.42 +0200, Raimo Niskanen ha scritto: > Serge apparently want a new BIF e.g hrtime/0 that would return > the best high resolution time the implementation knows on the > running OS. The precision would be OS dependant, but the best > known to the emulator, and it would be the fastest way to get it. > This BIF could also be suitable for getting high resolution > CPU time as well as wallclock time. > > How much interest for such a BIF is there from the community? I would be interested in it. > Came to think about it. The current suggestion for FFI > (Forein Function Interface) could be used to call the OS > high resolution time functions, but then you would have > to know the right call on every OS, and I do not know > how efficient that call interface would be. It mostly depends on the number of function call arguments, because the proposed FFI BIFs must perform type checking and conversion. Of course, it would be possible to wrap the native clock function so it takes no (or less) arguments. But, as an example, the POSIX clock_gettime() writes its result in a struct timespec, and one would need to write some accessor functions (in C) in order to get its fields. Otherwise, the struct could be copied (or written, if you're brave) into an Erlang binary, that in turn should be matched into a couple of Erlang integers (for seconds and microseconds). If clock resolution and precision are needed, then I think it's definitely too much work. A dedicated BIF would be required IMHO. Regards, alceste -- Alceste Scalas CRS4 - http://www.crs4.it/ From alceste@REDACTED Wed Sep 12 10:54:41 2007 From: alceste@REDACTED (Alceste Scalas) Date: Wed, 12 Sep 2007 10:54:41 +0200 Subject: [erlang-questions] sizeof() FFI types In-Reply-To: <1189581705.6081.17.camel@gnatziu.crs4.it> References: <1189513745.8590.43.camel@gnatziu.crs4.it> <46E692A4.5040008@hyber.org> <1189518730.8590.71.camel@gnatziu.crs4.it> <46E6B073.6060407@hyber.org> <1189525595.8590.122.camel@gnatziu.crs4.it> <46E6BE18.70203@hyber.org> <1189581705.6081.17.camel@gnatziu.crs4.it> Message-ID: <1189587281.6081.55.camel@gnatziu.crs4.it> Il giorno mer, 12/09/2007 alle 09.21 +0200, Alceste Scalas ha scritto: > * ffi:pointer_to_binary(Pointer, Size) would return a new binary() > with a copy of Size bytes read from Pointer. Well, one may even want to use the data inside the new binary --- and if it represents a struct or some other complex data type, one may need to know the sizes of the C basic types in order to perform binary matching. This additional BIF may be useful: * ffi:sizeof(CType): return the number of bytes used by CType on the current platform. CType is one of the supported FFI type atoms. Summing up, this email and the previous one contain the following additions to the Erlang/OTP FFI proposal available on http://muvara.org/crs4/erlang/ffi/ : * 'cstring' FFI type * ffi:cstring_to_binary/1 BIF * ffi:pointer_to_binary/2 BIF * ffi:sizeof/1 BIF Based on your feedback, I'll add a patch and update the draft EEP. Regards, alceste -- Alceste Scalas CRS4 - http://www.crs4.it/ From mikpe@REDACTED Wed Sep 12 11:22:07 2007 From: mikpe@REDACTED (Mikael Pettersson) Date: Wed, 12 Sep 2007 11:22:07 +0200 (MEST) Subject: [erlang-questions] hrtime/0, Was: now/0 resolution Message-ID: <200709120922.l8C9M70L028376@harpo.it.uu.se> On Wed, 12 Sep 2007 09:42:08 +0200, Raimo Niskanen wrote: > Serge apparently want a new BIF e.g hrtime/0 that would return > the best high resolution time the implementation knows on the > running OS. The precision would be OS dependant, but the best > known to the emulator, and it would be the fastest way to get it. > This BIF could also be suitable for getting high resolution > CPU time as well as wallclock time. > > How much interest for such a BIF is there from the community? Please clarify: do you propose hrtime (high-res actual time) or hrvtime (high-res virtual time). The latter is very useful for benchmarking, and HiPE in fact has a private BIF for it but only for a few non-standard Linux system. /Mikael From mikpe@REDACTED Wed Sep 12 11:26:13 2007 From: mikpe@REDACTED (Mikael Pettersson) Date: Wed, 12 Sep 2007 11:26:13 +0200 (MEST) Subject: [erlang-questions] hrtime/0, Was: now/0 resolution Message-ID: <200709120926.l8C9QDRg028396@harpo.it.uu.se> On Wed, 12 Sep 2007 10:23:18 +0200, Erik Stenman wrote: > There is support in Hipe for accessing performance counters in the CPU. > These has been used to great advantage while benchmarking and finding > bottlenecks in HiPE. > Take a look at > erts/emulator/hipe/hipe_perfctr.c > Perhaps it is time to make them official... Useful or not, that interface is far too low-level, OS-specific (Linux + my perfctr extension), and non-standard (no vanilla and very few vendor kernels include it) to be made official. For most users a simple hrvtime/0 BIF should suffice. /Mikael From raimo+erlang-questions@REDACTED Wed Sep 12 15:33:41 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Wed, 12 Sep 2007 15:33:41 +0200 Subject: [erlang-questions] : hrtime/0, Was: now/0 resolution In-Reply-To: <200709120922.l8C9M70L028376@harpo.it.uu.se> References: <200709120922.l8C9M70L028376@harpo.it.uu.se> Message-ID: <20070912133341.GA14625@erix.ericsson.se> On Wed, Sep 12, 2007 at 11:22:07AM +0200, Mikael Pettersson wrote: > On Wed, 12 Sep 2007 09:42:08 +0200, Raimo Niskanen wrote: > > Serge apparently want a new BIF e.g hrtime/0 that would return > > the best high resolution time the implementation knows on the > > running OS. The precision would be OS dependant, but the best > > known to the emulator, and it would be the fastest way to get it. > > This BIF could also be suitable for getting high resolution > > CPU time as well as wallclock time. > > > > How much interest for such a BIF is there from the community? > > Please clarify: do you propose hrtime (high-res actual time) > or hrvtime (high-res virtual time). The latter is very useful > for benchmarking, and HiPE in fact has a private BIF for it > but only for a few non-standard Linux system. > I guess both. Actual time is more essential, but virtual time (CPU time) often more useful. Either two BIFs or a BIB with an option. > /Mikael -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From dbt@REDACTED Wed Sep 12 15:38:49 2007 From: dbt@REDACTED (David Terrell) Date: Wed, 12 Sep 2007 08:38:49 -0500 Subject: [erlang-questions] What is wrong with this list? In-Reply-To: <46DDBA87.5020901@industrial-designers.co.uk> References: <764345.64386.qm@web51101.mail.re2.yahoo.com> <2D4C450E-36A4-4956-881F-518812719F4A@spy.net> <46DDBA87.5020901@industrial-designers.co.uk> Message-ID: <20070912133849.GB1857@sphinx.chicagopeoplez.org> On Tue, Sep 04, 2007 at 09:05:27PM +0100, David Hopwood wrote: > Hmm -- aren't improper lists almost always an error? Why are they allowed? > (Static typing isn't needed to prevent them, and the performance argument > against checking that each tail is a cons cell or nil is weak; it is an > O(1) tag check that can often be optimized out.) This was fresh enough in my mind that when I recently solved a problem I was having, I wanted to come back and mention it. here's an example of a valid, and useful, 'improper' list: MatchPattern = [Key1, Key2 | '_']. -- David Terrell dbt@REDACTED ((meatspace)) http://meat.net/ From raimo+erlang-questions@REDACTED Wed Sep 12 17:12:49 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Wed, 12 Sep 2007 17:12:49 +0200 Subject: [erlang-questions] FFI for Erlang: patches and draft EEP In-Reply-To: <1189513745.8590.43.camel@gnatziu.crs4.it> References: <1189513745.8590.43.camel@gnatziu.crs4.it> Message-ID: <20070912151249.GB15193@erix.ericsson.se> Hi! Your EEP has been accepted as EEP 7. (Despite the fact it was not submitted to ees@REDACTED :-) Anyone interested in the progress or wanting to participate in discussions (for this or other EEPs) should subscribe to the eeps@REDACTED mailing list. I made two changes: 1: removed the "for Erlang/OTP" tail from the title, 2: changed the document type to text/x-rst since it did not build. On Tue, Sep 11, 2007 at 02:29:05PM +0200, Alceste Scalas wrote: > Hello, > > some time ago [1] I asked for comments about extending Erlang/OTP with a > Foreign Function Interface (FFI) --- i.e. some new BIFs for calling > external C code, with automatic Erlang/C type translations. The > response was pretty good. > > After some cleanup, testing and bugfixing (and vacations...), I've > prepared a draft EEP (Erlang Enhancement Proposal) and a series of > patches that implement the proposal. Everything is available at the > following URL: > > http://muvara.org/crs4/erlang/ffi > > The implementation is based on OTP R11B-5, and has been tested on i386 > and x86_64 (on GNU/Linux). A simple test suite is also available. > > Comments, bug reports and patches are more than welcome. Have fun! > > Regards, > > alceste > > P.S.: the URL above is temporary, and will redirect on www.crs4.it > when some technical issues are resolved. > > Notes: > > [1] First discussion about the Erlang FFI proposal: > http://www.erlang.org/pipermail/erlang-questions/2007-August/028346.html > > -- > Alceste Scalas > CRS4 - http://www.crs4.it/ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From peter@REDACTED Wed Sep 12 17:47:09 2007 From: peter@REDACTED (Peter K Chan) Date: Wed, 12 Sep 2007 17:47:09 +0200 Subject: [erlang-questions] list:join() for erlang? Message-ID: I looked around and I couldn't find a list:join() implementation for erlang. Is this intentional? The join function seems to be a useful feature to have. I ended up writing my own version, which was simple enough; but it would be even better if it is available as a BIF. Peter From igwan@REDACTED Wed Sep 12 18:18:36 2007 From: igwan@REDACTED (igwan) Date: Wed, 12 Sep 2007 18:18:36 +0200 Subject: [erlang-questions] list:join() for erlang? In-Reply-To: References: Message-ID: <46E8115C.8000602@free.fr> It does exist : erlang:'++'/2 and the corresponding syntactic sugar : 1> [a,b,c] ++ [d,e,f]. [a,b,c,d,e,f] -igwan Peter K Chan a ?crit : > I looked around and I couldn't find a list:join() implementation for > erlang. Is this intentional? The join function seems to be a useful > feature to have. > > I ended up writing my own version, which was simple enough; but it would > be even better if it is available as a BIF. > > Peter > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From igwan@REDACTED Wed Sep 12 18:32:45 2007 From: igwan@REDACTED (igwan) Date: Wed, 12 Sep 2007 18:32:45 +0200 Subject: [erlang-questions] list:join() for erlang? In-Reply-To: References: <46E8115C.8000602@free.fr> Message-ID: <46E814AD.2060308@free.fr> If you're working with filenames, there exists filename:join/1 I don't know of a function in OTP that takes an arbitrary separator though. igwan Peter K Chan a ?crit : > Sorry that I made an omission. > > I was referring to the variant of join which takes a separator. For example: lists:join("abc", "/"), which evaluates to "a/b/c". > > Do you know if something like this exists in the distribution? > > Peter > > -----Original Message----- > From: igwan [mailto:igwan@REDACTED] > Sent: Wednesday, September 12, 2007 11:19 AM > To: Peter K Chan > Cc: erlang-questions@REDACTED > Subject: Re: [erlang-questions] list:join() for erlang? > > It does exist : > > erlang:'++'/2 > > and the corresponding syntactic sugar : > > 1> [a,b,c] ++ [d,e,f]. > [a,b,c,d,e,f] > > > -igwan > > Peter K Chan a ?crit : > >> I looked around and I couldn't find a list:join() implementation for >> erlang. Is this intentional? The join function seems to be a useful >> feature to have. >> >> I ended up writing my own version, which was simple enough; but it would >> be even better if it is available as a BIF. >> >> Peter >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> > > From peter@REDACTED Wed Sep 12 18:26:15 2007 From: peter@REDACTED (Peter K Chan) Date: Wed, 12 Sep 2007 18:26:15 +0200 Subject: [erlang-questions] list:join() for erlang? In-Reply-To: <46E8115C.8000602@free.fr> References: <46E8115C.8000602@free.fr> Message-ID: Sorry that I made an omission. I was referring to the variant of join which takes a separator. For example: lists:join("abc", "/"), which evaluates to "a/b/c". Do you know if something like this exists in the distribution? Peter -----Original Message----- From: igwan [mailto:igwan@REDACTED] Sent: Wednesday, September 12, 2007 11:19 AM To: Peter K Chan Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] list:join() for erlang? It does exist : erlang:'++'/2 and the corresponding syntactic sugar : 1> [a,b,c] ++ [d,e,f]. [a,b,c,d,e,f] -igwan Peter K Chan a ?crit : > I looked around and I couldn't find a list:join() implementation for > erlang. Is this intentional? The join function seems to be a useful > feature to have. > > I ended up writing my own version, which was simple enough; but it would > be even better if it is available as a BIF. > > Peter > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From dbudworth@REDACTED Wed Sep 12 18:56:02 2007 From: dbudworth@REDACTED (David Budworth) Date: Wed, 12 Sep 2007 11:56:02 -0500 Subject: [erlang-questions] list:join() for erlang? In-Reply-To: <46E8115C.8000602@free.fr> References: <46E8115C.8000602@free.fr> Message-ID: <2e23d1d20709120956j2560e019wd6a1d702c33bb277@mail.gmail.com> i'm guessing they mean join in the scripting language sense which is more for creating CSV type strings. ie (fictional function): "I,Like,Erlang" = lists:join(["I","Like","Erlang"],",") so join/2 would be something like (newbie alert, just started learning erlang, so excuse the (possibly) bad code): join([First|Rest],JoinWith) -> lists:flatten( [First] ++ [ JoinWith ++ X || X <- Rest] ). calling join(["A","B","C"],"+") would result in "A+B+C" On 9/12/07, igwan wrote: > > It does exist : > > erlang:'++'/2 > > and the corresponding syntactic sugar : > > 1> [a,b,c] ++ [d,e,f]. > [a,b,c,d,e,f] > > > -igwan > > Peter K Chan a ?crit : > > I looked around and I couldn't find a list:join() implementation for > > erlang. Is this intentional? The join function seems to be a useful > > feature to have. > > > > I ended up writing my own version, which was simple enough; but it would > > be even better if it is available as a BIF. > > > > Peter > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tty.erlang@REDACTED Wed Sep 12 19:29:21 2007 From: tty.erlang@REDACTED (t ty) Date: Wed, 12 Sep 2007 13:29:21 -0400 Subject: [erlang-questions] list:join() for erlang? In-Reply-To: <2e23d1d20709120956j2560e019wd6a1d702c33bb277@mail.gmail.com> References: <46E8115C.8000602@free.fr> <2e23d1d20709120956j2560e019wd6a1d702c33bb277@mail.gmail.com> Message-ID: <290b3ba10709121029u64f80b3ckafa4f0a9c2659ca1@mail.gmail.com> I have 4 versions of this variant in my application source base: from tsung, yaws, oserl and one written in house. I definitely vote to have this in either string or lists. t On 9/12/07, David Budworth wrote: > i'm guessing they mean join in the scripting language sense which is more > for creating CSV type strings. > > ie (fictional function): > "I,Like,Erlang" = lists:join(["I","Like","Erlang"],",") > > so join/2 would be something like (newbie alert, just started learning > erlang, so excuse the (possibly) bad code): > > join([First|Rest],JoinWith) -> > lists:flatten( [First] ++ [ JoinWith ++ X || X <- Rest] ). > > calling join(["A","B","C"],"+") > would result in "A+B+C" > > > > On 9/12/07, igwan < igwan@REDACTED> wrote: > > It does exist : > > > > erlang:'++'/2 > > > > and the corresponding syntactic sugar : > > > > 1> [a,b,c] ++ [d,e,f]. > > [a,b,c,d,e,f] > > > > > > -igwan > > > > Peter K Chan a ?crit : > > > I looked around and I couldn't find a list:join() implementation for > > > erlang. Is this intentional? The join function seems to be a useful > > > feature to have. > > > > > > I ended up writing my own version, which was simple enough; but it would > > > be even better if it is available as a BIF. > > > > > > Peter > > > _______________________________________________ > > > 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 vances@REDACTED Wed Sep 12 19:31:54 2007 From: vances@REDACTED (Vance Shipley) Date: Wed, 12 Sep 2007 13:31:54 -0400 Subject: [erlang-questions] Code review request In-Reply-To: <86869.41807.qm@web52004.mail.re2.yahoo.com> References: <1189430973.3637.14.camel@andre.mz.digirati.com.br> <86869.41807.qm@web52004.mail.re2.yahoo.com> Message-ID: <20070912173154.GA31990@frogman.motivity.ca> On Wed, Sep 12, 2007 at 10:04:48AM +1000, Richard Andrews wrote: } I think this might be suited to a trapexit.org forum discussion. That would } allow the resulting critique to be available for future newbies and be } searchable via google etc. rather than languishing in some inbox. The erlang list is archived and searchable: http://www.erlang.org/faq.html. The forum will always have a much smaller audience. -Vance From dking@REDACTED Wed Sep 12 19:51:25 2007 From: dking@REDACTED (David King) Date: Wed, 12 Sep 2007 10:51:25 -0700 Subject: [erlang-questions] list:join() for erlang? In-Reply-To: <2e23d1d20709120956j2560e019wd6a1d702c33bb277@mail.gmail.com> References: <46E8115C.8000602@free.fr> <2e23d1d20709120956j2560e019wd6a1d702c33bb277@mail.gmail.com> Message-ID: <7DF5FA7D-C1F8-4864-8AA7-FA1F97ACD32A@ketralnis.com> > i'm guessing they mean join in the scripting language sense which > is more for creating CSV type strings. > ie (fictional function): > "I,Like,Erlang" = lists:join(["I","Like","Erlang"],",") > so join/2 would be something like (newbie alert, just started > learning erlang, so excuse the (possibly) bad code): > join([First|Rest],JoinWith) -> > lists:flatten( [First] ++ [ JoinWith ++ X || X <- Rest] ). > calling join(["A","B","C"],"+") > would result in "A+B+C" (Same learning-warning as above) List concatenations involve building new lists, which involves copying the old ones. A better idea is probably to build one that returns an iolist (since if you're building a string, you're probably using it for io anyway), like this: join([ Head | [] ], _Sep) -> [Head]; join([ Head | Rest], Sep) -> [Head,Sep | join(Rest,Sep) ]. util:join(["I","Like","Erlang"],"_") = ["I","_","Like","_","Erlang"]. You can always use lists:flatten/1 or erlang:iolist_to_binary/1 if you need it flattened That could maybe be optimised further to be tail-recursive using an accumulator, but it doesn't involve building an entire list for every entry > > > On 9/12/07, igwan < igwan@REDACTED> wrote:It does exist : > > erlang:'++'/2 > > and the corresponding syntactic sugar : > > 1> [a,b,c] ++ [d,e,f]. > [a,b,c,d,e,f] > > > -igwan > > Peter K Chan a ?crit : > > I looked around and I couldn't find a list:join() implementation for > > erlang. Is this intentional? The join function seems to be a useful > > feature to have. > > > > I ended up writing my own version, which was simple enough; but > it would > > be even better if it is available as a BIF. > > > > Peter > > _______________________________________________ > > 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 hokan.stenholm@REDACTED Wed Sep 12 20:09:48 2007 From: hokan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Wed, 12 Sep 2007 20:09:48 +0200 Subject: [erlang-questions] list:join() for erlang? In-Reply-To: <46E8115C.8000602@free.fr> References: <46E8115C.8000602@free.fr> Message-ID: <46E82B6C.6070007@bredband.net> igwan wrote: > It does exist : > > erlang:'++'/2 > which is the same as lists:append/2. lists:append/1 (append list of lists) may also be of interest, as well as lists:flatten/1 that can be used like lists:append/1, but also to flatten deeper list structures. > and the corresponding syntactic sugar : > > 1> [a,b,c] ++ [d,e,f]. > [a,b,c,d,e,f] > > > -igwan > > Peter K Chan a ?crit : > >> I looked around and I couldn't find a list:join() implementation for >> erlang. Is this intentional? The join function seems to be a useful >> feature to have. >> >> I ended up writing my own version, which was simple enough; but it would >> be even better if it is available as a BIF. >> >> Peter >> _______________________________________________ >> 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 joshuajnoble@REDACTED Wed Sep 12 20:14:30 2007 From: joshuajnoble@REDACTED (Josh Noble) Date: Wed, 12 Sep 2007 15:14:30 -0300 Subject: [erlang-questions] question about node spawning Message-ID: <22099a270709121114w5720cccfjd744dd5d550c96f2@mail.gmail.com> Hi, please let me know if this is off-topic or could be handled somewhere else better, but I figured I'd throw it up here and see what happens. When I initialize a process like: erl -sname base I get this: (base@REDACTED) which throws errors when I try to run the "multiple processes on localhost" example from ch. 10 of the Programming Erlang book because the rpc chokes on the 'cpe-190-55-115-44'. I'm not sure why this is happening, but if anyone has any advice on how to configure processes when they're spawned a little better. I can of course just do erl -sname base@REDACTED and it's fine. I'm just wondering why the default spawning is a little strange. Thanks, Josh -- Joshua Noble http://thefactoryfactory.com From dbt@REDACTED Wed Sep 12 20:27:28 2007 From: dbt@REDACTED (David Terrell) Date: Wed, 12 Sep 2007 13:27:28 -0500 Subject: [erlang-questions] list:join() for erlang? In-Reply-To: <7DF5FA7D-C1F8-4864-8AA7-FA1F97ACD32A@ketralnis.com> References: <46E8115C.8000602@free.fr> <2e23d1d20709120956j2560e019wd6a1d702c33bb277@mail.gmail.com> <7DF5FA7D-C1F8-4864-8AA7-FA1F97ACD32A@ketralnis.com> Message-ID: <20070912182728.GC1857@sphinx.chicagopeoplez.org> On Wed, Sep 12, 2007 at 10:51:25AM -0700, David King wrote: > A better idea is probably to build one that returns an iolist (since > if you're building a string, you're probably using it for io anyway), > like this: > > join([ Head | [] ], _Sep) -> > [Head]; > join([ Head | Rest], Sep) -> > [Head,Sep | join(Rest,Sep) ]. > > util:join(["I","Like","Erlang"],"_") = ["I","_","Like","_","Erlang"]. > > You can always use lists:flatten/1 or erlang:iolist_to_binary/1 if > you need it flattened > > That could maybe be optimised further to be tail-recursive using an > accumulator, but it doesn't involve building an entire list for every > entry iolists can be arbitrarily deep, of course: util:join([H], _Sep) -> [H]; util:join([H | T], Sep) -> [H | [[Sep, S] || S <- T]]. %% or [H | lists:map(fun(S) -> [Sep, S] end, T)]. util:join(["I","Like","Erlang"],"_") = ["I",["_","Like"],["_","Erlang"]]. -- David Terrell dbt@REDACTED ((meatspace)) http://meat.net/ From erlangx@REDACTED Wed Sep 12 21:57:24 2007 From: erlangx@REDACTED (Michael McDaniel) Date: Wed, 12 Sep 2007 12:57:24 -0700 Subject: [erlang-questions] question about node spawning In-Reply-To: <22099a270709121114w5720cccfjd744dd5d550c96f2@mail.gmail.com> References: <22099a270709121114w5720cccfjd744dd5d550c96f2@mail.gmail.com> Message-ID: <20070912195723.GH10320@delora.autosys.us> On Wed, Sep 12, 2007 at 03:14:30PM -0300, Josh Noble wrote: > Hi, please let me know if this is off-topic or could be handled > somewhere else better, but I figured I'd throw it up here and see what > happens. When I initialize a process like: > > erl -sname base > > I get this: > > (base@REDACTED) > > which throws errors when I try to run the "multiple processes on > localhost" example from ch. 10 of the Programming Erlang book because > the rpc chokes on the 'cpe-190-55-115-44'. I'm not sure why this is > happening, but if anyone has any advice on how to configure processes > when they're spawned a little better. I can of course just do ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I guess that 'cpe-109-55-115-44' (with single quotes) would work fine, since it is an atom. However, cpe-109-55-115-44 is not an atom and, with the minus sign, is not a valid expression, either. 1> cpe-109-55-115-44. =ERROR REPORT==== ** exited: {badarith,[{erl_eval,eval_op,3}, It appears that your computer's hostname is getting set to the ISP's name for your location. "Customer Premise Equipment ..." with your IP. ^^^^^^^^^^^^^^^^^^^^^^ cpe-190-blah blah If you change your hostname to a valid erlang expression, then your "erl -sname base" should work fine. ~Michael > > erl -sname base@REDACTED > > and it's fine. I'm just wondering why the default spawning is a little > strange. Thanks, > > Josh > > -- > Joshua Noble > http://thefactoryfactory.com > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > !DSPAM:52,46e82cae73321194299324! > > -- Michael McDaniel Portland, Oregon, USA http://autosys.us +1 503 283 5284 From ulf.wiger@REDACTED Wed Sep 12 22:36:59 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 12 Sep 2007 22:36:59 +0200 Subject: [erlang-questions] hrtime/0, Was: now/0 resolution In-Reply-To: <20070912074208.GA8189@erix.ericsson.se> References: <46E142C6.9010804@gmail.com> <20070912074208.GA8189@erix.ericsson.se> Message-ID: <46E84DEB.4060803@ericsson.com> Raimo Niskanen wrote: > > New question: > > Serge apparently want a new BIF e.g hrtime/0 that would return > the best high resolution time the implementation knows on the > running OS. The precision would be OS dependant, but the best > known to the emulator, and it would be the fastest way to get it. > This BIF could also be suitable for getting high resolution > CPU time as well as wallclock time. > > How much interest for such a BIF is there from the community? > > This would perhaps better be asked for in an EEP, but > this is a first poll. We are very interested, and should even have this as a formal requirement somewhere (maybe it got lost along the way...) What I've asked for in the past is a time value that has _at least_ millisecond precision, but I will gladly settle for the best precision available. (: BR, Ulf W From dmercer@REDACTED Wed Sep 12 23:27:14 2007 From: dmercer@REDACTED (David Mercer) Date: Wed, 12 Sep 2007 16:27:14 -0500 Subject: [erlang-questions] definition of iolist In-Reply-To: <46D82F9D.4070709@cs.ntua.gr> References: <200708312209.37474.als@iinet.net.au> <20070831144031.GF16422@sphinx.chicagopeoplez.org> <46D82F9D.4070709@cs.ntua.gr> Message-ID: <001301c7f583$b080cb20$891ea8c0@SSI.CORP> On Friday, August 31, 2007, Kostis Sagonas wrote: > PS. I've repeatedly mentioned to the OTP group that there is very little > reason for an IOList to allow binaries in the tail. And what did they say? > Allowing binaries in the tail of the list only saves one cons cell > but it disallows the use of many/most lists functions for IOLists. > For example lists:length/1 cannot be safely used for IOLists because > its use may or might not throw an exception. Good point. > IMO, IOLists should not allow for binaries in the tail position. > Other than that, IOLists are great. I had an aha! moment last night thinking about this (yes, two weeks late, but it had to be queued in a LIFO stack in my mind until I had brain cycles to spare), and I thought that iolist() probably permits a binary() as the tail because a binary() is an iolist()! By allowing it in the tail, iolist-processing functions can recursively call themselves on the tail of an iolist() and if it's a binary(), everything's OK. Cool. Tried this to test: 5> erlang:iolist_to_binary(["abcdefg"| <<"h">>]). <<"abcdefgh">> 6> erlang:iolist_to_binary([<<"h">>]). <<"h">> 7> erlang:iolist_to_binary(<<"h">>). <<"h">> 8> erlang:iolist_to_binary("h"). <<"h">> 9> erlang:iolist_to_binary($h). =ERROR REPORT==== 12-Sep-2007::15:55:56 === Error in process <0.36.0> with exit value: {badarg,[{erlang,iolist_to_binary,"h" },{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} ** exited: {badarg,[{erlang,iolist_to_binary,"h"}, {erl_eval,do_apply,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** So far my, my theory was right. Line 7 passes a naked binary to erlang:iolist_to_binary/1 and it works. Line 9 shows that a naked character, on the other hand, is not acceptable, consistent with my theory. BUT it turns out there is another inconsistency with iolists, and that is that erlang:iolist_to_binary/1 is documented as accepting an iolist()|binary(). So instead of their being consistent in my mind, they become even more inconsistent by naming a function iolist_to_binary which does not have the type iolist() -> binary() as you might expect. No, that function is named list_to_binary, which is quite bizarre. Cheers, DBM From ok@REDACTED Thu Sep 13 01:00:50 2007 From: ok@REDACTED (ok) Date: Thu, 13 Sep 2007 11:00:50 +1200 Subject: [erlang-questions] list:join() for erlang? In-Reply-To: References: <46E8115C.8000602@free.fr> Message-ID: On 13 Sep 2007, at 4:26 am, Peter K Chan wrote: > Sorry that I made an omission. > > I was referring to the variant of join which takes a separator. For > example: lists:join("abc", "/"), which evaluates to "a/b/c". Should that have been join(["a","b","c"], "/")? There are filename:join/2 and filename:join/1 functions which come close to what you want, but they are specialised to file names and do stuff you may not want. On the other hand, if, as the slash suggests, you are pasting file names together, then filename:join/1 is EXACTLY what you want. Otherwise, if what you are after is the Python join(words, sep) function, you want the code below. As you note, it isn't that hard to write, but then, neither are most of the functions in the lists and string modules. This doesn't depend on the element type, so it could go in the lists module, but considering its likely uses, it probably belongs in the string module. % join([X1,...,Xn], Sep) -> X1 ++ Sep ++ ... ++ Sep ++ Xn; % join([], _) -> []. % The intended type is join([[x]], [x]) -> [x]. join([X|Xs], []) -> join0(X, Xs); join([X|Xs], [C]) -> join1(X, C, Xs); join([X|Xs], Sep) -> join2(X, Sep, Xs); join([], _) -> []. join0(X, [Y|Ys]) -> X ++ join0(Y, Ys); join0(X, []) -> X. join1(X, C, [Y|Ys]) -> X ++ [C|join1(Y, C, Ys)]; join1(X, _, []) -> X. join2(X, Sep, [Y|Ys]) -> X ++ (Sep ++ join2(Y, Sep, Ys)); join2(X, _, []) -> X. From peter@REDACTED Thu Sep 13 01:29:29 2007 From: peter@REDACTED (Peter K Chan) Date: Thu, 13 Sep 2007 01:29:29 +0200 Subject: [erlang-questions] list:join() for erlang? In-Reply-To: Message-ID: Yes, the list of lists was what I meant. :) I wanted Python/Ruby style join, where the function can take any arbitrary separator. I already have the code, so I am looking for either information on where to find such functionality in OTP (if it is hidden in some obscure module), or to suggest that such a function be added to lists or strings by OTP. Peter -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of ok Sent: Wednesday, September 12, 2007 6:01 PM To: erlang-questions Questions Subject: Re: [erlang-questions] list:join() for erlang? On 13 Sep 2007, at 4:26 am, Peter K Chan wrote: > Sorry that I made an omission. > > I was referring to the variant of join which takes a separator. For > example: lists:join("abc", "/"), which evaluates to "a/b/c". Should that have been join(["a","b","c"], "/")? There are filename:join/2 and filename:join/1 functions which come close to what you want, but they are specialised to file names and do stuff you may not want. On the other hand, if, as the slash suggests, you are pasting file names together, then filename:join/1 is EXACTLY what you want. Otherwise, if what you are after is the Python join(words, sep) function, you want the code below. As you note, it isn't that hard to write, but then, neither are most of the functions in the lists and string modules. This doesn't depend on the element type, so it could go in the lists module, but considering its likely uses, it probably belongs in the string module. % join([X1,...,Xn], Sep) -> X1 ++ Sep ++ ... ++ Sep ++ Xn; % join([], _) -> []. % The intended type is join([[x]], [x]) -> [x]. join([X|Xs], []) -> join0(X, Xs); join([X|Xs], [C]) -> join1(X, C, Xs); join([X|Xs], Sep) -> join2(X, Sep, Xs); join([], _) -> []. join0(X, [Y|Ys]) -> X ++ join0(Y, Ys); join0(X, []) -> X. join1(X, C, [Y|Ys]) -> X ++ [C|join1(Y, C, Ys)]; join1(X, _, []) -> X. join2(X, Sep, [Y|Ys]) -> X ++ (Sep ++ join2(Y, Sep, Ys)); join2(X, _, []) -> X. _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From bbmaj7@REDACTED Thu Sep 13 01:00:24 2007 From: bbmaj7@REDACTED (Richard Andrews) Date: Thu, 13 Sep 2007 09:00:24 +1000 (EST) Subject: [erlang-questions] Code review request In-Reply-To: <20070912173154.GA31990@frogman.motivity.ca> Message-ID: <37733.59729.qm@web52002.mail.re2.yahoo.com> --- Vance Shipley wrote: > The erlang list is archived and searchable: http://www.erlang.org/faq.html. True but that's not the same. Being able to search for something when you know where to look and what you are looking for (the nomenclature) is different to searching for info about ideas that you cannot yet name. Also a forum (or better a wiki), distils the essential concepts into concise dissertations without the stream-of-consciousness, tangential fluff that bloats email archives. IMO wiki/forum layout is more suited to the beginning to intermediate level developer. I'm of that level and I like the cookbooks on trapexit, but I find they are often too simplistic. I don't see a self-education bridge from these over-simplified examples to real-world levels of complexity. I would like to see a code reviews and examples by experienced developers. But trawling email threads to distil the information doesn't sound like fun to me. ____________________________________________________________________________________ Sick of deleting your inbox? Yahoo!7 Mail has free unlimited storage. http://au.docs.yahoo.com/mail/unlimitedstorage.html From saleyn@REDACTED Thu Sep 13 04:58:33 2007 From: saleyn@REDACTED (Serge Aleynikov) Date: Wed, 12 Sep 2007 21:58:33 -0500 Subject: [erlang-questions] hrtime/0, Was: now/0 resolution In-Reply-To: <46E84DEB.4060803@ericsson.com> References: <46E142C6.9010804@gmail.com> <20070912074208.GA8189@erix.ericsson.se> <46E84DEB.4060803@ericsson.com> Message-ID: <46E8A759.4000506@gmail.com> Here's a little test I ran on Linux (i386, 3GHz) to measure timer performance: clock resolution: 0.010 s gettimeofday() resolution: 4 us gettimeofday() duration = 10 us hrtime() resolution: 120 ns hrtime() 1 iteration cost = 130 ns clock_gettime() resolution = 461 ns clock_gettime() 1 iteration cost = 117 ns I also got a few private responses supporting community interest in an HR timer BIFs. To address Mikael's question, I also think that both actual/virtual time BIFs could be useful. Serge Ulf Wiger (TN/EAB) wrote: > Raimo Niskanen wrote: >> >> New question: >> >> Serge apparently want a new BIF e.g hrtime/0 that would return >> the best high resolution time the implementation knows on the >> running OS. The precision would be OS dependant, but the best >> known to the emulator, and it would be the fastest way to get it. >> This BIF could also be suitable for getting high resolution >> CPU time as well as wallclock time. >> >> How much interest for such a BIF is there from the community? >> >> This would perhaps better be asked for in an EEP, but >> this is a first poll. > > We are very interested, and should even have this as a > formal requirement somewhere (maybe it got lost along > the way...) > > What I've asked for in the past is a time value that has > _at least_ millisecond precision, but I will gladly > settle for the best precision available. (: > > BR, > Ulf W > -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: time.c URL: From saleyn@REDACTED Thu Sep 13 05:14:36 2007 From: saleyn@REDACTED (Serge Aleynikov) Date: Wed, 12 Sep 2007 22:14:36 -0500 Subject: [erlang-questions] hrtime/0, Was: now/0 resolution In-Reply-To: <46E8A759.4000506@gmail.com> References: <46E142C6.9010804@gmail.com> <20070912074208.GA8189@erix.ericsson.se> <46E84DEB.4060803@ericsson.com> <46E8A759.4000506@gmail.com> Message-ID: <46E8AB1C.8040706@gmail.com> Oh, I also forgot to state that exposing clock_gettime() via a driver and using erlang:port_call/3 takes around 75us on the same machine as below, so a BIF would definitely be a better choice in this regard. Serge Aleynikov wrote: > Here's a little test I ran on Linux (i386, 3GHz) to measure timer > performance: > > clock resolution: 0.010 s > gettimeofday() resolution: 4 us > gettimeofday() duration = 10 us > hrtime() resolution: 120 ns > hrtime() 1 iteration cost = 130 ns > clock_gettime() resolution = 461 ns > clock_gettime() 1 iteration cost = 117 ns > > > I also got a few private responses supporting community interest in an > HR timer BIFs. To address Mikael's question, I also think that both > actual/virtual time BIFs could be useful. > > Serge > > Ulf Wiger (TN/EAB) wrote: >> Raimo Niskanen wrote: >>> >>> New question: >>> >>> Serge apparently want a new BIF e.g hrtime/0 that would return >>> the best high resolution time the implementation knows on the >>> running OS. The precision would be OS dependant, but the best >>> known to the emulator, and it would be the fastest way to get it. >>> This BIF could also be suitable for getting high resolution >>> CPU time as well as wallclock time. >>> >>> How much interest for such a BIF is there from the community? >>> >>> This would perhaps better be asked for in an EEP, but >>> this is a first poll. >> >> We are very interested, and should even have this as a >> formal requirement somewhere (maybe it got lost along >> the way...) >> >> What I've asked for in the past is a time value that has >> _at least_ millisecond precision, but I will gladly >> settle for the best precision available. (: >> >> BR, >> Ulf W >> > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From rrerlang@REDACTED Tue Sep 11 11:35:56 2007 From: rrerlang@REDACTED (Robert Raschke) Date: Tue, 11 Sep 2007 10:35:56 +0100 Subject: [erlang-questions] Yaws, ErlyWeb and Windows. In-Reply-To: <46E59BFD.3050808@hyber.org> Message-ID: <3d4e07a415487df38e11c8912370fadc@tombob.com> > Bob Cowdery wrote: >> Hi All >> >> Can someone give me the picture on Yaws and ErlyWeb under Windows please > > I'm sorry about that - to my knowledge there is quite a lot > of people running yaws under windows. I don't run windows at > all any longer - and I'll just have to leave it up to the > yaws/windows community to write e.g. a proper wiki entry on how to do > it. I know for sure that it atleast used to work - I made sure it > worked once, but it might have gone bad. Here's how I build yaws on Windows: My source root is $ROOT. Unpack yaws-1.68 into $ROOT/lib/yaws. Have a folder called $ROOT/extra with the files yaws_generated.erl and yaws.app (although I forget why I need yaws.app): yaws_generated.erl: %%%---------------------------------------------------------------------- %%% File : yaws_generated.template %%% Author : Klacke %%% Purpose : %%% Created : 10 Jun 2002 by Klacke %%%---------------------------------------------------------------------- %% generated code from some environment variables %% especially VARDIR is important since it controls %% where the --hup and friends -module(yaws_generated). -author('klacke@REDACTED'). -compile(export_all). version() -> "1.68". vardir() -> "C:/yaws/var". ctldir() -> "C:/yaws/var/run/yaws". etcdir() -> "C:/yaws/etc". % (Or whatever you want your defaults to be.) yaws.app: {application, yaws, [ {description, "yaws WWW server"}, {vsn, "1.68"}, {modules, [ yaws, yaws_app, yaws_ticker, yaws_config, yaws_server, yaws_sup, yaws_api, yaws_log, yaws_ls, yaws_debug, yaws_compile, yaws_ctl, yaws_cgi, yaws_zlib, yaws_generated, mime_type_c, mime_types, yaws_session_server, yaws_404, yaws_revproxy, yaws_html, yaws_log_file_h, yaws_rss, yaws_dav, yaws_pam, json, jsonrpc, yaws_jsonrpc, yaws_xmlrpc, haxe, yaws_rpc, yaws_soap_srv, yaws_soap_lib ]}, {registered, []}, {mod, {yaws_app, []}}, {env, []}, {applications, [ kernel, stdlib ]} ]}. And then I run this batch script: build_yaws.bat: @echo off setlocal copy /Y extra\yaws_generated.erl lib\yaws\src cd lib\yaws\src set ERLC="C:\Program Files\erl5.5.4\bin\erlc" set ERL="C:\Program Files\erl5.5.4\bin\erl" set ERLCOPTS=-W -pa .. -I../include -o ../ebin set ERLOPTS=-noshell -pa ../ebin %ERLC% %ERLCOPTS% yaws.erl %ERLC% %ERLCOPTS% yaws_app.erl %ERLC% %ERLCOPTS% yaws_ticker.erl %ERLC% %ERLCOPTS% yaws_config.erl %ERLC% %ERLCOPTS% yaws_server.erl %ERLC% %ERLCOPTS% yaws_sup.erl %ERLC% %ERLCOPTS% yaws_api.erl %ERLC% %ERLCOPTS% yaws_log.erl %ERLC% %ERLCOPTS% yaws_ls.erl %ERLC% %ERLCOPTS% yaws_debug.erl %ERLC% %ERLCOPTS% yaws_compile.erl %ERLC% %ERLCOPTS% yaws_ctl.erl %ERLC% %ERLCOPTS% yaws_cgi.erl %ERLC% %ERLCOPTS% yaws_zlib.erl %ERLC% %ERLCOPTS% yaws_generated.erl %ERLC% %ERLCOPTS% yaws_session_server.erl %ERLC% %ERLCOPTS% yaws_404.erl %ERLC% %ERLCOPTS% yaws_revproxy.erl %ERLC% %ERLCOPTS% yaws_html.erl %ERLC% %ERLCOPTS% yaws_log_file_h.erl %ERLC% %ERLCOPTS% yaws_rss.erl %ERLC% %ERLCOPTS% yaws_dav.erl %ERLC% %ERLCOPTS% yaws_pam.erl %ERLC% %ERLCOPTS% json.erl %ERLC% %ERLCOPTS% jsonrpc.erl %ERLC% %ERLCOPTS% yaws_jsonrpc.erl %ERLC% %ERLCOPTS% yaws_xmlrpc.erl %ERLC% %ERLCOPTS% haxe.erl %ERLC% %ERLCOPTS% yaws_rpc.erl %ERLC% %ERLCOPTS% yaws_soap_srv.erl %ERLC% %ERLCOPTS% yaws_soap_lib.erl del /F charset.def echo. > charset.def %ERLC% %ERLCOPTS% mime_type_c.erl %ERL% %ERLOPTS% -s mime_type_c compile %ERLC% %ERLCOPTS% mime_types.erl pause endlocal I have also made a small attempt at writing a yaws.bat file, but I haven't used this in a few years: @echo off setlocal set HOME=C:/yaws set yawsdir=C:/yaws/erlang/yaws-1.68 set erl=C:\Program Files\erl5.5.4\bin\erl.exe set werl=C:\Program Files\erl5.5.4\bin\werl.exe set debug= set daemon= set interactive= set trace= set conf= set runmod= set sname= set heart= set xpath= set mnesia= set id=default set pdist= set erlarg= :NEXTARG set arg=%1 shift if "%arg%"=="" goto ENDARGS if "%arg%"=="-i" goto INTERACT if "%arg%"=="--interactive" goto INTERACT if "%arg%"=="-w" goto WINTERACT if "%arg%"=="--winteractive" goto WINTERACT if "%arg%"=="-D" goto DAEMON if "%arg%"=="--daemon" goto DAEMON if "%arg%"=="-d" goto DEBUG if "%arg%"=="--debug" goto DEBUG if "%arg%"=="-t" goto TRACETR if "%arg%"=="--tracetraf" goto TRACETR if "%arg%"=="-T" goto TRACEHT if "%arg%"=="--tracehttp" goto TRACEHT if "%arg%"=="-I" goto ID if "%arg%"=="--id" goto ID if "%arg%"=="-x" goto TRACEOUT if "%arg%"=="--traceout" goto TRACEOUT if "%arg%"=="--trace" goto TRACE if "%arg%"=="-M" goto MNESIADIR if "%arg%"=="--mnesiadir" goto MNESIADIR if "%arg%"=="-c" goto CONF if "%arg%"=="--conf" goto CONF if "%arg%"=="-pa" goto PA if "%arg%"=="--pa" goto PA if "%arg%"=="-r" goto RUNMOD if "%arg%"=="--runmod" goto RUNMOD if "%arg%"=="-h" goto HUP if "%arg%"=="--hup" goto HUP if "%arg%"=="-s" goto STOP if "%arg%"=="--stop" goto STOP if "%arg%"=="-ls" goto LS if "%arg%"=="--ls" goto LS if "%arg%"=="-S" goto STATUS if "%arg%"=="--status" goto STATUS if "%arg%"=="-load" goto LOAD if "%arg%"=="--load" goto LOAD if "%arg%"=="-j" goto CTLTRACE if "%arg%"=="--ctltrace" goto CTLTRACE if "%arg%"=="-v" goto VERSION if "%arg%"=="--version" goto VERSION if "%arg%"=="-sname" goto SNAME if "%arg%"=="--sname" goto SNAME if "%arg%"=="-name" goto NAME if "%arg%"=="--name" goto NAME if "%arg%"=="-heart" goto HEART if "%arg%"=="--heart" goto HEART if "%arg%"=="-proto_dist" goto PROTO if "%arg%"=="--proto_dist" goto PROTO if "%arg%"=="-erlarg" goto ERLARG if "%arg%"=="--erlarg" goto ERLARG if "%arg%"=="-check" goto CHECK if "%arg%"=="--check" goto CHECK goto HELP :INTERACT set interactive=true set debug= -yaws debug set daemon= goto NEXTARG :WINTERACT set interactive=true set debug= -yaws debug set daemon= set erl=%werl% goto NEXTARG :DAEMON set daemon= -detached goto NEXTARG :DEBUG set debug= -boot start_sasl -yaws debug goto NEXTARG :TRACETR set trace= -yaws trace traffic goto NEXTARG :TRACEHT set trace= -yaws trace http goto NEXTARG :ID set id=%1 shift goto NEXTARG :TRACEOUT set traceoutput= -yaws traceoutput goto NEXTARG :TRACE set traceoutput= -yaws traceoutput set trace= -yaws trace traffic goto NEXTARG :MNESIADIR set mnesia= -mnesia dir %1 -run mnesia start shift goto NEXTARG :CONF set conf= -conf %1 shift goto NEXTARG :PA set xpath= %xpath% -pa %1 shift goto NEXTARG :RUNMOD set runmod= -runmod %1 shift goto NEXTARG :HUP set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl hup goto NEXTARG :STOP set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl stop goto NEXTARG :LS set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl ls goto NEXTARG :STATUS set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl status goto NEXTARG :LOAD "%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl load %id% %1 %2 %3 %4 %5 %6 %7 %8 %9 goto END :CTLTRACE set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl trace %1 shift goto NEXTARG :VERSION "%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws printversion goto END :SNAME set sname= -sname %1 shift goto NEXTARG :NAME set sname= -name %1 shift goto NEXTARG :HEART set heart= -heart goto NEXTARG :PROTO set pdist= -proto_dist %1 shift goto NEXTARG :ERLARG set erlarg=%erlarg% %1 shift goto NEXTARG :CHECK mkdir "%HOME%/.yaws/" mkdir "%HOME%/.yaws/%id%" "%erl%" -noshell -pa "%yawsdir%/ebin" %xpath% -s yaws_ctl check %id% %1 %2 %3 %4 %5 %6 %7 %8 %9 goto END :ENDARGS if NOT DEFINED ex goto NOEX %ex% %id% goto END :NOEX if "%id%"=="" goto NOID set id=-yaws id %id% :NOID set trace=%trace% %traceoutput% if "%daemon%%interactive%"=="" goto HELP set XEC=%daemon% %heart% -pa "%yawsdir%/ebin" %xpath% %sname% %pdist% %erlarg% %debug% -s yaws %trace% %conf% %runmod% %mnesia% %id% set HEART_COMMAND= if "%heart%%daemon%"=="" goto NOHEART echo set HEART_COMMAND="%erl%" %XEC% set HEART_COMMAND="%erl%" %XEC% :NOHEART echo "%erl%" %XEC% "%erl%" %XEC% goto END :HELP echo "usage: " echo "" echo " yaws -i | --interactive -- interactive (no daemon) mode" echo " yaws -w | --winteractive -- interactive (werl) " echo " yaws --daemon -- daemon mode" echo "" echo "" echo " Auxilliary flags for the daemon: " echo " --id Id -- Set system id" echo " --debug -- debug mode " echo " --conf File -- set config file" echo " --tracetraf -- trace traffic" echo " --tracehttp -- trace http traffic" echo " --traceout -- trace output to stdout" echo " --version -- print version" echo " --pa path -- add load path" echo " --mnesiadir dir -- start Mnesia in dir" echo " --proto_dist Mod -- use Mod for distrib" echo " --sname xxx -- start with sname xxx" echo " --name xxx -- start with name xxx" echo " --runmod mod -- call mod:start/0 at startup" echo " --heart -- auto restart yaws if it crashes" echo " --erlarg X -- pass argument X to $erl" echo "" echo "ctl functions ... " echo " yaws --hup [--id ID] -- hup the daemon, reload conf" echo " yaws --stop [--id ID] -- stop the daemon" echo " yaws --status [--id ID] -- query the daemon status" echo " yaws --load Modules -- load modules" echo " yaws --ls -- list Yaws nodes and their status" echo " yaws --ctltrace traffic|http -- toggle trace of running daemon" echo " yaws --check YawsFile [IncDirs] -- test compile File" :END endlocal Robby -- r fullstop raschke around tombob fullstop com From kenneth.lundin@REDACTED Thu Sep 13 08:39:23 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Thu, 13 Sep 2007 08:39:23 +0200 Subject: [erlang-questions] list:join() for erlang? In-Reply-To: References: Message-ID: We are considering adding a string:join(ListOfStrings, SeparatorString) -> String in the next release. Note that String is a list of integers. /Kenneth (Erlang/OTP team at Ericsson) On 9/13/07, Peter K Chan wrote: > Yes, the list of lists was what I meant. :) > > I wanted Python/Ruby style join, where the function can take any > arbitrary separator. > > I already have the code, so I am looking for either information on where > to find such functionality in OTP (if it is hidden in some obscure > module), or to suggest that such a function be added to lists or strings > by OTP. > > Peter > > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of ok > Sent: Wednesday, September 12, 2007 6:01 PM > To: erlang-questions Questions > Subject: Re: [erlang-questions] list:join() for erlang? > > On 13 Sep 2007, at 4:26 am, Peter K Chan wrote: > > > Sorry that I made an omission. > > > > I was referring to the variant of join which takes a separator. For > > example: lists:join("abc", "/"), which evaluates to "a/b/c". > > Should that have been join(["a","b","c"], "/")? > > There are filename:join/2 and filename:join/1 functions which come > close to what you want, but they are specialised to file names and > do stuff you may not want. On the other hand, if, as the slash > suggests, you are pasting file names together, then filename:join/1 > is EXACTLY what you want. > > Otherwise, if what you are after is the Python join(words, sep) > function, you want the code below. As you note, it isn't that hard > to write, but then, neither are most of the functions in the lists > and string modules. This doesn't depend on the element type, so it > could go in the lists module, but considering its likely uses, it > probably belongs in the string module. > > % join([X1,...,Xn], Sep) -> X1 ++ Sep ++ ... ++ Sep ++ Xn; > % join([], _) -> []. > % The intended type is join([[x]], [x]) -> [x]. > > join([X|Xs], []) -> join0(X, Xs); > join([X|Xs], [C]) -> join1(X, C, Xs); > join([X|Xs], Sep) -> join2(X, Sep, Xs); > join([], _) -> []. > > join0(X, [Y|Ys]) -> X ++ join0(Y, Ys); > join0(X, []) -> X. > > join1(X, C, [Y|Ys]) -> X ++ [C|join1(Y, C, Ys)]; > join1(X, _, []) -> X. > > join2(X, Sep, [Y|Ys]) -> X ++ (Sep ++ join2(Y, Sep, Ys)); > join2(X, _, []) -> X. > > > _______________________________________________ > 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 Bob.Cowdery@REDACTED Thu Sep 13 09:00:06 2007 From: Bob.Cowdery@REDACTED (Bob Cowdery) Date: Thu, 13 Sep 2007 08:00:06 +0100 Subject: [erlang-questions] Yaws, ErlyWeb and Windows. Message-ID: <3A76756EED583B43A4AD704E29CCD079741262@mail.smartlogic.com> Robert Thanks very much for that. I will have a go when I'm out the woods. At the moment the pre-built version is working ok. However, I wonder, do you use ErlyWeb because I'm having trouble with it. I posted a message on the forum yesterday but no replies yet. Essentially I can't get it to generate code for a MySQL table and it can't seem to find the controller that it generated anyway. In fact it dosn't seem think they are controllers and views. Any help appreciated. Bob -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED]On Behalf Of Robert Raschke Sent: 11 September 2007 10:36 To: erlang-questions@REDACTED Subject: Re: [erlang-questions] Yaws, ErlyWeb and Windows. > Bob Cowdery wrote: >> Hi All >> >> Can someone give me the picture on Yaws and ErlyWeb under Windows please > > I'm sorry about that - to my knowledge there is quite a lot > of people running yaws under windows. I don't run windows at > all any longer - and I'll just have to leave it up to the > yaws/windows community to write e.g. a proper wiki entry on how to do > it. I know for sure that it atleast used to work - I made sure it > worked once, but it might have gone bad. Here's how I build yaws on Windows: My source root is $ROOT. Unpack yaws-1.68 into $ROOT/lib/yaws. Have a folder called $ROOT/extra with the files yaws_generated.erl and yaws.app (although I forget why I need yaws.app): yaws_generated.erl: %%%---------------------------------------------------------------------- %%% File : yaws_generated.template %%% Author : Klacke %%% Purpose : %%% Created : 10 Jun 2002 by Klacke %%%---------------------------------------------------------------------- %% generated code from some environment variables %% especially VARDIR is important since it controls %% where the --hup and friends -module(yaws_generated). -author('klacke@REDACTED'). -compile(export_all). version() -> "1.68". vardir() -> "C:/yaws/var". ctldir() -> "C:/yaws/var/run/yaws". etcdir() -> "C:/yaws/etc". % (Or whatever you want your defaults to be.) yaws.app: {application, yaws, [ {description, "yaws WWW server"}, {vsn, "1.68"}, {modules, [ yaws, yaws_app, yaws_ticker, yaws_config, yaws_server, yaws_sup, yaws_api, yaws_log, yaws_ls, yaws_debug, yaws_compile, yaws_ctl, yaws_cgi, yaws_zlib, yaws_generated, mime_type_c, mime_types, yaws_session_server, yaws_404, yaws_revproxy, yaws_html, yaws_log_file_h, yaws_rss, yaws_dav, yaws_pam, json, jsonrpc, yaws_jsonrpc, yaws_xmlrpc, haxe, yaws_rpc, yaws_soap_srv, yaws_soap_lib ]}, {registered, []}, {mod, {yaws_app, []}}, {env, []}, {applications, [ kernel, stdlib ]} ]}. And then I run this batch script: build_yaws.bat: @echo off setlocal copy /Y extra\yaws_generated.erl lib\yaws\src cd lib\yaws\src set ERLC="C:\Program Files\erl5.5.4\bin\erlc" set ERL="C:\Program Files\erl5.5.4\bin\erl" set ERLCOPTS=-W -pa .. -I../include -o ../ebin set ERLOPTS=-noshell -pa ../ebin %ERLC% %ERLCOPTS% yaws.erl %ERLC% %ERLCOPTS% yaws_app.erl %ERLC% %ERLCOPTS% yaws_ticker.erl %ERLC% %ERLCOPTS% yaws_config.erl %ERLC% %ERLCOPTS% yaws_server.erl %ERLC% %ERLCOPTS% yaws_sup.erl %ERLC% %ERLCOPTS% yaws_api.erl %ERLC% %ERLCOPTS% yaws_log.erl %ERLC% %ERLCOPTS% yaws_ls.erl %ERLC% %ERLCOPTS% yaws_debug.erl %ERLC% %ERLCOPTS% yaws_compile.erl %ERLC% %ERLCOPTS% yaws_ctl.erl %ERLC% %ERLCOPTS% yaws_cgi.erl %ERLC% %ERLCOPTS% yaws_zlib.erl %ERLC% %ERLCOPTS% yaws_generated.erl %ERLC% %ERLCOPTS% yaws_session_server.erl %ERLC% %ERLCOPTS% yaws_404.erl %ERLC% %ERLCOPTS% yaws_revproxy.erl %ERLC% %ERLCOPTS% yaws_html.erl %ERLC% %ERLCOPTS% yaws_log_file_h.erl %ERLC% %ERLCOPTS% yaws_rss.erl %ERLC% %ERLCOPTS% yaws_dav.erl %ERLC% %ERLCOPTS% yaws_pam.erl %ERLC% %ERLCOPTS% json.erl %ERLC% %ERLCOPTS% jsonrpc.erl %ERLC% %ERLCOPTS% yaws_jsonrpc.erl %ERLC% %ERLCOPTS% yaws_xmlrpc.erl %ERLC% %ERLCOPTS% haxe.erl %ERLC% %ERLCOPTS% yaws_rpc.erl %ERLC% %ERLCOPTS% yaws_soap_srv.erl %ERLC% %ERLCOPTS% yaws_soap_lib.erl del /F charset.def echo. > charset.def %ERLC% %ERLCOPTS% mime_type_c.erl %ERL% %ERLOPTS% -s mime_type_c compile %ERLC% %ERLCOPTS% mime_types.erl pause endlocal I have also made a small attempt at writing a yaws.bat file, but I haven't used this in a few years: @echo off setlocal set HOME=C:/yaws set yawsdir=C:/yaws/erlang/yaws-1.68 set erl=C:\Program Files\erl5.5.4\bin\erl.exe set werl=C:\Program Files\erl5.5.4\bin\werl.exe set debug= set daemon= set interactive= set trace= set conf= set runmod= set sname= set heart= set xpath= set mnesia= set id=default set pdist= set erlarg= :NEXTARG set arg=%1 shift if "%arg%"=="" goto ENDARGS if "%arg%"=="-i" goto INTERACT if "%arg%"=="--interactive" goto INTERACT if "%arg%"=="-w" goto WINTERACT if "%arg%"=="--winteractive" goto WINTERACT if "%arg%"=="-D" goto DAEMON if "%arg%"=="--daemon" goto DAEMON if "%arg%"=="-d" goto DEBUG if "%arg%"=="--debug" goto DEBUG if "%arg%"=="-t" goto TRACETR if "%arg%"=="--tracetraf" goto TRACETR if "%arg%"=="-T" goto TRACEHT if "%arg%"=="--tracehttp" goto TRACEHT if "%arg%"=="-I" goto ID if "%arg%"=="--id" goto ID if "%arg%"=="-x" goto TRACEOUT if "%arg%"=="--traceout" goto TRACEOUT if "%arg%"=="--trace" goto TRACE if "%arg%"=="-M" goto MNESIADIR if "%arg%"=="--mnesiadir" goto MNESIADIR if "%arg%"=="-c" goto CONF if "%arg%"=="--conf" goto CONF if "%arg%"=="-pa" goto PA if "%arg%"=="--pa" goto PA if "%arg%"=="-r" goto RUNMOD if "%arg%"=="--runmod" goto RUNMOD if "%arg%"=="-h" goto HUP if "%arg%"=="--hup" goto HUP if "%arg%"=="-s" goto STOP if "%arg%"=="--stop" goto STOP if "%arg%"=="-ls" goto LS if "%arg%"=="--ls" goto LS if "%arg%"=="-S" goto STATUS if "%arg%"=="--status" goto STATUS if "%arg%"=="-load" goto LOAD if "%arg%"=="--load" goto LOAD if "%arg%"=="-j" goto CTLTRACE if "%arg%"=="--ctltrace" goto CTLTRACE if "%arg%"=="-v" goto VERSION if "%arg%"=="--version" goto VERSION if "%arg%"=="-sname" goto SNAME if "%arg%"=="--sname" goto SNAME if "%arg%"=="-name" goto NAME if "%arg%"=="--name" goto NAME if "%arg%"=="-heart" goto HEART if "%arg%"=="--heart" goto HEART if "%arg%"=="-proto_dist" goto PROTO if "%arg%"=="--proto_dist" goto PROTO if "%arg%"=="-erlarg" goto ERLARG if "%arg%"=="--erlarg" goto ERLARG if "%arg%"=="-check" goto CHECK if "%arg%"=="--check" goto CHECK goto HELP :INTERACT set interactive=true set debug= -yaws debug set daemon= goto NEXTARG :WINTERACT set interactive=true set debug= -yaws debug set daemon= set erl=%werl% goto NEXTARG :DAEMON set daemon= -detached goto NEXTARG :DEBUG set debug= -boot start_sasl -yaws debug goto NEXTARG :TRACETR set trace= -yaws trace traffic goto NEXTARG :TRACEHT set trace= -yaws trace http goto NEXTARG :ID set id=%1 shift goto NEXTARG :TRACEOUT set traceoutput= -yaws traceoutput goto NEXTARG :TRACE set traceoutput= -yaws traceoutput set trace= -yaws trace traffic goto NEXTARG :MNESIADIR set mnesia= -mnesia dir %1 -run mnesia start shift goto NEXTARG :CONF set conf= -conf %1 shift goto NEXTARG :PA set xpath= %xpath% -pa %1 shift goto NEXTARG :RUNMOD set runmod= -runmod %1 shift goto NEXTARG :HUP set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl hup goto NEXTARG :STOP set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl stop goto NEXTARG :LS set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl ls goto NEXTARG :STATUS set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl status goto NEXTARG :LOAD "%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl load %id% %1 %2 %3 %4 %5 %6 %7 %8 %9 goto END :CTLTRACE set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl trace %1 shift goto NEXTARG :VERSION "%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws printversion goto END :SNAME set sname= -sname %1 shift goto NEXTARG :NAME set sname= -name %1 shift goto NEXTARG :HEART set heart= -heart goto NEXTARG :PROTO set pdist= -proto_dist %1 shift goto NEXTARG :ERLARG set erlarg=%erlarg% %1 shift goto NEXTARG :CHECK mkdir "%HOME%/.yaws/" mkdir "%HOME%/.yaws/%id%" "%erl%" -noshell -pa "%yawsdir%/ebin" %xpath% -s yaws_ctl check %id% %1 %2 %3 %4 %5 %6 %7 %8 %9 goto END :ENDARGS if NOT DEFINED ex goto NOEX %ex% %id% goto END :NOEX if "%id%"=="" goto NOID set id=-yaws id %id% :NOID set trace=%trace% %traceoutput% if "%daemon%%interactive%"=="" goto HELP set XEC=%daemon% %heart% -pa "%yawsdir%/ebin" %xpath% %sname% %pdist% %erlarg% %debug% -s yaws %trace% %conf% %runmod% %mnesia% %id% set HEART_COMMAND= if "%heart%%daemon%"=="" goto NOHEART echo set HEART_COMMAND="%erl%" %XEC% set HEART_COMMAND="%erl%" %XEC% :NOHEART echo "%erl%" %XEC% "%erl%" %XEC% goto END :HELP echo "usage: " echo "" echo " yaws -i | --interactive -- interactive (no daemon) mode" echo " yaws -w | --winteractive -- interactive (werl) " echo " yaws --daemon -- daemon mode" echo "" echo "" echo " Auxilliary flags for the daemon: " echo " --id Id -- Set system id" echo " --debug -- debug mode " echo " --conf File -- set config file" echo " --tracetraf -- trace traffic" echo " --tracehttp -- trace http traffic" echo " --traceout -- trace output to stdout" echo " --version -- print version" echo " --pa path -- add load path" echo " --mnesiadir dir -- start Mnesia in dir" echo " --proto_dist Mod -- use Mod for distrib" echo " --sname xxx -- start with sname xxx" echo " --name xxx -- start with name xxx" echo " --runmod mod -- call mod:start/0 at startup" echo " --heart -- auto restart yaws if it crashes" echo " --erlarg X -- pass argument X to $erl" echo "" echo "ctl functions ... " echo " yaws --hup [--id ID] -- hup the daemon, reload conf" echo " yaws --stop [--id ID] -- stop the daemon" echo " yaws --status [--id ID] -- query the daemon status" echo " yaws --load Modules -- load modules" echo " yaws --ls -- list Yaws nodes and their status" echo " yaws --ctltrace traffic|http -- toggle trace of running daemon" echo " yaws --check YawsFile [IncDirs] -- test compile File" :END endlocal Robby -- r fullstop raschke around tombob fullstop com _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From raimo+erlang-questions@REDACTED Thu Sep 13 09:30:23 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 13 Sep 2007 09:30:23 +0200 Subject: [erlang-questions] sizeof() FFI types In-Reply-To: <1189587281.6081.55.camel@gnatziu.crs4.it> References: <1189513745.8590.43.camel@gnatziu.crs4.it> <46E692A4.5040008@hyber.org> <1189518730.8590.71.camel@gnatziu.crs4.it> <46E6B073.6060407@hyber.org> <1189525595.8590.122.camel@gnatziu.crs4.it> <46E6BE18.70203@hyber.org> <1189581705.6081.17.camel@gnatziu.crs4.it> <1189587281.6081.55.camel@gnatziu.crs4.it> Message-ID: <20070913073023.GA16869@erix.ericsson.se> Regarding this suggestion being accepted as EEP 7... I was a bit early adopting it. I thought it was very thought through, and complete, but apparently it will benefit from more input from erlang-questions to settle a bit. Keep up working on the draft eep at http://muvara.org/crs4/erlang/ffi/ and we will see when it is appropriate to insert it in the Process. Oh, and I have a suggestion about the actual ffi:call/2,3 functions. Personally I would prefer an interface with tagged values: ffi:call(Port, {ReturnType,Function}, [TaggedVal]) -> {ReturnType,term()} ReturnType = type_tag() TaggedVal = {type_tag(),Val} Val = term() type_tag() = uchar|schar|...|pointer|size_t|ssize_t e.g Pointer = {pointer,PointerVal} = ffi:call(Port, {pointer,malloc}, [{size_t,1024}]), void = ffi:call(Port, {void,free}, [Pointer]), This would make the code more readable (resembling the C calls) IMHO, and make the ffi values more self-contained; a return value can directly be passed to another ffi function. On Wed, Sep 12, 2007 at 10:54:41AM +0200, Alceste Scalas wrote: > Il giorno mer, 12/09/2007 alle 09.21 +0200, Alceste Scalas ha scritto: > > * ffi:pointer_to_binary(Pointer, Size) would return a new binary() > > with a copy of Size bytes read from Pointer. > > Well, one may even want to use the data inside the new binary --- and if > it represents a struct or some other complex data type, one may need to > know the sizes of the C basic types in order to perform binary matching. > > This additional BIF may be useful: > > * ffi:sizeof(CType): return the number of bytes used by CType on > the current platform. CType is one of the supported FFI type > atoms. > > Summing up, this email and the previous one contain the following > additions to the Erlang/OTP FFI proposal available on > http://muvara.org/crs4/erlang/ffi/ : > > * 'cstring' FFI type > * ffi:cstring_to_binary/1 BIF > * ffi:pointer_to_binary/2 BIF > * ffi:sizeof/1 BIF > > Based on your feedback, I'll add a patch and update the draft EEP. > > Regards, > > alceste > -- > Alceste Scalas > CRS4 - http://www.crs4.it/ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From rsaccon@REDACTED Thu Sep 13 09:47:03 2007 From: rsaccon@REDACTED (Roberto Saccon) Date: Thu, 13 Sep 2007 04:47:03 -0300 Subject: [erlang-questions] New open source project: RTMP / Flash video streaming server Message-ID: If you feel the urgent need to contribute to an open source RTMP / Flash video streaming server, don't look any further, just stop at http://code.google.com/p/erlyvideo/ It is currently just a bare-bone proof-of-concept. have fun with it and please post the tcpdumps if it doesn't stream your FLV files ... -- Roberto Saccon http://rsaccon.com From bjarne@REDACTED Thu Sep 13 09:56:10 2007 From: bjarne@REDACTED (=?iso-8859-1?Q?Bjarne_D=E4cker?=) Date: Thu, 13 Sep 2007 09:56:10 +0200 Subject: [erlang-questions] Erlang User Conference 2007 - Call for Papers References: <46E8115C.8000602@free.fr> Message-ID: <002801c7f5db$aab3c6e0$0100007f@Dell> All Erlang developers, researchers, users, programmers, and interested persons are hereby cordially invited to the 13th International Erlang/OTP User Conference, EUC in Stockholm on November 8. Please see the Call for Papers at http://www.erlang.se/euc/07/cfp.html This year's Erlang/OTP User Conference will follow the same format as previous years. Please find both proceedings and photographs at http://www.erlang.se/euc/ Dead-line for submissions is October 15 and presentations of exiting new technical developments and applications are invited. Presentations can be in the form of a report, academic paper or just over-head slides. Also demos to be shown at intermissions are invited. Welcome Bjarne D?cker EUC chairman From sanjaya@REDACTED Thu Sep 13 09:56:55 2007 From: sanjaya@REDACTED (Sanjaya Vitharana) Date: Thu, 13 Sep 2007 13:26:55 +0530 Subject: [erlang-questions] diffrent emulator modes Message-ID: <00f201c7f5db$a6f00820$9a0810ac@wavenet.lk> Hi All, 1.) What is the diffrence between below each and every erlang emulator modes (found in erl_bif_info.c)? are there any docs discribing those? " [source]" " [64-bit]" " [smp:%bpu]" " [async-threads:%d]" " [hipe]" " [kernel-poll:%s]" " [no-frag]" " [io-thread]" " [io-at-once]" " [port-tasks]" " [hybrid heap]" " [incremental GC]" " [type-assertions]" " [debug-compiled]" " [lock-checking]" " [purify-compiled]" " [valgrind-compiled]" 2.) How to configure & make erlang emulator in diffrent modes (above) I am specially interested on below areas for debugging purposes (erlang port driver debugging) type-assertions debug compiled emulator Runing debug compiled emulator in gdb emulator compiled for valgrind 3.) how to run erlang in those modes ? Thanks in advance, Sanjaya Vitharana -------------- next part -------------- An HTML attachment was scrubbed... URL: From alceste@REDACTED Thu Sep 13 10:23:51 2007 From: alceste@REDACTED (Alceste Scalas) Date: Thu, 13 Sep 2007 10:23:51 +0200 Subject: [erlang-questions] Type-tagged FFI interface In-Reply-To: <20070913073023.GA16869@erix.ericsson.se> References: <1189513745.8590.43.camel@gnatziu.crs4.it> <46E692A4.5040008@hyber.org> <1189518730.8590.71.camel@gnatziu.crs4.it> <46E6B073.6060407@hyber.org> <1189525595.8590.122.camel@gnatziu.crs4.it> <46E6BE18.70203@hyber.org> <1189581705.6081.17.camel@gnatziu.crs4.it> <1189587281.6081.55.camel@gnatziu.crs4.it> <20070913073023.GA16869@erix.ericsson.se> Message-ID: <1189671831.28880.23.camel@gnatziu.crs4.it> Il giorno gio, 13/09/2007 alle 09.30 +0200, Raimo Niskanen ha scritto: > I thought [the Erlang FFI proposal] was very thought through, > and complete, but apparently it will benefit from more input from > erlang-questions to settle a bit. I definitely agree, and that's why I didn't send the draft to EEPs list yet... Anyway thanks for having adopted it! > Oh, and I have a suggestion about the actual ffi:call/2,3 functions. > Personally I would prefer an interface with tagged values: > > ffi:call(Port, {ReturnType,Function}, [TaggedVal]) -> > {ReturnType,term()} > ReturnType = type_tag() > TaggedVal = {type_tag(),Val} > Val = term() > type_tag() = uchar|schar|...|pointer|size_t|ssize_t > > e.g > > Pointer = {pointer,PointerVal} = > ffi:call(Port, {pointer,malloc}, [{size_t,1024}]), > void = ffi:call(Port, {void,free}, [Pointer]), > > This would make the code more readable (resembling the C calls) IMHO, > and make the ffi values more self-contained; a return value can > directly be passed to another ffi function. A tagged interface would be *very* nice, and more type-safe --- but it would be a performance killer, too [1]. Maybe something like this would be a good compromise: 1. move ffi:call/3 and ffi:call/2 to ffi.erl (part of the Erlang kernel library?), with the tagged interface you are proposing; 2. rename the "old" FFI BIFs to something like ffi:untagged_call/3 and ffi:untagged_call/2. In general, every FFI function could have a "standard" and recommended version implemented in Erlang, that will support (and check) the type tags. The "real FFI work" would be performed by the untagged_ BIFs. Developers may choose between the tagged and untagged interfaces, depending on the performance/safety/readability tradeoff they're looking for. What do you think? Regards, alceste Notes: [1] The current FFI interface is tuple-based on pourpose: it avoids unrolling lists when counting function call parameters, and Erlang terms are handled with very simple pointer arithmetics. -- Alceste Scalas CRS4 - http://www.crs4.it/ From raimo+erlang-questions@REDACTED Thu Sep 13 11:03:16 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 13 Sep 2007 11:03:16 +0200 Subject: [erlang-questions] Type-tagged FFI interface In-Reply-To: <1189671831.28880.23.camel@gnatziu.crs4.it> References: <1189513745.8590.43.camel@gnatziu.crs4.it> <46E692A4.5040008@hyber.org> <1189518730.8590.71.camel@gnatziu.crs4.it> <46E6B073.6060407@hyber.org> <1189525595.8590.122.camel@gnatziu.crs4.it> <46E6BE18.70203@hyber.org> <1189581705.6081.17.camel@gnatziu.crs4.it> <1189587281.6081.55.camel@gnatziu.crs4.it> <20070913073023.GA16869@erix.ericsson.se> <1189671831.28880.23.camel@gnatziu.crs4.it> Message-ID: <20070913090316.GA17383@erix.ericsson.se> Aah, I see! As we say in swedish - I did not hear the beauty in the crow's song. Then the tagged calls would be implemented in Erlang and themselves call the untagged BIFs. The name ffi:untagged_call feels awkward, though. On Thu, Sep 13, 2007 at 10:23:51AM +0200, Alceste Scalas wrote: > Il giorno gio, 13/09/2007 alle 09.30 +0200, Raimo Niskanen ha scritto: > > I thought [the Erlang FFI proposal] was very thought through, > > and complete, but apparently it will benefit from more input from > > erlang-questions to settle a bit. > > I definitely agree, and that's why I didn't send the draft to EEPs list > yet... Anyway thanks for having adopted it! > > > > Oh, and I have a suggestion about the actual ffi:call/2,3 functions. > > Personally I would prefer an interface with tagged values: > > > > ffi:call(Port, {ReturnType,Function}, [TaggedVal]) -> > > {ReturnType,term()} > > ReturnType = type_tag() > > TaggedVal = {type_tag(),Val} > > Val = term() > > type_tag() = uchar|schar|...|pointer|size_t|ssize_t > > > > e.g > > > > Pointer = {pointer,PointerVal} = > > ffi:call(Port, {pointer,malloc}, [{size_t,1024}]), > > void = ffi:call(Port, {void,free}, [Pointer]), > > > > This would make the code more readable (resembling the C calls) IMHO, > > and make the ffi values more self-contained; a return value can > > directly be passed to another ffi function. > > A tagged interface would be *very* nice, and more type-safe --- but it > would be a performance killer, too [1]. > > Maybe something like this would be a good compromise: > > 1. move ffi:call/3 and ffi:call/2 to ffi.erl (part of the Erlang > kernel library?), with the tagged interface you are proposing; > 2. rename the "old" FFI BIFs to something like ffi:untagged_call/3 > and ffi:untagged_call/2. > > In general, every FFI function could have a "standard" and recommended > version implemented in Erlang, that will support (and check) the type > tags. The "real FFI work" would be performed by the untagged_ BIFs. > Developers may choose between the tagged and untagged interfaces, > depending on the performance/safety/readability tradeoff they're looking > for. > > What do you think? > > Regards, > > alceste > > Notes: > > [1] The current FFI interface is tuple-based on pourpose: it avoids > unrolling lists when counting function call parameters, and > Erlang terms are handled with very simple pointer arithmetics. > -- > Alceste Scalas > CRS4 - http://www.crs4.it/ -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From bent@REDACTED Thu Sep 13 12:34:37 2007 From: bent@REDACTED (Ben Munat) Date: Thu, 13 Sep 2007 00:34:37 -1000 Subject: [erlang-questions] list:join() for erlang? In-Reply-To: References: <46E8115C.8000602@free.fr> Message-ID: <46E9123D.4000503@munat.com> ok wrote: > Otherwise, if what you are after is the Python join(words, sep) > function, you want the code below. As you note, it isn't that hard > to write, but then, neither are most of the functions in the lists > and string modules. This doesn't depend on the element type, so it > could go in the lists module, but considering its likely uses, it > probably belongs in the string module. > > % join([X1,...,Xn], Sep) -> X1 ++ Sep ++ ... ++ Sep ++ Xn; > % join([], _) -> []. > % The intended type is join([[x]], [x]) -> [x]. > > join([X|Xs], []) -> join0(X, Xs); > join([X|Xs], [C]) -> join1(X, C, Xs); > join([X|Xs], Sep) -> join2(X, Sep, Xs); > join([], _) -> []. > > join0(X, [Y|Ys]) -> X ++ join0(Y, Ys); > join0(X, []) -> X. > > join1(X, C, [Y|Ys]) -> X ++ [C|join1(Y, C, Ys)]; > join1(X, _, []) -> X. > > join2(X, Sep, [Y|Ys]) -> X ++ (Sep ++ join2(Y, Sep, Ys)); > join2(X, _, []) -> X. Out of curiosity -- still feeling my way around erlang and functional programming -- aren't the "helper" functions here stack-recursive (i.e. *not* tail-recursive)? In other words "X ++ join(Y, Ys)" would evaluate the recursive calls to join() before being able to concatenate the result onto X... meaning keeping stuff on the stack for each call. Am I right or misinterpreting the call structure? thanks, Ben From rsaccon@REDACTED Thu Sep 13 12:39:31 2007 From: rsaccon@REDACTED (Roberto Saccon) Date: Thu, 13 Sep 2007 07:39:31 -0300 Subject: [erlang-questions] HTTP server optimized for dynamic content ? Message-ID: Does anybody know about any Erlang HTTP server optimized just for dynamic requests ? A bit more sophisticated then those very simple servers floating around in the erlang tutorials, but without handling of static content, sessions and log files ? The closest to this requirements I have found so far is carre from the tercio (http://code.google.com/p/tercio/) project, after stripping off some off its stuff, it might be a starting point. regards -- Roberto Saccon http://rsaccon.com From saleyn@REDACTED Thu Sep 13 13:53:39 2007 From: saleyn@REDACTED (Serge Aleynikov) Date: Thu, 13 Sep 2007 06:53:39 -0500 Subject: [erlang-questions] diffrent emulator modes In-Reply-To: <008b01c7f5d4$610bbea0$9a0810ac@wavenet.lk> References: <008b01c7f5d4$610bbea0$9a0810ac@wavenet.lk> Message-ID: <46E924C3.1010407@gmail.com> Sanjaya Vitharana wrote: > Hi Serge, > > 1.) What is the diffrence between below each and every erlang emulator modes (found in erl_bif_info.c)? are there any docs discribing those? Some of them are described in erts/erl documentation. I put erl arguments below showing how to enable the feature. > " [source]" > " [64-bit]" auto-detected > " [smp:%bpu]" -smp N > " [async-threads:%d]" +A N > " [hipe]" auto-detected > " [kernel-poll:%s]" +K true > " [no-frag]" > " [io-thread]" > " [io-at-once]" > " [port-tasks]" > " [hybrid heap]" -hybrid > " [incremental GC]" > " [type-assertions]" > " [debug-compiled]" > " [lock-checking]" > " [purify-compiled]" > " [valgrind-compiled]" > > > 2.) How to configure & make erlang emulator in diffrent modes (above) Support for most of the modes above are auto-detected by the configure script, so if your OS supports them, the emulator will as well. > I am specially interested on below areas for debugging purposes (erlang port driver debugging) > > type-assertions I am not familiar with this one. > debug compiled emulator > Runing debug compiled emulator in gdb run erl with -emu_args to determine emulator startup command. Then do a "gdb /path/to/beam" and in gdb do "run ARGS_OF_BEAM" where ARGS_OF_BEAM are copied from the console output of -emu_args option. > emulator compiled for valgrind Never tried this one. > 3.) how to run erlang in those modes ? See above. > Thanks in advance, > > Sanjaya Vitharana > From klacke@REDACTED Thu Sep 13 12:59:55 2007 From: klacke@REDACTED (Claes Wikstrom) Date: Thu, 13 Sep 2007 12:59:55 +0200 Subject: [erlang-questions] HTTP server optimized for dynamic content ? In-Reply-To: References: Message-ID: <46E9182B.5070702@hyber.org> Roberto Saccon wrote: > Does anybody know about any Erlang HTTP server optimized just for > dynamic requests ? A bit more sophisticated then those very simple > servers floating around in the erlang tutorials, but without handling > of static content, sessions and log files ? > > The closest to this requirements I have found so far is carre from the > tercio (http://code.google.com/p/tercio/) project, after stripping off > some off its stuff, it might be a starting point. > Read up on appmods in Yaws /klacke From rsaccon@REDACTED Thu Sep 13 13:10:55 2007 From: rsaccon@REDACTED (Roberto Saccon) Date: Thu, 13 Sep 2007 08:10:55 -0300 Subject: [erlang-questions] HTTP server optimized for dynamic content ? In-Reply-To: <46E9182B.5070702@hyber.org> References: <46E9182B.5070702@hyber.org> Message-ID: I guess the question was not clear enough. it should not be or not be based on yaws. yaws is great as an all purpose server, but if you are doing very specific things, you need to patch the internals of yaws (that's what I am doing and I am pretty sure others do that as well ..) and a lightweight http server would be easier to maintain for such purpose On 9/13/07, Claes Wikstrom wrote: > Roberto Saccon wrote: > > Does anybody know about any Erlang HTTP server optimized just for > > dynamic requests ? A bit more sophisticated then those very simple > > servers floating around in the erlang tutorials, but without handling > > of static content, sessions and log files ? > > > > The closest to this requirements I have found so far is carre from the > > tercio (http://code.google.com/p/tercio/) project, after stripping off > > some off its stuff, it might be a starting point. > > > > Read up on appmods in Yaws > > /klacke > -- Roberto Saccon http://rsaccon.com From harveyd@REDACTED Thu Sep 13 14:20:07 2007 From: harveyd@REDACTED (Dale Harvey) Date: Thu, 13 Sep 2007 13:20:07 +0100 Subject: [erlang-questions] Erlang Positions Message-ID: Internet Startup Jobs - Project Playfair - 'websheets that talk to websheets' Edinburgh-based start-up Project Playfair has won the prestigious Seedcamp Venture Capital Start-Up Competition and is now hiring smart young things. (These are equity positions). You will have strong experience in functional programming (Erlang preferred but not necessary). Skills in the Ubuntu platform (6.06 LTS Dapper Drake) is also desirable. We are looking for immediate starts and will consider current students on a part time basis ? 20 hours a week. Interviews will be Friday 14th September 7pm in Edinburgh at 34a Howe St Persons outwith Scotland who would consider relocating feel free to get in touch if you have a work permit for the EU or are an EU Citizen. To apply phone Gordon 07776 251669 Seedcamp (seedcamp.org) is a VC funding competition organised by the following VC firms: * Atlas Venture * Index Ventures * Accel * Benchmark Capital * Highland Capital Partners * DFJEsprit * Partech International * Advent Venture Partners * 3i Seedcamp backers have previously funded a large number of companies inluding (but not exclusively): * Facebook * Skype * eBay * Red Hat * Real * LastFM * BitTorrent * Macromedia * MySQL * AOL * TrollTech * Betfair * Setanta Sports * JBoss * Collabnet -------------- next part -------------- An HTML attachment was scrubbed... URL: From bjorn@REDACTED Thu Sep 13 14:39:10 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 13 Sep 2007 14:39:10 +0200 Subject: [erlang-questions] bad links in OTP Design Principles html doc In-Reply-To: <29292211.7081189469246463.JavaMail.root@zimbra> References: <29292211.7081189469246463.JavaMail.root@zimbra> Message-ID: Michael FIG writes: > I sent this a couple of times to webmaster@REDACTED, but they haven't corrected it yet. > Could somebody please correct the links in the table of contents for OTP Design Principles? It is fixed now. I've also made sure that the problem will not reappear when we release R12B. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bjorn@REDACTED Thu Sep 13 14:52:52 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 13 Sep 2007 14:52:52 +0200 Subject: [erlang-questions] diffrent emulator modes In-Reply-To: <00f201c7f5db$a6f00820$9a0810ac@wavenet.lk> References: <00f201c7f5db$a6f00820$9a0810ac@wavenet.lk> Message-ID: "Sanjaya Vitharana" writes: > 2.) How to configure & make erlang emulator in diffrent modes (above) > > I am specially interested on below areas for debugging purposes (erlang port driver debugging) > > type-assertions Automatically turned on in a debug-built emulator. > > 3.) how to run erlang in those modes ? cerl -debug cerl -valgrind Only works when running from within the source code directory structure, not when Erlang/OTP has been installed. See the comments in the bin/cerl script for further information. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From sean.hinde@REDACTED Thu Sep 13 14:59:56 2007 From: sean.hinde@REDACTED (Sean Hinde) Date: Thu, 13 Sep 2007 14:59:56 +0200 Subject: [erlang-questions] HTTP server optimized for dynamic content ? In-Reply-To: References: <46E9182B.5070702@hyber.org> Message-ID: <3B4EEAFD-53D4-4CAA-9DC8-B85D33AFBA33@gmail.com> The one by me in the Trapexit tutorial is not a lot of code but you may find it complete enough. What else do you need in addition to HTTP/1.1 and dynamic pages? Sean On 13 Sep 2007, at 13:10, Roberto Saccon wrote: > I guess the question was not clear enough. it should not be or not be > based on yaws. yaws is great as an all purpose server, but if you are > doing very specific things, you need to patch the internals of yaws > (that's what I am doing and I am pretty sure others do that as well > ..) and a lightweight http server would be easier to maintain for > such purpose > > On 9/13/07, Claes Wikstrom wrote: >> Roberto Saccon wrote: >>> Does anybody know about any Erlang HTTP server optimized just for >>> dynamic requests ? A bit more sophisticated then those very simple >>> servers floating around in the erlang tutorials, but without >>> handling >>> of static content, sessions and log files ? >>> >>> The closest to this requirements I have found so far is carre >>> from the >>> tercio (http://code.google.com/p/tercio/) project, after >>> stripping off >>> some off its stuff, it might be a starting point. >>> >> >> Read up on appmods in Yaws >> >> /klacke >> > > > -- > Roberto Saccon > http://rsaccon.com > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From raimo+erlang-questions@REDACTED Thu Sep 13 15:39:35 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 13 Sep 2007 15:39:35 +0200 Subject: [erlang-questions] bad links in OTP Design Principles html doc In-Reply-To: <29292211.7081189469246463.JavaMail.root@zimbra> References: <29292211.7081189469246463.JavaMail.root@zimbra> Message-ID: <20070913133935.GA22375@erix.ericsson.se> Sorry about you not getting an answer before. I forwarded it to the concerned, they identified the problem but who should reply was forgotten. The problem is that there is a script that goes through the documentation and rewrites links to create the version independent documentation. That script assumed a flat namespace for the .html pages. For gen_server there is both a module documentation and a design principles documentation page with the same basename. It is easier to change the name of the design principles document than to make the rewriting script aware of manual sections (separating namespaces), so that is what we will do, but it will have to wait to the next release, that is R12B during this autumn. On Mon, Sep 10, 2007 at 06:07:26PM -0600, Michael FIG wrote: > I sent this a couple of times to webmaster@REDACTED, but they haven't corrected it yet. > > Could somebody please correct the links in the table of contents for OTP Design Principles? > > In: http://www.erlang.org/doc/design_principles/part_frame.html > the entire chapter on the Gen_server behaviour incorrectly links to doc/man/gen_server.html > instead of doc/design_principles/gen_server.html > > This can be quite confusing, and naive readers would not have the benefit of the excellent examples and high-level overview of gen_server. > > Please fix this soon. If I don't hear anything back in the next few days, I'll try investigating the document source and writing a patch for the incorrect table of contents. > > Thanks, > > -- > Michael FIG , PMP > MarkeTel Multi-Line Dialing Systems, Ltd. > Phone: (306) 359-6893 ext. 528 > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From rsaccon@REDACTED Thu Sep 13 15:40:38 2007 From: rsaccon@REDACTED (Roberto Saccon) Date: Thu, 13 Sep 2007 10:40:38 -0300 Subject: [erlang-questions] HTTP server optimized for dynamic content ? In-Reply-To: <3B4EEAFD-53D4-4CAA-9DC8-B85D33AFBA33@gmail.com> References: <46E9182B.5070702@hyber.org> <3B4EEAFD-53D4-4CAA-9DC8-B85D33AFBA33@gmail.com> Message-ID: Yeah, that is pretty close to what I am looking for. What I haven't see there is decoding of url encoded postdata thanks Roberto On 9/13/07, Sean Hinde wrote: > The one by me in the Trapexit tutorial is not a lot of code but you > may find it complete enough. What else do you need in addition to > HTTP/1.1 and dynamic pages? > > Sean > > On 13 Sep 2007, at 13:10, Roberto Saccon wrote: > > > I guess the question was not clear enough. it should not be or not be > > based on yaws. yaws is great as an all purpose server, but if you are > > doing very specific things, you need to patch the internals of yaws > > (that's what I am doing and I am pretty sure others do that as well > > ..) and a lightweight http server would be easier to maintain for > > such purpose > > > > On 9/13/07, Claes Wikstrom wrote: > >> Roberto Saccon wrote: > >>> Does anybody know about any Erlang HTTP server optimized just for > >>> dynamic requests ? A bit more sophisticated then those very simple > >>> servers floating around in the erlang tutorials, but without > >>> handling > >>> of static content, sessions and log files ? > >>> > >>> The closest to this requirements I have found so far is carre > >>> from the > >>> tercio (http://code.google.com/p/tercio/) project, after > >>> stripping off > >>> some off its stuff, it might be a starting point. > >>> > >> > >> Read up on appmods in Yaws > >> > >> /klacke > >> > > > > > > -- > > Roberto Saccon > > http://rsaccon.com > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- Roberto Saccon http://rsaccon.com From sean.hinde@REDACTED Thu Sep 13 16:01:43 2007 From: sean.hinde@REDACTED (Sean Hinde) Date: Thu, 13 Sep 2007 16:01:43 +0200 Subject: [erlang-questions] HTTP server optimized for dynamic content ? In-Reply-To: References: <46E9182B.5070702@hyber.org> <3B4EEAFD-53D4-4CAA-9DC8-B85D33AFBA33@gmail.com> Message-ID: Well, if the yaws project didn't mind I would take the very nicely written version from yaws_api.erl :-) Sean On 13 Sep 2007, at 15:40, Roberto Saccon wrote: > Yeah, that is pretty close to what I am looking for. What I haven't > see there is decoding of url encoded postdata > > thanks > Roberto > > On 9/13/07, Sean Hinde wrote: >> The one by me in the Trapexit tutorial is not a lot of code but you >> may find it complete enough. What else do you need in addition to >> HTTP/1.1 and dynamic pages? >> >> Sean >> >> On 13 Sep 2007, at 13:10, Roberto Saccon wrote: >> >>> I guess the question was not clear enough. it should not be or >>> not be >>> based on yaws. yaws is great as an all purpose server, but if >>> you are >>> doing very specific things, you need to patch the internals of yaws >>> (that's what I am doing and I am pretty sure others do that as well >>> ..) and a lightweight http server would be easier to maintain for >>> such purpose >>> >>> On 9/13/07, Claes Wikstrom wrote: >>>> Roberto Saccon wrote: >>>>> Does anybody know about any Erlang HTTP server optimized just for >>>>> dynamic requests ? A bit more sophisticated then those very simple >>>>> servers floating around in the erlang tutorials, but without >>>>> handling >>>>> of static content, sessions and log files ? >>>>> >>>>> The closest to this requirements I have found so far is carre >>>>> from the >>>>> tercio (http://code.google.com/p/tercio/) project, after >>>>> stripping off >>>>> some off its stuff, it might be a starting point. >>>>> >>>> >>>> Read up on appmods in Yaws >>>> >>>> /klacke >>>> >>> >>> >>> -- >>> Roberto Saccon >>> http://rsaccon.com >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> > > > -- > Roberto Saccon > http://rsaccon.com From peter@REDACTED Thu Sep 13 16:26:58 2007 From: peter@REDACTED (Peter K Chan) Date: Thu, 13 Sep 2007 16:26:58 +0200 Subject: [erlang-questions] list:join() for erlang? In-Reply-To: References: Message-ID: That would be a great help! It would be great if this functionality can make it into the official package. Peter -----Original Message----- From: Kenneth Lundin [mailto:kenneth.lundin@REDACTED] Sent: Thursday, September 13, 2007 1:39 AM To: Peter K Chan Cc: ok; erlang-questions Questions Subject: Re: [erlang-questions] list:join() for erlang? We are considering adding a string:join(ListOfStrings, SeparatorString) -> String in the next release. Note that String is a list of integers. /Kenneth (Erlang/OTP team at Ericsson) On 9/13/07, Peter K Chan wrote: > Yes, the list of lists was what I meant. :) > > I wanted Python/Ruby style join, where the function can take any > arbitrary separator. > > I already have the code, so I am looking for either information on where > to find such functionality in OTP (if it is hidden in some obscure > module), or to suggest that such a function be added to lists or strings > by OTP. > > Peter > > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of ok > Sent: Wednesday, September 12, 2007 6:01 PM > To: erlang-questions Questions > Subject: Re: [erlang-questions] list:join() for erlang? > > On 13 Sep 2007, at 4:26 am, Peter K Chan wrote: > > > Sorry that I made an omission. > > > > I was referring to the variant of join which takes a separator. For > > example: lists:join("abc", "/"), which evaluates to "a/b/c". > > Should that have been join(["a","b","c"], "/")? > > There are filename:join/2 and filename:join/1 functions which come > close to what you want, but they are specialised to file names and > do stuff you may not want. On the other hand, if, as the slash > suggests, you are pasting file names together, then filename:join/1 > is EXACTLY what you want. > > Otherwise, if what you are after is the Python join(words, sep) > function, you want the code below. As you note, it isn't that hard > to write, but then, neither are most of the functions in the lists > and string modules. This doesn't depend on the element type, so it > could go in the lists module, but considering its likely uses, it > probably belongs in the string module. > > % join([X1,...,Xn], Sep) -> X1 ++ Sep ++ ... ++ Sep ++ Xn; > % join([], _) -> []. > % The intended type is join([[x]], [x]) -> [x]. > > join([X|Xs], []) -> join0(X, Xs); > join([X|Xs], [C]) -> join1(X, C, Xs); > join([X|Xs], Sep) -> join2(X, Sep, Xs); > join([], _) -> []. > > join0(X, [Y|Ys]) -> X ++ join0(Y, Ys); > join0(X, []) -> X. > > join1(X, C, [Y|Ys]) -> X ++ [C|join1(Y, C, Ys)]; > join1(X, _, []) -> X. > > join2(X, Sep, [Y|Ys]) -> X ++ (Sep ++ join2(Y, Sep, Ys)); > join2(X, _, []) -> X. > > > _______________________________________________ > 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 fritchie@REDACTED Thu Sep 13 16:45:32 2007 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Thu, 13 Sep 2007 09:45:32 -0500 Subject: [erlang-questions] [Q] Mnesia is overloaded In-Reply-To: Message of "Mon, 10 Sep 2007 15:08:51 +0200." <46E541E3.30000@volny.cz> Message-ID: <200709131445.l8DEjWgg084144@snookles.snookles.com> >>>>> "ll" == Ladislav Lenart writes: ll> Mnesia is overloaded: {dump_log, write_threshold} Ladislav: This question appears frequently enough on this list that it probably ought to become a member of the FAQ. A search for that error message in this list's archives should show several threads over the last couple of years. Basic summary: it's a sign of a busy system and is mostly harmless. -Scott From bob@REDACTED Thu Sep 13 16:45:43 2007 From: bob@REDACTED (Bob Ippolito) Date: Thu, 13 Sep 2007 07:45:43 -0700 Subject: [erlang-questions] HTTP server optimized for dynamic content ? In-Reply-To: References: Message-ID: <6a36e7290709130745t152e9c1dub183de89ac2daa3a@mail.gmail.com> There's a copy of what we use, mochiweb, in here: http://undefined.org/erlang/c4-1_erlang_mit.tgz It'll be properly open source at some point, but what's in there works. It's done billions of HTTP requests without exploding on us :) -bob On 9/13/07, Roberto Saccon wrote: > Does anybody know about any Erlang HTTP server optimized just for > dynamic requests ? A bit more sophisticated then those very simple > servers floating around in the erlang tutorials, but without handling > of static content, sessions and log files ? > > The closest to this requirements I have found so far is carre from the > tercio (http://code.google.com/p/tercio/) project, after stripping off > some off its stuff, it might be a starting point. > > regards > -- > Roberto Saccon > http://rsaccon.com > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From alceste@REDACTED Thu Sep 13 16:46:48 2007 From: alceste@REDACTED (Alceste Scalas) Date: Thu, 13 Sep 2007 16:46:48 +0200 Subject: [erlang-questions] Erlang FFI: 1st discussion summary Message-ID: <1189694808.28880.49.camel@gnatziu.crs4.it> Hello, in order to make it easier to follow the Erlang FFI (Foreign Function Interface) proposal, here's a summary of the discussion so far, and a set of possible solutions for the issues being raised. I could send other summaries like this, if/when needed. The initial Erlang FFI proposal is still available in [0]. It was accepted as EEP-0007 [1], but it has been frozen until the discussion on this mailing list settles. A link to the first thread of the discussion itself is in [2]. Here's an index of the issues and suggestions that have appeared so far (I'm reordering them for ease of answer): 1. Raimo Niskanen proposed a type-tagged interface for the FFI calls: call arguments and return values could be tuples in the form {type_tag(), Value} [3]; 2. Claes Wikstr?m and Vlad Dumitrescu wondered how C pointers (to buffers or strings) returned by FFI calls could be turned into Erlang binaries; 3. when C buffers are turned into Erlang binaries, binary matching could be used e.g. to extract C struct fields. But this could require knowing the sizes of the C types on the system in use. Here are the proposals for addressing these issues (based on the ideas gathered so far). ======================== 1. Type-tagged FFI calls ======================== Type tags are extremely useful and can increase call safety, but they can also kill FFI performance (see the final note in [4]). A good compromise would be to leave the lower-level FFI BIFs without tags, and implement type tags handling in Erlang (i.e. in a ffi.erl module). Raimo agreed with this idea. The old untagged ffi:call/3 and ffi:call/2 BIFs could be kept with a different name (proposal: ffi:raw_call/3 and ffi:raw_call/2). The higher-level, type-tagged interface for FFI calls could be: ffi:call(Port, {ReturnType, Function}, [TaggedVal]) -> {ReturnType,term()} ReturnType = type_tag() Function = string() | atom() TaggedVal = {type_tag(), Val} Val = term() type_tag() = uchar|schar|...|pointer|size_t|ssize_t It checks whether the required C function was preloaded with erl_ddll:load_library/3. Then, two alternatives arise: a. if the C function was preloaded, its signature is compared with the type tags. If they match, a raw FFI call is performed (with ffi:raw_call/2); otherwise, a badarg exception is raised; b. if the C function was *not* preloaded, the type tags will be ignored and a raw FFI call will be performed (with ffi:raw_call/3). In both cases, the raw FFI call return value will be returned as a {ReturnType, RawReturnValue} tuple. -------------------------------------------------- 1.1. Getting information about preloaded functions -------------------------------------------------- The proposed high-level ffi:call/3 would need information about functions and FFI signatures preloaded with erl_ddll:load_library/3. This information could be useful for developers, too (e.g. for debugging pourposes). For these reasons, the erl_ddll:info/2 BIF could be extended with a 'preloads' argument, that would return a list of preloaded functions, signatures etc. This information could be obtained via erl_ddll:info/1 and erl_ddll:info/0 as well. ====================================================== 2. Creating Erlang binaries from C strings and buffers ====================================================== The first proposal on this issue [5] can be revised considering type tagging. A new 'cstring' type atom/tag can be introduced, in order to distinguish NULL-terminated C strings from generic 'pointer's to byte buffers. Two functions could be used for turning them into Erlang binaries: ffi:cstring_to_binary(TaggedCString) -> binary() TaggedCString = {cstring, CStringPtr} CStringPtr = integer() Return a new binary with a copy of the given NULL-terminated C string (including the trailing \0); ffi:buffer_to_binary(TaggedPointer, Size) -> binary() TaggedPointer = {pointer, Ptr} Ptr = integer() Return a new binary filled with a copy of Size bytes read from the given C pointer. These two functions would have, as seen in the previous section, their type-untagged equivalents: ffi:raw_cstring_to_binary/1 and ffi:raw_buffer_to_binary/2. ================================== 3. Determining the size of C types ================================== The sizes of C types could be determined in run-time with a new ffi:sizeof/1 BIF (initially proposed in [6]): * ffi:sizeof(CType) -> integer() CType = type_tag() Return the number of bytes used by CType on the current platform. Type size information should, in general, *not* be hardcoded, because it may change when running the same BEAM files on different architectures. The BIF above is the recommended way for getting type sizes when writing portable code. However, when the FFI-based code is *not* expected to be portable without recompilation, the size of C types remains constant and could be determined when the Erlang/OTP sources are compiled. Thus, this information could be stored in a .hrl file. Developers could -include_lib("kernel/include/ffi_hardcodes.hrl") [7] and obtain a set of faster and easier-to-use macros, for each supported FFI type: FFI_HARDCODED_SIZEOF_ The type size in bytes FFI_HARDCODED__BITS The type size in bits The size in bits is precomputed in order to simplify binary matching, since expressions like (?FFI_HARDCODED_SIZEOF_LONG * 8) are not allowed in patterns. =========================== 4. Other minor enhancements =========================== The following enhancements have never been discussed so far, but they are very small and extremely trivial to implement: * a new erl_ddll:load_library/2 function could be added, that can be used instead of calling erl_ddll:load_library/3 with an empty list of options (i.e. when no preloads are requested); * when used with a library instead of a linked-in driver, erlang:open_port/2 calls are quite noisy (the 'spawn' and the list of options are redundant). A new erlang:open_port/1 function could be added: erlang:open_port(Library) -> port() Library = string() Under the hoods, it could just call something like the existing erlang:open_port({spawn, Library}, [binary]). ============= 5. That's all ============= Please tell your opinion about the proposals above, and complain if something is missing. Everything will be implemented depending on your feedback. Thanks! ===== Notes ===== [0] Home page of the FFI for Erlang/OTP http://muvara.org/crs4/erlang/ffi [1] EEP-0007: Foreign Function Interface (FFI) http://www.erlang.org/eeps/eep-0007.html [2] Thread about the Erlang FFI on the erlang-questions mailing list http://erlang.org/pipermail/erlang-questions/2007-September/029121.html [3] Proposal for type-tagged FFI calls http://erlang.org/pipermail/erlang-questions/2007-September/029174.html [4] FFI tagging vs. call performance http://erlang.org/pipermail/erlang-questions/2007-September/029179.html [5] First proposal for turning C strings/buffers into binaries http://erlang.org/pipermail/erlang-questions/2007-September/029141.html [6] First proposal about a ffi:sizeof/1 BIF: http://erlang.org/pipermail/erlang-questions/2007-September/029146.html [7] From the implementation point of view, the ffi_hardcodes.hrl header file could be autogenerated by GNU Autoconf from ffi_hardcodes.hrl.in. Regards, alceste -- Alceste Scalas CRS4 - http://www.crs4.it/ From rsaccon@REDACTED Thu Sep 13 17:13:21 2007 From: rsaccon@REDACTED (Roberto Saccon) Date: Thu, 13 Sep 2007 12:13:21 -0300 Subject: [erlang-questions] HTTP server optimized for dynamic content ? In-Reply-To: <6a36e7290709130745t152e9c1dub183de89ac2daa3a@mail.gmail.com> References: <6a36e7290709130745t152e9c1dub183de89ac2daa3a@mail.gmail.com> Message-ID: wow, that looks great !!! thanks Roberto On 9/13/07, Bob Ippolito wrote: > There's a copy of what we use, mochiweb, in here: > http://undefined.org/erlang/c4-1_erlang_mit.tgz > > It'll be properly open source at some point, but what's in there > works. It's done billions of HTTP requests without exploding on us :) > > -bob > > On 9/13/07, Roberto Saccon wrote: > > Does anybody know about any Erlang HTTP server optimized just for > > dynamic requests ? A bit more sophisticated then those very simple > > servers floating around in the erlang tutorials, but without handling > > of static content, sessions and log files ? > > > > The closest to this requirements I have found so far is carre from the > > tercio (http://code.google.com/p/tercio/) project, after stripping off > > some off its stuff, it might be a starting point. > > > > regards > > -- > > Roberto Saccon > > http://rsaccon.com > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > -- Roberto Saccon http://rsaccon.com From lenartlad@REDACTED Thu Sep 13 17:41:53 2007 From: lenartlad@REDACTED (Ladislav Lenart) Date: Thu, 13 Sep 2007 17:41:53 +0200 Subject: [erlang-questions] [Q] Mnesia is overloaded In-Reply-To: <200709131445.l8DEjWgg084144@snookles.snookles.com> References: <200709131445.l8DEjWgg084144@snookles.snookles.com> Message-ID: <46E95A41.5080103@volny.cz> Scott Lystig Fritchie wrote: >>>>>> "ll" == Ladislav Lenart writes: > > ll> Mnesia is overloaded: {dump_log, write_threshold} > > Ladislav: This question appears frequently enough on this list that it > probably ought to become a member of the FAQ. A search for that error > message in this list's archives should show several threads over the > last couple of years. > > Basic summary: it's a sign of a busy system and is mostly harmless. Hello, I've read the latest postings about it but I am still a little bit confused. For example what does "mostly harmless" from above mean? Our mnesia database is now running on one node and is overloaded for ~20 concurrent writes which seems pretty low to me BTW. And what about ~1000 of them? How long will this report remain harmless? Or in other words, what is the maximum frequency of these concurrent bursts that mnesia running on one node can handle? What is the main cause of the report? Is it a total number of concurrent writes? Or is it a total size of all data to be written (from all the writes)? I am sorry to bother you all with this issue (again), but words like "often enough" and "mostly harmless" are too vague for me to be regarded as answers to my questions. Thanks in advance, Ladislav Lenart From dmercer@REDACTED Thu Sep 13 18:27:39 2007 From: dmercer@REDACTED (David Mercer) Date: Thu, 13 Sep 2007 11:27:39 -0500 Subject: [erlang-questions] list:join() for erlang? In-Reply-To: References: Message-ID: <003801c7f623$011dffe0$891ea8c0@SSI.CORP> Just wanted to make sure that it will accept any integers, not just those in the ISO-8859 range (0-255). Cheers, David -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Kenneth Lundin Sent: Thursday, September 13, 2007 01:39 To: Peter K Chan Cc: erlang-questions Questions Subject: Re: [erlang-questions] list:join() for erlang? We are considering adding a string:join(ListOfStrings, SeparatorString) -> String in the next release. Note that String is a list of integers. /Kenneth (Erlang/OTP team at Ericsson) On 9/13/07, Peter K Chan wrote: > Yes, the list of lists was what I meant. :) > > I wanted Python/Ruby style join, where the function can take any > arbitrary separator. > > I already have the code, so I am looking for either information on where > to find such functionality in OTP (if it is hidden in some obscure > module), or to suggest that such a function be added to lists or strings > by OTP. > > Peter > > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of ok > Sent: Wednesday, September 12, 2007 6:01 PM > To: erlang-questions Questions > Subject: Re: [erlang-questions] list:join() for erlang? > > On 13 Sep 2007, at 4:26 am, Peter K Chan wrote: > > > Sorry that I made an omission. > > > > I was referring to the variant of join which takes a separator. For > > example: lists:join("abc", "/"), which evaluates to "a/b/c". > > Should that have been join(["a","b","c"], "/")? > > There are filename:join/2 and filename:join/1 functions which come > close to what you want, but they are specialised to file names and > do stuff you may not want. On the other hand, if, as the slash > suggests, you are pasting file names together, then filename:join/1 > is EXACTLY what you want. > > Otherwise, if what you are after is the Python join(words, sep) > function, you want the code below. As you note, it isn't that hard > to write, but then, neither are most of the functions in the lists > and string modules. This doesn't depend on the element type, so it > could go in the lists module, but considering its likely uses, it > probably belongs in the string module. > > % join([X1,...,Xn], Sep) -> X1 ++ Sep ++ ... ++ Sep ++ Xn; > % join([], _) -> []. > % The intended type is join([[x]], [x]) -> [x]. > > join([X|Xs], []) -> join0(X, Xs); > join([X|Xs], [C]) -> join1(X, C, Xs); > join([X|Xs], Sep) -> join2(X, Sep, Xs); > join([], _) -> []. > > join0(X, [Y|Ys]) -> X ++ join0(Y, Ys); > join0(X, []) -> X. > > join1(X, C, [Y|Ys]) -> X ++ [C|join1(Y, C, Ys)]; > join1(X, _, []) -> X. > > join2(X, Sep, [Y|Ys]) -> X ++ (Sep ++ join2(Y, Sep, Ys)); > join2(X, _, []) -> X. > > > _______________________________________________ > 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 david.hopwood@REDACTED Thu Sep 13 18:36:19 2007 From: david.hopwood@REDACTED (David Hopwood) Date: Thu, 13 Sep 2007 17:36:19 +0100 Subject: [erlang-questions] Type-tagged FFI interface In-Reply-To: <1189671831.28880.23.camel@gnatziu.crs4.it> References: <1189513745.8590.43.camel@gnatziu.crs4.it> <46E692A4.5040008@hyber.org> <1189518730.8590.71.camel@gnatziu.crs4.it> <46E6B073.6060407@hyber.org> <1189525595.8590.122.camel@gnatziu.crs4.it> <46E6BE18.70203@hyber.org> <1189581705.6081.17.camel@gnatziu.crs4.it> <1189587281.6081.55.camel@gnatziu.crs4.it> <20070913073023.GA16869@erix.ericsson.se> <1189671831.28880.23.camel@gnatziu.crs4.it> Message-ID: <46E96703.10509@industrial-designers.co.uk> Alceste Scalas wrote: > Il giorno gio, 13/09/2007 alle 09.30 +0200, Raimo Niskanen ha scritto: >> >> Oh, and I have a suggestion about the actual ffi:call/2,3 functions. >> Personally I would prefer an interface with tagged values: >> >> ffi:call(Port, {ReturnType,Function}, [TaggedVal]) -> >> {ReturnType,term()} >> ReturnType = type_tag() >> TaggedVal = {type_tag(),Val} >> Val = term() >> type_tag() = uchar|schar|...|pointer|size_t|ssize_t Tagging pointers makes sense, but the representation of a pointer value need not be specified. Tagging integer types makes less sense, I think; instead the FFI should check that the actual value of the integer falls within the range of its C type (see below for an interface that would support this). >> e.g >> >> Pointer = {pointer,PointerVal} = >> ffi:call(Port, {pointer,malloc}, [{size_t,1024}]), >> void = ffi:call(Port, {void,free}, [Pointer]), >> >> This would make the code more readable (resembling the C calls) IMHO, >> and make the ffi values more self-contained; a return value can >> directly be passed to another ffi function. > > A tagged interface would be *very* nice, and more type-safe --- but it > would be a performance killer, too [1]. > > [1] The current FFI interface is tuple-based on purpose: it avoids > unrolling lists when counting function call parameters, and > Erlang terms are handled with very simple pointer arithmetics. That problem can be solved by "compiling" each C function signature into an Erlang function: ffi:c_function(port(), type_tag(), atom(), [type_tag()]) -> fun() type_tag() = uchar|schar|...|pointer|nonnull|size_t|ssize_t C_malloc = ffi:c_function(Port, nonnull, malloc, [size_t]), C_free = ffi:c_function(Port, void, free, [pointer]), C_memset = ffi:c_function(Port, void, memset, [nonnull, int, size_t]), C_memcpy = ffi:c_function(Port, void, memcpy, [nonnull, nonnull, size_t]), 'nonnull' means a pointer that is checked by the FFI to be non-NULL, i.e. an Erlang exception will be thrown if a NULL pointer is passed or returned. With the above definitions, the following code would be correct even though the mallocs may fail: Src = C_malloc(1024), Dest = C_malloc(1024), void = C_memset(Src, 42, 1024), void = C_memcpy(Dest, Src, 1024), void = C_free(Src), void = C_free(Dest), This could be implemented using one Erlang function definition for each argument count (up to some maximum), closed over some private data structure that holds the C type information. > In general, every FFI function could have a "standard" and recommended > version implemented in Erlang, that will support (and check) the type > tags. The "real FFI work" would be performed by the untagged_ BIFs. > Developers may choose between the tagged and untagged interfaces, > depending on the performance/safety/readability tradeoff they're looking > for. I don't think there's any need for a trade-off here. The cost of type checking is negligable compared to the other overheads introduced by this kind of interface (given that we need to do type conversions anyway). -- David Hopwood From gregory.t.brown@REDACTED Thu Sep 13 19:48:57 2007 From: gregory.t.brown@REDACTED (Gregory Brown) Date: Thu, 13 Sep 2007 13:48:57 -0400 Subject: [erlang-questions] OnLamp article, An Introduction to Erlang Message-ID: Hey folks, I wrote a very basic introduction to Erlang for O'Reilly OnLamp. It covers some of the basic constructs and shows some simple examples of Erlang code, with all my working knowledge stemming from Joe's book. :) I'm definitely an Erlang noob, but I hope that this is helpful to others trying to learn the language who haven't yet picked up "Programming Erlang". http://www.onlamp.com/pub/a/onlamp/2007/09/13/introduction-to-erlang.html Please let me know if there are any improvements that can be made. I probably won't be able to easily get them pushed through to the OnLamp site, but I'll republish after a month from now with any changes somewhere else. Hope this is interesting to you, -greg From dmercer@REDACTED Thu Sep 13 21:45:45 2007 From: dmercer@REDACTED (David Mercer) Date: Thu, 13 Sep 2007 14:45:45 -0500 Subject: [erlang-questions] list:join() for erlang? In-Reply-To: <46E9123D.4000503@munat.com> References: <46E8115C.8000602@free.fr> <46E9123D.4000503@munat.com> Message-ID: <000101c7f63e$adabef40$891ea8c0@SSI.CORP> On Thursday, September 13, 2007, Ben Munat wrote: > Out of curiosity -- still feeling my way around erlang and functional > programming -- aren't the "helper" functions here stack-recursive (i.e. *not* > tail-recursive)? Looks like you're right. Here's my tail-recursive version of the same: join([], _) -> []; join([S1 | S_Rest], Sep) -> S1 ++ reverse_join(lists:reverse(S_Rest), Sep, []). reverse_join([], _, Joined) -> Joined; reverse_join([S1 | S_Rest], Sep, Joined) -> reverse_join(S_Rest, Sep, Sep ++ S1 ++ Joined). Cheers, David From bob@REDACTED Thu Sep 13 22:38:29 2007 From: bob@REDACTED (Bob Ippolito) Date: Thu, 13 Sep 2007 13:38:29 -0700 Subject: [erlang-questions] list:join() for erlang? In-Reply-To: <000101c7f63e$adabef40$891ea8c0@SSI.CORP> References: <46E8115C.8000602@free.fr> <46E9123D.4000503@munat.com> <000101c7f63e$adabef40$891ea8c0@SSI.CORP> Message-ID: <6a36e7290709131338i4c19baefm44602f659affcc9@mail.gmail.com> On 9/13/07, David Mercer wrote: > On Thursday, September 13, 2007, Ben Munat wrote: > > Out of curiosity -- still feeling my way around erlang and functional > > programming -- aren't the "helper" functions here stack-recursive (i.e. > *not* > > tail-recursive)? > > Looks like you're right. Here's my tail-recursive version of the same: > > join([], _) -> []; > join([S1 | S_Rest], Sep) -> > S1 ++ reverse_join(lists:reverse(S_Rest), Sep, []). > > reverse_join([], _, Joined) -> Joined; > reverse_join([S1 | S_Rest], Sep, Joined) -> > reverse_join(S_Rest, Sep, Sep ++ S1 ++ Joined). Using ++ all over the place is probably a bad idea, at least according to the performance guide and my intuition. I haven't profiled it. This is our join/2, which is largely the same but uses lists:flatten/1 instead of ++: join([], _Separator) -> []; join([S], _Separator) -> lists:flatten(S); join(Strings, Separator) -> lists:flatten(revjoin(lists:reverse(Strings), Separator, [])). revjoin([], _Separator, Acc) -> Acc; revjoin([S | Rest], Separator, []) -> revjoin(Rest, Separator, [S]); revjoin([S | Rest], Separator, Acc) -> revjoin(Rest, Separator, [S, Separator | Acc]). -bob From dbt@REDACTED Thu Sep 13 23:39:33 2007 From: dbt@REDACTED (David Terrell) Date: Thu, 13 Sep 2007 16:39:33 -0500 Subject: [erlang-questions] list:join() for erlang? In-Reply-To: <6a36e7290709131338i4c19baefm44602f659affcc9@mail.gmail.com> References: <46E8115C.8000602@free.fr> <46E9123D.4000503@munat.com> <000101c7f63e$adabef40$891ea8c0@SSI.CORP> <6a36e7290709131338i4c19baefm44602f659affcc9@mail.gmail.com> Message-ID: <20070913213933.GC18483@sphinx.chicagopeoplez.org> On Thu, Sep 13, 2007 at 01:38:29PM -0700, Bob Ippolito wrote: > On 9/13/07, David Mercer wrote: > > On Thursday, September 13, 2007, Ben Munat wrote: > > > Out of curiosity -- still feeling my way around erlang and functional > > > programming -- aren't the "helper" functions here stack-recursive (i.e. > > *not* > > > tail-recursive)? > > > > Looks like you're right. Here's my tail-recursive version of the same: > > > > join([], _) -> []; > > join([S1 | S_Rest], Sep) -> > > S1 ++ reverse_join(lists:reverse(S_Rest), Sep, []). > > > > reverse_join([], _, Joined) -> Joined; > > reverse_join([S1 | S_Rest], Sep, Joined) -> > > reverse_join(S_Rest, Sep, Sep ++ S1 ++ Joined). > > Using ++ all over the place is probably a bad idea, at least according > to the performance guide and my intuition. I haven't profiled it. > > This is our join/2, which is largely the same but uses lists:flatten/1 > instead of ++: > > join([], _Separator) -> > []; > join([S], _Separator) -> > lists:flatten(S); > join(Strings, Separator) -> > lists:flatten(revjoin(lists:reverse(Strings), Separator, [])). Is there any reason to prefer that over: join([H|T], Sep) -> lists:flatten([H | [[Sep, X] || X <- T]]). list comprehensions rule. -- David Terrell dbt@REDACTED ((meatspace)) http://meat.net/ From bob@REDACTED Thu Sep 13 23:47:22 2007 From: bob@REDACTED (Bob Ippolito) Date: Thu, 13 Sep 2007 14:47:22 -0700 Subject: [erlang-questions] list:join() for erlang? In-Reply-To: <20070913213933.GC18483@sphinx.chicagopeoplez.org> References: <46E8115C.8000602@free.fr> <46E9123D.4000503@munat.com> <000101c7f63e$adabef40$891ea8c0@SSI.CORP> <6a36e7290709131338i4c19baefm44602f659affcc9@mail.gmail.com> <20070913213933.GC18483@sphinx.chicagopeoplez.org> Message-ID: <6a36e7290709131447n361a6021u279795e7799bdcea@mail.gmail.com> On 9/13/07, David Terrell wrote: > On Thu, Sep 13, 2007 at 01:38:29PM -0700, Bob Ippolito wrote: > > On 9/13/07, David Mercer wrote: > > > On Thursday, September 13, 2007, Ben Munat wrote: > > > > Out of curiosity -- still feeling my way around erlang and functional > > > > programming -- aren't the "helper" functions here stack-recursive (i.e. > > > *not* > > > > tail-recursive)? > > > > > > Looks like you're right. Here's my tail-recursive version of the same: > > > > > > join([], _) -> []; > > > join([S1 | S_Rest], Sep) -> > > > S1 ++ reverse_join(lists:reverse(S_Rest), Sep, []). > > > > > > reverse_join([], _, Joined) -> Joined; > > > reverse_join([S1 | S_Rest], Sep, Joined) -> > > > reverse_join(S_Rest, Sep, Sep ++ S1 ++ Joined). > > > > Using ++ all over the place is probably a bad idea, at least according > > to the performance guide and my intuition. I haven't profiled it. > > > > This is our join/2, which is largely the same but uses lists:flatten/1 > > instead of ++: > > > > join([], _Separator) -> > > []; > > join([S], _Separator) -> > > lists:flatten(S); > > join(Strings, Separator) -> > > lists:flatten(revjoin(lists:reverse(Strings), Separator, [])). > > Is there any reason to prefer that over: > join([H|T], Sep) -> > lists:flatten([H | [[Sep, X] || X <- T]]). > > list comprehensions rule. The above list comprehension flattens a list of list of lists, where the longer version flattens a list of lists. It might be worth benchmarking to see what the difference in performance characteristics are. Obviously it's not a bottleneck in our software, or we'd have profiled several different implementations by now. -bob From chsu79@REDACTED Fri Sep 14 00:12:33 2007 From: chsu79@REDACTED (Christian S) Date: Fri, 14 Sep 2007 00:12:33 +0200 Subject: [erlang-questions] Modifications to erlang.el Message-ID: http://www.erlang.org/pipermail/erlang-questions/2006-December/024518.html Any special reason that edoc-friendly skeleton erlang-mode didnt get into OTP erlang.el, or was it just missed in the rush around Yule? From kevin@REDACTED Fri Sep 14 00:42:35 2007 From: kevin@REDACTED (Kevin A. Smith) Date: Thu, 13 Sep 2007 18:42:35 -0400 Subject: [erlang-questions] Invoking a function based on name only Message-ID: If I have the name of the function and the module it belongs to, how can I invoke it? I tried cobbling together erl_scan and friends but the embedded macros in the code gave me some heartburn. Any pointers? Thanks, Kevin From dustin@REDACTED Fri Sep 14 01:01:45 2007 From: dustin@REDACTED (Dustin Sallings) Date: Thu, 13 Sep 2007 16:01:45 -0700 Subject: [erlang-questions] Invoking a function based on name only In-Reply-To: References: Message-ID: On Sep 13, 2007, at 15:42 , Kevin A. Smith wrote: > If I have the name of the function and the module it belongs to, how > can I invoke it? I tried cobbling together erl_scan and friends but > the embedded macros in the code gave me some heartburn. Any pointers? 1> apply(list_to_atom("erlang"), list_to_atom("now"), []). {1189,724492,627140} -- Dustin Sallings From bob@REDACTED Fri Sep 14 01:10:55 2007 From: bob@REDACTED (Bob Ippolito) Date: Thu, 13 Sep 2007 16:10:55 -0700 Subject: [erlang-questions] Invoking a function based on name only In-Reply-To: References: Message-ID: <6a36e7290709131610o635fdc99yea5c354e18f13863@mail.gmail.com> On 9/13/07, Kevin A. Smith wrote: > If I have the name of the function and the module it belongs to, how > can I invoke it? I tried cobbling together erl_scan and friends but > the embedded macros in the code gave me some heartburn. Any pointers? > It's really not clear to me what you're trying to do, but you can get the list of exported functions and their arity from M:module_info(). 1> proplists:get_value(exports, lists:module_info()). [{append,2}, {append,1}, {subtract,2}, {nth,2}, {nthtail,2}, {prefix,2}, ...] And you can call them with the apply/3 BIF. 2> apply(lists, append, ["foo", "bar"]). "foobar" -bob From ok@REDACTED Fri Sep 14 02:30:10 2007 From: ok@REDACTED (ok) Date: Fri, 14 Sep 2007 12:30:10 +1200 Subject: [erlang-questions] list:join() for erlang? In-Reply-To: <46E9123D.4000503@munat.com> References: <46E8115C.8000602@free.fr> <46E9123D.4000503@munat.com> Message-ID: I wrote: >> join0(X, [Y|Ys]) -> X ++ join0(Y, Ys); >> join0(X, []) -> X. >> [join/2, join1/1, join2/3 deleted] On 13 Sep 2007, at 10:34 pm, Ben Munat wrote: > Out of curiosity -- still feeling my way around erlang and functional > programming -- aren't the "helper" functions here stack-recursive > (i.e. *not* tail-recursive)? I've never heard the term "stack-recursive" before; the normal term for calls that are not tail calls is "body" calls (in this case, body recursion). Yes, they are body calls. What of that? They are what they need to be. As a matter of fact, the Prolog equivalents of these *would* be tail recursive: join0([], X, X). join0([Y|Ys], X, Ans) :- append(X, R, Ans), join0(Ys, Y, R). It would be possible to implement Erlang in such a way that these Erlang functions were also tail recursive. It wouldn't even be hard. In effect, each function would receive a hidden parameter that was the address of where to put the result. This would require a different kind of garbage collector, though; the current one can and does exploit the fact that there cannot be pointers from "older" cells to "newer" ones. Tail recursion is nice when you can use it, but in the current version of Erlang it would be necessary to build up a result in reverse and then reverse it at the end. There are times when that's a good idea, but this isn't one of them. Another idea would be not to build up the result but to build a stack of lists to be appended. Let's see what happens. join([], _) -> []; join(Xs, []) -> [Last|Stack] = reverse(Xs), join0(Stack, Last); join(Xs, [C]) -> [Last|Stack] = reverse(Xs), join1(Stack, Last, C); join(Xs, Sep) -> [Last|Stack] = reverse(Xs), join2(Stack, Last, Sep). join0([Ys|Yss], Xs) -> join0(Yss, Ys++Xs); join0([], Xs) -> Xs. join1([Ys|Yss], Xs, C) -> join1(Yss, Ys++[C|Xs], C); join1([], Xs, _) -> Xs. join2([Ys|Yss], Xs, Sep) -> join2(Yss, Ys++Sep++Xs, Sep); join2([], Xs, _ ) -> Xs. In effect, this also uses a stack, but it builds the stack as a list in the heap. Rather to my surprise, this second version turned out to be faster than the previous version. Mind you, you have to make the inputs so large, and repeat the operation so many times, to get a measurable time, that it's not really a problem. I wondered whether unrolling the loops would be worth while, but the measurements fluctuated so much it was hard to tell. What I'd really like is a high resolution cpu time BIF, which is the subject of another thread... From bent@REDACTED Fri Sep 14 02:32:40 2007 From: bent@REDACTED (Ben Munat) Date: Thu, 13 Sep 2007 14:32:40 -1000 Subject: [erlang-questions] list:join() for erlang? In-Reply-To: References: <46E8115C.8000602@free.fr> <46E9123D.4000503@munat.com> Message-ID: <46E9D6A8.6000401@munat.com> Thanks for the very thorough reply... Yeah, "stack-recursive" came out cuz I couldn't think of the term for "not tail recursive"... so, it's "body recursive". Thanks for setting me straight. b ok wrote: > I wrote: >>> join0(X, [Y|Ys]) -> X ++ join0(Y, Ys); >>> join0(X, []) -> X. >>> > [join/2, join1/1, join2/3 deleted] > > On 13 Sep 2007, at 10:34 pm, Ben Munat wrote: > >> Out of curiosity -- still feeling my way around erlang and functional >> programming -- aren't the "helper" functions here stack-recursive >> (i.e. *not* tail-recursive)? > > I've never heard the term "stack-recursive" before; the normal term > for calls that are not tail calls is "body" calls (in this case, > body recursion). Yes, they are body calls. What of that? They are > what they need to be. As a matter of fact, the Prolog equivalents > of these *would* be tail recursive: > > join0([], X, X). > join0([Y|Ys], X, Ans) :- > append(X, R, Ans), > join0(Ys, Y, R). > > It would be possible to implement Erlang in such a way that these > Erlang functions were also tail recursive. It wouldn't even be hard. > In effect, each function would receive a hidden parameter that was > the address of where to put the result. This would require a > different kind of garbage collector, though; the current one can and > does exploit the fact that there cannot be pointers from "older" > cells to "newer" ones. > > Tail recursion is nice when you can use it, but in the current > version of Erlang it would be necessary to build up a result in > reverse and then reverse it at the end. There are times when that's > a good idea, but this isn't one of them. Another idea would be not > to build up the result but to build a stack of lists to be appended. > Let's see what happens. > > join([], _) -> []; > join(Xs, []) -> [Last|Stack] = reverse(Xs), join0(Stack, Last); > join(Xs, [C]) -> [Last|Stack] = reverse(Xs), join1(Stack, Last, C); > join(Xs, Sep) -> [Last|Stack] = reverse(Xs), join2(Stack, Last, Sep). > > join0([Ys|Yss], Xs) -> join0(Yss, Ys++Xs); > join0([], Xs) -> Xs. > > join1([Ys|Yss], Xs, C) -> join1(Yss, Ys++[C|Xs], C); > join1([], Xs, _) -> Xs. > > join2([Ys|Yss], Xs, Sep) -> join2(Yss, Ys++Sep++Xs, Sep); > join2([], Xs, _ ) -> Xs. > > In effect, this also uses a stack, but it builds the stack as a list > in the heap. Rather to my surprise, this second version turned out > to be faster than the previous version. Mind you, you have to make > the inputs so large, and repeat the operation so many times, to get > a measurable time, that it's not really a problem. > > I wondered whether unrolling the loops would be worth while, but > the measurements fluctuated so much it was hard to tell. What > I'd really like is a high resolution cpu time BIF, which is the > subject of another thread... > > > From sanjaya@REDACTED Fri Sep 14 04:05:30 2007 From: sanjaya@REDACTED (sanjaya@REDACTED) Date: Fri, 14 Sep 2007 07:35:30 +0530 Subject: [erlang-questions] diffrent emulator modes In-Reply-To: References: <00f201c7f5db$a6f00820$9a0810ac@wavenet.lk> Message-ID: <1189735530.46e9ec6a59782@mail.wavenet.lk> An HTML attachment was scrubbed... URL: From ok@REDACTED Fri Sep 14 04:14:06 2007 From: ok@REDACTED (ok) Date: Fri, 14 Sep 2007 14:14:06 +1200 Subject: [erlang-questions] list:join() for erlang? In-Reply-To: <6a36e7290709131338i4c19baefm44602f659affcc9@mail.gmail.com> References: <46E8115C.8000602@free.fr> <46E9123D.4000503@munat.com> <000101c7f63e$adabef40$891ea8c0@SSI.CORP> <6a36e7290709131338i4c19baefm44602f659affcc9@mail.gmail.com> Message-ID: On 14 Sep 2007, at 8:38 am, Bob Ippolito wrote: > Using ++ all over the place is probably a bad idea, at least according > to the performance guide and my intuition. I haven't profiled it. I believe you have misunderstood the performance guide. When you want to concatenate lists, ++ is the tool for the job. > > This is our join/2, which is largely the same but uses lists:flatten/1 > instead of ++: But that changes the semantics. It will accept stuff that I did not at all wish my code to accept. > join([S], _Separator) -> > lists:flatten(S); This does *more* copying than the ++ version. If you are happy with using flatten/1 (as I am not), then a much simpler approach is join([], _) -> []; join([List|Lists], Separator) -> lists:flatten([List | [[Separator,Next] || Next <- Lists]]). This turns [S1,S2,S3,S4] into [S1,[Sep,S2],[Sep,S3],[Sep,S4]] and then flattens that. From surindar.shanthi@REDACTED Fri Sep 14 04:21:08 2007 From: surindar.shanthi@REDACTED (Surindar Sivanesan) Date: Fri, 14 Sep 2007 10:21:08 +0800 Subject: [erlang-questions] Erlang shell stops working for a while Message-ID: <42ea5fb60709131921k38c6f343p67b10e198476f96c@mail.gmail.com> Hi all, I'm using Erlang Emulator version 5.5 in Windows 2003 server. We have lots of processes spawned in our application (Around 700 threads). One process is used to write logs in a file. Is there any possibility that makes the whole Erlang shell to stop working for a while. In our application, Erlang shell stop working for around 10 seconds. Then, the shell came back to normal and it processes all the message in the Queue of every process. Anybody got the problem like this? Please give your ideas... -- Thanks and Regards, S.Surindar -------------- next part -------------- An HTML attachment was scrubbed... URL: From qrilka@REDACTED Fri Sep 14 06:25:46 2007 From: qrilka@REDACTED (Kirill Zaborski) Date: Fri, 14 Sep 2007 08:25:46 +0400 Subject: [erlang-questions] Modifications to erlang.el In-Reply-To: References: Message-ID: <337538cb0709132125h32ba289t9fe9c818a6d3eebc@mail.gmail.com> I was wondering too. Rewriting function comments is quite tedious... Best regards, Kirill. On 9/14/07, Christian S wrote: > > http://www.erlang.org/pipermail/erlang-questions/2006-December/024518.html > > Any special reason that edoc-friendly skeleton erlang-mode didnt get into > OTP erlang.el, or was it just missed in the rush around Yule? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From igwan@REDACTED Fri Sep 14 07:24:17 2007 From: igwan@REDACTED (igwan) Date: Fri, 14 Sep 2007 07:24:17 +0200 Subject: [erlang-questions] Invoking a function based on name only In-Reply-To: References: Message-ID: <46EA1B01.30509@free.fr> It is worth noting that if the number of arguments is known at compile time, it's more efficient to use Module:Function(Arg1, Arg2, ...) than apply/3. From the the Efficiency Guide : "The syntax |M:Foo(A1,A2,An)| (also referred to as implicit apply, where M and Foo are bound variables) where equivalent with |apply(M,Foo,[A1,A2,An])| in releases pre OTP-R10B. The compiler will now optimize this syntax giving it better performance than apply/3" igwan Dustin Sallings a ?crit : > On Sep 13, 2007, at 15:42 , Kevin A. Smith wrote: > > >> If I have the name of the function and the module it belongs to, how >> can I invoke it? I tried cobbling together erl_scan and friends but >> the embedded macros in the code gave me some heartburn. Any pointers? >> > > 1> apply(list_to_atom("erlang"), list_to_atom("now"), []). > {1189,724492,627140} > > From dgud@REDACTED Fri Sep 14 08:21:57 2007 From: dgud@REDACTED (Dan Gudmundsson) Date: Fri, 14 Sep 2007 08:21:57 +0200 Subject: [erlang-questions] [Q] Mnesia is overloaded In-Reply-To: <46E95A41.5080103@volny.cz> References: <200709131445.l8DEjWgg084144@snookles.snookles.com> <46E95A41.5080103@volny.cz> Message-ID: <46EA2885.6020002@erix.ericsson.se> Once in while (see mnesia dump_log_write_threshold, mnesia dump_log_time_threshold) mnesia dumps the transaction log, out to the actual disc tables. If a dump-process is not finished when the next starts it will write the warning message. I.e. it means that your are writing more to the disc than mnesia can handle, and if you continue to do it you will build up log files that eventually will fill up all your disc space and that is not good. So if you get these messages once in while during peek load it's no problem, if you continuously get them you have a problem you are overloading mnesia's disc performance. /Dan Ladislav Lenart wrote: > Scott Lystig Fritchie wrote: >>>>>>> "ll" == Ladislav Lenart writes: >> ll> Mnesia is overloaded: {dump_log, write_threshold} >> >> Ladislav: This question appears frequently enough on this list that it >> probably ought to become a member of the FAQ. A search for that error >> message in this list's archives should show several threads over the >> last couple of years. >> >> Basic summary: it's a sign of a busy system and is mostly harmless. > > Hello, > > I've read the latest postings about it but I am still a little > bit confused. For example what does "mostly harmless" from above > mean? > > Our mnesia database is now running on one node and is overloaded > for ~20 concurrent writes which seems pretty low to me BTW. And > what about ~1000 of them? How long will this report remain harmless? > Or in other words, what is the maximum frequency of these concurrent > bursts that mnesia running on one node can handle? > > What is the main cause of the report? Is it a total number of > concurrent writes? Or is it a total size of all data to be written > (from all the writes)? > > I am sorry to bother you all with this issue (again), but words > like "often enough" and "mostly harmless" are too vague for me > to be regarded as answers to my questions. > > Thanks in advance, > > Ladislav Lenart > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From dustin@REDACTED Fri Sep 14 08:23:34 2007 From: dustin@REDACTED (Dustin Sallings) Date: Thu, 13 Sep 2007 23:23:34 -0700 Subject: [erlang-questions] Invoking a function based on name only In-Reply-To: <46EA1B01.30509@free.fr> References: <46EA1B01.30509@free.fr> Message-ID: <2B947230-E626-4EAE-B3E2-9DE989C7DC06@spy.net> On Sep 13, 2007, at 22:24, igwan wrote: > It is worth noting that if the number of arguments is known at > compile time, it's more efficient to use Module:Function(Arg1, > Arg2, ...) than apply/3. > From the the Efficiency Guide : "The syntax |M:Foo(A1,A2,An)| (also > referred to as implicit apply, where M and Foo are bound variables) > where equivalent with |apply(M,Foo,[A1,A2,An])| in releases pre OTP- > R10B. The compiler will now optimize this syntax giving it better > performance than apply/3" Thanks. I thought I saw something like that. Revised: 1> M = list_to_atom("erlang"). erlang 2> F = list_to_atom("now"). now 3> M:F(). {1189,750920,871983} or 4> {M, F} = {list_to_atom("erlang"), list_to_atom("now")}. {erlang,now} 5> M:F(). {1189,750980,161945} Whichever is more appropriate in the given context. > igwan > > Dustin Sallings a ?crit : >> On Sep 13, 2007, at 15:42 , Kevin A. Smith wrote: >> >> >>> If I have the name of the function and the module it belongs to, how >>> can I invoke it? I tried cobbling together erl_scan and friends but >>> the embedded macros in the code gave me some heartburn. Any >>> pointers? >>> >> >> 1> apply(list_to_atom("erlang"), list_to_atom("now"), []). >> {1189,724492,627140} >> >> > > -- Dustin Sallings From hokan.stenholm@REDACTED Fri Sep 14 08:44:25 2007 From: hokan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Fri, 14 Sep 2007 08:44:25 +0200 Subject: [erlang-questions] Invoking a function based on name only In-Reply-To: <2B947230-E626-4EAE-B3E2-9DE989C7DC06@spy.net> References: <46EA1B01.30509@free.fr> <2B947230-E626-4EAE-B3E2-9DE989C7DC06@spy.net> Message-ID: <46EA2DC9.7000607@bredband.net> Dustin Sallings wrote: > On Sep 13, 2007, at 22:24, igwan wrote: > > >> It is worth noting that if the number of arguments is known at >> compile time, it's more efficient to use Module:Function(Arg1, >> Arg2, ...) than apply/3. >> From the the Efficiency Guide : "The syntax |M:Foo(A1,A2,An)| (also >> referred to as implicit apply, where M and Foo are bound variables) >> where equivalent with |apply(M,Foo,[A1,A2,An])| in releases pre OTP- >> R10B. The compiler will now optimize this syntax giving it better >> performance than apply/3" >> > > Thanks. I thought I saw something like that. Revised: > > 1> M = list_to_atom("erlang"). > erlang > 2> F = list_to_atom("now"). > now > 3> M:F(). > {1189,750920,871983} > > or > > 4> {M, F} = {list_to_atom("erlang"), list_to_atom("now")}. > {erlang,now} > 5> M:F(). > {1189,750980,161945} > or 1> (list_to_atom("erlang")):(list_to_atom("now"))(). {1189,752160,276431} > Whichever is more appropriate in the given context. > > >> igwan >> >> Dustin Sallings a ?crit : >> >>> On Sep 13, 2007, at 15:42 , Kevin A. Smith wrote: >>> >>> >>> >>>> If I have the name of the function and the module it belongs to, how >>>> can I invoke it? I tried cobbling together erl_scan and friends but >>>> the embedded macros in the code gave me some heartburn. Any >>>> pointers? >>>> >>>> >>> 1> apply(list_to_atom("erlang"), list_to_atom("now"), []). >>> {1189,724492,627140} >>> >>> >>> >> > > From ingela@REDACTED Fri Sep 14 09:01:38 2007 From: ingela@REDACTED (Ingela Anderton Andin) Date: Fri, 14 Sep 2007 09:01:38 +0200 Subject: [erlang-questions] erlang-questions Digest, Vol 4, Issue 51 In-Reply-To: References: Message-ID: <46EA31D2.2090404@erix.ericsson.se> Hi! > http://www.erlang.org/pipermail/erlang-questions/2006-December/024518.html > Any special reason that edoc-friendly skeleton erlang-mode didnt get into > OTP erlang.el, or was it just missed in the rush around Yule? There is no special reason, it was just missed. It will be added for R12. Regards Ingela - OTP team From dustin@REDACTED Fri Sep 14 09:31:31 2007 From: dustin@REDACTED (Dustin Sallings) Date: Fri, 14 Sep 2007 00:31:31 -0700 Subject: [erlang-questions] Invoking a function based on name only In-Reply-To: <46EA2DC9.7000607@bredband.net> References: <46EA1B01.30509@free.fr> <2B947230-E626-4EAE-B3E2-9DE989C7DC06@spy.net> <46EA2DC9.7000607@bredband.net> Message-ID: On Sep 13, 2007, at 23:44, H?kan Stenholm wrote: > 1> (list_to_atom("erlang")):(list_to_atom("now"))(). > {1189,752160,276431} Excellent. That's the one I couldn't figure out. :) -- Dustin Sallings From alceste@REDACTED Fri Sep 14 09:47:50 2007 From: alceste@REDACTED (Alceste Scalas) Date: Fri, 14 Sep 2007 09:47:50 +0200 Subject: [erlang-questions] Closure-based FFI In-Reply-To: <46E96703.10509@industrial-designers.co.uk> References: <1189513745.8590.43.camel@gnatziu.crs4.it> <46E692A4.5040008@hyber.org> <1189518730.8590.71.camel@gnatziu.crs4.it> <46E6B073.6060407@hyber.org> <1189525595.8590.122.camel@gnatziu.crs4.it> <46E6BE18.70203@hyber.org> <1189581705.6081.17.camel@gnatziu.crs4.it> <1189587281.6081.55.camel@gnatziu.crs4.it> <20070913073023.GA16869@erix.ericsson.se> <1189671831.28880.23.camel@gnatziu.crs4.it> <46E96703.10509@industrial-designers.co.uk> Message-ID: <1189756070.28880.91.camel@gnatziu.crs4.it> Il giorno gio, 13/09/2007 alle 17.36 +0100, David Hopwood ha scritto: > Tagging pointers makes sense, but the representation of a pointer > value need not be specified. I think that a FFI should allow the developer to work as near as possible to the "bare metal" (i.e. the underlying representation of the C types). It should be possible, thus, to see pointers as unsigned integers --- that could be considered just opaque references when one does not want to fiddle with them. Other safety layers (like the type-tagged interface) could be used as well. > Tagging integer types makes less sense, I think; instead the FFI should > check that the actual value of the integer falls within the range of > its C type (see below for an interface that would support this). I think that, when maximum FFI safety is required, a way to "mimic" the C static typing would help, and would make bug hunting easier. For example, let's say I'm trying to use a uint32 value (returned by a FFI call) as a sint16 C function parameter, without an explicit "cast": type tagging would make the program fail immediately; range checking alone could leave the bug hidden, until the value ranges are actually broken. IMHO, type-tags could be used *together* with type range checks [1], in order to ensure that {TypeTag, Value} tuples are actually consistent. > ffi:c_function(port(), type_tag(), atom(), [type_tag()]) -> fun() > type_tag() = uchar|schar|...|pointer|nonnull|size_t|ssize_t > > C_malloc = ffi:c_function(Port, nonnull, malloc, [size_t]), > C_free = ffi:c_function(Port, void, free, [pointer]), > C_memset = ffi:c_function(Port, void, memset, > [nonnull, int, size_t]), > C_memcpy = ffi:c_function(Port, void, memcpy, [nonnull, nonnull, size_t]) Well, this closure-based FFI could be extremely elegant... But I don't see how it could be actually used. Should a developer pass the FFI closures around as function arguments? Or redefine them in every function before using them? (I hope I'm not missing something very obvious here). > 'nonnull' means a pointer that is checked by the FFI to be non-NULL, > i.e. an Erlang exception will be thrown if a NULL pointer is passed or > returned. Adding this FFI type is a good idea (IMHO). Regards, alceste Notes: [1] Range checking is quite expensive, expecially when dealing with Erlang big integers. The current, low-level FFI implementation does *not* check type ranges, but behaves mostly like C: only sizeof(CType) bytes of the function call arguments are considered. -- Alceste Scalas CRS4 - http://www.crs4.it/ From bob@REDACTED Fri Sep 14 11:11:46 2007 From: bob@REDACTED (Bob Ippolito) Date: Fri, 14 Sep 2007 02:11:46 -0700 Subject: [erlang-questions] list:join() for erlang? In-Reply-To: References: <46E8115C.8000602@free.fr> <46E9123D.4000503@munat.com> <000101c7f63e$adabef40$891ea8c0@SSI.CORP> <6a36e7290709131338i4c19baefm44602f659affcc9@mail.gmail.com> Message-ID: <6a36e7290709140211x606ff67w9e9fd1b0c8defd80@mail.gmail.com> On 9/13/07, ok wrote: > On 14 Sep 2007, at 8:38 am, Bob Ippolito wrote: > > Using ++ all over the place is probably a bad idea, at least according > > to the performance guide and my intuition. I haven't profiled it. > > I believe you have misunderstood the performance guide. > When you want to concatenate lists, ++ is the tool for the job. Sure, it works great for concatenating two lists, but it's not necessarily great for O(N^2) lists. Given that most of them will probably be short, I absolutely concede that ++ could very well be a performance winner in some cases. However, given that lists:reverse is special-cased I could imagine that lists:flatten could be also at some point and then the performance landscape could change dramatically. Either way, as I said before, this is absolutely not a bottleneck in our code so we didn't try very many implementations. > > > > This is our join/2, which is largely the same but uses lists:flatten/1 > > instead of ++: > > But that changes the semantics. It will accept stuff that I did not > at all wish my code to accept. lists:append/1 could be used in this case, but I saw no good reason to specialize. If your code has incorrect input somewhere a library function such as this is probably not the best place to figure that out. > > join([S], _Separator) -> > > lists:flatten(S); > > This does *more* copying than the ++ version. This is a degenerate case where practically nothing happens in any version, so it's hardly worth mention. -bob From mbj@REDACTED Fri Sep 14 11:29:56 2007 From: mbj@REDACTED (Martin Bjorklund) Date: Fri, 14 Sep 2007 11:29:56 +0200 (CEST) Subject: [erlang-questions] Erlang FFI: 1st discussion summary In-Reply-To: <1189694808.28880.49.camel@gnatziu.crs4.it> References: <1189694808.28880.49.camel@gnatziu.crs4.it> Message-ID: <20070914.112956.226243802.mbj@tail-f.com> Hi, Alceste Scalas wrote: > -------------------------------------------------- > 1.1. Getting information about preloaded functions > -------------------------------------------------- > > The proposed high-level ffi:call/3 would need information about > functions and FFI signatures preloaded with > erl_ddll:load_library/3. This information could be useful for > developers, too (e.g. for debugging pourposes). For these > reasons, the erl_ddll:info/2 BIF could be extended with a > 'preloads' argument, that would return a list of preloaded > functions, signatures etc. This information could be obtained > via erl_ddll:info/1 and erl_ddll:info/0 as well. This seems very useful. > ====================================================== > 2. Creating Erlang binaries from C strings and buffers > ====================================================== > > The first proposal on this issue [5] can be revised considering type > tagging. A new 'cstring' type atom/tag can be introduced, in order > to distinguish NULL-terminated C strings from generic 'pointer's to > byte buffers. Two functions could be used for turning them into > Erlang binaries: > > ffi:cstring_to_binary(TaggedCString) -> binary() > TaggedCString = {cstring, CStringPtr} > CStringPtr = integer() > > Return a new binary with a copy of the given NULL-terminated > C string (including the trailing \0); > > ffi:buffer_to_binary(TaggedPointer, Size) -> binary() > TaggedPointer = {pointer, Ptr} > Ptr = integer() > > Return a new binary filled with a copy of Size bytes read > from the given C pointer. > > These two functions would have, as seen in the previous section, > their type-untagged equivalents: ffi:raw_cstring_to_binary/1 and > ffi:raw_buffer_to_binary/2. In this case, I don't think the tagging gives you anything. Another thing that would be nice would be to be able to get to a ref-counted binary in the C-code; i.e. let the C-code inc the ref count if it wants to. This would save a copy when the binary is very big. > ================================== > 3. Determining the size of C types > ================================== > > The sizes of C types could be determined in run-time with a new > ffi:sizeof/1 BIF (initially proposed in [6]): > > * ffi:sizeof(CType) -> integer() > CType = type_tag() > > Return the number of bytes used by CType on the current > platform. > > Type size information should, in general, *not* be hardcoded, > because it may change when running the same BEAM files on different > architectures. The BIF above is the recommended way for getting > type sizes when writing portable code. > > However, when the FFI-based code is *not* expected to be portable > without recompilation, the size of C types remains constant and > could be determined when the Erlang/OTP sources are compiled. Thus, > this information could be stored in a .hrl file. Developers could > -include_lib("kernel/include/ffi_hardcodes.hrl") [7] and obtain a > set of faster and easier-to-use macros, for each supported FFI type: > > FFI_HARDCODED_SIZEOF_ > The type size in bytes > > FFI_HARDCODED__BITS > The type size in bits > > The size in bits is precomputed in order to simplify binary > matching, since expressions like (?FFI_HARDCODED_SIZEOF_LONG * 8) > are not allowed in patterns. I think both these suggestions makes sense. For the use case I have in mind (which currently is implemented as a driver), I would use the hardcoded constants. /martin From bjorn@REDACTED Fri Sep 14 11:29:58 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 14 Sep 2007 11:29:58 +0200 Subject: [erlang-questions] list:join() for erlang? In-Reply-To: <6a36e7290709131338i4c19baefm44602f659affcc9@mail.gmail.com> References: <46E8115C.8000602@free.fr> <46E9123D.4000503@munat.com> <000101c7f63e$adabef40$891ea8c0@SSI.CORP> <6a36e7290709131338i4c19baefm44602f659affcc9@mail.gmail.com> Message-ID: I haven't profiled it, but the code seems fine to me. "Bob Ippolito" writes: > > Looks like you're right. Here's my tail-recursive version of the same: > > > > join([], _) -> []; > > join([S1 | S_Rest], Sep) -> > > S1 ++ reverse_join(lists:reverse(S_Rest), Sep, []). This call is body-recursive, which means that that '++' is evaluated from right to left. This use of '++' is fine. > > reverse_join([], _, Joined) -> Joined; > > reverse_join([S1 | S_Rest], Sep, Joined) -> > > reverse_join(S_Rest, Sep, Sep ++ S1 ++ Joined). This usage of '++' is also OK, since the growing result is on the right side. > Using ++ all over the place is probably a bad idea, at least according > to the performance guide and my intuition. I haven't profiled it. The Efficiency Guide could be a little bit clearer about '++'. We will probably update it in the R12B release. '++' is not always bad. It is bad if you build a result on the left-hand side of '++', because the result that is growing will be copied again and again. It is fine if the result is on the right-hand side, because the right-hand side is not copied. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From psa@REDACTED Fri Sep 14 12:39:44 2007 From: psa@REDACTED (=?ISO-8859-1?Q?Paulo_S=E9rgio_Almeida?=) Date: Fri, 14 Sep 2007 11:39:44 +0100 Subject: [erlang-questions] list:join() for erlang? In-Reply-To: References: <46E8115C.8000602@free.fr><46E912 3D.4000503@munat.com> <000101c7f63e$adabef40$891ea8c0@SSI.CORP><6a36e7290709131338i4c19baefm44602 f659affcc9@mail.gmail.com> Message-ID: <46EA64F0.6060800@di.uminho.pt> Bjorn Gustavsson wrote: > The Efficiency Guide could be a little bit clearer about '++'. We will probably > update it in the R12B release. > > '++' is not always bad. It is bad if you build a result on the left-hand side of '++', > because the result that is growing will be copied again and again. It is fine if the > result is on the right-hand side, because the right-hand side is not copied. > > /Bjorn This insight is important for people to start using ++ more frequently. Regarding list reverse, while playing around and observing: 85> erlang:is_builtin(lists, reverse, 1). false I found out that what is builtin is another function, reverse/2, which is not much advertised, but that may be very useful, as the fastest way to simultaneously reverse a list and concatenate to another. 87> lists:reverse("345", "21"). "54321" A list:join version exploring this reverse/2 is not much slower than the version with ++. join([], _Sep) -> []; join([H|T], Sep) -> join(T, Sep, lists:reverse(H)). join([], _Sep, Ac) -> lists:reverse(Ac); join([H | T], Sep, Ac) -> join(T, Sep, lists:reverse(H,lists:reverse(Sep,Ac))). In other cases where we truly want to reverse and concatenate it will be quite an amazing function to have around that deserves more advertising. Regards, Paulo From saleyn@REDACTED Fri Sep 14 14:07:55 2007 From: saleyn@REDACTED (Serge Aleynikov) Date: Fri, 14 Sep 2007 07:07:55 -0500 Subject: [erlang-questions] Erlang FFI: 1st discussion summary In-Reply-To: <1189694808.28880.49.camel@gnatziu.crs4.it> References: <1189694808.28880.49.camel@gnatziu.crs4.it> Message-ID: <46EA799B.80207@gmail.com> Alceste, Perhaps others on the list feel the same way, but I just wanted to express support for your initiative as I find your contribution very useful and for the amount of effort you put in following the EEP process, and hope that the work can make it soon into the distribution (at least in a beta form). Regards, Serge Alceste Scalas wrote: > Hello, > > in order to make it easier to follow the Erlang FFI (Foreign > Function Interface) proposal, here's a summary of the discussion so > far, and a set of possible solutions for the issues being raised. I > could send other summaries like this, if/when needed. > > The initial Erlang FFI proposal is still available in [0]. It was > accepted as EEP-0007 [1], but it has been frozen until the > discussion on this mailing list settles. A link to the first thread > of the discussion itself is in [2]. > > Here's an index of the issues and suggestions that have appeared so > far (I'm reordering them for ease of answer): > > 1. Raimo Niskanen proposed a type-tagged interface for the FFI > calls: call arguments and return values could be tuples in > the form {type_tag(), Value} [3]; > > 2. Claes Wikstr?m and Vlad Dumitrescu wondered how C pointers > (to buffers or strings) returned by FFI calls could be turned > into Erlang binaries; > > 3. when C buffers are turned into Erlang binaries, binary > matching could be used e.g. to extract C struct fields. But > this could require knowing the sizes of the C types on the > system in use. > > Here are the proposals for addressing these issues (based on the > ideas gathered so far). > > > ======================== > 1. Type-tagged FFI calls > ======================== > > Type tags are extremely useful and can increase call safety, but > they can also kill FFI performance (see the final note in [4]). A > good compromise would be to leave the lower-level FFI BIFs without > tags, and implement type tags handling in Erlang (i.e. in a ffi.erl > module). Raimo agreed with this idea. > > The old untagged ffi:call/3 and ffi:call/2 BIFs could be kept with a > different name (proposal: ffi:raw_call/3 and ffi:raw_call/2). The > higher-level, type-tagged interface for FFI calls could be: > > ffi:call(Port, {ReturnType, Function}, [TaggedVal]) -> > {ReturnType,term()} > ReturnType = type_tag() > Function = string() | atom() > TaggedVal = {type_tag(), Val} > Val = term() > type_tag() = uchar|schar|...|pointer|size_t|ssize_t > > It checks whether the required C function was preloaded with > erl_ddll:load_library/3. Then, two alternatives arise: > > a. if the C function was preloaded, its signature is compared > with the type tags. If they match, a raw FFI call is > performed (with ffi:raw_call/2); otherwise, a badarg > exception is raised; > > b. if the C function was *not* preloaded, the type tags will be > ignored and a raw FFI call will be performed (with > ffi:raw_call/3). > > In both cases, the raw FFI call return value will be returned as a > {ReturnType, RawReturnValue} tuple. > > > -------------------------------------------------- > 1.1. Getting information about preloaded functions > -------------------------------------------------- > > The proposed high-level ffi:call/3 would need information about > functions and FFI signatures preloaded with > erl_ddll:load_library/3. This information could be useful for > developers, too (e.g. for debugging pourposes). For these > reasons, the erl_ddll:info/2 BIF could be extended with a > 'preloads' argument, that would return a list of preloaded > functions, signatures etc. This information could be obtained > via erl_ddll:info/1 and erl_ddll:info/0 as well. > > > ====================================================== > 2. Creating Erlang binaries from C strings and buffers > ====================================================== > > The first proposal on this issue [5] can be revised considering type > tagging. A new 'cstring' type atom/tag can be introduced, in order > to distinguish NULL-terminated C strings from generic 'pointer's to > byte buffers. Two functions could be used for turning them into > Erlang binaries: > > ffi:cstring_to_binary(TaggedCString) -> binary() > TaggedCString = {cstring, CStringPtr} > CStringPtr = integer() > > Return a new binary with a copy of the given NULL-terminated > C string (including the trailing \0); > > ffi:buffer_to_binary(TaggedPointer, Size) -> binary() > TaggedPointer = {pointer, Ptr} > Ptr = integer() > > Return a new binary filled with a copy of Size bytes read > from the given C pointer. > > These two functions would have, as seen in the previous section, > their type-untagged equivalents: ffi:raw_cstring_to_binary/1 and > ffi:raw_buffer_to_binary/2. > > > ================================== > 3. Determining the size of C types > ================================== > > The sizes of C types could be determined in run-time with a new > ffi:sizeof/1 BIF (initially proposed in [6]): > > * ffi:sizeof(CType) -> integer() > CType = type_tag() > > Return the number of bytes used by CType on the current > platform. > > Type size information should, in general, *not* be hardcoded, > because it may change when running the same BEAM files on different > architectures. The BIF above is the recommended way for getting > type sizes when writing portable code. > > However, when the FFI-based code is *not* expected to be portable > without recompilation, the size of C types remains constant and > could be determined when the Erlang/OTP sources are compiled. Thus, > this information could be stored in a .hrl file. Developers could > -include_lib("kernel/include/ffi_hardcodes.hrl") [7] and obtain a > set of faster and easier-to-use macros, for each supported FFI type: > > FFI_HARDCODED_SIZEOF_ > The type size in bytes > > FFI_HARDCODED__BITS > The type size in bits > > The size in bits is precomputed in order to simplify binary > matching, since expressions like (?FFI_HARDCODED_SIZEOF_LONG * 8) > are not allowed in patterns. > > > =========================== > 4. Other minor enhancements > =========================== > > The following enhancements have never been discussed so far, but > they are very small and extremely trivial to implement: > > * a new erl_ddll:load_library/2 function could be added, that > can be used instead of calling erl_ddll:load_library/3 with an > empty list of options (i.e. when no preloads are requested); > > * when used with a library instead of a linked-in driver, > erlang:open_port/2 calls are quite noisy (the 'spawn' and the > list of options are redundant). A new erlang:open_port/1 > function could be added: > > erlang:open_port(Library) -> port() > Library = string() > > Under the hoods, it could just call something like the > existing erlang:open_port({spawn, Library}, [binary]). > > > ============= > 5. That's all > ============= > > Please tell your opinion about the proposals above, and complain if > something is missing. Everything will be implemented depending on > your feedback. Thanks! > > > ===== > Notes > ===== > > [0] Home page of the FFI for Erlang/OTP > http://muvara.org/crs4/erlang/ffi > > [1] EEP-0007: Foreign Function Interface (FFI) > http://www.erlang.org/eeps/eep-0007.html > > [2] Thread about the Erlang FFI on the erlang-questions mailing list > http://erlang.org/pipermail/erlang-questions/2007-September/029121.html > > [3] Proposal for type-tagged FFI calls > http://erlang.org/pipermail/erlang-questions/2007-September/029174.html > > [4] FFI tagging vs. call performance > http://erlang.org/pipermail/erlang-questions/2007-September/029179.html > > [5] First proposal for turning C strings/buffers into binaries > http://erlang.org/pipermail/erlang-questions/2007-September/029141.html > > [6] First proposal about a ffi:sizeof/1 BIF: > http://erlang.org/pipermail/erlang-questions/2007-September/029146.html > > [7] From the implementation point of view, the ffi_hardcodes.hrl > header file could be autogenerated by GNU Autoconf from > ffi_hardcodes.hrl.in. > > > Regards, > > alceste From ghalib@REDACTED Fri Sep 14 13:15:44 2007 From: ghalib@REDACTED (Ghalib Suleiman) Date: Fri, 14 Sep 2007 15:15:44 +0400 Subject: [erlang-questions] Yaws, ErlyWeb and Windows. In-Reply-To: <3A76756EED583B43A4AD704E29CCD079741262@mail.smartlogic.com> References: <3A76756EED583B43A4AD704E29CCD079741262@mail.smartlogic.com> Message-ID: <38D46DF3-F673-4A83-9AEF-C61D4F742B24@sent.com> Hi Bob, Erlyweb does indeed have a bug on Windows where it doesn't seem to be registering components properly (I ran into this last week myself), thus making it unusable. There's a slight discussion about it on the Erlyweb Google Group - I plan to hunt down the bug when I'm back at work tomorrow, as I don't have access to a Windows machine at home. -Ghalib On Sep 13, 2007, at 11:00 AM, Bob Cowdery wrote: > Robert > > Thanks very much for that. I will have a go when I'm out the woods. > At the moment the pre-built version is working ok. > > However, I wonder, do you use ErlyWeb because I'm having trouble > with it. I posted a message on the forum yesterday but no replies > yet. Essentially I can't get it to generate code for a MySQL table > and it can't seem to find the controller that it generated anyway. > In fact it dosn't seem think they are controllers and views. > > Any help appreciated. > > Bob > > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED]On Behalf Of Robert > Raschke > Sent: 11 September 2007 10:36 > To: erlang-questions@REDACTED > Subject: Re: [erlang-questions] Yaws, ErlyWeb and Windows. > > >> Bob Cowdery wrote: >>> Hi All >>> >>> Can someone give me the picture on Yaws and ErlyWeb under Windows >>> please >> >> I'm sorry about that - to my knowledge there is quite a lot >> of people running yaws under windows. I don't run windows at >> all any longer - and I'll just have to leave it up to the >> yaws/windows community to write e.g. a proper wiki entry on how to do >> it. I know for sure that it atleast used to work - I made sure it >> worked once, but it might have gone bad. > > Here's how I build yaws on Windows: > > My source root is $ROOT. > Unpack yaws-1.68 into $ROOT/lib/yaws. > Have a folder called $ROOT/extra with the files yaws_generated.erl and > yaws.app (although I forget why I need yaws.app): > > yaws_generated.erl: > %% > %--------------------------------------------------------------------- > - > %%% File : yaws_generated.template > %%% Author : Klacke > %%% Purpose : > %%% Created : 10 Jun 2002 by Klacke > %% > %--------------------------------------------------------------------- > - > > %% generated code from some environment variables > %% especially VARDIR is important since it controls > %% where the --hup and friends > > -module(yaws_generated). > -author('klacke@REDACTED'). > > -compile(export_all). > > version() -> "1.68". > > vardir() -> "C:/yaws/var". > > ctldir() -> "C:/yaws/var/run/yaws". > > etcdir() -> "C:/yaws/etc". > > % (Or whatever you want your defaults to be.) > > yaws.app: > {application, yaws, [ > {description, "yaws WWW server"}, > {vsn, "1.68"}, > {modules, [ > yaws, > yaws_app, > yaws_ticker, > yaws_config, > yaws_server, > yaws_sup, > yaws_api, > yaws_log, > yaws_ls, > yaws_debug, > yaws_compile, > yaws_ctl, > yaws_cgi, > yaws_zlib, > yaws_generated, > mime_type_c, > mime_types, > yaws_session_server, > yaws_404, > yaws_revproxy, > yaws_html, > yaws_log_file_h, > yaws_rss, > yaws_dav, > yaws_pam, > json, > jsonrpc, > yaws_jsonrpc, > yaws_xmlrpc, > haxe, > yaws_rpc, > yaws_soap_srv, > yaws_soap_lib > ]}, > {registered, []}, > {mod, {yaws_app, []}}, > {env, []}, > {applications, [ > kernel, > stdlib > ]} > ]}. > > And then I run this batch script: > > build_yaws.bat: > @echo off > setlocal > > copy /Y extra\yaws_generated.erl lib\yaws\src > cd lib\yaws\src > > set ERLC="C:\Program Files\erl5.5.4\bin\erlc" > set ERL="C:\Program Files\erl5.5.4\bin\erl" > > set ERLCOPTS=-W -pa .. -I../include -o ../ebin > set ERLOPTS=-noshell -pa ../ebin > > > %ERLC% %ERLCOPTS% yaws.erl > %ERLC% %ERLCOPTS% yaws_app.erl > %ERLC% %ERLCOPTS% yaws_ticker.erl > %ERLC% %ERLCOPTS% yaws_config.erl > %ERLC% %ERLCOPTS% yaws_server.erl > %ERLC% %ERLCOPTS% yaws_sup.erl > %ERLC% %ERLCOPTS% yaws_api.erl > %ERLC% %ERLCOPTS% yaws_log.erl > %ERLC% %ERLCOPTS% yaws_ls.erl > %ERLC% %ERLCOPTS% yaws_debug.erl > %ERLC% %ERLCOPTS% yaws_compile.erl > %ERLC% %ERLCOPTS% yaws_ctl.erl > %ERLC% %ERLCOPTS% yaws_cgi.erl > %ERLC% %ERLCOPTS% yaws_zlib.erl > %ERLC% %ERLCOPTS% yaws_generated.erl > %ERLC% %ERLCOPTS% yaws_session_server.erl > %ERLC% %ERLCOPTS% yaws_404.erl > %ERLC% %ERLCOPTS% yaws_revproxy.erl > %ERLC% %ERLCOPTS% yaws_html.erl > %ERLC% %ERLCOPTS% yaws_log_file_h.erl > %ERLC% %ERLCOPTS% yaws_rss.erl > %ERLC% %ERLCOPTS% yaws_dav.erl > %ERLC% %ERLCOPTS% yaws_pam.erl > %ERLC% %ERLCOPTS% json.erl > %ERLC% %ERLCOPTS% jsonrpc.erl > %ERLC% %ERLCOPTS% yaws_jsonrpc.erl > %ERLC% %ERLCOPTS% yaws_xmlrpc.erl > %ERLC% %ERLCOPTS% haxe.erl > %ERLC% %ERLCOPTS% yaws_rpc.erl > %ERLC% %ERLCOPTS% yaws_soap_srv.erl > %ERLC% %ERLCOPTS% yaws_soap_lib.erl > > del /F charset.def > echo. > charset.def > > %ERLC% %ERLCOPTS% mime_type_c.erl > %ERL% %ERLOPTS% -s mime_type_c compile > %ERLC% %ERLCOPTS% mime_types.erl > > pause > endlocal > > > I have also made a small attempt at writing a yaws.bat file, but I > haven't used this in a few years: > > @echo off > setlocal > > set HOME=C:/yaws > set yawsdir=C:/yaws/erlang/yaws-1.68 > > set erl=C:\Program Files\erl5.5.4\bin\erl.exe > set werl=C:\Program Files\erl5.5.4\bin\werl.exe > > set debug= > set daemon= > set interactive= > set trace= > set conf= > set runmod= > set sname= > set heart= > set xpath= > set mnesia= > set id=default > set pdist= > set erlarg= > > :NEXTARG > set arg=%1 > shift > if "%arg%"=="" goto ENDARGS > > if "%arg%"=="-i" goto INTERACT > if "%arg%"=="--interactive" goto INTERACT > > if "%arg%"=="-w" goto WINTERACT > if "%arg%"=="--winteractive" goto WINTERACT > > if "%arg%"=="-D" goto DAEMON > if "%arg%"=="--daemon" goto DAEMON > > if "%arg%"=="-d" goto DEBUG > if "%arg%"=="--debug" goto DEBUG > > if "%arg%"=="-t" goto TRACETR > if "%arg%"=="--tracetraf" goto TRACETR > > if "%arg%"=="-T" goto TRACEHT > if "%arg%"=="--tracehttp" goto TRACEHT > > if "%arg%"=="-I" goto ID > if "%arg%"=="--id" goto ID > > if "%arg%"=="-x" goto TRACEOUT > if "%arg%"=="--traceout" goto TRACEOUT > > if "%arg%"=="--trace" goto TRACE > > if "%arg%"=="-M" goto MNESIADIR > if "%arg%"=="--mnesiadir" goto MNESIADIR > > if "%arg%"=="-c" goto CONF > if "%arg%"=="--conf" goto CONF > > if "%arg%"=="-pa" goto PA > if "%arg%"=="--pa" goto PA > > if "%arg%"=="-r" goto RUNMOD > if "%arg%"=="--runmod" goto RUNMOD > > if "%arg%"=="-h" goto HUP > if "%arg%"=="--hup" goto HUP > > if "%arg%"=="-s" goto STOP > if "%arg%"=="--stop" goto STOP > > if "%arg%"=="-ls" goto LS > if "%arg%"=="--ls" goto LS > > if "%arg%"=="-S" goto STATUS > if "%arg%"=="--status" goto STATUS > > if "%arg%"=="-load" goto LOAD > if "%arg%"=="--load" goto LOAD > > if "%arg%"=="-j" goto CTLTRACE > if "%arg%"=="--ctltrace" goto CTLTRACE > > if "%arg%"=="-v" goto VERSION > if "%arg%"=="--version" goto VERSION > > if "%arg%"=="-sname" goto SNAME > if "%arg%"=="--sname" goto SNAME > > if "%arg%"=="-name" goto NAME > if "%arg%"=="--name" goto NAME > > if "%arg%"=="-heart" goto HEART > if "%arg%"=="--heart" goto HEART > > if "%arg%"=="-proto_dist" goto PROTO > if "%arg%"=="--proto_dist" goto PROTO > > if "%arg%"=="-erlarg" goto ERLARG > if "%arg%"=="--erlarg" goto ERLARG > > if "%arg%"=="-check" goto CHECK > if "%arg%"=="--check" goto CHECK > > goto HELP > > :INTERACT > set interactive=true > set debug= -yaws debug > set daemon= > goto NEXTARG > > :WINTERACT > set interactive=true > set debug= -yaws debug > set daemon= > set erl=%werl% > goto NEXTARG > > :DAEMON > set daemon= -detached > goto NEXTARG > > :DEBUG > set debug= -boot start_sasl -yaws debug > goto NEXTARG > > :TRACETR > set trace= -yaws trace traffic > goto NEXTARG > > :TRACEHT > set trace= -yaws trace http > goto NEXTARG > > :ID > set id=%1 > shift > goto NEXTARG > > :TRACEOUT > set traceoutput= -yaws traceoutput > goto NEXTARG > > :TRACE > set traceoutput= -yaws traceoutput > set trace= -yaws trace traffic > goto NEXTARG > > :MNESIADIR > set mnesia= -mnesia dir %1 -run mnesia start > shift > goto NEXTARG > > :CONF > set conf= -conf %1 > shift > goto NEXTARG > > :PA > set xpath= %xpath% -pa %1 > shift > goto NEXTARG > > :RUNMOD > set runmod= -runmod %1 > shift > goto NEXTARG > > :HUP > set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl hup > goto NEXTARG > > :STOP > set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl stop > goto NEXTARG > > :LS > set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl ls > goto NEXTARG > > :STATUS > set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl status > goto NEXTARG > > :LOAD > "%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl load %id% %1 %2 % > 3 %4 %5 %6 %7 %8 %9 > goto END > > :CTLTRACE > set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl trace %1 > shift > goto NEXTARG > > :VERSION > "%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws printversion > goto END > > :SNAME > set sname= -sname %1 > shift > goto NEXTARG > > :NAME > set sname= -name %1 > shift > goto NEXTARG > > :HEART > set heart= -heart > goto NEXTARG > > :PROTO > set pdist= -proto_dist %1 > shift > goto NEXTARG > > :ERLARG > set erlarg=%erlarg% %1 > shift > goto NEXTARG > > :CHECK > mkdir "%HOME%/.yaws/" > mkdir "%HOME%/.yaws/%id%" > "%erl%" -noshell -pa "%yawsdir%/ebin" %xpath% -s yaws_ctl check %id > % %1 %2 %3 %4 %5 %6 %7 %8 %9 > goto END > > :ENDARGS > > if NOT DEFINED ex goto NOEX > %ex% %id% > goto END > :NOEX > > if "%id%"=="" goto NOID > set id=-yaws id %id% > :NOID > > set trace=%trace% %traceoutput% > > if "%daemon%%interactive%"=="" goto HELP > > set XEC=%daemon% %heart% -pa "%yawsdir%/ebin" %xpath% %sname% %pdist > % %erlarg% %debug% -s yaws %trace% %conf% %runmod% %mnesia% %id% > > set HEART_COMMAND= > if "%heart%%daemon%"=="" goto NOHEART > echo set HEART_COMMAND="%erl%" %XEC% > set HEART_COMMAND="%erl%" %XEC% > > :NOHEART > echo "%erl%" %XEC% > "%erl%" %XEC% > goto END > > :HELP > echo "usage: " > echo "" > > echo " yaws -i | --interactive -- interactive (no > daemon) mode" > echo " yaws -w | --winteractive -- interactive (werl) " > echo " yaws --daemon -- daemon mode" > > echo "" > > echo "" > echo " Auxilliary flags for the daemon: " > echo " --id Id -- Set system id" > echo " --debug -- debug mode " > echo " --conf File -- set config file" > echo " --tracetraf -- trace traffic" > echo " --tracehttp -- trace http traffic" > echo " --traceout -- trace output to stdout" > echo " --version -- print version" > echo " --pa path -- add load path" > echo " --mnesiadir dir -- start Mnesia in dir" > echo " --proto_dist Mod -- use Mod for distrib" > echo " --sname xxx -- start with sname xxx" > echo " --name xxx -- start with name xxx" > echo " --runmod mod -- call mod:start/0 at startup" > echo " --heart -- auto restart yaws if it > crashes" > echo " --erlarg X -- pass argument X to $erl" > > echo "" > > echo "ctl functions ... " > echo " yaws --hup [--id ID] -- hup the daemon, reload > conf" > echo " yaws --stop [--id ID] -- stop the daemon" > echo " yaws --status [--id ID] -- query the daemon status" > echo " yaws --load Modules -- load modules" > echo " yaws --ls -- list Yaws nodes and > their status" > echo " yaws --ctltrace traffic|http -- toggle trace of > running daemon" > echo " yaws --check YawsFile [IncDirs] -- test compile File" > > :END > endlocal > > > > Robby > > -- > r fullstop raschke around tombob fullstop com > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From alceste@REDACTED Fri Sep 14 14:19:37 2007 From: alceste@REDACTED (Alceste Scalas) Date: Fri, 14 Sep 2007 14:19:37 +0200 Subject: [erlang-questions] FFI: handling refcounted binaries In-Reply-To: <20070914.112956.226243802.mbj@tail-f.com> References: <1189694808.28880.49.camel@gnatziu.crs4.it> <20070914.112956.226243802.mbj@tail-f.com> Message-ID: <1189772377.28880.162.camel@gnatziu.crs4.it> Il giorno ven, 14/09/2007 alle 11.29 +0200, Martin Bjorklund ha scritto: > > ffi:cstring_to_binary(TaggedCString) -> binary() > > > > ffi:buffer_to_binary(TaggedPointer, Size) -> binary() > > > > These two functions would have, as seen in the previous section, > > their type-untagged equivalents: ffi:raw_cstring_to_binary/1 and > > ffi:raw_buffer_to_binary/2. > > In this case, I don't think the tagging gives you anything. Tagging would make it more difficult to do a strcpy() over an arbitrary pointer (thus avoiding a possible access violations). > Another thing that would be nice would be to be able to get to a > ref-counted binary in the C-code; i.e. let the C-code inc the ref > count if it wants to. This would save a copy when the binary is very > big. This would go slightly beyond the current FFI scope (that does *not* allow to pass or return Erlang terms). However, after a deeper review, it seems to me that the ErlDrvBinary API still provides everything necessary for this task. Here is an implementation hypothesis, that should be checked by some Erlang/OTP core developer. ========================================= Handling refcounted binaries with the FFI ========================================= Let's suppose that the 'binary' FFI type is added. If you just want to *return* a binary (filled with data) from the C side, it is easy. You could just create an ErlDrvBinary in the usual way, (erl_driver.h, driver_alloc_binary(), driver_binary_inc_refc() etc.). The FFI would turn it into a "normal" Erlang binary [1]. If you want to *receive* a handle to an Erlang binary in the form of an ErlDrvBinary, and increment/decrement its refcount in order to keep it for later use, then: a. if the Erlang binary is still refcounted, it is straightforward [2]; b. however, a binary created from Erlang code may *not* be refcounted [3]. In this case, the FFI could force the creation of a refcounted binary, copy the contents of the original one, and pass an ErlDrvBinary to the C side [2]. There, the standard ErlDrvBinary API could be used. This implementation *should* be totally compatible with the current binary handling in Erlang linked-in drivers. But this sentence should be certified by Erlang/OTP core developers :-) Regards, alceste Notes: [1] The FFI could just use the ErlDrvBinary2Binary macro in erts/emulator/beam/global.h [2] The FFI could just use the Binary2ErlDrvBinary macro in erts/emulator/beam/global.h [3] In the current Erlang VM implementation, if a binary is small enough it will live in the process heap, and will be copied around instead of refcounted. The limit for these small binaries is 64 bytes, and is set by the ERL_ONHEAP_BIN_LIMIT in erts/emulator/beam/erl_binary.h. An Erlang-generated binary could also be a ErlSubBin, i.e. a portion of an existing binary (heap or refcounted). -- Alceste Scalas CRS4 - http://www.crs4.it/ From Bob.Cowdery@REDACTED Fri Sep 14 14:32:19 2007 From: Bob.Cowdery@REDACTED (Bob Cowdery) Date: Fri, 14 Sep 2007 13:32:19 +0100 Subject: [erlang-questions] Yaws, ErlyWeb and Windows. Message-ID: <3A76756EED583B43A4AD704E29CCD079CE4572@mail.smartlogic.com> Ghalib Thanks for that. I hope you can resolve it. I don't think I know enough at the moment but I'm learning. Bob -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED]On Behalf Of Ghalib Suleiman Sent: 14 September 2007 12:16 To: erlang-questions@REDACTED Subject: Re: [erlang-questions] Yaws, ErlyWeb and Windows. Hi Bob, Erlyweb does indeed have a bug on Windows where it doesn't seem to be registering components properly (I ran into this last week myself), thus making it unusable. There's a slight discussion about it on the Erlyweb Google Group - I plan to hunt down the bug when I'm back at work tomorrow, as I don't have access to a Windows machine at home. -Ghalib On Sep 13, 2007, at 11:00 AM, Bob Cowdery wrote: > Robert > > Thanks very much for that. I will have a go when I'm out the woods. > At the moment the pre-built version is working ok. > > However, I wonder, do you use ErlyWeb because I'm having trouble > with it. I posted a message on the forum yesterday but no replies > yet. Essentially I can't get it to generate code for a MySQL table > and it can't seem to find the controller that it generated anyway. > In fact it dosn't seem think they are controllers and views. > > Any help appreciated. > > Bob > > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED]On Behalf Of Robert > Raschke > Sent: 11 September 2007 10:36 > To: erlang-questions@REDACTED > Subject: Re: [erlang-questions] Yaws, ErlyWeb and Windows. > > >> Bob Cowdery wrote: >>> Hi All >>> >>> Can someone give me the picture on Yaws and ErlyWeb under Windows >>> please >> >> I'm sorry about that - to my knowledge there is quite a lot >> of people running yaws under windows. I don't run windows at >> all any longer - and I'll just have to leave it up to the >> yaws/windows community to write e.g. a proper wiki entry on how to do >> it. I know for sure that it atleast used to work - I made sure it >> worked once, but it might have gone bad. > > Here's how I build yaws on Windows: > > My source root is $ROOT. > Unpack yaws-1.68 into $ROOT/lib/yaws. > Have a folder called $ROOT/extra with the files yaws_generated.erl and > yaws.app (although I forget why I need yaws.app): > > yaws_generated.erl: > %% > %--------------------------------------------------------------------- > - > %%% File : yaws_generated.template > %%% Author : Klacke > %%% Purpose : > %%% Created : 10 Jun 2002 by Klacke > %% > %--------------------------------------------------------------------- > - > > %% generated code from some environment variables > %% especially VARDIR is important since it controls > %% where the --hup and friends > > -module(yaws_generated). > -author('klacke@REDACTED'). > > -compile(export_all). > > version() -> "1.68". > > vardir() -> "C:/yaws/var". > > ctldir() -> "C:/yaws/var/run/yaws". > > etcdir() -> "C:/yaws/etc". > > % (Or whatever you want your defaults to be.) > > yaws.app: > {application, yaws, [ > {description, "yaws WWW server"}, > {vsn, "1.68"}, > {modules, [ > yaws, > yaws_app, > yaws_ticker, > yaws_config, > yaws_server, > yaws_sup, > yaws_api, > yaws_log, > yaws_ls, > yaws_debug, > yaws_compile, > yaws_ctl, > yaws_cgi, > yaws_zlib, > yaws_generated, > mime_type_c, > mime_types, > yaws_session_server, > yaws_404, > yaws_revproxy, > yaws_html, > yaws_log_file_h, > yaws_rss, > yaws_dav, > yaws_pam, > json, > jsonrpc, > yaws_jsonrpc, > yaws_xmlrpc, > haxe, > yaws_rpc, > yaws_soap_srv, > yaws_soap_lib > ]}, > {registered, []}, > {mod, {yaws_app, []}}, > {env, []}, > {applications, [ > kernel, > stdlib > ]} > ]}. > > And then I run this batch script: > > build_yaws.bat: > @echo off > setlocal > > copy /Y extra\yaws_generated.erl lib\yaws\src > cd lib\yaws\src > > set ERLC="C:\Program Files\erl5.5.4\bin\erlc" > set ERL="C:\Program Files\erl5.5.4\bin\erl" > > set ERLCOPTS=-W -pa .. -I../include -o ../ebin > set ERLOPTS=-noshell -pa ../ebin > > > %ERLC% %ERLCOPTS% yaws.erl > %ERLC% %ERLCOPTS% yaws_app.erl > %ERLC% %ERLCOPTS% yaws_ticker.erl > %ERLC% %ERLCOPTS% yaws_config.erl > %ERLC% %ERLCOPTS% yaws_server.erl > %ERLC% %ERLCOPTS% yaws_sup.erl > %ERLC% %ERLCOPTS% yaws_api.erl > %ERLC% %ERLCOPTS% yaws_log.erl > %ERLC% %ERLCOPTS% yaws_ls.erl > %ERLC% %ERLCOPTS% yaws_debug.erl > %ERLC% %ERLCOPTS% yaws_compile.erl > %ERLC% %ERLCOPTS% yaws_ctl.erl > %ERLC% %ERLCOPTS% yaws_cgi.erl > %ERLC% %ERLCOPTS% yaws_zlib.erl > %ERLC% %ERLCOPTS% yaws_generated.erl > %ERLC% %ERLCOPTS% yaws_session_server.erl > %ERLC% %ERLCOPTS% yaws_404.erl > %ERLC% %ERLCOPTS% yaws_revproxy.erl > %ERLC% %ERLCOPTS% yaws_html.erl > %ERLC% %ERLCOPTS% yaws_log_file_h.erl > %ERLC% %ERLCOPTS% yaws_rss.erl > %ERLC% %ERLCOPTS% yaws_dav.erl > %ERLC% %ERLCOPTS% yaws_pam.erl > %ERLC% %ERLCOPTS% json.erl > %ERLC% %ERLCOPTS% jsonrpc.erl > %ERLC% %ERLCOPTS% yaws_jsonrpc.erl > %ERLC% %ERLCOPTS% yaws_xmlrpc.erl > %ERLC% %ERLCOPTS% haxe.erl > %ERLC% %ERLCOPTS% yaws_rpc.erl > %ERLC% %ERLCOPTS% yaws_soap_srv.erl > %ERLC% %ERLCOPTS% yaws_soap_lib.erl > > del /F charset.def > echo. > charset.def > > %ERLC% %ERLCOPTS% mime_type_c.erl > %ERL% %ERLOPTS% -s mime_type_c compile > %ERLC% %ERLCOPTS% mime_types.erl > > pause > endlocal > > > I have also made a small attempt at writing a yaws.bat file, but I > haven't used this in a few years: > > @echo off > setlocal > > set HOME=C:/yaws > set yawsdir=C:/yaws/erlang/yaws-1.68 > > set erl=C:\Program Files\erl5.5.4\bin\erl.exe > set werl=C:\Program Files\erl5.5.4\bin\werl.exe > > set debug= > set daemon= > set interactive= > set trace= > set conf= > set runmod= > set sname= > set heart= > set xpath= > set mnesia= > set id=default > set pdist= > set erlarg= > > :NEXTARG > set arg=%1 > shift > if "%arg%"=="" goto ENDARGS > > if "%arg%"=="-i" goto INTERACT > if "%arg%"=="--interactive" goto INTERACT > > if "%arg%"=="-w" goto WINTERACT > if "%arg%"=="--winteractive" goto WINTERACT > > if "%arg%"=="-D" goto DAEMON > if "%arg%"=="--daemon" goto DAEMON > > if "%arg%"=="-d" goto DEBUG > if "%arg%"=="--debug" goto DEBUG > > if "%arg%"=="-t" goto TRACETR > if "%arg%"=="--tracetraf" goto TRACETR > > if "%arg%"=="-T" goto TRACEHT > if "%arg%"=="--tracehttp" goto TRACEHT > > if "%arg%"=="-I" goto ID > if "%arg%"=="--id" goto ID > > if "%arg%"=="-x" goto TRACEOUT > if "%arg%"=="--traceout" goto TRACEOUT > > if "%arg%"=="--trace" goto TRACE > > if "%arg%"=="-M" goto MNESIADIR > if "%arg%"=="--mnesiadir" goto MNESIADIR > > if "%arg%"=="-c" goto CONF > if "%arg%"=="--conf" goto CONF > > if "%arg%"=="-pa" goto PA > if "%arg%"=="--pa" goto PA > > if "%arg%"=="-r" goto RUNMOD > if "%arg%"=="--runmod" goto RUNMOD > > if "%arg%"=="-h" goto HUP > if "%arg%"=="--hup" goto HUP > > if "%arg%"=="-s" goto STOP > if "%arg%"=="--stop" goto STOP > > if "%arg%"=="-ls" goto LS > if "%arg%"=="--ls" goto LS > > if "%arg%"=="-S" goto STATUS > if "%arg%"=="--status" goto STATUS > > if "%arg%"=="-load" goto LOAD > if "%arg%"=="--load" goto LOAD > > if "%arg%"=="-j" goto CTLTRACE > if "%arg%"=="--ctltrace" goto CTLTRACE > > if "%arg%"=="-v" goto VERSION > if "%arg%"=="--version" goto VERSION > > if "%arg%"=="-sname" goto SNAME > if "%arg%"=="--sname" goto SNAME > > if "%arg%"=="-name" goto NAME > if "%arg%"=="--name" goto NAME > > if "%arg%"=="-heart" goto HEART > if "%arg%"=="--heart" goto HEART > > if "%arg%"=="-proto_dist" goto PROTO > if "%arg%"=="--proto_dist" goto PROTO > > if "%arg%"=="-erlarg" goto ERLARG > if "%arg%"=="--erlarg" goto ERLARG > > if "%arg%"=="-check" goto CHECK > if "%arg%"=="--check" goto CHECK > > goto HELP > > :INTERACT > set interactive=true > set debug= -yaws debug > set daemon= > goto NEXTARG > > :WINTERACT > set interactive=true > set debug= -yaws debug > set daemon= > set erl=%werl% > goto NEXTARG > > :DAEMON > set daemon= -detached > goto NEXTARG > > :DEBUG > set debug= -boot start_sasl -yaws debug > goto NEXTARG > > :TRACETR > set trace= -yaws trace traffic > goto NEXTARG > > :TRACEHT > set trace= -yaws trace http > goto NEXTARG > > :ID > set id=%1 > shift > goto NEXTARG > > :TRACEOUT > set traceoutput= -yaws traceoutput > goto NEXTARG > > :TRACE > set traceoutput= -yaws traceoutput > set trace= -yaws trace traffic > goto NEXTARG > > :MNESIADIR > set mnesia= -mnesia dir %1 -run mnesia start > shift > goto NEXTARG > > :CONF > set conf= -conf %1 > shift > goto NEXTARG > > :PA > set xpath= %xpath% -pa %1 > shift > goto NEXTARG > > :RUNMOD > set runmod= -runmod %1 > shift > goto NEXTARG > > :HUP > set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl hup > goto NEXTARG > > :STOP > set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl stop > goto NEXTARG > > :LS > set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl ls > goto NEXTARG > > :STATUS > set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl status > goto NEXTARG > > :LOAD > "%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl load %id% %1 %2 % > 3 %4 %5 %6 %7 %8 %9 > goto END > > :CTLTRACE > set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl trace %1 > shift > goto NEXTARG > > :VERSION > "%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws printversion > goto END > > :SNAME > set sname= -sname %1 > shift > goto NEXTARG > > :NAME > set sname= -name %1 > shift > goto NEXTARG > > :HEART > set heart= -heart > goto NEXTARG > > :PROTO > set pdist= -proto_dist %1 > shift > goto NEXTARG > > :ERLARG > set erlarg=%erlarg% %1 > shift > goto NEXTARG > > :CHECK > mkdir "%HOME%/.yaws/" > mkdir "%HOME%/.yaws/%id%" > "%erl%" -noshell -pa "%yawsdir%/ebin" %xpath% -s yaws_ctl check %id > % %1 %2 %3 %4 %5 %6 %7 %8 %9 > goto END > > :ENDARGS > > if NOT DEFINED ex goto NOEX > %ex% %id% > goto END > :NOEX > > if "%id%"=="" goto NOID > set id=-yaws id %id% > :NOID > > set trace=%trace% %traceoutput% > > if "%daemon%%interactive%"=="" goto HELP > > set XEC=%daemon% %heart% -pa "%yawsdir%/ebin" %xpath% %sname% %pdist > % %erlarg% %debug% -s yaws %trace% %conf% %runmod% %mnesia% %id% > > set HEART_COMMAND= > if "%heart%%daemon%"=="" goto NOHEART > echo set HEART_COMMAND="%erl%" %XEC% > set HEART_COMMAND="%erl%" %XEC% > > :NOHEART > echo "%erl%" %XEC% > "%erl%" %XEC% > goto END > > :HELP > echo "usage: " > echo "" > > echo " yaws -i | --interactive -- interactive (no > daemon) mode" > echo " yaws -w | --winteractive -- interactive (werl) " > echo " yaws --daemon -- daemon mode" > > echo "" > > echo "" > echo " Auxilliary flags for the daemon: " > echo " --id Id -- Set system id" > echo " --debug -- debug mode " > echo " --conf File -- set config file" > echo " --tracetraf -- trace traffic" > echo " --tracehttp -- trace http traffic" > echo " --traceout -- trace output to stdout" > echo " --version -- print version" > echo " --pa path -- add load path" > echo " --mnesiadir dir -- start Mnesia in dir" > echo " --proto_dist Mod -- use Mod for distrib" > echo " --sname xxx -- start with sname xxx" > echo " --name xxx -- start with name xxx" > echo " --runmod mod -- call mod:start/0 at startup" > echo " --heart -- auto restart yaws if it > crashes" > echo " --erlarg X -- pass argument X to $erl" > > echo "" > > echo "ctl functions ... " > echo " yaws --hup [--id ID] -- hup the daemon, reload > conf" > echo " yaws --stop [--id ID] -- stop the daemon" > echo " yaws --status [--id ID] -- query the daemon status" > echo " yaws --load Modules -- load modules" > echo " yaws --ls -- list Yaws nodes and > their status" > echo " yaws --ctltrace traffic|http -- toggle trace of > running daemon" > echo " yaws --check YawsFile [IncDirs] -- test compile File" > > :END > endlocal > > > > Robby > > -- > r fullstop raschke around tombob fullstop com > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From nm@REDACTED Thu Sep 13 21:32:03 2007 From: nm@REDACTED (Gaspar Chilingarov) Date: Thu, 13 Sep 2007 23:32:03 +0400 Subject: [erlang-questions] Sending funs between nodes In-Reply-To: <46D666B1.4090503@ericsson.com> References: <337538cb0708291228u415559a1jd02bbbcecb9b3ccb@mail.gmail.com> <46D666B1.4090503@ericsson.com> Message-ID: <46E99033.3060101@web.am> Bengt Kleberg wrote: > Greetings, > > > yes, the fun needs the code. > yes, you need the beam files on both nodes. > there are 2 ways -- if you define fun inside module (like in your example) fun is defined inside module at compile time and is passed around as reference to some funcion in that module. if you compile it from shell (i.e. parsing text form and then compiling it to bytecode), then compiler creates full bytecode, not only the references -- and these funs are possible to pass between nodes. Look at term_to_binary(Fun) -- if you get short form (say 12-16 bytes) -- it's just reference to the module. If you get longer one - several hundred bytes -- then it's fun's full body. /Gaspar > > bengt > > Those were the days... > EPO guidelines 1978: "If the contribution to the known art resides > solely in a computer program then the subject matter is not > patentable in whatever manner it may be presented in the claims." > > > On 2007-08-29 21:28, Kirill Zaborski wrote: >> I was trying to do the following: >> 1) a module on node X - >> ------------------- >> -module(test1). >> -export([go/0]). >> >> go() -> >> P = spawn(fun() -> receive X -> X() end end), >> register(rrr, P). >> ------------------- >> 2) a module on node Y - >> ------------------- >> -module(test2). >> -export([go/0]). >> >> go() -> >> {rrr, x@REDACTED}!fun() -> io:format("bar",[]) end. >> ------------------- >> >> LOKI is my hostname :) >> >> So If I run test1:go() and then test2:go() on other node I get >> >> =ERROR REPORT==== 29-Aug-2007::22:34:29 === >> Error in process <0.35.0> on node 'y@REDACTED' with exit value: >> {undef,[{shell_defau >> lt,fun_to_list,[#Fun]},{erl_eval,do_apply,5},{shell,exprs, >> 6},{shell,eval_loop,3}]} >> >> ** exited: {undef,[{shell_default,fun_to_list,[#Fun]}, >> {erl_eval,do_apply,5}, >> {shell,exprs,6}, >> {shell,eval_loop,3}]} ** >> >> It looks like fun needs code of the module where it was defined. Why is >> it so? >> is there any way around this issue? Or I need the same beams on all the >> nodes? >> >> >> Best regards, >> Kirill Zaborski. >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> 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 > -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e nm@REDACTED w http://zanazan.am/ From mbj@REDACTED Fri Sep 14 15:48:50 2007 From: mbj@REDACTED (Martin Bjorklund) Date: Fri, 14 Sep 2007 15:48:50 +0200 (CEST) Subject: [erlang-questions] FFI: handling refcounted binaries In-Reply-To: <1189772377.28880.162.camel@gnatziu.crs4.it> References: <1189694808.28880.49.camel@gnatziu.crs4.it> <20070914.112956.226243802.mbj@tail-f.com> <1189772377.28880.162.camel@gnatziu.crs4.it> Message-ID: <20070914.154850.142634631.mbj@tail-f.com> Alceste Scalas wrote: > ========================================= > Handling refcounted binaries with the FFI > ========================================= > > Let's suppose that the 'binary' FFI type is added. > > If you just want to *return* a binary (filled with data) from the C > side, it is easy. You could just create an ErlDrvBinary in the usual > way, (erl_driver.h, driver_alloc_binary(), driver_binary_inc_refc() > etc.). The FFI would turn it into a "normal" Erlang binary [1]. > > If you want to *receive* a handle to an Erlang binary in the form of an > ErlDrvBinary, and increment/decrement its refcount in order to keep it > for later use, then: > > a. if the Erlang binary is still refcounted, it is > straightforward [2]; > > b. however, a binary created from Erlang code may *not* be > refcounted [3]. In this case, the FFI could force the > creation of a refcounted binary, copy the contents > of the original one, and pass an ErlDrvBinary to the C > side [2]. There, the standard ErlDrvBinary API could be > used. I like this proposal where you always get a ErlDrvBinary. It's cleaner than the current driver iovec i/f. /martin From bjorn@REDACTED Fri Sep 14 15:57:50 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 14 Sep 2007 15:57:50 +0200 Subject: [erlang-questions] Invoking a function based on name only In-Reply-To: <46EA1B01.30509@free.fr> References: <46EA1B01.30509@free.fr> Message-ID: igwan writes: > It is worth noting that if the number of arguments is known at compile > time, it's more efficient to use Module:Function(Arg1, Arg2, ...) than > apply/3. > From the the Efficiency Guide : "The syntax |M:Foo(A1,A2,An)| (also > referred to as implicit apply, where M and Foo are bound variables) > where equivalent with |apply(M,Foo,[A1,A2,An])| in releases pre > OTP-R10B. The compiler will now optimize this syntax giving it better > performance than apply/3" > That was correct in R10B and in some R11B releases. We will update that part of the Efficiency Guide in R12B. The compiler was changed in one of the R11B releases to internally rewrite apply(M, Foo, [A1,A2,An]) to M:Foo(A1, A2, An); thus, exactly the same code is produced and you can choose the version you find more readable (personally, I find M:Foo(A1, A2, An) more readable). /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From yuxh312@REDACTED Fri Sep 14 16:05:42 2007 From: yuxh312@REDACTED (krzycube) Date: Fri, 14 Sep 2007 22:05:42 +0800 Subject: [erlang-questions] distel doesn't work on my windows xp. but well on Ubuntu 7.04 Message-ID: i copy my issue from distel wiki in googlecode. *What steps will reproduce the problem?* 0. set up distel: with below code: ------------------------------------------- (add-to-list 'load-path "D:\\HOME\\distel\\elisp") (when (locate-library "distel") (require 'distel) (distel-setup) ;; (add-hook 'erlang-mode-hook 'distel-erlang-mode-hook) ; now with apt- get (add-hook 'erlang-mode-hook '(lambda () (unless erl-nodename-cache (distel-load-shell)))) (defun distel-load-shell () "Load/reload the erlang shell connection to a distel node" (interactive) ;; Set default distel node name (setq erl-nodename-cache 'emacs@REDACTED) (setq distel-modeline-node "emacs") (force-mode-line-update) ;; Start up an inferior erlang with node name `distel' (let ((file-buffer (current-buffer)) (file-window (selected-window))) (setq inferior-erlang-machine-options '("-sname" "emacs")) (switch-to-buffer-other-window file-buffer) (inferior-erlang) (select-window file-window) (switch-to-buffer file-buffer)))) ------------------------------------------- 1. run emacs 22.1 on windows xp pro 2. M-x erlang-mode 3. C-c C-z to run erlang-shell . 4.C-x C-f open some erlang source 5.c(xx.erl,[debug_info]). 5.C-c C-d n , connet to node named emacs@REDACTED as configured before 6.C-c C-d L , try to reload code. then here failed. here servral steps: first , can not find ~/.erlang.cookie , then i create it. why didn't this create itself ? after this , i face the message below: *What is the expected output? What do you see instead?* if: Can't handle event closed in state derl-recv-challenge-ack Can't handle event closed in state derl-recv-challenge-ack *What version of the product are you using? On what operating system?* Erlang (BEAM) emulator version 5.5.5 [async-threads:0] Eshell V5.5.5 (abort with ^G) on windows xp. *Please provide any additional information below.* i have tried distel before on my Ubuntu 7.04 with Emacs 21.3 , it works well. but on windows , it doesn't. and i also try to google this error message , found something ,said: there's newline in the cookie file , also i try to fix derl.el , but failed . -- "Yu Xihe" as Chinese Name "Martin" as English Name "KrzyCube" as Nickname -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardc@REDACTED Fri Sep 14 16:40:59 2007 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 14 Sep 2007 16:40:59 +0200 Subject: [erlang-questions] Invoking a function based on name only In-Reply-To: References: <46EA1B01.30509@free.fr> Message-ID: <46EA9D7B.6070003@it.uu.se> Bjorn Gustavsson wrote: > The compiler was changed in one of the R11B releases to > internally rewrite apply(M, Foo, [A1,A2,An]) to M:Foo(A1, A2, An); > thus, exactly the same code is produced and you can choose the > version you find more readable (personally, I find M:Foo(A1, A2, An) > more readable). Just to clarify, this only happens when the length of the argument list is constant at compile time, as in apply(M, Foo, [A1,A2,An]). If you write apply(M, Foo, Args), where Args is some variable or other expression that is not a constant list, like [A1,A2|ExtraArgs], the compiler cannot decide the arity of the call at compile time, and will generate a full 'apply'. (Apply has to traverse the list at runtime to prepare for the call, which is why it is less efficient.) /Richard From yuxh312@REDACTED Fri Sep 14 16:05:42 2007 From: yuxh312@REDACTED (krzycube) Date: Fri, 14 Sep 2007 22:05:42 +0800 Subject: [erlang-questions] distel doesn't work on my windows xp. but well on Ubuntu 7.04 Message-ID: i copy my issue from distel wiki in googlecode. *What steps will reproduce the problem?* 0. set up distel: with below code: ------------------------------------------- (add-to-list 'load-path "D:\\HOME\\distel\\elisp") (when (locate-library "distel") (require 'distel) (distel-setup) ;; (add-hook 'erlang-mode-hook 'distel-erlang-mode-hook) ; now with apt- get (add-hook 'erlang-mode-hook '(lambda () (unless erl-nodename-cache (distel-load-shell)))) (defun distel-load-shell () "Load/reload the erlang shell connection to a distel node" (interactive) ;; Set default distel node name (setq erl-nodename-cache 'emacs@REDACTED) (setq distel-modeline-node "emacs") (force-mode-line-update) ;; Start up an inferior erlang with node name `distel' (let ((file-buffer (current-buffer)) (file-window (selected-window))) (setq inferior-erlang-machine-options '("-sname" "emacs")) (switch-to-buffer-other-window file-buffer) (inferior-erlang) (select-window file-window) (switch-to-buffer file-buffer)))) ------------------------------------------- 1. run emacs 22.1 on windows xp pro 2. M-x erlang-mode 3. C-c C-z to run erlang-shell . 4.C-x C-f open some erlang source 5.c(xx.erl,[debug_info]). 5.C-c C-d n , connet to node named emacs@REDACTED as configured before 6.C-c C-d L , try to reload code. then here failed. here servral steps: first , can not find ~/.erlang.cookie , then i create it. why didn't this create itself ? after this , i face the message below: *What is the expected output? What do you see instead?* if: Can't handle event closed in state derl-recv-challenge-ack Can't handle event closed in state derl-recv-challenge-ack *What version of the product are you using? On what operating system?* Erlang (BEAM) emulator version 5.5.5 [async-threads:0] Eshell V5.5.5 (abort with ^G) on windows xp. *Please provide any additional information below.* i have tried distel before on my Ubuntu 7.04 with Emacs 21.3 , it works well. but on windows , it doesn't. and i also try to google this error message , found something ,said: there's newline in the cookie file , also i try to fix derl.el , but failed . -- "Yu Xihe" as Chinese Name "Martin" as English Name "KrzyCube" as Nickname -------------- next part -------------- An HTML attachment was scrubbed... URL: From billclem@REDACTED Fri Sep 14 17:29:32 2007 From: billclem@REDACTED (Bill Clementson) Date: Fri, 14 Sep 2007 08:29:32 -0700 Subject: [erlang-questions] distel doesn't work on my windows xp. but well on Ubuntu 7.04 References: Message-ID: krzycube writes: > i copy my issue from distel wiki in googlecode. > > What steps will reproduce the problem? > 0. set up distel: with below code: > ------------------------------------------- > (add-to-list 'load-path "D:\\HOME\\distel\\elisp") > (when (locate-library "distel") > (require 'distel) > (distel-setup) > ;; (add-hook 'erlang-mode-hook 'distel-erlang-mode-hook) ; now with apt- > get > (add-hook 'erlang-mode-hook > '(lambda () > (unless erl-nodename-cache > (distel-load-shell)))) > (defun distel-load-shell () > "Load/reload the erlang shell connection to a distel node" > (interactive) > ;; Set default distel node name > (setq erl-nodename-cache 'emacs@REDACTED) > (setq distel-modeline-node "emacs") > (force-mode-line-update) > ;; Start up an inferior erlang with node name `distel' > (let ((file-buffer (current-buffer)) > (file-window (selected-window))) > (setq inferior-erlang-machine-options '("-sname" "emacs")) > (switch-to-buffer-other-window file-buffer) > (inferior-erlang) > (select-window file-window) > (switch-to-buffer file-buffer)))) > ------------------------------------------- > > 1. run emacs 22.1 on windows xp pro > 2. M-x erlang-mode > 3. C-c C-z to run erlang-shell . > 4.C-x C-f open some erlang source > 5.c(xx.erl,[debug_info]). > 5.C-c C-d n , connet to node named emacs@REDACTED as configured before > 6.C-c C-d L , try to reload code. then here failed. > > here servral steps: > first , can not find ~/.erlang.cookie , then i create it. > why didn't this create itself ? > after this , i face the message below: > > What is the expected output? What do you see instead? > > if: Can't handle event closed in state > derl-recv-challenge-ack > Can't handle event closed in state > derl-recv-challenge-ack > > What version of the product are you using? On what operating system? > Erlang (BEAM) emulator version 5.5.5 [async-threads:0] > > Eshell V5.5.5 (abort with ^G) > > on windows xp. > > Please provide any additional information below. > > i have tried distel before on my Ubuntu 7.04 with Emacs 21.3 , it works well. > but on windows , it doesn't. > > and i also try to google this error message , found something ,said: > there's newline in the cookie file , also i try to fix derl.el , but failed . > > -- > "Yu Xihe" as Chinese Name > "Martin" as English Name > "KrzyCube" as Nickname I don't normally use Windows; however, I did recently setup distel on a Windows box. I encountered similar problems when I used a copy of ntemacs which was based on the unicode branch of cvs emacs. However, after switching to the released Emacs 22.1 (not cvs emacs), distel worked fine. You indicated that you were using emacs 22.1, so maybe this isn't your problem. However, if you are using the unicode branch of cvs emacs, you might want to try installing the released emacs 22.1 instead. Alternatively, if you're getting an error message that says something about there being a newline in the cookie file, you could use hexl mode to find and remove the newline (or recreate the cookie). If you continue to encounter problems, you should post details on the distel mailing list (http://news.gmane.org/gmane.comp.lang.erlang.distel.devel). - Bill From qrilka@REDACTED Fri Sep 14 21:21:50 2007 From: qrilka@REDACTED (Kirill Zaborski) Date: Fri, 14 Sep 2007 23:21:50 +0400 Subject: [erlang-questions] Sending funs between nodes In-Reply-To: <46E99033.3060101@web.am> References: <337538cb0708291228u415559a1jd02bbbcecb9b3ccb@mail.gmail.com> <46D666B1.4090503@ericsson.com> <46E99033.3060101@web.am> Message-ID: <337538cb0709141221q6d5fa744m96f622c7069030b0@mail.gmail.com> On 9/13/07, Gaspar Chilingarov wrote: > > there are 2 ways -- if you define fun inside module (like in your > example) fun is defined inside module at compile time and is passed > around as reference to some funcion in that module. > But why are those ways different from each other? What's so special in constructing funs from shell and why can't I do the same from compiled module? Best regards, Kirill. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmercer@REDACTED Fri Sep 14 22:15:49 2007 From: dmercer@REDACTED (David Mercer) Date: Fri, 14 Sep 2007 15:15:49 -0500 Subject: [erlang-questions] Newbie training project proposal In-Reply-To: <9b08084c0709110029v3c06c6fbt788d4490892190c9@mail.gmail.com> References: <44FCCF2C-4478-4BA3-BA02-9C64154475BF@skife.org> <9b08084c0709110029v3c06c6fbt788d4490892190c9@mail.gmail.com> Message-ID: <004b01c7f70c$0b2a2c90$891ea8c0@SSI.CORP> On Tuesday, September 11, 2007, Joe Armstrong wrote: > Do protocol designers turn off their brains when they design protocols? > > I see a lot of the following: > > - text protocols with are "easy" to understand and parse > (false - most text protocols are inadequately specified) One advantage of text protocols is that you can telnet to a port and do a transaction manually. I'm thinking SMTP and HTTP here as examples. I have on occasion had to send email without a mail client handy, so I just telnet to port 25 of my mail server and type in the SMTP commands. Similarly, I have had occasion to need a web page without a browser handy: I just telnetted to port 80 and typed in my request. STOMP is very HTTP-like. We'll be able to interact with the STOMP server with nothing but telnet and a keyboard. > - XML protocols > (crazy - did anybody think how long it would take to parse this crap) I agree with you wholeheartedly on this one. It's convenient for XML shops, but as a basis for a protocol that might be used by multiple organizations, it's a waste of resources. Non-XML shops end up having to do a bunch of string manipulation, regexp searches and the like to manage XML, which is awkward, buggy, and annoying. > > The two most obvious methods for building protocols are: > > - define a packed bit-byte-word structure appropriate to you needs > - use serialised lisp S expressions, or Erlang terms (whatever) > > Are rarely used. Agreed. I probably prefer S-expressions as the most generic. Even though they are very Lispy, they are ridiculously easy to parse in any language. Erlang terms are up there with JSON: they are kind of locking you into a technology, but they're not too difficult (or verbose) for non-Erlang/Javascript shops. At least they don't come with all the baggage of having to handle external DTD's, matching closing and opening tags, handling attributes and namespaces, and so on. Cheers, David From brianm@REDACTED Sat Sep 15 01:54:17 2007 From: brianm@REDACTED (Brian McCallister) Date: Fri, 14 Sep 2007 16:54:17 -0700 Subject: [erlang-questions] Newbie training project proposal In-Reply-To: <9b08084c0709110029v3c06c6fbt788d4490892190c9@mail.gmail.com> References: <44FCCF2C-4478-4BA3-BA02-9C64154475BF@skife.org> <9b08084c0709110029v3c06c6fbt788d4490892190c9@mail.gmail.com> Message-ID: On Sep 11, 2007, at 12:29 AM, Joe Armstrong wrote: > I'll start with a little rant about the architecture of STOMP :-) > Ooo, boy, this will be fun... > > > Do protocol designers turn off their brains when they design > protocols? Nope, I think everyone has good intentions at least. > I see a lot of the following: > > - text protocols with are "easy" to understand and parse depends on the client, if it is telnet then text is in fact much easier. It depends on the goal. > (false - most text protocols are inadequately specified) > What is inadequately specified? I am serious, I know the spec plays loosey-goosey with some areas. We rely on implementors to let us know where the gaps are. It got a "1.0" only because a lot of folks actually use it and no one implementing had complained in a while :-) > - XML protocols > (crazy - did anybody think how long it would take to parse this > crap) Agreed. > The two most obvious methods for building protocols are: > > - define a packed bit-byte-word structure appropriate to you needs Not appropriate when a design goal is that it can be done by hand over telnet. A key consumer of stomp is a sysadmin at 3am trying to figure out why somethign went wrong. IN that case text format protocols are massively valuable. They are also massively less efficient, which is why I would generally suggest stomp as a transport option on a system and an optimized packed binary transport as another. I think there are glaring crap points in stomp, but the decision to be text-oriented is *not* of them :-) -Brian (who wrote the initial stomp spec because he was tired of not being able to access binary protocols easily). From hughperkins@REDACTED Sat Sep 15 06:02:14 2007 From: hughperkins@REDACTED (Hugh Perkins) Date: Sat, 15 Sep 2007 11:02:14 +0700 Subject: [erlang-questions] Representation of a map in bytecode? Message-ID: <837db430709142102h77a4799foe5820f3dc3ca7aab@mail.gmail.com> How is a map represented in bytecode? To what extent is it clearly identifiable as a map, directly from the bytecode? Kindof contemplating to what extent it could be interesting/useful/fun to make a fork of Erlang that automatically parallelizes maps across available processor cores. This should probably be done dynamically, at runtime. I guess two options are: - write a wrapper function around map that communicates with some kind of scheduler process (presumably not the build-in scheduler, at least initially), to split the map across multiple cores if there are some available - extend the vm (and perhaps the byte-code) so that the vm can detect maps and automatically split them across multiple available processor cores where appropriate Just kindof contemplating out of curiosity. No idea how feasible it is, or how useful, but interests me, especially with Tilera-64s and so on on the horizon. From tim@REDACTED Sat Sep 15 06:23:36 2007 From: tim@REDACTED (Tim Bates) Date: Sat, 15 Sep 2007 13:53:36 +0930 Subject: [erlang-questions] list:join() for erlang? In-Reply-To: <46EA64F0.6060800@di.uminho.pt> References: <46E8115C.8000602@free.fr><46E912 3D.4000503@munat.com> <000101c7f63e$adabef40$891ea8c0@SSI.CORP><6a36e7290709131338i4c19baefm44602 f659affcc9@mail.gmail.com> <46EA64F0.6060800@di.uminho.pt> Message-ID: <46EB5E48.3060509@bates.id.au> Paulo S?rgio Almeida wrote: > Regarding list reverse, while playing around and observing: > > 85> erlang:is_builtin(lists, reverse, 1). > false > > I found out that what is builtin is another function, reverse/2, which > is not much advertised, but that may be very useful, as the fastest way > to simultaneously reverse a list and concatenate to another. From lists.erl, reverse/1 calls reverse/2 to do the actual reversing, except in a couple of special cases (where length(L) < 3). reverse([] = L) -> L; reverse([_] = L) -> L; reverse([A, B]) -> [B, A]; reverse([A, B | L]) -> lists:reverse(L, [B, A]). Tim. -- Tim Bates tim@REDACTED From dustin@REDACTED Sat Sep 15 06:44:24 2007 From: dustin@REDACTED (Dustin Sallings) Date: Fri, 14 Sep 2007 21:44:24 -0700 Subject: [erlang-questions] Representation of a map in bytecode? In-Reply-To: <837db430709142102h77a4799foe5820f3dc3ca7aab@mail.gmail.com> References: <837db430709142102h77a4799foe5820f3dc3ca7aab@mail.gmail.com> Message-ID: On Sep 14, 2007, at 21:02, Hugh Perkins wrote: > How is a map represented in bytecode? To what extent is it clearly > identifiable as a map, directly from the bytecode? > > Kindof contemplating to what extent it could be interesting/useful/fun > to make a fork of Erlang that automatically parallelizes maps across > available processor cores. Do you mean lists:map/{2,3}? It'd be trivial to write your own map functions to use in place of lists:map. If you wanted to have it replaced wholesale, then you'd need to patch the lists module, of course. -- Dustin Sallings From ok@REDACTED Sat Sep 15 07:10:47 2007 From: ok@REDACTED (ok) Date: Sat, 15 Sep 2007 17:10:47 +1200 Subject: [erlang-questions] list:join() for erlang? In-Reply-To: <6a36e7290709140211x606ff67w9e9fd1b0c8defd80@mail.gmail.com> References: <46E8115C.8000602@free.fr> <46E9123D.4000503@munat.com> <000101c7f63e$adabef40$891ea8c0@SSI.CORP> <6a36e7290709131338i4c19baefm44602f659affcc9@mail.gmail.com> <6a36e7290709140211x606ff67w9e9fd1b0c8defd80@mail.gmail.com> Message-ID: <0B70751F-CAD7-4676-9F18-D275C713F24F@cs.otago.ac.nz> On 14 Sep 2007, at 9:11 pm, Bob Ippolito wrote: > Sure, it works great for concatenating two lists, but it's not > necessarily great for O(N^2) lists. But that is TOTALLY irrelevant to the algorithm we have been discussing, where the total cost, using ++, is LINEAR in the total size of the input. The use of flatten will in NO WAY improve the performance for THIS particular problem. Basically, if you arrange your recursive code so that whenever there is E1 ++ E2 you also have E1 is part of the input (and never used again) while E2 may be recursively > Given that most of them will > probably be short, I absolutely concede that ++ could very well be a > performance winner in some cases. However, given that lists:reverse is > special-cased I could imagine that lists:flatten could be also at some > point and then the performance landscape could change dramatically. > Either way, as I said before, this is absolutely not a bottleneck in > our code so we didn't try very many implementations. > >>> >>> This is our join/2, which is largely the same but uses >>> lists:flatten/1 >>> instead of ++: >> >> But that changes the semantics. It will accept stuff that I did not >> at all wish my code to accept. > > lists:append/1 could be used in this case, but I saw no good reason to > specialize. If your code has incorrect input somewhere a library > function such as this is probably not the best place to figure that > out. > >>> join([S], _Separator) -> >>> lists:flatten(S); >> >> This does *more* copying than the ++ version. > > This is a degenerate case where practically nothing happens in any > version, so it's hardly worth mention. > > -bob From ok@REDACTED Sat Sep 15 07:20:25 2007 From: ok@REDACTED (ok) Date: Sat, 15 Sep 2007 17:20:25 +1200 Subject: [erlang-questions] list:join() for erlang? In-Reply-To: <6a36e7290709140211x606ff67w9e9fd1b0c8defd80@mail.gmail.com> References: <46E8115C.8000602@free.fr> <46E9123D.4000503@munat.com> <000101c7f63e$adabef40$891ea8c0@SSI.CORP> <6a36e7290709131338i4c19baefm44602f659affcc9@mail.gmail.com> <6a36e7290709140211x606ff67w9e9fd1b0c8defd80@mail.gmail.com> Message-ID: On 14 Sep 2007, at 9:11 pm, Bob Ippolito wrote: > Sure, it works great for concatenating two lists, but it's not > necessarily great for O(N^2) lists. Given that most of them will > probably be short, I absolutely concede that ++ could very well be a > performance winner in some cases. However, given that lists:reverse is > special-cased I could imagine that lists:flatten could be also at some > point and then the performance landscape could change dramatically. (a) I repeat, you have misunderstood the advice about ++. In this particular problem, the version using ++ is not only linear in the size of the input, it is optimal: it does fewer conses than the flatten version, and every single one of the conses it builds is a required part of the output. The thing is that (Xs++Ys)++Zs is inefficient compared with Xs++(Ys++Zs), and if you read the code I posted attentively, you will see that each and every instance of ++ is one of the Xs++(stuff) form, where Xs is one of the inputs. That is the efficient case. (b) I've done a few benchmarks, and the turning of reverse/1 into a BIF doesn't seem to have made much difference. I have tried comparing my own reverse/1 (using an unrolled reverse/2) and found it difficult to measure any difference between that and flatten/2. (c) Except for iolists, where the point is NOT to flatten, "unstructured" lists of the kind for which flatten makes sense are bad style in any programming language. If anyone speeds up flatten, it will count as a sin in the Book of Life that they encouraged folly. To cut a long story short, ++ is like a carving knife. You have to take reasonable care using it, but avoiding the carving knife and tearing the roast you are serving to your friensd apart with your teeth (like using flatten) would be messy and not likely to impress them (to put it kindly). From ulf@REDACTED Sat Sep 15 08:17:16 2007 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 15 Sep 2007 08:17:16 +0200 Subject: [erlang-questions] Newbie training project proposal In-Reply-To: <004b01c7f70c$0b2a2c90$891ea8c0@SSI.CORP> References: <44FCCF2C-4478-4BA3-BA02-9C64154475BF@skife.org> <9b08084c0709110029v3c06c6fbt788d4490892190c9@mail.gmail.com> <004b01c7f70c$0b2a2c90$891ea8c0@SSI.CORP> Message-ID: <8209f740709142317y54f6c1e8lf64ea26f29648c06@mail.gmail.com> 2007/9/14, David Mercer : > On Tuesday, September 11, 2007, Joe Armstrong wrote: > > Do protocol designers turn off their brains when they design protocols? > > > > I see a lot of the following: > > > > - text protocols with are "easy" to understand and parse > > (false - most text protocols are inadequately specified) > > One advantage of text protocols is that you can telnet to a port and do a > transaction manually. I'm thinking SMTP and HTTP here as examples. I have > on occasion had to send email without a mail client handy, so I just telnet > to port 25 of my mail server and type in the SMTP commands. Similarly, I > have had occasion to need a web page without a browser handy: I just > telnetted to port 80 and typed in my request. Having done development with UBF, I'd like to suggest that it combines much of the best of binary protocols with the transparency of text protocols. UBF is much more readable than most XML-based protocols, and still compact enough that it uses fewer bytes to encode Erlang terms than the standard Erlang external term format. http://www.sics.se/~joe/ubf/ After a while, reading and writing UBF structures manually was quite easy. UBF is a text-based protocol designed by people with their brains egaged. (: (According to the paper, it was Joe, with the help of Seif Haridi, Per Brand, Thomas Arts and Luke Gorrie - a competent team by any standards). BR, Ulf W From hubaghdadi@REDACTED Sat Sep 15 15:44:12 2007 From: hubaghdadi@REDACTED (Lone Wolf) Date: Sat, 15 Sep 2007 06:44:12 -0700 (PDT) Subject: [erlang-questions] Comma, semicolon. Aaaaa Message-ID: <411602.39371.qm@web51111.mail.re2.yahoo.com> Hi. Well guys, I'm struggling with Erlang syntax. Does Erlang has line terminators like C++ or Java? Consider this sinppet: ---------- convert_list_to_c([{Name, {f, F}} | Rest]) -> Converted_City = {Name, {c, (F -32)* 5 / 9}}, [Converted_City | convert_list_to_c(Rest)]; ---------- Why there is a comma after {Name, {c, (F -32)* 5 / 9}} ? Another snippet and the same question: ---------- format_temps(List_of_cities) -> Converted_List = convert_list_to_c(List_of_cities), print_temp(Converted_List). ---------- Another one: ---------- foreach(Fun, [First|Rest]) -> Fun(First), foreach(Fun, Rest); ---------- How to define blocks? using { } for example ? or by using indentation (aka Python) ? All these snippets are from Erlang docs. Thanks. Deep into that darkness peering, long I stood there, wondering, fearing, Doubting, dreaming dreams no mortal ever dreamed before. E.A Poe --------------------------------- Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel and lay it on us. -------------- next part -------------- An HTML attachment was scrubbed... URL: From brianm@REDACTED Sat Sep 15 17:39:42 2007 From: brianm@REDACTED (Brian McCallister) Date: Sat, 15 Sep 2007 08:39:42 -0700 Subject: [erlang-questions] Newbie training project proposal In-Reply-To: <8209f740709142317y54f6c1e8lf64ea26f29648c06@mail.gmail.com> References: <44FCCF2C-4478-4BA3-BA02-9C64154475BF@skife.org> <9b08084c0709110029v3c06c6fbt788d4490892190c9@mail.gmail.com> <004b01c7f70c$0b2a2c90$891ea8c0@SSI.CORP> <8209f740709142317y54f6c1e8lf64ea26f29648c06@mail.gmail.com> Message-ID: <89E45D96-6F63-4B9A-B536-E48FF54CF006@skife.org> On Sep 14, 2007, at 11:17 PM, Ulf Wiger wrote: > Having done development with UBF, I'd like to suggest that it > combines much > of the best of binary protocols with the transparency of text > protocols. > UBF is much more readable than most XML-based protocols, and still > compact enough that it uses fewer bytes to encode Erlang terms than > the > standard Erlang external term format. > > http://www.sics.se/~joe/ubf/ Thank you for pointing it out. Going to need to play some to get a feel for UBF(B) protocol description language. I can make some guesses from http://www.sics.se/~joe/ubf/site/ubfb.html, but that seems to only describe the type declarations. -Brian From masklinn@REDACTED Sat Sep 15 17:13:18 2007 From: masklinn@REDACTED (masklinn@REDACTED) Date: Sat, 15 Sep 2007 17:13:18 +0200 Subject: [erlang-questions] Comma, semicolon. Aaaaa In-Reply-To: <411602.39371.qm@web51111.mail.re2.yahoo.com> References: <411602.39371.qm@web51111.mail.re2.yahoo.com> Message-ID: <46EBF68E.9080504@masklinn.net> Lone Wolf wrote: > Hi. > Well guys, I'm struggling with Erlang syntax. > Does Erlang has line terminators like C++ or Java? Not exactly, it has statements terminators (the comma), clause terminator (used in pattern matching clauses such as functions, case and receive blocks) and it has function definition terminator (the period, used to mark the end of the last clause of a function). Oh, and it also has keyword terminators for some blocks (case and receive). > Consider this sinppet: > ---------- > convert_list_to_c([{Name, {f, F}} | Rest]) -> > Converted_City = {Name, {c, (F -32)* 5 / 9}}, > [Converted_City | convert_list_to_c(Rest)]; > ---------- > Why there is a comma after {Name, {c, (F -32)* 5 / 9}} ? > Another snippet and the same question: > ---------- > format_temps(List_of_cities) -> > Converted_List = convert_list_to_c(List_of_cities), > print_temp(Converted_List). > ---------- > Another one: > ---------- > foreach(Fun, [First|Rest]) -> > Fun(First), > foreach(Fun, Rest); > ---------- > How to define blocks? using { } for example ? or by using indentation (aka Python) ? > All these snippets are from Erlang docs. > Thanks. > a combination of punctuation (the semicolon) and keywords. In the first snippet, {Name, {c, (F -32)* 5 / 9}} is not a block (it's a tuple), the colon indicates the end of the statement `Converted_City = {Name, {c, (F -32)* 5 / 9}},`. The semicolon on the next line indicates the end of the current function clause (so there should be another function clause for the same function name but a different pattern under it). In the second snippet, the period at the end of `print_temp(Converted_List)` indicates the end of the whole function definition (so there should be no other clause under it) In the third snippet, the semicolon at the end once again indicates the end of a function matching clause, so there should be (at least) another one under it. From chsu79@REDACTED Sat Sep 15 18:32:08 2007 From: chsu79@REDACTED (Christian S) Date: Sat, 15 Sep 2007 18:32:08 +0200 Subject: [erlang-questions] Comma, semicolon. Aaaaa In-Reply-To: <46EBF68E.9080504@masklinn.net> References: <411602.39371.qm@web51111.mail.re2.yahoo.com> <46EBF68E.9080504@masklinn.net> Message-ID: > Not exactly, it has statements terminators (the comma), clause > terminator (used in pattern matching clauses such as functions, case and > receive blocks) and it has function definition terminator (the period, > used to mark the end of the last clause of a function). Oh, and it also > has keyword terminators for some blocks (case and receive). Think of commas and semicolons as delimiters instead of terminators. This is why the last expression doesnt have a comma and why the last clause doesnt have a semicolon. The dot is a terminator though. From bob@REDACTED Sun Sep 16 03:12:19 2007 From: bob@REDACTED (Bob Ippolito) Date: Sun, 16 Sep 2007 10:12:19 +0900 Subject: [erlang-questions] Bit-level binaries broken in R11B-5? Message-ID: <6a36e7290709151812x6b9f95efof54f87152e273971@mail.gmail.com> I was playing around with bit-level binaries in R11B-5 to see if we could use them to make some of our code shorter and faster, however it seems that some of the operations that we'd want to do give very unexpected results. Here's a short test module that uses two different methods of concatenating N bit long binaries and ends up with mostly the incorrect results. -module(bits). -compile([bitlevel_binaries, binary_comprehension]). -export([test/0]). test() -> lists:map(fun test/1, lists:seq(0, 8)). test(Bits) -> A = <<1:Bits>>, B = <<1:Bits>>, Expect = <<(1 bsl Bits bor 1):(2 * Bits)>>, R1 = <>, R2 = <<<> || N <- [A, B]>>, io:format("Bits: ~p~n", [Bits]), io:format(" Expect : ~p~n", [Expect]), io:format(" Concat : ~p~n", [R1]), io:format(" BinComp: ~p~n", [R2]), io:format("~n"), (Expect =:= R1) and (Expect =:= R2). %%% And the output: Erlang (BEAM) emulator version 5.5.5 [source] [smp:2] [async-threads:4] [kernel-poll:true] (on Mac OS X 10.4.10, Core 2 Duo MacBook Pro). Bits: 0 Expect : <<>> Concat : <<>> BinComp: <<>> Bits: 1 Expect : <<3:2>> Concat : <<2:2>> BinComp: <<0:2>> Bits: 2 Expect : <<5:4>> Concat : <<2:4>> BinComp: <<0:4>> Bits: 3 Expect : <<9:6>> Concat : <<10:6>> BinComp: <<9:6>> Bits: 4 Expect : <<17>> Concat : <<>> BinComp: <<"\"">> Bits: 5 Expect : <<8,1:2>> Concat : <<164,0:2>> BinComp: <<41,1:2>> Bits: 6 Expect : <<4,1:4>> Concat : <<164,0:4>> BinComp: <<100,10:4>> Bits: 7 Expect : <<2,1:6>> Concat : <<40,0:6>> BinComp: <<40,20:6>> Bits: 8 Expect : <<1,1>> Concat : <<1,1>> BinComp: <<1,1>> [true,false,false,false,false,false,false,false,true] I get the same results on FreeBSD x86 with or without HiPE. I haven't bothered to test on Linux but I assume it's broken just the same. -bob From Bruce@REDACTED Sun Sep 16 06:25:32 2007 From: Bruce@REDACTED (Bruce Fitzsimons) Date: Sun, 16 Sep 2007 16:25:32 +1200 Subject: [erlang-questions] Erlang on a phone... Message-ID: <46ECB03C.6060504@Fitzsimons.org> Well done (again^2) to tonyg on getting Erlang onto his new phone (the opensource, open platform, neo1973): http://www.lshift.net/blog/2007/09/16/erlang-on-neo1973-cellphone :-) From bjorn@REDACTED Sun Sep 16 07:09:22 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 16 Sep 2007 07:09:22 +0200 Subject: [erlang-questions] Bit-level binaries broken in R11B-5? In-Reply-To: <6a36e7290709151812x6b9f95efof54f87152e273971@mail.gmail.com> References: <6a36e7290709151812x6b9f95efof54f87152e273971@mail.gmail.com> Message-ID: "Bob Ippolito" writes: > I was playing around with bit-level binaries in R11B-5 to see if we > could use them to make some of our code shorter and faster, however it > seems that some of the operations that we'd want to do give very > unexpected results. Here's a short test module that uses two different > methods of concatenating N bit long binaries and ends up with mostly > the incorrect results. Yes, the result is wrong. The correct result (which you will get in R12B) is a 'badarg' exception. To make your program work, you must change the following lines R1 = <>, R2 = <<<> || N <- [A, B]>>, to R1 = <>, R2 = <<<> || N <- [A, B]>>, Note that bit-level binaries and binary comprehensions are EXPERIMENTAL and UNSUPPORTED features in R11B. In the final R12B, there will probably be changes to the bit-level binaries. Source code that use bit-level binaries with the R11B syntax will compile in R12B-0, but not in R12B-1. (The only reason for allowing the experimental syntax in R12B-0 is that we bootstrap the next release using the latest official release.) The performance of most bit syntax code will be better in R12B than in R11B (it should never be slower). If you want to know what the bit-level binary syntax probably will look like in R12B, see http://www.erlang.org/pipermail/eeps/2007-September/000005.html http://www.erlang.org/eeps/eep-0004.html http://www.erlang.org/eeps/eep-0006.html /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From rsaccon@REDACTED Sun Sep 16 10:49:01 2007 From: rsaccon@REDACTED (Roberto Saccon) Date: Sun, 16 Sep 2007 05:49:01 -0300 Subject: [erlang-questions] Erlang HTML parser (in leex / yecc) ? Message-ID: Does any HTML parser exist in Erlang ? (I mean HTML and not XHTML). if yes, great, if not, I am considering writing one. Anybody a better idea than using leex / yecc for that ? regards -- Roberto Saccon http://rsaccon.com From als@REDACTED Sun Sep 16 11:50:21 2007 From: als@REDACTED (Anthony Shipman) Date: Sun, 16 Sep 2007 19:50:21 +1000 Subject: [erlang-questions] gen_server call and reply Message-ID: <200709161950.21721.als@iinet.net.au> The following code works for me in a gen_server. handle_call(ok, From, State) -> gen_server:reply(From, hello), {noreply, State}; The documentation doesn't imply that I can do this. Is this something I can rely on? -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From ahmed.nawras@REDACTED Sun Sep 16 12:39:30 2007 From: ahmed.nawras@REDACTED (Ahmed Ali) Date: Sun, 16 Sep 2007 14:39:30 +0400 Subject: [erlang-questions] Yaws, ErlyWeb and Windows. In-Reply-To: <3A76756EED583B43A4AD704E29CCD079CE4572@mail.smartlogic.com> References: <3A76756EED583B43A4AD704E29CCD079CE4572@mail.smartlogic.com> Message-ID: Hi All, I had the same experience at first until I found the following page for building YAWS under CYGWIN on a windows machine. It works for me. I think the Makefile for windows should be fixed to prevent such headaches. http://bloggablea.wordpress.com/2007/04/21/building-yaws-for-windows/ Best regards Ahmed Al-Issaei On 9/14/07, Bob Cowdery wrote: > > Ghalib > > Thanks for that. I hope you can resolve it. I don't think I know enough at > the moment but I'm learning. > > Bob > > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED]On Behalf Of Ghalib Suleiman > Sent: 14 September 2007 12:16 > To: erlang-questions@REDACTED > Subject: Re: [erlang-questions] Yaws, ErlyWeb and Windows. > > > Hi Bob, Erlyweb does indeed have a bug on Windows where it doesn't > seem to be registering components properly (I ran into this last week > myself), thus making it unusable. There's a slight discussion about > it on the Erlyweb Google Group - I plan to hunt down the bug when I'm > back at work tomorrow, as I don't have access to a Windows machine at > home. > > -Ghalib > > On Sep 13, 2007, at 11:00 AM, Bob Cowdery wrote: > > > Robert > > > > Thanks very much for that. I will have a go when I'm out the woods. > > At the moment the pre-built version is working ok. > > > > However, I wonder, do you use ErlyWeb because I'm having trouble > > with it. I posted a message on the forum yesterday but no replies > > yet. Essentially I can't get it to generate code for a MySQL table > > and it can't seem to find the controller that it generated anyway. > > In fact it dosn't seem think they are controllers and views. > > > > Any help appreciated. > > > > Bob > > > > -----Original Message----- > > From: erlang-questions-bounces@REDACTED > > [mailto:erlang-questions-bounces@REDACTED]On Behalf Of Robert > > Raschke > > Sent: 11 September 2007 10:36 > > To: erlang-questions@REDACTED > > Subject: Re: [erlang-questions] Yaws, ErlyWeb and Windows. > > > > > >> Bob Cowdery wrote: > >>> Hi All > >>> > >>> Can someone give me the picture on Yaws and ErlyWeb under Windows > >>> please > >> > >> I'm sorry about that - to my knowledge there is quite a lot > >> of people running yaws under windows. I don't run windows at > >> all any longer - and I'll just have to leave it up to the > >> yaws/windows community to write e.g. a proper wiki entry on how to do > >> it. I know for sure that it atleast used to work - I made sure it > >> worked once, but it might have gone bad. > > > > Here's how I build yaws on Windows: > > > > My source root is $ROOT. > > Unpack yaws-1.68 into $ROOT/lib/yaws. > > Have a folder called $ROOT/extra with the files yaws_generated.erl and > > yaws.app (although I forget why I need yaws.app): > > > > yaws_generated.erl: > > %% > > %--------------------------------------------------------------------- > > - > > %%% File : yaws_generated.template > > %%% Author : Klacke > > %%% Purpose : > > %%% Created : 10 Jun 2002 by Klacke > > %% > > %--------------------------------------------------------------------- > > - > > > > %% generated code from some environment variables > > %% especially VARDIR is important since it controls > > %% where the --hup and friends > > > > -module(yaws_generated). > > -author('klacke@REDACTED'). > > > > -compile(export_all). > > > > version() -> "1.68". > > > > vardir() -> "C:/yaws/var". > > > > ctldir() -> "C:/yaws/var/run/yaws". > > > > etcdir() -> "C:/yaws/etc". > > > > % (Or whatever you want your defaults to be.) > > > > yaws.app: > > {application, yaws, [ > > {description, "yaws WWW server"}, > > {vsn, "1.68"}, > > {modules, [ > > yaws, > > yaws_app, > > yaws_ticker, > > yaws_config, > > yaws_server, > > yaws_sup, > > yaws_api, > > yaws_log, > > yaws_ls, > > yaws_debug, > > yaws_compile, > > yaws_ctl, > > yaws_cgi, > > yaws_zlib, > > yaws_generated, > > mime_type_c, > > mime_types, > > yaws_session_server, > > yaws_404, > > yaws_revproxy, > > yaws_html, > > yaws_log_file_h, > > yaws_rss, > > yaws_dav, > > yaws_pam, > > json, > > jsonrpc, > > yaws_jsonrpc, > > yaws_xmlrpc, > > haxe, > > yaws_rpc, > > yaws_soap_srv, > > yaws_soap_lib > > ]}, > > {registered, []}, > > {mod, {yaws_app, []}}, > > {env, []}, > > {applications, [ > > kernel, > > stdlib > > ]} > > ]}. > > > > And then I run this batch script: > > > > build_yaws.bat: > > @echo off > > setlocal > > > > copy /Y extra\yaws_generated.erl lib\yaws\src > > cd lib\yaws\src > > > > set ERLC="C:\Program Files\erl5.5.4\bin\erlc" > > set ERL="C:\Program Files\erl5.5.4\bin\erl" > > > > set ERLCOPTS=-W -pa .. -I../include -o ../ebin > > set ERLOPTS=-noshell -pa ../ebin > > > > > > %ERLC% %ERLCOPTS% yaws.erl > > %ERLC% %ERLCOPTS% yaws_app.erl > > %ERLC% %ERLCOPTS% yaws_ticker.erl > > %ERLC% %ERLCOPTS% yaws_config.erl > > %ERLC% %ERLCOPTS% yaws_server.erl > > %ERLC% %ERLCOPTS% yaws_sup.erl > > %ERLC% %ERLCOPTS% yaws_api.erl > > %ERLC% %ERLCOPTS% yaws_log.erl > > %ERLC% %ERLCOPTS% yaws_ls.erl > > %ERLC% %ERLCOPTS% yaws_debug.erl > > %ERLC% %ERLCOPTS% yaws_compile.erl > > %ERLC% %ERLCOPTS% yaws_ctl.erl > > %ERLC% %ERLCOPTS% yaws_cgi.erl > > %ERLC% %ERLCOPTS% yaws_zlib.erl > > %ERLC% %ERLCOPTS% yaws_generated.erl > > %ERLC% %ERLCOPTS% yaws_session_server.erl > > %ERLC% %ERLCOPTS% yaws_404.erl > > %ERLC% %ERLCOPTS% yaws_revproxy.erl > > %ERLC% %ERLCOPTS% yaws_html.erl > > %ERLC% %ERLCOPTS% yaws_log_file_h.erl > > %ERLC% %ERLCOPTS% yaws_rss.erl > > %ERLC% %ERLCOPTS% yaws_dav.erl > > %ERLC% %ERLCOPTS% yaws_pam.erl > > %ERLC% %ERLCOPTS% json.erl > > %ERLC% %ERLCOPTS% jsonrpc.erl > > %ERLC% %ERLCOPTS% yaws_jsonrpc.erl > > %ERLC% %ERLCOPTS% yaws_xmlrpc.erl > > %ERLC% %ERLCOPTS% haxe.erl > > %ERLC% %ERLCOPTS% yaws_rpc.erl > > %ERLC% %ERLCOPTS% yaws_soap_srv.erl > > %ERLC% %ERLCOPTS% yaws_soap_lib.erl > > > > del /F charset.def > > echo. > charset.def > > > > %ERLC% %ERLCOPTS% mime_type_c.erl > > %ERL% %ERLOPTS% -s mime_type_c compile > > %ERLC% %ERLCOPTS% mime_types.erl > > > > pause > > endlocal > > > > > > I have also made a small attempt at writing a yaws.bat file, but I > > haven't used this in a few years: > > > > @echo off > > setlocal > > > > set HOME=C:/yaws > > set yawsdir=C:/yaws/erlang/yaws-1.68 > > > > set erl=C:\Program Files\erl5.5.4\bin\erl.exe > > set werl=C:\Program Files\erl5.5.4\bin\werl.exe > > > > set debug= > > set daemon= > > set interactive= > > set trace= > > set conf= > > set runmod= > > set sname= > > set heart= > > set xpath= > > set mnesia= > > set id=default > > set pdist= > > set erlarg= > > > > :NEXTARG > > set arg=%1 > > shift > > if "%arg%"=="" goto ENDARGS > > > > if "%arg%"=="-i" goto INTERACT > > if "%arg%"=="--interactive" goto INTERACT > > > > if "%arg%"=="-w" goto WINTERACT > > if "%arg%"=="--winteractive" goto WINTERACT > > > > if "%arg%"=="-D" goto DAEMON > > if "%arg%"=="--daemon" goto DAEMON > > > > if "%arg%"=="-d" goto DEBUG > > if "%arg%"=="--debug" goto DEBUG > > > > if "%arg%"=="-t" goto TRACETR > > if "%arg%"=="--tracetraf" goto TRACETR > > > > if "%arg%"=="-T" goto TRACEHT > > if "%arg%"=="--tracehttp" goto TRACEHT > > > > if "%arg%"=="-I" goto ID > > if "%arg%"=="--id" goto ID > > > > if "%arg%"=="-x" goto TRACEOUT > > if "%arg%"=="--traceout" goto TRACEOUT > > > > if "%arg%"=="--trace" goto TRACE > > > > if "%arg%"=="-M" goto MNESIADIR > > if "%arg%"=="--mnesiadir" goto MNESIADIR > > > > if "%arg%"=="-c" goto CONF > > if "%arg%"=="--conf" goto CONF > > > > if "%arg%"=="-pa" goto PA > > if "%arg%"=="--pa" goto PA > > > > if "%arg%"=="-r" goto RUNMOD > > if "%arg%"=="--runmod" goto RUNMOD > > > > if "%arg%"=="-h" goto HUP > > if "%arg%"=="--hup" goto HUP > > > > if "%arg%"=="-s" goto STOP > > if "%arg%"=="--stop" goto STOP > > > > if "%arg%"=="-ls" goto LS > > if "%arg%"=="--ls" goto LS > > > > if "%arg%"=="-S" goto STATUS > > if "%arg%"=="--status" goto STATUS > > > > if "%arg%"=="-load" goto LOAD > > if "%arg%"=="--load" goto LOAD > > > > if "%arg%"=="-j" goto CTLTRACE > > if "%arg%"=="--ctltrace" goto CTLTRACE > > > > if "%arg%"=="-v" goto VERSION > > if "%arg%"=="--version" goto VERSION > > > > if "%arg%"=="-sname" goto SNAME > > if "%arg%"=="--sname" goto SNAME > > > > if "%arg%"=="-name" goto NAME > > if "%arg%"=="--name" goto NAME > > > > if "%arg%"=="-heart" goto HEART > > if "%arg%"=="--heart" goto HEART > > > > if "%arg%"=="-proto_dist" goto PROTO > > if "%arg%"=="--proto_dist" goto PROTO > > > > if "%arg%"=="-erlarg" goto ERLARG > > if "%arg%"=="--erlarg" goto ERLARG > > > > if "%arg%"=="-check" goto CHECK > > if "%arg%"=="--check" goto CHECK > > > > goto HELP > > > > :INTERACT > > set interactive=true > > set debug= -yaws debug > > set daemon= > > goto NEXTARG > > > > :WINTERACT > > set interactive=true > > set debug= -yaws debug > > set daemon= > > set erl=%werl% > > goto NEXTARG > > > > :DAEMON > > set daemon= -detached > > goto NEXTARG > > > > :DEBUG > > set debug= -boot start_sasl -yaws debug > > goto NEXTARG > > > > :TRACETR > > set trace= -yaws trace traffic > > goto NEXTARG > > > > :TRACEHT > > set trace= -yaws trace http > > goto NEXTARG > > > > :ID > > set id=%1 > > shift > > goto NEXTARG > > > > :TRACEOUT > > set traceoutput= -yaws traceoutput > > goto NEXTARG > > > > :TRACE > > set traceoutput= -yaws traceoutput > > set trace= -yaws trace traffic > > goto NEXTARG > > > > :MNESIADIR > > set mnesia= -mnesia dir %1 -run mnesia start > > shift > > goto NEXTARG > > > > :CONF > > set conf= -conf %1 > > shift > > goto NEXTARG > > > > :PA > > set xpath= %xpath% -pa %1 > > shift > > goto NEXTARG > > > > :RUNMOD > > set runmod= -runmod %1 > > shift > > goto NEXTARG > > > > :HUP > > set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl hup > > goto NEXTARG > > > > :STOP > > set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl stop > > goto NEXTARG > > > > :LS > > set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl ls > > goto NEXTARG > > > > :STATUS > > set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl status > > goto NEXTARG > > > > :LOAD > > "%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl load %id% %1 %2 % > > 3 %4 %5 %6 %7 %8 %9 > > goto END > > > > :CTLTRACE > > set ex="%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws_ctl trace %1 > > shift > > goto NEXTARG > > > > :VERSION > > "%erl%" -noshell -pa "%yawsdir%/ebin" -s yaws printversion > > goto END > > > > :SNAME > > set sname= -sname %1 > > shift > > goto NEXTARG > > > > :NAME > > set sname= -name %1 > > shift > > goto NEXTARG > > > > :HEART > > set heart= -heart > > goto NEXTARG > > > > :PROTO > > set pdist= -proto_dist %1 > > shift > > goto NEXTARG > > > > :ERLARG > > set erlarg=%erlarg% %1 > > shift > > goto NEXTARG > > > > :CHECK > > mkdir "%HOME%/.yaws/" > > mkdir "%HOME%/.yaws/%id%" > > "%erl%" -noshell -pa "%yawsdir%/ebin" %xpath% -s yaws_ctl check %id > > % %1 %2 %3 %4 %5 %6 %7 %8 %9 > > goto END > > > > :ENDARGS > > > > if NOT DEFINED ex goto NOEX > > %ex% %id% > > goto END > > :NOEX > > > > if "%id%"=="" goto NOID > > set id=-yaws id %id% > > :NOID > > > > set trace=%trace% %traceoutput% > > > > if "%daemon%%interactive%"=="" goto HELP > > > > set XEC=%daemon% %heart% -pa "%yawsdir%/ebin" %xpath% %sname% %pdist > > % %erlarg% %debug% -s yaws %trace% %conf% %runmod% %mnesia% %id% > > > > set HEART_COMMAND= > > if "%heart%%daemon%"=="" goto NOHEART > > echo set HEART_COMMAND="%erl%" %XEC% > > set HEART_COMMAND="%erl%" %XEC% > > > > :NOHEART > > echo "%erl%" %XEC% > > "%erl%" %XEC% > > goto END > > > > :HELP > > echo "usage: " > > echo "" > > > > echo " yaws -i | --interactive -- interactive (no > > daemon) mode" > > echo " yaws -w | --winteractive -- interactive (werl) " > > echo " yaws --daemon -- daemon mode" > > > > echo "" > > > > echo "" > > echo " Auxilliary flags for the daemon: " > > echo " --id Id -- Set system id" > > echo " --debug -- debug mode " > > echo " --conf File -- set config file" > > echo " --tracetraf -- trace traffic" > > echo " --tracehttp -- trace http traffic" > > echo " --traceout -- trace output to stdout" > > echo " --version -- print version" > > echo " --pa path -- add load path" > > echo " --mnesiadir dir -- start Mnesia in dir" > > echo " --proto_dist Mod -- use Mod for distrib" > > echo " --sname xxx -- start with sname xxx" > > echo " --name xxx -- start with name xxx" > > echo " --runmod mod -- call mod:start/0 at startup" > > echo " --heart -- auto restart yaws if it > > crashes" > > echo " --erlarg X -- pass argument X to $erl" > > > > echo "" > > > > echo "ctl functions ... " > > echo " yaws --hup [--id ID] -- hup the daemon, reload > > conf" > > echo " yaws --stop [--id ID] -- stop the daemon" > > echo " yaws --status [--id ID] -- query the daemon status" > > echo " yaws --load Modules -- load modules" > > echo " yaws --ls -- list Yaws nodes and > > their status" > > echo " yaws --ctltrace traffic|http -- toggle trace of > > running daemon" > > echo " yaws --check YawsFile [IncDirs] -- test compile File" > > > > :END > > endlocal > > > > > > > > Robby > > > > -- > > r fullstop raschke around tombob fullstop com > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean.hinde@REDACTED Sun Sep 16 12:42:45 2007 From: sean.hinde@REDACTED (Sean Hinde) Date: Sun, 16 Sep 2007 11:42:45 +0100 Subject: [erlang-questions] Erlang HTML parser (in leex / yecc) ? In-Reply-To: References: Message-ID: <2ECBE7E4-548F-416C-AB2C-39871DCCDA1C@gmail.com> On 16 Sep 2007, at 09:49, Roberto Saccon wrote: > Does any HTML parser exist in Erlang ? (I mean HTML and not XHTML). Yes, there is one in Yaws (yaws_html.erl). Sean From ahmed.nawras@REDACTED Sun Sep 16 12:55:39 2007 From: ahmed.nawras@REDACTED (Ahmed Ali) Date: Sun, 16 Sep 2007 14:55:39 +0400 Subject: [erlang-questions] Comma, semicolon. Aaaaa In-Reply-To: <411602.39371.qm@web51111.mail.re2.yahoo.com> References: <411602.39371.qm@web51111.mail.re2.yahoo.com> Message-ID: Hi Lone, I'll try to give you my view on the syntax. The comma (,) is like (;) in languages like Java/C. Each method is ended with a Dot (.). If you have more than one method with the same number parameters (called arity in Erlang), you need to separate them with (;). There is no similar construct in Java/C for this. Similarly, you can think of if/case statements, which use (;) to separate different if/case conditions, (,) to separate clauses for each condition, and (.) to indicate the end of if/case statement. I hope this helps. Best regards, Ahmed Al-Issaei On 9/15/07, Lone Wolf wrote: > > Hi. > Well guys, I'm struggling with Erlang syntax. > Does Erlang has line terminators like C++ or Java? > Consider this sinppet: > ---------- > convert_list_to_c([{Name, {f, F}} | Rest]) -> > Converted_City = {Name, {c, (F -32)* 5 / 9}}, > [Converted_City | convert_list_to_c(Rest)]; > ---------- > Why there is a comma after {Name, {c, (F -32)* 5 / 9}} ? > Another snippet and the same question: > ---------- > format_temps(List_of_cities) -> > Converted_List = convert_list_to_c(List_of_cities), > print_temp(Converted_List). > ---------- > Another one: > ---------- > foreach(Fun, [First|Rest]) -> > Fun(First), > foreach(Fun, Rest); > ---------- > How to define blocks? using { } for example ? or by using indentation (aka > Python) ? > All these snippets are from Erlang docs. > Thanks. > > > *Deep into that darkness peering, long I stood there, wondering, fearing, > Doubting, dreaming dreams no mortal ever dreamed before.* > *E.A Poe* > ** > ** > > ------------------------------ > Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user > paneland lay it on us. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rsaccon@REDACTED Sun Sep 16 12:56:16 2007 From: rsaccon@REDACTED (Roberto Saccon) Date: Sun, 16 Sep 2007 07:56:16 -0300 Subject: [erlang-questions] Erlang HTML parser (in leex / yecc) ? In-Reply-To: <2ECBE7E4-548F-416C-AB2C-39871DCCDA1C@gmail.com> References: <2ECBE7E4-548F-416C-AB2C-39871DCCDA1C@gmail.com> Message-ID: found it, thanks a lot. On 9/16/07, Sean Hinde wrote: > > On 16 Sep 2007, at 09:49, Roberto Saccon wrote: > > > Does any HTML parser exist in Erlang ? (I mean HTML and not XHTML). > > Yes, there is one in Yaws (yaws_html.erl). > > Sean > -- Roberto Saccon http://rsaccon.com From chsu79@REDACTED Sun Sep 16 14:17:03 2007 From: chsu79@REDACTED (Christian S) Date: Sun, 16 Sep 2007 14:17:03 +0200 Subject: [erlang-questions] gen_server call and reply In-Reply-To: <200709161950.21721.als@iinet.net.au> References: <200709161950.21721.als@iinet.net.au> Message-ID: > The documentation doesn't imply that I can do this. Is this something I can > rely on? This is what the documentation says: > If the functions returns {noreply,NewState} or {noreply,NewState,Timeout}, the gen_server > will continue executing with NewState. Any reply to From must be given explicitly using > gen_server:reply/2. See http://erlang.org/doc/man/gen_server.html#Module:handle_call/3 Or did you mean something else with your snippet? From rrerlang@REDACTED Sun Sep 16 14:40:48 2007 From: rrerlang@REDACTED (Robert Raschke) Date: Sun, 16 Sep 2007 13:40:48 +0100 Subject: [erlang-questions] Comma, semicolon. Aaaaa In-Reply-To: Message-ID: <8bbdc82088ce0b2f199b0ca86aa45ef3@tombob.com> I think because of Erlang's roots in langauages like Prolog, I've found it easiest to think of the comma as "and" and the semicolon as "or". That fits in quite nicely with the comma being the sequencing operator, wheras the semicolon acts as the searator between function, if, and receive clauses, etc. It also explains the guard syntax. The fullstop being the proper terminator at the end of an "Erlang sentence". Robby From als@REDACTED Sun Sep 16 15:29:34 2007 From: als@REDACTED (Anthony Shipman) Date: Sun, 16 Sep 2007 23:29:34 +1000 Subject: [erlang-questions] gen_server call and reply In-Reply-To: References: <200709161950.21721.als@iinet.net.au> Message-ID: <200709162329.34118.als@iinet.net.au> On Sunday 16 September 2007 22:17, Christian S wrote: > > The documentation doesn't imply that I can do this. Is this something I > > can rely on? > > This is what the documentation says: > > If the functions returns {noreply,NewState} or > > {noreply,NewState,Timeout}, the gen_server will continue executing with > > NewState. Any reply to From must be given explicitly using > > gen_server:reply/2. > > See http://erlang.org/doc/man/gen_server.html#Module:handle_call/3 > > Or did you mean something else with your snippet? The documentation says to me that you return noreply and then later you can use gen_server:reply to complete the call. I want to do it in the opposite order. According to the source code that will work but I'd like to know if the OTP people sanction it otherwise it might stop working in future. -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From ulf@REDACTED Sun Sep 16 16:34:30 2007 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 16 Sep 2007 16:34:30 +0200 Subject: [erlang-questions] gen_server call and reply In-Reply-To: <200709162329.34118.als@iinet.net.au> References: <200709161950.21721.als@iinet.net.au> <200709162329.34118.als@iinet.net.au> Message-ID: <8209f740709160734n50284016l6d4728024ad52e1b@mail.gmail.com> Ah, well, you _can_ do it. Don't pay too much attention to the word "after". It's no problem whatsoever calling reply() first, and then returning {noreply, S}. BR, Ulf W 2007/9/16, Anthony Shipman : > On Sunday 16 September 2007 22:17, Christian S wrote: > > > The documentation doesn't imply that I can do this. Is this something I > > > can rely on? > > > > This is what the documentation says: > > > If the functions returns {noreply,NewState} or > > > {noreply,NewState,Timeout}, the gen_server will continue executing with > > > NewState. Any reply to From must be given explicitly using > > > gen_server:reply/2. > > > > See http://erlang.org/doc/man/gen_server.html#Module:handle_call/3 > > > > Or did you mean something else with your snippet? > > The documentation says to me that you return noreply and then later you can > use gen_server:reply to complete the call. I want to do it in the opposite > order. According to the source code that will work but I'd like to know if > the OTP people sanction it otherwise it might stop working in future. > > -- > Anthony Shipman Mamas don't let your babies > als@REDACTED grow up to be outsourced. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From als@REDACTED Sun Sep 16 16:59:31 2007 From: als@REDACTED (Anthony Shipman) Date: Mon, 17 Sep 2007 00:59:31 +1000 Subject: [erlang-questions] gen_server call and reply In-Reply-To: <290b3ba10709160659vc4b568fi26b2830e6fd34be4@mail.gmail.com> References: <200709161950.21721.als@iinet.net.au> <200709162329.34118.als@iinet.net.au> <290b3ba10709160659vc4b568fi26b2830e6fd34be4@mail.gmail.com> Message-ID: <200709170059.31807.als@iinet.net.au> On Sunday 16 September 2007 23:59, you wrote: > why not just use {reply, Result, State} or gen_server:cast instead of > gen_server:call ? > > t The server must handle multiple concurrent requests. Requests that can't be responded to immediately must be queued. They will be replied to later. Meanwhile other requests must be handled. The code is a lot simpler if I have one way of replying to a request, gen_server:reply, no matter whether it is an immediate reply or a delayed reply. -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From matthias@REDACTED Sun Sep 16 17:29:59 2007 From: matthias@REDACTED (Matthias Lang) Date: Sun, 16 Sep 2007 17:29:59 +0200 Subject: [erlang-questions] gen_server call and reply In-Reply-To: <8209f740709160734n50284016l6d4728024ad52e1b@mail.gmail.com> References: <200709161950.21721.als@iinet.net.au> <200709162329.34118.als@iinet.net.au> <8209f740709160734n50284016l6d4728024ad52e1b@mail.gmail.com> Message-ID: <18157.19447.927951.598749@antilipe.corelatus.se> Ulf "Gung Ho" Wiger writes: > Ah, well, you _can_ do it. Don't pay too much attention to the > word "after". It's no problem whatsoever calling reply() first, > and then returning {noreply, S}. I can see that it's no problem in the gen_server implementation. But I can't see anything in the documentation which prohibits a future gen_server from breaking the reply-before-return. So the paranoid and prudent might prefer to avoid calling reply() first, unless you know that a large Ericsson project contains code like that, in which case you can relax. ;-) Matthias From dot@REDACTED Sun Sep 16 19:27:51 2007 From: dot@REDACTED (Tony Finch) Date: Sun, 16 Sep 2007 18:27:51 +0100 Subject: [erlang-questions] Bit-level binaries broken in R11B-5? In-Reply-To: References: <6a36e7290709151812x6b9f95efof54f87152e273971@mail.gmail.com> Message-ID: On Sun, 16 Sep 2007, Bjorn Gustavsson wrote: > > In the final R12B, there will probably be changes to the > bit-level binaries. Are you fixing support for little-endian data? Tony. -- f.a.n.finch http://dotat.at/ IRISH SEA: SOUTHERLY, BACKING NORTHEASTERLY FOR A TIME, 3 OR 4. SLIGHT OR MODERATE. SHOWERS. MODERATE OR GOOD, OCCASIONALLY POOR. From ulf@REDACTED Sun Sep 16 21:19:53 2007 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 16 Sep 2007 21:19:53 +0200 Subject: [erlang-questions] gen_server call and reply In-Reply-To: <18157.19447.927951.598749@antilipe.corelatus.se> References: <200709161950.21721.als@iinet.net.au> <200709162329.34118.als@iinet.net.au> <8209f740709160734n50284016l6d4728024ad52e1b@mail.gmail.com> <18157.19447.927951.598749@antilipe.corelatus.se> Message-ID: <8209f740709161219r7988823dr3c0cb668230f0c10@mail.gmail.com> Well, I see nothing in the docs stating that gen_server:reply/2 is expected to be called after having returned {noreply, S}. There is no rule stating that the server must reply to requests at all, so the gen_server module is wise not to buffer any information about requests that have triggered a {noreply, _} response. Since it cannot buffer info, it cannot really use anything in the reply that the callback doesn't already know, i.e. the Client info passed to the handle_call/3 function. But to be on the safe side, we could always ask the documentation team at OTP to state clearly that it is perfectly fine to call gen_server:reply/2 before returning {noreply, S}. /Gung 2007/9/16, Matthias Lang : > > Ulf "Gung Ho" Wiger writes: > > Ah, well, you _can_ do it. Don't pay too much attention to the > > word "after". It's no problem whatsoever calling reply() first, > > and then returning {noreply, S}. > > I can see that it's no problem in the gen_server implementation. > > But I can't see anything in the documentation which prohibits a future > gen_server from breaking the reply-before-return. > > So the paranoid and prudent might prefer to avoid calling reply() > first, unless you know that a large Ericsson project contains code > like that, in which case you can relax. ;-) > > Matthias > From bazil@REDACTED Mon Sep 17 00:40:03 2007 From: bazil@REDACTED (Dmitriy Gorbenko) Date: Sun, 16 Sep 2007 22:40:03 +0000 Subject: [erlang-questions] Setting Yaws process name Message-ID: <46EDB0C3.1080105@agenstvo.com> Hi all. I want to send message from one node to another node, which started by client's browser request on Yaws server. Someone type in their browser: http://some.domain.com/test.yaws and the page goes into receive loop, and waits for the messages, which should be send from another node. And the problem that I can't send any message to that process. Then we send a message to some node, we specify node name and process name in that node. But that name have Yaws process ? Or how I can set name to process, which Yaws executes. Thanks. -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 2244 bytes Desc: S/MIME Cryptographic Signature URL: From chsu79@REDACTED Sun Sep 16 21:38:56 2007 From: chsu79@REDACTED (Christian S) Date: Sun, 16 Sep 2007 21:38:56 +0200 Subject: [erlang-questions] gen_server call and reply In-Reply-To: <8209f740709161219r7988823dr3c0cb668230f0c10@mail.gmail.com> References: <200709161950.21721.als@iinet.net.au> <200709162329.34118.als@iinet.net.au> <8209f740709160734n50284016l6d4728024ad52e1b@mail.gmail.com> <18157.19447.927951.598749@antilipe.corelatus.se> <8209f740709161219r7988823dr3c0cb668230f0c10@mail.gmail.com> Message-ID: 2007/9/16, Ulf Wiger : > Well, I see nothing in the docs stating that gen_server:reply/2 > is expected to be called after having returned {noreply, S}. One case that struck my mind is when one spaws a process to do something and return the value with gen_server:reply/2. That requires gen_server:reply/2 to need to be executed before the gen_server:handle_call/3 returns noreply. From francis.norton@REDACTED Sun Sep 16 23:40:18 2007 From: francis.norton@REDACTED (Francis Norton) Date: Sun, 16 Sep 2007 22:40:18 +0100 Subject: [erlang-questions] Newbie training project proposal Message-ID: <24162acd0709161440y38a25dfcg912dee2249cf5c50@mail.gmail.com> > Thank you for pointing it out. Going to need to play some to get a > feel for UBF(B) protocol description language. I can make some > guesses from http://www.sics.se/~joe/ubf/site/ubfb.html, but that > seems to only describe the type declarations. At the risk of going off-topic, is there a JavaScript client for UBF, and in any case can anyone make any recommendations on the simplest and most scaleable approach to supporting an AJAX-like client? Francis. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob@REDACTED Mon Sep 17 00:46:02 2007 From: bob@REDACTED (Bob Ippolito) Date: Mon, 17 Sep 2007 07:46:02 +0900 Subject: [erlang-questions] Newbie training project proposal In-Reply-To: <24162acd0709161440y38a25dfcg912dee2249cf5c50@mail.gmail.com> References: <24162acd0709161440y38a25dfcg912dee2249cf5c50@mail.gmail.com> Message-ID: <6a36e7290709161546g222509c0we0e7bce87944cf3b@mail.gmail.com> On 9/17/07, Francis Norton wrote: > > > > Thank you for pointing it out. Going to need to play some to get a > > feel for UBF(B) protocol description language. I can make some > > guesses from http://www.sics.se/~joe/ubf/site/ubfb.html, > but that > > seems to only describe the type declarations. > > At the risk of going off-topic, is there a JavaScript client for UBF, and in > any case can anyone make any recommendations on the simplest and most > scaleable approach to supporting an AJAX-like client? > Francis. Define a mapping from UBF(B) to JSON and use that instead? -bob From ok@REDACTED Mon Sep 17 02:20:42 2007 From: ok@REDACTED (ok) Date: Mon, 17 Sep 2007 12:20:42 +1200 Subject: [erlang-questions] Comma, semicolon. Aaaaa In-Reply-To: <46EBF68E.9080504@masklinn.net> References: <411602.39371.qm@web51111.mail.re2.yahoo.com> <46EBF68E.9080504@masklinn.net> Message-ID: <0AD14170-D1E3-47BE-B908-D9566B09EB70@cs.otago.ac.nz> I'm seeing some dismayingly messy and confusing answers to a very simple question. The simple answer is that the comma operator in Erlang is an infix sequencing operator, EXACTLY the same as the comma operator in C or C++. E1, E2, E3 has the effects of E1 then E2 then E3 in that order and the value of E3. The nearest equivalent of {} in Erlang is (). Since Erlang has no loop statements (using tail recursion or calls to higher order functions for this purpose), Erlang function bodies are just expressions glued together with 'choice' (if, case, receive) and 'sequence' (comma). All 'choice' constructs use -> ... end and what goes between those symbols is an expression where you can use the sequencing operator without requiring any parentheses. C: x > y ? e1, e2 : (e3, e4) Erlang: if x > y -> e1, e2 ; true -> e3, e4 end >> ---------- >> convert_list_to_c([{Name, {f, F}} | Rest]) -> >> Converted_City = {Name, {c, (F -32)* 5 / 9}}, >> [Converted_City | convert_list_to_c(Rest)]; The semicolon here is an infix 'or' operator reflecting a choice between function clauses; ';' is always infix and always means 'or'. The thing that may be confusing for a beginner here is that Converted_City = {Name, {c, (F-32)*5/9}} is neither a declaration nor a statement but an expression that has the side effect of binding Converted_City to its value. I would have written that as convert_list_to_c([{Name,{f,F}}|Cities]) -> [{Name,{c,(F-32)*5/9} | convert_list_to_c(Rest)}; except that I hope I would never use a name like 'convert_list_to_c' >> format_temps(List_of_cities) -> >> Converted_List = convert_list_to_c(List_of_cities), >> print_temp(Converted_List). Again, format_temperatures(Cities) -> print_temperatures(convert_city_temperatures(Cities)). would be better. From eokyere@REDACTED Mon Sep 17 04:00:33 2007 From: eokyere@REDACTED (Emmanuel Okyere) Date: Sun, 16 Sep 2007 22:00:33 -0400 Subject: [erlang-questions] Comma, semicolon. Aaaaa (Emmanuel Okyere) In-Reply-To: References: Message-ID: <40A5F58F-765A-4352-ABE1-70CC7D5D2757@gmail.com> On 16 Sep 2007, at 15:19, Ahmed Ali wrote: > I'll try to give you my view on the syntax. The comma (,) is like > (;) in > languages like Java/C. Each method is ended with a Dot (.). If you > have more > than one method with the same number parameters (called arity in > Erlang), > you need to separate them with (;). There is no similar construct in > Java/C for this. correct. > Similarly, you can think of if/case statements, which use (;) to > separate > different if/case conditions, (,) to separate clauses for each > condition, > and (.) to indicate the end of if/case statement. not quite. if the end of the if/case clause is not the end of the entire function it will not end with a period. a period-whitespace denotes the end of an entire function. Cheers, Emmanuel --- Anyone can do any amount of work, provided it isn't the work he is supposed to be doing at that moment. ? Robert Benchley -------------- next part -------------- An HTML attachment was scrubbed... URL: From casper2000a@REDACTED Mon Sep 17 06:12:39 2007 From: casper2000a@REDACTED (Eranga Udesh) Date: Mon, 17 Sep 2007 09:42:39 +0530 Subject: [erlang-questions] Binary/Bit reversing In-Reply-To: <6a36e7290709151812x6b9f95efof54f87152e273971@mail.gmail.com> References: <6a36e7290709151812x6b9f95efof54f87152e273971@mail.gmail.com> Message-ID: <000501c7f8e0$fd26ce10$f7746a30$@com> Hi, Is there a possibility to add a function to reverse binary or bitstring? As it is now, doing this for a binary requires conversion to list, reverse and convert back to binary. Thanks, - Eranga From raimo+erlang-questions@REDACTED Mon Sep 17 09:40:22 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Mon, 17 Sep 2007 09:40:22 +0200 Subject: [erlang-questions] : Sending funs between nodes In-Reply-To: <337538cb0709141221q6d5fa744m96f622c7069030b0@mail.gmail.com> References: <337538cb0708291228u415559a1jd02bbbcecb9b3ccb@mail.gmail.com> <46D666B1.4090503@ericsson.com> <46E99033.3060101@web.am> <337538cb0709141221q6d5fa744m96f622c7069030b0@mail.gmail.com> Message-ID: <20070917074022.GA5552@erix.ericsson.se> Since the shell emulates expressions it does not compile funs - it emulates them too. And that is done by having a bunch of compiled shell funs; arity 0..20 something. These shell funs take the real fun code to emulate in their environment. So they look like funs, but are fun instances that emulate the fun you defined in the shell. That also means that they are compiled on all other nodes if just the same version of the shell module is loaded on the other nodes. On Fri, Sep 14, 2007 at 11:21:50PM +0400, Kirill Zaborski wrote: > On 9/13/07, Gaspar Chilingarov wrote: > > > > there are 2 ways -- if you define fun inside module (like in your > > example) fun is defined inside module at compile time and is passed > > around as reference to some funcion in that module. > > > > But why are those ways different from each other? What's so special in > constructing funs from shell and why can't I do the same from compiled > module? > > Best regards, > Kirill. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From matthias@REDACTED Mon Sep 17 10:05:54 2007 From: matthias@REDACTED (Matthias Lang) Date: Mon, 17 Sep 2007 10:05:54 +0200 Subject: [erlang-questions] gen_server call and reply In-Reply-To: References: <200709161950.21721.als@iinet.net.au> <200709162329.34118.als@iinet.net.au> <8209f740709160734n50284016l6d4728024ad52e1b@mail.gmail.com> <18157.19447.927951.598749@antilipe.corelatus.se> <8209f740709161219r7988823dr3c0cb668230f0c10@mail.gmail.com> Message-ID: <18158.13666.31269.913822@antilipe.corelatus.se> Christian S writes: > One case that struck my mind is when one spaws a process to do > something and return the > value with gen_server:reply/2. That requires gen_server:reply/2 to > need to be executed before the gen_server:handle_call/3 returns > noreply. That's a good point. That pretty much kills my doubts. Matthias From matthias@REDACTED Mon Sep 17 10:47:43 2007 From: matthias@REDACTED (Matthias Lang) Date: Mon, 17 Sep 2007 10:47:43 +0200 Subject: [erlang-questions] gen_server call and reply In-Reply-To: <8209f740709161219r7988823dr3c0cb668230f0c10@mail.gmail.com> References: <200709161950.21721.als@iinet.net.au> <200709162329.34118.als@iinet.net.au> <8209f740709160734n50284016l6d4728024ad52e1b@mail.gmail.com> <18157.19447.927951.598749@antilipe.corelatus.se> <8209f740709161219r7988823dr3c0cb668230f0c10@mail.gmail.com> Message-ID: <18158.16175.52187.273452@antilipe.corelatus.se> Ulf "GH" Wiger writes: > There is no rule stating that the server must reply to requests > at all, so the gen_server module is wise not to buffer any information > about requests that have triggered a {noreply, _} response. FWIW, I just took a look through our codebase to see how often we used the 'noreply' variant. It never occurs. Why not? Why use 'noreply'? I can only really think of one reason---you have a relatively long-running request but don't want to block the gen_server while it runs. Maybe there's also some case where you can avoid a deadlock, but I haven't thought about that. In the case of the long-running request, what I do instead is {reply, {pending, Ref}, State} where Ref is a reference which is then included in a later message sent the old-fashioned way. This amounts to more or less the same as 'noreply', though it's one message more expensive and has the benefit of making it easier to reason about timeouts, at least to my mind. Matthias From kenneth.lundin@REDACTED Mon Sep 17 12:33:17 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Mon, 17 Sep 2007 12:33:17 +0200 Subject: [erlang-questions] Representation of a map in bytecode? In-Reply-To: <837db430709142102h77a4799foe5820f3dc3ca7aab@mail.gmail.com> References: <837db430709142102h77a4799foe5820f3dc3ca7aab@mail.gmail.com> Message-ID: Hi, On 9/15/07, Hugh Perkins wrote: > How is a map represented in bytecode? To what extent is it clearly > identifiable as a map, directly from the bytecode? There is nothing special that distinguishes a map in the byte code. A map is typically implemented with a call to lists:map(Fun,List) or with a list comprehension like this [mapping(X)|| X <- List]. Although it would be possible to find the pattern for a map in the byte code I think it is a bad idea trying to parallellize this by some automatic magic. One of the strengths with Erlang is that it is very easy and natural to parallellize things explicitly by the use of Erlang processes. If a system already is parallellized into e.g. one Erlang process per connection in a web-server, one Erlang process per ongoing call in a telecom system etc. there is very little reason trying to parallellize each map if there are thousands of call or connection processes executing simultaneously and that each of those potentially will perform a map operation as part of their work. What I probably try to say is that there are different approaches to parallellism. 1) Trying to optimize a specific algorithm by use of parallell computation. Assuming that this is the only ongoing thing on this computer. This can be a heavy map operation for example, but even then it must be considered if the actuall mapping work for each element is big enough to motivate a split into many parallell tasks. 2) A SW system that is explicitly designed to be parallell from the beginning (like the one process per connection or one process per call above). If the system design already allows thousands of parallell tasks it is far from obvious that also the internal execution of each such task should benefit from automatic parallellisation. I actually believe that a system can be over parallellized and that this will degrade the performance. I don't think automatic parallellization of a map operation is interesting when it is so easy to write and encapsulate that parallell map into a function and call that function when parallellization is wanted. This function can of course be included in one of the standard libraries if the problem is common enough. /Kenneth (Erlang/OTP team at Ericsson) > > Kindof contemplating to what extent it could be interesting/useful/fun > to make a fork of Erlang that automatically parallelizes maps across > available processor cores. > > This should probably be done dynamically, at runtime. I guess two options are: > > - write a wrapper function around map that communicates with some kind > of scheduler process (presumably not the build-in scheduler, at > least initially), to split the map across multiple cores if there are > some available > > - extend the vm (and perhaps the byte-code) so that the vm can detect > maps and automatically split them across multiple available processor > cores where appropriate > > Just kindof contemplating out of curiosity. No idea how feasible it > is, or how useful, but interests me, especially with Tilera-64s and so > on on the horizon. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From Jouni.Ryno@REDACTED Mon Sep 17 13:32:03 2007 From: Jouni.Ryno@REDACTED (Jouni =?ISO-8859-1?Q?Ryn=F6?=) Date: Mon, 17 Sep 2007 14:32:03 +0300 Subject: [erlang-questions] Representation of a map in bytecode? In-Reply-To: References: <837db430709142102h77a4799foe5820f3dc3ca7aab@mail.gmail.com> Message-ID: <1190028723.5212.11.camel@adic.fmi.fi> On Mon, 2007-09-17 at 12:33 +0200, Kenneth Lundin wrote: > If the system design already allows thousands of parallell tasks it is > far from obvious that also the internal execution of each such task > should benefit from > automatic parallellisation. I actually believe that a system can be > over parallellized and that this will degrade the performance. > There used to be a beautiful processor architecture called Transputer and the language called Occam to program it. Making things going parallel was even more easier and natural than in Erlang. And there were many papers published, that going from extreme parallel systems to more serialised one was the way optimise the performance. Extreme parallel meaning systems, where you have decades more processes than real executing hardware. It all depends on the process switching time and communication overhead. regards Jouni -- Jouni Ryn? mailto://Jouni.Ryno@REDACTED/ http://space.fmi.fi/~ryno/ Finnish Meteorological Institute http://www.fmi.fi/ Space Research http://space.fmi.fi/ P.O.BOX 503 Tel (+358)-9-19294656 FIN-00101 Helsinki FAX (+358)-9-19294603 Finland priv-GSM (+358)-50-5302903 "It's just zeros and ones, it cannot be hard" From klacke@REDACTED Mon Sep 17 14:39:30 2007 From: klacke@REDACTED (Claes Wikstrom) Date: Mon, 17 Sep 2007 14:39:30 +0200 Subject: [erlang-questions] Setting Yaws process name In-Reply-To: <46EDB0C3.1080105@agenstvo.com> References: <46EDB0C3.1080105@agenstvo.com> Message-ID: <46EE7582.7090308@hyber.org> Dmitriy Gorbenko wrote: > And the problem that I can't send any message to that process. Then we > send a message to some node, we specify node name and process name in > that node. But that name have Yaws process ? > > Or how I can set name to process, which Yaws executes. > Well the erlang code executing in the .yaws page can do anything it wants. It can for example register a short lived name. This is a bit dangerous though since the process being used in actually reused by yaws, thus if you register a name it's very important that you also unregister the name when you're done. /klacke From dking@REDACTED Mon Sep 17 18:00:38 2007 From: dking@REDACTED (David King) Date: Mon, 17 Sep 2007 09:00:38 -0700 Subject: [erlang-questions] top(1) in Erlang Message-ID: <1F0B22BF-4486-4F47-85C3-BAF2BDB8D29C@ketralnis.com> I'm trying to write a process monitor akin to Unix's top(1) for Erlang processes. Is there any way to determine how long a given process spent with the CPU over the last X units of time? The scheduler has to know this, does it expose that information? Does something like this already exist that I'm missing? erlang:process_info/1 returns the following for a given process: [{current_function,{hipe_icode_coordinator,coordinate,4}}, {initial_call,{erlang,apply,2}}, {status,waiting}, {message_queue_len,0}, {messages,[]}, {links,[]}, {dictionary,[]}, {trap_exit,false}, {error_handler,error_handler}, {priority,normal}, {group_leader,<0.30.0>}, {heap_size,6765}, {stack_size,6}, {reductions,8193}, {garbage_collection,[{fullsweep_after,65535}]}] Is reductions close to what I want? Will that increment for things other than function calls? Does that matter? From minsloc@REDACTED Mon Sep 17 18:26:40 2007 From: minsloc@REDACTED (Minsloc Tarren) Date: Mon, 17 Sep 2007 18:26:40 +0200 Subject: [erlang-questions] Erlguten & Fonts. Message-ID: <330602700709170926j6550662fka71ad1e0b5eb39@mail.gmail.com> Hi there, does anybody know his way around ErlGuten & Custom fonts ? I need to get national characters with diacritics working, and try as i might, I simply can't. My "progress" so far is documented at erlgutens google code page (happily ignored by the rest of the world ;-)))) So if you think you would know better, or just wanna get a good laugh *1) just surf to http://code.google.com/p/erlguten/issues/list Minsloc *1) I don't really know what I'm trying to do. My only other experience with programmatically generating PDF comes from PHP's fpdf, and it had a cookbook on how to prepare one's custom fonts from .ttf's -------------- next part -------------- An HTML attachment was scrubbed... URL: From minsloc@REDACTED Mon Sep 17 18:35:44 2007 From: minsloc@REDACTED (Minsloc Tarren) Date: Mon, 17 Sep 2007 18:35:44 +0200 Subject: [erlang-questions] top(1) in Erlang In-Reply-To: <1F0B22BF-4486-4F47-85C3-BAF2BDB8D29C@ketralnis.com> References: <1F0B22BF-4486-4F47-85C3-BAF2BDB8D29C@ketralnis.com> Message-ID: <330602700709170935j7b1427bfkcfc98047f772478a@mail.gmail.com> just gut pman (try pman:start() if you hadn't seen it in action). According to http://www.erlang.org/doc/pdf/pman.pdf "Reds - number of reductions performed. Gives a rough estimate of the process' work load." Cheers, Minsloc. On 9/17/07, David King wrote: > > I'm trying to write a process monitor akin to Unix's top(1) for > Erlang processes. Is there any way to determine how long a given > process spent with the CPU over the last X units of time? The > scheduler has to know this, does it expose that information? Does > something like this already exist that I'm missing? > > erlang:process_info/1 returns the following for a given process: > > [{current_function,{hipe_icode_coordinator,coordinate,4}}, > {initial_call,{erlang,apply,2}}, > {status,waiting}, > {message_queue_len,0}, > {messages,[]}, > {links,[]}, > {dictionary,[]}, > {trap_exit,false}, > {error_handler,error_handler}, > {priority,normal}, > {group_leader,<0.30.0>}, > {heap_size,6765}, > {stack_size,6}, > {reductions,8193}, > {garbage_collection,[{fullsweep_after,65535}]}] > > Is reductions close to what I want? Will that increment for things > other than function calls? Does that matter? > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From taavi@REDACTED Mon Sep 17 19:01:11 2007 From: taavi@REDACTED (Taavi Talvik) Date: Mon, 17 Sep 2007 20:01:11 +0300 Subject: [erlang-questions] top(1) in Erlang In-Reply-To: <1F0B22BF-4486-4F47-85C3-BAF2BDB8D29C@ketralnis.com> References: <1F0B22BF-4486-4F47-85C3-BAF2BDB8D29C@ketralnis.com> Message-ID: <7D8FAD8A-302C-4D87-94BE-A5CB2FD02E9B@uninet.ee> On Sep 17, 2007, at 7:00 PM, David King wrote: > I'm trying to write a process monitor akin to Unix's top(1) for > Erlang processes. Is there any way to determine how long a given > process spent with the CPU over the last X units of time? The > scheduler has to know this, does it expose that information? Does > something like this already exist that I'm missing? > > erlang:process_info/1 returns the following for a given process: > > [{current_function,{hipe_icode_coordinator,coordinate,4}}, > {initial_call,{erlang,apply,2}}, > {status,waiting}, > {message_queue_len,0}, > {messages,[]}, > {links,[]}, > {dictionary,[]}, > {trap_exit,false}, > {error_handler,error_handler}, > {priority,normal}, > {group_leader,<0.30.0>}, > {heap_size,6765}, > {stack_size,6}, > {reductions,8193}, > {garbage_collection,[{fullsweep_after,65535}]}] > > Is reductions close to what I want? Will that increment for things > other than function calls? Does that matter? Yes, reductions is what you want. Btw, you can look at http://www.erlang.org/doc/apps/observer/ part_frame.html and "Erlang Top" from there;) And ../runtime_tools/src/observer_backend.erl best regards, taavi From dking@REDACTED Mon Sep 17 19:04:16 2007 From: dking@REDACTED (David King) Date: Mon, 17 Sep 2007 10:04:16 -0700 Subject: [erlang-questions] top(1) in Erlang In-Reply-To: <7D8FAD8A-302C-4D87-94BE-A5CB2FD02E9B@uninet.ee> References: <1F0B22BF-4486-4F47-85C3-BAF2BDB8D29C@ketralnis.com> <7D8FAD8A-302C-4D87-94BE-A5CB2FD02E9B@uninet.ee> Message-ID: <1B806397-E5C6-455F-B6B4-9039998AEA1D@ketralnis.com> >> I'm trying to write a process monitor akin to Unix's top(1) [...] > Btw, you can look at http://www.erlang.org/doc/apps/observer/ > part_frame.html > and "Erlang Top" from there;) > And ../runtime_tools/src/observer_backend.erl That's exactly what I was looking for, thanks From sean.hinde@REDACTED Mon Sep 17 19:07:42 2007 From: sean.hinde@REDACTED (Sean Hinde) Date: Mon, 17 Sep 2007 18:07:42 +0100 Subject: [erlang-questions] top(1) in Erlang In-Reply-To: <1F0B22BF-4486-4F47-85C3-BAF2BDB8D29C@ketralnis.com> References: <1F0B22BF-4486-4F47-85C3-BAF2BDB8D29C@ketralnis.com> Message-ID: Google for etop erlang - there is already some work on this. Sean On 17 Sep 2007, at 17:00, David King wrote: > I'm trying to write a process monitor akin to Unix's top(1) for > Erlang processes. Is there any way to determine how long a given > process spent with the CPU over the last X units of time? The > scheduler has to know this, does it expose that information? Does > something like this already exist that I'm missing? > > erlang:process_info/1 returns the following for a given process: > > [{current_function,{hipe_icode_coordinator,coordinate,4}}, > {initial_call,{erlang,apply,2}}, > {status,waiting}, > {message_queue_len,0}, > {messages,[]}, > {links,[]}, > {dictionary,[]}, > {trap_exit,false}, > {error_handler,error_handler}, > {priority,normal}, > {group_leader,<0.30.0>}, > {heap_size,6765}, > {stack_size,6}, > {reductions,8193}, > {garbage_collection,[{fullsweep_after,65535}]}] > > Is reductions close to what I want? Will that increment for things > other than function calls? Does that matter? > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From hakan@REDACTED Mon Sep 17 20:10:56 2007 From: hakan@REDACTED (Hakan Mattsson) Date: Mon, 17 Sep 2007 20:10:56 +0200 (CEST) Subject: [erlang-questions] gen_server call and reply In-Reply-To: <18158.16175.52187.273452@antilipe.corelatus.se> References: <200709161950.21721.als@iinet.net.au> <200709162329.34118.als@iinet.net.au> <8209f740709160734n50284016l6d4728024ad52e1b@mail.gmail.com> <18157.19447.927951.598749@antilipe.corelatus.se> <8209f740709161219r7988823dr3c0cb668230f0c10@mail.gmail.com> <18158.16175.52187.273452@antilipe.corelatus.se> Message-ID: On Mon, 17 Sep 2007, Matthias Lang wrote: ML> Why use 'noreply'? I can only really think of one reason---you have a ML> relatively long-running request but don't want to block the gen_server ML> while it runs. Maybe there's also some case where you can avoid a ML> deadlock, but I haven't thought about that. In a lock server it is quite handy to use 'noreply' to manage clients that needs to wait for the lock. ML> In the case of the long-running request, what I do instead is ML> ML> {reply, {pending, Ref}, State} ML> ML> where Ref is a reference which is then included in a later message ML> sent the old-fashioned way. This amounts to more or less the same as ML> 'noreply', though it's one message more expensive and has the benefit ML> of making it easier to reason about timeouts, at least to my mind. If the reply is really critical for the client (that is it cannot do anything useful without the reply) it would be simplest for the client to just wait indefinitely for the reply. Assuming that the client can do something useful while waiting for the reply, it could make sense to use the {pending, Ref} strategy. But would it not even be simpler to use an explicit receive in the client, instead of polling the server repeatedly for the outcome of {pending, Ref} in that case? /H?kan From dmercer@REDACTED Mon Sep 17 21:09:04 2007 From: dmercer@REDACTED (David Mercer) Date: Mon, 17 Sep 2007 14:09:04 -0500 Subject: [erlang-questions] : Sending funs between nodes In-Reply-To: <20070917074022.GA5552@erix.ericsson.se> References: <337538cb0708291228u415559a1jd02bbbcecb9b3ccb@mail.gmail.com><46D666B1.4090503@ericsson.com> <46E99033.3060101@web.am><337538cb0709141221q6d5fa744m96f622c7069030b0@mail.gmail.com> <20070917074022.GA5552@erix.ericsson.se> Message-ID: <005001c7f95e$37c83c20$891ea8c0@SSI.CORP> Raimo Niskanen wrote: > Since the shell emulates expressions it does not compile funs > - it emulates them too. And that is done by having a bunch of > compiled shell funs; arity 0..20 something. These shell funs > take the real fun code to emulate in their environment. Well, that certainly is clever. I did not know that. To demonstrate: 8> % 20 arguments 8> fun(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T)->1 end. #Fun 9> % 21 arguments 9> fun(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U)->1 end. =ERROR REPORT==== 17-Sep-2007::14:07:57 === Error in process <0.48.0> with exit value: {{argument_limit,{fun,2,[{clause,2,[{ var,2,'A'},{var,2,'B'},{var,2,'C'},{var,2,'D'},{var,2,'E'},{var,2,'F'},{var, 2,'G '},{var,2,'H'},{var,2,'I'},{var,2,'J'},{var,2,'K'},{var,2,'L'},{var,2,'M'},{ var, 2,'N'},{var,2,'O'},{var,2,'P'},{var,2,'Q'},{var,2,'R'},{var,2,'S'},{var,2,'T '},{ var,2... ** exited: {{argument_limit, {'fun', 2, [{clause, 2, [{var,2,'A'}, {var,2,'B'}, {var,2,'C'}, {var,2,'D'}, {var,2,'E'}, {var,2,'F'}, {var,2,'G'}, {var,2,'H'}, {var,2,'I'}, {var,2,'J'}, {var,2,'K'}, {var,2,'L'}, {var,2,'M'}, {var,2,'N'}, {var,2,'O'}, {var,2,'P'}, {var,2,...}, {var,...}, {...}|...], [], [{integer,2,1}]}]}}, [{erl_eval,expr,3}]} ** Cheers, David From dmercer@REDACTED Mon Sep 17 21:20:50 2007 From: dmercer@REDACTED (David Mercer) Date: Mon, 17 Sep 2007 14:20:50 -0500 Subject: [erlang-questions] list:join() for erlang? In-Reply-To: References: <46E8115C.8000602@free.fr><46E9123D.4000503@munat.com><000101c7f63e$adabef40$891ea8c0@SSI.CORP><6a36e7290709131338i4c19baefm44602f659affcc9@mail.gmail.com><6a36e7290709140211x606ff67w9e9fd1b0c8defd80@mail.gmail.com> Message-ID: <005101c7f95f$dbf1ba50$891ea8c0@SSI.CORP> Ok wrote: > To cut a long story short, ++ is like a carving knife. You have to > take reasonable care using it, but avoiding the carving knife and > tearing the roast you are serving to your friensd apart with your teeth > (like using flatten) would be messy and not likely to impress them > (to put it kindly). That analogy is worth every penny of this month's subscription fee to erlang-questions. Thanks! :-) David From matthias@REDACTED Mon Sep 17 22:01:02 2007 From: matthias@REDACTED (Matthias Lang) Date: Mon, 17 Sep 2007 22:01:02 +0200 Subject: [erlang-questions] gen_server call and reply In-Reply-To: References: <200709161950.21721.als@iinet.net.au> <200709162329.34118.als@iinet.net.au> <8209f740709160734n50284016l6d4728024ad52e1b@mail.gmail.com> <18157.19447.927951.598749@antilipe.corelatus.se> <8209f740709161219r7988823dr3c0cb668230f0c10@mail.gmail.com> <18158.16175.52187.273452@antilipe.corelatus.se> Message-ID: <18158.56574.243995.242302@antilipe.corelatus.se> > ML> In the case of the long-running request, what I do instead is > ML> > ML> {reply, {pending, Ref}, State} > ML> > ML> where Ref is a reference which is then included in a later message > ML> sent the old-fashioned way. This amounts to more or less the same as > ML> 'noreply', though it's one message more expensive and has the benefit > ML> of making it easier to reason about timeouts, at least to my mind. Hakan Mattsson writes: > If the reply is really critical for the client (that is > it cannot do anything useful without the reply) it > would be simplest for the client to just wait > indefinitely for the reply. It doesn't have to be a question of critical or not. A telecom example: you have a media gateway for conference calls. It has a gen server F which accepts commands from the outside world and a gen server G which talks to the switch hardware to set up the call. The switch hardware has relatively high latency. Simplest approach: F call()s G to set up the call. G replies when the call is actually set up. Cheating approach: F cast()s G to set up the call. Failure becomes harder to handle. Third approach: F call()s G to set up the call. G commits resources to the call and replies 'pending'. Then, G tells the switch to do things. The third approach lets you achieve more calls per second than the simplest approach. There are also other ways to achieve the same thing. > Assuming that the client can do something useful while > waiting for the reply, it could make sense to use the > {pending, Ref} strategy. But would it not even be > simpler to use an explicit receive in the client, > instead of polling the server repeatedly for the > outcome of {pending, Ref} in that case? Yes, that's more or less what I meant by "the old fashioned way". Matthias From rvirding@REDACTED Mon Sep 17 23:18:52 2007 From: rvirding@REDACTED (Robert Virding) Date: Mon, 17 Sep 2007 23:18:52 +0200 Subject: [erlang-questions] Representation of a map in bytecode? In-Reply-To: <1190028723.5212.11.camel@adic.fmi.fi> References: <837db430709142102h77a4799foe5820f3dc3ca7aab@mail.gmail.com> <1190028723.5212.11.camel@adic.fmi.fi> Message-ID: <3dbc6d1c0709171418r6ad7929el1142721f81239a31@mail.gmail.com> There is another problem with automatic parallelisation and Erlang. As Erlang DOES have side-effects, message passing basically, the order in which things are evaluated is significant. It is therefore not safe to automatically parallelise code. It is up to the programmer/designer to decide how the application should be made parallel. This is, of course, not always easy. Especially for most who come from a sequential world where you usually work out how to make things sequential. Yes I have been there. :-) Robert On 17/09/2007, Jouni Ryn? wrote: > > On Mon, 2007-09-17 at 12:33 +0200, Kenneth Lundin wrote: > > > If the system design already allows thousands of parallell tasks it is > > far from obvious that also the internal execution of each such task > > should benefit from > > automatic parallellisation. I actually believe that a system can be > > over parallellized and that this will degrade the performance. > > > There used to be a beautiful processor architecture called Transputer > and the language called Occam to program it. Making things going > parallel was even more easier and natural than in Erlang. > > And there were many papers published, that going from extreme parallel > systems to more serialised one was the way optimise the performance. > Extreme parallel meaning systems, where you have decades more processes > than real executing hardware. It all depends on the process switching > time and communication overhead. > > regards > Jouni > -- > > Jouni Ryn? mailto://Jouni.Ryno@REDACTED/ > http://space.fmi.fi/~ryno/ > Finnish Meteorological Institute http://www.fmi.fi/ > Space Research http://space.fmi.fi/ > P.O.BOX 503 Tel (+358)-9-19294656 > FIN-00101 Helsinki FAX (+358)-9-19294603 > Finland priv-GSM (+358)-50-5302903 > > "It's just zeros and ones, it cannot be hard" > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jarrod@REDACTED Tue Sep 18 00:51:17 2007 From: jarrod@REDACTED (Jarrod Roberson) Date: Mon, 17 Sep 2007 18:51:17 -0400 Subject: [erlang-questions] du in Erlang as a first attempt at an application Message-ID: I am trying to grok how to write a simple 'du' like program that walks a directory structure ( not just one but all nested directories ) and calculates a sum of all the file sizes. I found some sum() code that I understand how that works. I have stared at my Programming Erlang book I got a few days ago, and stared at the Erlang Cookbook as well as staring and hacking at the erlang shell and it just isn't clicking. >From what I see, this should be like a 5 line program in Erlang. Can anyone provide a working example or point me in the correct direction? From fredrik.svahn@REDACTED Mon Sep 17 23:50:08 2007 From: fredrik.svahn@REDACTED (Fredrik Svahn) Date: Mon, 17 Sep 2007 23:50:08 +0200 Subject: [erlang-questions] vlists & varrays Message-ID: I cannot say that I have been following the erlang mailing list day to day, but some quick googling indicates that no one has yet mentioned vlists or varrays here. http://en.wikipedia.org/wiki/VList Just for fun I made a small test implementation in erlang (no optimizations, and probably a lot of bugs) and did some benchmarking against normal list operations with a list of 1000 and 10000 elements. Adding an element ( i.e. [ NewElement | List ] ) is 3 times slower with lists, but the rest of the operations seem to be quite ok at least when doing the benchmarks with hipe compiled code. That is not bad considering for instance that lists:reverse/1 is a bif. $ erl -noshell -run vlists test 1000 -s erlang halt {insert,insert_last,iterate,first,last,reverse,length} lists: {250,22010,194,6,516,40,15} vlists: {774,2507,213,6,3,16,22} $ erl -noshell -run vlists test 10000 -s erlang halt {insert,insert_last,iterate,first,last,reverse,length} lists: {1420,3536945,3353,11,5071,824,228} vlists: {4250,27324,1760,6,5,5,23} Now the vlists module is really using a list as a wrapper around hipe arrays. Is there anyone who can spot something which is apparently dangerous or could cause unexpected side effects with the way they are used here? Are hipe arrays garbage collected for instance? Can they be passed around between erlang nodes as other data structures? Any way to optimize the insert operation? Code is attached. The paper by Phil Bagwell referenced at the end of the wikipedia page is worth reading. It states among other things that it is quite easy to change a vlist into a dynamic array with O(1) time for addition and deletion and where copying can be avoided altogether. It also describes how to write a deque using the same principles, and some other interesting pieces of information. I guess I will leave the varray and deque as an exercise to the reader if anyone is up to the challenge... :-) BR /Fredrik Svahn -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: vlists.erl Type: application/octet-stream Size: 7440 bytes Desc: not available URL: From ulf@REDACTED Tue Sep 18 01:10:36 2007 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 18 Sep 2007 01:10:36 +0200 Subject: [erlang-questions] Representation of a map in bytecode? In-Reply-To: <3dbc6d1c0709171418r6ad7929el1142721f81239a31@mail.gmail.com> References: <837db430709142102h77a4799foe5820f3dc3ca7aab@mail.gmail.com> <1190028723.5212.11.camel@adic.fmi.fi> <3dbc6d1c0709171418r6ad7929el1142721f81239a31@mail.gmail.com> Message-ID: <8209f740709171610v6b4fbc9sbff027231fa7d81b@mail.gmail.com> 2007/9/17, Robert Virding : > There is another problem with automatic parallelisation and Erlang. As > Erlang DOES have side-effects, message passing basically, the order in which > things are evaluated is significant. It is therefore not safe to > automatically parallelise code. It is up to the programmer/designer to > decide how the application should be made parallel. In the Barklund spec, which you helped write, it states clearly that the only order which is specified is that of expressions in a body. In an example, (X=8) + (X=9) is used to illustrate how the evaluation order can cause different run-time behavior(*), whereas the compiler accepts it, since all possible orders are valid at compile-time. (Chapter 6.5) (*) In this case, if X is unbound; then the exception will look different depending on the evaluation order: {badmatch, 8} or {badmatch,9} The new Erlang Reference Manual doesn't, as far as I can tell, address the issue of evaluation order within patterns. Personally, I think the description in the Specification is just fine. BR, Ulf W From hubaghdadi@REDACTED Tue Sep 18 01:31:46 2007 From: hubaghdadi@REDACTED (Lone Wolf) Date: Mon, 17 Sep 2007 16:31:46 -0700 (PDT) Subject: [erlang-questions] Comma, semicolon. Aaaaa Message-ID: <519680.96720.qm@web51110.mail.re2.yahoo.com> >>comma is the sequencing operator. >>The simple answer is that the comma operator in Erlang is an infix sequencing operator, EXACTLY the same as the comma operator in C or C++. E1, E2, E3 has the effects of E1 then E2 then E3 in that order and the value of E3. What does this mean? Would some one please shed some light on it since I'm not a C guy? An example maybe? >>C: x > y ? e1, e2 : (e3, e4) Erlang: if x > y -> e1, e2 ; true -> e3, e4 end I didn't understand this example. Sorry guys but I didn't know anything in C language. Thanks for help. Deep into that darkness peering, long I stood there, wondering, fearing, Doubting, dreaming dreams no mortal ever dreamed before. E.A Poe --------------------------------- Be a better Globetrotter. Get better travel answers from someone who knows. Yahoo! Answers - Check it out. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dustin@REDACTED Tue Sep 18 01:35:34 2007 From: dustin@REDACTED (Dustin Sallings) Date: Mon, 17 Sep 2007 16:35:34 -0700 Subject: [erlang-questions] du in Erlang as a first attempt at an application In-Reply-To: References: Message-ID: On Sep 17, 2007, at 15:51 , Jarrod Roberson wrote: > Can anyone provide a working example or point me in the correct > direction? What do you have so far? -- Dustin Sallings From dustin@REDACTED Tue Sep 18 01:46:57 2007 From: dustin@REDACTED (Dustin Sallings) Date: Mon, 17 Sep 2007 16:46:57 -0700 Subject: [erlang-questions] Comma, semicolon. Aaaaa In-Reply-To: <519680.96720.qm@web51110.mail.re2.yahoo.com> References: <519680.96720.qm@web51110.mail.re2.yahoo.com> Message-ID: On Sep 17, 2007, at 16:31 , Lone Wolf wrote: > What does this mean? > Would some one please shed some light on it since I'm not a C guy? > An example maybe? > > >>C: x > y ? e1, e2 : (e3, e4) > Erlang: if x > y -> e1, e2 ; true -> e3, e4 end > > I didn't understand this example. > Sorry guys but I didn't know anything in C language. > Thanks for help. (if (> x y) '(e1 e2) '(e3 e4)) -- Dustin Sallings -------------- next part -------------- An HTML attachment was scrubbed... URL: From bjt@REDACTED Tue Sep 18 02:48:49 2007 From: bjt@REDACTED (Benjamin Tolputt) Date: Tue, 18 Sep 2007 10:48:49 +1000 Subject: [erlang-questions] Stand Alone Erlang - Bare Bones Executable In-Reply-To: <816964.14345.qm@web38802.mail.mud.yahoo.com> References: <816964.14345.qm@web38802.mail.mud.yahoo.com> Message-ID: <46EF2071.10009@pmp.com.au> G'day All, Yes, I am still pursuing the "Stand Along Erlang" thread I started before, but am actually looking at implementation details (rather than just complaining it is not available). I am hoping I can ask some questions here that may be obvious to those commonly knee-deep in the code, but are a puzzle to me. Firstly, there is a few "SAE" files throughout the official OTP repository. I am assuming these are remnants of the Joe Armstrong Stand Alone Erlang. Are these still updated? I am assuming from earlier posts on this topic that they aren't, so should they be removed from the source code? Secondly, is there a way to build a single "self contained" executable which statically links in the beam library or will I have to perform makefile surgery to get this? I am looking at creating a self-contained EXE where the only "external" files are those required by Erlang modules / applications (i.e. "bin" directory will only have the one file - the Erlang Emulator/VM Executable). On that note, how easy would it be to compile a real bare bones Erlang that has no need for the OpenSSL & Libiconv DLL's? Regards, B.J.Tolputt From bjt@REDACTED Tue Sep 18 02:48:52 2007 From: bjt@REDACTED (Benjamin Tolputt) Date: Tue, 18 Sep 2007 10:48:52 +1000 Subject: [erlang-questions] Driver Threading & Message Sending In-Reply-To: <816964.14345.qm@web38802.mail.mud.yahoo.com> References: <816964.14345.qm@web38802.mail.mud.yahoo.com> Message-ID: <46EF2074.8030908@pmp.com.au> More questions though this time (while related to Stand Along Erlang, it also applies to general Erlang driver stuff I am developing). The benefit of Erlang which are pushing me to evangelize it to the game development crew is the high concurrency and CPU utilization on multi-core machines (i.e. it's SMP capabilities). To this end, they asked if it would be possible for them to run their physics & AI modules in a separate started up in a Erlang driver. This seems quite possible, but I wanted to know a couple of things about how threading & drivers are allowed to operate. Let's say that a driver is created for the AI engine utilizing whatever techniques they desire for this. Let's also assume that they are running this in a permanent loop (the classic "while (true)" thing) with input coming in from Erlang through the driver interface and sending messages back out the same way. Is it safe for the driver code to call the "driver_output" function from a thread other than one in which the emulator "calls into" the driver (i.e. is it possible to call driver_output from a thread not started by the emulator)? If not, what is the common method used to get output generated by the driver independent of queries (i.e. a call to the drv_output driver callback) from Erlang? Polling for output from the driver seems a bit strange given the message-centric method of everything else, but I haven't been this low-level with Erlang before... Regards, B.J.Tolputt From dking@REDACTED Tue Sep 18 03:05:44 2007 From: dking@REDACTED (David King) Date: Mon, 17 Sep 2007 18:05:44 -0700 Subject: [erlang-questions] Comma, semicolon. Aaaaa In-Reply-To: References: <519680.96720.qm@web51110.mail.re2.yahoo.com> Message-ID: <3D00665E-C1A6-4C66-9E3B-DBB7AF6920C6@ketralnis.com> >> >>C: x > y ? e1, e2 : (e3, e4) >> Erlang: if x > y -> e1, e2 ; true -> e3, e4 end >> I didn't understand this example. >> Sorry guys but I didn't know anything in C language. >> Thanks for help. > (if (> x y) '(e1 e2) '(e3 e4)) Not quite. that would look like if x>y -> [e1, e2]; true -> [e3,e4] end. Basically, A=if x>y -> e1, e2; true -> e3, e4 end. Is just to show that 'if' returns a value, and it returns the return- value of the last statement in the clause (a section of the 'if' that begins with "EXPRESSION ->") of the 'if' expression that is evaluated. The semicolons separate those clauses. That particular expression binds A=e4. From ok@REDACTED Tue Sep 18 04:18:45 2007 From: ok@REDACTED (ok) Date: Tue, 18 Sep 2007 14:18:45 +1200 Subject: [erlang-questions] Comma, semicolon. Aaaaa In-Reply-To: <519680.96720.qm@web51110.mail.re2.yahoo.com> References: <519680.96720.qm@web51110.mail.re2.yahoo.com> Message-ID: <71F91341-71B3-486F-8E5E-90C6B71C29EC@cs.otago.ac.nz> I wrote that Erlang's comma (when not acting as the element separator for tuples, lists, or function arguments) is an infix sequencing operator, just like in C. On 18 Sep 2007, at 11:31 am, Lone Wolf wrote: [that he doesn't know anything about C, so doesn't know what I am talking about]. Read the message again, where I said what an infix sequencing operator is: > E1, E2, E3 has the effects of E1 then > E2 then E3 in that order and the value of E3. In Algol 60, Simula I, Simula 67, Algol 68, Pascal, and Dijkstra's notation, the semicolon is an infix operator. If S1 and S2 are statements, then S1 ; S2 means "do S1, then do S2". In Algol 68, statements can be expressions, and this is generalised to If S is a statement and E is an expression then S ; E means "do S, then E, the result is the value of E". BCPL used ";" for statement sequencing and "<>" for expression sequencing. C copied BCPL, but changed "<>" to ",". There's a language called PL/I, which is a sort of Frankenstein's monster made out of bits of Fortran, bits of Algol, and bits of COBOL, the semicolon is a terminator. Many people exploited the fact that the Algols and Pascal have empty statements that no only have no effect, but no tokens in them, to treat the semicolon as if it were a terminator. The Algol 60 block begin x := 1; y := 2; end actually contains THREE statements. The third one is invisible, being an empty "do-nothing" statement, but it is definitely there. You can see how confusion might arise. Algol Erlang begin ( S1; E1, S2; E2, S3 E3 end ) The really horrible thing about C (faithfully copied, like so many bad ideas, by C++, Java, C#, and JavaScript) is that *some* statements end with a semicolon and some *don't*, and it's a property of the statement which is which. It is so much simpler in the Algol family languages, where two successive statements always have a semicolon between them, and it's also pretty simple in PL/I and Ada where statements *always* end with a semicolon. It's simple again in Erlang where "statements" (really, "expressions") that are both to be executed are ALWAYS separated by commas (and ONLY the comma has this effect). Lone Wolf, if this isn't clear enough, could you tell us which are some of the programming languages you do know? From hughperkins@REDACTED Tue Sep 18 04:55:36 2007 From: hughperkins@REDACTED (Hugh Perkins) Date: Tue, 18 Sep 2007 10:55:36 +0800 Subject: [erlang-questions] Representation of a map in bytecode? In-Reply-To: <3dbc6d1c0709171418r6ad7929el1142721f81239a31@mail.gmail.com> References: <837db430709142102h77a4799foe5820f3dc3ca7aab@mail.gmail.com> <1190028723.5212.11.camel@adic.fmi.fi> <3dbc6d1c0709171418r6ad7929el1142721f81239a31@mail.gmail.com> Message-ID: <837db430709171955q28c6c723yc2192a47a1c050fc@mail.gmail.com> On 9/18/07, Robert Virding wrote: > There is another problem with automatic parallelisation and Erlang. As > Erlang DOES have side-effects, message passing basically, the order in which > things are evaluated is significant. Hmmm, interesting. Good point. > In the Barklund spec, which you helped write, it states clearly that the only order which is specified is that of expressions in a body. In an example, (X=8) + (X=9) is used to illustrate how the evaluation order can cause different run-time behavior(*), whereas the compiler accepts it, since all possible orders are valid at compile-time. (Chapter 6.5) Hmmm, interesting too. So, is the order of execution of lists:map guaranteed to proceed always in a certain order? > Erlang DOES have side-effects, message passing basically Apart from io:format, are there any other side-effects possible in Erlang? Could one use a kindof MapReduce implementation where a map is evaluated as following: - incoming list to map split into n sub-lists, where n is number of available cores (eg on 64-core machine, if 17 cores are free at moment of execution of map, n = 17) - map run in n child processes, with one sub-list given to each process - any outgoing messages are cached temporarily - once all the child processes are finished, the messages are sent to their targets, in order (this is the "Reduce" part of the MapReduce implementation) Presumably, one could do the same thing for any io:formats too actually? Of course, another approach could be to use Haskell style monads to ensure purity, but Haskell has a number of other issues, such as lack of a vm. (By the way, just to clarify, in answer to objections such as: > If a system already is parallellized into e.g. one Erlang process per connection in a web-server, one Erlang process per ongoing call in a telecom system etc. there is very little reason trying to parallellize each map if there are thousands of call or connection processes executing simultaneously and that each of those potentially will perform a map operation as part of their work. I'm not really good at communication :-) so it's not really obvious in my proposition, but when I say "number of available cores", I dont mean the total number of cores on the system, I mean the number of available cores *at the time of execution of the map*. For example, example 1, imagine our program looks like this: dosomething(Max) -> lists:map( fun blah/1, [1..Max] ). Imagine we're running on a 64-core machine. At the time of execution of the map, there is a single process running, this one, and 63 other cores free, so there are a total of 64 cores available to the map. So, the list will be split into chunks of about (Max / 64 ) elements. Now, example 2, imagine our program is a webserver (your example), and the webpage runs a map. Example 2b, lets say there are 98 requests currently being handled, so at least 98 processes running. All 64 cores are in use. When we reach the map statement, we dont bother to split it into chunks, there's no point, as you say. Example 2b, lets say there is 1 request currently being handled, plus our new request. The request currently being handled is using 54 cores (lets say), so there are 10 cores free. Now, when we reach our map statement, it makes sense to split the map across the 10 available cores. Of course, the chunking will never be perfect, but its' really easy to do, and transparent to the programmer (in the absence of side-effects, but see above for mapreduce approach, or maybe use monads). It's generally going to be fairly optimal compared to static approaches, such as SPJ's NDP, or hard-coding directly by the programmer? From drcabana@REDACTED Tue Sep 18 05:19:56 2007 From: drcabana@REDACTED (David Cabana) Date: Mon, 17 Sep 2007 23:19:56 -0400 Subject: [erlang-questions] erl running in cygwin goofiness Message-ID: <44ed5e0f0709172019pe7eaf3cvea3255efb042dac2@mail.gmail.com> When I run erl inside a cygwin console, I notice that the up and down arrows are not bound to erl history, and the tab key does not do completion. Can anyone tell me the magic incantations I need to fix this? Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mogorman@REDACTED Tue Sep 18 06:13:36 2007 From: mogorman@REDACTED (Matthew O'Gorman) Date: Mon, 17 Sep 2007 23:13:36 -0500 Subject: [erlang-questions] erl running in cygwin goofiness In-Reply-To: <44ed5e0f0709172019pe7eaf3cvea3255efb042dac2@mail.gmail.com> References: <44ed5e0f0709172019pe7eaf3cvea3255efb042dac2@mail.gmail.com> Message-ID: you could install gnu/linux ^_^ http://goodbye-microsoft.com/ enjoy mog On 9/17/07, David Cabana wrote: > When I run erl inside a cygwin console, I notice that the up and down arrows > are not bound to erl history, and the tab key does not do completion. Can > anyone tell me the magic incantations I need to fix this? > > Thanks. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From dking@REDACTED Tue Sep 18 08:09:20 2007 From: dking@REDACTED (David King) Date: Mon, 17 Sep 2007 23:09:20 -0700 Subject: [erlang-questions] Representation of a map in bytecode? In-Reply-To: <837db430709171955q28c6c723yc2192a47a1c050fc@mail.gmail.com> References: <837db430709142102h77a4799foe5820f3dc3ca7aab@mail.gmail.com> <1190028723.5212.11.camel@adic.fmi.fi> <3dbc6d1c0709171418r6ad7929el1142721f81239a31@mail.gmail.com> <837db430709171955q28c6c723yc2192a47a1c050fc@mail.gmail.com> Message-ID: > Hmmm, interesting too. So, is the order of execution of lists:map > guaranteed to proceed always in a certain order? http://erlang.org/doc/man/lists.html says: > The evaluation order [of lists:map/1] is implementation dependent. From ulf@REDACTED Tue Sep 18 08:12:50 2007 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 18 Sep 2007 08:12:50 +0200 Subject: [erlang-questions] Driver Threading & Message Sending In-Reply-To: <46EF2074.8030908@pmp.com.au> References: <816964.14345.qm@web38802.mail.mud.yahoo.com> <46EF2074.8030908@pmp.com.au> Message-ID: <8209f740709172312n7cf0b100i4e5ff88f2781a224@mail.gmail.com> 2007/9/18, Benjamin Tolputt : > > The benefit of Erlang which are pushing me to evangelize it to the game > development crew is the high concurrency and CPU utilization on > multi-core machines (i.e. it's SMP capabilities). To this end, they > asked if it would be possible for them to run their physics & AI modules > in a separate started up in a Erlang driver. This seems quite possible, > but I wanted to know a couple of things about how threading & drivers > are allowed to operate. If you haven't already done so, you might want to read the tutorials in the ERTS User's Guide, e.g. 6.5 - Sample Asynchronous Driver: http://www.erlang.org/doc/apps/erts/driver.html#6.5http://www.erlang.org/doc/apps/erts/driver.html#6.5 In this example, the driver calls output_port() to send a message to the port owner, when there is something to report. BR, Ulf W From ingela@REDACTED Tue Sep 18 08:27:49 2007 From: ingela@REDACTED (Ingela Anderton Andin) Date: Tue, 18 Sep 2007 08:27:49 +0200 Subject: [erlang-questions] gen_server call and reply (Matthias Lang) In-Reply-To: References: Message-ID: <46EF6FE5.2030009@erix.ericsson.se> erlang-questions-request@REDACTED wrote: > Why use 'noreply'? I can only really think of one reason---you have a > relatively long-running request but don't want to block the gen_server > while it runs. Maybe there's also some case where you can avoid a > deadlock, but I haven't thought about that. > > I use noreply quite often. One reason is that I do not want my server to do blocking receives as that will spoil the soft upgrade for that process. I almost always use active_once on a socket to collect arbitary number of bytes in my server and then returning the response to the client with gen_server:reply/2 when I got the needed amount. (Could also be gen_fsm:reply/2). > In the case of the long-running request, what I do instead is > > {reply, {pending, Ref}, State} > > where Ref is a reference which is then included in a later message > sent the old-fashioned way. This amounts to more or less the same as > 'noreply', though it's one message more expensive and has the benefit > of making it easier to reason about timeouts, at least to my mind. > I do not agree. That changes the semantics for the client. I think a client that does a call shall hang until the reply is delivered (or is timed out) that is the semantics of call otherwise you might as well use cast. Of course for a long running request you do not want the server to hang for the duration of the call and that is one of the reasons why gen_server:reply/2 exists. If it is an independent calculation the best option is to spawn a new process that does the calculation and then calls gen:server_reply/2 in the new process. Otherwise you save "From" in the state and send the reply sometime later when you got enough information from elsewhere to send the reply. Timeout can always be handled with the help of erlang:send_after. Regards Ingela - OTP team From bjt@REDACTED Tue Sep 18 08:27:44 2007 From: bjt@REDACTED (Benjamin Tolputt) Date: Tue, 18 Sep 2007 16:27:44 +1000 Subject: [erlang-questions] Driver Threading & Message Sending In-Reply-To: <8209f740709172312n7cf0b100i4e5ff88f2781a224@mail.gmail.com> References: <816964.14345.qm@web38802.mail.mud.yahoo.com> <46EF2074.8030908@pmp.com.au> <8209f740709172312n7cf0b100i4e5ff88f2781a224@mail.gmail.com> Message-ID: <46EF6FE0.4080904@pmp.com.au> Ulf Wiger wrote: > If you haven't already done so, you might want to read the tutorials > in the ERTS User's Guide, e.g. 6.5 - Sample Asynchronous Driver: > > http://www.erlang.org/doc/apps/erts/driver.html#6.5http://www.erlang.org/doc/apps/erts/driver.html#6.5 > > In this example, the driver calls output_port() to send a message to > the port owner, when there is something to report. > Many thanks for this. I have read and understand the "Interoperability Tutorial" which uses the "driver_output" function, but when looking in the documentation on this function - it did not label this funciton as thread safe. I asked because this seemed like a pretty big "hole" given the elegance in the rest of Erlang (i.e. I guessed I had missed something) I will look into this, thanks. Regards, B.J.Tolputt From hughperkins@REDACTED Tue Sep 18 09:47:06 2007 From: hughperkins@REDACTED (Hugh Perkins) Date: Tue, 18 Sep 2007 15:47:06 +0800 Subject: [erlang-questions] Representation of a map in bytecode? In-Reply-To: References: <837db430709142102h77a4799foe5820f3dc3ca7aab@mail.gmail.com> <1190028723.5212.11.camel@adic.fmi.fi> <3dbc6d1c0709171418r6ad7929el1142721f81239a31@mail.gmail.com> <837db430709171955q28c6c723yc2192a47a1c050fc@mail.gmail.com> Message-ID: <837db430709180047m59bcf1a3w6fe2e9edb7c95fca@mail.gmail.com> On 9/18/07, David King wrote: > > The evaluation order [of lists:map/1] is implementation dependent. > Ok so, in theory, so we dont care about side-effects in a parallelized map? Still, probably better to enhance test repeatability by ensuring that the side-effects generated are predictable on a per-implementation basis? Ermmm..... random question, if lists:map is implementation dependent, I guess this means that, in standard erlang, the test results on one architecture are not portable to other architectures? Is this a good thing? From bjorn@REDACTED Tue Sep 18 10:13:59 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 18 Sep 2007 10:13:59 +0200 Subject: [erlang-questions] Representation of a map in bytecode? In-Reply-To: <837db430709180047m59bcf1a3w6fe2e9edb7c95fca@mail.gmail.com> References: <837db430709142102h77a4799foe5820f3dc3ca7aab@mail.gmail.com> <1190028723.5212.11.camel@adic.fmi.fi> <3dbc6d1c0709171418r6ad7929el1142721f81239a31@mail.gmail.com> <837db430709171955q28c6c723yc2192a47a1c050fc@mail.gmail.com> <837db430709180047m59bcf1a3w6fe2e9edb7c95fca@mail.gmail.com> Message-ID: "Hugh Perkins" writes: > Ermmm..... random question, if lists:map is implementation dependent, > I guess this means that, in standard erlang, the test results on one > architecture are not portable to other architectures? Is this a good > thing? The result IS the same on all architectures. There once was a difference between the BEAM and JAM (Joe Armstrong virtual Machine). JAM has since then been retired (it was last seen in the R5B release). /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From minsloc@REDACTED Tue Sep 18 11:01:13 2007 From: minsloc@REDACTED (Minsloc Tarren) Date: Tue, 18 Sep 2007 11:01:13 +0200 Subject: [erlang-questions] du in Erlang as a first attempt at an application In-Reply-To: References: Message-ID: <330602700709180201h6fbaee04mcd6143e0e4e2dcde@mail.gmail.com> Something like this should work dirsize(Dir) -> {Dirs,Files} = listdir(Dir), sum([filesize(File) || File <- Files]) % iterate over Files, collecting return values of filesize(), then sum the list + sum([dirsize(Dir2) || Dir2 <- Dirs]). % ditto for for directories (recursively) Not so effective, but quite elegant, I hope ;-) Does not detect circular links ... On 9/18/07, Jarrod Roberson wrote: > > I am trying to grok how to write a simple 'du' like program that walks > a directory structure ( not just one but all nested directories ) and > calculates a sum of all the file sizes. I found some sum() code that I > understand how that works. > > I have stared at my Programming Erlang book I got a few days ago, and > stared at the Erlang Cookbook as well as staring and hacking at the > erlang shell and it just isn't clicking. > > >From what I see, this should be like a 5 line program in Erlang. > > Can anyone provide a working example or point me in the correct direction? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rickard.s.green@REDACTED Tue Sep 18 11:22:28 2007 From: rickard.s.green@REDACTED (Rickard Green) Date: Tue, 18 Sep 2007 11:22:28 +0200 Subject: [erlang-questions] Driver Threading & Message Sending In-Reply-To: <46EF2074.8030908@pmp.com.au> References: <816964.14345.qm@web38802.mail.mud.yahoo.com> <46EF2074.8030908@pmp.com.au> Message-ID: <46EF98D4.9040502@ericsson.com> You can only use driver_output() from "emulator threads". When the runtime system with smp support is used, you can use driver_send_term() from any thread. See http://www.erlang.org/doc/man/erl_driver.html for more info. BR, Rickard Green, Erlang/OTP, Ericsson AB. Benjamin Tolputt wrote: > More questions though this time (while related to Stand Along Erlang, it > also applies to general Erlang driver stuff I am developing). > > The benefit of Erlang which are pushing me to evangelize it to the game > development crew is the high concurrency and CPU utilization on > multi-core machines (i.e. it's SMP capabilities). To this end, they > asked if it would be possible for them to run their physics & AI modules > in a separate started up in a Erlang driver. This seems quite possible, > but I wanted to know a couple of things about how threading & drivers > are allowed to operate. > > Let's say that a driver is created for the AI engine utilizing whatever > techniques they desire for this. Let's also assume that they are running > this in a permanent loop (the classic "while (true)" thing) with input > coming in from Erlang through the driver interface and sending messages > back out the same way. > > Is it safe for the driver code to call the "driver_output" function from > a thread other than one in which the emulator "calls into" the driver > (i.e. is it possible to call driver_output from a thread not started by > the emulator)? If not, what is the common method used to get output > generated by the driver independent of queries (i.e. a call to the > drv_output driver callback) from Erlang? Polling for output from the > driver seems a bit strange given the message-centric method of > everything else, but I haven't been this low-level with Erlang before... > > Regards, > B.J.Tolputt > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From klacke@REDACTED Tue Sep 18 11:25:01 2007 From: klacke@REDACTED (Claes Wikstrom) Date: Tue, 18 Sep 2007 11:25:01 +0200 Subject: [erlang-questions] top(1) in Erlang In-Reply-To: References: <1F0B22BF-4486-4F47-85C3-BAF2BDB8D29C@ketralnis.com> Message-ID: <46EF996D.3020800@hyber.org> Sean Hinde wrote: > Google for etop erlang - there is already some work on this. > I once wrote a top clone ages ago /klacke -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: top.erl URL: From rickard.s.green@REDACTED Tue Sep 18 11:32:01 2007 From: rickard.s.green@REDACTED (Rickard Green) Date: Tue, 18 Sep 2007 11:32:01 +0200 Subject: [erlang-questions] Driver Threading & Message Sending In-Reply-To: <46EF98D4.9040502@ericsson.com> References: <816964.14345.qm@web38802.mail.mud.yahoo.com> <46EF2074.8030908@pmp.com.au> <46EF98D4.9040502@ericsson.com> Message-ID: <46EF9B11.3090108@ericsson.com> Rickard Green wrote: > You can only use driver_output() from "emulator threads". Correction: The async thread pool are "emulator threads", but you cannot call driver_output() from them. You can only call driver_output() from the scheduler threads of the emulator. BR, Rickard Green, Erlang/OTP, Ericsson AB. > When the > runtime system with smp support is used, you can use driver_send_term() > from any thread. > > See http://www.erlang.org/doc/man/erl_driver.html for more info. > > BR, > Rickard Green, Erlang/OTP, Ericsson AB. > > Benjamin Tolputt wrote: >> More questions though this time (while related to Stand Along Erlang, it >> also applies to general Erlang driver stuff I am developing). >> >> The benefit of Erlang which are pushing me to evangelize it to the game >> development crew is the high concurrency and CPU utilization on >> multi-core machines (i.e. it's SMP capabilities). To this end, they >> asked if it would be possible for them to run their physics & AI modules >> in a separate started up in a Erlang driver. This seems quite possible, >> but I wanted to know a couple of things about how threading & drivers >> are allowed to operate. >> >> Let's say that a driver is created for the AI engine utilizing whatever >> techniques they desire for this. Let's also assume that they are running >> this in a permanent loop (the classic "while (true)" thing) with input >> coming in from Erlang through the driver interface and sending messages >> back out the same way. >> >> Is it safe for the driver code to call the "driver_output" function from >> a thread other than one in which the emulator "calls into" the driver >> (i.e. is it possible to call driver_output from a thread not started by >> the emulator)? If not, what is the common method used to get output >> generated by the driver independent of queries (i.e. a call to the >> drv_output driver callback) from Erlang? Polling for output from the >> driver seems a bit strange given the message-centric method of >> everything else, but I haven't been this low-level with Erlang before... >> >> Regards, >> B.J.Tolputt >> >> _______________________________________________ >> 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 minsloc@REDACTED Tue Sep 18 13:07:45 2007 From: minsloc@REDACTED (Minsloc Tarren) Date: Tue, 18 Sep 2007 13:07:45 +0200 Subject: [erlang-questions] sb. heard of a viable embedded erlang microproocessor Message-ID: <330602700709180407s76040985w3bb5f60d03cb5a23@mail.gmail.com> I am currently looking for a erlang microprocessor suitable for embedded development (as an alternative to Atmel's and PIC's). I want to use it as a controller(s) in building management system, semi-autonomous robots (hobby project), and even send it too the moon - not that i'm brains behind anything, i'm just a guy a bunch of x-prize winner wannabees asked to program the low-level mechanics in the moon-buggy and who refuses to touch assembly for the rest of his life ;-)) Only thing i''ve been able to find on the web is a message from 10/2001 that the design presented at EUC 2000 is nearly finished : http://www.erlang.org/pipermail/erlang-questions/2001-October/003789.html . Other sources state that it never was finished. Does anybody know about a ready solution ? The FPGA variant will probably be too pricey to use as a basis for commercial products, and power consumption - and maybe even higher sensitivity to interferences that can be expected in open space - will probably disqualify it from from the usage in the xprize mission, or am I wrong (I'm not a hardware guy) ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From ingela@REDACTED Tue Sep 18 13:09:57 2007 From: ingela@REDACTED (Ingela Anderton Andin) Date: Tue, 18 Sep 2007 13:09:57 +0200 Subject: [erlang-questions] gen_server call and reply (Matthias Lang) In-Reply-To: References: Message-ID: <46EFB205.7090905@erix.ericsson.se> Hi again! Humm ... I might have been a bit quick in my last response. I agree that letting the gen_server:call return a reference and later sending a response including that reference is a good strategy when you have the situation that you want some job done and you want to know when it is ready, but until then you can keep on doing other things. But if you need to wait for the job to be done I do not think that you should get an answer from gen_server:call/2 and then have do an explicit do receive on the return value from gen_srever:call/2 . Regards Ingela - OTP team erlang-questions-request@REDACTED wrote: >> In the case of the long-running request, what I do instead is >> >> {reply, {pending, Ref}, State} >> >> where Ref is a reference which is then included in a later message >> sent the old-fashioned way. This amounts to more or less the same as >> 'noreply', though it's one message more expensive and has the benefit >> of making it easier to reason about timeouts, at least to my mind. >> >> > I do not agree. That changes the semantics for the client. I think a > client that > does a call shall hang until the reply is delivered (or is timed out) > that is the semantics of call otherwise you might as well use cast. Of > course for a long running request you do not want the server to hang > for the duration of the call and that is one of the reasons why > gen_server:reply/2 exists. If it is an independent calculation the best > option is to spawn a new process that does the calculation and then > calls gen:server_reply/2 in the new process. Otherwise you > save "From" in the state and send the reply sometime later when you got > enough information from > elsewhere to send the reply. Timeout can always be handled with the help > of erlang:send_after. > > Regards Ingela - OTP team > > > From wnoise@REDACTED Tue Sep 18 13:04:58 2007 From: wnoise@REDACTED (Aaron Denney) Date: Tue, 18 Sep 2007 11:04:58 +0000 (UTC) Subject: [erlang-questions] I want documentation of Erlang in EDoc format References: <5e448700709042227l3e15c98bkca3606a32edabacc@mail.gmail.com> <337538cb0709050222i63b7116auc21a8c83c9726f5f@mail.gmail.com> <46DE854D.8010104@it.uu.se> Message-ID: On 2007-09-05, Richard Carlsson wrote: > and it is probably not worth the time and effort to move it into the > source files. That seems reasonable. But it would be nice to have the type information available to enable tools like dialyzer to check implementation against spec where appropriate. Even if you think actually giving type signatures for functions is too much work for not enough benefit, having the types defined so that everyone used the same ones in their own documentation, would be very helpful. -- Aaron Denney -><- From vladdu55@REDACTED Tue Sep 18 14:36:48 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 18 Sep 2007 14:36:48 +0200 Subject: [erlang-questions] I want documentation of Erlang in EDoc format In-Reply-To: References: <5e448700709042227l3e15c98bkca3606a32edabacc@mail.gmail.com> <337538cb0709050222i63b7116auc21a8c83c9726f5f@mail.gmail.com> <46DE854D.8010104@it.uu.se> Message-ID: <95be1d3b0709180536w74a2cd52p259de8b237cd06f1@mail.gmail.com> Hi, On 9/18/07, Aaron Denney wrote: > > That seems reasonable. But it would be nice to have the type > information available to enable tools like dialyzer to check > implementation against spec where appropriate. Even if you think > actually > giving type signatures for functions is too much work for not enough > benefit, having the types defined so that everyone used the same ones > in their own documentation, would be very helpful. > I just stumbled on this: the latest erl_parse.yrl contains some stuff related to adding type annotations to record definitions and specifying function type signatures. It doesn't seem to be functional yet - at least when I try it I get some internal crashes in erl_parse. So I suppose it's something coming in R12. If this was brought to people's attention before, I must have missed it and I apologize for increasing the noise level. best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From bjorn@REDACTED Tue Sep 18 15:02:40 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 18 Sep 2007 15:02:40 +0200 Subject: [erlang-questions] I want documentation of Erlang in EDoc format In-Reply-To: <95be1d3b0709180536w74a2cd52p259de8b237cd06f1@mail.gmail.com> References: <5e448700709042227l3e15c98bkca3606a32edabacc@mail.gmail.com> <337538cb0709050222i63b7116auc21a8c83c9726f5f@mail.gmail.com> <46DE854D.8010104@it.uu.se> <95be1d3b0709180536w74a2cd52p259de8b237cd06f1@mail.gmail.com> Message-ID: "Vlad Dumitrescu" writes: > Hi, > > I just stumbled on this: the latest erl_parse.yrl contains some stuff > related to adding type annotations to record definitions and specifying > function type signatures. It doesn't seem to be functional yet - at least > when I try it I get some internal crashes in erl_parse. So I suppose it's > something coming in R12. Yes, we hope to make type specifications an official and supported part of Erlang/OTP in R12B. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From kenneth.lundin@REDACTED Tue Sep 18 14:58:06 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Tue, 18 Sep 2007 14:58:06 +0200 Subject: [erlang-questions] I want documentation of Erlang in EDoc format In-Reply-To: References: <5e448700709042227l3e15c98bkca3606a32edabacc@mail.gmail.com> <337538cb0709050222i63b7116auc21a8c83c9726f5f@mail.gmail.com> <46DE854D.8010104@it.uu.se> Message-ID: On 9/18/07, Aaron Denney wrote: > On 2007-09-05, Richard Carlsson wrote: > > and it is probably not worth the time and effort to move it into the > > source files. > > That seems reasonable. But it would be nice to have the type > information available to enable tools like dialyzer to check > implementation against spec where appropriate. Even if you think actually > giving type signatures for functions is too much work for not enough > benefit, having the types defined so that everyone used the same ones > in their own documentation, would be very helpful. The formal type notation as discussed earlier will be used in the documentation sources (both edoc and our other XML format) as soon as the syntax is stable and supported by our tools. Today we have an informal markup in XML for function signatures which we will replace with the formal type spec syntax. /Kenneth (Erlang/OTP team at Ericsson) > > -- > Aaron Denney > -><- > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From erlang@REDACTED Tue Sep 18 16:05:11 2007 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 18 Sep 2007 16:05:11 +0200 Subject: [erlang-questions] du in Erlang as a first attempt at an application In-Reply-To: References: Message-ID: <9b08084c0709180705r193851c7pf0a537e24cd073d5@mail.gmail.com> 5 lines is a lot - should be one Hint Since you've got the book you could use lib_find (page 236,237) file_size_and_type page 233 and a list comprehension or lists:map/2 and lists:sum/1 You get another hint tomorrow if you've not solved it :-) /Joe Armstrong On 9/18/07, Jarrod Roberson wrote: > I am trying to grok how to write a simple 'du' like program that walks > a directory structure ( not just one but all nested directories ) and > calculates a sum of all the file sizes. I found some sum() code that I > understand how that works. > > I have stared at my Programming Erlang book I got a few days ago, and > stared at the Erlang Cookbook as well as staring and hacking at the > erlang shell and it just isn't clicking. > > >From what I see, this should be like a 5 line program in Erlang. > > Can anyone provide a working example or point me in the correct direction? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From twanvds@REDACTED Tue Sep 18 17:14:30 2007 From: twanvds@REDACTED (twanvds@REDACTED) Date: Tue, 18 Sep 2007 17:14:30 +0200 (CEST) Subject: [erlang-questions] =?iso-8859-1?q?Erlang_caf=E9_in_Nederland=3F_?= =?iso-8859-1?q?=28The_Netherlands=29?= Message-ID: <22616.83.80.64.66.1190128470.squirrel@webmail.xs4all.nl> Hi All, Is there a (public) "Erlang caf?" initiative in The Netherlands? If not, would you be interested to attend one? I've written this mail in English because I hope to draw the attention of English speaking Erlang programmers in the Netherlands as well. /Twan From dmitriid@REDACTED Tue Sep 18 17:44:04 2007 From: dmitriid@REDACTED (Dmitrii 'Mamut' Dimandt) Date: Tue, 18 Sep 2007 18:44:04 +0300 Subject: [erlang-questions] Large array of data structures Message-ID: <46EFF244.9080606@gmail.com> I've received a question over at "Erlang in Russian" forum, http://erlang.dmitriid.com/forum/topic/11 that reads: " I need to process a huge array of structures - about 60 million of them in total. Each structure looks like this: {PID, type (atom), direct (atom), index (Integer), nextind (Integer), prevind (Integer), position (Integer)}. I think such a structure would take up about 50 bytes and the entire array would then need 60 * 50 = 3 GB. It means that the array must be partly written to disk. In addition I need a fast access to PID, index, nextind, prevind fields. Searching for a structure by these fields should take about 2 microseconds, saving such a structure should takle as much. Reading and writing is performed on the same structures (about 30 000 of them) while the others simply wait. So the question is: how can i implement such an array? " My guess is that (d)ets/mnesia could be involved, but that's all I know :) Can anyone help? From klacke@REDACTED Tue Sep 18 21:40:04 2007 From: klacke@REDACTED (=?ISO-8859-1?Q?Claes_Wikstr=F6m?=) Date: Tue, 18 Sep 2007 21:40:04 +0200 Subject: [erlang-questions] Large array of data structures In-Reply-To: <46EFF244.9080606@gmail.com> References: <46EFF244.9080606@gmail.com> Message-ID: <46F02994.4000804@hyber.org> Dmitrii 'Mamut' Dimandt wrote: > I've received a question over at "Erlang in Russian" forum, > http://erlang.dmitriid.com/forum/topic/11 that reads: > " > I need to process a huge array of structures - about 60 million of them > in total. Each structure looks like this: {PID, type (atom), direct > (atom), index (Integer), nextind (Integer), prevind (Integer), position > (Integer)}. I think such a structure would take up about 50 bytes and > the entire array would then need 60 * 50 = 3 GB. It means that the array > must be partly written to disk. In addition I need a fast access to PID, > index, nextind, prevind fields. Searching for a structure by these > fields should take about 2 microseconds, saving such a structure should > takle as much. Reading and writing is performed on the same structures > (about 30 000 of them) while the others simply wait. So the question is: > how can i implement such an array? > " > Use Berkely DB and some of the BDB drivers posted here on the list /klacke From qrilka@REDACTED Tue Sep 18 22:58:51 2007 From: qrilka@REDACTED (Kirill Zaborski) Date: Wed, 19 Sep 2007 00:58:51 +0400 Subject: [erlang-questions] Large array of data structures In-Reply-To: <46F02994.4000804@hyber.org> References: <46EFF244.9080606@gmail.com> <46F02994.4000804@hyber.org> Message-ID: <337538cb0709181358o14adbfd4j5c2d1e9089607b96@mail.gmail.com> And by the way it looks like SleepyCat/Oracle people are working on native BerkeleyDB driver for Erlang - http://lionet.livejournal.com/18422.html(sorry but the page is in Russian - it's about http://bayfp.org/ meeting that took place recently). Best regards, Kirill. On 9/18/07, Claes Wikstr?m wrote: > > Dmitrii 'Mamut' Dimandt wrote: > > I've received a question over at "Erlang in Russian" forum, > > http://erlang.dmitriid.com/forum/topic/11 that reads: > > " > > I need to process a huge array of structures - about 60 million of them > > in total. Each structure looks like this: {PID, type (atom), direct > > (atom), index (Integer), nextind (Integer), prevind (Integer), position > > (Integer)}. I think such a structure would take up about 50 bytes and > > the entire array would then need 60 * 50 = 3 GB. It means that the array > > must be partly written to disk. In addition I need a fast access to PID, > > index, nextind, prevind fields. Searching for a structure by these > > fields should take about 2 microseconds, saving such a structure should > > takle as much. Reading and writing is performed on the same structures > > (about 30 000 of them) while the others simply wait. So the question is: > > how can i implement such an array? > > " > > > > > Use Berkely DB and some of the BDB drivers posted here on the list > > /klacke > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gbulmer@REDACTED Tue Sep 18 23:51:23 2007 From: gbulmer@REDACTED (G Bulmer) Date: Tue, 18 Sep 2007 22:51:23 +0100 Subject: [erlang-questions] Newbie question - how do I get global:register_name() to work? Message-ID: <1CFA23DD-A7F8-41C0-AEFC-56191EEFF3EA@gmail.com> I apologise for this newbie question, but ... Would someone please explain how to get global:register_name()/ global:whereis_name() to work across nodes? I have some very simple, experimental, local-registry based code which looks roughly like this: register(lookup, spawn(fun() -> some_fun() end)), and uses this message sending syntax from the 'remote' machine: { lookup, 'server@REDACTED' } ! { some_message } This code works okay across nodes on the same machine, and nodes on two machines; so cookie, -name server, etc. seem to be fine. I've tried converting it to use global:register_name(...), etc: Status = global:register_name(lookup, Pid = spawn(fun() -> some_fun() end)) This returns 'yes' as the value of Status, and seems to work within the VM that calls global:register_name(), i.e. global:whereis_name (lookup) returns the same pid value as bound to Pid in register_name, and global:registered_names() returns [lookup]. BUT in a second VM, on the same machine it fails (the 2nd VM is started with erl -name client). Specifically: global:whereis_name(lookup) returns 'undefined', and global: registered_names() returns []. I can see the process global_name_server mentioned in the global: module doc, in response to i() to the shell: <0.11.0> global:init/1 233 69 0 global_name_server gen_server:loop/6 12 What am I missing? Help and advice would be much appreciated. Garry From ok@REDACTED Wed Sep 19 00:33:29 2007 From: ok@REDACTED (ok) Date: Wed, 19 Sep 2007 10:33:29 +1200 Subject: [erlang-questions] Representation of a map in bytecode? In-Reply-To: <837db430709171955q28c6c723yc2192a47a1c050fc@mail.gmail.com> References: <837db430709142102h77a4799foe5820f3dc3ca7aab@mail.gmail.com> <1190028723.5212.11.camel@adic.fmi.fi> <3dbc6d1c0709171418r6ad7929el1142721f81239a31@mail.gmail.com> <837db430709171955q28c6c723yc2192a47a1c050fc@mail.gmail.com> Message-ID: <7F3F9077-DFC4-41D2-BA32-A211808AD9C8@cs.otago.ac.nz> To repeat a point that has already been made: (1) Providing a parallel map that people can call IF THEY WANT TO is both a good idea and easy to do in Erlang. A low level implementation of pmap might be a good idea. (2) Turning ALL maps into parallel ones is a dumb idea. Think about a tree. There are two ways to measure how big it is: SIZE (total number of nodes) and DEPTH (length of longest path). Now any computation can be seen as a tree of dependencies (this is calculated in terms of that). In a serial system, the time is proportional to the SIZE. In a system with more processors than you could ever want, the time is proportional to the DEPTH. It is only worth parallelising a map when the SIZE of the computation significantly exceeds the DEPTH, that is, when the amount of work per element is "high" compared with the cost of simply getting to all the elements. Given the current implementation of lists, map(fun(X) -> X+1 end, L) is going to be O(length(L)) even given infinitely many processors. Suppose we had tuple maps, specified as tmap(F, T) -> list_to_tuple(map(F, tuple_to_list(T))). but implemented directly. It is straightforward to implement this with depth proportional to log(size(T)), so automatically parallelising tuple maps would very nearly be sensible. (And it's what things like parellising C and Fortran compilers do.) Even then, for cheap enough F or small enough T, it might not be worth while. I am *not* saying that automatic parallisation is a bad idea, only that *blind* automatic parallelisation is a bad idea. Doing it right requires reasonably thorough whole-module analysis (at least!), not simply pattern matching byte code. Something like the approach that Clean used to take might work pretty well. Clean is a pure lazy functional language like Haskell, but with lightweight arrays and usually getting better performance. It was called Concurrent Clean because it really did have a multiprocessor concurrent implementation. Clean used programmer supplied annotations to indicate where parallelising would be a good idea. Another approach is the "parallel skeletons" one, where there are preprogrammed patterns of concurrency and you just plug your details in. Not unlike Erlang behaviours, come to think of it. And not unlike Joe's parallel map that you can call when it's appropriate. From fritchie@REDACTED Wed Sep 19 00:45:44 2007 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Tue, 18 Sep 2007 17:45:44 -0500 Subject: [erlang-questions] Comma, semicolon. Aaaaa In-Reply-To: Message of "Mon, 17 Sep 2007 18:05:44 PDT." <3D00665E-C1A6-4C66-9E3B-DBB7AF6920C6@ketralnis.com> Message-ID: <200709182245.l8IMjiJU035195@snookles.snookles.com> A note to all newbies: matters of punctuation are *really* simplified if you use Emacs's Erlang mode ... or some other editor/IDE that's aware of Erlang syntax. To this day, I still rely on Emacs to indent things for me, and if the indentation isn't what I expect, it means that I've omitted a comma or semicolon. Ditto if the compiler hates one of my input files. (Because I ignored Emacs's indentation, typically because I forgot to re-indent a region after major cut-and-or-paste surgery.) -Scott From ok@REDACTED Wed Sep 19 00:48:29 2007 From: ok@REDACTED (ok) Date: Wed, 19 Sep 2007 10:48:29 +1200 Subject: [erlang-questions] Representation of a map in bytecode? In-Reply-To: <837db430709180047m59bcf1a3w6fe2e9edb7c95fca@mail.gmail.com> References: <837db430709142102h77a4799foe5820f3dc3ca7aab@mail.gmail.com> <1190028723.5212.11.camel@adic.fmi.fi> <3dbc6d1c0709171418r6ad7929el1142721f81239a31@mail.gmail.com> <837db430709171955q28c6c723yc2192a47a1c050fc@mail.gmail.com> <837db430709180047m59bcf1a3w6fe2e9edb7c95fca@mail.gmail.com> Message-ID: On 18 Sep 2007, at 7:47 pm, Hugh Perkins wrote: > On 9/18/07, David King wrote: >>> The evaluation order [of lists:map/1] is implementation dependent. >> > > Ok so, in theory, so we dont care about side-effects in a > parallelized map? Whyever would you say THAT? No, the conclusion is that if you care about side effects, you don't use lists:map/1, you use your own code and *document* what order things must be done. And if you map a function with side effects down a list, you had *better* care about the order, even if only to prove that in this case the order does not matter. > Ermmm..... random question, if lists:map is implementation dependent, > I guess this means that, in standard erlang, the test results on one > architecture are not portable to other architectures? Is this a good > thing? Common Lisp and Scheme say exactly the same thing: the order in which user functions are applied in the supplied list processing functions is not defined. Common Lisp has a fairly large section saying what such a user-supplied function must not do. Here are two possible implementations of map: map(F, [H|T]) -> H1 = F(H), T1 = map(F, T), [H1|T1]; map(F, []) when is_function(F, 1) -> []. is just the existing lists:map/2 written in a funny way, while map(F, [H|T]) -> T1 = map(F, T), H1 = F(H), [H1|T1]; map(F, []) when is_function(F, 1) -> []. For pure functions F (that is, for the application map/2 was designed for) you get the same result either way. If now you write map(F, [H|T]) -> [F(H) | map(F, T)]; map(F, []) when is_function(F, 1) -> []. the version you get depends on what the compiler does with [E1 | E2]. Which was defined in one Erlang specification to be left to right, but it is the kind of thing people can change their minds about. Anyone who cares about the order of operations really should be using the sequencing operator (,) to make it absolutely explicit and unmistakable. I would be a bit wary about list comprehensions too... Do you know what the compiler does with them? Are you sure it will still be doing the same thing in 10 years? (I can think of a fairly obvious strategy which, for equally obvious plausible reasons, might evaluate parts of a comprehension left to right and other parts right to left.) From fritchie@REDACTED Wed Sep 19 02:09:41 2007 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Tue, 18 Sep 2007 19:09:41 -0500 Subject: [erlang-questions] gen_server call and reply In-Reply-To: Message of "Mon, 17 Sep 2007 10:05:54 +0200." <18158.13666.31269.913822@antilipe.corelatus.se> Message-ID: <200709190009.l8J09f4m035729@snookles.snookles.com> >>>>> "ml" == Matthias Lang writes: ml> Christian S writes: >> One case that struck my mind is when one spaws a process to do >> something and return the value with gen_server:reply/2. That >> requires gen_server:reply/2 to need to be executed before the >> gen_server:handle_call/3 returns noreply. ml> That's a good point. That pretty much kills my doubts. I'm now quite puzzled. Perhaps I haven't had enough coffee today. Assume the following two timelines, where time advances as we read from top to bottom: gen_server proc helper proc --------------- ----------- start executing handle_call/3 spawn helper proc do stuff for arbitrary time... call gen_server:reply/2 return {noreply, ...} My understanding of Christian's statement is that this timeline results in invalid behavior: gen_server proc helper proc --------------- ----------- start executing handle_call/3 spawn helper proc do stuff for arbitrary time... return {noreply, ...} call gen_server:reply/2 If my understanding is correct, then Christian's statement is not correct: the server's apparent behavior will be correct in either timeline. -Scott From hubaghdadi@REDACTED Wed Sep 19 01:30:05 2007 From: hubaghdadi@REDACTED (Lone Wolf) Date: Tue, 18 Sep 2007 16:30:05 -0700 (PDT) Subject: [erlang-questions] Comma, semicolon. Aaaaa Message-ID: <522440.2521.qm@web51112.mail.re2.yahoo.com> >>Lone Wolf, if this isn't clear enough, could you tell us which are some of the programming languages you do know? I'm a Java developer and somehow familiar with Python. Deep into that darkness peering, long I stood there, wondering, fearing, Doubting, dreaming dreams no mortal ever dreamed before. E.A Poe --------------------------------- Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rc.china@REDACTED Wed Sep 19 02:51:30 2007 From: rc.china@REDACTED (raocheng) Date: Wed, 19 Sep 2007 08:51:30 +0800 Subject: [erlang-questions] Solaris 10 build issues - otp_src_R11B-5 Message-ID: Hi, I have searched the mail list and found two similar questions: http://erlang.org/pipermail/erlang-questions/2007-May/026675.html http://erlang.org/pipermail/erlang-questions/2007-June/027354.html I have tried my best to solve my problem according the above two mail but failed. So I have to trouble you again:) This is the compile result: $ uname -a SunOS suntest05 5.10 Generic_232931-16 sun4u sparc SUNW,Sun-Blade-100 Solaris $ which as ; which ld ; which cc ; which gmake ; which gcc /usr/ccs/bin/as /usr/ucb/ld /usr/ucb/cc /opt/sfw/bin/gmake /opt/sfw/bin/gcc $ echo $PATH /usr/ucb:/opt/sfw/bin:... $ gcc --version gcc (GCC) 3.4.3 (csl-sol210-3_4-branch+sol_rpath) ... $ gmake --version GNU Make 3.80 ... $ cd /home/test/otp_src_R11B-5 $ ./configure --enable-smp-support $ gmake ... gcc -o /home/test/otp_src_R11B-5/bin/sparc-sun-solaris2.10/beam.hybrid \ obj/sparc-sun-solaris2.10/opt/hybrid/erl_main.o obj/sparc- sun-solaris2.10/opt/hybrid/preload.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_pbifs.o obj/sparc-sun-solaris2.10/opt/hybrid/benchmark.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_alloc.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_mtrace.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_alloc_util.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_goodfit_alloc.o obj/sparc- sun-solaris2.10/opt/hybrid/erl_bestfit_alloc.o obj/sparc- sun-solaris2.10/opt/hybrid/erl_afit_alloc.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_instrument.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_init.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_atom_table.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_bif_table.o obj/sparc- sun-solaris2.10/opt/hybrid/erl_bif_ddll.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_bif_guard.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_bif_info.o obj/sparc- sun-solaris2.10/opt/hybrid/erl_bif_op.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_bif_os.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_bif_lists.o obj/sparc- sun-solaris2.10/opt/hybrid/erl_bif_trace.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_bif_wrap.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_trace.o obj/sparc- sun-solaris2.10/opt/hybrid/copy.o obj/sparc-sun-solaris2.10/opt/hybrid/utils.o obj/sparc-sun-solaris2.10/opt/hybrid/bif.o obj/sparc-sun-solaris2.10/opt/hybrid/io.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_printf_term.o obj/sparc- sun-solaris2.10/opt/hybrid/erl_debug.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_md5.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_message.o obj/sparc- sun-solaris2.10/opt/hybrid/erl_process.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_process_dict.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_arith.o obj/sparc-sun-solaris2.10/opt/hybrid/time.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_time_sup.o obj/sparc- sun-solaris2.10/opt/hybrid/external.o obj/sparc-sun-solaris2.10/opt/hybrid/dist.o obj/sparc-sun-solaris2.10/opt/hybrid/binary.o obj/sparc- sun-solaris2.10/opt/hybrid/erl_db.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_db_util.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_db_hash.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_db_tree.o obj/sparc-sun-solaris2.10/opt/hybrid/fix_alloc.o obj/sparc-sun-solaris2.10/opt/hybrid/big.o obj/sparc-sun-solaris2.10/opt/hybrid/hash.o obj/sparc-sun-solaris2.10/opt/hybrid/index.o obj/sparc-sun-solaris2.10/opt/hybrid/atom.o obj/sparc-sun-solaris2.10/opt/hybrid/module.o obj/sparc-sun-solaris2.10/opt/hybrid/export.o obj/sparc-sun-solaris2.10/opt/hybrid/register.o obj/sparc-sun-solaris2.10/opt/hybrid/break.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_async.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_lock_check.o obj/sparc- sun-solaris2.10/opt/hybrid/ggc.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_gc.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_nmgc.o obj/sparc- sun-solaris2.10/opt/hybrid/erl_posix_str.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_bits.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_math.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_fun.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_bif_port.o obj/sparc- sun-solaris2.10/opt/hybrid/erl_term.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_node_tables.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_monitors.o obj/sparc- sun-solaris2.10/opt/hybrid/erl_process_dump.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_obsolete.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_bif_timer.o obj/sparc- sun-solaris2.10/opt/hybrid/erl_port_task.o obj/sparc-sun-solaris2.10/opt/hybrid/beam_emu.o obj/sparc-sun-solaris2.10/opt/hybrid/beam_opcodes.o obj/sparc- sun-solaris2.10/opt/hybrid/beam_load.o obj/sparc-sun-solaris2.10/opt/hybrid/beam_bif_load.o obj/sparc-sun-solaris2.10/opt/hybrid/beam_debug.o obj/sparc- sun-solaris2.10/opt/hybrid/beam_bp.o obj/sparc-sun-solaris2.10/opt/hybrid/beam_catches.o obj/sparc-sun-solaris2.10/opt/hybrid/sys.o obj/sparc-sun-solaris2.10/opt/hybrid/driver_tab.o obj/sparc-sun-solaris2.10/opt/hybrid/unix_efile.o obj/sparc-sun-solaris2.10/opt/hybrid/gzio.o obj/sparc-sun-solaris2.10/opt/hybrid/elib_malloc.o obj/sparc-sun-solaris2.10/opt/hybrid/elib_memmove.o obj/sparc-sun-solaris2.10/opt/hybrid/sys_float.o obj/sparc-sun-solaris2.10/opt/hybrid/sys_time.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_poll.kp.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_check_io.kp.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_poll.nkp.o obj/sparc- sun-solaris2.10/opt/hybrid/erl_check_io.nkp.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_mseg.o obj/sparc-sun-solaris2.10/opt/hybrid/erl_unix_sys_ddll.o obj/sparc- sun-solaris2.10/opt/hybrid/erl_mtrace_sys_wrap.o obj/sparc-sun-solaris2.10/opt/hybrid/hipe_bif0.o obj/sparc-sun-solaris2.10/opt/hybrid/hipe_bif1.o obj/sparc-sun-solaris2.10/opt/hybrid/hipe_bif2.o obj/sparc-sun-solaris2.10/opt/hybrid/hipe_debug.o obj/sparc-sun-solaris2.10/opt/hybrid/hipe_gc.o obj/sparc-sun-solaris2.10/opt/hybrid/hipe_mode_switch.o obj/sparc- sun-solaris2.10/opt/hybrid/hipe_native_bif.o obj/sparc-sun-solaris2.10/opt/hybrid/hipe_stack.o obj/sparc-sun-solaris2.10/opt/hybrid/hipe_sparc.o obj/sparc-sun-solaris2.10/opt/hybrid/hipe_sparc_glue.o obj/sparc-sun-solaris2.10/opt/hybrid/hipe_sparc_bifs.o obj/sparc- sun-solaris2.10/opt/hybrid/hipe_sparc_stack.o obj/sparc-sun-solaris2.10/opt/hybrid/efile_drv.o obj/sparc-sun-solaris2.10/opt/hybrid/inet_drv.o obj/sparc-sun-solaris2.10/opt/hybrid/zlib_drv.o obj/sparc-sun-solaris2.10/opt/hybrid/ram_file_drv.o obj/sparc- sun-solaris2.10/opt/hybrid/ttsl_drv.o -ldl -lm -lsocket -lnsl -lpthread -lcurses -L../lib/internal/sparc-sun-solaris2.10/home/test/otp_src_R11B-5/erts/obj/sparc- sun-solaris2.10/libz.a -lsctp -lethread -lpthread -lerts_internal_r ld: fatal: relocation error: R_SPARC_32: file obj/sparc-sun-solaris2.10/opt/hybrid/hipe_sparc_glue.o: symbol : offset 0xfcec0cfa is non-aligned ld: fatal: relocation error: R_SPARC_32: file obj/sparc-sun-solaris2.10/opt/hybrid/hipe_sparc_bifs.o: symbol : offset 0xfcec0d5f is non-aligned ld: fatal: relocation error: R_SPARC_32: file obj/sparc-sun-solaris2.10/opt/hybrid/hipe_sparc_bifs.o: symbol : offset 0xfcec0d65 is non-aligned ld: fatal: relocation error: R_SPARC_32: file obj/sparc-sun-solaris2.10/opt/hybrid/hipe_sparc_bifs.o: symbol : offset 0xfcec0d69 is non-aligned ld: fatal: relocation error: R_SPARC_32: file obj/sparc-sun-solaris2.10/opt/hybrid/hipe_sparc_bifs.o: symbol : offset 0xfcec0d6d is non-aligned ld: fatal: relocation error: R_SPARC_32: file obj/sparc-sun-solaris2.10/opt/hybrid/hipe_sparc_bifs.o: symbol : offset 0xfcfbf90f is non-aligned ld: fatal: relocation error: R_SPARC_32: file obj/sparc-sun-solaris2.10/opt/hybrid/hipe_sparc_glue.o: symbol : offset 0xfd00191e is non-aligned ld: fatal: relocation error: R_SPARC_32: file obj/sparc-sun-solaris2.10/opt/hybrid/hipe_sparc_bifs.o: symbol : offset 0xfd00193e is non-aligned collect2: ld returned 1 exit status gmake[3]: *** [/home/test/otp_src_R11B-5/bin/sparc-sun-solaris2.10/beam.hybrid] Error 1 gmake[3]: Leaving directory `/home/test/otp_src_R11B-5/erts/emulator' gmake[2]: *** [opt] Error 2 gmake[2]: Leaving directory `/home/test/otp_src_R11B-5/erts/emulator' gmake[1]: *** [hybrid] Error 2 gmake[1]: Leaving directory `/home/test/otp_src_R11B-5/erts' Thank you in advance. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lcoquelle@REDACTED Wed Sep 19 03:26:55 2007 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Wed, 19 Sep 2007 09:26:55 +0800 Subject: [erlang-questions] Newbie question - how do I get global:register_name() to work? In-Reply-To: <1CFA23DD-A7F8-41C0-AEFC-56191EEFF3EA@gmail.com> References: <1CFA23DD-A7F8-41C0-AEFC-56191EEFF3EA@gmail.com> Message-ID: I just tested it, and it seems to work one my local machine. Maybe you omited to "kind of connect" the nodes (help then to discover each others) using net_adm:ping/1 for example? Following is my test with output of the 2 VM. VM1: erl -sname e1 Erlang (BEAM) emulator version 5.5.4 [source] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.5.4 (abort with ^G) (e1@REDACTED)1> P1 = spawn(fun() -> receive _ -> ok end end). <0.42.0> (e1@REDACTED)2> global:register_name(test, P1). yes (e1@REDACTED)3> global:registered_names(). [test] (e1@REDACTED)4> global:whereis_name(test). <0.42.0> VM2: erl -sname e2 Erlang (BEAM) emulator version 5.5.4 [source] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.5.4 (abort with ^G) (e2@REDACTED)1> net_adm:ping(e1@REDACTED). pong (e2@REDACTED)2> global:registered_names(). [test] (e2@REDACTED)3> global:whereis_name(test). <5218.42.0> On 9/19/07, G Bulmer wrote: > > I apologise for this newbie question, but ... > Would someone please explain how to get global:register_name()/ > global:whereis_name() to work across nodes? > > I have some very simple, experimental, local-registry based code > which looks roughly like this: > register(lookup, spawn(fun() -> some_fun() end)), > > and uses this message sending syntax from the 'remote' machine: > { lookup, 'server@REDACTED' } ! { some_message } > > This code works okay across nodes on the same machine, and nodes on > two machines; so cookie, -name server, etc. seem to be fine. > > I've tried converting it to use global:register_name(...), etc: > Status = global:register_name(lookup, Pid = spawn(fun() -> some_fun() > end)) > > This returns 'yes' as the value of Status, and seems to work within > the VM that calls global:register_name(), i.e. global:whereis_name > (lookup) returns the same pid value as bound to Pid in register_name, > and global:registered_names() returns [lookup]. > > BUT in a second VM, on the same machine it fails (the 2nd VM is > started with erl -name client). Specifically: > global:whereis_name(lookup) returns 'undefined', and > global: registered_names() returns []. > > I can see the process global_name_server mentioned in the global: > module doc, in response to i() to the shell: > <0.11.0> global:init/1 > 233 69 0 > global_name_server gen_server:loop/6 12 > > What am I missing? > Help and advice would be much appreciated. > > Garry > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dougedmunds@REDACTED Wed Sep 19 05:33:00 2007 From: dougedmunds@REDACTED (Doug Edmunds) Date: Tue, 18 Sep 2007 20:33:00 -0700 Subject: [erlang-questions] separators before end Message-ID: Can someone tell me why it would be so difficult for Erlang to allow commas and semi-colons before the word ''end"? If there is a syntax error waiting to happen it is doing a copy/paste that doesn't add or take away a comma or semi-colon. What is so bad about having an empty statement? --dae -------------- next part -------------- An HTML attachment was scrubbed... URL: From w.a.de.jong@REDACTED Wed Sep 19 07:56:21 2007 From: w.a.de.jong@REDACTED (Willem de Jong) Date: Wed, 19 Sep 2007 07:56:21 +0200 Subject: [erlang-questions] =?iso-8859-1?q?Erlang_caf=E9_in_Nederland=3F_?= =?iso-8859-1?q?=28The_Netherlands=29?= In-Reply-To: <407d9ef80709182250i498ef198oda795e9c1976f936@mail.gmail.com> References: <22616.83.80.64.66.1190128470.squirrel@webmail.xs4all.nl> <407d9ef80709182250i498ef198oda795e9c1976f936@mail.gmail.com> Message-ID: <407d9ef80709182256o4208b32ei6559fb23418ce977@mail.gmail.com> Hi, Wat betreft locatie: ik zou een duidelijke voorkeur hebben voor een plaats in de randstad die per openbaar vervoer te bereiken is. Het is een goed initiatief, ik hoop dat je wat reacties krijgt. Groeten, Willem. On 9/19/07, Willem de Jong wrote: > Hi Twan, > > I would be interested. I am quite curious what other people are doing > with Erlang in the Netherlands. > > Groeten, > Willem. > > > > On 9/18/07, twanvds@REDACTED wrote: > > Hi All, > > > > Is there a (public) "Erlang caf?" initiative in The Netherlands? > > > > > > If not, would you be interested to attend one? > > > > > > I've written this mail in English because I hope to draw the attention of > > English speaking Erlang programmers in the Netherlands as well. > > > > > > > > /Twan > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > From w.a.de.jong@REDACTED Wed Sep 19 07:50:48 2007 From: w.a.de.jong@REDACTED (Willem de Jong) Date: Wed, 19 Sep 2007 07:50:48 +0200 Subject: [erlang-questions] =?iso-8859-1?q?Erlang_caf=E9_in_Nederland=3F_?= =?iso-8859-1?q?=28The_Netherlands=29?= In-Reply-To: <22616.83.80.64.66.1190128470.squirrel@webmail.xs4all.nl> References: <22616.83.80.64.66.1190128470.squirrel@webmail.xs4all.nl> Message-ID: <407d9ef80709182250i498ef198oda795e9c1976f936@mail.gmail.com> Hi Twan, I would be interested. I am quite curious what other people are doing with Erlang in the Netherlands. Groeten, Willem. On 9/18/07, twanvds@REDACTED wrote: > Hi All, > > Is there a (public) "Erlang caf?" initiative in The Netherlands? > > > If not, would you be interested to attend one? > > > I've written this mail in English because I hope to draw the attention of > English speaking Erlang programmers in the Netherlands as well. > > > > /Twan > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From ok@REDACTED Wed Sep 19 08:00:10 2007 From: ok@REDACTED (ok) Date: Wed, 19 Sep 2007 18:00:10 +1200 Subject: [erlang-questions] separators before end In-Reply-To: References: Message-ID: On 19 Sep 2007, at 3:33 pm, Doug Edmunds wrote: > Can someone tell me why it would be so difficult for Erlang > to allow commas and semi-colons before the word ''end"? Syntactically it would be easy. > > If there is a syntax error waiting to happen it is doing > a copy/paste that doesn't add or take away a comma or > semi-colon. This doesn't happen to me, but I'm not a *heavy* user of Erlang, so evidence from people who are would be useful. > What is so bad about having an empty statement? The fact that Erlang doesn't *HAVE* statements. It only has expressions. What is the value of an empty expression? Should if ... -> E1, ; ... -> En, ; end have the same value as if ... -> E1 ; ... -> En end and if so, how come the empty expression has so many different values? If not, why not? Where Erlang *does* need to allow extra semicolons is at the *beginnings* of ifs, cases, and receives, so you can write case e0 of ; p1 when g1 -> e1 ; ... ; pn when gn -> en end and be sure of having your punctuation right. > > > --dae > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From dmitriid@REDACTED Wed Sep 19 08:02:32 2007 From: dmitriid@REDACTED (Dmitrii 'Mamut' Dimandt) Date: Wed, 19 Sep 2007 09:02:32 +0300 Subject: [erlang-questions] Erlang Book 1996 vs. 2007 Message-ID: <46F0BB78.7030601@gmail.com> There are some chapters missing from v2007 as compared to v1996 such as 10.7 Negotiation Techniques 10.8 Adaptive Load Distribution 10.9 Relay Techniques 11.2 Partial Replication 15 An ASN.1 Compiler 17 Object-Oriented Programming These might be suitable for a book on more advanced topics, I guess. So the question is: will such a book be written/available? :) From erik.reitsma@REDACTED Wed Sep 19 08:36:11 2007 From: erik.reitsma@REDACTED (Erik Reitsma (RY/ETM)) Date: Wed, 19 Sep 2007 08:36:11 +0200 Subject: [erlang-questions] =?iso-8859-1?q?Erlang_caf=E9_in_Nederland=3F_?= =?iso-8859-1?q?=28The_Netherlands=29?= In-Reply-To: <22616.83.80.64.66.1190128470.squirrel@webmail.xs4all.nl> References: <22616.83.80.64.66.1190128470.squirrel@webmail.xs4all.nl> Message-ID: <110BA8ACEE682C479D0B008B6BE4AEB101F4575A@esealmw107.eemea.ericsson.se> Hi Twan and other Dutch Erlangers, If a Dutch Erlounge will be organized, I will do my best to be present. Breda or Zoetermeer would be convenient locations for me. Regards, *Erik. > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of > twanvds@REDACTED > Sent: Tuesday, September 18, 2007 5:15 PM > To: erlang-questions@REDACTED > Subject: [erlang-questions] Erlang caf? in Nederland? (The > Netherlands) > > Hi All, > > Is there a (public) "Erlang caf?" initiative in The Netherlands? > > > If not, would you be interested to attend one? > > > I've written this mail in English because I hope to draw the > attention of English speaking Erlang programmers in the > Netherlands as well. > > > > /Twan > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From raimo+erlang-questions@REDACTED Wed Sep 19 11:13:13 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Wed, 19 Sep 2007 11:13:13 +0200 Subject: [erlang-questions] : gen_server call and reply In-Reply-To: <200709190009.l8J09f4m035729@snookles.snookles.com> References: <18158.13666.31269.913822@antilipe.corelatus.se> <200709190009.l8J09f4m035729@snookles.snookles.com> Message-ID: <20070919091313.GB23100@erix.ericsson.se> I might step into something unplesent here, but... I think Christian and Matthias ment that Ulf's statement was an example that demonstrated it must be allowed to call gen_server:reply/2 both before and after return {noreply,_}, or else it would be unusable. On Tue, Sep 18, 2007 at 07:09:41PM -0500, Scott Lystig Fritchie wrote: > >>>>> "ml" == Matthias Lang writes: > > ml> Christian S writes: > > >> One case that struck my mind is when one spaws a process to do > >> something and return the value with gen_server:reply/2. That > >> requires gen_server:reply/2 to need to be executed before the > >> gen_server:handle_call/3 returns noreply. > > ml> That's a good point. That pretty much kills my doubts. > > I'm now quite puzzled. Perhaps I haven't had enough coffee today. > > Assume the following two timelines, where time advances as we read > from top to bottom: > > gen_server proc helper proc > --------------- ----------- > start executing handle_call/3 > spawn helper proc > do stuff for arbitrary time... > call gen_server:reply/2 > return {noreply, ...} > > My understanding of Christian's statement is that this timeline > results in invalid behavior: > > gen_server proc helper proc > --------------- ----------- > start executing handle_call/3 > spawn helper proc > do stuff for arbitrary time... > return {noreply, ...} > call gen_server:reply/2 > > If my understanding is correct, then Christian's statement is not > correct: the server's apparent behavior will be correct in either > timeline. > > -Scott > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From codeslinger@REDACTED Wed Sep 19 13:31:45 2007 From: codeslinger@REDACTED (Toby DiPasquale) Date: Wed, 19 Sep 2007 07:31:45 -0400 Subject: [erlang-questions] Erlang Book 1996 vs. 2007 In-Reply-To: <46F0BB78.7030601@gmail.com> References: <46F0BB78.7030601@gmail.com> Message-ID: <876ef97a0709190431k2a3ca2e0rba149c6e79f23656@mail.gmail.com> On 9/19/07, Dmitrii 'Mamut' Dimandt wrote: > There are some chapters missing from v2007 as compared to v1996 such as > > 10.7 Negotiation Techniques > 10.8 Adaptive Load Distribution I'd be very interested in these two chapters. Are they available in the first half that's in PDF format online? > 17 Object-Oriented Programming This would be in conflict with Joe's statements about Erlang not being object-oriented, right? -- Toby DiPasquale From sgolovan@REDACTED Wed Sep 19 13:29:28 2007 From: sgolovan@REDACTED (Sergei Golovan) Date: Wed, 19 Sep 2007 15:29:28 +0400 Subject: [erlang-questions] Testing reliable floating points exeption fails on x86? Message-ID: Hi! Could someone explain me what 'reliable floating points exceptions' are and how their reliability is checked? I'm packaging erlang/OTP for Debian GNU/Linux using two erlang flavours: with and without HiPE (HiPE enabled architectures are i386 (x86), amd64 (x86_64), powerpc and sparc). If I understand correctly, HiPE refuses to build if floating points exceptions are unreliable. I built erlang on x86 architecture many times and test for reliable fp exceptions never failed. But recently I've got a bugreport (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=442965) where the test fails. 1) Could it be that the test fails due to false negative (probably because it was run on x86_64 hardware, though I never managed to get it failed using both 32-bit and 64-bit kernel with 32-bit userland)? 2) I'm tempted to disable this test in a Debian source package and undefine NO_FPE_SIGNALS only for 4 architectures mentioned above. Will this cause any harm if erlang is built without HiPE support (for those 4 arches there are two erts - with and without HiPE and users select which to use)? Or fp exceptions play certain role even in this case? Cheers! -- Sergei Golovan From ulf.wiger@REDACTED Wed Sep 19 13:43:43 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 19 Sep 2007 13:43:43 +0200 Subject: [erlang-questions] Erlang Book 1996 vs. 2007 In-Reply-To: <876ef97a0709190431k2a3ca2e0rba149c6e79f23656@mail.gmail.com> References: <46F0BB78.7030601@gmail.com> <876ef97a0709190431k2a3ca2e0rba149c6e79f23656@mail.gmail.com> Message-ID: <46F10B6F.8050707@ericsson.com> Toby DiPasquale wrote: > >> 17 Object-Oriented Programming > > This would be in conflict with Joe's statements about Erlang not being > object-oriented, right? Not really. You can do object-oriented programming in C as well, but that doesn't make C object-oriented. (: Conversely, you can do concurrency-oriented programming in a variety of languages, but few languages besides Erlang promote a style of programming that is intrinsically concurrency-oriented. BR, Ulf W From chsu79@REDACTED Wed Sep 19 13:46:08 2007 From: chsu79@REDACTED (Christian S) Date: Wed, 19 Sep 2007 13:46:08 +0200 Subject: [erlang-questions] gen_server call and reply In-Reply-To: <200709190009.l8J09f4m035729@snookles.snookles.com> References: <18158.13666.31269.913822@antilipe.corelatus.se> <200709190009.l8J09f4m035729@snookles.snookles.com> Message-ID: Yes, im incorrent if you interpret my statement that way. :) I don't blame you, reading it again as carefully then I misinterpret myself too. I just wanted to point out that if you spawn a process to gen_server:reply/2 from, you have independent processes and thus order between anything the server does and anything the spawned process do is undefined. Therefore it must be irrelevant if gen_server:reply happens after or before the gen_server returns a no reply. > If my understanding is correct, then Christian's statement is not > correct: the server's apparent behavior will be correct in either > timeline. From dmitriid@REDACTED Wed Sep 19 14:03:52 2007 From: dmitriid@REDACTED (Dmitrii 'Mamut' Dimandt) Date: Wed, 19 Sep 2007 15:03:52 +0300 Subject: [erlang-questions] Erlang Book 1996 vs. 2007 In-Reply-To: <876ef97a0709190431k2a3ca2e0rba149c6e79f23656@mail.gmail.com> References: <46F0BB78.7030601@gmail.com> <876ef97a0709190431k2a3ca2e0rba149c6e79f23656@mail.gmail.com> Message-ID: <46F11028.7060206@gmail.com> Toby DiPasquale wrote: > On 9/19/07, Dmitrii 'Mamut' Dimandt wrote: > >> There are some chapters missing from v2007 as compared to v1996 such as >> >> 10.7 Negotiation Techniques >> 10.8 Adaptive Load Distribution >> > > I'd be very interested in these two chapters. Are they available in > the first half that's in PDF format online? > Unfortunately, not. They belong to the other half? > >> 17 Object-Oriented Programming >> > > This would be in conflict with Joe's statements about Erlang not being > object-oriented, right >From the TOC: http://erlang.org/erlang_book_toc.html 17 Object-Oriented Programming 17.1 Basic Concepts 17.2 Mapping to Erlang 17.3 An Object-Oriented Interface 17.4 Object-Oriented Programming 17.5 Object-Oriented Design I mostly interested in the "Mapping to Erlang" chapter as it could be quite useful when trying to port certain libraries to Erlang -------------- next part -------------- An HTML attachment was scrubbed... URL: From mikpe@REDACTED Wed Sep 19 14:30:42 2007 From: mikpe@REDACTED (Mikael Pettersson) Date: Wed, 19 Sep 2007 14:30:42 +0200 (MEST) Subject: [erlang-questions] Testing reliable floating points exeption fails on x86? Message-ID: <200709191230.l8JCUgEv008118@harpo.it.uu.se> On Wed, 19 Sep 2007 15:29:28 +0400, Sergei Golovan wrote: > Could someone explain me what 'reliable floating points exceptions' > are and how their reliability is checked? The ability to program the FPU so that e.g. overflows are reported as signals instead of as +inf. > I'm packaging erlang/OTP for Debian GNU/Linux using two erlang > flavours: with and without HiPE (HiPE enabled architectures are i386 > (x86), amd64 (x86_64), powerpc and sparc). If I understand correctly, > HiPE refuses to build if floating points exceptions are unreliable. Correct for x86-32, x86-64, ppc32, and sparc32. HiPE doesn't require FP exceptions on ARMv5b. > I built erlang on x86 architecture many times and test for reliable fp > exceptions never failed. But recently I've got a bugreport > (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=442965) where the > test fails. > > 1) Could it be that the test fails due to false negative (probably > because it was run on x86_64 hardware, though I never managed to get > it failed using both 32-bit and 64-bit kernel with 32-bit userland)? There's no information in that Debian bug report apart from "it failed". Most likely a compile-time error is causing fpe-test.c to fail. FWIW, the HiPE group regularly does builds on Fedora-based x86-{32,64} boxes without problems. > 2) I'm tempted to disable this test in a Debian source package and > undefine NO_FPE_SIGNALS only for 4 architectures mentioned above. Will > this cause any harm if erlang is built without HiPE support (for those > 4 arches there are two erts - with and without HiPE and users select > which to use)? Or fp exceptions play certain role even in this case? Floating-point arithmetic in the base BEAM system will be slower if FP exceptions don't work. The real solution is to debug the fpe-test.c failure on the bug reporter's machine. /Mikael From pat.eyler@REDACTED Wed Sep 19 14:40:26 2007 From: pat.eyler@REDACTED (pat eyler) Date: Wed, 19 Sep 2007 06:40:26 -0600 Subject: [erlang-questions] Erlang Book 1996 vs. 2007 In-Reply-To: <46F0BB78.7030601@gmail.com> References: <46F0BB78.7030601@gmail.com> Message-ID: <6fd0654b0709190540k76f25a1wac84cfaf6570954c@mail.gmail.com> On 9/19/07, Dmitrii 'Mamut' Dimandt wrote: > There are some chapters missing from v2007 as compared to v1996 such as > ... > These might be suitable for a book on more advanced topics, I guess. So > the question is: will such a book be written/available? :) I have been talking with a publisher (I can't say which one right now) who's quite interested in getting into the FP space. It sounds like they want to do it right (avoid the draw academic tomes and focus on practical programming; look at some advanced topics; and get authors who are recognizable in the community). I'll pass these and other ideas along to them. If anyone is interested in working on a book, let me know and I would be happy to pass along contact info. -- thanks, -pate ------------------------- Duty makes us do things, Love make us do things well. http://on-ruby.blogspot.com http://on-erlang.blogspot.com http://on-soccer.blogspot.com From sgolovan@REDACTED Wed Sep 19 14:50:51 2007 From: sgolovan@REDACTED (Sergei Golovan) Date: Wed, 19 Sep 2007 16:50:51 +0400 Subject: [erlang-questions] Testing reliable floating points exeption fails on x86? In-Reply-To: <200709191230.l8JCUgEv008118@harpo.it.uu.se> References: <200709191230.l8JCUgEv008118@harpo.it.uu.se> Message-ID: On 9/19/07, Mikael Pettersson wrote: > On Wed, 19 Sep 2007 15:29:28 +0400, Sergei Golovan wrote: > > Could someone explain me what 'reliable floating points exceptions' > > are and how their reliability is checked? > > The ability to program the FPU so that e.g. overflows are reported > as signals instead of as +inf. OK, I see. > > > I'm packaging erlang/OTP for Debian GNU/Linux using two erlang > > flavours: with and without HiPE (HiPE enabled architectures are i386 > > (x86), amd64 (x86_64), powerpc and sparc). If I understand correctly, > > HiPE refuses to build if floating points exceptions are unreliable. > > Correct for x86-32, x86-64, ppc32, and sparc32. > HiPE doesn't require FP exceptions on ARMv5b. But what may cause FP exceptions to be unreliable? Do they require some special support in Linux kernel for example, or if it's Linux 2.6 than they must be reliable? Or it depends on a user hardware (in this case we probably should disable FP exceptions in non-HiPE package, because in Debian we use binary packages which should work for anyone)? > > > I built erlang on x86 architecture many times and test for reliable fp > > exceptions never failed. But recently I've got a bugreport > > (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=442965) where the > > test fails. > > > > 1) Could it be that the test fails due to false negative (probably > > because it was run on x86_64 hardware, though I never managed to get > > it failed using both 32-bit and 64-bit kernel with 32-bit userland)? > > There's no information in that Debian bug report apart from "it failed". > Most likely a compile-time error is causing fpe-test.c to fail. Unfortunately, the reporter didn't get any additional info. I'll certainly ask him. > > FWIW, the HiPE group regularly does builds on Fedora-based x86-{32,64} > boxes without problems. I rebuild erlang with and without HiPE very often (on amd64, usually with 32-bit kernel), and never get it failed (excepting my own bugs in a build script). > > > 2) I'm tempted to disable this test in a Debian source package and > > undefine NO_FPE_SIGNALS only for 4 architectures mentioned above. Will > > this cause any harm if erlang is built without HiPE support (for those > > 4 arches there are two erts - with and without HiPE and users select > > which to use)? Or fp exceptions play certain role even in this case? > > Floating-point arithmetic in the base BEAM system will be slower > if FP exceptions don't work. I've found references to NO_FPE_SIGNALS macro in erl_interface. Should it matter if an application will use erl_interface built without using FP and run on erlang with FP (and vice versa)? > > The real solution is to debug the fpe-test.c failure on the > bug reporter's machine. Yes, it's definitely the best direction to go. Cheers! -- Sergei Golovan From thomasl_erlang@REDACTED Wed Sep 19 15:38:45 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 19 Sep 2007 06:38:45 -0700 (PDT) Subject: [erlang-questions] Erlounge Paris + seminar Message-ID: <12979.56615.qm@web38805.mail.mud.yahoo.com> Hi guys, This may be a bit short notice, but ... I'm visiting Paris next week on September 26-28, and wonder if there is any community interest in a short seminar on Thursday the 27th, followed by an Erlounge? The seminar currently has the provisional and somewhat cryptic title, "Roadmap to Native-Space, Native-Speed Numerical Computation in Erlang". Location: TBA, likely hotel in central Paris Time: 1730 (if scheduling permits) Length: 30-60 minutes. It's free to attend, but I'll need to know who is coming pretty soon. Attendance may be limited, though I expect it won't be a problem. On the other hand, if there are too few people interested, we will just go for the Erlounge instead. So, if you're interested in the seminar, please send me an email ASAP, before Friday 1200. Also, any advice on suitable locations for an Erlounge is appreciated. Best, Thomas PS. Those who miss the seminar could also sign up for a weekend remedial opportunity in Angers 28/29th. Well ... maybe :-) ____________________________________________________________________________________ Check out the hottest 2008 models today at Yahoo! Autos. http://autos.yahoo.com/new_cars.html From joelr1@REDACTED Wed Sep 19 15:59:28 2007 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 19 Sep 2007 14:59:28 +0100 Subject: [erlang-questions] Erlounge Paris + seminar In-Reply-To: <12979.56615.qm@web38805.mail.mud.yahoo.com> References: <12979.56615.qm@web38805.mail.mud.yahoo.com> Message-ID: <0181C9CD-1A1A-47AF-B4C9-C2DE10F00C0B@gmail.com> Thomas, On Sep 19, 2007, at 2:38 PM, Thomas Lindgren wrote: > The seminar currently has the provisional and somewhat > cryptic title, "Roadmap to Native-Space, Native-Speed > Numerical Computation in Erlang". Are there any papers on the subject for those of us who cannot attend the seminar? Thanks, Joel -- http://wagerlabs.com From mikpe@REDACTED Wed Sep 19 16:28:46 2007 From: mikpe@REDACTED (Mikael Pettersson) Date: Wed, 19 Sep 2007 16:28:46 +0200 (MEST) Subject: [erlang-questions] Testing reliable floating points exeption fails on x86? Message-ID: <200709191428.l8JESkUM009695@harpo.it.uu.se> On Wed, 19 Sep 2007 16:50:51 +0400, Sergei Golovan wrote: > But what may cause FP exceptions to be unreliable? Do they require > some special support in Linux kernel for example, or if it's Linux 2.6 > than they must be reliable? Or it depends on a user hardware (in this > case we probably should disable FP exceptions in non-HiPE package, > because in Debian we use binary packages which should work for > anyone)? Reliable FP exceptions require: 1. A CPU architecture that allows user-space to program the FPU control, or failing that a kernel that offers a system call for that purpose. PowerPC needs a system call, but x86/sparc do not. 2. Knowledge about the FPU in the erts source code. For instance, on x86 we must know about both x87 and sse2. 3. A kernel that preserves FPU control across context switches. 4. sigaction() with SA_SIGINFO and appropriate #include files so the signal handler can access the sigcontext/ucontext. 5. A libc that doesn't clobber the FPU control behind the user's back. A broken /usr/include/, for instance, would prevent reliable FP exceptions, even if the CPU and kernel would allow them. On the currently supported CPU architectures, the FPU programming model is pretty much the same for all CPU models. (We do detect dynamically if an x86 is using x87, sse2, or both.) The only real problem is that some ancient or low-end embedded CPU models don't have FPU HW. If their kernels also lack FPU emulation, then FP-using code won't work. However, that would break Erlang/OTP regardless of whether FP exceptions work or not, so it's not really an issue here. > > Floating-point arithmetic in the base BEAM system will be slower > > if FP exceptions don't work. > > I've found references to NO_FPE_SIGNALS macro in erl_interface. Should > it matter if an application will use erl_interface built without using > FP and run on erlang with FP (and vice versa)? The usage in lib/erl_interface/src/decode/decode_big.c is bogus. The code there is incomplete and unsafe for x86-64 and any x86-32 environment configured to use sse2. As far as I can tell, erl_interface will be linked with the Erlang runtime system, and should use FP exceptions if and only if the Erlang runtime system also uses them. /Mikael From pat.eyler@REDACTED Wed Sep 19 17:01:18 2007 From: pat.eyler@REDACTED (pat eyler) Date: Wed, 19 Sep 2007 09:01:18 -0600 Subject: [erlang-questions] A new erlang book? Message-ID: <6fd0654b0709190801y368be8d2o4ecba25fa5124b97@mail.gmail.com> The other day, a publisher asked me what I thought about the potential market for books on Functional Programming. As we talked, it became obvious that they want to play in this space and are looking for some feedback. It sounds like they want to put out a (some) book(s) that are a little bit more advanced than Joe's Programming Erlang, or the upcoming O'Reilly book on Haskell without doing yet another dry, academic tome. I'd love to collect some feedback about: Why Erlang is (or isn't) the right language. Who might be interested in/good at writing such a book? What topic(s) should be covered? Would it be better to write a traditional, big book or several smaller e-book/print books (in the 100-150 page range) about individual topics? -- thanks, -pate ------------------------- Duty makes us do things, Love make us do things well. http://on-ruby.blogspot.com http://on-erlang.blogspot.com http://on-soccer.blogspot.com From bjorn@REDACTED Wed Sep 19 18:11:56 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 19 Sep 2007 18:11:56 +0200 Subject: [erlang-questions] Testing reliable floating points exeption fails on x86? In-Reply-To: References: Message-ID: "Sergei Golovan" writes: > 2) I'm tempted to disable this test in a Debian source package and > undefine NO_FPE_SIGNALS only for 4 architectures mentioned above. Will > this cause any harm if erlang is built without HiPE support (for those > 4 arches there are two erts - with and without HiPE and users select > which to use)? Or fp exceptions play certain role even in this case? Erlang without HiPE support works fine without fp exceptions. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From steve@REDACTED Wed Sep 19 17:45:12 2007 From: steve@REDACTED (Stefan Strigler) Date: Wed, 19 Sep 2007 17:45:12 +0200 Subject: [erlang-questions] escript and define Message-ID: <1190216712.6757.19.camel@sz2.lan> Hi there, is there a way to define constants in escript? I've tried with #!/usr/bin/env escript -define(FOO, "hello world"). main(_) -> io:format("~s", [?FOO]). but no luck. Any help appreciated, Steve From steve@REDACTED Wed Sep 19 18:42:48 2007 From: steve@REDACTED (Stefan Strigler) Date: Wed, 19 Sep 2007 18:42:48 +0200 Subject: [erlang-questions] escript and epmd Message-ID: <1190220168.6757.26.camel@sz2.lan> Hi, next question :) How can I make sure that epmd is running when using escript. I want to start a named node from within escript and ping some other node like this: #!/usr/bin/env escript main(_) -> net_kernel:start([foo, shortnames]), erlang:set_cookie(some_random_cookie), case net_adm:ping(some_other_node) of pong -> ... pang -> %% spawn some_other_node ... end. But if epmd isn't running already I get: =INFO REPORT==== 19-Sep-2007::18:50:36 === Protocol: "inet_tcp": register error: {{badmatch,{error,econnrefused}}, [{inet_tcp_dist,listen,1}, {net_kernel,start_protos,4}, {net_kernel,start_protos,3}, {net_kernel,init_node,2}, {net_kernel,init,1}, {gen_server,init_it,6}, {proc_lib,init_p,5}]} escript: script failed with error reason function_clause Any help appreciated, Steve From dmercer@REDACTED Wed Sep 19 19:07:15 2007 From: dmercer@REDACTED (David Mercer) Date: Wed, 19 Sep 2007 12:07:15 -0500 Subject: [erlang-questions] separators before end In-Reply-To: References: Message-ID: <00f801c7fadf$87941b70$891ea8c0@SSI.CORP> > The fact that Erlang doesn't *HAVE* statements. It only has > expressions. What is the value of an empty expression? Good point. > Where Erlang *does* need to allow extra semicolons is at the > *beginnings* of ifs, cases, and receives, so you can write > case e0 of > ; p1 when g1 -> e1 > ; ... > ; pn when gn -> en > end > and be sure of having your punctuation right. I prefer this, too. Cheers, David -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of ok Sent: Wednesday, September 19, 2007 01:00 To: Erlang-Questions (E-mail) Subject: Re: [erlang-questions] separators before end On 19 Sep 2007, at 3:33 pm, Doug Edmunds wrote: > Can someone tell me why it would be so difficult for Erlang > to allow commas and semi-colons before the word ''end"? Syntactically it would be easy. > > If there is a syntax error waiting to happen it is doing > a copy/paste that doesn't add or take away a comma or > semi-colon. This doesn't happen to me, but I'm not a *heavy* user of Erlang, so evidence from people who are would be useful. > What is so bad about having an empty statement? The fact that Erlang doesn't *HAVE* statements. It only has expressions. What is the value of an empty expression? Should if ... -> E1, ; ... -> En, ; end have the same value as if ... -> E1 ; ... -> En end and if so, how come the empty expression has so many different values? If not, why not? Where Erlang *does* need to allow extra semicolons is at the *beginnings* of ifs, cases, and receives, so you can write case e0 of ; p1 when g1 -> e1 ; ... ; pn when gn -> en end and be sure of having your punctuation right. > > > --dae > > _______________________________________________ > 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 wnoise@REDACTED Wed Sep 19 20:09:57 2007 From: wnoise@REDACTED (Aaron Denney) Date: Wed, 19 Sep 2007 18:09:57 +0000 (UTC) Subject: [erlang-questions] I want documentation of Erlang in EDoc format References: <5e448700709042227l3e15c98bkca3606a32edabacc@mail.gmail.com> <337538cb0709050222i63b7116auc21a8c83c9726f5f@mail.gmail.com> <46DE854D.8010104@it.uu.se> Message-ID: On 2007-09-18, Kenneth Lundin wrote: > The formal type notation as discussed earlier will be used in the > documentation sources (both edoc and our other XML format) as soon > as the syntax is stable and supported by our tools. Today we have an > informal markup in XML for function signatures which we will replace > with the formal type spec syntax. I had missed that discussion. After looking back in the archives, I'm quite pleased with the plans. -- Aaron Denney -><- From patrickbachmann@REDACTED Wed Sep 19 20:21:18 2007 From: patrickbachmann@REDACTED (Patrick Bachmann) Date: Wed, 19 Sep 2007 20:21:18 +0200 Subject: [erlang-questions] =?iso-8859-1?q?Erlang_caf=E9_in_Nederland=3F_?= =?iso-8859-1?q?=28The_Netherlands=29?= In-Reply-To: <22616.83.80.64.66.1190128470.squirrel@webmail.xs4all.nl> References: <22616.83.80.64.66.1190128470.squirrel@webmail.xs4all.nl> Message-ID: <20070919182118.GA9389@bueno.flowtech> Hello Twan, On Tue, Sep 18, 2007 at 05:14:30PM +0200, twanvds@REDACTED wrote: > > If not, would you be interested to attend one? Yes, I'm interested. Though I'm still a newbie and making my way through "Programming Erlang". I'll start studying at the RWTH in Aachen, Germany and it's just 3 km to the Dutch border. Any place that I can reach within 1.5 h by train or car is ok. If someone from my area wants to car-pool please drop me a line. Greetings, Patrick From dougedmunds@REDACTED Wed Sep 19 20:44:42 2007 From: dougedmunds@REDACTED (Doug Edmunds) Date: Wed, 19 Sep 2007 11:44:42 -0700 Subject: [erlang-questions] separators before end In-Reply-To: <00f801c7fadf$87941b70$891ea8c0@SSI.CORP> References: <00f801c7fadf$87941b70$891ea8c0@SSI.CORP> Message-ID: Use of semicolons seems workable with IF as well (but look closely at the final IF expression, where there is a semicolon already). From: doc/getting_started/seq_prog.html % original test_if(A, B) -> if A == 5 -> io:format("A = 5~n", []), a_equals_5; B == 6 -> io:format("B = 6~n", []), b_equals_6; A == 2, B == 3 -> %i.e. A equals 2 and B equals 3 io:format("A == 2, B == 3~n", []), a_equals_2_b_equals_3; A == 1 ; B == 7 -> %i.e. A equals 1 or B equals 7 io:format("A == 1 ; B == 7~n", []), a_equals_1_or_b_equals_7 end. %With a semicolon before expressions, this becomes test_if(A, B) -> if ; A == 5 -> io:format("A = 5~n", []), a_equals_5 ; B == 6 -> io:format("B = 6~n", []), b_equals_6 ; A == 2, B == 3 -> %i.e. A equals 2 and B equals 3 io:format("A == 2, B == 3~n", []), a_equals_2_b_equals_3 ; A == 1 ; B == 7 -> %i.e. A equals 1 or B equals 7 io:format("A == 1 ; B == 7~n", []), a_equals_1_or_b_equals_7 end. -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Wed Sep 19 21:44:43 2007 From: erlang@REDACTED (Joe Armstrong) Date: Wed, 19 Sep 2007 21:44:43 +0200 Subject: [erlang-questions] separators before end In-Reply-To: <00f801c7fadf$87941b70$891ea8c0@SSI.CORP> References: <00f801c7fadf$87941b70$891ea8c0@SSI.CORP> Message-ID: <9b08084c0709191244r6f617d78r705f109fdc048e96@mail.gmail.com> ,What about English, should we also have leading commas? I agree with Orwell (rule 3). /Joe On 9/19/07, David Mercer wrote: > > The fact that Erlang doesn't *HAVE* statements. It only has > > expressions. What is the value of an empty expression? > > Good point. > > > Where Erlang *does* need to allow extra semicolons is at the > > *beginnings* of ifs, cases, and receives, so you can write > > case e0 of > > ; p1 when g1 -> e1 > > ; ... > > ; pn when gn -> en > > end > > and be sure of having your punctuation right. > > I prefer this, too. > > Cheers, > > David > > > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of ok > Sent: Wednesday, September 19, 2007 01:00 > To: Erlang-Questions (E-mail) > Subject: Re: [erlang-questions] separators before end > > > On 19 Sep 2007, at 3:33 pm, Doug Edmunds wrote: > > > Can someone tell me why it would be so difficult for Erlang > > to allow commas and semi-colons before the word ''end"? > > Syntactically it would be easy. > > > > If there is a syntax error waiting to happen it is doing > > a copy/paste that doesn't add or take away a comma or > > semi-colon. > > This doesn't happen to me, but I'm not a *heavy* user of Erlang, > so evidence from people who are would be useful. > > What is so bad about having an empty statement? > > The fact that Erlang doesn't *HAVE* statements. It only has > expressions. What is the value of an empty expression? > Should > if ... -> E1, ; ... -> En, ; end > have the same value as > if ... -> E1 ; ... -> En end > and if so, how come the empty expression has so many different values? > If not, why not? > > Where Erlang *does* need to allow extra semicolons is at the > *beginnings* of ifs, cases, and receives, so you can write > case e0 of > ; p1 when g1 -> e1 > ; ... > ; pn when gn -> en > end > and be sure of having your punctuation right. > > > > > > > --dae > > > > _______________________________________________ > > 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 erlang@REDACTED Wed Sep 19 22:00:58 2007 From: erlang@REDACTED (Joe Armstrong) Date: Wed, 19 Sep 2007 22:00:58 +0200 Subject: [erlang-questions] Representation of a map in bytecode? In-Reply-To: <7F3F9077-DFC4-41D2-BA32-A211808AD9C8@cs.otago.ac.nz> References: <837db430709142102h77a4799foe5820f3dc3ca7aab@mail.gmail.com> <1190028723.5212.11.camel@adic.fmi.fi> <3dbc6d1c0709171418r6ad7929el1142721f81239a31@mail.gmail.com> <837db430709171955q28c6c723yc2192a47a1c050fc@mail.gmail.com> <7F3F9077-DFC4-41D2-BA32-A211808AD9C8@cs.otago.ac.nz> Message-ID: <9b08084c0709191300s559d752pa7a9c479ce39fb54@mail.gmail.com> On 9/19/07, ok wrote: > To repeat a point that has already been made: > (1) Providing a parallel map that people can call IF THEY WANT TO is > both a > good idea and easy to do in Erlang. A low level implementation > of pmap > might be a good idea. Absolutely - there are only two ways you can exploit parallelism "on the chip" these are instruction level parallelism (ie the instruction set on the chip pipelines several instructions for higher performance, fetching one instruction as it evaluates another) and thread level parallelism (multicores) - there are no other ways of exploiting parallelism in the hardware. For the programmer this means that only thread level parallelism is available (in the form of multicores). Setting up a thread level parallel computation costs something - if this cost is greater than the cost of doing the computation in-place then nothing is won. Only the programmer knows (or should know) if a given map is worth parallelising. Automatic attempts to parallelise sequential code have always been dismal failures (despite massive research budgets) /Joe From dougedmunds@REDACTED Wed Sep 19 22:24:31 2007 From: dougedmunds@REDACTED (Doug Edmunds) Date: Wed, 19 Sep 2007 13:24:31 -0700 Subject: [erlang-questions] separators before end In-Reply-To: <9b08084c0709191244r6f617d78r705f109fdc048e96@mail.gmail.com> References: <00f801c7fadf$87941b70$891ea8c0@SSI.CORP> <9b08084c0709191244r6f617d78r705f109fdc048e96@mail.gmail.com> Message-ID: Perhaps Erlang should be more like Espa?ol: ?No problema? ? No problema! On 9/19/07, Joe Armstrong wrote: > > ,What about English, should we also have leading commas? > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From olopierpa@REDACTED Wed Sep 19 22:17:41 2007 From: olopierpa@REDACTED (Pierpaolo Bernardi) Date: Wed, 19 Sep 2007 22:17:41 +0200 Subject: [erlang-questions] escript and define In-Reply-To: <1190216712.6757.19.camel@sz2.lan> References: <1190216712.6757.19.camel@sz2.lan> Message-ID: <7352e43a0709191317s5ba3ee06w70a1189cb10eadd7@mail.gmail.com> On 9/19/07, Stefan Strigler wrote: > Hi there, > > is there a way to define constants in escript? I've tried with > > #!/usr/bin/env escript > > -define(FOO, "hello world"). Why not: foo() -> "hello world". P. From minsloc@REDACTED Wed Sep 19 23:07:22 2007 From: minsloc@REDACTED (Minsloc Tarren) Date: Wed, 19 Sep 2007 23:07:22 +0200 Subject: [erlang-questions] separators before end In-Reply-To: References: <00f801c7fadf$87941b70$891ea8c0@SSI.CORP> <9b08084c0709191244r6f617d78r705f109fdc048e96@mail.gmail.com> Message-ID: <330602700709191407s99b89bbvf55a860d0a1a6a1@mail.gmail.com> But why would anybody want this ? If the meaning of the code doesn't change, the only thing is everybody would be forced to type extra characters (and it's the de-facto standard to use semicolon as separator or end-statement character, this would only confuse newcomers. Same goes for the if example, 4 semicolons instead of 3 (I'm not counting the one serving as an and). The rule is simple, _separate_ expressions with "," and branches with ";". Or bring forth a SOUND argument that will convince all of those who are used to this kind of notation for years (I'm not an long time erlanger, but this was a no-brainer, seemed just natural and logical) that there is real benefit to it (other then that you would cut-and-paste your "programs" together twice as fast ;-))))))) Just try to go to java forum and convince them to switch to prefix notation (or just shout as loud as you can "Lisp, Smalltalk, Ruby, dynamic typing" etc, either will get your ass busted ;-))))). On 9/19/07, Doug Edmunds wrote: > > Perhaps Erlang should be more like Espa?ol: > > ?No problema? > ? No problema! > > > On 9/19/07, Joe Armstrong < erlang@REDACTED> wrote: > > > > ,What about English, should we also have leading commas? > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From attila.rajmund.nohl@REDACTED Wed Sep 19 23:24:00 2007 From: attila.rajmund.nohl@REDACTED (attila.rajmund.nohl@REDACTED) Date: Wed, 19 Sep 2007 23:24:00 +0200 (CEST) Subject: [erlang-questions] separators before end In-Reply-To: <330602700709191407s99b89bbvf55a860d0a1a6a1@mail.gmail.com> References: <00f801c7fadf$87941b70$891ea8c0@SSI.CORP> <9b08084c0709191244r6f617d78r705f109fdc048e96@mail.gmail.com> <330602700709191407s99b89bbvf55a860d0a1a6a1@mail.gmail.com> Message-ID: On Wed, 19 Sep 2007, Minsloc Tarren wrote: > But why would anybody want this ? > If the meaning of the code doesn't change, the only thing is everybody would > be forced to type extra characters (and it's the de-facto standard to use > semicolon as separator or end-statement character, this would only confuse > newcomers. No need to force, just allow. For example let's say I have a case statement like this: case SomeVar of 1 -> do_something; 2 -> do_otherthing end, Then I realize that I need to handle the value of 3 also, so I just add a line: case SomeVar of 1 -> do_something(); 2 -> do_other thing() 3 -> do_some_other_thing() end, and I get compilation error. Actually this is the most common compilation error I receive. If erlang would allow syntax like this: case SomeVar of 1 -> do_something; 2 -> do_otherthing; end, I wouldn't get these error messages. It's _really_ annoying. Bye,NAR -- "Beware of bugs in the above code; I have only proved it correct, not tried it." From rvirding@REDACTED Wed Sep 19 23:46:41 2007 From: rvirding@REDACTED (Robert Virding) Date: Wed, 19 Sep 2007 23:46:41 +0200 Subject: [erlang-questions] separators before end In-Reply-To: <330602700709191407s99b89bbvf55a860d0a1a6a1@mail.gmail.com> References: <00f801c7fadf$87941b70$891ea8c0@SSI.CORP> <9b08084c0709191244r6f617d78r705f109fdc048e96@mail.gmail.com> <330602700709191407s99b89bbvf55a860d0a1a6a1@mail.gmail.com> Message-ID: <3dbc6d1c0709191446ye8fa384q56cde8ea757e8092@mail.gmail.com> This is, of course, the correct observation, ; and , are separators not terminators. ; is a sequential or SEPARATOR and it is consistently used as such whether in guards or function/if/case/receive clauses. For , the situation is not as clear. It is both a sequential separator between expressions and an argument/element separator. We wanted to allow sequences of expressions in clauses without having to wrap them with begin/end as you do in for example C. C has , as an argument separator and ; as a statement terminator. If these were GOOD choices is a completely different matter. I personally am so used to it that it is not a problem and I don't really see the problem. :-) Robert On 19/09/2007, Minsloc Tarren wrote: > > But why would anybody want this ? > If the meaning of the code doesn't change, the only thing is everybody > would be forced to type extra characters (and it's the de-facto standard to > use semicolon as separator or end-statement character, this would only > confuse newcomers. > > Same goes for the if example, 4 semicolons instead of 3 (I'm not counting > the one serving as an and). > > The rule is simple, _separate_ expressions with "," and branches with ";". > > Or bring forth a SOUND argument that will convince all of those who are > used to this kind of notation for years (I'm not an long time erlanger, but > this was a no-brainer, seemed just natural and logical) that there is real > benefit to it (other then that you would cut-and-paste your "programs" > together twice as fast ;-))))))) > > Just try to go to java forum and convince them to switch to prefix > notation (or just shout as loud as you can "Lisp, Smalltalk, Ruby, dynamic > typing" etc, either will get your ass busted ;-))))). > > > On 9/19/07, Doug Edmunds wrote: > > > > Perhaps Erlang should be more like Espa?ol: > > > > ?No problema? > > ? No problema! > > > > > > On 9/19/07, Joe Armstrong < erlang@REDACTED> wrote: > > > > > > ,What about English, should we also have leading commas? > > > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmercer@REDACTED Wed Sep 19 22:30:05 2007 From: dmercer@REDACTED (David Mercer) Date: Wed, 19 Sep 2007 15:30:05 -0500 Subject: [erlang-questions] separators before end In-Reply-To: <9b08084c0709191244r6f617d78r705f109fdc048e96@mail.gmail.com> References: <00f801c7fadf$87941b70$891ea8c0@SSI.CORP> <9b08084c0709191244r6f617d78r705f109fdc048e96@mail.gmail.com> Message-ID: <010501c7fafb$ddebc560$891ea8c0@SSI.CORP> See http://www.erlang.org/pipermail/erlang-questions/2007-August/028516.html for my reasons. Cheers, David -----Original Message----- From: Joe Armstrong [mailto:erlang@REDACTED] Sent: Wednesday, September 19, 2007 14:45 To: dmercer@REDACTED Cc: Erlang-Questions (E-mail) Subject: Re: [erlang-questions] separators before end ,What about English, should we also have leading commas? I agree with Orwell (rule 3). /Joe On 9/19/07, David Mercer wrote: > > The fact that Erlang doesn't *HAVE* statements. It only has > > expressions. What is the value of an empty expression? > > Good point. > > > Where Erlang *does* need to allow extra semicolons is at the > > *beginnings* of ifs, cases, and receives, so you can write > > case e0 of > > ; p1 when g1 -> e1 > > ; ... > > ; pn when gn -> en > > end > > and be sure of having your punctuation right. > > I prefer this, too. > > Cheers, > > David > > > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of ok > Sent: Wednesday, September 19, 2007 01:00 > To: Erlang-Questions (E-mail) > Subject: Re: [erlang-questions] separators before end > > > On 19 Sep 2007, at 3:33 pm, Doug Edmunds wrote: > > > Can someone tell me why it would be so difficult for Erlang > > to allow commas and semi-colons before the word ''end"? > > Syntactically it would be easy. > > > > If there is a syntax error waiting to happen it is doing > > a copy/paste that doesn't add or take away a comma or > > semi-colon. > > This doesn't happen to me, but I'm not a *heavy* user of Erlang, > so evidence from people who are would be useful. > > What is so bad about having an empty statement? > > The fact that Erlang doesn't *HAVE* statements. It only has > expressions. What is the value of an empty expression? > Should > if ... -> E1, ; ... -> En, ; end > have the same value as > if ... -> E1 ; ... -> En end > and if so, how come the empty expression has so many different values? > If not, why not? > > Where Erlang *does* need to allow extra semicolons is at the > *beginnings* of ifs, cases, and receives, so you can write > case e0 of > ; p1 when g1 -> e1 > ; ... > ; pn when gn -> en > end > and be sure of having your punctuation right. > > > > > > > --dae > > > > _______________________________________________ > > 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 minsloc@REDACTED Thu Sep 20 00:36:32 2007 From: minsloc@REDACTED (Minsloc Tarren) Date: Thu, 20 Sep 2007 00:36:32 +0200 Subject: [erlang-questions] separators before end In-Reply-To: References: <00f801c7fadf$87941b70$891ea8c0@SSI.CORP> <9b08084c0709191244r6f617d78r705f109fdc048e96@mail.gmail.com> <330602700709191407s99b89bbvf55a860d0a1a6a1@mail.gmail.com> Message-ID: <330602700709191536o48522063j1abf595879c7cde@mail.gmail.com> On 9/19/07, attila.rajmund.nohl@REDACTED < attila.rajmund.nohl@REDACTED> wrote: > > No need to force, just allow. For example let's say I have a case > statement like this: > case SomeVar of > 1 -> do_something; > 2 -> do_otherthing > end, > > Then I realize that I need to handle the value of 3 also, so I just add > a line: > case SomeVar of > 1 -> do_something(); > 2 -> do_other thing() > 3 -> do_some_other_thing() well, most of the time i do it automatically ( <;> ). and even in times i forgot, it never occured to me that a perfectly logical language standard should be changed because of my mistake ... end, > > and I get compilation error. Actually this is the most common > compilation error I receive. If erlang would allow syntax like this: > case SomeVar of > 1 -> do_something; > 2 -> do_otherthing; > end, > > I wouldn't get these error messages. It's _really_ annoying. just look at it that whats annoying in that case is you forgetfulness. and no, i'm not saying that having a bit more flexible syntax is wrong *1),but it seems to me as too much of a hassle to change a language standard so you could just copy and paste more easily. but if you really wanna change this, just go ahead and write an EEP. If during the proces of writing it you wont come to the conclusion that it is unnecessary, maybe you can convince the people whose opinions in that matter really counts. http://www.erlang.org/eeps/eep-0001.html Bye,NAR > -- > "Beware of bugs in the above code; I have only proved it correct, not > tried it." > *1) i really liked ruby in that matter, and i would never use python because only idiot - sorry, Guido - would use whitespace in other way than as word-separator. I'm willing to accept any sensible community standard for indentation, but this is whitespace fascism ;-). if you wanna have some fun : http://mail.python.org/pipermail/python-list/2003-January/183048.html (third thing on goole under python tab), and exactly why i never tried python - not even when they started hyping about django. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dustin@REDACTED Thu Sep 20 01:11:01 2007 From: dustin@REDACTED (Dustin Sallings) Date: Wed, 19 Sep 2007 16:11:01 -0700 Subject: [erlang-questions] separators before end In-Reply-To: <330602700709191536o48522063j1abf595879c7cde@mail.gmail.com> References: <00f801c7fadf$87941b70$891ea8c0@SSI.CORP> <9b08084c0709191244r6f617d78r705f109fdc048e96@mail.gmail.com> <330602700709191407s99b89bbvf55a860d0a1a6a1@mail.gmail.com> <330602700709191536o48522063j1abf595879c7cde@mail.gmail.com> Message-ID: On Sep 19, 2007, at 15:36 , Minsloc Tarren wrote: > *1) i really liked ruby in that matter, and i would never use > python because only idiot - sorry, Guido - would use whitespace in > other way than as word-separator. I'm willing to accept any > sensible community standard for indentation, but this is whitespace > fascism ;-). > > if you wanna have some fun : http://mail.python.org/pipermail/ > python-list/2003-January/183048.html (third thing on goole under > python tab), and exactly why i never tried python - not even when > they started hyping about django. Please don't take someone's annoyance with an aspect of this language to start a flamewar about another. In this case, people who use erlang a lot aren't terribly bothered by treating ; and , as separators. The question is whether it's a barrier to entry, and how big of a barrier it is. In python's case, the only people who complain about whitespace are people who haven't used it (although they usually don't go as far as to call the creator an idiot on a completely unrelated list). -- Dustin Sallings -------------- next part -------------- An HTML attachment was scrubbed... URL: From minsloc@REDACTED Thu Sep 20 01:44:41 2007 From: minsloc@REDACTED (Minsloc Tarren) Date: Thu, 20 Sep 2007 01:44:41 +0200 Subject: [erlang-questions] separators before end In-Reply-To: References: <00f801c7fadf$87941b70$891ea8c0@SSI.CORP> <9b08084c0709191244r6f617d78r705f109fdc048e96@mail.gmail.com> <330602700709191407s99b89bbvf55a860d0a1a6a1@mail.gmail.com> <330602700709191536o48522063j1abf595879c7cde@mail.gmail.com> Message-ID: <330602700709191644k2b7b4257s8bce8b4f8821bb68@mail.gmail.com> On 9/20/07, Dustin Sallings wrote: > > > On Sep 19, 2007, at 15:36 , Minsloc Tarren wrote: > > *1) i really liked ruby in that matter, and i would never use python > because only idiot - sorry, Guido - would use whitespace in other way than > as word-separator. I'm willing to accept any sensible community standard for > indentation, but this is whitespace fascism ;-). > > if you wanna have some fun : > http://mail.python.org/pipermail/python-list/2003-January/183048.html (third > thing on goole under python tab), and exactly why i never tried python - not > even when they started hyping about django. > > > Please don't take someone's annoyance with an aspect of this language to > start a flamewar about another. > didn't meant to start a flamewar. sorry if it felt like this. and yeah, it depends on what you wanna call flaming (ie. you don't require malicious intention as an ingredient of flame). In this case, people who use erlang a lot aren't terribly bothered by > treating ; and , as separators. The question is whether it's a barrier to > entry, and how big of a barrier it is. > depends on the individual as with everything. for me, reading that it is separator was enough, as separator logically separates two things. In python's case, the only people who complain about whitespace are people > who haven't used it (although they usually don't go as far as to call the > creator an idiot on a completely unrelated list). > it's a matter of taste. and sorry, maybe i'm not weighting words, but if i find some decision idiotic, i'm not afraid/ashamed to say so. on the matter as when and where i said it: i would feel like an idiot and troll venting it on python list, because they are quite happy with python as it is. for me on the other side, it's language that has nothing the mainstream wouldn't have with an ugly syntax on top. i mentioned it here only because i mentioned ruby, whose elegance (both in way of syntax, and how objects are incorporated in language) contrasts with pythons ugliness. next time, just keep in mind that not everybody tries to flame when he uses stronger language, that some of us are aware of the fact that everything we say have implied imho in front of it (how exactly do you think i call people who don't get this ?), because we accept the fact that we see the world only through our own eyes/logic. and that we are simply sharing our opinion for the sake of discussion, not enforcing it on anybody, or putting it forth as an Universal Truth. -- > Dustin Sallings > Minsloc ps: political correctness is just just piece of cloth people stuff in their mouths so they don't have to change the way the think. pps: i know this probably looks like flaming to you again, but just try too believe i'm being honest. otherwise we'll have to ignore each other. -------------- next part -------------- An HTML attachment was scrubbed... URL: From minsloc@REDACTED Thu Sep 20 01:48:23 2007 From: minsloc@REDACTED (Minsloc Tarren) Date: Thu, 20 Sep 2007 01:48:23 +0200 Subject: [erlang-questions] separators before end In-Reply-To: <010501c7fafb$ddebc560$891ea8c0@SSI.CORP> References: <00f801c7fadf$87941b70$891ea8c0@SSI.CORP> <9b08084c0709191244r6f617d78r705f109fdc048e96@mail.gmail.com> <010501c7fafb$ddebc560$891ea8c0@SSI.CORP> Message-ID: <330602700709191648l2fcf4cc9g3353136e6142a04c@mail.gmail.com> yeah, erlang is not lispy enough (what language is, anyway ;-))) i you wanna more lispy erlang, or more erlangy lisp, look at Termite http://toute.ca/ (still in early development, i think). I looked at termite whitepaper just now, and they even removed mutation from scheme. neat. btw, you are absolutely right about the awkwardnes of A + B + C + ... + Z multiline formatting, I stuck with the A + B + C ... variant because you don't have to check the end of the line to notice that the expression continues. On 9/19/07, David Mercer wrote: > > See > http://www.erlang.org/pipermail/erlang-questions/2007-August/028516.html > for my reasons. > > Cheers, > > David > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jarrod@REDACTED Thu Sep 20 02:49:46 2007 From: jarrod@REDACTED (Jarrod Roberson) Date: Wed, 19 Sep 2007 20:49:46 -0400 Subject: [erlang-questions] du in Erlang as a first attempt at an application In-Reply-To: <9b08084c0709180705r193851c7pf0a537e24cd073d5@mail.gmail.com> References: <9b08084c0709180705r193851c7pf0a537e24cd073d5@mail.gmail.com> Message-ID: On 9/18/07, Joe Armstrong wrote: > 5 lines is a lot - should be one > > Hint > > Since you've got the book you could use lib_find (page 236,237) > file_size_and_type page 233 > and a list comprehension or lists:map/2 and lists:sum/1 > > You get another hint tomorrow if you've not solved it :-) > > /Joe Armstrong thanks I asked a similar question on trapexit about filelib:fold_files() about the parameters and someone suggested this. Does everything in one line! Simpler than I thought. filelib:fold_files(".", ".+", true, fun(F, A) -> A+filelib:file_size(F) end, 0). getting my head around functional programming after all these years of OO is going to take some time. At least I have done list comprehensions in Python :-) From gbulmer@REDACTED Thu Sep 20 04:05:40 2007 From: gbulmer@REDACTED (G Bulmer) Date: Thu, 20 Sep 2007 03:05:40 +0100 Subject: [erlang-questions] A new erlang book? Message-ID: <65673C95-4C45-4732-89E9-80A20DE0A0DF@gmail.com> Fundamentally, I like books that I can use to get developers up the learning curve faster, or to give a base for fun weekend hacking. I've lead development groups, and I've found it easier for staff to engage with bite-size pieces, which they could read and usefully experiment with in a week or two, part time. Of course it had to be information-dense, and they had to be reasonably bright and interested (which may be too small a market to attract your publisher :-( I really like books with relatively short, focused, chapters which can be used in 'reading circles' with developers every week or better. With plenty of working code snippets, so they can try this stuff, and not just leave it on the page. When a book and its technology supports engineers doing 5 minute experiments, they can really learn rapidly, and bring evidence to a debate. I think Joe's book demonstrates that Erlang is an excellent vehicle for this. Joe's use of the Erlang shell (and also Graham Hutton's Haskell Programming) got me typing along, which I think is a mark of a very good programming book based on a viable, potentially vibrant, technology. Joshua Bloch's "Effective Java" was good for reading circles as each 'tip' was quite short, and the group could assign 'lead' at a fine grain (over 100 tips), and pull everyone into really analysing, debating and understanding the information. One group got so interested that they met every day (instead of just twice/week) for a several weeks to cover the tips I asked them to analyse. So, $0.01 of my $0.02 is for slimmer books in the style of Effective Java, or these "Practical Guides": http://www.amazon.co.uk/TCP-Sockets-Java-Practical-Programmers/dp/ 1558606858/ref=sr_1_3/202-3897543-8546206? ie=UTF8&s=books&qid=1190245644&sr=1-3 http://www.amazon.co.uk/Multicast-Sockets-Practical-Programmers- Guides/dp/155860846X/ref=sr_1_10/202-3897543-8546206? ie=UTF8&s=books&qid=1190245644&sr=1-10 which are 128 and 180 pages. While I accept the content could be improved, I liked them as a platform for fun hacking over a few weekends (I don't believe I just wrote that :-) Whinge { I feel that a lot of the 600+ page books contain lots of stuff that I don't want, and more filler than a McD%~@<)& thick shake; they have very low information to paper content (sadly, IMHO, some of the other pragmatic programmers books suffer, and they are quite slim too :-( } Areas I would have liked covered in Joe's book are mentioned in my review of the book at amazon.co.uk, but I will elaborate: 1. This may seem to be bit cynical, but compare and contrast Erlang/ OTP with the "Web application architecture" * of Java+Structs +Hibernate+...+Oracle/... MS.NET, 'LAMP' etc. I don't feel this is the sweetest spot for Erlang (but I am happy to be corrected). My aim would be to provide a way of understanding what OTP is good for, and a 'model' within which Erlang/OTP's benefits can be usefully identified and highlighted. It should build complete working systems. This should help astute developers to understand the breadth and depth of OTP, and how to use and deploy it appropriately. I'd probably try to support "richer client's" too (e.g. AJAX, REST, etc, etc) as that should demonstrate a 'sexy hook' that developers seem to be interested in learning and trying out. If the publisher already has an AJAX book, maybe complement that with Erlang services? This is likely too much work unless someone really wants to make Erlang 'the next Java'. So, maybe a collaborative community effort? 2. Some in-depth, larger scale, richer functionality, OTP apps. Maybe, an Erlang replacement for Skype, but using standards, would be fun. Maybe explore the ejabber code base, and build-out/highlight some interesting/useful/fun architecture and functionality? Better still, just dig into chunks of OTP itself to highlight key issues and explore actual solutions. I'd like to see measurement and analysis as a major axes in here too. IMHO, there is premature optimisation, based on unsound basis, still going on. OTP provides a code base which is in production, and based on experience. So this book would be aimed at the aspiring 'architect'. 3. String and text processing in an Erlang context. FP books often cover parsing/transformation for good reason (IMHO, the OO 'visitor' pattern is not that cool when using a language that has pattern matching built in:-). This would be handy, as lots of raw data comes in textual form. I'd like to understand the idioms that experienced Erlang developers use. Maybe be very radical and compared to e.g. Haskell, or Ruby, or Java. Examples? Maybe several alternative SPAM filter techniques? This would let you exploit parallelism, data storage, etc too. 4. Finer-grained parallelism. Light-weight processes and messaging help, but I feel there needs to be more elaboration than Joe's book; there are issues around resource management, scaling, co-ordination, etc. which Joe's book highlights, but doesn't necessarily dig into in depth (this isn't a criticism, it already covers a lot of ground at a good level). I have no inspiration about the focus, but maybe all the other topic areas could benefit from a careful interweaving of these issues. There is a plethora of other stuff **, but I have to decide if I might want to do those things myself ;-) HTH Garry * - I accept that many developers seem to think 'Architecture' is just a bunch of old J2EE/.NET power point slides with the current customers logo attached, but I'm not one of them, I use 'web application architecture' as a shorthand for a broad range of stuff ** - That final tease is a bit naughty, but I'm like that at this time of night. > Date: Wed, 19 Sep 2007 09:01:18 -0600 > From: "pat eyler" > Subject: [erlang-questions] A new erlang book? > > > The other day, a publisher asked me what I thought about the > potential market for books on Functional Programming. As we > talked, it became obvious that they want to play in this space > and are looking for some feedback. It sounds like they want to > put out a (some) book(s) that are a little bit more advanced than > Joe's Programming Erlang, or the upcoming O'Reilly book on > Haskell without doing yet another dry, academic tome. > > I'd love to collect some feedback about: > > Why Erlang is (or isn't) the right language. > > Who might be interested in/good at writing such a > book? > > What topic(s) should be covered? > > Would it be better to write a traditional, big book or several > smaller e-book/print books (in the 100-150 page range) about > individual topics? > From charles.gordon@REDACTED Thu Sep 20 07:29:38 2007 From: charles.gordon@REDACTED (Charles Gordon) Date: Wed, 19 Sep 2007 22:29:38 -0700 Subject: [erlang-questions] Programming Erlang Exercise 8.11 Message-ID: <575ee0d40709192229v6268e3bdo33a6d84847ed7209@mail.gmail.com> I'm new to Erlang and working my way through Joe Armstrong's "Programming Erlang". I'm a little stumped by exercise 8.11, and I'm hoping someone can give me a hint or two. Here is the full text of the exercise for those of you without the book: "Write a function start(AnAtom, Fun) to register AnAtom as spawn(Fun). Make sure your program works correctly in the case when two parallel processes simultaneously evaluate start/2. In this case, you must guarantee that one of these processes succeeds and the other fails." I think I understand the problem to mean that start(AnAtom, Fun) should spawn(Fun) and then register the resulting Pid with AnAtom. Here is my best shot at such a function: start(AnAtom, Fun) -> case whereis(AnAtom) of undefined -> Pid = spawn(Fun), register(AnAtom, Pid); true -> true end. The problem didn't specify what the function should return after the first call, so I'm just returning "true" (since that is what "register/2" returns). The trouble I'm having is that I can't see how this avoids a race condition. I don't understand what underlying mechanisms ensure that two parallel processes calling this function don't both evaluate "whereis(AnAtom)", both get "undefined" and both spawn the process (and register it). The problem here is that whereis and register seem to be accessing some sort of shared global state, which is supposed to be impossible. At least, I think they are, since I can't understand how else they would work. What am I missing here? Thanks! Charles Gordon -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.hopwood@REDACTED Thu Sep 20 06:07:24 2007 From: david.hopwood@REDACTED (David Hopwood) Date: Thu, 20 Sep 2007 05:07:24 +0100 Subject: [erlang-questions] Large array of data structures In-Reply-To: <46EFF244.9080606@gmail.com> References: <46EFF244.9080606@gmail.com> Message-ID: <46F1F1FC.3090004@industrial-designers.co.uk> Dmitrii 'Mamut' Dimandt wrote: > I've received a question over at "Erlang in Russian" forum, > http://erlang.dmitriid.com/forum/topic/11 that reads: > " > I need to process a huge array of structures - about 60 million of them > in total. Each structure looks like this: {PID, type (atom), direct > (atom), index (Integer), nextind (Integer), prevind (Integer), position > (Integer)}. I think such a structure would take up about 50 bytes and > the entire array would then need 60 * 50 = 3 GB. 60 million * 50 bytes ~= 300 Mbytes. But that assumes that only one immutable copy of each of the 60 million structures is needed. -- David Hopwood From igwan@REDACTED Thu Sep 20 08:50:04 2007 From: igwan@REDACTED (igwan) Date: Thu, 20 Sep 2007 08:50:04 +0200 Subject: [erlang-questions] Programming Erlang Exercise 8.11 In-Reply-To: <575ee0d40709192229v6268e3bdo33a6d84847ed7209@mail.gmail.com> References: <575ee0d40709192229v6268e3bdo33a6d84847ed7209@mail.gmail.com> Message-ID: <46F2181C.3080000@free.fr> Hi, One solution would be to make the new spawned process call register/2 before calling Fun, but in this case you would use spawn_link instead of spawn to cause the process calling the start function to exit when the name is already registered : start(AnAtom, Fun) -> Fun2 = fun() -> register(AnAtom, self()), Fun() end, spawn_link(Fun2). igwan Charles Gordon a ?crit : > I'm new to Erlang and working my way through Joe Armstrong's > "Programming Erlang". I'm a little stumped by exercise 8.11, and I'm > hoping someone can give me a hint or two. Here is the full text of the > exercise for those of you without the book: > > "Write a function start(AnAtom, Fun) to register AnAtom as spawn(Fun). > Make sure your program works correctly in the case when two parallel > processes simultaneously evaluate start/2. In this case, you must > guarantee that one of these processes succeeds and the other fails." > > I think I understand the problem to mean that start(AnAtom, Fun) > should spawn(Fun) and then register the resulting Pid with AnAtom. > Here is my best shot at such a function: > > start(AnAtom, Fun) -> > case whereis(AnAtom) of > undefined -> > Pid = spawn(Fun), > register(AnAtom, Pid); > true -> > true > end. > > The problem didn't specify what the function should return after the > first call, so I'm just returning "true" (since that is what > "register/2" returns). The trouble I'm having is that I can't see how > this avoids a race condition. I don't understand what underlying > mechanisms ensure that two parallel processes calling this function > don't both evaluate "whereis(AnAtom)", both get "undefined" and both > spawn the process (and register it). The problem here is that whereis > and register seem to be accessing some sort of shared global state, > which is supposed to be impossible. At least, I think they are, since > I can't understand how else they would work. What am I missing here? > > Thanks! > Charles Gordon > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From qrilka@REDACTED Thu Sep 20 08:51:18 2007 From: qrilka@REDACTED (Kirill Zaborski) Date: Thu, 20 Sep 2007 10:51:18 +0400 Subject: [erlang-questions] Large array of data structures In-Reply-To: <46F1F1FC.3090004@industrial-designers.co.uk> References: <46EFF244.9080606@gmail.com> <46F1F1FC.3090004@industrial-designers.co.uk> Message-ID: <337538cb0709192351q22012018wc1830c2daf089bfc@mail.gmail.com> You've got somewhat strange arithmetic rules :) Best regards, Kirill. On 9/20/07, David Hopwood wrote: > > Dmitrii 'Mamut' Dimandt wrote: > > I've received a question over at "Erlang in Russian" forum, > > http://erlang.dmitriid.com/forum/topic/11 that reads: > > " > > I need to process a huge array of structures - about 60 million of them > > in total. Each structure looks like this: {PID, type (atom), direct > > (atom), index (Integer), nextind (Integer), prevind (Integer), position > > (Integer)}. I think such a structure would take up about 50 bytes and > > the entire array would then need 60 * 50 = 3 GB. > > 60 million * 50 bytes ~= 300 Mbytes. But that assumes that only one > immutable copy of each of the 60 million structures is needed. > > -- > David Hopwood > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From igwan@REDACTED Thu Sep 20 09:06:22 2007 From: igwan@REDACTED (igwan) Date: Thu, 20 Sep 2007 09:06:22 +0200 Subject: [erlang-questions] Programming Erlang Exercise 8.11 In-Reply-To: <46F2181C.3080000@free.fr> References: <575ee0d40709192229v6268e3bdo33a6d84847ed7209@mail.gmail.com> <46F2181C.3080000@free.fr> Message-ID: <46F21BEE.9010800@free.fr> Oops, forget it, I clicked on send too fast The function I proposed will not fail when calling it, but exit at a later time only when the second process happens to call register/2. I'm interested in a correct/atomic solution too :) igwan igwan a ?crit : > start(AnAtom, Fun) -> > Fun2 = fun() -> register(AnAtom, self()), Fun() end, > spawn_link(Fun2). > From bbmaj7@REDACTED Thu Sep 20 08:21:42 2007 From: bbmaj7@REDACTED (Richard Andrews) Date: Thu, 20 Sep 2007 16:21:42 +1000 (EST) Subject: [erlang-questions] can you boot slave nodes Message-ID: <917461.43806.qm@web52012.mail.re2.yahoo.com> Is it possible to pass "-boot /path/mysystem" as Arg to slave:start/3? When I pass a -boot param slave:start() doesn't return. If possible, I want to create a test controller which causes several other erlang nodes to be started with those nodes starting from boot files. The boot files work for normal start. ____________________________________________________________________________________ Sick of deleting your inbox? Yahoo!7 Mail has free unlimited storage. http://au.docs.yahoo.com/mail/unlimitedstorage.html From lenartlad@REDACTED Thu Sep 20 09:47:46 2007 From: lenartlad@REDACTED (Ladislav Lenart) Date: Thu, 20 Sep 2007 09:47:46 +0200 Subject: [erlang-questions] Programming Erlang Exercise 8.11 In-Reply-To: <46F21BEE.9010800@free.fr> References: <575ee0d40709192229v6268e3bdo33a6d84847ed7209@mail.gmail.com> <46F2181C.3080000@free.fr> <46F21BEE.9010800@free.fr> Message-ID: <46F225A2.30307@volny.cz> igwan wrote: > Oops, forget it, I clicked on send too fast > > The function I proposed will not fail when calling it, but exit at a > later time only when the second process happens to call register/2. > I'm interested in a correct/atomic solution too :) > > igwan > > igwan a ?crit : >> start(AnAtom, Fun) -> >> Fun2 = fun() -> register(AnAtom, self()), Fun() end, >> spawn_link(Fun2). Hello, and what about this: start(Atom, Fun) when is_atom(Atom), is_function(Fun, 0) -> Sender = self(), Fun2 = fun() -> case catch register(Atom, self()) of true -> Sender ! {started, self()}, Fun(); _ -> Sender ! {already_running, self()} end end, Pid = spawn(Fun2), receive {started, Pid} -> {ok, Pid}; {already_running, Pid} -> already_running end. Hope this helps, Ladislav Lenart From monch1962@REDACTED Thu Sep 20 10:07:25 2007 From: monch1962@REDACTED (David Mitchell) Date: Thu, 20 Sep 2007 18:07:25 +1000 Subject: [erlang-questions] Large array of data structures In-Reply-To: <46EFF244.9080606@gmail.com> References: <46EFF244.9080606@gmail.com> Message-ID: I guess the obvious response would be "use a database" for that quantity of data, but I can't see that you're going to get 2ms search times once you write it to disc. Pretty sure that limits you to RAM-only solutions. Anyone know how well mnesia scales up in that scenario? Regards Dave M. On 19/09/2007, Dmitrii 'Mamut' Dimandt wrote: > I've received a question over at "Erlang in Russian" forum, > http://erlang.dmitriid.com/forum/topic/11 that reads: > " > I need to process a huge array of structures - about 60 million of them > in total. Each structure looks like this: {PID, type (atom), direct > (atom), index (Integer), nextind (Integer), prevind (Integer), position > (Integer)}. I think such a structure would take up about 50 bytes and > the entire array would then need 60 * 50 = 3 GB. It means that the array > must be partly written to disk. In addition I need a fast access to PID, > index, nextind, prevind fields. Searching for a structure by these > fields should take about 2 microseconds, saving such a structure should > takle as much. Reading and writing is performed on the same structures > (about 30 000 of them) while the others simply wait. So the question is: > how can i implement such an array? > " > > > My guess is that (d)ets/mnesia could be involved, but that's all I know > :) Can anyone help? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From rrerlang@REDACTED Thu Sep 20 10:42:35 2007 From: rrerlang@REDACTED (Robert Raschke) Date: Thu, 20 Sep 2007 09:42:35 +0100 Subject: [erlang-questions] A new erlang book? In-Reply-To: <6fd0654b0709190801y368be8d2o4ecba25fa5124b97@mail.gmail.com> Message-ID: pat eyler wrote: > The other day, a publisher asked me what I thought about the > potential market for books on Functional Programming. As we > talked, it became obvious that they want to play in this space > and are looking for some feedback. It sounds like they want to > put out a (some) book(s) that are a little bit more advanced than > Joe's Programming Erlang, or the upcoming O'Reilly book on > Haskell without doing yet another dry, academic tome. I really, really liked the approach that Brian Kernighan and Rob Pike took in The Practice Of Programming, in that they did not restrict themselves to one language. A nice book on functional programming would use various languages, and use those to highlight things like how eager vs. lazy influences your programming style, similarly for static vs dynamic typing, and so on. But keeping it practical, showing the benefits of both ways. Robby From bengt.kleberg@REDACTED Thu Sep 20 07:17:06 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 20 Sep 2007 07:17:06 +0200 Subject: [erlang-questions] escript and define In-Reply-To: <1190216712.6757.19.camel@sz2.lan> References: <1190216712.6757.19.camel@sz2.lan> Message-ID: <46F20252.2070500@ericsson.com> greetings, could you live with a function? like this: #!/usr/bin/env escript foo() -> "hello world". main(_) ->io:fwrite("~s", [foo()]). note, this does not work if you want something that can be pattern matched. bengt Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." On 2007-09-19 17:45, Stefan Strigler wrote: > Hi there, > > is there a way to define constants in escript? I've tried with > > #!/usr/bin/env escript > > -define(FOO, "hello world"). > > main(_) -> > io:format("~s", [?FOO]). > > but no luck. > > Any help appreciated, > > Steve > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From sgolovan@REDACTED Thu Sep 20 12:58:11 2007 From: sgolovan@REDACTED (Sergei Golovan) Date: Thu, 20 Sep 2007 14:58:11 +0400 Subject: [erlang-questions] Testing reliable floating points exeption fails on x86? In-Reply-To: <200709191428.l8JESkUM009695@harpo.it.uu.se> References: <200709191428.l8JESkUM009695@harpo.it.uu.se> Message-ID: Mikael, Bjorn, thanks for the answers! I hope that I understand FPE in erlang better now. -- Sergei Golovan From bengt.kleberg@REDACTED Thu Sep 20 07:33:55 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 20 Sep 2007 07:33:55 +0200 Subject: [erlang-questions] escript and epmd In-Reply-To: <1190220168.6757.26.camel@sz2.lan> References: <1190220168.6757.26.camel@sz2.lan> Message-ID: <46F20643.9080207@ericsson.com> greetings, coulkd you live with another level of indirection? if you have a shell (ex: /bin/sh) script that checks epmd (epmd -names or similar) and then start your escript? bengt Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." On 2007-09-19 18:42, Stefan Strigler wrote: > Hi, next question :) > > How can I make sure that epmd is running when using escript. I want to > start a named node from within escript and ping some other node like > this: > > #!/usr/bin/env escript > > main(_) -> > net_kernel:start([foo, shortnames]), > erlang:set_cookie(some_random_cookie), > case net_adm:ping(some_other_node) of > pong -> ... > pang -> %% spawn some_other_node > ... > end. > > But if epmd isn't running already I get: > > =INFO REPORT==== 19-Sep-2007::18:50:36 === > Protocol: "inet_tcp": register error: {{badmatch,{error,econnrefused}}, > [{inet_tcp_dist,listen,1}, > {net_kernel,start_protos,4}, > {net_kernel,start_protos,3}, > {net_kernel,init_node,2}, > {net_kernel,init,1}, > {gen_server,init_it,6}, > {proc_lib,init_p,5}]} > escript: script failed with error reason function_clause > > > > Any help appreciated, Steve > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From adam@REDACTED Thu Sep 20 13:30:03 2007 From: adam@REDACTED (Adam Lindberg) Date: Thu, 20 Sep 2007 13:30:03 +0200 Subject: [erlang-questions] Why no ?FUNCTION macro Message-ID: <6344005f0709200430v412e92e3o10755bf7e1285e56@mail.gmail.com> Hi all! Why is there no ?FUNCTION macro? If it is possible to do ?MODULE and ?LINE it should be possible to do ?FUNCTION too? Cheers! Adam -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomasl_erlang@REDACTED Thu Sep 20 13:54:48 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Thu, 20 Sep 2007 04:54:48 -0700 (PDT) Subject: [erlang-questions] Erlounge Paris + seminar In-Reply-To: <0181C9CD-1A1A-47AF-B4C9-C2DE10F00C0B@gmail.com> Message-ID: <209261.51110.qm@web38802.mail.mud.yahoo.com> --- Joel Reymont wrote: > Thomas, > > On Sep 19, 2007, at 2:38 PM, Thomas Lindgren wrote: > > > The seminar currently has the provisional and > somewhat > > cryptic title, "Roadmap to Native-Space, > Native-Speed > > Numerical Computation in Erlang". > > Are there any papers on the subject for those of us > who cannot attend > the seminar? Sorry, no, not yet. Best, Thomas ____________________________________________________________________________________ Got a little couch potato? Check out fun summer activities for kids. http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz From richardc@REDACTED Thu Sep 20 14:34:29 2007 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 20 Sep 2007 14:34:29 +0200 Subject: [erlang-questions] Why no ?FUNCTION macro In-Reply-To: <6344005f0709200430v412e92e3o10755bf7e1285e56@mail.gmail.com> References: <6344005f0709200430v412e92e3o10755bf7e1285e56@mail.gmail.com> Message-ID: <46F268D5.7090504@it.uu.se> Adam Lindberg wrote: > Hi all! > > Why is there no ?FUNCTION macro? If it is possible to do ?MODULE and > ?LINE it should be possible to do ?FUNCTION too? Maybe it is possible, but it's not quite as simple, in any case. Note that these are preprocessor macros. ?LINE is trivial to keep track of during preprocessing, and the ?MODULE macro is only defined *after* the complete '-module(...).' declaration has been seen (also not hard to recognize during preprocessing), but for a function definition you would probably want it to be defined immediately after the leading " (" tokens, so you could write e.g. "foo(?FUNCTION, ...) ...". But at that point, it is perhaps not certain that what you are seeing is actually a function. To make sure, the preprocessor would have to be able to do rather a lot of real parsing (patterns and guards can be pretty complex) interleaved with preprocessor expansion. Or you could just say "what the heck", and define it as soon as you se " (" at the start of a declaration; I'm just not totally convinced that this would be a good idea; it smells like a hack to me. /Richard From akos.kutvolgyi@REDACTED Thu Sep 20 14:31:26 2007 From: akos.kutvolgyi@REDACTED (Akos kutvolgyi) Date: Thu, 20 Sep 2007 14:31:26 +0200 Subject: [erlang-questions] ODBC Connection Timeout Message-ID: <46F2681E.2020002@sei.hu> Hello ALL! I could not connect to mssql DB by erlang odbc module in Gentoo Linux. After odbc:connect(...) I have got Error Report with Timeout Reason. The Steps that I've taken. -Merged unixODBC Driver Manager v2.2.12 -Merged the freetds ODBC driver with odbc and mssql USE flags. v0.64 -Merged erlang with hipo,java,kpoll,odbc,smp,ssl and tk USE flags v11.2.5 -Configured odbc.ini and odbcinst.ini files. odbc.ini [ODBC Data Sources] MyDatabase = FREETDS SQLServer driver MYSQLPL = My SQL [MyDatabase] Driver = /usr/lib/libtdsodbc.so Description = SQL Server Server = ServerName\SQLEXPRESS Port = 1433 Language = Database = PresenceLog QuotedId = No AnsiNPW = No odbcins.ini [ODBC Drivers] FreeTDS = installed [FreeTDS] Description = FreeTDS ODBC Driver Driver = /usr/lib/libtdsodbc.so Threading = 0 FileUsage = 1 DontDLClose = 1 UsageCount = 1 Tested the connectivity to MSSQL database using "isql". Everything works. Seted the enviroments ODBCINI and ODBCSYSINI $ export ODBCINI=/etc/unixODBC/odbc.ini $ export ODBCSYSINI=/etc/unixODBC/ Try out sample. erl > application:start(odbc). > {ok, Ref} = odbc:connect("DSN=MyDatabase;UID=user;PWD=pwd", []). Get as output: {error,connection_closed} =ERROR REPORT==== 20-Sep-2007::14:16:58 === ** Generic server <0.38.0> terminating ** Last message in was {<0.31.0>, {connect,[1, 1, 2, 1, 1, "DSN=MyDatabase;UID=user;PWD=pwd"], on, on}, infinity} ** When Server state == {state,#Port<0.105>, {<0.31.0>,#Ref<0.0.0.68>}, <0.31.0>, undefined, on, undefined, undefined, on, connecting, undefined, 0, [#Port<0.103>,#Port<0.104>], undefined, undefined} ** Reason for termination == ** timeout I tried the DSN again via two little c program. DSN LIST: #include #include #include main() { SQLHENV env; char dsn[256]; char desc[256]; SQLSMALLINT dsn_ret; SQLSMALLINT desc_ret; SQLUSMALLINT direction; SQLRETURN ret; SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env); SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0); direction = SQL_FETCH_FIRST; while(SQL_SUCCEEDED(ret = SQLDataSources(env, direction, dsn, sizeof(dsn), &dsn_ret, desc, sizeof(desc), &desc_ret))) { direction = SQL_FETCH_NEXT; printf("%s - %s\n", dsn, desc); if (ret == SQL_SUCCESS_WITH_INFO) printf("\tdata truncation\n"); } } It founds both of my DSNs. Connection TEST by *Edmund Dengler* #include #include #include #include #include #include #define MAX_CONN_STR_OUT 1024 #define TIME_OUT 10 int main() { unsigned char *connStrIn = "DSN=MyDatabase;UID=user;PWD=pwd"; SQLCHAR connStrOut[MAX_CONN_STR_OUT]; SQLRETURN stringlength2ptr, result; SQLSMALLINT connlen; SQLHENV env; SQLHDBC connect; SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env); SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3, 0); SQLAllocHandle(SQL_HANDLE_DBC, env, &connect); SQLSetConnectAttr(connect, SQL_ATTR_CONNECTION_TIMEOUT, (SQLPOINTER)TIME_OUT, 0); SQLSetConnectAttr(connect, SQL_ATTR_AUTOCOMMIT, (SQLPOINTER)SQL_AUTOCOMMIT_ON, 0); SQLSetConnectAttr(connect, SQL_ATTR_TRACE, (SQLPOINTER)SQL_OPT_TRACE_OFF, 0); connlen = (SQLSMALLINT)strlen((const char*)connStrIn); printf("Connecting\n"); result = SQLDriverConnect(connect, NULL, (SQLCHAR *)connStrIn, connlen, connStrOut, (SQLSMALLINT)MAX_CONN_STR_OUT, &stringlength2ptr, SQL_DRIVER_NOPROMPT); printf("Done (%d)\n", result); } The result was SQL_SUCCESS If anybody has any ideas, they would be greatly appreciated! -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomasl_erlang@REDACTED Thu Sep 20 14:05:45 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Thu, 20 Sep 2007 05:05:45 -0700 (PDT) Subject: [erlang-questions] Why no ?FUNCTION macro In-Reply-To: <6344005f0709200430v412e92e3o10755bf7e1285e56@mail.gmail.com> Message-ID: <366192.19165.qm@web38801.mail.mud.yahoo.com> --- Adam Lindberg wrote: > Hi all! > > Why is there no ?FUNCTION macro? If it is possible > to do ?MODULE and ?LINE > it should be possible to do ?FUNCTION too? Well, you then have to know whether you're in a function or not during macro expansion (and which one, of course). So it doesn't fit as easily as ?MODULE or ?LINE. But for what it's worth, I've certainly been annoyed at the lack of ?FUNCTION too. So please add it, macro hackers! Best, Thomas ____________________________________________________________________________________ Check out the hottest 2008 models today at Yahoo! Autos. http://autos.yahoo.com/new_cars.html From tobbe@REDACTED Thu Sep 20 15:17:36 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Thu, 20 Sep 2007 15:17:36 +0200 Subject: [erlang-questions] Why no ?FUNCTION macro In-Reply-To: <6344005f0709200430v412e92e3o10755bf7e1285e56@mail.gmail.com> References: <6344005f0709200430v412e92e3o10755bf7e1285e56@mail.gmail.com> Message-ID: Adam Lindberg wrote: > Hi all! > > Why is there no ?FUNCTION macro? If it is possible to do ?MODULE and > ?LINE it should be possible to do ?FUNCTION too? > > Cheers! > Adam > I think there exist a solution in the XX user contrib package: http://forum.trapexit.org/viewtopic.php?t=9357 NB: It is very old and may need to be tweaked to still run. Cheers, Tobbe From eokyere@REDACTED Thu Sep 20 15:39:20 2007 From: eokyere@REDACTED (Emmanuel Okyere) Date: Thu, 20 Sep 2007 09:39:20 -0400 Subject: [erlang-questions] I would never use python (was: separators before end) In-Reply-To: References: Message-ID: On 19 Sep 2007, at 19:48, erlang-questions-request@REDACTED wrote: > i would never use python because > only idiot - sorry, Guido - would use whitespace in other way than as > word-separator. I'm willing to accept any sensible community > standard for > indentation, but this is whitespace fascism ;-). I have said "I would never use Python" before; but then, my opinion was misinformed at best. Might be different in your case, but I doubt it. cheers, Emmanuel --- SYLLOGISM, n. A logical formula consisting of a major and a minor assumption and an inconsequent. (See LOGIC.) ? Devil's Dictionary -------------- next part -------------- An HTML attachment was scrubbed... URL: From bjorn@REDACTED Thu Sep 20 14:40:40 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 20 Sep 2007 14:40:40 +0200 Subject: [erlang-questions] Why no ?FUNCTION macro In-Reply-To: <6344005f0709200430v412e92e3o10755bf7e1285e56@mail.gmail.com> References: <6344005f0709200430v412e92e3o10755bf7e1285e56@mail.gmail.com> Message-ID: "Adam Lindberg" writes: > Hi all! > > Why is there no ?FUNCTION macro? If it is possible to do ?MODULE and ?LINE > it should be possible to do ?FUNCTION too? The pre-processor that defines macros knows nothing about Erlang syntax and has no idea about which the current function is. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From gbulmer@REDACTED Thu Sep 20 16:35:55 2007 From: gbulmer@REDACTED (G Bulmer) Date: Thu, 20 Sep 2007 15:35:55 +0100 Subject: [erlang-questions] Why no ?FUNCTION macro Message-ID: Adam I'm just curious, but is the requirement to get an atom (or string) as a macro expansion, e.g. available at compile time, or would it be okay if it were available from a function at run-time (where you could also use the full power of Erlang to manipulate the value)? As Richard Carlsson explained, knowing the function name at pre- processor time may be quite difficult. Further, it may have no obvious meaning for anonymous fun's (lambda expressions). Specifically, I'm curious to know if you need to use the function name value in debug-style messages (and hence as late as run-time may be okay), or whether you really need to do something during pre- processor or compile time (e.g. like C tokenising to build lexically new names). As I said, this is only curiosity, but if the need is a run-time name, maybe an ingenious function to dig through the stack trace returned by erlang:get_stacktrace() would be workable. I was looking at Joe's Book at try_test.erl in section 4.9 which gives a way to get this information. I realise this is a bit ugly, but I haven't found how to get a stack trace *without* generating an exception. On the basis that the information appears to be available at run-time to erlang:get_stacktrace(), then maybe there is a way to get it without generating an exception, and I'd like to know. If not available now, it does look like a candidate for a future release, and I'd be happy with a run time function, but I realise that may be inadequate for your need. Garry > Date: Thu, 20 Sep 2007 13:30:03 +0200 > From: "Adam Lindberg" > Subject: [erlang-questions] Why no ?FUNCTION macro > ... > Why is there no ?FUNCTION macro? If it is possible to do ?MODULE > and ?LINE > it should be possible to do ?FUNCTION too? > > Cheers! > Adam From bahram.erlang@REDACTED Thu Sep 20 17:05:56 2007 From: bahram.erlang@REDACTED (Bahram Bahar) Date: Thu, 20 Sep 2007 17:05:56 +0200 Subject: [erlang-questions] Vector and matrix libraries Message-ID: <5d17d1a50709200805k4ab828c7y5a1af7870ef61225@mail.gmail.com> Hi all Two years ago I was involved in programming an assisted GPS (A-GPS) system in Erlang during a project at Uppsala University. During the development process I was forced to design a matrix and a vector library for the GPS position calculation sub-system. I was wondering if there is any interest from Erlang.org to review and possibly incorporate these two libraries into Erlang/OTP. Best Regards Bahram -------------- next part -------------- An HTML attachment was scrubbed... URL: From dbt@REDACTED Thu Sep 20 17:13:37 2007 From: dbt@REDACTED (David Terrell) Date: Thu, 20 Sep 2007 10:13:37 -0500 Subject: [erlang-questions] separators before end In-Reply-To: <330602700709191644k2b7b4257s8bce8b4f8821bb68@mail.gmail.com> References: <00f801c7fadf$87941b70$891ea8c0@SSI.CORP> <9b08084c0709191244r6f617d78r705f109fdc048e96@mail.gmail.com> <330602700709191407s99b89bbvf55a860d0a1a6a1@mail.gmail.com> <330602700709191536o48522063j1abf595879c7cde@mail.gmail.com> <330602700709191644k2b7b4257s8bce8b4f8821bb68@mail.gmail.com> Message-ID: <20070920151337.GJ18483@sphinx.chicagopeoplez.org> On Thu, Sep 20, 2007 at 01:44:41AM +0200, Minsloc Tarren wrote: > > depends on the individual as with everything. for me, reading that it is > separator was enough, as separator logically separates two things. > > In python's case, the only people who complain about whitespace are people > > who haven't used it (although they usually don't go as far as to call the > > creator an idiot on a completely unrelated list). > > > > it's a matter of taste. and sorry, maybe i'm not weighting words, but if i > find some decision idiotic, i'm not afraid/ashamed to say so. And I've encountered people who refuse to use erlang because of the atom/Variable thing. Teaching your brain to be able to switch idioms is good for it. I suggest you try it more often. -- David Terrell dbt@REDACTED ((meatspace)) http://meat.net/ From coderplay@REDACTED Thu Sep 20 18:03:12 2007 From: coderplay@REDACTED (Jeremy Chow) Date: Fri, 21 Sep 2007 00:03:12 +0800 Subject: [erlang-questions] why each erlang process sets 233 words as its default heap size? Message-ID: Hi all, My first instinction is that it want to club together with one process size to reach exactly 1024 bytes . But each process has more than 1024/4 -233 = 23 words size . What's the author's original intention? why each erlang process sets 233 words as its default heap size? Thx, Jeremy -------------- next part -------------- An HTML attachment was scrubbed... URL: From dot@REDACTED Thu Sep 20 18:12:27 2007 From: dot@REDACTED (Tony Finch) Date: Thu, 20 Sep 2007 17:12:27 +0100 Subject: [erlang-questions] separators before end In-Reply-To: <3dbc6d1c0709191446ye8fa384q56cde8ea757e8092@mail.gmail.com> References: <00f801c7fadf$87941b70$891ea8c0@SSI.CORP> <9b08084c0709191244r6f617d78r705f109fdc048e96@mail.gmail.com> <330602700709191407s99b89bbvf55a860d0a1a6a1@mail.gmail.com> <3dbc6d1c0709191446ye8fa384q56cde8ea757e8092@mail.gmail.com> Message-ID: On Wed, 19 Sep 2007, Robert Virding wrote: > This is, of course, the correct observation, ; and , are separators not > terminators. > > If these were GOOD choices is a completely different matter. I personally am > so used to it that it is not a problem and I don't really see the problem. > :-) I don't think it would hurt to allow programmers to write ;end. See Bertrand Meyer's dicussion of the topic on p.11 of http://se.ethz.ch/~meyer/publications/oxford-hoare/evolution.pdf Tony. -- f.a.n.finch http://dotat.at/ IRISH SEA: SOUTHERLY, BACKING NORTHEASTERLY FOR A TIME, 3 OR 4. SLIGHT OR MODERATE. SHOWERS. MODERATE OR GOOD, OCCASIONALLY POOR. From dmercer@REDACTED Thu Sep 20 18:16:36 2007 From: dmercer@REDACTED (David Mercer) Date: Thu, 20 Sep 2007 11:16:36 -0500 Subject: [erlang-questions] separators before end In-Reply-To: <20070920151337.GJ18483@sphinx.chicagopeoplez.org> References: <00f801c7fadf$87941b70$891ea8c0@SSI.CORP><9b08084c0709191244r6f617d78r705f109fdc048e96@mail.gmail.com><330602700709191407s99b89bbvf55a860d0a1a6a1@mail.gmail.com><330602700709191536o48522063j1abf595879c7cde@mail.gmail.com><330602700709191644k2b7b4257s8bce8b4f8821bb68@mail.gmail.com> <20070920151337.GJ18483@sphinx.chicagopeoplez.org> Message-ID: <016b01c7fba1$9f3d4e50$891ea8c0@SSI.CORP> > And I've encountered people who refuse to use erlang because of the > atom/Variable thing. Teaching your brain to be able to switch idioms > is good for it. I suggest you try it more often. I agree. That sort of thinking has kept Lisp out of the mainstream. All sorts of things *I* would have designed differently with the Erlang language. However, I certainly don't think we should destabilize a successful language to suit my personal preferences, particularly as I am not the one who would program any of the changes. Unless I'm willing to sit down and write my own language (Mercerlang?), I suppose I'll take what the Swedes give me and be thankful. The big winner for the language is that it has been used to develop extremely reliable systems. If I have to wade through some non-Lisp-like or non-C-like syntax to get that, I think I can manage, and not whine *too* much. I'd have designed English differently, too. Cheers, David -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of David Terrell Sent: Thursday, September 20, 2007 10:14 To: Minsloc Tarren Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] separators before end On Thu, Sep 20, 2007 at 01:44:41AM +0200, Minsloc Tarren wrote: > > depends on the individual as with everything. for me, reading that it is > separator was enough, as separator logically separates two things. > > In python's case, the only people who complain about whitespace are people > > who haven't used it (although they usually don't go as far as to call the > > creator an idiot on a completely unrelated list). > > > > it's a matter of taste. and sorry, maybe i'm not weighting words, but if i > find some decision idiotic, i'm not afraid/ashamed to say so. And I've encountered people who refuse to use erlang because of the atom/Variable thing. Teaching your brain to be able to switch idioms is good for it. I suggest you try it more often. -- David Terrell dbt@REDACTED ((meatspace)) http://meat.net/ _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From dking@REDACTED Thu Sep 20 19:39:01 2007 From: dking@REDACTED (David King) Date: Thu, 20 Sep 2007 10:39:01 -0700 Subject: [erlang-questions] separators before end In-Reply-To: <330602700709191536o48522063j1abf595879c7cde@mail.gmail.com> References: <00f801c7fadf$87941b70$891ea8c0@SSI.CORP> <9b08084c0709191244r6f617d78r705f109fdc048e96@mail.gmail.com> <330602700709191407s99b89bbvf55a860d0a1a6a1@mail.gmail.com> <330602700709191536o48522063j1abf595879c7cde@mail.gmail.com> Message-ID: <8D2FD4EE-6E8A-4E7D-B240-CBC7DB9B3A36@ketralnis.com> > *1) i really liked ruby in that matter, and i would never use > python because only idiot - sorry, Guido - would use whitespace in > other way than as word-separator. I'm willing to accept any > sensible community standard for indentation, but this is whitespace > fascism ;-). Ruby uses whitespace (newlines) to delimit expressions From hughperkins@REDACTED Thu Sep 20 20:23:56 2007 From: hughperkins@REDACTED (Hugh Perkins) Date: Thu, 20 Sep 2007 20:23:56 +0200 Subject: [erlang-questions] Representation of a map in bytecode? In-Reply-To: <9b08084c0709191300s559d752pa7a9c479ce39fb54@mail.gmail.com> References: <837db430709142102h77a4799foe5820f3dc3ca7aab@mail.gmail.com> <1190028723.5212.11.camel@adic.fmi.fi> <3dbc6d1c0709171418r6ad7929el1142721f81239a31@mail.gmail.com> <837db430709171955q28c6c723yc2192a47a1c050fc@mail.gmail.com> <7F3F9077-DFC4-41D2-BA32-A211808AD9C8@cs.otago.ac.nz> <9b08084c0709191300s559d752pa7a9c479ce39fb54@mail.gmail.com> Message-ID: <837db430709201123vea816fbmb758960bf393a5d9@mail.gmail.com> Wow, Joe has replied in my thread. That's cool :-) I guess really we're never going to know for sure until we've got some 64-cores to play with. I kindof tend to use real-world analogies to solve programming problems. Maybe this is why I always hated quantum physics where this isnt possible. In the real-world, a manager will assign tasks to people, then follow up how the tasks are going. Any tasks that are taking a while will be shared among several people. People who finish their tasks sooner will be given new tasks. The manager doesnt need to know how the tasks are actually done, or need any prior knowledge of how long a task will take. So, switching back to threading, I kindof see it like you have a supervisor process which watches the processes around it. When there are cores free, it looks at which processes are (a) taking a while, and (b) running some kind of parallelisable task (map, fold of associative function, etc ...), and shares that task out among the available cores. In a later version, one could imagine that the supervisor process can memorize (cache) which bits of the program tended to need parallelizing out, so that in the future it proactively parallelizes them out right off the bat. "but everything ends up being choked by a serial bottleneck". Well, in the real-world tasks can be shared among thousands of people successfully, in various ways. "what about books, theyre always written by one person right?" In the case of books, we take a "mud sticks" strategy in the real world. Many people write books, and a few of them turn out to be really good. Parallelizing is only hard when you seek to run at close to 100% of the single-core efficiency. If one is willing to allow for a lot of wastage, maybe each thread is only 10% as efficient as in a single-threaded application, it's maybe easy to share among thousands of cores? From erik.stenman@REDACTED Thu Sep 20 20:25:29 2007 From: erik.stenman@REDACTED (Erik Stenman) Date: Thu, 20 Sep 2007 20:25:29 +0200 Subject: [erlang-questions] why each erlang process sets 233 words as its default heap size? In-Reply-To: References: Message-ID: On 20 sep 2007, at 18.03, Jeremy Chow wrote: > Hi all, > My first instinction is that it want to club together with > one process size to reach exactly 1024 bytes . But each process > has more than 1024/4 -233 = 23 words size . > What's the author's original intention? why each erlang > process sets 233 words as its default heap size? The Erlang runtime system allocates memory for a process in increments of Fibonacci numbers. The rational is apparently that memory usage has a tendency to grow like the Fibonacci numbers, whether this really pays off is questionable but the code has been kept. 233 is a reasonably sized Fibonacci number and seems seemingly randomly chosen as a good initial start size. /Erik Stenman From olopierpa@REDACTED Thu Sep 20 20:30:07 2007 From: olopierpa@REDACTED (Pierpaolo Bernardi) Date: Thu, 20 Sep 2007 20:30:07 +0200 Subject: [erlang-questions] why each erlang process sets 233 words as its default heap size? In-Reply-To: References: Message-ID: <7352e43a0709201130l5455ee22mc3047795d3439012@mail.gmail.com> On 9/20/07, Jeremy Chow wrote: > Hi all, > My first instinction is that it want to club together with one process > size to reach exactly 1024 bytes . But each process has more than 1024/4 > -233 = 23 words size . > What's the author's original intention? why each erlang process sets > 233 words as its default heap size? The heap size is a fibonacci number. Maybe 233 is the smallest fibonacci number that allows to do something useful. The sequence is: ... 89 144 233 377 610 ... P. From smangano@REDACTED Thu Sep 20 19:41:48 2007 From: smangano@REDACTED (Salvatore Mangano) Date: Thu, 20 Sep 2007 13:41:48 -0400 Subject: [erlang-questions] A new erlang book? In-Reply-To: References: <6fd0654b0709190801y368be8d2o4ecba25fa5124b97@mail.gmail.com> Message-ID: <012d01c7fbad$870a6d70$d90ac246@Turing> I am two chapters into writing a new book on Erlang. There will inevitably be some overlap with Joe's book because I want to make it stand by itself. However, the main emphasis is on using Erlang to develop large projects where concurrency and fault tolerance are crucial. I plan to use financial trading as my example domain. I will have greater coverage of the various pieces of the Erlang stack (Yaws, Rabbit MQ, Mnesia, My SQL interfacing, etc.) There will also emphasis on development of unit tests. I would love to hear what subscribers to this list want to see in a new book. I am also looking for people who would like to be technical editors. Please email me off list. -Sal Mangano smangano (at) into-technology (dot) com -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Robert Raschke Sent: Thursday, September 20, 2007 4:43 AM To: erlang-questions@REDACTED Subject: Re: [erlang-questions] A new erlang book? pat eyler wrote: > The other day, a publisher asked me what I thought about the > potential market for books on Functional Programming. As we > talked, it became obvious that they want to play in this space > and are looking for some feedback. It sounds like they want to > put out a (some) book(s) that are a little bit more advanced than > Joe's Programming Erlang, or the upcoming O'Reilly book on > Haskell without doing yet another dry, academic tome. I really, really liked the approach that Brian Kernighan and Rob Pike took in The Practice Of Programming, in that they did not restrict themselves to one language. A nice book on functional programming would use various languages, and use those to highlight things like how eager vs. lazy influences your programming style, similarly for static vs dynamic typing, and so on. But keeping it practical, showing the benefits of both ways. Robby _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From fredrik.svahn@REDACTED Thu Sep 20 20:46:53 2007 From: fredrik.svahn@REDACTED (Fredrik Svahn) Date: Thu, 20 Sep 2007 20:46:53 +0200 Subject: [erlang-questions] escript and epmd In-Reply-To: <1190220168.6757.26.camel@sz2.lan> References: <1190220168.6757.26.camel@sz2.lan> Message-ID: Perhaps something on the lines of: #!/usr/bin/env escript main(_) -> os:cmd("epmd&"), net_kernel:start([foo, shortnames]), erlang:set_cookie(node(), foo), case net_adm:ping( some_other_node@REDACTED) of pong -> io:format("~p~n",[nodes()]); pang -> io:format("nok~n") end. BR /Fredrik On 9/19/07, Stefan Strigler wrote: > > Hi, next question :) > > How can I make sure that epmd is running when using escript. I want to > start a named node from within escript and ping some other node like > this: > > #!/usr/bin/env escript > > main(_) -> > net_kernel:start([foo, shortnames]), > erlang:set_cookie(some_random_cookie), > case net_adm:ping(some_other_node) of > pong -> ... > pang -> %% spawn some_other_node > ... > end. > > But if epmd isn't running already I get: > > =INFO REPORT==== 19-Sep-2007::18:50:36 === > Protocol: "inet_tcp": register error: {{badmatch,{error,econnrefused}}, > [{inet_tcp_dist,listen,1}, > {net_kernel,start_protos,4}, > {net_kernel,start_protos,3}, > {net_kernel,init_node,2}, > {net_kernel,init,1}, > {gen_server,init_it,6}, > {proc_lib,init_p,5}]} > escript: script failed with error reason function_clause > > > > Any help appreciated, Steve > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From charles.gordon@REDACTED Thu Sep 20 21:30:18 2007 From: charles.gordon@REDACTED (Charles Gordon) Date: Thu, 20 Sep 2007 12:30:18 -0700 Subject: [erlang-questions] Programming Erlang Exercise 8.11 Message-ID: <575ee0d40709201230s24f29db8n70d1d3902dd7f5c1@mail.gmail.com> > From: Ladislav Lenart > > start(Atom, Fun) when is_atom(Atom), is_function(Fun, 0) -> > Sender = self(), > Fun2 = fun() -> > case catch register(Atom, self()) of > true -> > Sender ! {started, self()}, > Fun(); > _ -> > Sender ! {already_running, self()} > end > end, > Pid = spawn(Fun2), > receive > {started, Pid} -> > {ok, Pid}; > {already_running, Pid} -> > already_running > end. Thanks Ladislav, this seems to be the correct solution to the problem. Thanks also to Chris Newcombe who patiently explained to me how this works. For the future readers of this list, I'll reproduce my understanding of it here. The key insight I was missing is that "register/2" does an atomic test-and-set, so it will only register a given atom once, regardless of how it is called (and how many processes try concurrently). My original solution had the obvious race condition between the "whereis/1" and "register/2" calls. Just getting rid of the call to "whereis/1" wouldn't fix the problem, since you would have already spawned the process by the time you realized someone else had beaten you to registering it. Ladislav's solution starts a process every time "start/2" is called and then has that function register itself. If it succeeds, it runs the original fun, so now the registered atom is linked to the original fun (as the problem requires). I assumed this meant that the "register/2" BIF was keeping some global shared state that was also accessible via "whereis/1". Chris explained that a better way to look at it, in Erlang, is that register/2 acts as a server for some state (in this case, the registered atoms) and is able to atomically update that state when called by clients. So you can think of it as having a serialized queue of requests and responding to them in order. I'm not sure if that is how it is actually implemented, but it makes sense (to me) to think of it that way. Any mistakes in the above explanation are definitely mine! Thanks again, Charles Gordon -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.hopwood@REDACTED Thu Sep 20 21:42:12 2007 From: david.hopwood@REDACTED (David Hopwood) Date: Thu, 20 Sep 2007 20:42:12 +0100 Subject: [erlang-questions] Large array of data structures In-Reply-To: <337538cb0709192351q22012018wc1830c2daf089bfc@mail.gmail.com> References: <46EFF244.9080606@gmail.com> <46F1F1FC.3090004@industrial-designers.co.uk> <337538cb0709192351q22012018wc1830c2daf089bfc@mail.gmail.com> Message-ID: <46F2CD14.7000303@industrial-designers.co.uk> Kirill Zaborski wrote: > You've got somewhat strange arithmetic rules :) Oops, so I have. Must have been too early in the morning. -- David Hopwood From david.hopwood@REDACTED Thu Sep 20 21:58:01 2007 From: david.hopwood@REDACTED (David Hopwood) Date: Thu, 20 Sep 2007 20:58:01 +0100 Subject: [erlang-questions] Testing reliable floating points exeption fails on x86? In-Reply-To: <200709191230.l8JCUgEv008118@harpo.it.uu.se> References: <200709191230.l8JCUgEv008118@harpo.it.uu.se> Message-ID: <46F2D0C9.70007@industrial-designers.co.uk> Mikael Pettersson wrote: > On Wed, 19 Sep 2007 15:29:28 +0400, Sergei Golovan wrote: >> Could someone explain me what 'reliable floating points exceptions' >> are and how their reliability is checked? > > The ability to program the FPU so that e.g. overflows are reported > as signals instead of as +inf. > >> I'm packaging erlang/OTP for Debian GNU/Linux using two erlang >> flavours: with and without HiPE (HiPE enabled architectures are i386 >> (x86), amd64 (x86_64), powerpc and sparc). If I understand correctly, >> HiPE refuses to build if floating points exceptions are unreliable. > > Correct for x86-32, x86-64, ppc32, and sparc32. > HiPE doesn't require FP exceptions on ARMv5b. > >> I built erlang on x86 architecture many times and test for reliable fp >> exceptions never failed. But recently I've got a bugreport >> (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=442965) where the >> test fails. >> >> 1) Could it be that the test fails due to false negative (probably >> because it was run on x86_64 hardware, though I never managed to get >> it failed using both 32-bit and 64-bit kernel with 32-bit userland)? > > There's no information in that Debian bug report apart from "it failed". There is if you look at the referenced build log, at . The command that fails is this link: gcc -o /build/user/erlang-11.b.5dfsg/bin/i686-pc-linux-gnu/beam.hybrid \ -Wl,-export-dynamic obj/i686-pc-linux-gnu/opt/hybrid/erl_main.o [... long list of object files snipped ...] obj/i686-pc-linux-gnu/opt/hybrid/ttsl_drv.o -lutil -ldl -lm -lpthread -lncurses -L../lib/internal/i686-pc-linux-gnu /build/user/erlang-11.b.5dfsg/erts/obj/i686-pc-linux-gnu/libz.a -lethread -lpthread -lerts_internal_r -lrt obj/i686-pc-linux-gnu/opt/hybrid/hipe_x86_bifs.o: In function `nbif_handle_fp_exception': /build/user/erlang-11.b.5dfsg/erts/emulator/i686-pc-linux-gnu/opt/hybrid/hipe_x86_bifs.S:278: undefined reference to `erts_restore_fpu' -- David Hopwood From sgolovan@REDACTED Thu Sep 20 22:07:27 2007 From: sgolovan@REDACTED (Sergei Golovan) Date: Fri, 21 Sep 2007 00:07:27 +0400 Subject: [erlang-questions] Testing reliable floating points exeption fails on x86? In-Reply-To: <46F2D0C9.70007@industrial-designers.co.uk> References: <200709191230.l8JCUgEv008118@harpo.it.uu.se> <46F2D0C9.70007@industrial-designers.co.uk> Message-ID: On 9/20/07, David Hopwood wrote: > Mikael Pettersson wrote: > > > > There's no information in that Debian bug report apart from "it failed". > > There is if you look at the referenced build log, at > . > > The command that fails is this link: It's a symptom. If you try to build erlang with HiPE and the FP are unreliable, you'll get this. So, the build log doesn't show what the actual error is. BTW, the man who reported this bug can't reproduce it again. Looks strange. -- Sergei Golovan From dave.rafkind@REDACTED Thu Sep 20 22:06:46 2007 From: dave.rafkind@REDACTED (Dave Rafkind) Date: Thu, 20 Sep 2007 16:06:46 -0400 Subject: [erlang-questions] Building a Non-blocking TCP server using OTP principles In-Reply-To: <4bd555f70708171304w23f3d4d2r3b7fc986c12cfb19@mail.gmail.com> References: <4bd555f70708162059g4e8449dcsa21820b0fd2a284a@mail.gmail.com> <46C59CDD.3020200@gmail.com> <4bd555f70708171304w23f3d4d2r3b7fc986c12cfb19@mail.gmail.com> Message-ID: <2ae2b2da0709201306j5852fa34o26e88497d3f7de11@mail.gmail.com> Just to bring this back up again, I looked at ejabberd_listener.erl and as far as I can tell, the strategy is to have a "master acceptor" supervisor that babysits some processes doing gen_tcp:listen() and gen_tcp:accept(), in a "normal" blocking manner. When each worker's gen_tcp:accept() returns with a client socket, the socket is then passed along to a separate "controller" process (supervised by something else) and the worker goes back to accepting. Does the fact that the worker processes are properly supervised and can be administrated through supervision make this an "officially safe" way to have a non-blocking tcp server? On 8/17/07, Samuel Tesla wrote: > > I suppose the question really becomes, then, how can you write a TCPserver using the documented APIs of Erlang/OTP that you can reasonably > expect to remain the same between releases? > > The APIs in prim_inet aren't intended to be used. They can change between > releases and that will cause problems with the original code you posted as > well. Whereas a solution that uses the functions exported from gen_tcp can > be expected to survive upgrades to the OTP environment. > > I'm currently looking at ejabberd to see how they do things, as they > manage a jabber server with only gen_tcp. > > -- Samuel > > On 8/17/07, Serge Aleynikov wrote: > > > > Samuel, > > > > Thanks for your input. I reviewed your modifications and have to say > > that there are several problems with this approach. > > > > 1. Not doing asynchronous accept and relying on a separate process to > > accept connections may be *dangerous* if not handled properly as it > > introduces race conditions that could potentially block the server > > permanently. > > > > Here's an important quote from ACE book "C++ Network Programming Vol.1": > > > > "When an acceptor socket is passed to select(), it's marked as "active" > > when a connection is received. Many servers use this event to indicate > > that it's OK to call accept() without blocking. Unfortunately, there's a > > race condition that stems from the asynchronous behavior of TCP/IP In > > particular, after select() indicates an acceptor socket is active (but > > before accept() is called) a client can close its connection, whereupon > > accept() can block and potentially hang the entire application process. > > To avoid this problem, acceptor sockets should always be set into > > non-blocking mode when used with select()." > > > > This applies to your changes indirectly. Under the hood of the network > > driver, it still does the asynchronous accept, so the paragraph above > > doesn't apply at the driver level. However, there may be a failure > > between these two lines in the init/1: > > > > {ok, Ref} = create_acceptor(Listen_socket), > > {ok, #state{listener = Listen_socket, > > acceptor = Ref, > > module = Module}}; > > > > due to various reasons and despite the fact that it was linked, the > > {'EXIT', Pid, Reason} message is presently not handled (trap_exit though > > > > is turned on), so the process will be locked forever. > > > > The same can happen if the acceptor process dies anywhere in the middle > > of the F() function: > > > > F = fun() -> > > {ok, Socket} = gen_tcp:accept(Listener), > > gen_tcp:controlling_process(Socket, Self), > > gen_server:call(Self, {accept, Socket}) > > end, > > > > As mentioned above, this can likely be fixed by proper handling of the > > {'EXIT', Pid, Reason} and respawning acceptor when it happens. This, > > however presents another challenge - what if the system runs out of file > > descriptors - your listener process will be in an unhappy more of > > constantly respawning acceptors that will die because of this line: > > > > {ok, Socket} = gen_tcp:accept(Listener) > > > > So you would need to monitor how many accept failures you got in the > > last several seconds and do some intelligent recovery. This would > > complicate code by quite a bit. > > > > 2. This new process is not OTP compliant - no supervisors know about it > > and it doesn't process debug and system messages as per "6.2 Special > > Processes" of Design Principles. This means that you may have problems > > when you upgrade your system dynamically. > > > > Partly these are some of the reasons I put together this tutorial to > > show how to avoid such problems all together. :-) > > > > I hope you will find this feedback useful. > > > > Regards, > > > > Serge > > > > > > Samuel Tesla wrote: > > > Serge, > > > > > > I really got a lot from your guide on building TCP servers. I really > > > appreciate the work you put into it. I think I've got an improvement > > that > > > you may want to consider putting up on the website. > > > > > > I wanted to read documentation for prim_inet:async_accept/2 so I could > > > figure out what that -1 was for, and couldn't find any > > documentation. So, I > > > Googled and discovered that there is no documentation on purpose ( > > > http://www.trapexit.org/forum/viewtopic.php?p=29157). Basically, it's > > not a > > > guaranteed API between versions, whereas gen_tcp is. So, I set out to > > see > > > if I could use gen_tcp:accept/1 instead of prim_inet:async_accept/2, > > and I > > > was successful. > > > > > > I copied your source off the website and then made modifications. I > > only > > > had to change the listener and the FSM modules, and I've attached the > > > altered source files. The gist of what I did was spawn a linked > > process > > > which does the accept, and then sends a call back to the main listener > > > > > process. The whole sequence until the control has to be synchronous > > until > > > the FSM gets into WAIT_FOR_DATA or the socket will disconnect and > > you'll > > > start getting posix errors. > > > > > > There were a few other things I cleaned up or changed: > > > * You don't need to copy socket options, as accept/1 does that. > > > * You don't need to call gen_tcp:close/1 in terminate/2 as the > > listening > > > socket will close when its controlling process exits. > > > * I set {packet, 0} as I was testing with a raw telnet session. > > > > > > I hope you find this helpful! > > > > > > -- Samuel > > > > > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fritchie@REDACTED Thu Sep 20 23:04:02 2007 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Thu, 20 Sep 2007 16:04:02 -0500 Subject: [erlang-questions] Large array of data structures In-Reply-To: Message of "Thu, 20 Sep 2007 18:07:25 +1000." Message-ID: <200709202104.l8KL4253053918@snookles.snookles.com> >>>>> "dm" == David Mitchell writes: dm> Anyone know how well mnesia scales up in that scenario? As someone who regularly uses test cases where the environment crams 7-9GB into Mnesia 'disc_copies' tables, I'd have to say "quite well". -Scott P.S. On machines with 16GB RAM, that is. I don't recommend doing that with machines less than 12GB. -s From dbt@REDACTED Thu Sep 20 23:53:59 2007 From: dbt@REDACTED (David Terrell) Date: Thu, 20 Sep 2007 16:53:59 -0500 Subject: [erlang-questions] Building a Non-blocking TCP server using OTP principles In-Reply-To: <2ae2b2da0709201306j5852fa34o26e88497d3f7de11@mail.gmail.com> References: <4bd555f70708162059g4e8449dcsa21820b0fd2a284a@mail.gmail.com> <46C59CDD.3020200@gmail.com> <4bd555f70708171304w23f3d4d2r3b7fc986c12cfb19@mail.gmail.com> <2ae2b2da0709201306j5852fa34o26e88497d3f7de11@mail.gmail.com> Message-ID: <20070920215359.GB14841@sphinx.chicagopeoplez.org> On Thu, Sep 20, 2007 at 04:06:46PM -0400, Dave Rafkind wrote: > Just to bring this back up again, I looked at ejabberd_listener.erl and as > far as I can tell, > the strategy is to have a "master acceptor" supervisor that babysits some > processes doing gen_tcp:listen() and gen_tcp:accept(), in a "normal" > blocking manner. > > When each worker's gen_tcp:accept() returns with a client socket, the socket > is then passed along to a separate "controller" process (supervised by > something else) and the worker goes back to accepting. > > Does the fact that the worker processes are properly supervised and can be > administrated through supervision make this an "officially safe" way to have > a non-blocking tcp server? The problem with doing a blocking gen_tcp:accept() is that it prevents you from doing code reloading on that module. If you can do it in a small gen_server that never changes, that's ok. Personally, I prefer to have a gen_server that simply holds the listen socket, and implement my socket handler has a gen_fsm that starts in a listen state. It sends itself 'accept' state messages. the listen(accept, ...) calls gen_tcp:accept() with a short timeout. If it returns error,timeout, send accept to self. If it succeeds, tell the supervisor to start another fsm in the listen state and go into the initial connection state. This avoids having to play startup games with calling gen_tcp:controlling_process() and then allowing the connection to go ahead, which I hate. And I find the gen_fsm paradigm more useful for socket owners anyway. -- David Terrell dbt@REDACTED ((meatspace)) http://meat.net/ From bjt@REDACTED Fri Sep 21 02:26:38 2007 From: bjt@REDACTED (Benjamin Tolputt) Date: Fri, 21 Sep 2007 10:26:38 +1000 Subject: [erlang-questions] Vector and matrix libraries In-Reply-To: <5d17d1a50709200805k4ab828c7y5a1af7870ef61225@mail.gmail.com> References: <5d17d1a50709200805k4ab828c7y5a1af7870ef61225@mail.gmail.com> Message-ID: <46F30FBE.6070903@pmp.com.au> WQhile not one of the "big guns" in the Erlang crowd (I wouldn't even call myself a pea shooter!!!), I would be interested in looking into the code you developed. My work involves GPS/GIS and as such I would at least understand most the code involved. Currentl we are having to use Erlang primarily as a "load balancing" solution as the math has been extracted out into a driver. Being able to integrate the math and the Erlang code would (hopefully) make parallel alot of the code currently running serial due to the driver bottleneck. Regards, B.J.Tolputt Bahram Bahar wrote: > Hi all > > Two years ago I was involved in programming an assisted GPS (A-GPS) > system in Erlang during a project at Uppsala University. > During the development process I was forced to design a matrix and a > vector library for the GPS position calculation sub-system. > > I was wondering if there is any interest from Erlang.org > to review and possibly incorporate these two > libraries into Erlang/OTP. > > Best Regards > > Bahram > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From ckerr@REDACTED Fri Sep 21 03:31:07 2007 From: ckerr@REDACTED (Cameron Kerr) Date: Fri, 21 Sep 2007 13:31:07 +1200 Subject: [erlang-questions] A new erlang book? In-Reply-To: <012d01c7fbad$870a6d70$d90ac246@Turing> References: <6fd0654b0709190801y368be8d2o4ecba25fa5124b97@mail.gmail.com> <012d01c7fbad$870a6d70$d90ac246@Turing> Message-ID: I'm currently proposing a paper for our Telecommunications program, the paper will be about Architectures for Computer Network Applications. I would be very interested in a book that would be suitable as a course text (I've got 'Programming Erlang' ordered). I'm proposing we teach the course in Erlang, because it simply wouldn't be feasible to teach in C or Java, and would like a book that teaches a good amount of principle, as well as a useful subset of Erlang/OTP. I'd also like to hear of any suitable papers that people would recommend (I'm thinking of prescribing part of Joe's thesis as a reading) As a bonus, something that also includes a bit of P2P architecture would be appreciated. On 21/09/2007, at 5:41 AM, Salvatore Mangano wrote: > > I am two chapters into writing a new book on Erlang. There will > inevitably > be some overlap with Joe's book because I want to make it stand by > itself. > However, the main emphasis is on using Erlang to develop large > projects > where concurrency and fault tolerance are crucial. I plan to use > financial > trading as my example domain. I will have greater coverage of the > various > pieces of the Erlang stack (Yaws, Rabbit MQ, Mnesia, My SQL > interfacing, > etc.) There will also emphasis on development of unit tests. > > I would love to hear what subscribers to this list want to see in a > new > book. > > I am also looking for people who would like to be technical editors. > Please email me off list. > > -Sal Mangano > smangano (at) into-technology (dot) com > > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Robert > Raschke > Sent: Thursday, September 20, 2007 4:43 AM > To: erlang-questions@REDACTED > Subject: Re: [erlang-questions] A new erlang book? > > pat eyler wrote: >> The other day, a publisher asked me what I thought about the >> potential market for books on Functional Programming. As we >> talked, it became obvious that they want to play in this space >> and are looking for some feedback. It sounds like they want to >> put out a (some) book(s) that are a little bit more advanced than >> Joe's Programming Erlang, or the upcoming O'Reilly book on >> Haskell without doing yet another dry, academic tome. > > I really, really liked the approach that Brian Kernighan and Rob Pike > took in The Practice Of Programming, in that they did not restrict > themselves to one language. > > A nice book on functional programming would use various languages, and > use those to highlight things like how eager vs. lazy influences your > programming style, similarly for static vs dynamic typing, and so on. > But keeping it practical, showing the benefits of both ways. > > Robby > > > _______________________________________________ > 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 -- ? Cameron Kerr ? ? ckerr@REDACTED ? ? ? ? Telecommunications Teaching Fellow & SysAdmin ? ? ? http://humbledown.org/blog/ ? ? 021 02 333 294 ? From ok@REDACTED Fri Sep 21 04:42:18 2007 From: ok@REDACTED (ok) Date: Fri, 21 Sep 2007 14:42:18 +1200 Subject: [erlang-questions] Why no ?FUNCTION macro In-Reply-To: <46F268D5.7090504@it.uu.se> References: <6344005f0709200430v412e92e3o10755bf7e1285e56@mail.gmail.com> <46F268D5.7090504@it.uu.se> Message-ID: <0624AEEA-EFC8-4C06-9EF0-5672C474E7A4@cs.otago.ac.nz> Note that __FUNCTION__ (or whatever it's call) in C99 is not, strictly speaking, a preprocessor macro. Basically, it's a funny way of writing a context-dependent string literal. It's not even clear whether it should "foobar/#" or {foobar,#} in Erlang. Possibly the simplest way to hack it would be to write a parse transform. From dcaoyuan@REDACTED Fri Sep 21 09:41:55 2007 From: dcaoyuan@REDACTED (Caoyuan) Date: Fri, 21 Sep 2007 15:41:55 +0800 Subject: [erlang-questions] ErlyBird 0.15.0 released - An Erlang IDE based on NetBeans Message-ID: I'm pleased to announce ErlyBird 0.15.0, an Erlang IDE based on NetBeans. This is a major features release. This release will only provide all-in-one IDE package, which is in size of 17.6M. CHANGELOG: * Pretty formatter (Ctrl+Shift+F). * Variables and functions occurrences mark. * Better brace matching highlighting, such as for 'try-catch-end', 'if-end' etc. * "-import" syntax now works in all cases, that means RabbitMQ's code will be parsed correctly. *Various bugs fixes. As NetBeans 6.0 beta1 was just released, I hope ErlyBird has got more stable also. Java JRE 5.0+ is requested. To download, please go to: http://sourceforge.net/project/showfiles.php?group_id=192439 To install: 1. Unzip erlybird-bin-0.15.0-ide.zip to somewhere. For Windows user, execute 'bin/erlybird.exe'. For *nix user, 'bin/erlybird'. 2. Make sure 'erl.exe' or 'erl' is under your environment path 3. Check/set your OTP path. From [Tools]->[Options], click on 'Erlang, then 'Erlang Installation' tab, fill in the full path of your 'erl.exe' or 'erl' file. For instance: "C:/erl/bin/erl.exe" 4. The default -Xmx option for jvm is set to 256M, ErlyBird now works good with -Xmx128M. If you want to increase/decrease it, please open the config file that is located at etc/erlybird.conf, set -J-Xmx of 'default_options'. When you run ErlyBird first time, the OTP libs will be indexed. The indexing time varies from 10 to 30 minutes deponding on your computer. Notice: If you have previous version of ErlyBird 0.12.0+ installed, you can keep your old cache files, otherwise, please delete the old cache files which are located at: *nix: "${HOME}/.erlybird/dev" mac os x: "${HOME}/Library/Application Support/erlybird/dev" windows: "C:\Documents and Settings\yourusername\.erlybird\dev" or some where The status of ErlyBird is still Alpha, feedback and bug report are welcome. Project web site: http://sourceforge.net/projects/erlybird/ Developing blogs: http://blogtrader.net/page/dcaoyuan From davidnwelton@REDACTED Fri Sep 21 10:15:32 2007 From: davidnwelton@REDACTED (David Welton) Date: Fri, 21 Sep 2007 10:15:32 +0200 Subject: [erlang-questions] Memcached client implementation Message-ID: <9877cd600709210115r66d51f0ajf17cdeec9931c18c@mail.gmail.com> Hi, I needed a memcached implementation for some work I'm doing, so I've been working on a simple one. A few questions: 1) I'm using gen_server so that I can start it up and have a socket that remains open with the memcached server. Does that seem like a good approach? It's been several years since I've worked with Erlang and I'm a bit rusty. 2) We would like to open source this code - what might be the best place for it? I still have commit access to jungerl (isn't it time to switch to subversion, though?), so that's one possibility - anything else? Thanks, -- David N. Welton http://www.welton.it/davidw/ From chsu79@REDACTED Fri Sep 21 11:01:30 2007 From: chsu79@REDACTED (Christian S) Date: Fri, 21 Sep 2007 11:01:30 +0200 Subject: [erlang-questions] Memcached client implementation In-Reply-To: <9877cd600709210115r66d51f0ajf17cdeec9931c18c@mail.gmail.com> References: <9877cd600709210115r66d51f0ajf17cdeec9931c18c@mail.gmail.com> Message-ID: > 1) I'm using gen_server so that I can start it up and have a socket > that remains open with the memcached server. Does that seem like a > good approach? It's been several years since I've worked with Erlang > and I'm a bit rusty. It is not bad. What you get: * A proven rpc mechanism, doing registered service lookup for you if needed. * A simple callback for code-upgrade * A suitable component to put into a supervisor for restart on failure, you can handle memcached disconnects this way. Also, it does not exclude having a pool of memcached connections. However that is not something OTP helps you with that much unless you go for random pick of a process in a pg process-group. > 2) We would like to open source this code - what might be the best > place for it? I still have commit access to jungerl (isn't it time to > switch to subversion, though?), so that's one possibility - anything > else? Jungerl is suitable. If you would like to put some time into a svn transfer then it would be great. Personally I don't see any aching problems with CVS that SVN solves, I'm more appealed by using a distributed version control, but that takes at least one person actively pulling blessed patches into their source tree. In short, we need a Linus Torvalds. If you expose a git-repo you can lower the entry to people sending you patches. Anyone can clone and improve locally using version control. Of course, I recognize that there is an "emacs vs. vi"-like war between git and mercury and other distributed version control systems. _I_ am partial toward git, but not against using another distributed version control. So we dont get into a dead-end discussion about those. From mats.cronqvist@REDACTED Fri Sep 21 11:12:08 2007 From: mats.cronqvist@REDACTED (mats cronqvist) Date: Fri, 21 Sep 2007 11:12:08 +0200 Subject: [erlang-questions] Why no ?FUNCTION macro In-Reply-To: References: Message-ID: <1190365928.21642.22.camel@seasc0498.dyn.rnd.as.sw.ericsson.se> On Thu, 2007-09-20 at 15:35 +0100, G Bulmer wrote: [...] > As I said, this is only curiosity, but if the need is a run-time > name, maybe an ingenious function to dig through the stack trace > returned by erlang:get_stacktrace() would be workable. in that case, i think something like this is a lot simpler; -define(LOG(T),error_logger:info_report([process_info(self(),current_function)|T])). e.g. go() -> ?LOG([{xxx,yyy}]). will print =INFO REPORT==== 21-Sep-2007::11:08:38 === current_function: {foo,go,0} xxx: yyy mats From nem@REDACTED Fri Sep 21 11:32:52 2007 From: nem@REDACTED (Geoff Cant) Date: Fri, 21 Sep 2007 21:32:52 +1200 Subject: [erlang-questions] Memcached client implementation In-Reply-To: <9877cd600709210115r66d51f0ajf17cdeec9931c18c@mail.gmail.com> (David Welton's message of "Fri, 21 Sep 2007 10:15:32 +0200") References: <9877cd600709210115r66d51f0ajf17cdeec9931c18c@mail.gmail.com> Message-ID: "David Welton" writes: > Hi, > > I needed a memcached implementation for some work I'm doing, so I've > been working on a simple one. A few questions: > > 1) I'm using gen_server so that I can start it up and have a socket > that remains open with the memcached server. Does that seem like a > good approach? It's been several years since I've worked with Erlang > and I'm a bit rusty. > > 2) We would like to open source this code - what might be the best > place for it? I still have commit access to jungerl (isn't it time to > switch to subversion, though?), so that's one possibility - anything > else? > > Thanks, > -- > David N. Welton > http://www.welton.it/davidw/ Great! I've been meaning to write a memcache interface for some time, but have a dearth of round to-its. A one gen_server/tcp_socket approach sounds pretty reasonable - if there's a benefit to be had from a pool of these connections you could add a simple one for one supervisor to manage a collection of them. For publishing code a subversion repository at code.google.com or a git repository anywhere would be really useful. Cheers, --Geoff Cant From adam@REDACTED Fri Sep 21 13:05:08 2007 From: adam@REDACTED (Adam Lindberg) Date: Fri, 21 Sep 2007 12:05:08 +0100 Subject: [erlang-questions] Why no ?FUNCTION macro In-Reply-To: <1190365928.21642.22.camel@seasc0498.dyn.rnd.as.sw.ericsson.se> References: <1190365928.21642.22.camel@seasc0498.dyn.rnd.as.sw.ericsson.se> Message-ID: <6344005f0709210405r33a49a6fn6c8beee2dc3fea0@mail.gmail.com> Mats and Garry, Actually that was exactly what I was looking for, I only had it in mind like this (felt kind off natural): error_logger:error_report([{module, ?MODULE}, {function, ?FUNCTION}, {error, Error}]). However, what you propose works well enough for my purposes! Thanks, Adam On 9/21/07, mats cronqvist wrote: > > On Thu, 2007-09-20 at 15:35 +0100, G Bulmer wrote: > [...] > > As I said, this is only curiosity, but if the need is a run-time > > name, maybe an ingenious function to dig through the stack trace > > returned by erlang:get_stacktrace() would be workable. > > in that case, i think something like this is a lot simpler; > > > -define(LOG(T),error_logger:info_report([process_info(self(),current_function)|T])). > > e.g. > go() -> ?LOG([{xxx,yyy}]). > > will print > > =INFO REPORT==== 21-Sep-2007::11:08:38 === > current_function: {foo,go,0} > xxx: yyy > > mats > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From eokyere@REDACTED Fri Sep 21 12:47:03 2007 From: eokyere@REDACTED (Emmanuel Okyere) Date: Fri, 21 Sep 2007 06:47:03 -0400 Subject: [erlang-questions] ErlyBird 0.15.0 released - An Erlang IDE based on NetBeans In-Reply-To: References: Message-ID: <988E26EA-5444-4A8B-A338-CFC4C9B2CA94@gmail.com> On 21 Sep 2007, at 06:00, erlang-questions-request@REDACTED wrote: > * Pretty formatter (Ctrl+Shift+F). > * Variables and functions occurrences mark. > * Better brace matching highlighting, such as for 'try-catch-end', > 'if-end' etc. > * "-import" syntax now works in all cases, that means RabbitMQ's code > will be parsed correctly > *Various bugs fixes. > > As NetBeans 6.0 beta1 was just released, I hope ErlyBird has got more > stable also. Very nice. Thanks, Caoyuan. I am going to give this a shot over the weekend, even though I use Aquamacs as my primary Erlang editor now. Cheers, Emmanuel --- (*--p->foo+1)(2,4), don't memorize precedence rules; use scheme -------------- next part -------------- An HTML attachment was scrubbed... URL: From mazen@REDACTED Fri Sep 21 15:42:39 2007 From: mazen@REDACTED (Mazen Harake) Date: Fri, 21 Sep 2007 14:42:39 +0100 Subject: [erlang-questions] Mnesia - How to fix inconsistency on a running node. Message-ID: <46F3CA4F.4080104@erlang-consulting.com> Hello All. Assuming you have two nodes running mnesia who end up having two (or more) inconsistent tables, my current approach to solve this is to set one to master and then restart the other node(s) (not just mnesia, even though that also works). However, I was trying to somehow achieve the same result but with the both nodes still running without actually having to restart one of them (not even mnesia). As far as I can tell it can't be done since mnesia according to documentation only do this at start up by bypassing the normal start up procedure. So my questions are: 1) Can you somehow fix an inconsistency by chosing the master without having to restart the other nodes or mnesia applications? 2) Assuming you could, what do you think would be the downside of doing that? One could argue that if you have inconsistency in one (or more) node(s) then they would be useless anyway until they are fixed and therefore shouldn't be used. But the point is that even if they are not consistent, adding new data to it should not affect the inconsistent part (unless it depends on it). This would on the other hand be implementation dependent. Anyone out there who would care to share their experience in this matter? Regards, /Mazen -- Mazen Harake Erlang Software Developer and Consultant, Erlang Training & Consulting, Ltd Mobile Phone: +44 (0)795 13 26 317 Office Phone: +44 (0)207 45 61 020 Office Address: 401 London Fruit & Wool Exchange Brushfield St, London, E1 6EL United Kingdom From ingela@REDACTED Fri Sep 21 16:24:35 2007 From: ingela@REDACTED (Ingela Anderton Andin) Date: Fri, 21 Sep 2007 16:24:35 +0200 Subject: [erlang-questions] ODBC Connection Timeout In-Reply-To: References: Message-ID: <46F3D423.3050704@erix.ericsson.se> An idea: --------- From the users Guide --------------------- 1.4 About the Erlang ODBC application Provides an Erlang interface to communicate with relational SQL-databases. It is built on top of Microsofts ODBC interface and therefore requires that you have an ODBC driver to the database that you want to connect to. The Erlang ODBC application is designed using the version 3.0 of the ODBC-standard, however using the option {scrollable_cursors, off} for a connection has been known to make it work for at least some 2.X drivers. ----------------------------------------------------- Regards Ingela - OTP team > Hello ALL! > >I could not connect to mssql DB by erlang odbc module in Gentoo Linux. >After odbc:connect(...) I have got Error Report with Timeout Reason. > >The Steps that I've taken. >-Merged unixODBC Driver Manager v2.2.12 >-Merged the freetds ODBC driver with odbc and mssql USE flags. v0.64 >-Merged erlang with hipo,java,kpoll,odbc,smp,ssl and tk USE flags v11.2.5 >-Configured odbc.ini and odbcinst.ini files. > >odbc.ini > >[ODBC Data Sources] > >MyDatabase = FREETDS SQLServer driver >MYSQLPL = My SQL > > >[MyDatabase] >Driver = /usr/lib/libtdsodbc.so >Description = SQL Server >Server = ServerName\SQLEXPRESS >Port = 1433 >Language = >Database = PresenceLog >QuotedId = No >AnsiNPW = No > > >odbcins.ini > >[ODBC Drivers] > >FreeTDS = installed > > >[FreeTDS] >Description = FreeTDS ODBC Driver >Driver = /usr/lib/libtdsodbc.so >Threading = 0 >FileUsage = 1 >DontDLClose = 1 >UsageCount = 1 > > > >Tested the connectivity to MSSQL database using "isql". Everything works. > >Seted the enviroments ODBCINI and ODBCSYSINI >$ export ODBCINI=/etc/unixODBC/odbc.ini >$ export ODBCSYSINI=/etc/unixODBC/ > >Try out sample. > > erl > > application:start(odbc). > > {ok, Ref} = odbc:connect("DSN=MyDatabase;UID=user;PWD=pwd", []). > > Get as output: > >{error,connection_closed} >=ERROR REPORT==== 20-Sep-2007::14:16:58 === >** Generic server <0.38.0> terminating >** Last message in was {<0.31.0>, > {connect,[1, > 1, > 2, > 1, > 1, > "DSN=MyDatabase;UID=user;PWD=pwd"], > on, > on}, > infinity} >** When Server state == {state,#Port<0.105>, > {<0.31.0>,#Ref<0.0.0.68>}, > <0.31.0>, > undefined, > on, > undefined, > undefined, > on, > connecting, > undefined, > 0, > [#Port<0.103>,#Port<0.104>], > undefined, > undefined} >** Reason for termination == >** timeout > > >I tried the DSN again via two little c program. > >DSN LIST: > > >#include >#include >#include > >main() { > SQLHENV env; > char dsn[256]; > char desc[256]; > SQLSMALLINT dsn_ret; > SQLSMALLINT desc_ret; > SQLUSMALLINT direction; > SQLRETURN ret; > > SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env); > SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0); > > direction = SQL_FETCH_FIRST; > while(SQL_SUCCEEDED(ret = SQLDataSources(env, direction, > dsn, sizeof(dsn), &dsn_ret, > desc, sizeof(desc), &desc_ret))) { > direction = SQL_FETCH_NEXT; > printf("%s - %s\n", dsn, desc); > if (ret == SQL_SUCCESS_WITH_INFO) printf("\tdata truncation\n"); > } >} > >It founds both of my DSNs. > >Connection TEST by *Edmund Dengler* > >> #include >> #include >> #include >> #include >> #include >> #include > >#define MAX_CONN_STR_OUT 1024 >#define TIME_OUT 10 > >int main() { > unsigned char *connStrIn = "DSN=MyDatabase;UID=user;PWD=pwd"; > SQLCHAR connStrOut[MAX_CONN_STR_OUT]; > SQLRETURN stringlength2ptr, result; > SQLSMALLINT connlen; > > SQLHENV env; > SQLHDBC connect; > > SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env); > SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3, 0); > > SQLAllocHandle(SQL_HANDLE_DBC, env, &connect); > SQLSetConnectAttr(connect, SQL_ATTR_CONNECTION_TIMEOUT, >(SQLPOINTER)TIME_OUT, 0); > SQLSetConnectAttr(connect, SQL_ATTR_AUTOCOMMIT, >(SQLPOINTER)SQL_AUTOCOMMIT_ON, 0); > SQLSetConnectAttr(connect, SQL_ATTR_TRACE, >(SQLPOINTER)SQL_OPT_TRACE_OFF, 0); > > connlen = (SQLSMALLINT)strlen((const char*)connStrIn); > > printf("Connecting\n"); > result = SQLDriverConnect(connect, NULL, > (SQLCHAR *)connStrIn, > connlen, > connStrOut, (SQLSMALLINT)MAX_CONN_STR_OUT, > &stringlength2ptr, SQL_DRIVER_NOPROMPT); > printf("Done (%d)\n", result); >} > >The result was SQL_SUCCESS > > >If anybody has any ideas, they would be greatly appreciated! From jay@REDACTED Fri Sep 21 17:19:56 2007 From: jay@REDACTED (Jay Nelson) Date: Fri, 21 Sep 2007 08:19:56 -0700 Subject: [erlang-questions] Hot code loading and OTP Message-ID: <687A1E5A-6C89-4505-B743-853E1623A1E8@duomark.com> A friend who hadn't seen erlang before just finished reading Joe's book. We were discussing hot code loading and he didn't realize that prefixing a function call with a Module: caused a load of code from disk. I attempted to search through the book and find the description, but was unable to find an explicit reference. Was this accidentally left out? My real question has to deal with OTP and relup / appup code loading. Does the use of my error logging functions such as my_logger:log_error(Msg) interfere with an orderly code upgrade? Should I eschew all uses of Module:Function (I guess by using import, unless there is some other mechanism to avoid triggering an unwanted code load) so that code is only loaded on signal from an OTP upgrade? I was just going to try an appup for the first time when it occurred to me that the logger would get upgraded before the rest of the system was even copied to disk properly depending on how I install the software... As I write this I think I've realized how OTP achieves the code upgrade in an orderly fashion: 1) The OTP release system is guided by the current release version and directory. 2) Any reference to M,F,A or M:F checks the initial location on disk from which it was loaded -- which is determined by the release and module-vsn.num directory name in the lib directory. 3) Appup and relup change the release number and vsn.num for all modules on disk. 4) The triggering switch is controlled and causes a lockstep upgrade by switching the code loader to be using the release directories. Just be careful not to replace any beam file in place in a previous release directory or you will get an uncontrolled code upgrade. Is that all correct? jay From minsloc@REDACTED Fri Sep 21 17:59:06 2007 From: minsloc@REDACTED (Minsloc Tarren) Date: Fri, 21 Sep 2007 17:59:06 +0200 Subject: [erlang-questions] I would never use python (was: separators before end) In-Reply-To: References: Message-ID: <330602700709210859p3c63c6d6qb2054f47acb0ffcf@mail.gmail.com> python (when not looking at the syntax) is ok. pretty fast, lots of libs, lot of supported platforms, single form of bytecode for all of them and people proved you can write pretty much anything in it. but i really don't like the syntax, mainly the fact that indentation is part of the syntax and the way oop is glued to the rest of python. zope, plone, django, and a few other apps nearly got me to learn it, but i always reconsidered. is there a someone who knew lisp - for some reason i heard few pretty smart guys saying that python has a lot in common with lisp, but i don't know where they keep the parentheses or what is it they share with each other ;-) - and ruby before he learned python and considers python a worthwhile addition too his toolbox ? it's also said that every language opens your mind in another way. mentioning only the main langs in their respective categories, will python teach me something new after c, ruby, smalltalk, lisp and erlang (which i'm still learning) ? learning something new and important would be probably the only thing that would force me to start with python ... On 9/20/07, Emmanuel Okyere wrote: > > > On 19 Sep 2007, at 19:48, erlang-questions-request@REDACTED wrote: > > I have said "I would never use Python" before; but then, my opinion was > misinformed at best. > Might be different in your case, but I doubt it. > > cheers, > Emmanuel > > --- > SYLLOGISM, n. A logical formula consisting of a major and a minor > assumption and an inconsequent. (See LOGIC.) ? Devil's Dictionary > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gbulmer@REDACTED Fri Sep 21 18:02:31 2007 From: gbulmer@REDACTED (G Bulmer) Date: Fri, 21 Sep 2007 17:02:31 +0100 Subject: [erlang-questions] Why no ?FUNCTION macro In-Reply-To: <6344005f0709210405r33a49a6fn6c8beee2dc3fea0@mail.gmail.com> References: <1190365928.21642.22.camel@seasc0498.dyn.rnd.as.sw.ericsson.se> <6344005f0709210405r33a49a6fn6c8beee2dc3fea0@mail.gmail.com> Message-ID: Adam I'm just a newbie, so here's my solution: -module(funnames). -compile(export_all). % -define(FUN, helper(process_info(self(),current_function))). -define(FUN, case process_info(self(), current_function) of {_, {_,F,_}} -> F end). toyfun() -> io:format("starting a function blah, blah, ...~n"), io:format("replacing ?FUN, and getting ~p~n", [?FUN]), io:format("finishing the function phew!~n"). % just a helper function while I was playing with formatting - it isn't used in this version of the code helper({ current_function, {Mname, Fname, Arrity}}) -> atom_to_list(Mname) ++ ":" ++ atom_to_list(Fname) ++ "/" ++ integer_to_list(Arrity). I can't think of a neater way to extract the function name from the return value of process_info than the case ... end, but hopefully, someone will make it even better. Garry > Mats and Garry, > > Actually that was exactly what I was looking for, I only had it in > mind like this (felt kind off natural): > > error_logger:error_report([{module, ?MODULE}, {function, ? > FUNCTION}, {error, Error}]). > > However, what you propose works well enough for my purposes! > > Thanks, > Adam > > On 9/21/07, mats cronqvist < mats.cronqvist@REDACTED> wrote:On > Thu, 2007-09-20 at 15:35 +0100, G Bulmer wrote: > [...] > > As I said, this is only curiosity, but if the need is a run-time > > name, maybe an ingenious function to dig through the stack trace > > returned by erlang:get_stacktrace() would be workable. > > in that case, i think something like this is a lot simpler; > > -define(LOG(T),error_logger:info_report([process_info(self > (),current_function)|T])). > > e.g. > go() -> ?LOG([{xxx,yyy}]). > > will print > > =INFO REPORT==== 21-Sep-2007::11:08:38 === > current_function: {foo,go,0} > xxx: yyy > > mats > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > Garry Bulmer email: gbulmer@REDACTED Home: +44 (0)24 7667 9497 Mobile: +44 (0)7726 880058 From erik.stenman@REDACTED Fri Sep 21 18:06:57 2007 From: erik.stenman@REDACTED (Erik Stenman) Date: Fri, 21 Sep 2007 18:06:57 +0200 Subject: [erlang-questions] Hot code loading and OTP In-Reply-To: <687A1E5A-6C89-4505-B743-853E1623A1E8@duomark.com> References: <687A1E5A-6C89-4505-B743-853E1623A1E8@duomark.com> Message-ID: On 21 sep 2007, at 17.19, Jay Nelson wrote: > A friend who hadn't seen erlang before just finished reading Joe's > book. We were discussing hot code loading and he didn't realize that > prefixing a function call with a Module: caused a load of code from > disk. Just prefixing a call with Module: *don't* cause a load from disk, it just causes that code to call the latest *loaded* version of the code. You still have to explicitly load the new code into the system. /Erik Happi Stenman From dbt@REDACTED Fri Sep 21 18:12:34 2007 From: dbt@REDACTED (David Terrell) Date: Fri, 21 Sep 2007 11:12:34 -0500 Subject: [erlang-questions] Hot code loading and OTP In-Reply-To: <687A1E5A-6C89-4505-B743-853E1623A1E8@duomark.com> References: <687A1E5A-6C89-4505-B743-853E1623A1E8@duomark.com> Message-ID: <20070921161234.GD14841@sphinx.chicagopeoplez.org> On Fri, Sep 21, 2007 at 08:19:56AM -0700, Jay Nelson wrote: > A friend who hadn't seen erlang before just finished reading Joe's > book. We were discussing hot code loading and he didn't realize that > prefixing a function call with a Module: caused a load of code from > disk. I attempted to search through the book and find the > description, but was unable to find an explicit reference. Was this > accidentally left out? calling Module:Func only loads the module from disk if the module was not loaded before. It does not reload the module. The only time there's a difference in behavior is the case of localfunc(Args) vs ?MODULE:localfunc(Args). The former will stay in the same version of the module; the latter will break out of the stale version and into the new version if the module has been reloaded. -- David Terrell dbt@REDACTED ((meatspace)) http://meat.net/ From minsloc@REDACTED Fri Sep 21 18:14:17 2007 From: minsloc@REDACTED (Minsloc Tarren) Date: Fri, 21 Sep 2007 18:14:17 +0200 Subject: [erlang-questions] separators before end In-Reply-To: <330602700709210854r2d296bl217bf3f4f2eb236b@mail.gmail.com> References: <330602700709191407s99b89bbvf55a860d0a1a6a1@mail.gmail.com> <330602700709191536o48522063j1abf595879c7cde@mail.gmail.com> <330602700709191644k2b7b4257s8bce8b4f8821bb68@mail.gmail.com> <20070920151337.GJ18483@sphinx.chicagopeoplez.org> <016b01c7fba1$9f3d4e50$891ea8c0@SSI.CORP> <330602700709210854r2d296bl217bf3f4f2eb236b@mail.gmail.com> Message-ID: <330602700709210914u66549737v756c0b4aae10e476@mail.gmail.com> a three in one package. On 9/20/07, David Terrell wrote: > And I've encountered people who refuse to use erlang because of the > atom/Variable thing. Teaching your brain to be able to switch idioms > is good for it. I suggest you try it more often. i learned a lot of languages, in no particular order : basic, assembly, c, c++, c#, pascal, ruby, smalltalk, common lisp, javascript, php, lush (something between scheme and mathematica) and probablly a few i forgot about ;-)). i also toyed with others (rebol, forth, self, io, brainfuck & friends if you call those languages and lots of others). I even had to endure fixing a few python scripts and some java code (yes, it included checking a ton of XML files). blech. someone started a new thread off this one - I would never use python (was: separators before end) - and i asked there, what people think learning python would give me. so if you have a suggestion, answer there. On 9/20/07, David Mercer wrote: > > I agree. That sort of thinking has kept Lisp out of the mainstream. All in lisp, all those parentheses serve a very good purpose. it's about what you consider a good trade-off (i'd be willing to write twice as much parentheses for what lisp offers, but what does python offer to me ?). On 9/21/07, David King wrote: > True, but there is no way to turn that off. My point was that Ruby > forces a particular whitespace use. For instance, this won't work: > a=a+1; > b=b+2; > c=5; > d= a > +b > +c; > Even though, stylistically, this programmer has chosen to end lines > in semicolons, he's still bitten by Ruby's significant whitespace. that never came to me as fault, its a logical conclusion that comes from the fact that ";" is optional, so it never bitten me. i think that its even explained in specs (if there is no sign that the expression is not terminated, like an operator on the end of the line, or un-closed parenthesis, the parser has no way to tell that the expression should continue on the next line ...), for christ's sake. so what ? are you going to indent just two spaces in python and cry that "it doesn't work" ??? you indented it, didn't you ? ;-))) ruby strikes me as elegant, python as ugly. i'm asking in other thread whether there is something i would learn from python (other than learning another scripting lang of which i know a bunch already), and only that would force me to overcome my hatred for for python (i know it's kinda childish, but as i have no use for python, there is no need for compromises ...) 2 everybody> and even if i would learned something new from python, i still would view the choice of using whitespace as block delimiters as idiotic. indentation is something that can be achieved automatically because of syntactic rules, not something that should be part of syntax imho. From bhatti_shahzad@REDACTED Fri Sep 21 18:15:41 2007 From: bhatti_shahzad@REDACTED (shahzad bhatti) Date: Fri, 21 Sep 2007 09:15:41 -0700 (PDT) Subject: [erlang-questions] Iterating (Page scrolling) over Mnesia database Message-ID: <61433.98458.qm@web81113.mail.mud.yahoo.com> I am looking for a way to iterate over the results in the Mnesia that are ordered by some element, in other words equivalent of SELECT * FROM TABLE ORDER BY MYFIELD -- that can return results in cursor like fashion Or page scrolling like SELECT * FROM TABLE ORDER BY MYFIELD where rownum > 100 and rownum < 200; I see foldl and foldr methods can iterate, and qlc can query, but can someone point me how to implement Cursor or page scrolling behavior. Thanks in advance. -Shahzad Bhatti --------------------------------- Moody friends. Drama queens. Your life? Nope! - their life, your story. Play Sims Stories at Yahoo! Games. -------------- next part -------------- An HTML attachment was scrubbed... URL: From parlar@REDACTED Fri Sep 21 18:17:38 2007 From: parlar@REDACTED (Jay Parlar) Date: Fri, 21 Sep 2007 12:17:38 -0400 Subject: [erlang-questions] I would never use python (was: separators before end) In-Reply-To: <330602700709210859p3c63c6d6qb2054f47acb0ffcf@mail.gmail.com> References: <330602700709210859p3c63c6d6qb2054f47acb0ffcf@mail.gmail.com> Message-ID: On 9/21/07, Minsloc Tarren wrote: > but i really don't like the syntax, mainly the fact that indentation is part > of the syntax and the way oop is glued to the rest of python. zope, plone, > django, and a few other apps nearly got me to learn it, but i always > reconsidered. You don't normally indent your code? How you can say oop is glued? Everything is an object. Even functions are objects. Do you think this just because of the explicit self? I've seen this "claim" before, and it's just plain wrong. Look at the source code for the Python interpreter, EVERYTHING IS AN OBJECT. And the great part is, that if you hate OOP, you can just pretend it doesn't exist. > it's also said that every language opens your mind in another way. > mentioning only the main langs in their respective categories, will python > teach me something new after c, ruby, smalltalk, lisp and erlang (which i'm > still learning) ? If you already know Ruby *really* well, then Python won't teach you too much. I'm a Python guy, I use it for everything that I can (though I'm trying to learn Erlang), and for the most part, Ruby and Python are interchangeable. Strongly typed dynamic languages with great interpreters. Really comes down to which syntax you prefer, and a few other minors things (ie. blocks, iterators). It's actually funny, how similar Python and Ruby really are, considering their development has not been linked at all. Although for certain tasks, Python is much better, thanks to the large number of third party libraries. Of course, the Ruby on Rails buzz has helped Ruby gain more libraries, but some things just take a long time to do (numpy and scipy, for example). > learning something new and important would be probably the only thing that > would force me to start with python ... Again, if you already know Ruby really well, then there's not a *whole* lot of reasons to learn Python. However, I'll tell you this: It won't be hard to learn Python, if you know Ruby, and since it's such a popular language, it's a good thing to know. Jay P. From dustin@REDACTED Fri Sep 21 18:56:04 2007 From: dustin@REDACTED (Dustin Sallings) Date: Fri, 21 Sep 2007 09:56:04 -0700 Subject: [erlang-questions] Memcached client implementation In-Reply-To: <9877cd600709210115r66d51f0ajf17cdeec9931c18c@mail.gmail.com> References: <9877cd600709210115r66d51f0ajf17cdeec9931c18c@mail.gmail.com> Message-ID: <5178106B-724F-4602-8A8F-78B9E03D11D4@spy.net> This is particular interesting to me, because of the three mailing lists I'm on, erlang and memcached are two. On Sep 21, 2007, at 1:15 , David Welton wrote: > 1) I'm using gen_server so that I can start it up and have a socket > that remains open with the memcached server. Does that seem like a > good approach? It's been several years since I've worked with Erlang > and I'm a bit rusty. I wrote a java client that looks a lot like I would imagine this looking. It's got one thread that performs all of the communication, and what is in effect a message queue to push requests in to it. Responses work in a similar way (using Futures in java). I get *really* good performance off of my one connection and one IO thread. Note that there is a new protocol in development (actually, I've pretty much stopped developing it since it's as done as I'm able to get it). I'd expect you'd get much better performance out of the new protocol than the old if you're planning on using this a lot. I've written two client implementations and two server implementations using the new protocol (and one in the old). If you're interested in the new protocol, my test client and server would be very handy for you, I'd think. Depends on your goals. > 2) We would like to open source this code - what might be the best > place for it? I still have commit access to jungerl (isn't it time to > switch to subversion, though?), so that's one possibility - anything > else? The third list is mercurial, so I may be biased in my response. :) Personally, I think CVS and subversion are both barriers to contributions in open source projects. If you start writing a memcached client as part of jungerl, only jungerl contributors are first-class citizens. Everyone else can get a copy of the source and make patches against it, but I rarely do that unless there's a really compelling reason for me because I don't like leaving work not checked in, and I work on at least two or three machines on any given day. The high-level concept of jungerl is good, but I don't think a giant monolithic package manager that contains both all of the meta information and source code under the same group even scales that well. So, in my (obviously biased) opinion, you're better off starting out in mercurial and stick it up on a web server there for people to play with. -- Dustin Sallings From minsloc@REDACTED Fri Sep 21 19:08:46 2007 From: minsloc@REDACTED (Minsloc Tarren) Date: Fri, 21 Sep 2007 19:08:46 +0200 Subject: [erlang-questions] I would never use python (was: separators before end) In-Reply-To: References: <330602700709210859p3c63c6d6qb2054f47acb0ffcf@mail.gmail.com> Message-ID: <330602700709211008h393ebf25h19981d5775ea9d6e@mail.gmail.com> On 9/21/07, Jay Parlar wrote: > On 9/21/07, Minsloc Tarren wrote: > You don't normally indent your code? yes, i do (in case you mean manually, i did). i let my ide to do it. > > How you can say oop is glued? Everything is an object. Even functions self as required implicit parameter and a few other things. no, i dont know python much. are you saying python started as oo language ? i thought oo was added later, like in case of perl. which is another lang i played with a bit and abandoned. no bad feelings although it can be pretty cryptical. no drive to use it, though. but it made a nice glue between urlsnarf and mysql some six years back ;-). > are objects. Do you think this just because of the explicit self? I've > seen this "claim" before, and it's just plain wrong. Look at the > source code for the Python interpreter, EVERYTHING IS AN OBJECT. And > the great part is, that if you hate OOP, you can just pretend it i have nothing against oop (erlang is kinda oop without oop ;-))) > doesn't exist. > > > > it's also said that every language opens your mind in another way. > > mentioning only the main langs in their respective categories, will python > > teach me something new after c, ruby, smalltalk, lisp and erlang (which i'm > > still learning) ? > > If you already know Ruby *really* well, then Python won't teach you > too much. I'm a Python guy, I use it for everything that I can (though > I'm trying to learn Erlang), and for the most part, Ruby and Python > are interchangeable. Strongly typed dynamic languages with great > interpreters. Really comes down to which syntax you prefer, and a few if you knew ruby and python, you would have known that python is compiled (don't know if it even has an interpreter, but can be even compiled to native code), and ruby's interpreter is dog slow and can be crashed using floating point math extensively. ruby 2.0/rite is announced like being worked on some 3 or more years, but wait for Smalltalk's original vm specs, (or just check the progress, which is pretty fast), ruby bytecode compiler/vm based on the blue book, Smalltalk's original vm specs. Not so surprising, ruby is basically smalltalk with c-like syntax. And without image, but with rubinius, that might become possible. Of course, using mixins is a completely different strategy than smalltalk uses, so it won't be entirely like smalltalk, but at least it should be possible to save a state of running calculation and resume it later. > other minors things (ie. blocks, iterators). It's actually funny, how > similar Python and Ruby really are, considering their development has > not been linked at all. > > Although for certain tasks, Python is much better, thanks to the large > number of third party libraries. Of course, the Ruby on Rails buzz has > helped Ruby gain more libraries, but some things just take a long time > to do (numpy and scipy, for example). > > > > learning something new and important would be probably the only thing that > > would force me to start with python ... > > Again, if you already know Ruby really well, then there's not a > *whole* lot of reasons to learn Python. However, I'll tell you this: > It won't be hard to learn Python, if you know Ruby, and since it's i'm not saying it would be hard. i'm saying that python looks so ugly to me that trying to do so was (very) unpleasant. and as i code because i enjoy to do so, it was a no-go. > such a popular language, it's a good thing to know. java's popular, and i'm not going to learn it (i know the basics, and never had used it extensively, ugly as python, from different reasons). php is popular, but since i left it behind, i'm refusing real money because i don't like to code in it. > Jay P. > From dking@REDACTED Fri Sep 21 19:10:35 2007 From: dking@REDACTED (David King) Date: Fri, 21 Sep 2007 10:10:35 -0700 Subject: [erlang-questions] Iterating (Page scrolling) over Mnesia database In-Reply-To: <61433.98458.qm@web81113.mail.mud.yahoo.com> References: <61433.98458.qm@web81113.mail.mud.yahoo.com> Message-ID: > I am looking for a way to iterate over the results in the Mnesia > that are ordered by some element, in other words equivalent of > SELECT * FROM TABLE ORDER BY MYFIELD -- that can return results in > cursor like fashion The idea is to combine query handles, like this: mnesia:transaction(fun() -> % give me all of the authors from the author table with an ID over 10 Q1=qlc:q([ X || X <- mnesia:table(author), X#author.id > 10 ]), % sort them by name Q2=qlc:sort(Q1, {order, % I'm using the OrderFun form here. See file_sorter fun(Author1,Author2) -> Author1#author.name < Author2#author.name end}), % and run the query qlc:eval(Q2) end) Note that these query handles aren't evaluated until you ask them to be (with fold, cursor, eval, etc), so it's not as inefficient as sorting them all in memory if, for instance, indexes are available.. To iterate over them, use qlc:fold or qlc:cursor instead of qlc:eval: qlc:fold(fun(Author,AccIn) -> Author#author.id+AccIn end, 0, Q2). That would give me the sum of all of the IDs in the results (which is a bit contrived, but you get the idea) More information at http://www.erlang.org/doc/man/qlc.html > Or page scrolling like > SELECT * FROM TABLE ORDER BY MYFIELD where rownum > 100 and rownum > < 200; > I see foldl and foldr methods can iterate, and qlc can query, but > can someone point me how to implement Cursor or page scrolling > behavior. > > Thanks in advance. > -Shahzad Bhatti > > Moody friends. Drama queens. Your life? Nope! - their life, your > story. > Play Sims Stories at Yahoo! Games. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From minsloc@REDACTED Fri Sep 21 19:18:22 2007 From: minsloc@REDACTED (Minsloc Tarren) Date: Fri, 21 Sep 2007 19:18:22 +0200 Subject: [erlang-questions] I would never use python (was: separators before end) In-Reply-To: <330602700709211008h393ebf25h19981d5775ea9d6e@mail.gmail.com> References: <330602700709210859p3c63c6d6qb2054f47acb0ffcf@mail.gmail.com> <330602700709211008h393ebf25h19981d5775ea9d6e@mail.gmail.com> Message-ID: <330602700709211018k3181c6c4j346f92460ea3696c@mail.gmail.com> ... some 3 or more years, but wait for Smalltalk's original vm specs, (or just check the progress ... should be: ... some 3 or more years, but wait for Rubinius (or just check the progress ... i should watch "Impotence of proofreading" on youtube once more ;-))) http://www.youtube.com/watch?v=FjhOBiSk8Gg From jeremy@REDACTED Fri Sep 21 21:41:32 2007 From: jeremy@REDACTED (Jeremy Wall) Date: Fri, 21 Sep 2007 14:41:32 -0500 Subject: [erlang-questions] Memcached client implementation In-Reply-To: References: <9877cd600709210115r66d51f0ajf17cdeec9931c18c@mail.gmail.com> Message-ID: <69d143cd0709211241v1445c649tc8171efadac22911@mail.gmail.com> On 9/21/07, Christian S wrote: If you expose a git-repo you can lower the entry to people sending you > patches. Anyone can clone and improve locally using version controll. > Of course, I recognize that there is an "emacs vs. vi"-like war > between git and mercury and other distributed version control systems. > _I_ am partial toward git, but not against using another distributed > version control. So we dont get into a dead-end discussion about I'm a darcs fan myself, It's command set is small and simple and is just as easy as git to share with. I'll use either of course. but I like darcs for it's simplicity -- Jeremy Wall http://jeremy.marzhillstudios.com Jeremy@REDACTED -------------- next part -------------- An HTML attachment was scrubbed... URL: From parlar@REDACTED Fri Sep 21 22:01:31 2007 From: parlar@REDACTED (Jay Parlar) Date: Fri, 21 Sep 2007 16:01:31 -0400 Subject: [erlang-questions] I would never use python (was: separators before end) In-Reply-To: <330602700709211008h393ebf25h19981d5775ea9d6e@mail.gmail.com> References: <330602700709210859p3c63c6d6qb2054f47acb0ffcf@mail.gmail.com> <330602700709211008h393ebf25h19981d5775ea9d6e@mail.gmail.com> Message-ID: On 9/21/07, Minsloc Tarren wrote: > self as required implicit parameter and a few other things. no, i dont > know python much. Then maybe you shouldn't make such broad statements :) > are you saying python started as oo language ? i thought oo was added > later, like in case of perl. which is another lang i played with a bit > and abandoned. no bad feelings although it can be pretty cryptical. no > drive to use it, though. but it made a nice glue between urlsnarf and > mysql some six years back ;-). Python did not in fact start as an OO language. But you know what? Python is 15 years old. Many years ago, everything was re-written, where it needed to be, to make the entire language object based. > i have nothing against oop (erlang is kinda oop without oop ;-))) I like OO for some things, I was just trying to point out a nice feature of Python, that you don't need to program in an OO way, if you don't want. > if you knew ruby and python, you would have known that python is > compiled (don't know if it even has an interpreter, but can be even > compiled to native code), No, I'm sorry, you are wrong. Python does get byte compiled, but that's it, it's an interpreted language. There are various projects out there that try to compile it down to native code, but the standard Python used in 99.9% of projects is interpreted. > i'm not saying it would be hard. i'm saying that python looks so ugly > to me that trying to do so was (very) unpleasant. and as i code > because i enjoy to do so, it was a no-go. Well, most people find Python to be rather beautiful. No unnecessary curly braces or 'end' statements, it's very clean and a lot like pseudo-code. But, to each his/her own. If you don't like it, that's fine :) > java's popular, and i'm not going to learn it (i know the basics, and > never had used it extensively, ugly as python, from different > reasons). php is popular, but since i left it behind, i'm refusing > real money because i don't like to code in it. Sorry, I must not have explained properly, that was not my point. What I'm saying, is that Ruby and Python are very similar to each other, so if you become a Ruby master, then you might as well learn Python too. It will be easy to learn once you understand Ruby, and you'll then get access to the myriad of Python libraries out there. Jay P. From erlang@REDACTED Fri Sep 21 22:06:48 2007 From: erlang@REDACTED (Joe Armstrong) Date: Fri, 21 Sep 2007 22:06:48 +0200 Subject: [erlang-questions] Hot code loading and OTP In-Reply-To: <20070921161234.GD14841@sphinx.chicagopeoplez.org> References: <687A1E5A-6C89-4505-B743-853E1623A1E8@duomark.com> <20070921161234.GD14841@sphinx.chicagopeoplez.org> Message-ID: <9b08084c0709211306q48ada380sef5019dc534b8aaf@mail.gmail.com> On 9/21/07, David Terrell wrote: > On Fri, Sep 21, 2007 at 08:19:56AM -0700, Jay Nelson wrote: > > A friend who hadn't seen erlang before just finished reading Joe's > > book. We were discussing hot code loading and he didn't realize that > > prefixing a function call with a Module: caused a load of code from > > disk. I attempted to search through the book and find the > > description, but was unable to find an explicit reference. Was this > > accidentally left out? It doesn't load from disk - it calls the latest version of the module. This *is* described in detail in appendix E.4 /Joe > > calling Module:Func only loads the module from disk if the module > was not loaded before. It does not reload the module. > > The only time there's a difference in behavior is the case of > localfunc(Args) vs ?MODULE:localfunc(Args). The former will > stay in the same version of the module; the latter will break > out of the stale version and into the new version if the module > has been reloaded. > > -- > David Terrell > dbt@REDACTED > ((meatspace)) http://meat.net/ > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From dustin@REDACTED Fri Sep 21 22:32:16 2007 From: dustin@REDACTED (Dustin Sallings) Date: Fri, 21 Sep 2007 13:32:16 -0700 Subject: [erlang-questions] Memcached client implementation In-Reply-To: <69d143cd0709211241v1445c649tc8171efadac22911@mail.gmail.com> References: <9877cd600709210115r66d51f0ajf17cdeec9931c18c@mail.gmail.com> <69d143cd0709211241v1445c649tc8171efadac22911@mail.gmail.com> Message-ID: <5EC733D7-BF86-4681-8873-B2D0F5727601@spy.net> On Sep 21, 2007, at 12:41 , Jeremy Wall wrote: > I'm a darcs fan myself, It's command set is small and simple and > is just as easy as git to share with. I'll use either of course. > but I like darcs for it's simplicity Any of git, mercurial, or darcs would be good, but that's a less important part. More importantly, I'd recommend just building the thing independently and keep the list(s) up with your progress. Interested people may cooperate. Distributed revision control lowers the barrier to entry, but doesn't guarantee anyone will help. Centralized revision control makes it a little harder, but doesn't guarantee people won't. I've thought about writing this client many times myself, but I have no personal use for it (the closest thing I have to a use has mnesia doing the work). -- Dustin Sallings -------------- next part -------------- An HTML attachment was scrubbed... URL: From parlar@REDACTED Fri Sep 21 22:50:51 2007 From: parlar@REDACTED (Jay Parlar) Date: Fri, 21 Sep 2007 16:50:51 -0400 Subject: [erlang-questions] I would never use python (was: separatorsbefore end) In-Reply-To: <008e01c7fc90$f5f9afa0$d92bc14b@Turing> References: <330602700709210859p3c63c6d6qb2054f47acb0ffcf@mail.gmail.com> <330602700709211008h393ebf25h19981d5775ea9d6e@mail.gmail.com> <008e01c7fc90$f5f9afa0$d92bc14b@Turing> Message-ID: On 9/21/07, Salvatore Mangano wrote: > Perhaps debates on the merits of Python should take place somewhere else. > -Sal Good idea, sorry for being so OT. I'm happy to answer anyone's Python questions off-list. Jay P. From david.hopwood@REDACTED Fri Sep 21 22:52:19 2007 From: david.hopwood@REDACTED (David Hopwood) Date: Fri, 21 Sep 2007 21:52:19 +0100 Subject: [erlang-questions] [meta] What does Python or Lisp syntax have to do with erlang-questions? In-Reply-To: <330602700709210859p3c63c6d6qb2054f47acb0ffcf@mail.gmail.com> References: <330602700709210859p3c63c6d6qb2054f47acb0ffcf@mail.gmail.com> Message-ID: <46F42F03.4030102@industrial-designers.co.uk> Minsloc Tarren wrote: > python (when not looking at the syntax) is ok. [...] I'm not picking on your post specifically -- but why do we suddenly have a language advocacy thread about Python and Lisp, with little or no relevance to Erlang? It's not even an interesting discussion about the design of Python or Lisp, just superficial opinions about syntax that everyone has heard a dozen times before. The erlang-questions list has been relatively free of advocacy threads. When we do have them, they are about language concepts, or at the very least they have some concrete relevance to Erlang. That's one reason I still read erlang-questions after giving up on several other language mailing lists. I hope it stays that way. -- David Hopwood From smangano@REDACTED Fri Sep 21 22:49:51 2007 From: smangano@REDACTED (Salvatore Mangano) Date: Fri, 21 Sep 2007 16:49:51 -0400 Subject: [erlang-questions] I would never use python (was: separatorsbefore end) In-Reply-To: References: <330602700709210859p3c63c6d6qb2054f47acb0ffcf@mail.gmail.com><330602700709211008h393ebf25h19981d5775ea9d6e@mail.gmail.com> Message-ID: <008e01c7fc90$f5f9afa0$d92bc14b@Turing> Perhaps debates on the merits of Python should take place somewhere else. -Sal From davidnwelton@REDACTED Sat Sep 22 01:07:38 2007 From: davidnwelton@REDACTED (David Welton) Date: Sat, 22 Sep 2007 01:07:38 +0200 Subject: [erlang-questions] Memcached client implementation In-Reply-To: <5178106B-724F-4602-8A8F-78B9E03D11D4@spy.net> References: <9877cd600709210115r66d51f0ajf17cdeec9931c18c@mail.gmail.com> <5178106B-724F-4602-8A8F-78B9E03D11D4@spy.net> Message-ID: <9877cd600709211607o50e60999k79afba183223c395@mail.gmail.com> > I wrote a java client that looks a lot like I would imagine this > looking. It's got one thread that performs all of the communication, > and what is in effect a message queue to push requests in to it. > Responses work in a similar way (using Futures in java). > > I get *really* good performance off of my one connection and one IO > thread. Interesting. If you're set up for benchmarking, an interesting comparison might be with 'memcached in erlang': http://dsas.blog.klab.org/archives/51094713.html Just to see how much better the real thing is vs something done in Erlang. Version control commentary snipped. I'm putting it in Jungerl, infact, I just commited it. I'm a little bit embarassed, because I haven't worked with Erlang for a few years, so the code is surely kind of ugly. -- David N. Welton http://www.welton.it/davidw/ From jeremy@REDACTED Sat Sep 22 01:20:05 2007 From: jeremy@REDACTED (Jeremy Wall) Date: Fri, 21 Sep 2007 18:20:05 -0500 Subject: [erlang-questions] etap - A tap compliant testing library for erlang. Message-ID: <69d143cd0709211620t20835d16yf40afbd302cd6a@mail.gmail.com> I'd appreciate any input form folks. This is my first erlang project so I'm still learning on it. I'm sure I'm making a few mistakes or wrong assumptions along the way. Any feedback would be appreciated. -- Jeremy Wall http://jeremy.marzhillstudios.com Jeremy@REDACTED -------------- next part -------------- An HTML attachment was scrubbed... URL: From dustin@REDACTED Sat Sep 22 01:27:03 2007 From: dustin@REDACTED (Dustin Sallings) Date: Fri, 21 Sep 2007 16:27:03 -0700 Subject: [erlang-questions] Memcached client implementation In-Reply-To: <9877cd600709211607o50e60999k79afba183223c395@mail.gmail.com> References: <9877cd600709210115r66d51f0ajf17cdeec9931c18c@mail.gmail.com> <5178106B-724F-4602-8A8F-78B9E03D11D4@spy.net> <9877cd600709211607o50e60999k79afba183223c395@mail.gmail.com> Message-ID: <19B5E79E-6B41-4B8D-B6A2-E1BC387B3B13@spy.net> On Sep 21, 2007, at 16:07 , David Welton wrote: > Interesting. If you're set up for benchmarking, an interesting > comparison might be with 'memcached in erlang': > > http://dsas.blog.klab.org/archives/51094713.html > > Just to see how much better the real thing is vs something done in > Erlang. Possibly, but that's missing multi-gets, which would really freak my client out since one of the things it does is combines multiple individual gets into a single request. That's pretty code, otherwise, though. Might not take much to get it doing enough to make it test-worthy. It needs a multi-get and a flush at least, I think. -- Dustin Sallings From davidnwelton@REDACTED Sat Sep 22 01:36:00 2007 From: davidnwelton@REDACTED (David Welton) Date: Sat, 22 Sep 2007 01:36:00 +0200 Subject: [erlang-questions] Memcached client implementation In-Reply-To: <19B5E79E-6B41-4B8D-B6A2-E1BC387B3B13@spy.net> References: <9877cd600709210115r66d51f0ajf17cdeec9931c18c@mail.gmail.com> <5178106B-724F-4602-8A8F-78B9E03D11D4@spy.net> <9877cd600709211607o50e60999k79afba183223c395@mail.gmail.com> <19B5E79E-6B41-4B8D-B6A2-E1BC387B3B13@spy.net> Message-ID: <9877cd600709211636i6baf2db6vabe1c7425ffca707@mail.gmail.com> > Possibly, but that's missing multi-gets, which would really freak my > client out since one of the things it does is combines multiple > individual gets into a single request. Right. I don't see any sort of 'reaper' process either, to get rid of stale entries. > That's pretty code, otherwise, though. Might not take much to get > it doing enough to make it test-worthy. It needs a multi-get and a > flush at least, I think. No, although I think contacting the author would be a good idea so as to ensure that it's under the proper license. -- David N. Welton http://www.welton.it/davidw/ From eajam@REDACTED Sat Sep 22 05:50:46 2007 From: eajam@REDACTED (Alex Alvarez) Date: Sat, 22 Sep 2007 03:50:46 +0000 Subject: [erlang-questions] erl/werl module loading Message-ID: My excuses in advance if by any chance someone else has asked about it before, and I'm just repeating. I was wondering, as an old programmer, but complete newbie to erlang, how could I change which modules load up by default on erl/werl? I would like to get, for example, some additional modules from stdlib to load by default, like win32reg. Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From eajam@REDACTED Sat Sep 22 06:31:10 2007 From: eajam@REDACTED (Alex Alvarez) Date: Sat, 22 Sep 2007 04:31:10 +0000 Subject: [erlang-questions] separators before end In-Reply-To: References: <00f801c7fadf$87941b70$891ea8c0@SSI.CORP> <9b08084c0709191244r6f617d78r705f109fdc048e96@mail.gmail.com> Message-ID: Although you are certainly talking about the exclamation and interrogation marks, I hope you don't mind if I point out that "No problema" is totally wrong. In English it might be "No problem," but in Spanish it's "No hay problema" (with the "h" at the beginning of the word silent of course). Now, you could keep saying it wrong, if that makes you happy, but this is the right way of saying it.Cheers, Alex Date: Wed, 19 Sep 2007 13:24:31 -0700From: dougedmunds@REDACTED: erlang-questions@REDACTED: Re: [erlang-questions] separators before endPerhaps Erlang should be more like Espa?ol:?No problema?? No problema! On 9/19/07, Joe Armstrong < erlang@REDACTED> wrote: ,What about English, should we also have leading commas? -------------- next part -------------- An HTML attachment was scrubbed... URL: From tony@REDACTED Sat Sep 22 08:57:55 2007 From: tony@REDACTED (Tony Rogvall) Date: Sat, 22 Sep 2007 08:57:55 +0200 Subject: [erlang-questions] Fwd: iPhone References: <5627F29D-9E96-45DC-9796-2A3DD4C38B55@rogvall.se> Message-ID: <884411CB-7897-44C5-8059-1A458588F370@rogvall.se> I resend this since I think it was not received by the list ... /Tony Begin forwarded message: > From: Tony Rogvall > Date: torsdag 20 sep 2007 17.04.32 GMT+02:00 > To: "Erlang-Questions (E-mail)" > Subject: iPhone > > FYI (and Sean's request ;-) > > Erlang runs without any problem on the iPhone! > > > # cd / > # ls > Applications System cores etc private tmp var > Library bin dev mach sbin usr > # > # > # erl > Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] > > Eshell V5.5.5 (abort with ^G) > 1> > 1> os:type(). > {unix,darwin} > 2> os:version(). > {9,0,0} > 3> > > > /Tony > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Sat Sep 22 16:09:17 2007 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 22 Sep 2007 16:09:17 +0200 Subject: [erlang-questions] erl/werl module loading In-Reply-To: References: Message-ID: <8209f740709220709g5a0a1ca6kfb88c5f7a18105f2@mail.gmail.com> The easiest (albeit a bit blunt) way to accomplish this is to add "-mode embedded" after "werl.exe". This will cause all modules in kernel and stdlib (and whatever other applications exist in your boot script) to be loaded at boot time. It also disables dynamic code loading, so a call to a module which is not already loaded, will result in an 'undef' exception, even if the module exists in the path. (In ancient times, there existed a "-mode test", which loaded all modules in the boot script, but didn't disable dynamic code loading. It has been removed). BR, Ulf W 2007/9/22, Alex Alvarez : > > My excuses in advance if by any chance someone else has asked about it > before, and I'm just repeating. > > I was wondering, as an old programmer, but complete newbie to erlang, how > could I change which modules load up by default on erl/werl? I would like to > get, for example, some additional modules from stdlib to load by default, > like win32reg. > > Thanks! > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From gbulmer@REDACTED Sat Sep 22 16:17:59 2007 From: gbulmer@REDACTED (G Bulmer) Date: Sat, 22 Sep 2007 15:17:59 +0100 Subject: [erlang-questions] Help - Can I stop this warning? Message-ID: <543CAC3B-69F2-4B67-ACF8-6B5E0854F18A@gmail.com> I have been playing with this macro to print the current functions name: -define(IOFUN(), io:format("~s: ", [case process_info(self (),current_function) of {_,{_,F,_}} ->F end])). Unfortunately, I get this irritating warning on *every* function, on the first use of ?IOFUN(): ./script.erl:34: Warning: variable 'F' exported from 'case' (line 31) ... Can someone suggest how I get rid of it? Garry From tim@REDACTED Sat Sep 22 16:52:18 2007 From: tim@REDACTED (Tim Bates) Date: Sun, 23 Sep 2007 00:22:18 +0930 Subject: [erlang-questions] Help - Can I stop this warning? In-Reply-To: <543CAC3B-69F2-4B67-ACF8-6B5E0854F18A@gmail.com> References: <543CAC3B-69F2-4B67-ACF8-6B5E0854F18A@gmail.com> Message-ID: <46F52C22.7010905@bates.id.au> G Bulmer wrote: > I have been playing with this macro to print the current functions name: > > -define(IOFUN(), io:format("~s: ", [case process_info(self > (),current_function) of {_,{_,F,_}} ->F end])). > > Unfortunately, I get this irritating warning on *every* function, on > the first use of ?IOFUN(): > ./script.erl:34: Warning: variable 'F' exported from 'case' (line 31) > ... > > Can someone suggest how I get rid of it? -define(IOFUN(), io:format("~s: ", [element(2, element(2, process_info(self(),current_function)))])). Tim. -- Tim Bates tim@REDACTED From Lennart.Ohman@REDACTED Sat Sep 22 17:04:33 2007 From: Lennart.Ohman@REDACTED (=?iso-8859-1?Q?Lennart_=D6hman?=) Date: Sat, 22 Sep 2007 17:04:33 +0200 Subject: [erlang-questions] Help - Can I stop this warning? In-Reply-To: <543CAC3B-69F2-4B67-ACF8-6B5E0854F18A@gmail.com> References: <543CAC3B-69F2-4B67-ACF8-6B5E0854F18A@gmail.com> Message-ID: Hi, the easiest way would be to refrain from using a case when you don't have more than one branch. Try [begin {_,{_,F,_}}=process_info(self(),current_function), F end] Another reason not to use your suggestion is that define leads to that the subtituation gets copied into the locations where you use ?IOFUN. And since F actually gets exported (since it becomes bound in all (the only) branches) it might very well mess with another varible F in the variable scoop where you use IOFUN. What I am trying to say in too many words is that there is a very good reason for the warning to be there :-) Best Regards Lennart ------------------------------------------------------------------------------- Lennart ?hman phone: +46 8 587 623 27 Sj?land & Thyselius Telecom AB cell : +46 70 552 6735 H?lsingegatan 43, 10th floor fax : +46 8 667 8230 SE-113 31 STOCKHOLM, SWEDEN email: lennart.ohman@REDACTED -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of G Bulmer Sent: den 22 september 2007 16:18 To: erlang-questions@REDACTED Subject: [erlang-questions] Help - Can I stop this warning? I have been playing with this macro to print the current functions name: -define(IOFUN(), io:format("~s: ", [case process_info(self (),current_function) of {_,{_,F,_}} ->F end])). Unfortunately, I get this irritating warning on *every* function, on the first use of ?IOFUN(): ./script.erl:34: Warning: variable 'F' exported from 'case' (line 31) ... Can someone suggest how I get rid of it? Garry _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From gbulmer@REDACTED Sat Sep 22 18:22:35 2007 From: gbulmer@REDACTED (G Bulmer) Date: Sat, 22 Sep 2007 17:22:35 +0100 Subject: [erlang-questions] Help - Can I stop this warning? In-Reply-To: References: <543CAC3B-69F2-4B67-ACF8-6B5E0854F18A@gmail.com> Message-ID: <687886A7-39DF-433D-B239-208DEEFD0A41@gmail.com> Doh! Lennart, thank you, that's the kind of solution I was expecting, but didn't think of !-) So it's now: -define(IOFUN(), io:format("~s: ", [begin {_,{_,F,_}} = process_info (self(),current_function), F end])). Tim, I hadn't thought of your suggestion, so thank you for pointing it out: -define(IOFUN(), io:format("~s: ", [element(2, element(2, process_info (self(),current_function)))])). Is it in some way 'better' to avoid the pattern match, or is it simply personal preference? I didn't ask my question well. I'd realised the variable F was getting pushed into a higher scope, but I had thought that 'case ... end' established a new scope, so I didn't/don't understand why F was exported, or what to do about it. I had tried: -define(IOFUN(), io:format("~s: ", [begin case process_info(self(),current_function) of {_,{_,F,_}} ->F end end])). thinking the 'begin ... end' would kill the scope issue, but that didn't stop the warning, and F was still exported to the substitution site! test1() -> ?IOFUN(), io:format("see if F is bound~n"), F = wibble. fails with a ... {{badmatch,wibble}, error. Can anyone explain why/how "case ... of ... -> F end" and "begin case ... of ... -> F end end" export F, yet "[begin {_,{_,F,_}} = process_info(self(),current_function), F end]" does not? I'd expect all three to simply return the *value* of F as the value of the case ... end/begin ... end expressions. Garry > Hi, the easiest way would be to refrain from using a case when you > don't have > more than one branch. > > Try > > [begin {_,{_,F,_}}=process_info(self(),current_function), F end] > > Another reason not to use your suggestion is that define leads to > that the > subtituation gets copied into the locations where you use ?IOFUN. > And since F > actually gets exported (since it becomes bound in all (the only) > branches) > it might very well mess with another varible F in the variable > scoop where > you use IOFUN. What I am trying to say in too many words is that > there is > a very good reason for the warning to be there :-) > > Best Regards > Lennart > > > ---------------------------------------------------------------------- > --------- > Lennart ?hman phone: +46 8 587 623 27 > Sj?land & Thyselius Telecom AB cell : +46 70 552 6735 > H?lsingegatan 43, 10th floor fax : +46 8 667 8230 > SE-113 31 STOCKHOLM, SWEDEN email: lennart.ohman@REDACTED > -----Original Message----- > From: erlang-questions-bounces@REDACTED [mailto:erlang-questions- > bounces@REDACTED] On Behalf Of G Bulmer > Sent: den 22 september 2007 16:18 > To: erlang-questions@REDACTED > Subject: [erlang-questions] Help - Can I stop this warning? > > I have been playing with this macro to print the current functions > name: > > -define(IOFUN(), io:format("~s: ", [case process_info(self > (),current_function) of {_,{_,F,_}} ->F end])). > > Unfortunately, I get this irritating warning on *every* function, > on the first use of ?IOFUN(): > ./script.erl:34: Warning: variable 'F' exported from 'case' (line > 31) ... > > Can someone suggest how I get rid of it? > > Garry > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions Garry Bulmer email: gbulmer@REDACTED Home: +44 (0)24 7667 9497 Mobile: +44 (0)7726 880058 From richardc@REDACTED Sat Sep 22 18:28:01 2007 From: richardc@REDACTED (Richard Carlsson) Date: Sat, 22 Sep 2007 18:28:01 +0200 Subject: [erlang-questions] Help - Can I stop this warning? In-Reply-To: <46F52C22.7010905@bates.id.au> References: <543CAC3B-69F2-4B67-ACF8-6B5E0854F18A@gmail.com> <46F52C22.7010905@bates.id.au> Message-ID: <46F54291.6090600@it.uu.se> Tim Bates wrote: > G Bulmer wrote: >> I have been playing with this macro to print the current functions name: >> >> -define(IOFUN(), io:format("~s: ", [case process_info(self >> (),current_function) of {_,{_,F,_}} ->F end])). >> >> Unfortunately, I get this irritating warning on *every* function, on >> the first use of ?IOFUN(): >> ./script.erl:34: Warning: variable 'F' exported from 'case' (line 31) >> ... >> >> Can someone suggest how I get rid of it? > > -define(IOFUN(), io:format("~s: ", [element(2, element(2, > process_info(self(),current_function)))])). That's a good solution in this case, but for the general case when you want a macro to do something more complicated, and avoid contaminating the environment, use a fun-expression to simulate local variables: -define(my_macro, ((fun()-> ... end)())). Variables defined in ... are not exported outside the fun. /Richard From gbulmer@REDACTED Sat Sep 22 18:44:50 2007 From: gbulmer@REDACTED (G Bulmer) Date: Sat, 22 Sep 2007 17:44:50 +0100 Subject: [erlang-questions] Help - Can I stop this warning? In-Reply-To: <46F54291.6090600@it.uu.se> References: <543CAC3B-69F2-4B67-ACF8-6B5E0854F18A@gmail.com> <46F52C22.7010905@bates.id.au> <46F54291.6090600@it.uu.se> Message-ID: Richard So "begin ... end" does *not* introduce a new lexical scope. It *only* groups expressions. Ah! I think I've got it. Tripped up by my own baggage. Thank you, Garry > Tim Bates wrote: >> G Bulmer wrote: >>> I have been playing with this macro to print the current >>> functions name: >>> >>> -define(IOFUN(), io:format("~s: ", [case process_info(self >>> (),current_function) of {_,{_,F,_}} ->F end])). >>> >>> Unfortunately, I get this irritating warning on *every* function, on >>> the first use of ?IOFUN(): >>> ./script.erl:34: Warning: variable 'F' exported from 'case' (line >>> 31) >>> ... >>> >>> Can someone suggest how I get rid of it? >> >> -define(IOFUN(), io:format("~s: ", [element(2, element(2, >> process_info(self(),current_function)))])). > > That's a good solution in this case, but for the general case when you > want a macro to do something more complicated, and avoid contaminating > the environment, use a fun-expression to simulate local variables: > > -define(my_macro, ((fun()-> ... end)())). > > Variables defined in ... are not exported outside the fun. > > /Richard From gbulmer@REDACTED Sat Sep 22 19:57:50 2007 From: gbulmer@REDACTED (G Bulmer) Date: Sat, 22 Sep 2007 18:57:50 +0100 Subject: [erlang-questions] Help - Can I stop this warning? In-Reply-To: <46F54291.6090600@it.uu.se> References: <543CAC3B-69F2-4B67-ACF8-6B5E0854F18A@gmail.com> <46F52C22.7010905@bates.id.au> <46F54291.6090600@it.uu.se> Message-ID: <8D3CEDB0-3FB3-478C-BACD-6F5C1C5B44C3@gmail.com> Hmm, I'm still not getting it. I accept that a fun is overkill in this situation, but I was trying to get the tactic clear. Unfortunately I seem to have created a deeper problem. This is wrong: -define(FUN1, (fun() -> {_,{_,F,_}} = process_info(self (),current_function), F end)()). because the function name is based on the name *within* the scope of the fun, so it returns ugly things like '-test0/0-fun-0-' So, this is what I would expect to be correct: -define(FUN, ((fun(X) -> {_,{_,F,_}} = X, F end) (process_info(self (),current_function))) ). -define(IOFUN(), io:format("~p: ", [?FUN])). test0() -> ?IOFUN(), io:format("explode if F is bound~n"), F = wibble, io:format("clearly, everything is fine with F, and wibble == ~p~n", [F]), ?IOFUN(), io:format("Finished.~n"). Unfortunately, this fails: 11> scriptbug:test0(). test0: explode if F is bound clearly, everything is fine with F, and wibble == wibble =ERROR REPORT==== 22-Sep-2007::18:35:21 === Error in process <0.69.0> on node 'master@REDACTED' with exit value: {{badmatch,{current_function,{scriptbug,test0,0}}}, [{scriptbug,'-test0/0-fun-1-',1},{erl_eval,do_apply,5},{shell,exprs, 6},{shell,eval_loop,3}]} ** exited: {{badmatch,{current_function,{scriptbug,test0,0}}}, [{scriptbug,'-test0/0-fun-1-',1}, {erl_eval,do_apply,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** Now just to make things interesting, I remove F in test0() test0() -> ?IOFUN(), io:format("explode if F is bound~n"), % F = wibble, io:format("clearly, everything is fine with F, and wibble == ~p~n", [wibble]), ?IOFUN(), io:format("Finished.~n"). The result is now correct: 13> scriptbug:test0(). test0: explode if F is bound clearly, everything is fine with F, and wibble == wibble test0: Finished. ok I can't see why this fails with F = wibble in the first version of test0(), when that should be the only match operation on F in that scope. Worse, I can't see why it fails in the first version of test0(), but at the second macro expansion; I would expect the failure at 'F = wibble' if F is in scope from the first ?IOFUN()! Finally, if there is some cleverness going on inside the ?IOFUN() macro expansion, I would expect F to have the same value in each case anyway. Any hints or techniques that I could use to get better information so that I can debug these things in future? Garry > Tim Bates wrote: >> G Bulmer wrote: >>> I have been playing with this macro to print the current >>> functions name: >>> >>> -define(IOFUN(), io:format("~s: ", [case process_info(self >>> (),current_function) of {_,{_,F,_}} ->F end])). >>> >>> Unfortunately, I get this irritating warning on *every* function, on >>> the first use of ?IOFUN(): >>> ./script.erl:34: Warning: variable 'F' exported from 'case' (line >>> 31) >>> ... >>> >>> Can someone suggest how I get rid of it? >> >> -define(IOFUN(), io:format("~s: ", [element(2, element(2, >> process_info(self(),current_function)))])). > > That's a good solution in this case, but for the general case when you > want a macro to do something more complicated, and avoid contaminating > the environment, use a fun-expression to simulate local variables: > > -define(my_macro, ((fun()-> ... end)())). > > Variables defined in ... are not exported outside the fun. > > /Richard From richardc@REDACTED Sat Sep 22 22:12:13 2007 From: richardc@REDACTED (Richard Carlsson) Date: Sat, 22 Sep 2007 22:12:13 +0200 Subject: [erlang-questions] Help - Can I stop this warning? In-Reply-To: <8D3CEDB0-3FB3-478C-BACD-6F5C1C5B44C3@gmail.com> References: <543CAC3B-69F2-4B67-ACF8-6B5E0854F18A@gmail.com> <46F52C22.7010905@bates.id.au> <46F54291.6090600@it.uu.se> <8D3CEDB0-3FB3-478C-BACD-6F5C1C5B44C3@gmail.com> Message-ID: <46F5771D.5080208@it.uu.se> G Bulmer wrote: > So, this is what I would expect to be correct: > -define(FUN, ((fun(X) -> {_,{_,F,_}} = X, F end) > (process_info(self > (),current_function))) ). > -define(IOFUN(), io:format("~p: ", [?FUN])). > > test0() -> > ?IOFUN(), io:format("explode if F is bound~n"), > F = wibble, > io:format("clearly, everything is fine with F, and wibble == > ~p~n", [F]), > ?IOFUN(), io:format("Finished.~n"). > > Unfortunately, this fails: > 11> scriptbug:test0(). > test0: explode if F is bound > clearly, everything is fine with F, and wibble == wibble > > =ERROR REPORT==== 22-Sep-2007::18:35:21 === > Error in process <0.69.0> on node 'master@REDACTED' with exit > value: {{badmatch,{current_function,{scriptbug,test0,0}}}, > [{scriptbug,'-test0/0-fun-1-',1},{erl_eval,do_apply,5},{shell,exprs, > 6},{shell,eval_loop,3}]} It looks like the problem is the _second_ invocation of ?IOFUN. At that point, F is bound (by F = wibble), so it becomes imported into the {_,{_,F,_}} pattern in the body of the fun. It is only variables in the parameters (the parameter patterns) of the fun that will shadow surrounding bindings. Since F only occurs in the body, it becomes imported if it is bound in the surrounding environment, even if it occurs in a pattern match. What you want is: -define(FUN, ((fun({_,{_,F,_}}) -> F end)(...))). /Richard From bbmaj7@REDACTED Sun Sep 23 03:44:38 2007 From: bbmaj7@REDACTED (Richard Andrews) Date: Sun, 23 Sep 2007 11:44:38 +1000 (EST) Subject: [erlang-questions] runaway epmd process Message-ID: <998718.23021.qm@web52008.mail.re2.yahoo.com> While testing some shell scripts that start and stop multiple erlang nodes on one host this happened: (from /var/log/messages) Sep 22 12:15:56 mercury epmd: epmd: error in accept Sep 22 12:16:26 mercury last message repeated 240238 times Sep 22 12:17:27 mercury last message repeated 502050 times Sep 22 12:18:29 mercury last message repeated 501569 times Sep 22 12:19:30 mercury last message repeated 501764 times Sep 22 12:20:31 mercury last message repeated 501061 times Sep 22 12:21:31 mercury last message repeated 500861 times Sep 22 12:22:33 mercury last message repeated 500728 times Sep 22 12:23:34 mercury last message repeated 500757 times Sep 22 12:24:34 mercury last message repeated 500823 times Sep 22 12:25:35 mercury last message repeated 501179 times Sep 22 12:26:36 mercury last message repeated 500755 times Sep 22 12:27:37 mercury last message repeated 501494 times Sep 22 12:28:38 mercury last message repeated 501178 times Sep 22 12:29:39 mercury last message repeated 500750 times Sep 22 12:30:41 mercury last message repeated 500573 times Sep 22 12:31:41 mercury last message repeated 500807 times Sep 22 12:32:42 mercury last message repeated 501407 times Sep 22 12:33:43 mercury last message repeated 501585 times Sep 22 12:34:44 mercury last message repeated 501064 times Sep 22 12:35:46 mercury last message repeated 501021 times Sep 22 12:36:47 mercury last message repeated 501117 times Sep 22 12:37:47 mercury last message repeated 501469 times Sep 22 12:38:48 mercury last message repeated 501370 times Sep 22 12:39:49 mercury last message repeated 497215 times Sep 22 12:40:19 mercury last message repeated 230081 times epmd was chewing up all CPU it could get. Kill -15 stopped it. Using * R11B5 * Linux mercury.optusnet.com.au 2.6.17-1.2142_FC4smp #1 SMP Tue Jul 11 22:57:02 EDT 2006 i686 i686 i386 GNU/Linux Sick of deleting your inbox? Yahoo!7 Mail has free unlimited storage. http://au.docs.yahoo.com/mail/unlimitedstorage.html From headspin@REDACTED Sun Sep 23 13:53:36 2007 From: headspin@REDACTED (dda) Date: Sun, 23 Sep 2007 19:53:36 +0800 Subject: [erlang-questions] Not an Erlang fan Message-ID: http://www.tbray.org/ongoing/When/200x/2007/09/22/Erlang Tim Bray might raise some valid points here, even if he's slightly biased by his background. -- Didier From eajam@REDACTED Sun Sep 23 17:41:50 2007 From: eajam@REDACTED (Alex Alvarez) Date: Sun, 23 Sep 2007 15:41:50 +0000 Subject: [erlang-questions] Not an Erlang fan In-Reply-To: References: Message-ID: He definitely seems kind of bias at different points, but still it would be great to find out where he went wrong! -Alex > Date: Sun, 23 Sep 2007 19:53:36 +0800> From: headspin@REDACTED> To: erlang-questions@REDACTED> Subject: [erlang-questions] Not an Erlang fan> > http://www.tbray.org/ongoing/When/200x/2007/09/22/Erlang> > Tim Bray might raise some valid points here, even if he's slightly> biased by his background.> > -- > Didier> _______________________________________________> erlang-questions mailing list> erlang-questions@REDACTED> http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From keith.irwin@REDACTED Sun Sep 23 18:30:48 2007 From: keith.irwin@REDACTED (Keith Irwin) Date: Sun, 23 Sep 2007 09:30:48 -0700 Subject: [erlang-questions] Not an Erlang fan In-Reply-To: References: Message-ID: <8aff81590709230930x1bc2baf7r74916dc4a14d34b1@mail.gmail.com> On 9/23/07, Alex Alvarez wrote: > > He definitely seems kind of bias at different points, but still it would > be great to find out where he went wrong! > Isn't it that he's basing his whole analysis on file io, what's more, a single file which doesn't lend itself to parallelism? Had he started by writing a client/server or p2p application around some domain other than system-admin stuff, perhaps he'd be much more favorable towards the multitude of strengths Erlang has to offer. --Keith -Alex > > > ------------------------------ > > > Date: Sun, 23 Sep 2007 19:53:36 +0800 > > From: headspin@REDACTED > > To: erlang-questions@REDACTED > > Subject: [erlang-questions] Not an Erlang fan > > > > http://www.tbray.org/ongoing/When/200x/2007/09/22/Erlang > > > > Tim Bray might raise some valid points here, even if he's slightly > > biased by his background. > > > > -- > > Didier > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman > /listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman > /listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From patrickdlogan@REDACTED Sun Sep 23 19:33:54 2007 From: patrickdlogan@REDACTED (Patrick Logan) Date: Sun, 23 Sep 2007 10:33:54 -0700 Subject: [erlang-questions] Not an Erlang fan In-Reply-To: <8aff81590709230930x1bc2baf7r74916dc4a14d34b1@mail.gmail.com> References: <8aff81590709230930x1bc2baf7r74916dc4a14d34b1@mail.gmail.com> Message-ID: > > > http://www.tbray.org/ongoing/When/200x/2007/09/22/Erlang > > > > > > Tim Bray might raise some valid points here, even if he's slightly > > > biased by his background. The good news is speeding up the i/o in erlang should be easier than introducing better concurrency to another language. -Patrick From eajam@REDACTED Sun Sep 23 19:33:39 2007 From: eajam@REDACTED (Alex Alvarez) Date: Sun, 23 Sep 2007 17:33:39 +0000 Subject: [erlang-questions] Not an Erlang fan In-Reply-To: <8aff81590709230930x1bc2baf7r74916dc4a14d34b1@mail.gmail.com> References: <8aff81590709230930x1bc2baf7r74916dc4a14d34b1@mail.gmail.com> Message-ID: As with any language, it's hard to make final conclusions when you barely know anything about it. Now, having said that, text processing regardless the source is a basic necessity particularly nowadays, and I wonder what improvements are in store for Erlang in the near future in this area. > ... a single file which doesn't lend itself to parallelism? Had he started by writing a client/server or p2p application around some domain other than system-admin stuff, perhaps he'd be much more favorable towards the multitude of strengths Erlang has to offer. > > http://www.tbray.org/ongoing/When/200x/2007/09/22/Erlang> -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomasl_erlang@REDACTED Sun Sep 23 19:20:28 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Sun, 23 Sep 2007 10:20:28 -0700 (PDT) Subject: [erlang-questions] Not an Erlang fan In-Reply-To: <8aff81590709230930x1bc2baf7r74916dc4a14d34b1@mail.gmail.com> Message-ID: <18251.79142.qm@web38815.mail.mud.yahoo.com> --- Keith Irwin wrote: > On 9/23/07, Alex Alvarez wrote: > > > > He definitely seems kind of bias at different > points, but still it would > > be great to find out where he went wrong! > > > > Isn't it that he's basing his whole analysis on file > io, what's more, a > single file which doesn't lend itself to > parallelism? Had he started by > writing a client/server or p2p application around > some domain other than > system-admin stuff, perhaps he'd be much more > favorable towards the > multitude of strengths Erlang has to offer. He's also using the obvious, tempting but very slow io:read_line. Reading the entire file into a binary takes 7 ms (sic) using file:read_file, not 34 seconds using io:read_line as he reports. For a beginner it's not obvious what to use, though, so life could be easier. My own experience with parsing XML in Erlang vs Ruby is that xmerl parsing about 4 MB of XML handily beat "the obvious" Ruby library the other guy used (REXML?), being 10+ times faster or more -- xmerl needed 10 seconds versus "a few minutes" for Ruby. So I wouldn't say Erlang is inherently slow w.r.t. parsing, but again, one may need some experience to get it right. Best, Thomas ____________________________________________________________________________________ Don't let your dream ride pass you by. Make it a reality with Yahoo! Autos. http://autos.yahoo.com/index.html From chris@REDACTED Sun Sep 23 20:39:22 2007 From: chris@REDACTED (Chris Wong) Date: Sun, 23 Sep 2007 11:39:22 -0700 Subject: [erlang-questions] Not an Erlang fan In-Reply-To: <18251.79142.qm@web38815.mail.mud.yahoo.com> References: <18251.79142.qm@web38815.mail.mud.yahoo.com> Message-ID: <45DA8853-9046-4DC6-A065-CE615F2A89FC@chriswongstudio.com> On Sep 23, 2007, at 10:20 AM, Thomas Lindgren wrote: > > My own experience with parsing XML in Erlang vs Ruby > is that xmerl parsing about 4 MB of XML handily beat > "the obvious" Ruby library the other guy used > (REXML?), being 10+ times faster or more -- xmerl > needed 10 seconds versus "a few minutes" for Ruby. So > I wouldn't say Erlang is inherently slow w.r.t. > parsing, but again, one may need some experience to > get it right. > Ruby is known to be very slow. REXML is a pure Ruby XML parser. It's the slowest XML parser I've ever used. You've set the bar too low for xmerl to pass. :-) Now, if xmerl beats a C XML parser, I'd be impressed. :-) Chris From dcaoyuan@REDACTED Sun Sep 23 21:16:42 2007 From: dcaoyuan@REDACTED (Caoyuan) Date: Mon, 24 Sep 2007 03:16:42 +0800 Subject: [erlang-questions] Not an Erlang fan In-Reply-To: <18251.79142.qm@web38815.mail.mud.yahoo.com> References: <8aff81590709230930x1bc2baf7r74916dc4a14d34b1@mail.gmail.com> <18251.79142.qm@web38815.mail.mud.yahoo.com> Message-ID: Tim's example is not about io, read whole file into binary is very quick, but, when you even simply travel a binary byte by byte, it cost a lot of time. I wrote a simple test module, and please take a look at test2/1, which is a funtion simply travel a binary. when the binary is read from a 200M file, travel it will cost about 30s. -module(widefinder). -export([test/1, test1/1, test2/1, test3/1]). test(FileName) -> statistics(wall_clock), {ok, IO} = file:open(FileName, read), {Matched, Total} = scan_line(IO), {_, Duration} = statistics(wall_clock), io:format("Duration ~pms~n Matched:~B, Total:~B", [Duration, Matched, Total]). scan_line(IO) -> scan_line("", IO, 0, -1). scan_line(eof, _, Matched, Total) -> {Matched, Total}; scan_line(Line, IO, Matched, Total) -> NewCount = Matched + process_match(Line), scan_line(io:get_line(IO, ''), IO, NewCount, Total + 1). process_match([]) -> 0; process_match("/ongoing/When/"++Rest) -> case parse_until_space(Rest, false) of true -> 0; false -> 1 end; process_match([_H|Rest]) -> process_match(Rest). test1(FileName) -> statistics(wall_clock), {ok, Bin} = file:read_file(FileName), {Matched, Total} = scan_line1(Bin), {_, Duration} = statistics(wall_clock), io:format("Duration ~pms~n Matched:~B, Total:~B", [Duration, Matched, Total]). scan_line1(Bin) -> scan_line1(Bin, [], 0, 0). scan_line1(<<>>, _Line, Matched, Total) -> {Matched, Total}; scan_line1(<<$\n, Rest/binary>>, Line, Matched, Total) -> %Line1 = lists:reverse(Line), scan_line1(Rest, [], Matched, Total + 1); scan_line1(<>, Line, Matched, Total) -> %NewCount = Matched + process_match(Line), scan_line1(Rest, [C|Line], Matched, Total). test2(FileName) -> statistics(wall_clock), {ok, Bin} = file:read_file(FileName), Total = travel_bin(Bin), {_, Duration} = statistics(wall_clock), io:format("Duration ~pms~n Total:~B", [Duration, Total]). travel_bin(Bin) -> travel_bin(Bin, 0). travel_bin(<<>>, ByteCount) -> ByteCount; travel_bin(<<_C:1/binary, Rest/binary>>, ByteCount) -> travel_bin(Rest, ByteCount + 1). test3(FileName) -> statistics(wall_clock), {ok, Bin} = file:read_file(FileName), Total = travel_list(binary_to_list(Bin)), {_, Duration} = statistics(wall_clock), io:format("Duration ~pms~n Total:~B", [Duration, Total]). travel_list(List) -> travel_list(List, 0). travel_list([], CharCount) -> CharCount; travel_list([_C|Rest], CharCount) -> travel_list(Rest, CharCount + 1). parse_until_space([$\040|_Rest], Bool) -> Bool; parse_until_space([$.|_Rest], _Bool) -> true; parse_until_space([_H|Rest], Bool) -> parse_until_space(Rest, Bool). On 9/24/07, Thomas Lindgren wrote: > > --- Keith Irwin wrote: > > > On 9/23/07, Alex Alvarez wrote: > > > > > > He definitely seems kind of bias at different > > points, but still it would > > > be great to find out where he went wrong! > > > > > > > Isn't it that he's basing his whole analysis on file > > io, what's more, a > > single file which doesn't lend itself to > > parallelism? Had he started by > > writing a client/server or p2p application around > > some domain other than > > system-admin stuff, perhaps he'd be much more > > favorable towards the > > multitude of strengths Erlang has to offer. > > He's also using the obvious, tempting but very slow > io:read_line. Reading the entire file into a binary > takes 7 ms (sic) using file:read_file, not 34 seconds > using io:read_line as he reports. For a beginner it's > not obvious what to use, though, so life could be > easier. > > My own experience with parsing XML in Erlang vs Ruby > is that xmerl parsing about 4 MB of XML handily beat > "the obvious" Ruby library the other guy used > (REXML?), being 10+ times faster or more -- xmerl > needed 10 seconds versus "a few minutes" for Ruby. So > I wouldn't say Erlang is inherently slow w.r.t. > parsing, but again, one may need some experience to > get it right. > > Best, > Thomas > > > > ____________________________________________________________________________________ > Don't let your dream ride pass you by. Make it a reality with Yahoo! Autos. > http://autos.yahoo.com/index.html > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- - Caoyuan From olopierpa@REDACTED Sun Sep 23 21:17:57 2007 From: olopierpa@REDACTED (Pierpaolo Bernardi) Date: Sun, 23 Sep 2007 21:17:57 +0200 Subject: [erlang-questions] Not an Erlang fan In-Reply-To: <18251.79142.qm@web38815.mail.mud.yahoo.com> References: <8aff81590709230930x1bc2baf7r74916dc4a14d34b1@mail.gmail.com> <18251.79142.qm@web38815.mail.mud.yahoo.com> Message-ID: <7352e43a0709231217h6c8c63batf259dfc1a57a79ca@mail.gmail.com> On 9/23/07, Thomas Lindgren wrote: > He's also using the obvious, tempting but very slow > io:read_line. Reading the entire file into a binary > takes 7 ms (sic) using file:read_file, not 34 seconds > using io:read_line as he reports. He reports 34 seconds for the whole log file of about 1 million lines. Not for the reduced sample of about 20000 lines that he made available on the site (a difference of 50x in size). Cheers P. From sgolovan@REDACTED Sun Sep 23 21:55:59 2007 From: sgolovan@REDACTED (Sergei Golovan) Date: Sun, 23 Sep 2007 23:55:59 +0400 Subject: [erlang-questions] SCTP with lksctp 2.6.22-1.0.7 In-Reply-To: <20070820102452.GB11758@erix.ericsson.se> References: <20070820102452.GB11758@erix.ericsson.se> Message-ID: On 8/20/07, Raimo Niskanen wrote: > Yes, in general there are plans to follow the development. > > Could you give me some pointers on how to be compatible > with old versions too. We can not find the latest > version on all our supported platforms, eg. Solaris 10 Mikael Magnusson proposed the attached patch (to R11B-5). It keeps full compatibility with older sctp versions and doesn't make any change to erlang part of the SCTP support in erlang. But in the long run it'd probably better to replace 'adaption' by 'adaptation' in erlang atoms too. Cheers! -- Sergei Golovan -------------- next part -------------- A non-text attachment was scrubbed... Name: inet_drv_sctp.patch Type: application/octet-stream Size: 845 bytes Desc: not available URL: From thomasl_erlang@REDACTED Sun Sep 23 22:00:07 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Sun, 23 Sep 2007 13:00:07 -0700 (PDT) Subject: [erlang-questions] Not an Erlang fan In-Reply-To: <45DA8853-9046-4DC6-A065-CE615F2A89FC@chriswongstudio.com> Message-ID: <986169.96484.qm@web38808.mail.mud.yahoo.com> --- Chris Wong wrote: > > On Sep 23, 2007, at 10:20 AM, Thomas Lindgren wrote: > > > > My own experience with parsing XML in Erlang vs > Ruby > > is that xmerl parsing about 4 MB of XML handily > beat > > "the obvious" Ruby library the other guy used > > (REXML?), being 10+ times faster or more -- xmerl > > needed 10 seconds versus "a few minutes" for Ruby. > So > > I wouldn't say Erlang is inherently slow w.r.t. > > parsing, but again, one may need some experience > to > > get it right. > > > > Ruby is known to be very slow. REXML is a pure Ruby > XML parser. It's > the slowest XML parser I've ever used. > > You've set the bar too low for xmerl to pass. :-) > Now, if xmerl > beats a C XML parser, I'd be impressed. :-) Oh yeah :-) But just to be clear: my point is not that xmerl is beating highly optimized parsers written in portable assembly language nor that REXML is the gold standard of Ruby XML parsing, but that one shouldn't jump to conclusions based on simple examples. I think Erlang and xmerl are not world-beaters but pretty competitive in this instance, and that it's thus premature to say parsing or file processing in Erlang is inherently slow. (As far as I can tell, Tim Bray doesn't say that either.) I'll grant that getting there can be much messier than with scripting languages because there is less support for those kinds of operations. Best, Thomas ____________________________________________________________________________________ Yahoo! oneSearch: Finally, mobile search that gives answers, not web links. http://mobile.yahoo.com/mobileweb/onesearch?refer=1ONXIC From bob@REDACTED Sun Sep 23 23:10:40 2007 From: bob@REDACTED (Bob Ippolito) Date: Mon, 24 Sep 2007 06:10:40 +0900 Subject: [erlang-questions] Not an Erlang fan In-Reply-To: References: <8aff81590709230930x1bc2baf7r74916dc4a14d34b1@mail.gmail.com> Message-ID: <6a36e7290709231410o98e4873ubae018dba10fede1@mail.gmail.com> On 9/24/07, Patrick Logan wrote: > > > > http://www.tbray.org/ongoing/When/200x/2007/09/22/Erlang > > > > > > > > Tim Bray might raise some valid points here, even if he's slightly > > > > biased by his background. > > The good news is speeding up the i/o in erlang should be easier than > introducing better concurrency to another language. > I've never had a problem with Erlang's general I/O performance, it's probably just some implementation detail of direct file I/O that is the loser here. The obvious Erlang fast path to read lines is to spawn cat and let the port machinery do all of the work for you. Here's an example (including a copy of Tim's dataset): http://undefined.org/erlang/o10k.zip -bob From thomasl_erlang@REDACTED Sun Sep 23 22:20:41 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Sun, 23 Sep 2007 13:20:41 -0700 (PDT) Subject: [erlang-questions] Not an Erlang fan In-Reply-To: <7352e43a0709231217h6c8c63batf259dfc1a57a79ca@mail.gmail.com> Message-ID: <731862.22976.qm@web38812.mail.mud.yahoo.com> --- Pierpaolo Bernardi wrote: > On 9/23/07, Thomas Lindgren > wrote: > > > He's also using the obvious, tempting but very > slow > > io:read_line. Reading the entire file into a > binary > > takes 7 ms (sic) using file:read_file, not 34 > seconds > > using io:read_line as he reports. > > He reports 34 seconds for the whole log file of > about 1 million lines. > Not for the reduced sample of about 20000 lines that > he made > available on the site (a difference of 50x in size). Oops, sorry about missing that. Even so, the I/O as such does not appear very costly. Chunk the processing into 50 reads of 2MB each, or whatever size is suitable. The total cost of these operations should then be on the order of 50*7=350 ms (let's say around a second, because it really depends on whether the data have to be fetched from disk, seeks, bandwidth, memory management, etc). At a guess, most of the time will instead be spent in scanning and processing the binaries. Regarding parallelism, it looks to me like the reading and processing can be overlapped. You have to special-case lines or data that span chunks, but apart from that, it looks as if you could process each chunk independently, at least when you are doing map/filter/reduce style operations (where the output is combined incrementally as chunks are processed). Best, Thomas ____________________________________________________________________________________ Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out. http://answers.yahoo.com/dir/?link=list&sid=396545433 From headspin@REDACTED Mon Sep 24 03:32:33 2007 From: headspin@REDACTED (dda) Date: Mon, 24 Sep 2007 09:32:33 +0800 Subject: [erlang-questions] Not an Erlang fan In-Reply-To: <18251.79142.qm@web38815.mail.mud.yahoo.com> References: <8aff81590709230930x1bc2baf7r74916dc4a14d34b1@mail.gmail.com> <18251.79142.qm@web38815.mail.mud.yahoo.com> Message-ID: But what he is parsing here is plain text, not XML -- and his complaints are about i/o and regexes, which are indeed slow. However I think that he's mocking some of Erlang best features without really using them, and I think we should prove him -- he asks for it after all! -- that Erlang can do the job, and that if he can't wrap his old Perl brain around it, not our fault... -- Didier On 9/24/07, Thomas Lindgren wrote: > He's also using the obvious, tempting but very slow > io:read_line. Reading the entire file into a binary > takes 7 ms (sic) using file:read_file, not 34 seconds > using io:read_line as he reports. For a beginner it's > not obvious what to use, though, so life could be > easier. > > My own experience with parsing XML in Erlang vs Ruby > is that xmerl parsing about 4 MB of XML handily beat > "the obvious" Ruby library the other guy used > (REXML?), being 10+ times faster or more -- xmerl > needed 10 seconds versus "a few minutes" for Ruby. So > I wouldn't say Erlang is inherently slow w.r.t. > parsing, but again, one may need some experience to > get it right. > > Best, > Thomas From bhatti_shahzad@REDACTED Mon Sep 24 06:38:49 2007 From: bhatti_shahzad@REDACTED (shahzad bhatti) Date: Sun, 23 Sep 2007 21:38:49 -0700 (PDT) Subject: [erlang-questions] Iterating (Page scrolling) over Mnesia database In-Reply-To: Message-ID: <522107.16504.qm@web81108.mail.mud.yahoo.com> This worked, but is there a way to do page scrolling with explicit start position and number of rows (without skipping manually). Let's say, I am sorting by name, I can't use id to control the start position. I would like to say List = select rows with some query starting from 10000th record and max 200. Thanks again. David King wrote: > I am looking for a way to iterate over the results in the Mnesia > that are ordered by some element, in other words equivalent of > SELECT * FROM TABLE ORDER BY MYFIELD -- that can return results in > cursor like fashion The idea is to combine query handles, like this: mnesia:transaction(fun() -> % give me all of the authors from the author table with an ID over 10 Q1=qlc:q([ X || X <- mnesia:table(author), X#author.id > 10 ]), % sort them by name Q2=qlc:sort(Q1, {order, % I'm using the OrderFun form here. See file_sorter fun(Author1,Author2) -> Author1#author.name < Author2#author.name end}), % and run the query qlc:eval(Q2) end) Note that these query handles aren't evaluated until you ask them to be (with fold, cursor, eval, etc), so it's not as inefficient as sorting them all in memory if, for instance, indexes are available.. To iterate over them, use qlc:fold or qlc:cursor instead of qlc:eval: qlc:fold(fun(Author,AccIn) -> Author#author.id+AccIn end, 0, Q2). That would give me the sum of all of the IDs in the results (which is a bit contrived, but you get the idea) More information at http://www.erlang.org/doc/man/qlc.html > Or page scrolling like > SELECT * FROM TABLE ORDER BY MYFIELD where rownum > 100 and rownum > < 200; > I see foldl and foldr methods can iterate, and qlc can query, but > can someone point me how to implement Cursor or page scrolling > behavior. > > Thanks in advance. > -Shahzad Bhatti > > Moody friends. Drama queens. Your life? Nope! - their life, your > story. > Play Sims Stories at Yahoo! Games. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions --------------------------------- Don't let your dream ride pass you by. Make it a reality with Yahoo! Autos. -------------- next part -------------- An HTML attachment was scrubbed... URL: From vito.detullio@REDACTED Sun Sep 23 20:58:26 2007 From: vito.detullio@REDACTED (ZeD) Date: Sun, 23 Sep 2007 20:58:26 +0200 Subject: [erlang-questions] gs and canvas Message-ID: Hi all, I'm studying erlang, and, ATM I'm looking at GS. It's a nice module, but I find a problem in the canvas objects. AFAIK all canvas objects (arcs, ovals, images...) must have a canvas as a parent, and I can't add a canvas as a child of another canvas, widthout errors... So, how can I create a custom object? As example, I want to generate a "dartboard" object, made of 6 ovals, 6 labes and some line, and I want it haves a unique Id, and to bind all the "generic" event (buttonpress, motion, etc) and maybe some others, and also the same about the Options (coords, hit, etc). Is there an obvious way I can't see? As a workaround I just create the objects, but is a PITA to bind objects togheter externally (and incredibly orrid to see). -- Under construction From thomasl_erlang@REDACTED Mon Sep 24 09:08:24 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 24 Sep 2007 00:08:24 -0700 (PDT) Subject: [erlang-questions] Not an Erlang fan In-Reply-To: Message-ID: <467765.91034.qm@web38802.mail.mud.yahoo.com> --- dda wrote: > But what he is parsing here is plain text, not XML Indeed, but the XML example shows that parsing as such is not inherently slower in Erlang than in Ruby. The point is that simple examples and benchmarks may not generalize to broader statements. > -- and his > complaints are about i/o and regexes, which are > indeed slow. I wouldn't say I/O is inherently slow; for example, reading large chunks of files into memory with file:read_file and similar functions is fast enough. Regexps are currently not a strength and could be sped up. (Robert, here's your time to shine :-) Also, when I consider the use of io:get_line/2, it seems it may be "too easy" to choose a suboptimal solution to some problems. That can be a problem in situations like this, when the user base grows quickly outside the core community and the new users thus can't rely on helpful insiders. Best, Thomas > However I > think that he's mocking some of Erlang best features > without really > using them, and I think we should prove him -- he > asks for it after > all! -- that Erlang can do the job, and that if he > can't wrap his old > Perl brain around it, not our fault... > > -- > Didier > > On 9/24/07, Thomas Lindgren > wrote: > > He's also using the obvious, tempting but very > slow > > io:read_line. Reading the entire file into a > binary > > takes 7 ms (sic) using file:read_file, not 34 > seconds > > using io:read_line as he reports. For a beginner > it's > > not obvious what to use, though, so life could be > > easier. > > > > My own experience with parsing XML in Erlang vs > Ruby > > is that xmerl parsing about 4 MB of XML handily > beat > > "the obvious" Ruby library the other guy used > > (REXML?), being 10+ times faster or more -- xmerl > > needed 10 seconds versus "a few minutes" for Ruby. > So > > I wouldn't say Erlang is inherently slow w.r.t. > > parsing, but again, one may need some experience > to > > get it right. > > > > Best, > > Thomas > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > ____________________________________________________________________________________ Moody friends. Drama queens. Your life? Nope! - their life, your story. Play Sims Stories at Yahoo! Games. http://sims.yahoo.com/ From ulf.wiger@REDACTED Mon Sep 24 09:22:28 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Mon, 24 Sep 2007 09:22:28 +0200 Subject: [erlang-questions] Not an Erlang fan In-Reply-To: <467765.91034.qm@web38802.mail.mud.yahoo.com> References: <467765.91034.qm@web38802.mail.mud.yahoo.com> Message-ID: <46F765B4.7060903@ericsson.com> Thomas Lindgren wrote: > > Also, when I consider the use of io:get_line/2, it > seems it may be "too easy" to choose a suboptimal > solution to some problems. That can be a problem in > situations like this, when the user base grows quickly > outside the core community and the new users thus > can't rely on helpful insiders. There were some suggestions on how to perform line- oriented I/O much faster in Erlang, in this post and the replies that followed: http://www.erlang.org/pipermail/erlang-questions/2007-June/027557.html The problem I ran into was actually lack of flow control: data flowed in so fast that the receiving end couldn't keep up, even with minimal processing. BR, Ulf W From akos.kutvolgyi@REDACTED Mon Sep 24 09:34:24 2007 From: akos.kutvolgyi@REDACTED (Akos kutvolgyi) Date: Mon, 24 Sep 2007 09:34:24 +0200 Subject: [erlang-questions] ODBC Connection Timeout In-Reply-To: <46F2681E.2020002@sei.hu> References: <46F2681E.2020002@sei.hu> Message-ID: <46F76880.1030907@sei.hu> I was trying the {scrollable_cursors, off}. It wasn't solve the timeout problem.:( I was trying to connect to MySQL Database in the same system. - MySQL 5.0.44 - MyODBC 3.51.12 Tested the connectivity to MySQL database using "isql". Everything works. erl > application:start(odbc). > Ret = odbc:connect("DSN=MySQLDatabase;UID=user;PWD=pwd", [{scrollable_cursors, off}]). The output was similar. ** Reason for termination == ** timeout An idea: --------- From the users Guide --------------------- 1.4 About the Erlang ODBC application Provides an Erlang interface to communicate with relational SQL-databases. It is built on top of Microsofts ODBC interface and therefore requires that you have an ODBC driver to the database that you want to connect to. The Erlang ODBC application is designed using the version 3.0 of the ODBC-standard, however using the option {scrollable_cursors, off} for a connection has been known to make it work for at least some 2.X drivers. ----------------------------------------------------- Regards Ingela - OTP team Akos Kutvolgyi wrote: > Hello ALL! > > I could not connect to mssql DB by erlang odbc module in Gentoo Linux. > After odbc:connect(...) I have got Error Report with Timeout Reason. > > The Steps that I've taken. > -Merged unixODBC Driver Manager v2.2.12 > -Merged the freetds ODBC driver with odbc and mssql USE flags. v0.64 > -Merged erlang with hipo,java,kpoll,odbc,smp,ssl and tk USE flags v11.2.5 > -Configured odbc.ini and odbcinst.ini files. > > odbc.ini > > [ODBC Data Sources] > > MyDatabase = FREETDS SQLServer driver > MYSQLPL = My SQL > > > [MyDatabase] > Driver = /usr/lib/libtdsodbc.so > Description = SQL Server > Server = ServerName\SQLEXPRESS > Port = 1433 > Language = > Database = PresenceLog > QuotedId = No > AnsiNPW = No > > > odbcins.ini > > [ODBC Drivers] > > FreeTDS = installed > > > [FreeTDS] > Description = FreeTDS ODBC Driver > Driver = /usr/lib/libtdsodbc.so > Threading = 0 > FileUsage = 1 > DontDLClose = 1 > UsageCount = 1 > > > > Tested the connectivity to MSSQL database using "isql". Everything works. > > Seted the enviroments ODBCINI and ODBCSYSINI > $ export ODBCINI=/etc/unixODBC/odbc.ini > $ export ODBCSYSINI=/etc/unixODBC/ > > Try out sample. > > erl > > application:start(odbc). > > {ok, Ref} = odbc:connect("DSN=MyDatabase;UID=user;PWD=pwd", []). > > Get as output: > > {error,connection_closed} > =ERROR REPORT==== 20-Sep-2007::14:16:58 === > ** Generic server <0.38.0> terminating > ** Last message in was {<0.31.0>, > {connect,[1, > 1, > 2, > 1, > 1, > "DSN=MyDatabase;UID=user;PWD=pwd"], > on, > on}, > infinity} > ** When Server state == {state,#Port<0.105>, > {<0.31.0>,#Ref<0.0.0.68>}, > <0.31.0>, > undefined, > on, > undefined, > undefined, > on, > connecting, > undefined, > 0, > [#Port<0.103>,#Port<0.104>], > undefined, > undefined} > ** Reason for termination == > ** timeout > > > I tried the DSN again via two little c program. > > DSN LIST: > > > #include > #include > #include > > main() { > SQLHENV env; > char dsn[256]; > char desc[256]; > SQLSMALLINT dsn_ret; > SQLSMALLINT desc_ret; > SQLUSMALLINT direction; > SQLRETURN ret; > > SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env); > SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0); > > direction = SQL_FETCH_FIRST; > while(SQL_SUCCEEDED(ret = SQLDataSources(env, direction, > dsn, sizeof(dsn), &dsn_ret, > desc, sizeof(desc), &desc_ret))) { > direction = SQL_FETCH_NEXT; > printf("%s - %s\n", dsn, desc); > if (ret == SQL_SUCCESS_WITH_INFO) printf("\tdata truncation\n"); > } > } > > It founds both of my DSNs. > > Connection TEST by *Edmund Dengler* > > #include > #include > #include > #include > #include > #include > > #define MAX_CONN_STR_OUT 1024 > #define TIME_OUT 10 > > int main() { > unsigned char *connStrIn = "DSN=MyDatabase;UID=user;PWD=pwd"; > SQLCHAR connStrOut[MAX_CONN_STR_OUT]; > SQLRETURN stringlength2ptr, result; > SQLSMALLINT connlen; > > SQLHENV env; > SQLHDBC connect; > > SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env); > SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3, 0); > > SQLAllocHandle(SQL_HANDLE_DBC, env, &connect); > SQLSetConnectAttr(connect, SQL_ATTR_CONNECTION_TIMEOUT, > (SQLPOINTER)TIME_OUT, 0); > SQLSetConnectAttr(connect, SQL_ATTR_AUTOCOMMIT, > (SQLPOINTER)SQL_AUTOCOMMIT_ON, 0); > SQLSetConnectAttr(connect, SQL_ATTR_TRACE, > (SQLPOINTER)SQL_OPT_TRACE_OFF, 0); > > connlen = (SQLSMALLINT)strlen((const char*)connStrIn); > > printf("Connecting\n"); > result = SQLDriverConnect(connect, NULL, > (SQLCHAR *)connStrIn, > connlen, > connStrOut, (SQLSMALLINT)MAX_CONN_STR_OUT, > &stringlength2ptr, SQL_DRIVER_NOPROMPT); > printf("Done (%d)\n", result); > } > > The result was SQL_SUCCESS > > > If anybody has any ideas, they would be greatly appreciated! > From thomasl_erlang@REDACTED Mon Sep 24 09:47:30 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 24 Sep 2007 00:47:30 -0700 (PDT) Subject: [erlang-questions] Not an Erlang fan In-Reply-To: Message-ID: <395265.45231.qm@web38804.mail.mud.yahoo.com> --- Caoyuan wrote: > Tim's example is not about io, read whole file into > binary is very > quick, but, when you even simply travel a binary > byte by byte, it cost > a lot of time. I wrote a simple test module, and > please take a look at > test2/1, which is a funtion simply travel a binary. > when the binary is > read from a 200M file, travel it will cost about > 30s. > test2(FileName) -> > statistics(wall_clock), > {ok, Bin} = file:read_file(FileName), > Total = travel_bin(Bin), > {_, Duration} = statistics(wall_clock), > io:format("Duration ~pms~n Total:~B", [Duration, > Total]). > > travel_bin(Bin) -> travel_bin(Bin, 0). > travel_bin(<<>>, ByteCount) -> ByteCount; > travel_bin(<<_C:1/binary, Rest/binary>>, ByteCount) > -> > travel_bin(Rest, ByteCount + 1). In travel_bin/1, I have two observations: First, there is no need to turn C into a binary. You can get the byte directly as <> That seems simpler and avoids building a binary holding the single byte C, saving a couple of words of heap allocation per element. Second, iterating over the binary that way is a common mistake. When you write <>, you also build a new binary Rest (which is 'just' a couple of pointers, perhaps 3 words). But that is actually _more_ memory consuming than turning the binary into a list (2 words per element). So perhaps simply turning the binary into a list (all at once or in stages) and processing that would be the faster option. One way of speeding things up while keeping the same program structure is to get more than one byte at a time, e.g: loop(<>) -> ..., loop(Rest); loop(Small_bin) -> ... A less pleasant, but more efficient, way of accessing each element of a binary is this: count_bin(Bin) -> M = 0, N = size(Bin), count(M, N, Bin, 0). count(M, N, Bin, Size) -> case Bin of <<_:M/binary, C, _/binary>> -> count(M+1, N, Bin, Size+1); _ -> Size end. (use it like {ok, B} = file:read_file("o10k.txt"), count_bin(B). ) On my machine (1*1.7 GHz, 0.5 GB), the above code walks the o10k 2MB binary in 236 ms. (Using Hipe, 90 ms.) Granted, this is a silly example, but it shows that accessing all the binary elements need not be extremely slow either. (NB: similar code collects the positions of all newlines $\n in the binary in 251 ms.) Best, Thomas ____________________________________________________________________________________ Need a vacation? Get great deals to amazing places on Yahoo! Travel. http://travel.yahoo.com/ From bjorn@REDACTED Mon Sep 24 11:46:33 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 24 Sep 2007 11:46:33 +0200 Subject: [erlang-questions] Not an Erlang fan In-Reply-To: <395265.45231.qm@web38804.mail.mud.yahoo.com> References: <395265.45231.qm@web38804.mail.mud.yahoo.com> Message-ID: I usually don't write about thing we haven't released yet, but in this case I think I'll need to say a few words about binaries in R12B. Although, Thomas's advice is very good for R11B, it could lead to worse performance in R12B. So if you need the very best performance for R11B right now, do as Thomas suggest, but please forget most of it when R12B is released! :-) Thomas Lindgren writes: > Second, iterating over the binary that way is a common > mistake. When you write <>, you also > build a new binary Rest (which is 'just' a couple of > pointers, perhaps 3 words). But that is actually > _more_ memory consuming than turning the binary into a > list (2 words per element). So perhaps simply turning > the binary into a list (all at once or in stages) and > processing that would be the faster option. That is entirely correct in R11B. In R12B, the compiler in many cases will optimize away the building of that new binary (what we call a "sub binary"). > > One way of speeding things up while keeping the same > program structure is to get more than one byte at a > time, e.g: > > loop(<>) -> > ..., loop(Rest); > loop(Small_bin) -> ... This code is fine also in R12B. (But matching out only one element is also quite fast, as no sub binary will be built.) > A less pleasant, but more efficient, way of accessing > each element of a binary is this: Fortunately, the unpleasant way of accessing a binary is the slowest way to access a binary in R12B (because none of the new optimizations can be applied to it), so you should forget it as soon as R12B is released: > count_bin(Bin) -> > M = 0, > N = size(Bin), > count(M, N, Bin, 0). > > count(M, N, Bin, Size) -> > case Bin of > <<_:M/binary, C, _/binary>> -> > count(M+1, N, Bin, Size+1); > _ -> > Size > end. > > (use it like > {ok, B} = file:read_file("o10k.txt"), > count_bin(B). > ) > /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From rvirding@REDACTED Mon Sep 24 11:47:21 2007 From: rvirding@REDACTED (Robert Virding) Date: Mon, 24 Sep 2007 11:47:21 +0200 Subject: [erlang-questions] He really hates us! Message-ID: <3dbc6d1c0709240247j2a97ff85g600404355b3c4cb1@mail.gmail.com> He's at it again and he really hates us: http://rebelscience.blogspot.com/2007/09/why-i-think-functional-programming.html I can't wait for the next installment. And no, I'm not going to bother with replying to him. :-) Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomasl_erlang@REDACTED Mon Sep 24 14:13:40 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 24 Sep 2007 05:13:40 -0700 (PDT) Subject: [erlang-questions] Not an Erlang fan In-Reply-To: Message-ID: <919586.45600.qm@web38805.mail.mud.yahoo.com> --- Bjorn Gustavsson wrote: > I usually don't write about thing we haven't > released yet, > but in this case I think I'll need to say a few > words about > binaries in R12B. > > Although, Thomas's advice is very good for R11B, it > could lead to > worse performance in R12B. So if you need the very > best performance > for R11B right now, do as Thomas suggest, but please > forget most of > it when R12B is released! :-) You guys need to release an optimization guide :-) Or perhaps more fast, common operations on binaries, so we/I can abandon these tricks. Best, Thomas ____________________________________________________________________________________ Don't let your dream ride pass you by. Make it a reality with Yahoo! Autos. http://autos.yahoo.com/index.html From dcaoyuan@REDACTED Mon Sep 24 14:30:38 2007 From: dcaoyuan@REDACTED (Caoyuan) Date: Mon, 24 Sep 2007 20:30:38 +0800 Subject: [erlang-questions] Not an Erlang fan In-Reply-To: References: <500037.45015.qm@web38806.mail.mud.yahoo.com> Message-ID: On 9/24/07, Thomas Lindgren wrote: > > --- Caoyuan wrote: > > > For a 2M data file, test2/1 also cost about 300ms in > > my machine, but > > this is not a good result for 200M file too. > > > > What I'm wondering is, for Tim's example or a lot of > > other cases, when > > you should process a very big text/binary, you have > > to travel it in > > some way, so, what's the best efficient way? > > Currently, all test2/1. > > test3/1 or similar code are not efficient enough. > > Hi Caoyuan, > > It's of course difficult to give a single solution > that is best in every instance. And sometimes, the > best available solution might just not be fast enough. > The previous mail is most of the toolbox I currently > use on the micro level. > > 1. Try to process larger parts of binaries at once to > amortize 'shared' work. > > 2. Use tricks like the "load byte" thing of the last > example. > > 3. Sometimes, converting the binary to a list and > traversing the list can be the best solution. > I try to split big binary to smaller pieces than, convert them to list, here's the code: scan(FileName) -> statistics(wall_clock), {ok, Bin} = file:read_file(FileName), {_, Duration1} = statistics(wall_clock), io:format("Duration reading: ~pms~n", [Duration1]), {Matched, Total} = split_scan(Bin, 1024 * 1024, []), {_, Duration2} = statistics(wall_clock), io:format("Duration ~pms~n Matched:~B, Total:~B~n", [Duration2, Matched, Total]). split_scan(<<>>, _SplitSize, _PreLeft) -> {0, 0}; split_scan(Bin, SplitSize, PreLeft) -> Size = size(Bin), io:format("splitting: ~B~n", [Size]), {Bin1, Rest} = if Size >= SplitSize -> <> = Bin, {BinX, RestX}; true -> {Bin, <<>>} end, {Matched, Total, Left} = scan_line(binary_to_list(Bin1), PreLeft), split_scan(Rest, SplitSize, Left). scan_line(Bin, PreLeft) -> scan_line(Bin, lists:reverse(PreLeft), 0, 0). scan_line([], Line, Matched, Total) -> {Matched, Total, Line}; scan_line([$\n|Rest], Line, Matched, Total) -> Line1 = lists:reverse(Line), %Matched1 = Matched + process_match(Line1), scan_line(Rest, [], Matched, Total + 1); scan_line([C|Rest], Line , Matched, Total) -> scan_line(Rest, [C|Line], Matched, Total). But the costed time seems not decreased, or, even worse. > 4. Use the erlang builtins, if applicable. (See the > erlang module.) > > For instance, Ulf Wiger pointed to a trick that > delivers data in lines at a high rate. Another > approach (very hacky) could be to send the data via a > loopback gen_tcp socket set in 'line' mode, then > matching the lines as they arrive. > > 5. (Write erlang drivers.) This is fairly popular for > some problems but then you're not doing Erlang > programming anymore. > > On the mesolevel (sorry :-) a better algorithm may be > what you need. But in this specific case, it might not > be applicable. > > On the macro level, splitting the 200M file into > smaller parts and processing each of them > independently (and combining the results afterwards) > probably maps nicely to multiple cores. That's the > MapReduce or "make -j" approach, if you will. I think > there was a fine example of this available via the > comments on Tim Bray's blog (the WF II post). > > Likewise, you can probably overlap reading data from > disk with processing it. Pipelining can be useful, but > again, in this case the effects are probably small. > > Hope this helps. > > Best, > Thomas > > > > > I read 'A Stream Library using Erlang Binaries' before: http://www.duomark.com/erlang/publications/acm2005.pdf Where a lot of implement information on Binary/List/Tuple in Erlang. Thanks for these suggestions. I'm with a lot of interesting to find the way to handle large text/binary efficiently enough in Erlang, and like to see more discuss on this topic. Best, Caoyuan -- - Caoyuan From bjorn@REDACTED Mon Sep 24 14:38:39 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 24 Sep 2007 14:38:39 +0200 Subject: [erlang-questions] Not an Erlang fan In-Reply-To: <919586.45600.qm@web38805.mail.mud.yahoo.com> References: <919586.45600.qm@web38805.mail.mud.yahoo.com> Message-ID: Thomas Lindgren writes: > --- Bjorn Gustavsson wrote: > > > Although, Thomas's advice is very good for R11B, it > > could lead to > > worse performance in R12B. So if you need the very > > best performance > > for R11B right now, do as Thomas suggest, but please > > forget most of > > it when R12B is released! :-) I plan to do extensive updates to the Efficiency Guide for R12B (and not only for binaries). /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From vinoski@REDACTED Mon Sep 24 15:11:30 2007 From: vinoski@REDACTED (Steve Vinoski) Date: Mon, 24 Sep 2007 09:11:30 -0400 Subject: [erlang-questions] Not an Erlang fan In-Reply-To: <6a36e7290709231410o98e4873ubae018dba10fede1@mail.gmail.com> References: <8aff81590709230930x1bc2baf7r74916dc4a14d34b1@mail.gmail.com> <6a36e7290709231410o98e4873ubae018dba10fede1@mail.gmail.com> Message-ID: <65b2728e0709240611m5d93ab4eg899ba8f0c2b56b34@mail.gmail.com> On 9/23/07, Bob Ippolito wrote: > > On 9/24/07, Patrick Logan wrote: > > > > > http://www.tbray.org/ongoing/When/200x/2007/09/22/Erlang > > > > > > > > > > Tim Bray might raise some valid points here, even if he's slightly > > > > > biased by his background. > > > > The good news is speeding up the i/o in erlang should be easier than > > introducing better concurrency to another language. > > > > I've never had a problem with Erlang's general I/O performance, it's > probably just some implementation detail of direct file I/O that is > the loser here. The obvious Erlang fast path to read lines is to spawn > cat and let the port machinery do all of the work for you. Here's an > example (including a copy of Tim's dataset): > > http://undefined.org/erlang/o10k.zip > I posted a link in a comment to Tim's blog to an example that uses multiple processes to break down the expensive parts of processing Tim's dataset in parallel, and was able to achieve a pure Erlang approach that on my MacBook Pro equals your "cat" approach, and is much faster than "cat" on an 8-core machine. It's shown on my blog: It definitely speeds up as the number of cores goes up. I don't consider myself an Erlang expert and so welcome any suggestions for improving this. I'm guessing someone will see the two instances of "++" list handling and jump on that, but I tried it with the typical reverse approach and with flattening and neither was faster. However I am quite open to being enlightened. :-) --steve -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlangx@REDACTED Mon Sep 24 16:14:10 2007 From: erlangx@REDACTED (Michael McDaniel) Date: Mon, 24 Sep 2007 07:14:10 -0700 Subject: [erlang-questions] ODBC Connection Timeout In-Reply-To: <46F76880.1030907@sei.hu> References: <46F2681E.2020002@sei.hu> <46F76880.1030907@sei.hu> Message-ID: <20070924141409.GG10320@delora.autosys.us> On Mon, Sep 24, 2007 at 09:34:24AM +0200, Akos kutvolgyi wrote: > I was trying the {scrollable_cursors, off}. It wasn't solve the timeout problem.:( > > > I was trying to connect to MySQL Database in the same system. > > - MySQL 5.0.44 > > - MyODBC 3.51.12 > > > > Tested the connectivity to MySQL database using "isql". Everything > works. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ What is default timeout value for "isql" ? Appears that timeout value for odbc:connect/2 is too low for your environment and needs to be higher. I suggest setting it high and if that works, back it off until discover where it typically times out. Then set above threshold. ~Michael > > erl > > application:start(odbc). > > Ret = odbc:connect("DSN=MySQLDatabase;UID=user;PWD=pwd", [{scrollable_cursors, off}]). > > > > > The output was similar. > > ** Reason for termination == > ** timeout > > > > An idea: > > > --------- From the users Guide --------------------- > > 1.4 About the Erlang ODBC application > > Provides an Erlang interface to communicate with relational > SQL-databases. It is built on top of Microsofts ODBC interface and > therefore requires that you have an ODBC driver to the database that > you want to connect to. The Erlang ODBC application is designed using > the version 3.0 of the ODBC-standard, however using the option > {scrollable_cursors, off} for a connection has been known to make it > work for at least some 2.X drivers. > > ----------------------------------------------------- > > Regards Ingela - OTP team > > > Akos Kutvolgyi wrote: > > > Hello ALL! > > > > I could not connect to mssql DB by erlang odbc module in Gentoo Linux. > > After odbc:connect(...) I have got Error Report with Timeout Reason. > > > > The Steps that I've taken. > > -Merged unixODBC Driver Manager v2.2.12 > > -Merged the freetds ODBC driver with odbc and mssql USE flags. v0.64 > > -Merged erlang with hipo,java,kpoll,odbc,smp,ssl and tk USE flags v11.2.5 > > -Configured odbc.ini and odbcinst.ini files. > > > > odbc.ini > > > > [ODBC Data Sources] > > > > MyDatabase = FREETDS SQLServer driver > > MYSQLPL = My SQL > > > > > > [MyDatabase] > > Driver = /usr/lib/libtdsodbc.so > > Description = SQL Server > > Server = ServerName\SQLEXPRESS > > Port = 1433 > > Language = > > Database = PresenceLog > > QuotedId = No > > AnsiNPW = No > > > > > > odbcins.ini > > > > [ODBC Drivers] > > > > FreeTDS = installed > > > > > > [FreeTDS] > > Description = FreeTDS ODBC Driver > > Driver = /usr/lib/libtdsodbc.so > > Threading = 0 > > FileUsage = 1 > > DontDLClose = 1 > > UsageCount = 1 > > > > > > > > Tested the connectivity to MSSQL database using "isql". Everything works. > > > > Seted the enviroments ODBCINI and ODBCSYSINI > > $ export ODBCINI=/etc/unixODBC/odbc.ini > > $ export ODBCSYSINI=/etc/unixODBC/ > > > > Try out sample. > > > > erl > > > application:start(odbc). > > > {ok, Ref} = odbc:connect("DSN=MyDatabase;UID=user;PWD=pwd", []). > > > > Get as output: > > > > {error,connection_closed} > > =ERROR REPORT==== 20-Sep-2007::14:16:58 === > > ** Generic server <0.38.0> terminating > > ** Last message in was {<0.31.0>, > > {connect,[1, > > 1, > > 2, > > 1, > > 1, > > "DSN=MyDatabase;UID=user;PWD=pwd"], > > on, > > on}, > > infinity} > > ** When Server state == {state,#Port<0.105>, > > {<0.31.0>,#Ref<0.0.0.68>}, > > <0.31.0>, > > undefined, > > on, > > undefined, > > undefined, > > on, > > connecting, > > undefined, > > 0, > > [#Port<0.103>,#Port<0.104>], > > undefined, > > undefined} > > ** Reason for termination == > > ** timeout > > > > > > I tried the DSN again via two little c program. > > > > DSN LIST: > > > > > > #include > > #include > > #include > > > > main() { > > SQLHENV env; > > char dsn[256]; > > char desc[256]; > > SQLSMALLINT dsn_ret; > > SQLSMALLINT desc_ret; > > SQLUSMALLINT direction; > > SQLRETURN ret; > > > > SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env); > > SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0); > > > > direction = SQL_FETCH_FIRST; > > while(SQL_SUCCEEDED(ret = SQLDataSources(env, direction, > > dsn, sizeof(dsn), &dsn_ret, > > desc, sizeof(desc), &desc_ret))) { > > direction = SQL_FETCH_NEXT; > > printf("%s - %s\n", dsn, desc); > > if (ret == SQL_SUCCESS_WITH_INFO) printf("\tdata truncation\n"); > > } > > } > > > > It founds both of my DSNs. > > > > Connection TEST by *Edmund Dengler* > > > > #include > > #include > > #include > > #include > > #include > > #include > > > > #define MAX_CONN_STR_OUT 1024 > > #define TIME_OUT 10 > > > > int main() { > > unsigned char *connStrIn = "DSN=MyDatabase;UID=user;PWD=pwd"; > > SQLCHAR connStrOut[MAX_CONN_STR_OUT]; > > SQLRETURN stringlength2ptr, result; > > SQLSMALLINT connlen; > > > > SQLHENV env; > > SQLHDBC connect; > > > > SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env); > > SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3, 0); > > > > SQLAllocHandle(SQL_HANDLE_DBC, env, &connect); > > SQLSetConnectAttr(connect, SQL_ATTR_CONNECTION_TIMEOUT, > > (SQLPOINTER)TIME_OUT, 0); > > SQLSetConnectAttr(connect, SQL_ATTR_AUTOCOMMIT, > > (SQLPOINTER)SQL_AUTOCOMMIT_ON, 0); > > SQLSetConnectAttr(connect, SQL_ATTR_TRACE, > > (SQLPOINTER)SQL_OPT_TRACE_OFF, 0); > > > > connlen = (SQLSMALLINT)strlen((const char*)connStrIn); > > > > printf("Connecting\n"); > > result = SQLDriverConnect(connect, NULL, > > (SQLCHAR *)connStrIn, > > connlen, > > connStrOut, (SQLSMALLINT)MAX_CONN_STR_OUT, > > &stringlength2ptr, SQL_DRIVER_NOPROMPT); > > printf("Done (%d)\n", result); > > } > > > > The result was SQL_SUCCESS > > > > > > If anybody has any ideas, they would be greatly appreciated! > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > !DSPAM:52,46f7686873326900152256! > > -- Michael McDaniel Portland, Oregon, USA http://autosys.us +1 503 283 5284 From vinoski@REDACTED Mon Sep 24 16:54:23 2007 From: vinoski@REDACTED (Steve Vinoski) Date: Mon, 24 Sep 2007 10:54:23 -0400 Subject: [erlang-questions] Not an Erlang fan In-Reply-To: <65b2728e0709240611m5d93ab4eg899ba8f0c2b56b34@mail.gmail.com> References: <8aff81590709230930x1bc2baf7r74916dc4a14d34b1@mail.gmail.com> <6a36e7290709231410o98e4873ubae018dba10fede1@mail.gmail.com> <65b2728e0709240611m5d93ab4eg899ba8f0c2b56b34@mail.gmail.com> Message-ID: <65b2728e0709240754s242aac51pe95e11ad43c8f705@mail.gmail.com> On 9/24/07, Steve Vinoski wrote: > > On 9/23/07, Bob Ippolito wrote: > > > > On 9/24/07, Patrick Logan wrote: > > > > > > http://www.tbray.org/ongoing/When/200x/2007/09/22/Erlang > > > > > > > > > > > > Tim Bray might raise some valid points here, even if he's > > slightly > > > > > > biased by his background. > > > > > > The good news is speeding up the i/o in erlang should be easier than > > > introducing better concurrency to another language. > > > > > > > I've never had a problem with Erlang's general I/O performance, it's > > probably just some implementation detail of direct file I/O that is > > the loser here. The obvious Erlang fast path to read lines is to spawn > > cat and let the port machinery do all of the work for you. Here's an > > example (including a copy of Tim's dataset): > > > > http://undefined.org/erlang/o10k.zip > > > > I posted a link in a comment to Tim's blog to an example that uses > multiple processes to break down the expensive parts of processing Tim's > dataset in parallel, and was able to achieve a pure Erlang approach that on > my MacBook Pro equals your "cat" approach, and is much faster than "cat" on > an 8-core machine. It's shown on my blog: > > > > > It definitely speeds up as the number of cores goes up. > > > I don't consider myself an Erlang expert and so welcome any suggestions > for improving this. I'm guessing someone will see the two instances of "++" > list handling and jump on that, but I tried it with the typical reverse > approach and with flattening and neither was faster. However I am quite open > to being enlightened. :-) > Just a follow-up: a couple people have mentioned that I must be missing the fact that Tim's sample dataset in 100 times smaller than the real dataset. No, I'm not missing that, as I explained in a comment on my blog. I think it's obvious that any solution that counts on reading in the whole file at once, like mine does, will have trouble with the full dataset. For that, I think a combination of Bob's "cat port" and my multiprocess line analysis would yield the best of both worlds. --steve -------------- next part -------------- An HTML attachment was scrubbed... URL: From paulp@REDACTED Mon Sep 24 17:51:24 2007 From: paulp@REDACTED (Paul Phillips) Date: Mon, 24 Sep 2007 08:51:24 -0700 Subject: [erlang-questions] strings, json, and what happens now Message-ID: <20070924154551.GA7140@jon.loc> When I read something like this: http://www.lshift.net/blog/2007/09/13/how-should-json-strings-be-represented-in-erlang It says to me that some decision has to be made about improving string representations in erlang, or there are going to be several incompatible implementations in the wild soon. Are there good arguments against standardizing on an enhanced string "type" of a tuple including the list of characters and whatever metadata people are accustomed to having in other languages? I know this could be done without core language support if you were willing to wrap and unwrap it everytime you interacted with stdlib, or via a brand new string library which operates on the tuples, which seems more likely. But there's already so much important code spread out among third party libraries, it seems a shame to add to it, especially given the immaturity of erlang's library mechanisms when compared to gem, cpan, etc. I'm not particularly fascinated by character encodings and language impedance mismatches, and I would suppose neither are most people, but as someone presently trying to apply erlang in a real world setting this issue is demanding a large percentage of my initial time investment. Do those who speak for the distribution see the string representation as a problem? And is there some agreement on a way to deal with it? Thanks, -- Paul Phillips | It's better to have gloved and tossed than never to Analgesic | have played baseball. Empiricist | all hip pupils! |----------* http://www.improving.org/paulp/ *---------- From thomasl_erlang@REDACTED Mon Sep 24 18:20:08 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 24 Sep 2007 09:20:08 -0700 (PDT) Subject: [erlang-questions] Not an Erlang fan In-Reply-To: Message-ID: <761781.89097.qm@web38802.mail.mud.yahoo.com> --- Caoyuan wrote: > On 9/24/07, Thomas Lindgren > wrote: > > > > --- Caoyuan wrote: > > > > > For a 2M data file, test2/1 also cost about > 300ms in > > > my machine, but > > > this is not a good result for 200M file too. > > > > > > What I'm wondering is, for Tim's example or a > lot of > > > other cases, when > > > you should process a very big text/binary, you > have > > > to travel it in > > > some way, so, what's the best efficient way? > > > Currently, all test2/1. > > > test3/1 or similar code are not efficient > enough. > > > > Hi Caoyuan, > > > > It's of course difficult to give a single solution > > that is best in every instance. And sometimes, the > > best available solution might just not be fast > enough. > > The previous mail is most of the toolbox I > currently > > use on the micro level. > > > > 1. Try to process larger parts of binaries at once > to > > amortize 'shared' work. > > > > 2. Use tricks like the "load byte" thing of the > last > > example. > > > > 3. Sometimes, converting the binary to a list and > > traversing the list can be the best solution. > > > > I try to split big binary to smaller pieces than, > convert them to > list, here's the code: > > scan(FileName) -> > statistics(wall_clock), > {ok, Bin} = file:read_file(FileName), > {_, Duration1} = statistics(wall_clock), > io:format("Duration reading: ~pms~n", > [Duration1]), > > {Matched, Total} = split_scan(Bin, 1024 * 1024, > []), > {_, Duration2} = statistics(wall_clock), > io:format("Duration ~pms~n Matched:~B, > Total:~B~n", [Duration2, > Matched, Total]). > > split_scan(<<>>, _SplitSize, _PreLeft) -> {0, 0}; > split_scan(Bin, SplitSize, PreLeft) -> > Size = size(Bin), > io:format("splitting: ~B~n", [Size]), > {Bin1, Rest} = if Size >= SplitSize -> > < RestX/binary>> = Bin, > {BinX, RestX}; > true -> > {Bin, <<>>} > end, > {Matched, Total, Left} = > scan_line(binary_to_list(Bin1), PreLeft), > split_scan(Rest, SplitSize, Left). > > scan_line(Bin, PreLeft) -> scan_line(Bin, > lists:reverse(PreLeft), 0, 0). > scan_line([], Line, Matched, Total) -> {Matched, > Total, Line}; > scan_line([$\n|Rest], Line, Matched, Total) -> > Line1 = lists:reverse(Line), > %Matched1 = Matched + process_match(Line1), > scan_line(Rest, [], Matched, Total + 1); > scan_line([C|Rest], Line , Matched, Total) -> > scan_line(Rest, [C|Line], Matched, Total). > > But the costed time seems not decreased, or, even > worse. > > > 4. Use the erlang builtins, if applicable. (See > the > > erlang module.) > > > > For instance, Ulf Wiger pointed to a trick that > > delivers data in lines at a high rate. Another > > approach (very hacky) could be to send the data > via a > > loopback gen_tcp socket set in 'line' mode, then > > matching the lines as they arrive. > > > > 5. (Write erlang drivers.) This is fairly popular > for > > some problems but then you're not doing Erlang > > programming anymore. > > > > On the mesolevel (sorry :-) a better algorithm may > be > > what you need. But in this specific case, it might > not > > be applicable. > > > > On the macro level, splitting the 200M file into > > smaller parts and processing each of them > > independently (and combining the results > afterwards) > > probably maps nicely to multiple cores. That's the > > MapReduce or "make -j" approach, if you will. I > think > > there was a fine example of this available via the > > comments on Tim Bray's blog (the WF II post). > > > > Likewise, you can probably overlap reading data > from > > disk with processing it. Pipelining can be useful, > but > > again, in this case the effects are probably > small. > > > > Hope this helps. > > > > Best, > > Thomas > > > > > > > > > > > > I read 'A Stream Library using Erlang Binaries' > before: > http://www.duomark.com/erlang/publications/acm2005.pdf > Where a lot of implement information on > Binary/List/Tuple in Erlang. > > Thanks for these suggestions. > > I'm with a lot of interesting to find the way to > handle large > text/binary efficiently enough in Erlang, and like > to see more discuss > on this topic. A small bit of further data: I built a 200M file from the original 2M data. On my machine, the final step of pasting together 10 20M files with cat needed 5.54 seconds real, user 0.04; sys 1.35. Presumably, my laptop won't do much better than that in the I/O department. Reading the file back into Erlang (using file:read_file) needed 8.147 seconds. Not too shabby, but it could do better. Finally, using the R11 "load byte" idiom of traversing the whole binary to locate all newlines needed 6.28 seconds (ie, running at 31.8 MB/s if you will :-). (Hipe didn't improve things.) It would be interesting to see how and whether reading and processing the file could be overlapped and split/parallelized. (It doesn't seem impossible, does it?) Note that this does not include the actual regexp search of each line ... The code to do that could be an FSM + dictionary insert instead of the simple check-and-accumulate for newline. Extra cost? Unclear. One could merge that code into the scanning the binary but this should ideally be done by a regexp compiler, shouldn't it? Not done at this time AFAIK. Best, Thomas ____________________________________________________________________________________ Shape Yahoo! in your own image. Join our Network Research Panel today! http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 From davidnwelton@REDACTED Mon Sep 24 18:42:38 2007 From: davidnwelton@REDACTED (David Welton) Date: Mon, 24 Sep 2007 18:42:38 +0200 Subject: [erlang-questions] elisp snippet - function comment skeleton Message-ID: <9877cd600709240942h5ef536c7n45580b5ebb265b1b@mail.gmail.com> In case anyone is interested in this sort of thing and hasn't already built their own: (define-skeleton erlang-function-comment "Create Erlang comment to describe next function" nil "%%-------------------------------------------------------------------- %% Function: " (progn (save-excursion (re-search-forward "\\(^[a-z][^(]*\\)(\\([^)]*\\))" nil t) (concat (match-string 1) "(" (match-string 2) ") -> "))) " %% %% Description: %%--------------------------------------------------------------------") This grabs the next function, and puts a fancy comment in front of it. -- David N. Welton http://www.welton.it/davidw/ From dking@REDACTED Mon Sep 24 19:51:52 2007 From: dking@REDACTED (David King) Date: Mon, 24 Sep 2007 10:51:52 -0700 Subject: [erlang-questions] Iterating (Page scrolling) over Mnesia database In-Reply-To: <522107.16504.qm@web81108.mail.mud.yahoo.com> References: <522107.16504.qm@web81108.mail.mud.yahoo.com> Message-ID: > This worked, but is there a way to do page scrolling with explicit > start position and number of rows (without skipping manually). > Let's say, I am sorting by name, I can't use id to control the > start position. I would like to say > List = select rows with some query starting from 10000th record and > max 200. > Thanks again. You might want to start by using your internal IDs, like qlc:q([ { X#article.title, X#article.contents} || X <- qlc:table(article), X#article.id > 100, X#article.id < 110 ]). That's easiest to understand for me, anyway. But if you want paging based on the results rather than the table (if you need constant- sized pages, like for visual paging for a web site), take a look at qlc:table/2, especially this part: > The binary callback function LookupFun is used for looking up > objects in the table. The first argument Position is the key > position or an indexed position and the second argument Keys is a > sorted list of unique values. The return value is to be a list of > all objects (tuples) such that the element at Position is a member > of Keys. Any other return value is immediately returned as value of > the query evaluation I haven't tried it, but it's a good place to start looking, at least From klacke@REDACTED Mon Sep 24 19:55:12 2007 From: klacke@REDACTED (Claes Wikstrom) Date: Mon, 24 Sep 2007 19:55:12 +0200 Subject: [erlang-questions] Not an Erlang fan In-Reply-To: <6a36e7290709231410o98e4873ubae018dba10fede1@mail.gmail.com> References: <8aff81590709230930x1bc2baf7r74916dc4a14d34b1@mail.gmail.com> <6a36e7290709231410o98e4873ubae018dba10fede1@mail.gmail.com> Message-ID: <46F7FA00.8070507@hyber.org> Bob Ippolito wrote: > On 9/24/07, Patrick Logan wrote: >>>>> http://www.tbray.org/ongoing/When/200x/2007/09/22/Erlang >>>>> >>>>> Tim Bray might raise some valid points here, even if he's slightly >>>>> biased by his background. >> The good news is speeding up the i/o in erlang should be easier than >> introducing better concurrency to another language. >> > > I've never had a problem with Erlang's general I/O performance, it's > probably just some implementation detail of direct file I/O that is > the loser here. The obvious Erlang fast path to read lines is to spawn > cat and let the port machinery do all of the work for you. Here's an > example (including a copy of Tim's dataset): > spawning cat is actually a very bad idea - It'll lead to all kinds of havoc since ports don't by themselves have any means to do flow control. Spawning cat will lead to a situation where a whole lot of messages will be sent to the owner of the port. When we do socket I/O this is the equivalent of having {active ,true} on a socket, we'll just get a lot of messages and if we cannot process the messages at the same speed or higher than we receive them our message inbox will fill up and we'll just be spending time in the garbage collector - bad. We need the equivalent of {active once} on ports to do this efficiently. There exists a very nice {line, L} mode for ports, but that still doesn't solve the problem of flow control. No, the only fast way today to process a large file line/by/line is to 1. file:open(Filename, [read, raw]) 2. In a loop {ok, Bin} = file:read(Fd, BufSize), 3. Use a binary regex matcher such as http://yaws.hyber.org/download/posregex-1.0.tgz (I don't know the state of the regex lib in OTP today, last time I looked it sucked bigtime though) /klacke From rvirding@REDACTED Tue Sep 25 00:18:19 2007 From: rvirding@REDACTED (Robert Virding) Date: Tue, 25 Sep 2007 00:18:19 +0200 Subject: [erlang-questions] He really hates us! In-Reply-To: <3dbc6d1c0709240247j2a97ff85g600404355b3c4cb1@mail.gmail.com> References: <3dbc6d1c0709240247j2a97ff85g600404355b3c4cb1@mail.gmail.com> Message-ID: <3dbc6d1c0709241518l3853f4e4i3491a1733b52de98@mail.gmail.com> Many apparently don't share my amusement with this guy. I just become fascinated by what he thinks of next. It's like watching a reality TV-show where at the same time you are repulsed by it you become captivated by the stupidity of the people taking part in it. I suppose you need the right (wrong?) sort of humour to appreciate it. I won't bore you with it any more. Robert On 24/09/2007, Robert Virding wrote: > > He's at it again and he really hates us: > > http://rebelscience.blogspot.com/2007/09/why-i-think-functional-programming.html > > > I can't wait for the next installment. And no, I'm not going to bother > with replying to him. :-) > > Robert > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From igwan@REDACTED Tue Sep 25 01:05:09 2007 From: igwan@REDACTED (igwan) Date: Tue, 25 Sep 2007 01:05:09 +0200 Subject: [erlang-questions] gen_tcp receving slow Message-ID: <46F842A5.4080801@free.fr> Hi list ! I'm writing a HTTP server and while doing some benchmarks on big POST/PUT requests (file uploads), I was a little surprised with the results. I bypassed my parsing code, just to be sure, and tested on Linux and Win32 with R11B-5, all this on the loopback interface. The incoming data throughput doesn't get over 5 MB/s or so during the transfer while my Intel 2Ghz Intel CPU is 100 % busy with "werl". On my linux box, it's around 2,5MB/s on a 2Ghz Via CPU, again 100% busy. I'm using [{active, true}, {packet, raw}, binary] as inet options. ETop doesn't show any message queue growing, they're all zero during the receiving. The CPU load that it displays, unlike the one indicated by 'top', stays very low, 0 or 1 most of the time, and no more than 15 during the whole process. Where's the CPU time going ? As I have Yaws installed on my linux box, I did some tests, in case I was missing some obvious inet option that the guy who wrote such a nice beast as Yaws would undoubtly have got right. GETting a file using Curl is fast : 32MB/s ... POSTing or PUTing a file goes no faster than 2MB/s at 100% CPU load. Have you experienced such **asymmetry on TCP data transfers ? Any ideas about where it comes from ? Thanks for your help, igwan From yarivsadan@REDACTED Tue Sep 25 03:58:08 2007 From: yarivsadan@REDACTED (Yariv Sadan) Date: Mon, 24 Sep 2007 18:58:08 -0700 Subject: [erlang-questions] new site built with Erlang Message-ID: <17244f480709241858q2d968348nae1c1aff3bddef44@mail.gmail.com> Hi, I hope this isn't an inappropriate place to make this announcement, but I created this site with Erlang (using ErlyWeb), and I wanted to share it with the list: http://vimagi.com. Vimagi is the second site built with ErlyWeb, following http://beerriot.com. Now would be a great time for artistically inclined Erlangers to visit Vimagi and unleash their creativity! :) Cheers, Yariv From klacke@REDACTED Tue Sep 25 10:35:50 2007 From: klacke@REDACTED (Claes Wikstrom) Date: Tue, 25 Sep 2007 10:35:50 +0200 Subject: [erlang-questions] gen_tcp receving slow In-Reply-To: <46F842A5.4080801@free.fr> References: <46F842A5.4080801@free.fr> Message-ID: <46F8C866.3010403@hyber.org> igwan wrote: > POSTing or PUTing a file goes no faster than 2MB/s > at 100% CPU load. > Here's my guess, when POST'ing data you'd typically POST to .yaws page which then subsequently invokes yaws_api:parse_post/1 There is a lot of parsing that goes on in order to split up a POST into its components. This code can undoubtedly be made a lot faster - especially when the case is a simple file upload and you just want to stream the data to an output file. So - this is no TCP asymmetry - it's just poorly written parse code that parse the POSTed data. /klacke From oscar@REDACTED Tue Sep 25 11:01:14 2007 From: oscar@REDACTED (=?ISO-8859-1?Q?Oscar_Hellstr=F6m?=) Date: Tue, 25 Sep 2007 10:01:14 +0100 Subject: [erlang-questions] Strange behaviour of element/2 inside list comprehensions Message-ID: <46F8CE5A.4040907@erlang-consulting.com> Hi, I've noticed that element/2 doesn't exit with a badarg as I expected when used in a list comprehension. Other functions that exit with badarg are behaving as expected though. Is this actually the intended behaviour? (I'm using R11B-4 but have also seen it on R11B-3). Example: 1> [Foo || Foo <- [{1,2}], element(3, Foo) /= 9]. [] 5> [Foo || Foo <- [{1,2}], list_to_integer(Foo) /= 10]. =ERROR REPORT==== 25-Sep-2007::09:58:45 === Error in process <0.38.0> with exit value: {badarg,[{erlang,list_to_integer,[{1,2}]},{erl_eval,do_apply,5},{erl_eval,expr,5},{erl_eval,eval_filter,6},{erl_eval,eval_generate,7},{erl_eval,eval_lc,6},{shell,exprs,6},{shell,eval_loop,3}]} ... 3> element(3, {1,2}). =ERROR REPORT==== 25-Sep-2007::09:55:30 === Error in process <0.31.0> with exit value: {badarg,[{erlang,element,[3,{1,2}]},{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} ... 4> > lists:filter(fun(Foo) -> element(3, Foo) /= 9 end, [{1,2}]). =ERROR REPORT==== 25-Sep-2007::09:56:45 === Error in process <0.36.0> with exit value: {badarg,[{erlang,element,[3,{1,2}]},{erl_eval,do_apply,5},{erl_eval,expr,5},{lists,'-filter/2-lc$^0/1-0-',2},{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} Best Regards -- Oscar Hellstr?m, oscar@REDACTED Erlang Training and Consulting http://www.erlang-consulting.com/ From igwan@REDACTED Tue Sep 25 11:13:49 2007 From: igwan@REDACTED (igwan) Date: Tue, 25 Sep 2007 11:13:49 +0200 Subject: [erlang-questions] gen_tcp receving slow In-Reply-To: <46F8C866.3010403@hyber.org> References: <46F842A5.4080801@free.fr> <46F8C866.3010403@hyber.org> Message-ID: <46F8D14D.6040601@free.fr> Claes Wikstrom a ?crit : > So - this is no TCP asymmetry - it's just poorly written parse code > that parse the POSTed data. This is what I thought at first about my parsing code, so I tested sending the same data in {tcp, Socket, Data} messages using a dummy socket process, just like the gen_tcp does, and it's really fast. In another test, I set up a process which does nothing but count incoming bytes from (the real) gen_tcp, and that's slow, so my guess is that the bottleneck lies in gen_tcp or esock. igwan From bjorn@REDACTED Tue Sep 25 11:15:59 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 25 Sep 2007 11:15:59 +0200 Subject: [erlang-questions] Strange behaviour of element/2 inside list comprehensions In-Reply-To: <46F8CE5A.4040907@erlang-consulting.com> References: <46F8CE5A.4040907@erlang-consulting.com> Message-ID: Oscar Hellstr?m writes: > Hi, > > I've noticed that element/2 doesn't exit with a badarg as I expected > when used in a list comprehension. Other functions that exit with badarg > are behaving as expected though. Is this actually the intended > behaviour? (I'm using R11B-4 but have also seen it on R11B-3). > > Example: > 1> [Foo || Foo <- [{1,2}], element(3, Foo) /= 9]. > [] > 5> [Foo || Foo <- [{1,2}], list_to_integer(Foo) /= 10]. Guard BIFs (such as element/2) will be executed in guard context and will not cause an exception. All other BIFs and functions call will cause an exception. The reason for this difference is because the original implementation did it this way (probably as an optimization or because it was simplest). When we later wanted to change that in the new Beam compiler for R6B, we discovered that a lot of code in OTP depended on this behaviour, so we kept it. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From jeffm@REDACTED Tue Sep 25 11:38:02 2007 From: jeffm@REDACTED (jm) Date: Tue, 25 Sep 2007 19:38:02 +1000 Subject: [erlang-questions] erlmail status Message-ID: <46F8D6FA.4000802@ghostgun.com> Has anyone used erlmail (http://erlsoft.org/modules/erlmail/)? The current version is 0.0.3 and the only documentation appears to be that in the source files. The developer does list his contact details in the readme, but a wider impression from others that have used it is desired. Specifically I am interested in the smtp server and client components? How stable and usable are these components? Any examples of its use? I'd also like some indication of how active development is? Jeff. From davidnwelton@REDACTED Tue Sep 25 12:07:55 2007 From: davidnwelton@REDACTED (David Welton) Date: Tue, 25 Sep 2007 12:07:55 +0200 Subject: [erlang-questions] interest in fixing open_port to handle stderr ? Message-ID: <9877cd600709250307k6f77dd2djed986251484aa355@mail.gmail.com> I don't have the time to do this myself, nor probably the knowledge, but is anyone else interested in seeing a version of open_port that handles stderr a little better than it does? Here's my half-formed thoughts: * Mixing stderr and stdout, as is possible now with the redir_stderr option, isn't ideal if you want to know what's going to one, and what's going to the other. * Ideally, the port would send back messages along the lines of {stdout, "blah blah blah"} and {stderr, "we lost R2!"}. Just something that came to mind as a potential improvement, not a critical need. Thanks, -- David N. Welton http://www.welton.it/davidw/ From rvirding@REDACTED Tue Sep 25 11:58:17 2007 From: rvirding@REDACTED (Robert Virding) Date: Tue, 25 Sep 2007 11:58:17 +0200 Subject: [erlang-questions] Strange behaviour of element/2 inside list comprehensions In-Reply-To: References: <46F8CE5A.4040907@erlang-consulting.com> Message-ID: <3dbc6d1c0709250258v12c4904cyf64897285efce94@mail.gmail.com> On 25 Sep 2007 11:15:59 +0200, Bjorn Gustavsson wrote: > > Oscar Hellstr?m writes: > > > Hi, > > > > I've noticed that element/2 doesn't exit with a badarg as I expected > > when used in a list comprehension. Other functions that exit with badarg > > are behaving as expected though. Is this actually the intended > > behaviour? (I'm using R11B-4 but have also seen it on R11B-3). > > > > Example: > > 1> [Foo || Foo <- [{1,2}], element(3, Foo) /= 9]. > > [] > > 5> [Foo || Foo <- [{1,2}], list_to_integer(Foo) /= 10]. > > Guard BIFs (such as element/2) will be executed in guard context and will > not cause an > exception. All other BIFs and functions call will cause an exception. > > The reason for this difference is because the original implementation did > it this way > (probably as an optimization or because it was simplest). When we later > wanted to change > that in the new Beam compiler for R6B, we discovered that a lot of code in > OTP depended > on this behaviour, so we kept it. It was an optimisation, and not because it was simpler to do. It is in fact slightly more difficult, but not much. Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From rc.china@REDACTED Tue Sep 25 12:53:20 2007 From: rc.china@REDACTED (raocheng) Date: Tue, 25 Sep 2007 18:53:20 +0800 Subject: [erlang-questions] What's the difference between tuple and list ? Message-ID: The Pragmatic Programming Erlang says: 1) Suppose you want to group a fixed number of items into a single entity.For this you'd use a tuple. 2) We use lists to store variable numbers of things. However, we know that variables in Erlang are in essence invariable. So what is the difference between tuple and list ? Thanks in advance. -------------- next part -------------- An HTML attachment was scrubbed... URL: From igwan@REDACTED Tue Sep 25 13:01:21 2007 From: igwan@REDACTED (igwan) Date: Tue, 25 Sep 2007 13:01:21 +0200 Subject: [erlang-questions] gen_tcp receving slow In-Reply-To: <46F842A5.4080801@free.fr> References: <46F842A5.4080801@free.fr> Message-ID: <46F8EA81.4000803@free.fr> Ok, here's a simple test case in attempt to isolate the problem : -------------------------- -module(tcptest). -compile(export_all). listener(Port) -> {ok, ListenSocket} = gen_tcp:listen(Port, [{packet, raw}, {active, true}, binary]), {ok, Socket} = gen_tcp:accept(ListenSocket, 60000), io:format("Incoming connection accepted.\n"), receiver(Socket). receiver(Socket) -> receiver(Socket, 0, []). receiver(Socket, Count, TimeStamp) -> receive {tcp, Socket, Data} when Count =:= 0 -> receiver(Socket, Count + size(Data), now()); {tcp, Socket, Data} -> receiver(Socket, Count + size(Data), TimeStamp); {tcp_closed, Socket} -> TimeDiff = timer:now_diff(now(), TimeStamp), io:format("Received ~p bytes in ~p ms.\n",[Count, TimeDiff/1000]), gen_tcp:close(Socket); _Other -> io:format("Unexpected message : ~p\n", [_Other]), gen_tcp:close(Socket) end. -------------------------- I start my listener on an erlang node then start a netcat on another shell session to send a 20MB file : igwan@REDACTED:~$ cat 20M.txt | nc -q 0 127.0.0.1 1234 13> tcptest:listener(1234). Incoming connection accepted. Received 20399370 bytes in 5803.51 ms. ok That's roughly 3,5 MB/s ... and here's top output during the transfer : PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 23093 igwan 25 0 11532 7024 1868 R 97.9 0.7 1:01.39 beam 23151 igwan 18 0 3176 476 408 S 0.7 0.0 0:01.41 cat 23152 igwan 15 0 1736 624 524 S 0.7 0.1 0:01.22 nc Thanks igwan igwan a ?crit : > I bypassed my parsing code, just to be sure, and tested on > Linux and Win32 with R11B-5, all this on the loopback interface. The > incoming data throughput doesn't get over 5 MB/s or so during the > transfer while my Intel 2Ghz Intel CPU is 100 % busy with "werl". On my > linux box, it's around 2,5MB/s on a 2Ghz Via CPU, again 100% busy. > From attila.rajmund.nohl@REDACTED Tue Sep 25 13:08:16 2007 From: attila.rajmund.nohl@REDACTED (attila.rajmund.nohl@REDACTED) Date: Tue, 25 Sep 2007 13:08:16 +0200 (CEST) Subject: [erlang-questions] What's the difference between tuple and list ? In-Reply-To: References: Message-ID: On Tue, 25 Sep 2007, raocheng wrote: > The Pragmatic Programming Erlang says: > 1) Suppose you want to group a fixed number of items into a single > entity.For this you'd use a tuple. > 2) We use lists to store variable numbers of things. > > However, we know that variables in Erlang are in essence invariable. So what > is the difference between tuple and list ? Use list when you don't know how many elements will be used. In a code like this: loop([H | T] = L) -> loop(T). in each subsequent call you'll have one less element in the parameter list. Bye,NAR -- "Beware of bugs in the above code; I have only proved it correct, not tried it." From ulf.wiger@REDACTED Tue Sep 25 13:09:01 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Tue, 25 Sep 2007 13:09:01 +0200 Subject: [erlang-questions] What's the difference between tuple and list ? In-Reply-To: References: Message-ID: <46F8EC4D.4060209@ericsson.com> raocheng wrote: > The Pragmatic Programming Erlang says: > 1) Suppose you want to group a fixed number of items into a single > entity.For this you'd use a tuple. > 2) We use lists to store variable numbers of things. > > However, we know that variables in Erlang are in essence invariable. So > what is the difference between tuple and list ? > > Thanks in advance. While a certain bound instance of an object will not change, we often construct new data structures from old ones. So if I have a variable Team = [joe, hans, mats] and want to add an element: Team1 = [ulf | Persons] I have constructed a new variable out of the old one, but I have not changed Team. Still, you could say that the data object has changed. This becomes clearer if we think of a process that holds the data as a function argument loop(Team) -> receive {add, Member} -> loop([Member|Team]); {remove, Member} -> loop(lists:delete(Member, Team)) end. In this case, using a list is far better than using a tuple, since the program doesn't really know what the number of elements will be. BR, Ulf W From bengt.kleberg@REDACTED Tue Sep 25 13:14:00 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 25 Sep 2007 13:14:00 +0200 Subject: [erlang-questions] What's the difference between tuple and list ? In-Reply-To: References: Message-ID: <46F8ED78.9000205@ericsson.com> greetings, it is as simple as it says. if you have a variable amount of things you store them in a list (ex: the number of people inside a room). if you have a fixed number of items you store them in a tuple. (ex: descriptive data about a person, like age and name). bengt Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." On 2007-09-25 12:53, raocheng wrote: > The Pragmatic Programming Erlang says: > 1) Suppose you want to group a fixed number of items into a single > entity.For this you'd use a tuple. > 2) We use lists to store variable numbers of things. > > However, we know that variables in Erlang are in essence invariable. So > what is the difference between tuple and list ? > > Thanks in advance. > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From rvirding@REDACTED Tue Sep 25 13:54:43 2007 From: rvirding@REDACTED (Robert Virding) Date: Tue, 25 Sep 2007 13:54:43 +0200 Subject: [erlang-questions] strings, json, and what happens now In-Reply-To: <20070924154551.GA7140@jon.loc> References: <20070924154551.GA7140@jon.loc> Message-ID: <3dbc6d1c0709250454w6659bcd0w58513802fa57c7fb@mail.gmail.com> I think it very much depends on what you are going to do with the string. If you are going to store for later then using a binary with some encoding (UTF-8, UTF-16, ...) is probably the best. But if you are are going to *work* with it then keeping it as a list of codepoints is much better, much better in fact than keeping them in arrays like C++ type strings. How to handle the metadata I don't know. If I remember correctly from a previous discussion the metadata was not really standardised and could be a bit messy. Robert On 24/09/2007, Paul Phillips wrote: > > When I read something like this: > > > http://www.lshift.net/blog/2007/09/13/how-should-json-strings-be-represented-in-erlang > > It says to me that some decision has to be made about improving string > representations in erlang, or there are going to be several incompatible > implementations in the wild soon. > > Are there good arguments against standardizing on an enhanced string > "type" of a tuple including the list of characters and whatever metadata > people are accustomed to having in other languages? I know this could be > done without core language support if you were willing to wrap and > unwrap it everytime you interacted with stdlib, or via a brand new > string library which operates on the tuples, which seems more likely. > But there's already so much important code spread out among third party > libraries, it seems a shame to add to it, especially given the > immaturity of erlang's library mechanisms when compared to gem, cpan, etc. > > I'm not particularly fascinated by character encodings and language > impedance mismatches, and I would suppose neither are most people, but > as someone presently trying to apply erlang in a real world setting this > issue is demanding a large percentage of my initial time investment. Do > those who speak for the distribution see the string representation as a > problem? And is there some agreement on a way to deal with it? > > Thanks, > > -- > Paul Phillips | It's better to have gloved and tossed than never to > Analgesic | have played baseball. > Empiricist | > all hip pupils! |----------* http://www.improving.org/paulp/*---------- > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From per@REDACTED Tue Sep 25 14:38:12 2007 From: per@REDACTED (Per Hedeland) Date: Tue, 25 Sep 2007 14:38:12 +0200 (CEST) Subject: [erlang-questions] gen_tcp receving slow In-Reply-To: <46F8EA81.4000803@free.fr> Message-ID: <200709251238.l8PCcC94019100@pluto.hedeland.org> igwan wrote: > >Ok, here's a simple test case in attempt to isolate the problem : [snip] >13> tcptest:listener(1234). >Incoming connection accepted. >Received 20399370 bytes in 5803.51 ms. Interesting... - I get a similar result: Received 20971520 bytes in 3262.23 ms. Changed to use {active, once}: Received 20971520 bytes in 9563.91 ms. (!) Changed to use {active, false} and gen_tcp:recv/2: Received 20971520 bytes in 384.559 ms. I guess you'll need to dig deep into the inet modules and driver to figure out why.:-) --Per Hedeland From bazil@REDACTED Tue Sep 25 21:13:07 2007 From: bazil@REDACTED (Dmitriy Gorbenko) Date: Tue, 25 Sep 2007 19:13:07 +0000 Subject: [erlang-questions] Adding new disc_copies node to existing schema Message-ID: <46F95DC3.4010401@agenstvo.com> Hi all. I need an advice: I have two nodes (node1@REDACTED and node2@REDACTED). The are in the same schema. And I want to add a new node node3@REDACTED to existing schema. Next code is helpless, because it creates ram_copies node in schema: mnesia:change_config(extra_db_nodes, [node3@REDACTED]). mnesia:add_table_copy(tt, node3@REDACTED, ram_copies). but I need create a disc_copies node. If I create a backup and change node name - this is also not helping me: (node1@REDACTED)6> mnesia:backup("./backup"). ok (node1@REDACTED)7> c(a). {ok,a} (node1@REDACTED)8> a:change_node_name(node1@REDACTED, node3@REDACTED, "./backup", "./new_backup"). * Checking table: 'schema' + Checking key: 'disc_copies' - Replacing nodename: ''node1@REDACTED'' with: ''node3@REDACTED'' - Node: ''node2@REDACTED'' will not be modified (it is not ''node1@REDACTED'') + Checking key: 'disc_only_copies' * Checking table: 'tt' + Checking key: 'disc_copies' - Replacing nodename: ''node1@REDACTED'' with: ''node3@REDACTED'' - Node: ''node2@REDACTED'' will not be modified (it is not ''node1@REDACTED'') + Checking key: 'disc_only_copies' {ok,switched} (node1@REDACTED)9> Then I copied this backup to node3@REDACTED, and trying to restore one: (node3@REDACTED)2> mnesia:start(). ok (node3@REDACTED)4> mnesia:restore("./new_backup", [{default_op, recreate_tables}]). {aborted,{'EXIT',{aborted,{bad_commit,{missing_lock,'node2@REDACTED'}}}}} (node3@REDACTED)5> I think it's impossible to create another disc_copies node in existing schema. Only ram_copies. Or, I could be possible, if I could remove at node1 from schema node2, then create backup, and then collect all nodes into one schema. But I did not find how I could remove node from schema. Like: mnesia:remove_node_from_schema(node3@REDACTED). If anyone knows how to solve the problem - please, help me. Dmitriy. -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 2244 bytes Desc: S/MIME Cryptographic Signature URL: From dking@REDACTED Tue Sep 25 18:06:58 2007 From: dking@REDACTED (David King) Date: Tue, 25 Sep 2007 09:06:58 -0700 Subject: [erlang-questions] Not an Erlang fan In-Reply-To: <46F7FA00.8070507@hyber.org> References: <8aff81590709230930x1bc2baf7r74916dc4a14d34b1@mail.gmail.com> <6a36e7290709231410o98e4873ubae018dba10fede1@mail.gmail.com> <46F7FA00.8070507@hyber.org> Message-ID: > spawning cat is actually a very bad idea - It'll lead to all > kinds of havoc since ports don't by themselves have any means > to do flow control. > Spawning cat will lead to a situation where a whole lot of messages > will be sent to the owner of the port. When we do socket I/O this is > the equivalent of having {active ,true} on a socket, we'll just get > a lot of messages and if we cannot process the messages at the same > speed or higher than we receive them our message inbox will fill up > and we'll just be spending time in the garbage collector - bad. Would it be enough to have one process that accepts all of these incoming Port messages, adding them to a queue, and then making them available to another process to request? In theory that should be able to keep up with the rate of messages as long as it's receiving them more slowly or equal to the speed at which it can add them to the queue, and allows them to come in line- by-line (and be fetched line-by-line by the second process) From igwan@REDACTED Tue Sep 25 18:18:28 2007 From: igwan@REDACTED (igwan) Date: Tue, 25 Sep 2007 18:18:28 +0200 Subject: [erlang-questions] gen_tcp receving slow In-Reply-To: <200709251238.l8PCcC94019100@pluto.hedeland.org> References: <200709251238.l8PCcC94019100@pluto.hedeland.org> Message-ID: <46F934D4.9050902@free.fr> Per Hedeland wrote : > I guess you'll need to dig deep into the inet modules and driver to > figure out why.:-) > I'm glad I don't need to ... :-) I just raised recbuf to a higher value and now I'm happy : with {recbuf, 10*1024*1024} transfering 113 MB of data : 24> tcptest:listener(1234). Incoming connection accepted. Received 113468091 bytes in 2619.79 ms. That's 43 MB/s, about the read-speed of my hard-disk. Beam now only takes about 75% CPU during the process. I should have thought about that one. Sorry for the noise ! igwan From psa@REDACTED Tue Sep 25 20:18:15 2007 From: psa@REDACTED (=?UTF-8?B?UGF1bG8gU8OpcmdpbyBBbG1laWRh?=) Date: Tue, 25 Sep 2007 19:18:15 +0100 Subject: [erlang-questions] "group" and "user" mnesia tables; are they used for something in OTP? In-Reply-To: <46F95DC3.4010401@agenstvo.com> References: <46F95DC3.4010401@agenstvo.com> Message-ID: <46F950E7.8080204@di.uminho.pt> Hi all, when using mnesia tables with names "group" and "user" they don't show up in table viewer (tv), unless I ask it to show "System Tables". This makes me afraid of using these table names, wondering what else they are used for, somewhere. Does someone know if that is the case and they should be avoided by normal apps or can I use these names with no problem? Regards, Paulo From klacke@REDACTED Tue Sep 25 21:28:13 2007 From: klacke@REDACTED (Claes Wikstrom) Date: Tue, 25 Sep 2007 21:28:13 +0200 Subject: [erlang-questions] gen_tcp receving slow In-Reply-To: <46F934D4.9050902@free.fr> References: <200709251238.l8PCcC94019100@pluto.hedeland.org> <46F934D4.9050902@free.fr> Message-ID: <46F9614D.1060804@hyber.org> igwan wrote: > Per Hedeland wrote : >> I guess you'll need to dig deep into the inet modules and driver to >> figure out why.:-) >> > I'm glad I don't need to ... :-) I just raised recbuf to a higher value > and now I'm happy : > > with {recbuf, 10*1024*1024} transfering 113 MB of data : > That's boring - we shouldn't have to fiddle with the size of the recbufs to get good TCP performace. /klacke From klacke@REDACTED Tue Sep 25 21:31:05 2007 From: klacke@REDACTED (Claes Wikstrom) Date: Tue, 25 Sep 2007 21:31:05 +0200 Subject: [erlang-questions] Not an Erlang fan In-Reply-To: References: <8aff81590709230930x1bc2baf7r74916dc4a14d34b1@mail.gmail.com> <6a36e7290709231410o98e4873ubae018dba10fede1@mail.gmail.com> <46F7FA00.8070507@hyber.org> Message-ID: <46F961F9.4070603@hyber.org> David King wrote: >> spawning cat is actually a very bad idea - It'll lead to all >> kinds of havoc since ports don't by themselves have any means >> to do flow control. >> Spawning cat will lead to a situation where a whole lot of messages >> will be sent to the owner of the port. When we do socket I/O this is >> the equivalent of having {active ,true} on a socket, we'll just get >> a lot of messages and if we cannot process the messages at the same >> speed or higher than we receive them our message inbox will fill up >> and we'll just be spending time in the garbage collector - bad. > > Would it be enough to have one process that accepts all of these > incoming Port messages, adding them to a queue, and then making them > available to another process to request? No, > > In theory that should be able to keep up with the rate of messages as > long as it's receiving them more slowly or equal to the speed at which > it can add them to the queue, and allows them to come in line-by-line > (and be fetched line-by-line by the second process) > We want to get to the built in flow control that is part of the operating system. When the buffers are full, the writer blocks. If we keep on reading and buffering the messages, the writer will never block. /klacke From kosik@REDACTED Tue Sep 25 21:17:11 2007 From: kosik@REDACTED (Matej Kosik) Date: Tue, 25 Sep 2007 21:17:11 +0200 Subject: [erlang-questions] "amusing" error messages Message-ID: <46F95EB7.1000403@fiit.stuba.sk> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I am not sure if anyone will be able (and have time) to give me some explanation (and since it is already solved it is not critical to me now) but just out of curiousity (and for the future) I would like to know how I should have interpreted the following error: sudo erl +P 500000 -boot testing/nms -config testing/nms -name nms1@REDACTED -setcookie test {error_logger,{{2007,9,25},{16,6,24}},crash_report,[[{pid,<0.26.0>},{registered_name,[]},{error_info,nouser},{initial_call,{gen,init_it,[gen_server,<0.9.0>,<0.9.0>,supervisor_bridge,[user_sup,[],self],[]]}},{ancestors,[kernel_sup,<0.8.0>]},{messages,[]},{links,[<0.9.0>]},{dictionary,[]},{trap_exit,true},{status,running},{heap_size,377},{stack_size,21},{reductions,321}],[]]} {error_logger,{{2007,9,25},{16,6,24}},supervisor_report,[{supervisor,{local,kernel_sup}},{errorContext,start_error},{reason,nouser},{offender,[{pid,undefined},{name,user},{mfa,{user_sup,start,[]}},{restart_type,temporary},{shutdown,2000},{child_type,supervisor}]}]} {error_logger,{{2007,9,25},{16,6,24}},crash_report,[[{pid,<0.7.0>},{registered_name,[]},{error_info,{shutdown,{kernel,start,[normal,[]]}}},{initial_call,{application_master,init,[<0.5.0>,<0.6.0>,{appl_data,kernel,[application_controller,erl_reply,auth,boot_server,code_server,disk_log_server,disk_log_sup,erl_prim_loader,error_logger,file_server_2,fixtable_server,global_group,global_name_server,heart,init,kernel_config,kernel_sup,net_kernel,net_sup,rex,user,os_server,ddll_server,erl_epmd,inet_db,pg2],undefined,{kernel,[]},[application,application_controller,application_master,application_starter,auth,code,code_aux,packages,code_server,dist_util,erl_boot_server,erl_distribution,erl_prim_loader,erl_reply,erlang,error_handler,error_logger,file,file_server,file_io_server,prim_file,global,global_group,global_search,group,heart,hipe_unified_loader,inet6_tcp,inet6_tcp_dist,inet6_udp,inet_config,inet_hosts,inet_gethost_native,inet_tcp_dist,init,kernel,kernel_config,net,net_adm,net_kern el,os,ram_file,rpc,user,user_drv,user_sup,disk_log,disk_log_1,disk_log_server,disk_log_sup,dist_ac,erl_ddll,erl_epmd,erts_debug,gen_tcp,gen_udp,prim_inet,inet,inet_db,inet_dns,inet_parse,inet_res,inet_tcp,inet_udp,pg2,seq_trace,wrap_log_reader,zlib,otp_ring0],[],infinity,infinity},normal]}},{ancestors,[<0.6.0>]},{messages,[{'EXIT',<0.8.0>,normal}]},{links,[<0.6.0>,<0.5.0>]},{dictionary,[]},{trap_exit,true},{status,running},{heap_size,610},{stack_size,21},{reductions,2079}],[]]} {error_logger,{{2007,9,25},{16,6,24}},std_info,[{application,kernel},{exited,{shutdown,{kernel,start,[normal,[]]}}},{type,permanent}]} {"Kernel pid terminated",application_controller,"{application_start_failure,kernel,{shutdown,{kernel,start,[normal,[]]}}}"} Crash dump was written to: erl_crash.dump Kernel pid terminated (application_controller) ({application_start_failure,kernel,{shutdown,{kernel,start,[normal,[]]}}}) make: *** [nms_test] Error 1 ? This happened when I booted my Erlang release via `nohup' so that I could log out from the machine where release has to run and provide services. (Now I know that I should do that via `-detach' parameter but usage of `nohup' seemed (prior to I learned about `-detach') suitable option. I was not able to determine what is wrong. Did VM crash? Did my server crash? Did some internal library I used caused some problems? Can somebody tell me (ex post) what happed there. I would provide more information if I knew what is relevant. A crash dump? Help is welcome Regards - -- Matej Ko??k ICQ: 300133844 skype: matej_kosik -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFG+V63L+CaXfJI/hgRAhaSAKCgN1fhGSc9VX38jkDwzw/puNvv0QCgmhHt KcOjCjofmo+Gf+BqojH7ZB8= =f2Qg -----END PGP SIGNATURE----- From gbulmer@REDACTED Tue Sep 25 21:27:41 2007 From: gbulmer@REDACTED (G Bulmer) Date: Tue, 25 Sep 2007 20:27:41 +0100 Subject: [erlang-questions] Regular expression library (was Not an Erlang fan) In-Reply-To: References: Message-ID: <62CB1DD6-55BA-4822-88E3-46E18822C1EA@gmail.com> After reading the original thread, I wondered what implementation of regular expression matching is used by Erlang? I ask because this paper points out that many implementations have bad pathological behaviour: http://swtch.com/~rsc/regexp/regexp1.html An observation they make is: "Regular expression matching can be simple and fast, using finite automata-based techniques that have been known for decades. In contrast, Perl, PCRE, Python, Ruby, Java, and many other languages have regular expression implementations based on recursive backtracking that are simple but can be excruciatingly slow." This is followed by a discussion at http://lambda-the-ultimate.org/ node/2064 Which seems to come to a working implementation. Usefully, they note that Thompson's original patent has expired, so there is no obstacle to using the original, and apparently superior, algorithm I looked at 'man regex' on my Mac, and it describes the POSIX implementation of regex. It does contain the note "Originally written by Henry Spencer", which is suggested as the basis/culprit of the pathological regular expression implementations (I should add, as Henry Spencer is one of my heroes, that he is also credited with TCL 8 regex, which works very well according to the graphs in the paper). I have tried grep'ing through *.c in otp_src for regex and regcomp, and came up with nothing! Does anyone know what is used in Erlang? It may be a relatively small amount of work to incorporate a new regex to provide more stable behaviour. GB On 25 Sep 2007, at 10:00, erlang-questions-request@REDACTED wrote: > Date: Mon, 24 Sep 2007 09:20:08 -0700 (PDT) > From: Thomas Lindgren > Subject: Re: [erlang-questions] Not an Erlang fan > To: "Erlang-Questions \(E-mail\)" > Message-ID: <761781.89097.qm@REDACTED> > Content-Type: text/plain; charset=iso-8859-1 > > > - > Note that this does not include the actual regexp > search of each line ... The code to do that could be > an FSM + dictionary insert instead of the simple > check-and-accumulate for newline. Extra cost? Unclear. > > One could merge that code into the scanning the binary > but this should ideally be done by a regexp compiler, > shouldn't it? Not done at this time AFAIK. > > Best, > Thomas > Date: Mon, 24 Sep 2007 19:55:12 +0200 > From: Claes Wikstrom > Subject: Re: [erlang-questions] Not an Erlang fan > To: Bob Ippolito > Cc: "Erlang-Questions \(E-mail\)" > Message-ID: <46F7FA00.8070507@REDACTED> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > Bob Ippolito wrote: > >> On 9/24/07, Patrick Logan wrote: >> >>>>>> http://www.tbray.org/ongoing/When/200x/2007/09/22/Erlang >>>>>> >>>>>> Tim Bray might raise some valid points here, even if he's >>>>>> slightly >>>>>> biased by his background. >>>>>> > > No, the only fast way today to process a large file line/by/line is to > > 1. file:open(Filename, [read, raw]) > 2. In a loop {ok, Bin} = file:read(Fd, BufSize), > 3. Use a binary regex matcher such as > http://yaws.hyber.org/download/posregex-1.0.tgz > > (I don't know the state of the regex lib in OTP today, last time > I looked it sucked bigtime though) > > /klacke > From olopierpa@REDACTED Tue Sep 25 22:20:46 2007 From: olopierpa@REDACTED (Pierpaolo Bernardi) Date: Tue, 25 Sep 2007 22:20:46 +0200 Subject: [erlang-questions] Regular expression library (was Not an Erlang fan) In-Reply-To: <62CB1DD6-55BA-4822-88E3-46E18822C1EA@gmail.com> References: <62CB1DD6-55BA-4822-88E3-46E18822C1EA@gmail.com> Message-ID: <7352e43a0709251320q39e8fa69ma117686711c09d15@mail.gmail.com> On 9/25/07, G Bulmer wrote: > I have tried grep'ing through *.c in otp_src for regex and regcomp, > and came up with nothing! try grepping in lib/stdlib/*.erl instead! :) From per@REDACTED Tue Sep 25 23:58:45 2007 From: per@REDACTED (Per Hedeland) Date: Tue, 25 Sep 2007 23:58:45 +0200 (CEST) Subject: [erlang-questions] gen_tcp receving slow In-Reply-To: <46F9614D.1060804@hyber.org> Message-ID: <200709252158.l8PLwjqK031035@pluto.hedeland.org> Claes Wikstrom wrote: > >igwan wrote: >> Per Hedeland wrote : >>> I guess you'll need to dig deep into the inet modules and driver to >>> figure out why.:-) >>> >> I'm glad I don't need to ... :-) I just raised recbuf to a higher value >> and now I'm happy : >> >> with {recbuf, 10*1024*1024} transfering 113 MB of data : >> > >That's boring - we shouldn't have to fiddle with the size >of the recbufs to get good TCP performace. Agreed - and in case it wasn't clear from the numbers in my message, my suggestion to go digging wasn't to find out why active receive was "slow" per se, but rather why passive receive was ~ 10 times faster (at least in this particular case). The same recbuf size was used for both... --Per From codewalkerjoe@REDACTED Wed Sep 26 02:24:47 2007 From: codewalkerjoe@REDACTED (joe lee) Date: Tue, 25 Sep 2007 20:24:47 -0400 Subject: [erlang-questions] newb: Erlang Mnesia Full Text Search Message-ID: <50ec7a2e0709251724h470c2daaw16d1c74d6e846a0f@mail.gmail.com> At our company, we are planning to implement a web app in Erlang and Mnesia. In the previous project (php) we looked at Java Lucene, Xapian and Sphinx Search. We finally decided with Sphinx Search. Sphin Search was very fast compared Lucene, Xapian and was easy to setup. Its just hooks into mysql. To any web app, search feature is essential. So my question is, is there a search/indexer in Erlang, where you can set weights to different fields(title, tags, descriptions)? Or any binding/ported version of lucene, xapian or sphinx search? Does Mnesia has the ability to set weights to different fields or in this case objects? thanks, joe -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeffm@REDACTED Wed Sep 26 02:43:20 2007 From: jeffm@REDACTED (jm) Date: Wed, 26 Sep 2007 10:43:20 +1000 Subject: [erlang-questions] newb: Erlang Mnesia Full Text Search In-Reply-To: <50ec7a2e0709251724h470c2daaw16d1c74d6e846a0f@mail.gmail.com> References: <50ec7a2e0709251724h470c2daaw16d1c74d6e846a0f@mail.gmail.com> Message-ID: <46F9AB28.9000301@ghostgun.com> joe lee wrote: > At our company, we are planning to implement a web app in Erlang and > Mnesia. In the previous project (php) we looked at Java Lucene, Xapian > and Sphinx Search. We finally decided with Sphinx Search. Sphin Search > was very fast compared Lucene, Xapian and was easy to setup. Its just > hooks into mysql. Mnesia is just a database. It holds a similar position to SQL databases. Tuples are stored using one of the fields as a key. In doesn't do any text indexing for that you'll need to add a layer on top of mnesia. I can't think of one off the top of my head for erlang. Someone else on the list may know of one though. see also, http://www.erlang.org/doc/apps/mnesia/index.html http://www.erlang.org/doc/pdf/mnesia.pdf http://www.erlang.org/doc/pdf/mnesia_session.pdf and possibly http://www.erlang.se/publications/mnesia_overview.pdf Jeff. From igwan@REDACTED Wed Sep 26 00:18:44 2007 From: igwan@REDACTED (igwan) Date: Wed, 26 Sep 2007 00:18:44 +0200 Subject: [erlang-questions] gen_tcp receving slow In-Reply-To: <200709252158.l8PLwjqK031035@pluto.hedeland.org> References: <200709252158.l8PLwjqK031035@pluto.hedeland.org> Message-ID: <46F98944.6040209@free.fr> Per Hedeland wrote : >> >> That's boring - we shouldn't have to fiddle with the size >> of the recbufs to get good TCP performace. >> > > Agreed - and in case it wasn't clear from the numbers in my message, my > suggestion to go digging wasn't to find out why active receive was > "slow" per se, but rather why passive receive was ~ 10 times faster (at > least in this particular case). The same recbuf size was used for > both... > Last time I benchmarked using eprof with {active, once} I noticed the call to inet:setopts on each received chunk was eating up 25 % of the CPU time (relative to my program). It might be that a 2-message exchange with the Port is needed instead of just one. As for {active, false}, it's really bad numbers. My remaining question is why is all this (even with a big receive buffer) so CPU-intensive ? Is socket handling done in a port program ? A linked-in driver ? Is there too much copying within the memory that kills performance ? igwan From ckerr@REDACTED Wed Sep 26 03:19:31 2007 From: ckerr@REDACTED (Cameron Kerr) Date: Wed, 26 Sep 2007 13:19:31 +1200 Subject: [erlang-questions] newb: Erlang Mnesia Full Text Search In-Reply-To: <46F9AB28.9000301@ghostgun.com> References: <50ec7a2e0709251724h470c2daaw16d1c74d6e846a0f@mail.gmail.com> <46F9AB28.9000301@ghostgun.com> Message-ID: <1190769571.422.5.camel@oucs707.otago.ac.nz> Joe's book Programming Erlang has a full project on a text indexing engine. Not sure what's its built on, as I'm only up to chapter 2, having just received the book. On Wed, 2007-09-26 at 10:43 +1000, jm wrote: > joe lee wrote: > > At our company, we are planning to implement a web app in Erlang and > > Mnesia. In the previous project (php) we looked at Java Lucene, Xapian > > and Sphinx Search. We finally decided with Sphinx Search. Sphin Search > > was very fast compared Lucene, Xapian and was easy to setup. Its just > > hooks into mysql. > > Mnesia is just a database. It holds a similar position to SQL databases. > Tuples are stored using one of the fields as a key. In doesn't do any > text indexing for that you'll need to add a layer on top of mnesia. I > can't think of one off the top of my head for erlang. Someone else on > the list may know of one though. > > see also, > http://www.erlang.org/doc/apps/mnesia/index.html > http://www.erlang.org/doc/pdf/mnesia.pdf > http://www.erlang.org/doc/pdf/mnesia_session.pdf > > and possibly > http://www.erlang.se/publications/mnesia_overview.pdf > > Jeff. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From yunjnz@REDACTED Wed Sep 26 03:50:08 2007 From: yunjnz@REDACTED (Sean) Date: Tue, 25 Sep 2007 18:50:08 -0700 (PDT) Subject: [erlang-questions] For C language programmer Message-ID: <903481.94835.qm@web35808.mail.mud.yahoo.com> Hi, I'm using C language currently, and I would like to program on erlang's H.248/Megaco protocol stack, is it possible for me to implement a MG using C language on the stack? if so, can anyone give me an example? Another question, is it possible for porting the stack to C language? or can I run this stack on Montavista IXP platform? how about the performance and the memory to be used? Thanks a lot. Sean. ____________________________________________________________________________________ Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more. http://mobile.yahoo.com/go?refer=1GNXIC From yunjnz@REDACTED Wed Sep 26 04:45:38 2007 From: yunjnz@REDACTED (Sean) Date: Tue, 25 Sep 2007 19:45:38 -0700 (PDT) Subject: [erlang-questions] Erlang on Montavista Linux Message-ID: <422081.51656.qm@web35805.mail.mud.yahoo.com> Hi, >From the official site, I know that the Erlang can be compiled on Montavista Linux, Can anyone tell me how to do? I run the following command: CC=mips_fp_be-gcc CPP=mips_fp_be-cpp CXX=mips_fp_be-g++ AR=mips_fp_be-ar STRIP=mips_fp_be-strip RANLIB=mips_fp_be-ranlib AS=mips_fp_be-as NM=mips_fp_be-nm ./configure --prefix=/root/target/erlang --host=mips but after configuration, there will be errors on command "make", and if I specify the --host=mips-linux, the configuration will be failed because of no NPTL module. can anyone tell me on how to configure and compile the erlang on Montavista Linux? Thanks a lot. Sean. ____________________________________________________________________________________ Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more. http://mobile.yahoo.com/go?refer=1GNXIC From patrickdlogan@REDACTED Wed Sep 26 06:28:49 2007 From: patrickdlogan@REDACTED (Patrick Logan) Date: Tue, 25 Sep 2007 21:28:49 -0700 Subject: [erlang-questions] erlmail status In-Reply-To: <46F8D6FA.4000802@ghostgun.com> References: <46F8D6FA.4000802@ghostgun.com> Message-ID: > Has anyone used erlmail (http://erlsoft.org/modules/erlmail/)? Don't know anything about it. I also came across this... http://catseye.tc/projects/ce/doc/ce_smtp.html ...which I know nothing about, but might interest you. -Patrick From bjorn@REDACTED Wed Sep 26 09:16:40 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 26 Sep 2007 09:16:40 +0200 Subject: [erlang-questions] gen_tcp receving slow In-Reply-To: <46F98944.6040209@free.fr> References: <200709252158.l8PLwjqK031035@pluto.hedeland.org> <46F98944.6040209@free.fr> Message-ID: igwan writes: > Is socket handling done in a port program ? A > linked-in driver ? It's done in a linked-in driver. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bengt.kleberg@REDACTED Wed Sep 26 10:03:35 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 26 Sep 2007 10:03:35 +0200 Subject: [erlang-questions] Not an Erlang fan In-Reply-To: <46F961F9.4070603@hyber.org> References: <8aff81590709230930x1bc2baf7r74916dc4a14d34b1@mail.gmail.com> <6a36e7290709231410o98e4873ubae018dba10fede1@mail.gmail.com> <46F7FA00.8070507@hyber.org> <46F961F9.4070603@hyber.org> Message-ID: <46FA1257.2090808@ericsson.com> greetings, while it would not be as fast as the solution suggested below, i think it would be very simple, and faster than using the io module, to add the possibility of stdin to file:read/2 and stout and stderr to file:write/2. bengt Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." On 2007-09-25 21:31, Claes Wikstrom wrote: ...deleted > > We want to get to the built in flow control that is part of > the operating system. When the buffers are full, the writer blocks. > If we keep on reading and buffering the messages, the writer will never > block. > > /klacke > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From igor@REDACTED Wed Sep 26 10:18:05 2007 From: igor@REDACTED (Igor Goryachev) Date: Wed, 26 Sep 2007 12:18:05 +0400 Subject: [erlang-questions] [just for fun] erlang/ejabberd on nokia n800 device Message-ID: <871wclzvpe.fsf@goryachev.org> Hello everyone. I've run erlang (R11B-5) and ejabberd (1.1.4) on my Nokia N800 device (Debian GNU/Linux based OS, kernel 2.6.18). The server is up and running, you can access it under home.goryachev.org (in-band registration and s2s are open). Have a nice day. -- Igor Goryachev E-Mail/Jabber: igor@REDACTED From chandrashekhar.mullaparthi@REDACTED Wed Sep 26 10:26:06 2007 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Wed, 26 Sep 2007 09:26:06 +0100 Subject: [erlang-questions] Adding new disc_copies node to existing schema In-Reply-To: <46F95DC3.4010401@agenstvo.com> References: <46F95DC3.4010401@agenstvo.com> Message-ID: On 25/09/2007, Dmitriy Gorbenko wrote: > Hi all. > > I need an advice: I have two nodes (node1@REDACTED and node2@REDACTED). The > are in the same schema. > And I want to add a new node node3@REDACTED to existing schema. > > Next code is helpless, because it creates ram_copies node in schema: > > mnesia:change_config(extra_db_nodes, [node3@REDACTED]). > mnesia:add_table_copy(tt, node3@REDACTED, ram_copies). > > but I need create a disc_copies node. > Try this. One node1 or node2 ================ mnesia:add_table_copy(schema, node3@REDACTED, ram_copies). One node3@REDACTED ================ erl -sname node3@REDACTED -setcookie cookie mnesia:start(). mnesia:change_config(extra_db_nodes, [node1@REDACTED]). mnesia:change_table_copy_type(schema, node(), disc_copies). mnesia:add_table_copy(tt, node3@REDACTED, disc_copies). cheers Chandru From bazil@REDACTED Wed Sep 26 17:44:28 2007 From: bazil@REDACTED (Dmitriy Gorbenko) Date: Wed, 26 Sep 2007 15:44:28 +0000 Subject: [erlang-questions] Two nodes in schema and different info in each Message-ID: <46FA7E5C.3030606@agenstvo.com> hello everyone I have a question about mnesia. I have three nodes in schema (two with disc_copies, one with ram_copies): running db nodes = ['alpha1@REDACTED','alpha3@REDACTED','f3t@REDACTED'] stopped db nodes = [] ... [{'alpha1@REDACTED',ram_copies}, {'alpha3@REDACTED',disc_copies}, {'f3t@REDACTED',disc_copies}] = [schema,tt] And I turned off node alpha1@REDACTED Well, I type mnesia:info() at f3t@REDACTED node, and saw that removed node is in stopped_db_nodes array. Next I type command "mnesia:del_table_copy(schema, removed_node)." and at f3t@REDACTED, but removed node did not disappear from 'stopped_db_nodes' array, but at second node - he did. How it could be - than two nodes in schema has different datas (using mnesia:info()): at first: running db nodes = ['alpha3@REDACTED','f3t@REDACTED'] stopped db nodes = ['alpha1@REDACTED'] at second: running db nodes = ['f3t@REDACTED','alpha3@REDACTED'] stopped db nodes = [] Thanks. -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 2244 bytes Desc: S/MIME Cryptographic Signature URL: From vinoski@REDACTED Wed Sep 26 15:38:31 2007 From: vinoski@REDACTED (Steve Vinoski) Date: Wed, 26 Sep 2007 09:38:31 -0400 Subject: [erlang-questions] Not an Erlang fan In-Reply-To: <46F7FA00.8070507@hyber.org> References: <8aff81590709230930x1bc2baf7r74916dc4a14d34b1@mail.gmail.com> <6a36e7290709231410o98e4873ubae018dba10fede1@mail.gmail.com> <46F7FA00.8070507@hyber.org> Message-ID: <65b2728e0709260638j4b220a89y9d6b65a00c6b0308@mail.gmail.com> On 9/24/07, Claes Wikstrom wrote: > > 3. Use a binary regex matcher such as > http://yaws.hyber.org/download/posregex-1.0.tgz > Before I dive in to fix, anybody get this building correctly on OS X yet? --steve -------------- next part -------------- An HTML attachment was scrubbed... URL: From fritchie@REDACTED Wed Sep 26 16:45:11 2007 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Wed, 26 Sep 2007 09:45:11 -0500 Subject: [erlang-questions] Two nodes in schema and different info in each In-Reply-To: Message of "Wed, 26 Sep 2007 15:44:28 -0000." <46FA7E5C.3030606@agenstvo.com> Message-ID: <200709261445.l8QEjBrw020726@snookles.snookles.com> >>>>> "dg" == Dmitriy Gorbenko writes: dg> running db nodes = dg> ['alpha1@REDACTED','alpha3@REDACTED','f3t@REDACTED'] dg> And I turned off node alpha1@REDACTED dg> [...] dg> Next I type command "mnesia:del_table_copy(schema, removed_node)." What about: mnesia:del_table_copy(schema, 'alpha1@REDACTED'). -Scott From bazil@REDACTED Wed Sep 26 20:13:05 2007 From: bazil@REDACTED (Dmitriy Gorbenko) Date: Wed, 26 Sep 2007 18:13:05 +0000 Subject: [erlang-questions] Two nodes in schema and different info in each In-Reply-To: <200709261445.l8QEjBrw020726@snookles.snookles.com> References: <200709261445.l8QEjBrw020726@snookles.snookles.com> Message-ID: <46FAA131.5040603@agenstvo.com> (f3t@REDACTED)36> mnesia:del_table_copy(schema, alpha1@REDACTED). {atomic,ok} (f3t@REDACTED)37> mnesia:info(). ---> Processes holding locks <--- ---> Processes waiting for locks <--- ---> Participant transactions <--- ---> Coordinator transactions <--- ---> Uncertain transactions <--- ---> Active tables <--- schema : with 2 records occupying 515 words of mem tt : with 1 records occupying 287 words of mem ===> System info in version "4.3.5", debug level = none <=== opt_disc. Directory "/home/bazil/try/Mnesia.f3t@REDACTED" is used. use fallback at restart = false running db nodes = ['alpha3@REDACTED','f3t@REDACTED'] stopped db nodes = ['alpha1@REDACTED'] master node tables = [] remote = [] ram_copies = [] disc_copies = [schema,tt] disc_only_copies = [] [{'alpha3@REDACTED',disc_copies},{'f3t@REDACTED',disc_copies}] = [tt,schema] 32 transactions committed, 6 aborted, 0 restarted, 17 logged to disc 0 held locks, 0 in queue; 0 local transactions, 0 remote 0 transactions waits for other nodes: [] ok That is why I am asking this question. Scott Lystig Fritchie wrote: > dg> running db nodes = > dg> ['alpha1@REDACTED','alpha3@REDACTED','f3t@REDACTED'] > > > dg> And I turned off node alpha1@REDACTED > dg> [...] > > dg> Next I type command "mnesia:del_table_copy(schema, removed_node)." > > What about: > > mnesia:del_table_copy(schema, 'alpha1@REDACTED'). > > -Scott > > -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 2244 bytes Desc: S/MIME Cryptographic Signature URL: From garry@REDACTED Wed Sep 26 19:05:06 2007 From: garry@REDACTED (Garry Hodgson) Date: Wed, 26 Sep 2007 13:05:06 -0400 (EDT) Subject: [erlang-questions] He really hates us! In-Reply-To: <3dbc6d1c0709241518l3853f4e4i3491a1733b52de98@mail.gmail.com> References: <3dbc6d1c0709241518l3853f4e4i3491a1733b52de98@mail.gmail.com> Message-ID: <2007092613051190826306@k2.sage.att.com> "Robert Virding" wrote: > Many apparently don't share my amusement with this guy. I just become > fascinated by what he thinks of next. It's like watching a reality TV-show > where at the same time you are repulsed by it you become captivated by the > stupidity of the people taking part in it. i'm with you, to a degree. but living in a country run by creationists puts kind of an edge on things like this. they're still funny, but they're a little scary, too. ---- Garry Hodgson, Senior Software Geek, AT&T CSO nobody can do everything, but everybody can do something. do something. From klacke@REDACTED Wed Sep 26 20:01:49 2007 From: klacke@REDACTED (Claes Wikstrom) Date: Wed, 26 Sep 2007 20:01:49 +0200 Subject: [erlang-questions] Not an Erlang fan In-Reply-To: <65b2728e0709260638j4b220a89y9d6b65a00c6b0308@mail.gmail.com> References: <8aff81590709230930x1bc2baf7r74916dc4a14d34b1@mail.gmail.com> <6a36e7290709231410o98e4873ubae018dba10fede1@mail.gmail.com> <46F7FA00.8070507@hyber.org> <65b2728e0709260638j4b220a89y9d6b65a00c6b0308@mail.gmail.com> Message-ID: <46FA9E8D.2080400@hyber.org> Steve Vinoski wrote: > On 9/24/07, *Claes Wikstrom* > wrote: > > 3. Use a binary regex matcher such as > http://yaws.hyber.org/download/posregex-1.0.tgz > > > Before I dive in to fix, anybody get this building correctly on OS X yet? > > --steve Fixed http://yaws.hyber.org/download/posregex-1.01.tgz /klacke From yerl@REDACTED Wed Sep 26 19:48:51 2007 From: yerl@REDACTED (Yerl) Date: Wed, 26 Sep 2007 19:48:51 +0200 Subject: [erlang-questions] Minimal Erlang system In-Reply-To: <46FAA131.5040603@agenstvo.com> References: <200709261445.l8QEjBrw020726@snookles.snookles.com> <46FAA131.5040603@agenstvo.com> Message-ID: <46FA9B83.6080004@club-internet.fr> Hi Folks ! I'm looking for a minimal (ultra tiny if possble) OTP system to be able to show Erlang demos without installing it from source. Any chance that someone come up with such a system ? cheers Y. From bob@REDACTED Wed Sep 26 21:00:33 2007 From: bob@REDACTED (Bob Ippolito) Date: Wed, 26 Sep 2007 12:00:33 -0700 Subject: [erlang-questions] Minimal Erlang system In-Reply-To: <46FA9B83.6080004@club-internet.fr> References: <200709261445.l8QEjBrw020726@snookles.snookles.com> <46FAA131.5040603@agenstvo.com> <46FA9B83.6080004@club-internet.fr> Message-ID: <6a36e7290709261200x668a084cwe7932aad29718ba5@mail.gmail.com> Have you looked at CEAN yet? http://cean.process-one.net/ On 9/26/07, Yerl wrote: > Hi Folks ! > > I'm looking for a minimal (ultra tiny if possble) OTP system > to be able to show Erlang demos without installing it from source. > > Any chance that someone come up with such a system ? > > cheers > Y. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From dloutrein.lists@REDACTED Thu Sep 27 00:23:51 2007 From: dloutrein.lists@REDACTED (denis) Date: Wed, 26 Sep 2007 18:23:51 -0400 Subject: [erlang-questions] custom module attributes Message-ID: <000001c8008b$eb5d17e0$b029030a@mtl.ubisoft.org> Hello, I'm wondering if it difficult or not to define custom module attributes, allowing several parameters instead of one, like -compile for instance. I've not found where it's defined in the source. Is it managed at the parsing level ? or elsewhere ? Thanks for the pointers Denis -------------- next part -------------- An HTML attachment was scrubbed... URL: From rvirding@REDACTED Thu Sep 27 00:40:59 2007 From: rvirding@REDACTED (Robert Virding) Date: Thu, 27 Sep 2007 00:40:59 +0200 Subject: [erlang-questions] Regular expression library (was Not an Erlang fan) In-Reply-To: <62CB1DD6-55BA-4822-88E3-46E18822C1EA@gmail.com> References: <62CB1DD6-55BA-4822-88E3-46E18822C1EA@gmail.com> Message-ID: <3dbc6d1c0709261540m636091ecsafcd387283986c73@mail.gmail.com> The regular expression module which is included in the distribution is a simple rather na?ve one written in Erlang which uses a back-tracking algorithm directly on the AST. It has all the problems Russ Cox mentioned in his paper. I wrote it long ago when no one was interested in parsing regexps in Erlang. :-) I am rewriting it at the moment, still in Erlang but using the same algorithm, or similar to the one, which Russ describes. It is about the same speed as the existing one for simpler regexps but it can handle all the pathological cases as it should. It will handle POSIX syntax and semantics (but no back-references*). There will also be a version which will implement a subset of PERL regexps with PERL semantics. Both will work on either lists or binaries. I hadn't seen the lambda-the-ultimate discussion you mentioned and will check it out. There are a number of regexp packages for Erlang which use PCRE or other libraries which I don't have references to. Look in the "Not an Erlang fan" thread here which gives some references to them. An interesting alternative would be to write the regexp parser/compiler in Erlang and have the basic regexp matcher in the emulator. This actually wouldn't be so big, I think. Get the best of both worlds. An I used to complain (still do in fact) that the emulator is to big. :-) Robert * Actually there are two types of POSIX regexps in the standard, one which has back-references and one which doesn't. On 25/09/2007, G Bulmer wrote: > > After reading the original thread, I wondered what implementation of > regular expression matching is used by Erlang? > > I ask because this paper points out that many implementations have > bad pathological behaviour: > http://swtch.com/~rsc/regexp/regexp1.html > > An observation they make is: > "Regular expression matching can be simple and fast, using finite > automata-based techniques that have been known for decades. In > contrast, Perl, PCRE, Python, Ruby, Java, and many other languages > have regular expression implementations based on recursive > backtracking that are simple but can be excruciatingly slow." > > This is followed by a discussion at http://lambda-the-ultimate.org/ > node/2064 > Which seems to come to a working implementation. > Usefully, they note that Thompson's original patent has expired, so > there is no obstacle to using the original, and apparently superior, > algorithm > > I looked at 'man regex' on my Mac, and it describes the POSIX > implementation of regex. It does contain the note "Originally written > by Henry Spencer", which is suggested as the basis/culprit of the > pathological regular expression implementations (I should add, as > Henry Spencer is one of my heroes, that he is also credited with TCL > 8 regex, which works very well according to the graphs in the paper). > > I have tried grep'ing through *.c in otp_src for regex and regcomp, > and came up with nothing! > > Does anyone know what is used in Erlang? It may be a relatively small > amount of work to incorporate a new regex to provide more stable > behaviour. > > GB > > On 25 Sep 2007, at 10:00, erlang-questions-request@REDACTED wrote: > > > Date: Mon, 24 Sep 2007 09:20:08 -0700 (PDT) > > From: Thomas Lindgren < thomasl_erlang@REDACTED> > > Subject: Re: [erlang-questions] Not an Erlang fan > > To: "Erlang-Questions \(E-mail\)" < erlang-questions@REDACTED> > > Message-ID: <761781.89097.qm@REDACTED > > > Content-Type: text/plain; charset=iso-8859-1 > > > > > > - > > Note that this does not include the actual regexp > > search of each line ... The code to do that could be > > an FSM + dictionary insert instead of the simple > > check-and-accumulate for newline. Extra cost? Unclear. > > > > One could merge that code into the scanning the binary > > but this should ideally be done by a regexp compiler, > > shouldn't it? Not done at this time AFAIK. > > > > Best, > > Thomas > > > Date: Mon, 24 Sep 2007 19:55:12 +0200 > > From: Claes Wikstrom > > Subject: Re: [erlang-questions] Not an Erlang fan > > To: Bob Ippolito < bob@REDACTED> > > Cc: "Erlang-Questions \(E-mail\)" < erlang-questions@REDACTED> > > Message-ID: < 46F7FA00.8070507@REDACTED> > > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > > > Bob Ippolito wrote: > > > >> On 9/24/07, Patrick Logan < patrickdlogan@REDACTED> wrote: > >> > >>>>>> http://www.tbray.org/ongoing/When/200x/2007/09/22/Erlang > >>>>>> > >>>>>> Tim Bray might raise some valid points here, even if he's > >>>>>> slightly > >>>>>> biased by his background. > >>>>>> > > > > No, the only fast way today to process a large file line/by/line is to > > > > 1. file:open(Filename, [read, raw]) > > 2. In a loop {ok, Bin} = file:read(Fd, BufSize), > > 3. Use a binary regex matcher such as > > http://yaws.hyber.org/download/posregex-1.0.tgz > > > > (I don't know the state of the regex lib in OTP today, last time > > I looked it sucked bigtime though) > > > > /klacke > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From yarivsadan@REDACTED Thu Sep 27 01:07:08 2007 From: yarivsadan@REDACTED (Yariv Sadan) Date: Wed, 26 Sep 2007 16:07:08 -0700 Subject: [erlang-questions] Regular expression library (was Not an Erlang fan) In-Reply-To: <3dbc6d1c0709261540m636091ecsafcd387283986c73@mail.gmail.com> References: <62CB1DD6-55BA-4822-88E3-46E18822C1EA@gmail.com> <3dbc6d1c0709261540m636091ecsafcd387283986c73@mail.gmail.com> Message-ID: <17244f480709261607w58108f2k7f1282d397f871b2@mail.gmail.com> I was wondering if it would be possible/beneficial to write a regexp compiler that takes a regexp string and compiles it into an Erlang module. You would use it as follows: regexp2:compile("f*o+o?", myregexp, [native]), true = myregexp:matches("foo"). This could be a very fast regexp engine. What do you think? Yariv On 9/26/07, Robert Virding wrote: > The regular expression module which is included in the distribution is a > simple rather na?ve one written in Erlang which uses a back-tracking > algorithm directly on the AST. It has all the problems Russ Cox mentioned in > his paper. I wrote it long ago when no one was interested in parsing regexps > in Erlang. :-) > > I am rewriting it at the moment, still in Erlang but using the same > algorithm, or similar to the one, which Russ describes. It is about the same > speed as the existing one for simpler regexps but it can handle all the > pathological cases as it should. It will handle POSIX syntax and semantics > (but no back-references*). There will also be a version which will implement > a subset of PERL regexps with PERL semantics. Both will work on either lists > or binaries. > > I hadn't seen the lambda-the-ultimate discussion you mentioned and will > check it out. > > There are a number of regexp packages for Erlang which use PCRE or other > libraries which I don't have references to. Look in the "Not an Erlang fan" > thread here which gives some references to them. > > An interesting alternative would be to write the regexp parser/compiler in > Erlang and have the basic regexp matcher in the emulator. This actually > wouldn't be so big, I think. Get the best of both worlds. An I used to > complain (still do in fact) that the emulator is to big. :-) > > Robert > > * Actually there are two types of POSIX regexps in the standard, one which > has back-references and one which doesn't. > > > > On 25/09/2007, G Bulmer wrote: > > After reading the original thread, I wondered what implementation of > > regular expression matching is used by Erlang? > > > > I ask because this paper points out that many implementations have > > bad pathological behaviour: > > http://swtch.com/~rsc/regexp/regexp1.html > > An observation they make is: > > "Regular expression matching can be simple and fast, using finite > > automata-based techniques that have been known for decades. In > > contrast, Perl, PCRE, Python, Ruby, Java, and many other languages > > have regular expression implementations based on recursive > > backtracking that are simple but can be excruciatingly slow." > > > > This is followed by a discussion at http://lambda-the-ultimate.org/ > > node/2064 > > Which seems to come to a working implementation. > > Usefully, they note that Thompson's original patent has expired, so > > there is no obstacle to using the original, and apparently superior, > > algorithm > > > > I looked at 'man regex' on my Mac, and it describes the POSIX > > implementation of regex. It does contain the note "Originally written > > by Henry Spencer", which is suggested as the basis/culprit of the > > pathological regular expression implementations (I should add, as > > Henry Spencer is one of my heroes, that he is also credited with TCL > > 8 regex, which works very well according to the graphs in the paper). > > > > I have tried grep'ing through *.c in otp_src for regex and regcomp, > > and came up with nothing! > > > > Does anyone know what is used in Erlang? It may be a relatively small > > amount of work to incorporate a new regex to provide more stable > > behaviour. > > > > GB > > > > On 25 Sep 2007, at 10:00, > erlang-questions-request@REDACTED wrote: > > > > > Date: Mon, 24 Sep 2007 09:20:08 -0700 (PDT) > > > From: Thomas Lindgren < thomasl_erlang@REDACTED> > > > Subject: Re: [erlang-questions] Not an Erlang fan > > > To: "Erlang-Questions \(E-mail\)" < erlang-questions@REDACTED> > > > Message-ID: > <761781.89097.qm@REDACTED > > > > Content-Type: text/plain; charset=iso-8859-1 > > > > > > > > > - > > > Note that this does not include the actual regexp > > > search of each line ... The code to do that could be > > > an FSM + dictionary insert instead of the simple > > > check-and-accumulate for newline. Extra cost? Unclear. > > > > > > One could merge that code into the scanning the binary > > > but this should ideally be done by a regexp compiler, > > > shouldn't it? Not done at this time AFAIK. > > > > > > Best, > > > Thomas > > > > > Date: Mon, 24 Sep 2007 19:55:12 +0200 > > > From: Claes Wikstrom > > > Subject: Re: [erlang-questions] Not an Erlang fan > > > To: Bob Ippolito < bob@REDACTED> > > > Cc: "Erlang-Questions \(E-mail\)" < erlang-questions@REDACTED> > > > Message-ID: < 46F7FA00.8070507@REDACTED> > > > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > > > > > Bob Ippolito wrote: > > > > > >> On 9/24/07, Patrick Logan < patrickdlogan@REDACTED> wrote: > > >> > > >>>>>> > http://www.tbray.org/ongoing/When/200x/2007/09/22/Erlang > > >>>>>> > > >>>>>> Tim Bray might raise some valid points here, even if he's > > >>>>>> slightly > > >>>>>> biased by his background. > > >>>>>> > > > > > > No, the only fast way today to process a large file line/by/line is to > > > > > > 1. file:open(Filename, [read, raw]) > > > 2. In a loop {ok, Bin} = file:read(Fd, BufSize), > > > 3. Use a binary regex matcher such as > > > http://yaws.hyber.org/download/posregex-1.0.tgz > > > > > > (I don't know the state of the regex lib in OTP today, last time > > > I looked it sucked bigtime though) > > > > > > /klacke > > > > > _______________________________________________ > > 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 gbulmer@REDACTED Thu Sep 27 02:41:34 2007 From: gbulmer@REDACTED (G Bulmer) Date: Thu, 27 Sep 2007 01:41:34 +0100 Subject: [erlang-questions] Regular expression library (was Not an Erlang fan) In-Reply-To: <17244f480709261607w58108f2k7f1282d397f871b2@mail.gmail.com> References: <62CB1DD6-55BA-4822-88E3-46E18822C1EA@gmail.com> <3dbc6d1c0709261540m636091ecsafcd387283986c73@mail.gmail.com> <17244f480709261607w58108f2k7f1282d397f871b2@mail.gmail.com> Message-ID: <6EDC386D-45B2-4A65-96E2-9DED83656726@gmail.com> I have no direct experience of it, but Regal (http:// www.cs.queensu.ca/~thurston/ragel/) has a good reputation. It compiles regular expressions to several different languages, so I assume it is designed to support that kind of behaviour. Regal claims it is used in the Ruby-based web server Mongrel, so any one interested in using Erlang to parse HTTP (and I assume HTML) might pick that work up too if Regal targeted Erlang!-) NB: This is *not* an offer to go do the work :-) Regal compiles a regular expression to a target language. My gossamer- thin understanding is Regal has more of a lex feel to it, i.e. generate a program that implements the regular expression matcher, but with a dynamic language like Erlang, that shouldn't be an issue. Regal allows actions to be interspersed within the regular expression (hence my lex analogy), so a Regal-generated FSM should have the advantage that user-actions can be executed before the whole regular expression is matched. With my even sketchier understanding of the core of Tim Bray's problem (of scanning continuously generated logs), this sounds like a very good match (pardon the pun). TBH, I am reading my own views into Tim's requirements (but that won't stop me:-) I would like to leave a log-file analyser sucking up logs continuously, spitting out important stuff for urgent attention and maybe filtering the rest into different 'grades', rather than waiting for quarter-gig to build up, then picking over that data at a later stage. Apologies Tim, as you can see, I don't understand the needs you are reflecting. GB On 27 Sep 2007, at 00:07, Yariv Sadan wrote: > I was wondering if it would be possible/beneficial to write a regexp > compiler that takes a regexp string and compiles it into an Erlang > module. > > You would use it as follows: > > regexp2:compile("f*o+o?", myregexp, [native]), > true = myregexp:matches("foo"). > > This could be a very fast regexp engine. > > What do you think? > > Yariv > > On 9/26/07, Robert Virding wrote: >> The regular expression module which is included in the >> distribution is a >> simple rather na?ve one written in Erlang which uses a back-tracking >> algorithm directly on the AST. It has all the problems Russ Cox >> mentioned in >> his paper. I wrote it long ago when no one was interested in >> parsing regexps >> in Erlang. :-) >> >> I am rewriting it at the moment, still in Erlang but using the same >> algorithm, or similar to the one, which Russ describes. It is >> about the same >> speed as the existing one for simpler regexps but it can handle >> all the >> pathological cases as it should. It will handle POSIX syntax and >> semantics >> (but no back-references*). There will also be a version which will >> implement >> a subset of PERL regexps with PERL semantics. Both will work on >> either lists >> or binaries. >> >> I hadn't seen the lambda-the-ultimate discussion you mentioned and >> will >> check it out. >> >> There are a number of regexp packages for Erlang which use PCRE or >> other >> libraries which I don't have references to. Look in the "Not an >> Erlang fan" >> thread here which gives some references to them. >> >> An interesting alternative would be to write the regexp parser/ >> compiler in >> Erlang and have the basic regexp matcher in the emulator. This >> actually >> wouldn't be so big, I think. Get the best of both worlds. An I >> used to >> complain (still do in fact) that the emulator is to big. :-) >> >> Robert >> >> * Actually there are two types of POSIX regexps in the standard, >> one which >> has back-references and one which doesn't. >> >> >> >> On 25/09/2007, G Bulmer wrote: >>> After reading the original thread, I wondered what implementation of >>> regular expression matching is used by Erlang? >>> >>> I ask because this paper points out that many implementations have >>> bad pathological behaviour: >>> http://swtch.com/~rsc/regexp/regexp1.html >>> An observation they make is: >>> "Regular expression matching can be simple and fast, using finite >>> automata-based techniques that have been known for decades. In >>> contrast, Perl, PCRE, Python, Ruby, Java, and many other languages >>> have regular expression implementations based on recursive >>> backtracking that are simple but can be excruciatingly slow." >>> >>> This is followed by a discussion at http://lambda-the-ultimate.org/ >>> node/2064 >>> Which seems to come to a working implementation. >>> Usefully, they note that Thompson's original patent has expired, so >>> there is no obstacle to using the original, and apparently superior, >>> algorithm >>> >>> I looked at 'man regex' on my Mac, and it describes the POSIX >>> implementation of regex. It does contain the note "Originally >>> written >>> by Henry Spencer", which is suggested as the basis/culprit of the >>> pathological regular expression implementations (I should add, as >>> Henry Spencer is one of my heroes, that he is also credited with TCL >>> 8 regex, which works very well according to the graphs in the >>> paper). >>> >>> I have tried grep'ing through *.c in otp_src for regex and regcomp, >>> and came up with nothing! >>> >>> Does anyone know what is used in Erlang? It may be a relatively >>> small >>> amount of work to incorporate a new regex to provide more stable >>> behaviour. >>> >>> GB >>> >>> On 25 Sep 2007, at 10:00, >> erlang-questions-request@REDACTED wrote: >>> >>>> Date: Mon, 24 Sep 2007 09:20:08 -0700 (PDT) >>>> From: Thomas Lindgren < thomasl_erlang@REDACTED> >>>> Subject: Re: [erlang-questions] Not an Erlang fan >>>> To: "Erlang-Questions \(E-mail\)" < erlang-questions@REDACTED> >>>> Message-ID: >> <761781.89097.qm@REDACTED > >>>> Content-Type: text/plain; charset=iso-8859-1 >>>> >>>> >>>> - >>>> Note that this does not include the actual regexp >>>> search of each line ... The code to do that could be >>>> an FSM + dictionary insert instead of the simple >>>> check-and-accumulate for newline. Extra cost? Unclear. >>>> >>>> One could merge that code into the scanning the binary >>>> but this should ideally be done by a regexp compiler, >>>> shouldn't it? Not done at this time AFAIK. >>>> >>>> Best, >>>> Thomas >>> >>>> Date: Mon, 24 Sep 2007 19:55:12 +0200 >>>> From: Claes Wikstrom >>>> Subject: Re: [erlang-questions] Not an Erlang fan >>>> To: Bob Ippolito >>>> Cc: "Erlang-Questions \(E-mail\)" < erlang-questions@REDACTED> >>>> Message-ID: < 46F7FA00.8070507@REDACTED> >>>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed >>>> >>>> Bob Ippolito wrote: >>>> >>>>> On 9/24/07, Patrick Logan wrote: >>>>> >>>>>>>>> >> http://www.tbray.org/ongoing/When/200x/2007/09/22/Erlang >>>>>>>>> >>>>>>>>> Tim Bray might raise some valid points here, even if he's >>>>>>>>> slightly >>>>>>>>> biased by his background. >>>>>>>>> >>>> >>>> No, the only fast way today to process a large file line/by/line >>>> is to >>>> >>>> 1. file:open(Filename, [read, raw]) >>>> 2. In a loop {ok, Bin} = file:read(Fd, BufSize), >>>> 3. Use a binary regex matcher such as >>>> http://yaws.hyber.org/download/posregex-1.0.tgz >>>> >>>> (I don't know the state of the regex lib in OTP today, last time >>>> I looked it sucked bigtime though) >>>> >>>> /klacke >>>> >>> _______________________________________________ >>> 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 vinoski@REDACTED Thu Sep 27 08:15:44 2007 From: vinoski@REDACTED (Steve Vinoski) Date: Thu, 27 Sep 2007 02:15:44 -0400 Subject: [erlang-questions] slow file I/O (was Not an Erlang fan) Message-ID: <65b2728e0709262315q27907dc8s74113412010089b2@mail.gmail.com> The whole discussion surrounding the Erlang issues that Tim Bray presented in his blog has got me wondering about file I/O. I'm definitely no Erlang expert, but my own experiments seem to show that Erlang file I/O is an insurmountable obstacle for the kind of problem Tim's trying to solve. Unfortunately, clear details about file I/O didn't seem to come out in the "Not an Erlang fan" thread. So, I'm wondering: 1. Is file I/O for large files really as slow as it seems, and if so, why? 2. Are there existing alternatives to the regular file module functions for file I/O that might skirt this problem, and if so, what are they? 3. Is the whole premise of this problem just not "how it's done" in Erlang? If so, how would this problem be rearranged to better allow for an efficient Erlang solution on the large dataset? 4. Someone posted a link to a Haskell solution in a comment in my blog that seems too good to be true: < http://www.serpentine.com/blog/2007/09/25/what-the-heck-is-a-wide-finder-anyway/>. Assuming it's accurate, why does Haskell beat Erlang so handily in this situation? 5. If file I/O speed is really the issue that it seems to be, are there any plans to officially fix it? thanks, --steve -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Thu Sep 27 08:48:40 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 27 Sep 2007 08:48:40 +0200 Subject: [erlang-questions] custom module attributes In-Reply-To: <000001c8008b$eb5d17e0$b029030a@mtl.ubisoft.org> References: <000001c8008b$eb5d17e0$b029030a@mtl.ubisoft.org> Message-ID: <46FB5248.2050303@ericsson.com> greetings, you can do it now if you are willing to work with the single argument. ex: -module(a). -a_custom_attribute([{tag1,1}, {tag2,2}]). will give you: (ppb1_bs4-R6A@REDACTED)61> a:module_info(). [{exports,[{module_info,0},{module_info,1}]}, {imports,[]}, {attributes,[{vsn,[161104697305202649401065793456291489343]}, {a_custom_attribute,[{tag1,1},{tag2,2}]}]}, bengt Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." On 2007-09-27 00:23, denis wrote: > Hello, > > > > I?m wondering if it difficult or not to define custom module attributes, > allowing several parameters instead of one, like ?compile for instance. > > I?ve not found where it?s defined in the source. Is it managed at the > parsing level ? or elsewhere ? > > > > Thanks for the pointers > > Denis > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From ulf.wiger@REDACTED Thu Sep 27 09:38:44 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Thu, 27 Sep 2007 09:38:44 +0200 Subject: [erlang-questions] slow file I/O (was Not an Erlang fan) In-Reply-To: <65b2728e0709262315q27907dc8s74113412010089b2@mail.gmail.com> References: <65b2728e0709262315q27907dc8s74113412010089b2@mail.gmail.com> Message-ID: <46FB5E04.6070908@ericsson.com> The Haskell code uses functions more similar to file:read_file/1 and file:read/2, which are not nearly as slow as io:get_line/2. I agree with Klacke, that if we could just get flow control on ports, then there is a perfectly fine line-oriented mode built into the port. It's so fast, that using it without flow control on a large file will swamp your erlang code (I tried that in the shootout, with disastrous results). http://www.erlang.org/pipermail/erlang-questions/2007-June/027557.html BR, Ulf W Steve Vinoski wrote: > The whole discussion surrounding the Erlang issues that Tim Bray > presented in his blog has got me wondering about file I/O. I'm > definitely no Erlang expert, but my own experiments seem to show that > Erlang file I/O is an insurmountable obstacle for the kind of problem > Tim's trying to solve. Unfortunately, clear details about file I/O > didn't seem to come out in the "Not an Erlang fan" thread. > > So, I'm wondering: > > 1. Is file I/O for large files really as slow as it seems, and if so, why? > 2. Are there existing alternatives to the regular file module functions > for file I/O that might skirt this problem, and if so, what are they? > 3. Is the whole premise of this problem just not "how it's done" in > Erlang? If so, how would this problem be rearranged to better allow for > an efficient Erlang solution on the large dataset? > 4. Someone posted a link to a Haskell solution in a comment in my blog > that seems too good to be true: > >. > Assuming it's accurate, why does Haskell beat Erlang so handily in this > situation? > 5. If file I/O speed is really the issue that it seems to be, are there > any plans to officially fix it? > > > thanks, > --steve > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From dcaoyuan@REDACTED Thu Sep 27 11:24:42 2007 From: dcaoyuan@REDACTED (Caoyuan) Date: Thu, 27 Sep 2007 17:24:42 +0800 Subject: [erlang-questions] slow file I/O (was Not an Erlang fan) In-Reply-To: <46FB5E04.6070908@ericsson.com> References: <65b2728e0709262315q27907dc8s74113412010089b2@mail.gmail.com> <46FB5E04.6070908@ericsson.com> Message-ID: I wrote a solution in Erlang, with a parallel file data reading, plus a simple express matching, for a 1 million lines file (200M size), took 8.311 seconds when -smp enable, and 10.206 seconds when smp disabled. The code is at: http://blogtrader.net/page/dcaoyuan?entry=tim_bray_s_erlang_exercise My computer is a 2.0G 2-core MacBook, I'd like a see a result on more-core machine :-) The solution spwans a lot of processes to parallel read the file to binary. Then send them to a collect_loop, collect_loop will buffered_read each chunk (when chunks order is correct), buffer_read will convert binary to small (4096 bytes here) lists, then scan_line will merge them to lines, and process_match on line. On 9/27/07, Ulf Wiger (TN/EAB) wrote: > > The Haskell code uses functions more similar to > file:read_file/1 and file:read/2, which are not > nearly as slow as io:get_line/2. > > I agree with Klacke, that if we could just get flow > control on ports, then there is a perfectly fine > line-oriented mode built into the port. It's so fast, > that using it without flow control on a large file > will swamp your erlang code (I tried that in the shootout, > with disastrous results). > > http://www.erlang.org/pipermail/erlang-questions/2007-June/027557.html > > BR, > Ulf W > > Steve Vinoski wrote: > > The whole discussion surrounding the Erlang issues that Tim Bray > > presented in his blog has got me wondering about file I/O. I'm > > definitely no Erlang expert, but my own experiments seem to show that > > Erlang file I/O is an insurmountable obstacle for the kind of problem > > Tim's trying to solve. Unfortunately, clear details about file I/O > > didn't seem to come out in the "Not an Erlang fan" thread. > > > > So, I'm wondering: > > > > 1. Is file I/O for large files really as slow as it seems, and if so, why? > > 2. Are there existing alternatives to the regular file module functions > > for file I/O that might skirt this problem, and if so, what are they? > > 3. Is the whole premise of this problem just not "how it's done" in > > Erlang? If so, how would this problem be rearranged to better allow for > > an efficient Erlang solution on the large dataset? > > 4. Someone posted a link to a Haskell solution in a comment in my blog > > that seems too good to be true: > > > >. > > Assuming it's accurate, why does Haskell beat Erlang so handily in this > > situation? > > 5. If file I/O speed is really the issue that it seems to be, are there > > any plans to officially fix it? > > > > > > thanks, > > --steve > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > 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 > -- - Caoyuan From vinoski@REDACTED Thu Sep 27 16:41:44 2007 From: vinoski@REDACTED (Steve Vinoski) Date: Thu, 27 Sep 2007 10:41:44 -0400 Subject: [erlang-questions] slow file I/O (was Not an Erlang fan) In-Reply-To: References: <65b2728e0709262315q27907dc8s74113412010089b2@mail.gmail.com> <46FB5E04.6070908@ericsson.com> Message-ID: <65b2728e0709270741h62ee6f3aoccd8481efcf8d0e6@mail.gmail.com> I've tried your code with the 1000k file on my MacBook Pro (2.33 GHz 2 core) with 2 GB RAM and a Linux box with 2 quad-core 2.33 GHz Intel Xeons with 8 GB RAM. On the laptop, the best time I got was 17 secs. On the Linux system, the best time I got was 9.7 sec. Changing the number of processes doesn't seem to affect the result that much. Perhaps there's a better way to run it than just going into the erl shell, compiling it, and then running it? So even with an elaborate program like this, Ruby still outperforms Erlang by at least 2x, closer to 3x, and yet Ruby is generally slow compared to Perl and Python. (Mind you, I use multiple programming languages every day, so I'm not approaching this from a "my language is better than yours" perspective. I don't have time for such nonsense.) I'm just really trying to understand why file I/O has to be so slow compared to these other languages. Ulf and Klacke have mentioned putting flow control on ports -- is that the right answer to this issue, and if so, can anyone who works on the code say whether there's anything in the works for that? BTW, Tim told me via email that he's working up a new solution, but I haven't seen it yet. thanks, --steve On 9/27/07, Caoyuan wrote: > > I wrote a solution in Erlang, with a parallel file data reading, plus > a simple express matching, for a 1 million lines file (200M size), > took 8.311 seconds when -smp enable, and 10.206 seconds when smp > disabled. The code is at: > http://blogtrader.net/page/dcaoyuan?entry=tim_bray_s_erlang_exercise > > My computer is a 2.0G 2-core MacBook, I'd like a see a result on > more-core machine :-) > > The solution spwans a lot of processes to parallel read the file to > binary. Then send them to a collect_loop, collect_loop will > buffered_read each chunk (when chunks order is correct), buffer_read > will convert binary to small (4096 bytes here) lists, then scan_line > will merge them to lines, and process_match on line. > > > On 9/27/07, Ulf Wiger (TN/EAB) wrote: > > > > The Haskell code uses functions more similar to > > file:read_file/1 and file:read/2, which are not > > nearly as slow as io:get_line/2. > > > > I agree with Klacke, that if we could just get flow > > control on ports, then there is a perfectly fine > > line-oriented mode built into the port. It's so fast, > > that using it without flow control on a large file > > will swamp your erlang code (I tried that in the shootout, > > with disastrous results). > > > > http://www.erlang.org/pipermail/erlang-questions/2007-June/027557.html > > > > BR, > > Ulf W > > > > Steve Vinoski wrote: > > > The whole discussion surrounding the Erlang issues that Tim Bray > > > presented in his blog has got me wondering about file I/O. I'm > > > definitely no Erlang expert, but my own experiments seem to show that > > > Erlang file I/O is an insurmountable obstacle for the kind of problem > > > Tim's trying to solve. Unfortunately, clear details about file I/O > > > didn't seem to come out in the "Not an Erlang fan" thread. > > > > > > So, I'm wondering: > > > > > > 1. Is file I/O for large files really as slow as it seems, and if so, > why? > > > 2. Are there existing alternatives to the regular file module > functions > > > for file I/O that might skirt this problem, and if so, what are they? > > > 3. Is the whole premise of this problem just not "how it's done" in > > > Erlang? If so, how would this problem be rearranged to better allow > for > > > an efficient Erlang solution on the large dataset? > > > 4. Someone posted a link to a Haskell solution in a comment in my blog > > > that seems too good to be true: > > > -wide-finder-anyway/ > > > -wide-finder-anyway/>>. > > > Assuming it's accurate, why does Haskell beat Erlang so handily in > this > > > situation? > > > 5. If file I/O speed is really the issue that it seems to be, are > there > > > any plans to officially fix it? > > > > > > > > > thanks, > > > --steve > > > > > > > > > ------------------------------------------------------------ > ------------ > > > > > > _______________________________________________ > > > 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 > > > > > > -- > - Caoyuan > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf.wiger@REDACTED Thu Sep 27 17:15:55 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Thu, 27 Sep 2007 17:15:55 +0200 Subject: [erlang-questions] slow file I/O (was Not an Erlang fan) In-Reply-To: <65b2728e0709270741h62ee6f3aoccd8481efcf8d0e6@mail.gmail.com> References: <65b2728e0709262315q27907dc8s74113412010089b2@mail.gmail.com> <46FB5E04.6070908@ericsson.com> <65b2728e0709270741h62ee6f3aoccd8481efcf8d0e6@mail.gmail.com> Message-ID: <46FBC92B.1040309@ericsson.com> Steve Vinoski wrote: > > So even with an elaborate program like this, Ruby still outperforms > Erlang by at least 2x, closer to 3x, and yet Ruby is generally slow > compared to Perl and Python. (Mind you, I use multiple programming > languages every day, so I'm not approaching this from a "my language is > better than yours" perspective. I don't have time for such nonsense.) > I'm just really trying to understand why file I/O has to be so slow > compared to these other languages. One reason is that file IO in Erlang has traditionally been tuned in order to be as unobtrusive as possible, in massively concurrent systems. For example, Mnesia's log dumps usually run in the background at low priority in such systems, and the more important IO is the signaling to/from the network. In these systems, writes to disk are uncommon, and reading large volumes of data from disk only occurs at restarts (which are - hopefully - exceedingly uncommon). While we've noticed for a long time that Erlang's IO generally sucks in benchmarks that test raw sequential speed on one large file or one socket, it hasn't been clear that this adversely affects the key products using Erlang. I'm sure that we can find ways to speed up such IO without adversely affecting the characteristics of massively concurrent IO. As Erlang is spreading more into other application areas, this is bound to be a major issue. BR, Ulf W From per.gustafsson@REDACTED Thu Sep 27 17:53:59 2007 From: per.gustafsson@REDACTED (Per Gustafsson) Date: Thu, 27 Sep 2007 17:53:59 +0200 Subject: [erlang-questions] slow file I/O (was Not an Erlang fan) In-Reply-To: <65b2728e0709270741h62ee6f3aoccd8481efcf8d0e6@mail.gmail.com> References: <65b2728e0709262315q27907dc8s74113412010089b2@mail.gmail.com> <46FB5E04.6070908@ericsson.com> <65b2728e0709270741h62ee6f3aoccd8481efcf8d0e6@mail.gmail.com> Message-ID: <46FBD217.7030606@it.uu.se> I've made another solution for this problem based on a line_server which serves lists of lines taken from a file. It runs in about 8 secs on a 2 p4 2.4 ghz machine using R11B-5 and in about 5 secs using an R-12 pre-release, but the program should scale to more processors. To compile the modules write: erl -smp -make To run the program write on your command line: erl -smp -noshell -run pcount run filename n where n is the number of processes you want to split the work on. Note that the modules are native compiled if possible. Per Steve Vinoski wrote: > I've tried your code with the 1000k file on my MacBook Pro (2.33 GHz 2 core) > with 2 GB RAM and a Linux box with 2 quad-core 2.33 GHz Intel Xeons with 8 > GB RAM. On the laptop, the best time I got was 17 secs. On the Linux system, > the best time I got was 9.7 sec. Changing the number of processes doesn't > seem to affect the result that much. Perhaps there's a better way to run it > than just going into the erl shell, compiling it, and then running it? > > So even with an elaborate program like this, Ruby still outperforms Erlang > by at least 2x, closer to 3x, and yet Ruby is generally slow compared to > Perl and Python. (Mind you, I use multiple programming languages every day, > so I'm not approaching this from a "my language is better than yours" > perspective. I don't have time for such nonsense.) I'm just really trying to > understand why file I/O has to be so slow compared to these other languages. > Ulf and Klacke have mentioned putting flow control on ports -- is that the > right answer to this issue, and if so, can anyone who works on the code say > whether there's anything in the works for that? > > > BTW, Tim told me via email that he's working up a new solution, but I > haven't seen it yet. > > > thanks, > --steve > > > On 9/27/07, Caoyuan wrote: > >>I wrote a solution in Erlang, with a parallel file data reading, plus >>a simple express matching, for a 1 million lines file (200M size), >>took 8.311 seconds when -smp enable, and 10.206 seconds when smp >>disabled. The code is at: >>http://blogtrader.net/page/dcaoyuan?entry=tim_bray_s_erlang_exercise >> >>My computer is a 2.0G 2-core MacBook, I'd like a see a result on >>more-core machine :-) >> >>The solution spwans a lot of processes to parallel read the file to >>binary. Then send them to a collect_loop, collect_loop will >>buffered_read each chunk (when chunks order is correct), buffer_read >>will convert binary to small (4096 bytes here) lists, then scan_line >>will merge them to lines, and process_match on line. >> >> >>On 9/27/07, Ulf Wiger (TN/EAB) wrote: >> >>>The Haskell code uses functions more similar to >>>file:read_file/1 and file:read/2, which are not >>>nearly as slow as io:get_line/2. >>> >>>I agree with Klacke, that if we could just get flow >>>control on ports, then there is a perfectly fine >>>line-oriented mode built into the port. It's so fast, >>>that using it without flow control on a large file >>>will swamp your erlang code (I tried that in the shootout, >>>with disastrous results). >>> >>>http://www.erlang.org/pipermail/erlang-questions/2007-June/027557.html >>> >>>BR, >>>Ulf W >>> >>>Steve Vinoski wrote: >>> >>>>The whole discussion surrounding the Erlang issues that Tim Bray >>>>presented in his blog has got me wondering about file I/O. I'm >>>>definitely no Erlang expert, but my own experiments seem to show that >>>>Erlang file I/O is an insurmountable obstacle for the kind of problem >>>>Tim's trying to solve. Unfortunately, clear details about file I/O >>>>didn't seem to come out in the "Not an Erlang fan" thread. >>>> >>>>So, I'm wondering: >>>> >>>>1. Is file I/O for large files really as slow as it seems, and if so, >> >>why? >> >>>>2. Are there existing alternatives to the regular file module >> >>functions >> >>>>for file I/O that might skirt this problem, and if so, what are they? >>>>3. Is the whole premise of this problem just not "how it's done" in >>>>Erlang? If so, how would this problem be rearranged to better allow >> >>for >> >>>>an efficient Erlang solution on the large dataset? >>>>4. Someone posted a link to a Haskell solution in a comment in my blog >>>>that seems too good to be true: >>>>> >>-wide-finder-anyway/ >> >>>>> >>-wide-finder-anyway/>>. >> >>>>Assuming it's accurate, why does Haskell beat Erlang so handily in >> >>this >> >>>>situation? >>>>5. If file I/O speed is really the issue that it seems to be, are >> >>there >> >>>>any plans to officially fix it? >>>> >>>> >>>>thanks, >>>>--steve >>>> >>>> >>>>------------------------------------------------------------ >> >>------------ >> >>>>_______________________________________________ >>>>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 >>> >> >> >> >>-- >>- Caoyuan >>_______________________________________________ >>erlang-questions mailing list >>erlang-questions@REDACTED >>http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: pcount.erl URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: line_server.erl URL: From bengt.kleberg@REDACTED Thu Sep 27 08:54:01 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 27 Sep 2007 08:54:01 +0200 Subject: [erlang-questions] slow file I/O (was Not an Erlang fan) In-Reply-To: <65b2728e0709262315q27907dc8s74113412010089b2@mail.gmail.com> References: <65b2728e0709262315q27907dc8s74113412010089b2@mail.gmail.com> Message-ID: <46FB5389.9000403@ericsson.com> On 2007-09-27 08:15, Steve Vinoski wrote: ...deleted > 2. Are there existing alternatives to the regular file module functions > for file I/O that might skirt this problem, and if so, what are they? there are many functions for file I/O in the io module. they are _slower_ than the functions in the file module. bengt From klacke@REDACTED Thu Sep 27 20:46:05 2007 From: klacke@REDACTED (Claes Wikstrom) Date: Thu, 27 Sep 2007 20:46:05 +0200 Subject: [erlang-questions] slow file I/O (was Not an Erlang fan) In-Reply-To: <46FBD217.7030606@it.uu.se> References: <65b2728e0709262315q27907dc8s74113412010089b2@mail.gmail.com> <46FB5E04.6070908@ericsson.com> <65b2728e0709270741h62ee6f3aoccd8481efcf8d0e6@mail.gmail.com> <46FBD217.7030606@it.uu.se> Message-ID: <46FBFA6D.2060904@hyber.org> Originally at Bluetail, we had some serious problems with high performance file I/O, especially line oriented such. I then wrote a portable (yes win32 too) linked in driver for fast FILE I/O. It's based on an old and hacked version of the BSD FILE* interface. It's called bfile and we've been using it in pretty much all projects during the past 8 years. I've prepared a tarball of it at http://yaws.hyber.org/download/bfile-1.0.tgz Here's an (slightly edited) example shell session: 2> bfile:load_driver(). ok 4> {ok, Fd} = bfile:fopen("Makefile", "r"). {ok,{bfile,#Port<0.98>}} 5> bfile:fgets(Fd). {line,<<10>>} 6> bfile:fgets(Fd). {line,<<10>>} 7> bfile:fgets(Fd). {line,<<97,108,108,58,32,10>>} 14> bfile:fread(Fd, 10000). {ok,<<10,10,105,110,115,116,97,108,108,58,32,97,108,108,10,9,40,99,100,32,99,95,115,114,99,59,32,...>>} 15> bfile:fread(Fd, 10000). eof It should be equally fast as the same code in C. Enjoy, /klacke From dcaoyuan@REDACTED Thu Sep 27 21:14:38 2007 From: dcaoyuan@REDACTED (Caoyuan) Date: Fri, 28 Sep 2007 03:14:38 +0800 Subject: [erlang-questions] slow file I/O (was Not an Erlang fan) In-Reply-To: <46FBD217.7030606@it.uu.se> References: <65b2728e0709262315q27907dc8s74113412010089b2@mail.gmail.com> <46FB5E04.6070908@ericsson.com> <65b2728e0709270741h62ee6f3aoccd8481efcf8d0e6@mail.gmail.com> <46FBD217.7030606@it.uu.se> Message-ID: It took the code 5.1 seconds on my machine. >From line_server:divide_lines/3, it seems binary matching should avoid one byte matching as Thomas said :-) BTW, after add -compile([native]). My code took about 5.2 seconds now, where process_match tooks about 1.2 seconds of this 5.2 seconds. BR, - Caoyuan On 9/27/07, Per Gustafsson wrote: > I've made another solution for this problem based on a line_server which > serves lists of lines taken from a file. It runs in about 8 secs on a > 2 p4 2.4 ghz machine using R11B-5 and in about 5 secs using an R-12 > pre-release, but the program should scale to more processors. > > To compile the modules write: > > erl -smp -make > > To run the program write on your command line: > > erl -smp -noshell -run pcount run filename n > > where n is the number of processes you want to split the work on. Note > that the modules are native compiled if possible. > > Per From matthew@REDACTED Thu Sep 27 21:21:01 2007 From: matthew@REDACTED (Matthew Dempsky) Date: Thu, 27 Sep 2007 12:21:01 -0700 Subject: [erlang-questions] Erlang release management Message-ID: The OTP release management tools look really useful, but they also seem to have a steep learning curve. I was curious if anyone on the mailing list has successfully used them in real-world deployments. From vinoski@REDACTED Thu Sep 27 21:36:52 2007 From: vinoski@REDACTED (Steve Vinoski) Date: Thu, 27 Sep 2007 15:36:52 -0400 Subject: [erlang-questions] slow file I/O (was Not an Erlang fan) In-Reply-To: <46FBFA6D.2060904@hyber.org> References: <65b2728e0709262315q27907dc8s74113412010089b2@mail.gmail.com> <46FB5E04.6070908@ericsson.com> <65b2728e0709270741h62ee6f3aoccd8481efcf8d0e6@mail.gmail.com> <46FBD217.7030606@it.uu.se> <46FBFA6D.2060904@hyber.org> Message-ID: <65b2728e0709271236j3a2f8a19xeef2d586ae0b65b3@mail.gmail.com> On 9/27/07, Claes Wikstrom wrote: > > > Originally at Bluetail, we had some serious problems with > high performance file I/O, especially line oriented such. > > I then wrote a portable (yes win32 too) linked in driver > for fast FILE I/O. It's based on an old and hacked version > of the BSD FILE* interface. It's called bfile and we've > been using it in pretty much all projects during the past 8 > years. I've prepared a tarball of it at > > http://yaws.hyber.org/download/bfile-1.0.tgz > > Here's an (slightly edited) example shell session: > > 2> bfile:load_driver(). > ok > 4> {ok, Fd} = bfile:fopen("Makefile", "r"). > {ok,{bfile,#Port<0.98>}} > 5> bfile:fgets(Fd). > {line,<<10>>} > 6> bfile:fgets(Fd). > {line,<<10>>} > 7> bfile:fgets(Fd). > {line,<<97,108,108,58,32,10>>} > 14> bfile:fread(Fd, 10000). > {ok,<<10,10,105,110,115,116,97,108,108,58,32,97,108,108,10,9 > ,40,99,100,32,99,95,115,114,99 ,59,32,...>>} > 15> bfile:fread(Fd, 10000). > eof > > It should be equally fast as the same code in C. > Very cool! Between this and the regexp library you posted yesterday, the Tim Bray "wide finder" problem has very likely just gotten a whole lot easier. --steve -------------- next part -------------- An HTML attachment was scrubbed... URL: From dcaoyuan@REDACTED Thu Sep 27 21:38:00 2007 From: dcaoyuan@REDACTED (Caoyuan) Date: Fri, 28 Sep 2007 03:38:00 +0800 Subject: [erlang-questions] slow file I/O (was Not an Erlang fan) In-Reply-To: References: <65b2728e0709262315q27907dc8s74113412010089b2@mail.gmail.com> <46FB5E04.6070908@ericsson.com> <65b2728e0709270741h62ee6f3aoccd8481efcf8d0e6@mail.gmail.com> <46FBD217.7030606@it.uu.se> Message-ID: Wow, Per Gustafsson' code travels the whole dataset and get all lines ready only took 1.57 seconds on my computer, that's really fast. Will the line_server be part of OTP? On 9/28/07, Caoyuan wrote: > It took the code 5.1 seconds on my machine. > > From line_server:divide_lines/3, it seems binary matching should avoid > one byte matching as Thomas said :-) > > BTW, after add -compile([native]). My code took about 5.2 seconds now, > where process_match tooks about 1.2 seconds of this 5.2 seconds. > > BR, > - Caoyuan > > On 9/27/07, Per Gustafsson wrote: > > I've made another solution for this problem based on a line_server which > > serves lists of lines taken from a file. It runs in about 8 secs on a > > 2 p4 2.4 ghz machine using R11B-5 and in about 5 secs using an R-12 > > pre-release, but the program should scale to more processors. > > > > To compile the modules write: > > > > erl -smp -make > > > > To run the program write on your command line: > > > > erl -smp -noshell -run pcount run filename n > > > > where n is the number of processes you want to split the work on. Note > > that the modules are native compiled if possible. > > > > Per > -- - Caoyuan From nem@REDACTED Thu Sep 27 23:19:18 2007 From: nem@REDACTED (Geoff Cant) Date: Fri, 28 Sep 2007 09:19:18 +1200 Subject: [erlang-questions] Erlang release management In-Reply-To: (Matthew Dempsky's message of "Thu, 27 Sep 2007 12:21:01 -0700") References: Message-ID: "Matthew Dempsky" writes: > The OTP release management tools look really useful, but they also > seem to have a steep learning curve. I was curious if anyone on the > mailing list has successfully used them in real-world deployments. I almost got the hang of OTP releases. I use systools to prepare release tarballs which I then turn into debian packages. (This is because I didn't find the release_handler documentation until I'd already deployed something - I saw the system.tar.gz file and thought "Oh, you just untar it somewhere"). It would be good for someone (in their copious free time) to figure out a better way of turning release tarballs into operating system packages or write a code deployment/upgrade system as an alternative to systools/release_handler. In a debian package you could depend on the erlang runtime, install the release tarball as /usr/share//-.tar.gz and call release_handler:unpack_release and release_handler:install appropriately in a postinst script. Incidently, some FHS guidance on where to put installed systems would be really useful (I don't like the idea of altering anything in the $OTPROOT heirarchy). Cheers, -- Geoff From nem@REDACTED Thu Sep 27 23:35:44 2007 From: nem@REDACTED (Geoff Cant) Date: Fri, 28 Sep 2007 09:35:44 +1200 Subject: [erlang-questions] Silly Standalone Erlang (Customer code loader / error_handler module) Message-ID: Hi all, I was inspired last night to write an error_handler module to load code from zip files. The result is http://git.erlang.geek.nz/?p=ssae.git;a=summary -- a module that can hide an entire system inside a beam file and subsequently load from it. It's not particularly practical, but demonstrates writing a custom error_handler, and some of the pitfalls of doing so (I got my laptop to swap to death because ssae was trying to load code that ssae needed in order to load code). I'm not quite sure how to go about faking non-beam file loads however, so if the system you deploy with ssae has private data you can't currently get at it. On a related note, does anyone know how the original SAE worked? I'm stumped about how to pack files into the beam emulator binary in such a way that it could use them. Cheers, -- Geoff Cant From rvirding@REDACTED Fri Sep 28 00:29:31 2007 From: rvirding@REDACTED (Robert Virding) Date: Fri, 28 Sep 2007 00:29:31 +0200 Subject: [erlang-questions] Regular expression library (was Not an Erlang fan) In-Reply-To: References: <62CB1DD6-55BA-4822-88E3-46E18822C1EA@gmail.com> <3dbc6d1c0709261540m636091ecsafcd387283986c73@mail.gmail.com> Message-ID: <3dbc6d1c0709271529s33a1d36fya744ec6e398349a9@mail.gmail.com> On 27/09/2007, G Bulmer wrote: > I guess it's the 'pathological' cases that worry me; "MY software > NEVER breaks on the easy cases" :-) > Seriously though, having a regexp with stable behaviour wins over one > that gets the last 200% of performance *most of the time*, but is > unstable. I did some tests using Russ Cox example comparing the old regexp module (not a good comparison i know) and a new version I am working on. The results confirmed his findings. N 15 18 20 22 25 30 40 regexp 40 360 1570 6900 59000 re 0.2 0.25 0.32 0.38 0.5 0.73 1.4 All times in millisecs. The old regexp uses a backtracking algorithm. Which tends to show that we will have no problems with pathological cases. :-) If people feel that it is too slow for the simpler regexps and would prefer to use a C library then it is definitely important to choose the *right* library. Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From fig@REDACTED Fri Sep 28 01:00:02 2007 From: fig@REDACTED (Michael FIG) Date: Thu, 27 Sep 2007 17:00:02 -0600 (CST) Subject: [erlang-questions] Erlang release management In-Reply-To: Message-ID: <2946668.66891190934002671.JavaMail.root@zimbra> Hi, For those of you who work on Windows, I partly developed an installer creator (which needs an installed Windows Erlang and the free Inno Setup) that allows you to bootstrap an Erlang target system with an initial release tarball. It's available at http://fig.org/michael/wintarget/ I haven't made sure that systools can be used on Windows yet, so you need to do some work yourself. (It's useful to my company because we use Inno Setup, and wanted to bundle a minimal Erlang with our product, kind of like CEAN, only customizable and not using NullSoft). Eventually, I want to be able to use the full OTP capabilities and generate fat release tarballs that can be installed using release_tools into the bootstrapped target system on any operating system we support. I probably won't do that for a while, though. -- Michael FIG , PMP MarkeTel Multi-Line Dialing Systems, Ltd. Phone: (306) 359-6893 ext. 528 ----- Original Message ----- From: "Matthew Dempsky" To: erlang-questions@REDACTED Sent: Thursday, September 27, 2007 1:21:01 PM (GMT-0600) America/Guatemala Subject: [erlang-questions] Erlang release management The OTP release management tools look really useful, but they also seem to have a steep learning curve. I was curious if anyone on the mailing list has successfully used them in real-world deployments. _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From dbt@REDACTED Fri Sep 28 02:39:22 2007 From: dbt@REDACTED (David Terrell) Date: Thu, 27 Sep 2007 19:39:22 -0500 Subject: [erlang-questions] mmap(2) to a binary? Message-ID: <20070928003922.GD8620@sphinx.chicagopeoplez.org> In reference to the ongoing thread here and in the blogosphere, I had an idea for doing some arbitrary file I/O in convenient fashion. What if you could call mmap() on a file and get a binary out of it that points directly to the mapped space? would someone more familiar with the internals of the beam machine tell me if that's possible or not? I don't know if you'd have to hold open some sort of port that kept it alive and kill it when it died, or if it's completely impossible, but it seems like a really efficient way to sidestep the drama of read(2) and friends. -- David Terrell dbt@REDACTED ((meatspace)) http://meat.net/ From nem@REDACTED Fri Sep 28 05:18:41 2007 From: nem@REDACTED (Geoff Cant) Date: Fri, 28 Sep 2007 15:18:41 +1200 Subject: [erlang-questions] San Francisco Erlounge? Message-ID: Hi all, I'm going to be in San Francisco for the Google Summer of Code mentor summit next week and was wondering if anyone would be interested in an Erlounge on Sunday the 7th or Monday the 8th. Cheers, -- Geoff Cant From dking@REDACTED Fri Sep 28 05:30:31 2007 From: dking@REDACTED (David King) Date: Thu, 27 Sep 2007 20:30:31 -0700 Subject: [erlang-questions] San Francisco Erlounge? In-Reply-To: References: Message-ID: > Hi all, I'm going to be in San Francisco for the Google Summer of Code > mentor summit next week and was wondering if anyone would be > interested > in an Erlounge on Sunday the 7th or Monday the 8th. (moving to bay-area-erlangers@REDACTED) Sounds like a plan to me. Did you have a date in mind? Last time we had eight or nine show up, if it stays that small we could meet at a pub or somesuch. Otherwise I could probably talk my office into hosting something, but it'd be BYOB From mikage@REDACTED Fri Sep 28 08:39:44 2007 From: mikage@REDACTED (Mikage Sawatari) Date: Fri, 28 Sep 2007 15:39:44 +0900 Subject: [erlang-questions] Message passing in Erlang is very slow with the -smp option. Message-ID: <5e448700709272339o31c76115la1f4e52ee2ed00ed@mail.gmail.com> I found message passing becomes very slow when the -smp option is in effect. I did a benchmark by passing messages circularly around several processes. The performance became about 1/7 with the -smp option. Is there any workaround for this? Or will this be improved in the future of Erlang? >> erl -noshell -eval 'ring_bench:start(1000,10000), halt().' >> > N = 1000, M = 10000; elapsed time = 1470 (1494) miliseconds > > >> erl -smp -noshell -eval 'ring_bench:start(1000,10000), halt().' >> > N = 1000, M = 10000; elapsed time = 9810 (9826) miliseconds > The program I used can be found in the following blog: > http://d.hatena.ne.jp/sumim/20070513/p1 (Japanese) > -- ----------------------------------------------------------------------- SAWATARI Mikage (SANO Taku) From bengt.kleberg@REDACTED Fri Sep 28 08:49:28 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 28 Sep 2007 08:49:28 +0200 Subject: [erlang-questions] slow file I/O (was Not an Erlang fan) In-Reply-To: <46FBFA6D.2060904@hyber.org> References: <65b2728e0709262315q27907dc8s74113412010089b2@mail.gmail.com> <46FB5E04.6070908@ericsson.com> <65b2728e0709270741h62ee6f3aoccd8481efcf8d0e6@mail.gmail.com> <46FBD217.7030606@it.uu.se> <46FBFA6D.2060904@hyber.org> Message-ID: <46FCA3F8.40509@ericsson.com> greetings, bfile sounds great. can it do stdin/stdout? bengt Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." On 2007-09-27 20:46, Claes Wikstrom wrote: > Originally at Bluetail, we had some serious problems with > high performance file I/O, especially line oriented such. > > I then wrote a portable (yes win32 too) linked in driver > for fast FILE I/O. It's based on an old and hacked version > of the BSD FILE* interface. It's called bfile and we've > been using it in pretty much all projects during the past 8 > years. I've prepared a tarball of it at > > http://yaws.hyber.org/download/bfile-1.0.tgz > > Here's an (slightly edited) example shell session: > > 2> bfile:load_driver(). > ok > 4> {ok, Fd} = bfile:fopen("Makefile", "r"). > {ok,{bfile,#Port<0.98>}} > 5> bfile:fgets(Fd). > {line,<<10>>} > 6> bfile:fgets(Fd). > {line,<<10>>} > 7> bfile:fgets(Fd). > {line,<<97,108,108,58,32,10>>} > 14> bfile:fread(Fd, 10000). > {ok,<<10,10,105,110,115,116,97,108,108,58,32,97,108,108,10,9,40,99,100,32,99,95,115,114,99,59,32,...>>} > 15> bfile:fread(Fd, 10000). > eof > > It should be equally fast as the same code in C. > > Enjoy, > > /klacke > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From mikage@REDACTED Fri Sep 28 08:50:00 2007 From: mikage@REDACTED (Mikage Sawatari) Date: Fri, 28 Sep 2007 15:50:00 +0900 Subject: [erlang-questions] Message passing in Erlang is very slow with the -smp option. In-Reply-To: <5e448700709272339o31c76115la1f4e52ee2ed00ed@mail.gmail.com> References: <5e448700709272339o31c76115la1f4e52ee2ed00ed@mail.gmail.com> Message-ID: <5e448700709272350l24fe576dj24d9428c1daf4eb4@mail.gmail.com> Sorry for omitting my environment: SUSE Linux Enterprise Server 10 SP1 (x86_64) Kernel: 2.6.16.46-0.14-smp CPU: Intel(R) Xeon(R) CPU E5335 @ 2.00GHz x 2 sockets (total 8 cores) Memory: 8GB Erlang: R11B-5 (version 5.5.5) On 9/28/07, Mikage Sawatari wrote: > I found message passing becomes very slow when the -smp option is in > effect. I did a benchmark by passing messages circularly around several > processes. The performance became about 1/7 with the -smp option. > > Is there any workaround for this? Or will this be improved in the future > of Erlang? > > >> erl -noshell -eval 'ring_bench:start(1000,10000), halt().' > >> > > N = 1000, M = 10000; elapsed time = 1470 (1494) miliseconds > > > > > >> erl -smp -noshell -eval 'ring_bench:start(1000,10000), halt().' > >> > > N = 1000, M = 10000; elapsed time = 9810 (9826) miliseconds > > > > The program I used can be found in the following blog: > > > http://d.hatena.ne.jp/sumim/20070513/p1 (Japanese) > > -- ----------------------------------------------------------------------- SAWATARI Mikage (SANO Taku) From klacke@REDACTED Fri Sep 28 10:38:45 2007 From: klacke@REDACTED (Claes Wikstrom) Date: Fri, 28 Sep 2007 10:38:45 +0200 Subject: [erlang-questions] slow file I/O (was Not an Erlang fan) In-Reply-To: <46FCA3F8.40509@ericsson.com> References: <65b2728e0709262315q27907dc8s74113412010089b2@mail.gmail.com> <46FB5E04.6070908@ericsson.com> <65b2728e0709270741h62ee6f3aoccd8481efcf8d0e6@mail.gmail.com> <46FBD217.7030606@it.uu.se> <46FBFA6D.2060904@hyber.org> <46FCA3F8.40509@ericsson.com> Message-ID: <46FCBD95.2030102@hyber.org> Bengt Kleberg wrote: > greetings, > > bfile sounds great. can it do stdin/stdout? > > No - but it would be straight forward to extend it to do that. After all stdin _is_ a FILE* /klacke From rickard.s.green@REDACTED Fri Sep 28 12:49:26 2007 From: rickard.s.green@REDACTED (Rickard Green) Date: Fri, 28 Sep 2007 12:49:26 +0200 Subject: [erlang-questions] Message passing in Erlang is very slow with the -smp option. In-Reply-To: <5e448700709272350l24fe576dj24d9428c1daf4eb4@mail.gmail.com> References: <5e448700709272339o31c76115la1f4e52ee2ed00ed@mail.gmail.com> <5e448700709272350l24fe576dj24d9428c1daf4eb4@mail.gmail.com> Message-ID: <46FCDC36.3030709@ericsson.com> We constantly work on improving the smp emulator. In the coming R12B release we have optimized the emulator internal process locking which has effect on this benchmark. I ran your benchmark on a machine similar to yours and got a time 6.7 times longer for the R11B-5 emulator with smp support compared to the emulator without smp support. With the, to be, R12B release I got a time 4.4 times longer. This might still seem as a large difference, but if you increase the size of the message being passed the difference between the smp and non-smp emulator shrinks (you very seldom pass single atoms as messages in real applications). Also note that you cannot blame message passing for the whole difference, scheduling is more expensive in smp emulator as well and this benchmark is quite scheduling intensive. A ring benchmark isn't especially nice to the smp emulator since nothing will be able to execute in parallel, but it is of course non the less interesting to see the cost for locking, etc. BR, Rickard Green, Erlang/OTP, Ericsson AB. Mikage Sawatari wrote: > Sorry for omitting my environment: > > SUSE Linux Enterprise Server 10 SP1 (x86_64) > Kernel: 2.6.16.46-0.14-smp > CPU: Intel(R) Xeon(R) CPU E5335 @ 2.00GHz x 2 sockets (total 8 cores) > Memory: 8GB > Erlang: R11B-5 (version 5.5.5) > > On 9/28/07, Mikage Sawatari wrote: >> I found message passing becomes very slow when the -smp option is in >> effect. I did a benchmark by passing messages circularly around several >> processes. The performance became about 1/7 with the -smp option. >> >> Is there any workaround for this? Or will this be improved in the future >> of Erlang? >> >>>> erl -noshell -eval 'ring_bench:start(1000,10000), halt().' >>>> >>> N = 1000, M = 10000; elapsed time = 1470 (1494) miliseconds >>> >>> >>>> erl -smp -noshell -eval 'ring_bench:start(1000,10000), halt().' >>>> >>> N = 1000, M = 10000; elapsed time = 9810 (9826) miliseconds >>> >> The program I used can be found in the following blog: >> >>> http://d.hatena.ne.jp/sumim/20070513/p1 (Japanese) >>> > From bbmaj7@REDACTED Fri Sep 28 13:04:18 2007 From: bbmaj7@REDACTED (Richard Andrews) Date: Fri, 28 Sep 2007 21:04:18 +1000 (EST) Subject: [erlang-questions] slow file I/O (was Not an Erlang fan) In-Reply-To: <46FCBD95.2030102@hyber.org> Message-ID: <348225.16519.qm@web52011.mail.re2.yahoo.com> > > bfile sounds great. can it do stdin/stdout? > > No - but it would be straight forward to extend it > to do that. After all stdin _is_ a FILE* Not even with /dev/stdin and /dev/stdout (under linux that is) ? Sick of deleting your inbox? Yahoo!7 Mail has free unlimited storage. http://au.docs.yahoo.com/mail/unlimitedstorage.html From christophe.romain@REDACTED Fri Sep 28 13:55:34 2007 From: christophe.romain@REDACTED (Christophe Romain) Date: Fri, 28 Sep 2007 13:55:34 +0200 Subject: [erlang-questions] Erlang release management In-Reply-To: References: Message-ID: <4B3109BF-2CE8-4768-A996-AC3188F1AF5C@process-one.net> > write a code deployment/upgrade system as an alternative to > systools/release_handler. it is really something that CEAN should be able to do i guess. cean:upgrade is working by now for packages, it will be no big deal for cean to handle release tarballs as well. From matthew@REDACTED Fri Sep 28 16:30:38 2007 From: matthew@REDACTED (Matthew Dempsky) Date: Fri, 28 Sep 2007 07:30:38 -0700 Subject: [erlang-questions] Erlang release management In-Reply-To: <4B3109BF-2CE8-4768-A996-AC3188F1AF5C@process-one.net> References: <4B3109BF-2CE8-4768-A996-AC3188F1AF5C@process-one.net> Message-ID: On 9/28/07, Christophe Romain wrote: > it is really something that CEAN should be able to do i guess. Looking through cean.erl, I don't see anything that handles live or distributed updates. I can imagine a higher layer that stops, upgrades, and restarts nodes one at a time across a network. Is there a better solution with CEAN? I'll add to my original question: Has anyone successfully deployed a real-world system (multiple applications; multiple nodes) using CEAN for release management? Thanks. From vinoski@REDACTED Fri Sep 28 17:53:34 2007 From: vinoski@REDACTED (Steve Vinoski) Date: Fri, 28 Sep 2007 11:53:34 -0400 Subject: [erlang-questions] mmap(2) to a binary? In-Reply-To: <20070928003922.GD8620@sphinx.chicagopeoplez.org> References: <20070928003922.GD8620@sphinx.chicagopeoplez.org> Message-ID: <65b2728e0709280853wf807e70qdae1a3d0f481ec49@mail.gmail.com> On 9/27/07, David Terrell wrote: > > In reference to the ongoing thread here and in the blogosphere, > I had an idea for doing some arbitrary file I/O in convenient > fashion. What if you could call mmap() on a file and get a binary > out of it that points directly to the mapped space? > > would someone more familiar with the internals of the beam machine > tell me if that's possible or not? I don't know if you'd have to > hold open some sort of port that kept it alive and kill it when > it died, or if it's completely impossible, but it seems like a > really efficient way to sidestep the drama of read(2) and friends. > I emailed this same suggestion to Tim Bray a few days ago. To gain the efficiency of mmap, in your driver C code you'd need to be able to allocate a binary whose buffer met mmap's alignment requirement, which is that the address being mapped to be page-aligned. Without page alignment, you'd be forced to mmap and copy, which would defeat the purpose of using mmap. Unfortunately, unless I'm missing something this alignment is pretty much impossible to guarantee without adding a special-purpose binary allocator to force such alignment. --steve -------------- next part -------------- An HTML attachment was scrubbed... URL: From fritchie@REDACTED Fri Sep 28 18:24:03 2007 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Fri, 28 Sep 2007 11:24:03 -0500 Subject: [erlang-questions] mmap(2) to a binary? In-Reply-To: Message of "Thu, 27 Sep 2007 19:39:22 CDT." <20070928003922.GD8620@sphinx.chicagopeoplez.org> Message-ID: <200709281624.l8SGO3w2029296@snookles.snookles.com> >>>>> "dt" == David Terrell writes: dt> In reference to the ongoing thread here and in the blogosphere, I dt> had an idea for doing some arbitrary file I/O in convenient dt> fashion. What if you could call mmap() on a file and get a binary dt> out of it that points directly to the mapped space? It's quite easy to do, in a naive manner. If you have a read-only mapped region, *and* if nobody else updates the file while you've got the region mapped, then a linked-in driver can do everything you need. If either of those assumptions are incorrect, then a very naive driver will violate VM internals' assumptions in a pretty spectacular way. In the general case, I think you'd need to have two basic ops: * map a region * given a region, starting offset, and length, copy length bytes into a new binary (so that its contents can't change) In the general case, there are other things you'd also need or want, of course: unmap a region, tie mapped regions to the process so that the regions are unmapped if the owner process dies, ... -Scott From codewalkerjoe@REDACTED Fri Sep 28 17:45:57 2007 From: codewalkerjoe@REDACTED (nintendo) Date: Fri, 28 Sep 2007 08:45:57 -0700 Subject: [erlang-questions] newb: Inside Erlang shell, go to directory and compile a module how to? Message-ID: <1190994357.397632.326290@22g2000hsm.googlegroups.com> I have one questions: 1) How do I change directory inside the Erlang shell, so that I can go get a file and then compile this module into beam? My module located in: C:\Program Files\myproject\elang\mymodule.erl Side note: I did a complete install of erlang for windows and it doesn't set the path for erlang. I checked the documentation and searched on goolge, there is no mention of setting the path. I just added it to my windows path=C: \Program Files\erl5.5.5\bin. My 2cents: I think you should add it to FAQ at http://www.erlang.org/faq/faq.html#AEN430 on hello world. From erlangx@REDACTED Fri Sep 28 18:47:11 2007 From: erlangx@REDACTED (Michael McDaniel) Date: Fri, 28 Sep 2007 09:47:11 -0700 Subject: [erlang-questions] newb: Inside Erlang shell, go to directory and compile a module how to? In-Reply-To: <1190994357.397632.326290@22g2000hsm.googlegroups.com> References: <1190994357.397632.326290@22g2000hsm.googlegroups.com> Message-ID: <20070928164711.GU10320@delora.autosys.us> On Fri, Sep 28, 2007 at 08:45:57AM -0700, nintendo wrote: > I have one questions: > 1) How do I change directory inside the Erlang shell, so that I can go > get a file and then compile this module into beam? > > My module located in: > C:\Program Files\myproject\elang\mymodule.erl ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1> c("C:\\Program\ Files\\myproject\\elang\\mymodule.erl"). {ok,mymodule} 2> or, if you are already in myproject directory ... 3> c("elang\\mymodule"). {ok,mymodule} ~Michael > > Side note: > > I did a complete install of erlang for windows and it doesn't set the > path for erlang. > I checked the documentation and searched on goolge, there is no > mention of setting the path. I just added it to my windows path=C: > \Program Files\erl5.5.5\bin. > > My 2cents: > I think you should add it to FAQ at http://www.erlang.org/faq/faq.html#AEN430 > on hello world. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > !DSPAM:52,46fd2cff73321471919437! > > -- Michael McDaniel Portland, Oregon, USA http://autosys.us +1 503 283 5284 From gbulmer@REDACTED Fri Sep 28 19:17:46 2007 From: gbulmer@REDACTED (G Bulmer) Date: Fri, 28 Sep 2007 18:17:46 +0100 Subject: [erlang-questions] Erlang Workshop, Freiburg, Germany, October 5, 2007 Message-ID: Is anyone planning to attend next weeks Erlang Workshop in Freiburg? I'm travelling to Freiburg on Wednesday to attend CUFP and then the Erlang workshop on Friday. I'd like to meet up for a drink, dinner, or both. As the Erlang workshop is on Friday, I assume most people will be rushing back home (I'm staying Friday night, as travel times make no sense). So, would anyone like to meet on Thursday evening? G Bulmer From klacke@REDACTED Fri Sep 28 21:29:08 2007 From: klacke@REDACTED (Claes Wikstrom) Date: Fri, 28 Sep 2007 21:29:08 +0200 Subject: [erlang-questions] slow file I/O (was Not an Erlang fan) In-Reply-To: <348225.16519.qm@web52011.mail.re2.yahoo.com> References: <348225.16519.qm@web52011.mail.re2.yahoo.com> Message-ID: <46FD5604.1020100@hyber.org> Richard Andrews wrote: >>> bfile sounds great. can it do stdin/stdout? >> No - but it would be straight forward to extend it >> to do that. After all stdin _is_ a FILE* > > Not even with /dev/stdin and /dev/stdout (under linux that is) ? > Yaeh - that would work (not tried) but not portable, /klacke From dougedmunds@REDACTED Sat Sep 29 00:32:56 2007 From: dougedmunds@REDACTED (DougEdmunds) Date: Fri, 28 Sep 2007 15:32:56 -0700 Subject: [erlang-questions] newb: Inside Erlang shell, go to directory and compile a module how to? In-Reply-To: <1190994357.397632.326290@22g2000hsm.googlegroups.com> References: <1190994357.397632.326290@22g2000hsm.googlegroups.com> Message-ID: <46FD8118.3030807@gmail.com> go to directory: cd/1 Use single or double quotes around the new directory. Windows: you can use forward slashes, like *nix. 1> cd("c:/program files/directory_of_files"). or Use double backward slashes. 1> cd("c:\\program files\\directory_of_files"). cd/1 returns a string indicating the current directory. If the directory doesn't exist, it is not an error. related functions pwd/0 (working directory). ls/0 (contents of working directory) -dae nintendo wrote: > 1) How do I change directory inside the Erlang shell, so that I can go > get a file and then compile this module into beam? > From gbulmer@REDACTED Sat Sep 29 01:34:56 2007 From: gbulmer@REDACTED (G Bulmer) Date: Sat, 29 Sep 2007 00:34:56 +0100 Subject: [erlang-questions] Erlang timer accuracy & precision Message-ID: <1D43EA36-3230-46EC-B355-634762BBC620@gmail.com> I am writing some benchmarks, and I'd like to know what is the accuracy and precision/sensitivity of the Erlang time mechanisms? AFAIK I can use timer:tc(), statistics(wall_clock) and now() to get wall-clock/real time. I'm trying to understand if it makes any significant difference which I use. My questions are: 1. Are they all similar accuracy, or is one more accurate than the others? 2. Is the aparent precision/sensitivity of (at least) a millisecond really available from those time sources, or is there some mechanism they use which is actually less precise/sensitive? 3. Are they all approximately the same cost, or is one typically cheaper than another? I'm using Mac OS X 10.4 on MacBook Pro (core 2 duo) and Linux 2.6.9- smp (Centos 4.1) on Athlon 64 X2. Supplementary question: does the answers to 1-3 change significantly with newer versions of the Linux Kernel? I'm able to move to a 'good' kernel, but preferably something on long term support. As ever, pointers, advice and suggestions are always welcome. G Bulmer PS - See you next week in Freiburg. From cyberlync@REDACTED Sat Sep 29 02:10:18 2007 From: cyberlync@REDACTED (Eric Merritt) Date: Fri, 28 Sep 2007 17:10:18 -0700 Subject: [erlang-questions] Erlang release management In-Reply-To: References: <4B3109BF-2CE8-4768-A996-AC3188F1AF5C@process-one.net> Message-ID: Sinan understands OTP pretty fully and will handle all of the release stuff for you, up to and including building the tarball. The difficulty of release management is what got me started on sinan in the first place. On 9/28/07, Matthew Dempsky wrote: > On 9/28/07, Christophe Romain wrote: > > it is really something that CEAN should be able to do i guess. > > Looking through cean.erl, I don't see anything that handles live or > distributed updates. I can imagine a higher layer that stops, > upgrades, and restarts nodes one at a time across a network. Is there > a better solution with CEAN? > > I'll add to my original question: Has anyone successfully deployed a > real-world system (multiple applications; multiple nodes) using CEAN > for release management? > > Thanks. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From rc.china@REDACTED Sat Sep 29 03:32:32 2007 From: rc.china@REDACTED (raocheng) Date: Sat, 29 Sep 2007 09:32:32 +0800 Subject: [erlang-questions] Help: compiler error Message-ID: When I compile a erl file, it failed: Please see the following steps: $uname -a SunOS tesst01 5.9 Generic_327231-29 sun4u sparc SUNW,Sun-Fire-V440 Solaris $ pwd /home/test $ more hello.erl -module(hello). -export([start/0]). start() -> io:format("Hello world~n"). $ ls -lrtF hello.erl -rwxrwxrwx 1 crao msc 80 Sep 29 09:09 hello.erl* $ erl Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [hipe] [kernel-poll:false] $ erlc hello.erl Compiler function compile:compile/3 failed: {undef,[{compile,compile, ["/home/test/hello", "/home/test/hello", {options,[], "/home/test", undefined, [], 1, false, 999, [], [], "/home/test"}]}, {erl_compile,compile_file,4}, {erl_compile,compile3,3}, {erl_compile,compiler_runner,1}]} $ Thanks for any help. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jcone@REDACTED Sat Sep 29 09:37:05 2007 From: jcone@REDACTED (James Cone) Date: Sat, 29 Sep 2007 19:37:05 +1200 Subject: [erlang-questions] Forced erl_crash.dump References: CE32AABA6936B0459B3EBE99331FC75D488EE0@server.Cellfind.local Message-ID: <46FE00A1.3020807@eservglobal.com> If you're in the same interpreter with it, you could try i(). From jcone@REDACTED Sat Sep 29 10:01:36 2007 From: jcone@REDACTED (James Cone) Date: Sat, 29 Sep 2007 20:01:36 +1200 Subject: [erlang-questions] How to implement multiple sockets per client? References: 20060826033140.35255.qmail@web31604.mail.mud.yahoo.com Message-ID: <46FE0660.4020504@eservglobal.com> If the end-to-end assumption held, then the client could listen and give the server details about where to connect the other socket to, thereby guaranteeing that the sockets were matched. Alternatively, for each incoming connection on the main listen socket, the server could listen on another port and send details to the client. I'm still not convinced, like Bob, that I know what the two sockets are for, that can't be done better with one socket. From twa@REDACTED Sat Sep 29 09:50:21 2007 From: twa@REDACTED (Tom Ayerst) Date: Sat, 29 Sep 2007 08:50:21 +0100 Subject: [erlang-questions] yaws user running beam process on Ubuntu Message-ID: <46FE03BD.7080708@post.com> I was looking around my Ubuntu Feisty install today and found this at the top of my "top". PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1681 yaws 18 0 16120 5116 1668 S 7.3 0.5 0:00.22 beam With "yaws" and "beam" in the line my thoughts turned to Erlang. Does anyone know what it is? I have only installed basic Erlang and Distel for emacs to my knowledge. Thanks Tom From Bruce@REDACTED Sat Sep 29 12:01:36 2007 From: Bruce@REDACTED (Bruce Fitzsimons) Date: Sat, 29 Sep 2007 22:01:36 +1200 Subject: [erlang-questions] Decoding of ASN.1 BER files Message-ID: <46FE2280.7090603@Fitzsimons.org> Hullo list, A hint and a request. The hint: If you need to process files of ASN.1 structures concatenated together then the standard routines generated by the asn1ct module will almost work perfectly (proven for BER at least), you only need to alter the :decode/2 to return the remaining bytes and length from whatever reasonable size chunk of binary data you pass in (they default to suppressing it). Concatenate, rinse, repeat. A simple fix, but like most simple fixes they take more investigation than the ugly hack that went before them... The request: It would be nice if the asn1ct generated :decode functions returned this information by default, or via an alternative entry point. I can understand the encode routines accepting exactly the required amount of data, but for decodes having the correct information only occurs in some circumstances such as TCAP packet decoding (and even there it is of interest to know if there are leftovers). If there is interest and /// motivation I can produce a patch to provide this behaviour, or otherwise if someone can tell me the rationale for not providing it and how else I should parse files I'd be interested. For those still reading I am constructing a webpage for 3GPP CDR decoding (MSC, SGSN, IMS, LBS etc). Someone at work described how their hand-coded BER decoder crashed when extra fields were added (!) the other day and that offended me to the point of getting the 3GPP ASN.1 source for CDRs compiling under Erlang (non-trivial dependencies). I'll post the url when the rest is working. Regards, Bruce From rc.china@REDACTED Sat Sep 29 13:27:30 2007 From: rc.china@REDACTED (raocheng) Date: Sat, 29 Sep 2007 19:27:30 +0800 Subject: [erlang-questions] Example in <> Message-ID: There is an example in <> (Chapter 6.3): factorial.erl #!/usr/bin/env escript main([A]) -> I = list_to_integer(A), F = fac(I), io:format("factorial ~w = ~w~n" ,[I, F]). fac(0) -> 1; fac(N) -> N * fac(N-1). However, when I execute this example, it outputs: $ ./factorial 25 escript: script failed with error reason {function_clause, [{local, main, [["25","-s","cean","version"]]}]} What's wrong with me ? Thank you very much. -------------- next part -------------- An HTML attachment was scrubbed... URL: From alceste@REDACTED Sat Sep 29 13:01:32 2007 From: alceste@REDACTED (Alceste Scalas) Date: Sat, 29 Sep 2007 13:01:32 +0200 Subject: [erlang-questions] Erlang FFI: new draft EEP, patches, and summary Message-ID: <20070929130132.i4ybto09ssg48koc@webmail.crs4.it> Hello, based on the feedback received on this mailing list, I've updated the Erlang FFI draft EEP and patches. Everything is available at the usual place: http://muvara.org/crs4/erlang/ffi Here's a summary of the changes discussed so far (with references to the previous emails): 1. buffer-to-binary and cstring-to-binary conversions [1] 2. passing/returning Erlang binary()'es as ErlDrvBinary'es [2] 3. FFI and preload information on erl_ddll:info/2 [1] 4. high-level API with type-tagged values [1] 5. 'nonnull' FFI type, for representing (and checking) non-NULL pointers [3] 6. ffi:sizeof(Type) and hard-coded type size macros [1] 7. erl_ddll:load_library/2 and erlang:open_port/1 [1] Here's a list of enhancements that were *not* discussed before (for the details, see the updated draft EEP): 8. passing iolist()s to the C side as ErlIOVec's 9. ffi:min/1, ffi:max/1 and ffi:check/1 (for range and consistence checking on type-tagged values) 10. utility macros for easier binary matching of FFI types. 11. some new FFI types (pid_t, off_t). At the moment, there are two known issues (in the patches and/or the draft EEP): 1. the patches have not been tested on big-endian platforms, yet. I expect them to have signedness problems, so beta testers (and bug fixers ;-) are welcome! 2. floating point types are not (yet) properly supported by ffi:min/1, ffi:max/1 and ffi:check/1. In general, the floating point checking API needs to be enhanced (for example, there should be a way to obtain FLT_EPSILON for the current platform). And finally, here's the only proposal that has not been integrated (yet) in the draft EEP: * David Hopwood proposed a very elegant closure-based FFI [3]. However, I didn't get how it could be actually used, and asked for clarifications [4]. I think that's all. As usual, leave your feedback and/or try the patches. Thanks! Regards, alceste Notes and references: [1] Erlang FFI : 1st discussion summary http://erlang.org/pipermail/erlang-questions/2007-September/029195.html [2] FFI: handling refcounted binaries http://erlang.org/pipermail/erlang-questions/2007-September/029228.html [3] David Howood's original proposal for the closure-based FFI http://erlang.org/pipermail/erlang-questions/2007-September/029199.html [4] Discussion about the closure-based FFI http://erlang.org/pipermail/erlang-questions/2007-September/029221.html -- Alceste Scalas ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program. From klacke@REDACTED Sat Sep 29 15:05:47 2007 From: klacke@REDACTED (Claes Wikstrom) Date: Sat, 29 Sep 2007 15:05:47 +0200 Subject: [erlang-questions] Help: compiler error In-Reply-To: References: Message-ID: <46FE4DAB.7030509@hyber.org> raocheng wrote: > When I compile a erl file, it failed: Please see the following steps: > .... > > $ erlc hello.erl > Compiler function compile:compile/3 failed: > {undef,[{compile,compile, > ["/home/test/hello", Your erlang installation is completely broken, at least the one which is behind your erlc in the $PATH /klacke From juanjo@REDACTED Sat Sep 29 15:15:17 2007 From: juanjo@REDACTED (Juan Jose Comellas) Date: Sat, 29 Sep 2007 10:15:17 -0300 Subject: [erlang-questions] yaws user running beam process on Ubuntu In-Reply-To: <46FE03BD.7080708@post.com> References: <46FE03BD.7080708@post.com> Message-ID: <1c3be50f0709290615r3ad6dad0w645f654aad0a5ebc@mail.gmail.com> That's yaws, a web server written in Erlang. You can find more information about it at http://yaws.hyber.org/. If you want to remove it just do: sudo apt-get remove yaws On 9/29/07, Tom Ayerst wrote: > > I was looking around my Ubuntu Feisty install today and found this at > the top of my "top". > > PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND > 1681 yaws 18 0 16120 5116 1668 S 7.3 0.5 0:00.22 beam > > With "yaws" and "beam" in the line my thoughts turned to Erlang. Does > anyone know what it is? I have only installed basic Erlang and Distel > for emacs to my knowledge. > > Thanks > > Tom > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From anders.nygren@REDACTED Sat Sep 29 16:32:26 2007 From: anders.nygren@REDACTED (Anders Nygren) Date: Sat, 29 Sep 2007 09:32:26 -0500 Subject: [erlang-questions] Example in <> In-Reply-To: References: Message-ID: On 9/29/07, raocheng wrote: > There is an example in <> (Chapter 6.3): > > factorial.erl > > #!/usr/bin/env escript > main([A]) -> > I = list_to_integer(A), > F = fac(I), > io:format("factorial ~w = ~w~n" ,[I, F]). > fac(0) -> 1; > fac(N) -> > N * fac(N-1). > > > However, when I execute this example, it outputs: > $ ./factorial 25 > escript: script failed with error reason {function_clause, > [{local, > main, > > [["25","-s","cean","version"]]}]} > > What's wrong with me ? Thank you very much. Hi It seems like Your CEAN based version of escript add some extra parameters. I think that if You change to this it will work. main([A|_]) -> /Anders From twa@REDACTED Sat Sep 29 19:54:50 2007 From: twa@REDACTED (Tom Ayerst) Date: Sat, 29 Sep 2007 18:54:50 +0100 Subject: [erlang-questions] yaws user running beam process on Ubuntu In-Reply-To: <1c3be50f0709290615r3ad6dad0w645f654aad0a5ebc@mail.gmail.com> References: <46FE03BD.7080708@post.com> <1c3be50f0709290615r3ad6dad0w645f654aad0a5ebc@mail.gmail.com> Message-ID: <46FE916A.3010703@post.com> Thank you, I guess I must have installed it when I grabbed all the Erlang stuff in Synaptic. Juan Jose Comellas wrote: > That's yaws, a web server written in Erlang. You can find more information > about it at http://yaws.hyber.org/. If you want to remove it just do: > > sudo apt-get remove yaws > > > On 9/29/07, Tom Ayerst wrote: > >> I was looking around my Ubuntu Feisty install today and found this at >> the top of my "top". >> >> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND >> 1681 yaws 18 0 16120 5116 1668 S 7.3 0.5 0:00.22 beam >> >> With "yaws" and "beam" in the line my thoughts turned to Erlang. Does >> anyone know what it is? I have only installed basic Erlang and Distel >> for emacs to my knowledge. >> >> Thanks >> >> Tom >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> > > From bhatti_shahzad@REDACTED Sun Sep 30 05:12:48 2007 From: bhatti_shahzad@REDACTED (shahzad bhatti) Date: Sat, 29 Sep 2007 20:12:48 -0700 (PDT) Subject: [erlang-questions] Storing tuples directly in Mnesia without records In-Reply-To: Message-ID: <825248.29607.qm@web81113.mail.mud.yahoo.com> I am trying to build a Linda like tuple space in Erlang and though my simple application is using ets for now, but I would like to use Mnesia to store tuples directly to take leverage of its replication and transactions capabilities. Since, Mnesia supports multiple tables that map to records, is it possible to use tuples directly. Also, if anyone can suggest anything that will make it easier to implement tuplespace with blocking get/read operations. Thanks in advance. --------------------------------- Pinpoint customers who are looking for what you sell. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Sun Sep 30 09:12:39 2007 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 30 Sep 2007 09:12:39 +0200 Subject: [erlang-questions] Storing tuples directly in Mnesia without records In-Reply-To: <825248.29607.qm@web81113.mail.mud.yahoo.com> References: <825248.29607.qm@web81113.mail.mud.yahoo.com> Message-ID: <8209f740709300012y230c1fc6s5c672d1bf473a1a2@mail.gmail.com> Yes, you can use tuples directly. Unlike ets, mnesia requires the key to be the second element in the tuple, and the first element needs to be a label (record_name). Mnesia will check that the inserted data is a tuple of the right arity, and that the first element of the tuple is equal to the 'record_name' of the table (this defaults to the table name, but can be changed with the {record_name, N} option. Remember, records are only syntactic sugar for tagged tuples. BR, Ulf W 2007/9/30, shahzad bhatti : > I am trying to build a Linda like tuple space in Erlang and though my simple > application is using ets for now, but I would like to use Mnesia to store > tuples directly to take leverage of its replication and transactions > capabilities. Since, Mnesia supports multiple tables that map to records, is > it possible to use tuples directly. Also, if anyone can suggest anything > that will make it easier to implement tuplespace with blocking get/read > operations. Thanks in advance. > > > > ________________________________ > Pinpoint customers who are looking for what you sell. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From anders.nygren@REDACTED Sun Sep 30 15:26:38 2007 From: anders.nygren@REDACTED (Anders Nygren) Date: Sun, 30 Sep 2007 08:26:38 -0500 Subject: [erlang-questions] Decoding of ASN.1 BER files In-Reply-To: <46FE2280.7090603@Fitzsimons.org> References: <46FE2280.7090603@Fitzsimons.org> Message-ID: On 9/29/07, Bruce Fitzsimons wrote: > Hullo list, > > A hint and a request. > > The hint: If you need to process files of ASN.1 structures concatenated > together then the standard routines generated by the asn1ct module will > almost work perfectly (proven for BER at least), you only need to alter > the :decode/2 to return the remaining bytes and length from > whatever reasonable size chunk of binary data you pass in (they default > to suppressing it). Concatenate, rinse, repeat. A simple fix, but like > most simple fixes they take more investigation than the ugly hack that > went before them... > > The request: It would be nice if the asn1ct generated :decode > functions returned this information by default, or via an alternative > entry point. I can understand the encode routines accepting exactly the > required amount of data, but for decodes having the correct information > only occurs in some circumstances such as TCAP packet decoding (and even > there it is of interest to know if there are leftovers). > > If there is interest and /// motivation I can produce a patch to provide > this behaviour, or otherwise if someone can tell me the rationale for > not providing it and how else I should parse files I'd be interested. > > For those still reading I am constructing a webpage for 3GPP CDR > decoding (MSC, SGSN, IMS, LBS etc). Someone at work described how their > hand-coded BER decoder crashed when extra fields were added (!) the > other day and that offended me to the point of getting the 3GPP ASN.1 > source for CDRs compiling under Erlang (non-trivial dependencies). I'll > post the url when the rest is working. > Hi It seems like the asn1 compiler option does most of what You want. >From the docs "undec_rest A buffer that holds a message, beeing decoded may also have some following bytes. Now it is possible to get those following bytes returned together with the decoded value. If an asn1 spec is compiled with this option a tuple {ok,Value,Rest} is returned. Rest may be a list or a binary. Earlier versions of the compiler ignored those following bytes. " /Anders From erlang@REDACTED Sun Sep 30 17:27:03 2007 From: erlang@REDACTED (Joe Armstrong) Date: Sun, 30 Sep 2007 17:27:03 +0200 Subject: [erlang-questions] Erlang Workshop, Freiburg, Germany, October 5, 2007 In-Reply-To: References: Message-ID: <9b08084c0709300827g47cb7432s46c9f68d020c0a5a@mail.gmail.com> Sure, quite a few of the Erang people will be attending CUFP on the 4'th - I think it's the same place as for the Erlang workshop. If you wander into the tail end of the CUFP meeting you'll be able to meet up with some Erlang folks. /Joe Armstrong On 9/28/07, G Bulmer wrote: > Is anyone planning to attend next weeks Erlang Workshop in Freiburg? > > I'm travelling to Freiburg on Wednesday to attend CUFP and then the > Erlang workshop on Friday. > I'd like to meet up for a drink, dinner, or both. As the Erlang > workshop is on Friday, I assume most people will be rushing back home > (I'm staying Friday night, as travel times make no sense). > So, would anyone like to meet on Thursday evening? > > G Bulmer > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From petry@REDACTED Fri Sep 28 19:10:39 2007 From: petry@REDACTED (Alexander Petry) Date: Fri, 28 Sep 2007 19:10:39 +0200 Subject: [erlang-questions] newb: Inside Erlang shell, go to directory and compile a module how to? In-Reply-To: <1190994357.397632.326290@22g2000hsm.googlegroups.com> References: <1190994357.397632.326290@22g2000hsm.googlegroups.com> Message-ID: <20070928171039.GA15233@localhost.localdomain> * nintendo [070928 18:46]: > I have one questions: > 1) How do I change directory inside the Erlang shell, so that I can go > get a file and then compile this module into beam? > > My module located in: > C:\Program Files\myproject\elang\mymodule.erl When you are in the shell type 'help().' which produces a somewhat long list of functions that can be called directly within the shell. The function that changes the current working directory (I think you are looking for something like that) would be: cd(Dir). You may then simply type 'c(mymodule).' or 'l(mymodule).' to compile and load or just load if it has already been compiled. Alex From bhatti_shahzad@REDACTED Sun Sep 30 19:34:44 2007 From: bhatti_shahzad@REDACTED (shahzad bhatti) Date: Sun, 30 Sep 2007 10:34:44 -0700 (PDT) Subject: [erlang-questions] Storing tuples directly in Mnesia without records In-Reply-To: <8209f740709300012y230c1fc6s5c672d1bf473a1a2@mail.gmail.com> Message-ID: <708470.76594.qm@web81102.mail.mud.yahoo.com> Though, I would like to use tuples of any arity, so that clients can store any tuples without defining schema. But it sounds like I will have to add that constraint for arity and record name. Also, is it possible for insert to automatically add table/schema if it does not exist. And is there any event that I can listen to know when tuples are added to simulate blocking read/remove (preferably using pattern based filtering). Thanks again. Ulf Wiger wrote: Yes, you can use tuples directly. Unlike ets, mnesia requires the key to be the second element in the tuple, and the first element needs to be a label (record_name). Mnesia will check that the inserted data is a tuple of the right arity, and that the first element of the tuple is equal to the 'record_name' of the table (this defaults to the table name, but can be changed with the {record_name, N} option. Remember, records are only syntactic sugar for tagged tuples. BR, Ulf W 2007/9/30, shahzad bhatti : > I am trying to build a Linda like tuple space in Erlang and though my simple > application is using ets for now, but I would like to use Mnesia to store > tuples directly to take leverage of its replication and transactions > capabilities. Since, Mnesia supports multiple tables that map to records, is > it possible to use tuples directly. Also, if anyone can suggest anything > that will make it easier to implement tuplespace with blocking get/read > operations. Thanks in advance. > > > > ________________________________ > Pinpoint customers who are looking for what you sell. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > --------------------------------- Luggage? GPS? Comic books? Check out fitting gifts for grads at Yahoo! Search. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dcaoyuan@REDACTED Sun Sep 30 22:52:24 2007 From: dcaoyuan@REDACTED (Caoyuan) Date: Mon, 1 Oct 2007 04:52:24 +0800 Subject: [erlang-questions] ErlyBird 0.15.1 released - An Erlang IDE based on NetBeans Message-ID: I'm pleased to announce ErlyBird 0.15.1, an Erlang IDE based on NetBeans. This is a performance improvement release. This release will only provide all-in-one IDE package, which is in size of 18.3M. CHANGELOG: * Performance improvement. * Integrated with NetBeans' Common Scripting Framework. Thanks Tor. * Fix a bug related to occurrences mark on built-in functions. * Fix bug of wrong formatting multiple-lines string. * Supports "-module(x.y.z)" syntax. * Various bugs fixes. Java JRE 5.0+ is required. To download, please go to: http://sourceforge.net/project/showfiles.php?group_id=192439 To install: 1. Unzip erlybird-bin-0.15.1-ide.zip to somewhere. 2. Make sure 'erl.exe' or 'erl' is under your environment path 3. For Windows user, execute 'bin/erlybird.exe'. For *nix user, 'bin/erlybird'. 4. Check/set your OTP path. From [Tools]->[Options], click on 'Erlang', then 'Erlang Installation' tab, fill in the full path of your 'erl.exe' or 'erl' file. For instance: "C:/erl/bin/erl.exe" 5. The default -Xmx option for jvm is set to 256M, ErlyBird now works good with less memory, such as -Xmx128M. If you want to increase/decrease it, please open the config file that is located at etc/erlybird.conf, set -J-Xmx of 'default_options'. When run ErlyBird first time, the OTP libs will be indexed. The indexing time varies from 10 to 30 minutes deponding on your computer. Notice: If you have previous version of ErlyBird 0.12.0+ installed, you can keep your old cache files, otherwise, please delete the old cache files which are located at: * *nix: "${HOME}/.erlybird/dev" * mac os x: "${HOME}/Library/Application Support/erlybird/dev" * windows: "C:\Documents and Settings\yourusername\.erlybird\dev" or some where The status of ErlyBird is still Alpha, feedbacks and bug reports are welcome. -- - Caoyuan