From puneet.lakhina@REDACTED Sun Feb 1 04:20:15 2009 From: puneet.lakhina@REDACTED (Puneet Lakhina) Date: Sat, 31 Jan 2009 19:20:15 -0800 Subject: [erlang-questions] BEAM Runtime Details Message-ID: Hi, I am exploring Erlang and its Runtime as a part of a course project. I am specifically interested in understanding how are processes implemented (both at the BEAM code and then at native code level) and scheduled by the runtime. Hence could you please give me some pointers that will help me understand the BEAM instruction set more closely and understanding erlang processes in general. I have gone through http://erlangdotnet.net which provides some useful information. Thanks a lot -- Regards, Puneet -------------- next part -------------- An HTML attachment was scrubbed... URL: From bgustavsson@REDACTED Sun Feb 1 09:49:11 2009 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Sun, 1 Feb 2009 09:49:11 +0100 Subject: [erlang-questions] erlang:md5/1 vs crypto:md5/1 difference: speed In-Reply-To: <11466.1233376981@snookles.snookles.com> References: <11466.1233376981@snookles.snookles.com> Message-ID: <6672d0160902010049j5a7cabc0kc34805fb720eb61d@mail.gmail.com> On Sat, Jan 31, 2009 at 5:43 AM, Scott Lystig Fritchie wrote: > Hi, all. Two years ago, Roberta Saccon asked a question of the > difference between erlang:md5/1 vs crypto:md5/1. > > One answer was, "none." Another answer was, "You need to start the > crypto application before calling crypto:md5/1." > > I've discovered a third answer: speed. On a newer Intel Xeon single > CPU, dual-core box @ 2.33GHz, and on an AMD X2 single CPU, dual-core > box, crypto:md5/1 is 3.0-3.5 times faster on a 64KByte blob than > erlang:md5. On an older 3.4GHz single core Xeon, the difference is over > almost 7x, and on a several-year-old Pentium M laptop @ 1.33GHz, the > difference is 8x.(*) > The MD5 BIFs are specially written not to block the virtual machine/the scheduler it is running in. It will process data up to a certain limit, and then do what we call a trap. It basically means that the Erlang process executing the BIF will be scheduled out allowing other processes to run and then scheduled in to continue working with the BIF. Another reason the BIFs are slower is that the OpenSSL version of the MD5 calculation is probably a lot more optimized (it might even be in assembly language) than the BIF version. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bgustavsson@REDACTED Sun Feb 1 10:02:27 2009 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Sun, 1 Feb 2009 10:02:27 +0100 Subject: [erlang-questions] Help me reduce the complexity of this function please... (Possible Erlang Bug?) In-Reply-To: <20ED213A-E1E1-4053-9E47-D6B9E49AE78F@patternmatched.com> References: <20ED213A-E1E1-4053-9E47-D6B9E49AE78F@patternmatched.com> Message-ID: <6672d0160902010102x420fef98if597b813713cfa96@mail.gmail.com> On Sat, Jan 31, 2009 at 12:38 PM, Rudolph van Graan wrote: > I get this error from erlang: > >> csn_rmcs_file_SUITE: function test_cancelling_file_process/1+2246: >> An implementation limit was reached. >> Try reducing the complexity of this function. >> >> Instruction: {test,bs_get_integer2, >> {f,41}, >> [{x,952}, >> 1024, >> {integer,8}, >> 1, >> {field_flags,[unsigned,big]}, >> {x,1024}]} >> >> make: *** [csn_rmcs_file_SUITE.beam] Error 1 > > when I compile the file containing this function: > [code omitted] It is usually better to send big code examples as an attachment, as mail software can do funny things to it. In this case, it seem that at least one line has been truncated. After repairing the code as best I could (and adding stubs for the missing functions), it compiled without problems in R12B-5. Which version of Erlang/OTP do you use? /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From francesco@REDACTED Sun Feb 1 10:46:01 2009 From: francesco@REDACTED (Francesco Cesarini (Erlang Training and Consulting)) Date: Sun, 01 Feb 2009 09:46:01 +0000 Subject: [erlang-questions] Looking for summer interns passionate about Erlang Message-ID: <49856F59.8000408@erlang-consulting.com> Hi All, We are now receiving applications for our 2009 summer internships. We are looking for up to 10 undergraduate students who are passionate about Erlang, have a drive and curiosity for new technologies and don't turn pale when digging their heads into an RFC or asked to work on a customer facing role. The positions will be based out of London and Krakow and possibly San Francisco and Uppsala. More information can be found at http://www.erlang-consulting.com/jobs.html#13 If you have questions or want to come in contact with former summer interns of ours, drop me a line. This is an excellent opportunity to work in an exciting and fast growing Erlang company, gain industrial experience, learn new technologies, get advanced training and pave your way to a paid industrial thesis project. Prior Erlang experience is a must, either from a University course of a hobby project of your own. Regards, Francesco -- http://www.erlang-consulting.com From agnel.joel@REDACTED Sun Feb 1 13:24:56 2009 From: agnel.joel@REDACTED (Joel Fernandes) Date: Sun, 1 Feb 2009 17:54:56 +0530 Subject: [erlang-questions] Programming Erlang code example bug? Message-ID: <9ff7a3bc0902010424y47e77080n4c73a025b5ce2065@mail.gmail.com> This is just to discuss about a possible bug in a code example of the programming erlang book. On pg 198, the wait_login_response function is called on connection to the server, if you notice, the receive loop doesn't consider the possibility of the user closing the client widget while the client process waits for a response from the server. If this happens, the client receives a widget-destroyed message from the widget but doesn't understand it because the receive loop doeesn't have such a pattern, and so it matches it to the pattern "Other" and then loops infintely till the login request to the server succeeds. On login success, the active function gets called and the client tries to send received-messages to the widget process that just died, this results in the client crashing.. A neater way of handling this would be to handle widget-destroyed message in wait_login_response and gracefully terminate the client process during such an event Best wishes, Joel -------------- next part -------------- An HTML attachment was scrubbed... URL: From per@REDACTED Sun Feb 1 21:27:42 2009 From: per@REDACTED (Per Hedeland) Date: Sun, 1 Feb 2009 21:27:42 +0100 (CET) Subject: [erlang-questions] HTTP requests and the meaning of eaddrinuse In-Reply-To: <498440A3.7070001@softjar.se> Message-ID: <200902012027.n11KRgCY028793@pluto.hedeland.org> Johnny Billquist wrote: > >Per Hedeland wrote: >> >> Yes, that's what you get (on connect()) on all Unices where I have seen >> it, and it does make some amount of sense I think - if there are no >> local ports left, any attempt to form a connection would have to use a >> port that is already "in use". > >Well, I think that it's a flaw in the design of the interface. If you >use port 0 (ask the system to give you a port) you should never get >eaddrinuse. That is sort of guaranteed by the call (the semantic is to >give you a free port). Well, we're talking about connect() here - you're not asking for a free port, you're asking for a connection - just that the stack has to give you a port to establish the connection (unless you have bound the socket, which is "unusual" on connect()). > I wonder if all systems do this, or if different systems have >different "solutions". If noone can tell for other systems than Linux I >guess I'll have to go in and examine the source myself soon. :-) Looking at the FreeBSD kernel code, it seems it will actually return EADDRNOTAVAIL or possibly EAGAIN if it fails to find a "free" port - but will return EADDRINUSE if the chosen port ends up conflicting with a connection in TIME_WAIT. The latter is probably the most common failure case. >You have the sockopt SO_REUSEADDR which circumvents this check. Is it >possible to set that from Erlang? Certainly (read the man page), but I'm not sure how or if it applies to connect() (and can't be bothered to figure out that part of the kernel code:-). It obviously wouldn't make sense to not try to find a "free" port at all if it is set (but it may affect the exact meaning of "free"), and it certainly won't allow a connection that conflicts with an existing one. >> Forgot one that I actually used recently on FreeBSD - it randomizes the >> selection of local port to make spoofing harder, and every now and then >> a test case that did a bunch of localhost connections would get the >> EADDRINUSE. Turning off the randomization (sysctl >> net.inet.ip.portrange.randomized 1 -> 0) made it cycle nicely through >> the available range => problem solved. A quick check on a Linux 2.6.20 >> system doesn't show any such randomization nor reveal a way to turn it >> on or off, but it may well be there somewhere... > >Whoa? It don't actually check that the random port is actually free >before giving it to you??? The check is the same whether randomizing or not, but the probability of hitting one of your own old connections in TIME_WAIT is higher when randomizing is used. But anyway, I think we're getting rather off-topic here, and the original answer of "you're running out of ports" to the original question is probably as good as it gets - I'll shut up now. --Per From kenneth.lundin@REDACTED Mon Feb 2 09:53:15 2009 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Mon, 2 Feb 2009 09:53:15 +0100 Subject: [erlang-questions] -version or -vsn? In-Reply-To: <0e922b47-ccf3-42dc-9f37-5f2d52ac2988@v5g2000pre.googlegroups.com> References: <0e922b47-ccf3-42dc-9f37-5f2d52ac2988@v5g2000pre.googlegroups.com> Message-ID: The -vsn attribute is special because it is used by the release handler and upgrade functions in the sasl application. The -vsn attribute can be handled manually in the source code and should then be set to different values for different versions of the module. There is no order of the values. If no -vsn attribute is specified in the source code the compiler will generate a value for the -vsn attribute anyway. The value generated is the MD5 sum of the abstract syntax tree and it will differ only if there are changes that have impact on the code. A change in a comment only will for example not result in a change of the generated MD5 value. We have discussed if we should always generate the MD5 value even if the -vsn is specified (and put it under some other attribute name) but we have not decided yet. I think you should use the -vsn for you manual version (if you need to have that) or use the MD5 as is since -vsn is the value that is used by the release handler and upgrade functions. /Kenneth Erlang/OTP Ericsson On Sat, Jan 31, 2009 at 5:58 PM, Steve Davis wrote: > I've noticed that if you use -version then -vsn is still recorded in > Module:module_info(attributes) apparently as a 128 uuid. If you use - > vsn, that uuid isn't generated... so is it better practice to use - > version() in your source so that you have that serial UID to uniquely > identify the beam from the vsn attribute? > > /s > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From exta7@REDACTED Mon Feb 2 14:19:54 2009 From: exta7@REDACTED (Zvi) Date: Mon, 2 Feb 2009 05:19:54 -0800 (PST) Subject: [erlang-questions] Shortnames Message-ID: <21789500.post@talk.nabble.com> Hi, Is using shortnames in distributed Erlang more secure, than longnames? I.e. even if intruder guessed the cookie, he/she still will not able to connect from different subnet. Also, I heard that some high profile projects do not use distribution at all, replacing it with custom RPC mechanism like [1]. Is there are any reasons beside security for this? Thanks in Advance, Zvi [1] %%It is very easy to roll your own RPC: call(Sock, M,F,A) -> gen_tcp:send(Sock, erlang:term_to_binary(M,F,A)). %% TODO %%Then at the other end: loop(Sock, Allowed_funcs) -> receive {tcp, Sock, Data} -> case erlang:binary_to_term(Data) of {M, F, A} when is_list(A) -> case lists:member({M,F,length(A)}, Allowed_funcs) of true -> apply(M,F,A); false -> ignore end; _ -> ignore end , loop(Sock, Allowed_funcs). -- View this message in context: http://www.nabble.com/Shortnames-tp21789500p21789500.html Sent from the Erlang Questions mailing list archive at Nabble.com. From agnel.joel@REDACTED Mon Feb 2 14:54:40 2009 From: agnel.joel@REDACTED (Joel Fernandes) Date: Mon, 2 Feb 2009 19:24:40 +0530 Subject: [erlang-questions] badsig on sending message to the cat process Message-ID: <9ff7a3bc0902020554t3fa8fc75m93a93a317d739580@mail.gmail.com> Hi, I have been doing a little experiment with interfacing an erlang process to one that accepts standard input and outputs to standard output. I chose the unix "cat" for this. The process starts and waits for input when I do an open_port however it errors out with a message "** exited: badsig **" when I try to send it some input. The following is the program: --module(cat). -export([start/0]). start() -> Port = open_port({spawn, "cat"}, [stream]), spawn(fun() -> loop(Port) end). loop(Port) -> receive {call, Msg} -> Port ! { self(), { command, Msg } }, receive {Port, {data, Data}} -> io:format("received ~p~n", [Data]), loop(Port) end; {'EXIT', Port, Reason} -> exit(Reason) end. and the shell session.. 2> P = cat:start(). <0.34.0> 3> P ! {call, {data, "hello"}}. {call,{data,"hello"}}** exited: badsig ** Any idea on why this could be happening? Thanks for any help, Joel From freza@REDACTED Mon Feb 2 15:25:04 2009 From: freza@REDACTED (Jachym Holecek) Date: Mon, 2 Feb 2009 15:25:04 +0100 Subject: [erlang-questions] badsig on sending message to the cat process In-Reply-To: <9ff7a3bc0902020554t3fa8fc75m93a93a317d739580@mail.gmail.com> References: <9ff7a3bc0902020554t3fa8fc75m93a93a317d739580@mail.gmail.com> Message-ID: <20090202142504.GA3075@hanele> Hello, # Joel Fernandes 2009-02-02: > "** exited: badsig **" when I try to send it some input. This means (see erlang:port_command/2): "If Port is open and the calling process is not the port owner, the port owner fails with badsig. The port owner fails with badsig also if Data is not a valid IO list." > The following is the program: > > --module(cat). > -export([start/0]). > > start() -> > Port = open_port({spawn, "cat"}, [stream]), > spawn(fun() -> loop(Port) end). The port owner is the process that called this function (shell), but you're sending commands from a freshly spawned process. This seems to be badsig #1. > loop(Port) -> > receive > {call, Msg} -> > Port ! { self(), { command, Msg } }, > receive > {Port, {data, Data}} -> > io:format("received ~p~n", [Data]), > loop(Port) > end; > {'EXIT', Port, Reason} -> > exit(Reason) > end. > > > and the shell session.. > > 2> P = cat:start(). > <0.34.0> > 3> P ! {call, {data, "hello"}}. ^^^^^^^^^^^^^^^ This term isn't iodata(), yet it ends up being the `Msg' in `{command, Msg}'. This seems to be badsig #2. HTH, -- Jachym From vlm@REDACTED Mon Feb 2 15:32:07 2009 From: vlm@REDACTED (Lev Walkin) Date: Mon, 02 Feb 2009 17:32:07 +0300 Subject: [erlang-questions] Shortnames In-Reply-To: <21789500.post@talk.nabble.com> References: <21789500.post@talk.nabble.com> Message-ID: <498703E7.7060707@lionet.info> Short names are not any more secure than long names. They're just shorter and thus a bit more easily transferrable between different installations, such as development/testing/staging/production. Zvi wrote: > Hi, > > Is using shortnames in distributed Erlang more secure, than longnames? I.e. > even if intruder guessed the cookie, he/she still will not able to connect > from different subnet. Users will be able to connect from different subnet even in short-names configuration. To disable ability to accept connections from non-local networks one should use "-kernel check_ip true" option to `erl` during VM start. > Also, I heard that some high profile projects do not use distribution at > all, replacing it with custom RPC mechanism like [1]. Is there are any > reasons beside security for this? Beside security, I heard of another reason: not being sure about performance, scalability and reliability properties of standard internode communication. In my view, using AMQP should be more natural next step than rolling out custom RPC in such case (if security is not the primary concern of going away from native RPC). > Thanks in Advance, > Zvi > > [1] > %%It is very easy to roll your own RPC: > call(Sock, M,F,A) -> > gen_tcp:send(Sock, erlang:term_to_binary(M,F,A)). > > %% TODO > > %%Then at the other end: > loop(Sock, Allowed_funcs) -> > receive > {tcp, Sock, Data} -> > case erlang:binary_to_term(Data) of > {M, F, A} when is_list(A) -> > case lists:member({M,F,length(A)}, Allowed_funcs) of > true -> > apply(M,F,A); > false -> > ignore > end; > _ -> ignore > end , > loop(Sock, Allowed_funcs). > I assume this is just a proof of concept [pseudo]code. This exact loop won't work reliably in practice due to TCP segmentation semantics. -- Lev Walkin vlm@REDACTED From icfp.publicity@REDACTED Mon Feb 2 16:31:05 2009 From: icfp.publicity@REDACTED (Matthew Fluet (ICFP Publicity Chair)) Date: Mon, 2 Feb 2009 09:31:05 -0600 Subject: [erlang-questions] ICFP09 Final CFP Message-ID: <53ff55480902020731m5ef3d60cpb732e79c15b1275d@mail.gmail.com> Final Call for Papers ICFP 2009: International Conference on Functional Programming Edinburgh, Scotland, 31 August - 2 September 2009 http://www.cs.nott.ac.uk/~gmh/icfp09.html ** Submission deadline: 2 March 2009 ** Submission URL: https://www.softconf.com/a/icfp09/ ICFP 2009 seeks original papers on the art and science of functional programming. Submissions are invited on all topics from principles to practice, from foundations to features, from abstraction to application. The scope includes all languages that encourage functional programming, including both purely applicative and imperative languages, as well as languages with objects or concurrency. Particular topics of interest include * Language Design * Implementation * Software-Development Techniques * Foundations * Applications and Domain-Specific Languages * Functional Pearls The conference also solicits Experience Reports, which are short papers that provide evidence that functional programming really works or describe obstacles that have kept it from working in a particular application. Important Dates (at 20:00 UTC) ~~~~~~~~~~~~~~~ Submission: 2 March 2009 https://www.softconf.com/a/icfp09/ Author response: 21-23 April 2009 Notification: 5 May 2009 Final papers due: 8 June 2009 Call for Papers (full text) ~~~~~~~~~~~~~~~ http://web.cecs.pdx.edu/~apt/icfp09_cfp.html Call for Experience Reports (full text) ~~~~~~~~~~~~~~~~~~~~~~~~~~~ http://web.cecs.pdx.edu/~apt/icfp09_cfer.html Program Chair ~~~~~~~~~~~~~ Andrew Tolmach Department of Computer Science Portland State University P.O. Box 751, Portland, OR 97207 USA Email: apt@REDACTED Phone: +1 503 725 5492 Fax: +1 503 725 3211 Mail sent to the address above is filtered for spam. If you send mail and do not receive a prompt response, particularly if the deadline is looming, feel free to telephone. From joe@REDACTED Mon Feb 2 17:37:52 2009 From: joe@REDACTED (Joe Williams) Date: Mon, 02 Feb 2009 08:37:52 -0800 Subject: [erlang-questions] Erlounge Seattle This Week. Message-ID: <49872160.7040807@joetify.com> Erlounge Seattle (http://erloungeseattle.org/) is coming up again this week. 7pm, Feb 4th 2009 @ Vivace Cafe 550 East Broadway Seattle, WA, 98102 See you there! -Joe -- Name: Joseph A. Williams Email: joe@REDACTED Blog: http://www.joeandmotorboat.com/ From kevin@REDACTED Mon Feb 2 21:11:52 2009 From: kevin@REDACTED (Kevin A. Smith) Date: Mon, 2 Feb 2009 15:11:52 -0500 Subject: [erlang-questions] Shortnames In-Reply-To: <498703E7.7060707@lionet.info> References: <21789500.post@talk.nabble.com> <498703E7.7060707@lionet.info> Message-ID: <5FD8DF5D-A63B-48F1-9EF4-B24DA8746E06@hypotheticalabs.com> On Feb 2, 2009, at 9:32 AM, Lev Walkin wrote: > > >> Also, I heard that some high profile projects do not use >> distribution at >> all, replacing it with custom RPC mechanism like [1]. Is there are >> any >> reasons beside security for this? > > Beside security, I heard of another reason: not being sure about > performance, scalability and reliability properties of standard > internode communication. In my view, using AMQP should be more natural > next step than rolling out custom RPC in such case (if security is not > the primary concern of going away from native RPC). A random AMQP comment: I'm using RabbitMQ on a project with demanding performance requirements. After just a few days of use with hardly any tweaking or optimization we're seeing message rates of 10-12k per second on a developer laptop with Erlang and Java AMQP clients. We expect this rate to increase when we get closer to deploy time after we've optimized our code and have access to server-class machines. --Kevin From exta7@REDACTED Mon Feb 2 23:59:02 2009 From: exta7@REDACTED (Zvi) Date: Mon, 2 Feb 2009 14:59:02 -0800 (PST) Subject: [erlang-questions] Shortnames In-Reply-To: <5FD8DF5D-A63B-48F1-9EF4-B24DA8746E06@hypotheticalabs.com> References: <21789500.post@talk.nabble.com> <498703E7.7060707@lionet.info> <5FD8DF5D-A63B-48F1-9EF4-B24DA8746E06@hypotheticalabs.com> Message-ID: <21800189.post@talk.nabble.com> funny thing, according to [1] I guess, that RabbitMQ itself using built-in Erlang distribution! Zvi [1] http://www.rabbitmq.com/clustering.html Kevin A. Smith-2 wrote: > > > On Feb 2, 2009, at 9:32 AM, Lev Walkin wrote: >> >> >>> Also, I heard that some high profile projects do not use >>> distribution at >>> all, replacing it with custom RPC mechanism like [1]. Is there are >>> any >>> reasons beside security for this? >> >> Beside security, I heard of another reason: not being sure about >> performance, scalability and reliability properties of standard >> internode communication. In my view, using AMQP should be more natural >> next step than rolling out custom RPC in such case (if security is not >> the primary concern of going away from native RPC). > > A random AMQP comment: I'm using RabbitMQ on a project with demanding > performance requirements. After just a few days of use with hardly any > tweaking or optimization we're seeing message rates of 10-12k per > second on a developer laptop with Erlang and Java AMQP clients. We > expect this rate to increase when we get closer to deploy time after > we've optimized our code and have access to server-class machines. > > --Kevin > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- View this message in context: http://www.nabble.com/Shortnames-tp21789500p21800189.html Sent from the Erlang Questions mailing list archive at Nabble.com. From ssroy1979@REDACTED Tue Feb 3 01:01:27 2009 From: ssroy1979@REDACTED (Salonee Sinha Roy) Date: Mon, 2 Feb 2009 16:01:27 -0800 Subject: [erlang-questions] newbie question about port driver. Message-ID: Hi All I am trying to port some perl code to erlang and for that I need to write a port driver (linked-in driver) . I decided to go with this because I want to execute the C code within the erlang process space. I am having issue with the control function in the driver. Adding the control function to my C code, causes erl_ddll:load_driver to fail. If I remove this function erl_ddll:load_driver works fine. I have isolated the issue to the following 2 lines in the function ei_x_new_with_version(&x_buff); ret = ei_x_encode_string(&x_buff,arg1); Commenting these 2 lines,results in erl_ddll:load_driver working find.I need some help to understand if I am doing something wrong. Any help would be appreciated. The code for the control function is static int example_drv_control(ErlDrvData example_data,unsigned int command,char *buf,int len, char **rbuf, int rlen){ int ret = -1; char *arg1; ei_x_buff x_buff; arg1 = (char *)malloc(sizeof(char) * (len+1)); logmessage("In control"); strncpy(arg1,buf,len); strcat(arg1,"\0"); logmessage(arg1); ei_x_new_with_version(&x_buff); strcat(arg1,"ASDF"); ret = ei_x_encode_string(&x_buff,arg1); *rbuf = (char*)ei_x_to_new_binary(&x_buff); return ret; } -------------- next part -------------- An HTML attachment was scrubbed... URL: From kevin@REDACTED Tue Feb 3 03:59:04 2009 From: kevin@REDACTED (Kevin A. Smith) Date: Mon, 2 Feb 2009 21:59:04 -0500 Subject: [erlang-questions] Shortnames In-Reply-To: <21800189.post@talk.nabble.com> References: <21789500.post@talk.nabble.com> <498703E7.7060707@lionet.info> <5FD8DF5D-A63B-48F1-9EF4-B24DA8746E06@hypotheticalabs.com> <21800189.post@talk.nabble.com> Message-ID: <8CFF4FDE-73F4-4BF9-8EC0-4C0C1D7F60B8@hypotheticalabs.com> And the Erlang client code can use Erlang's built-in distribution to communicate with the server, too. We're using the socketed interface instead to get better deployment flexibility but the performance is still quite good. --Kevin On Feb 2, 2009, at 5:59 PM, Zvi wrote: > > funny thing, according to [1] I guess, that RabbitMQ itself using > built-in > Erlang distribution! > > Zvi > > [1] http://www.rabbitmq.com/clustering.html > > > > > Kevin A. Smith-2 wrote: >> >> >> On Feb 2, 2009, at 9:32 AM, Lev Walkin wrote: >>> >>> >>>> Also, I heard that some high profile projects do not use >>>> distribution at >>>> all, replacing it with custom RPC mechanism like [1]. Is there are >>>> any >>>> reasons beside security for this? >>> >>> Beside security, I heard of another reason: not being sure about >>> performance, scalability and reliability properties of standard >>> internode communication. In my view, using AMQP should be more >>> natural >>> next step than rolling out custom RPC in such case (if security is >>> not >>> the primary concern of going away from native RPC). >> >> A random AMQP comment: I'm using RabbitMQ on a project with demanding >> performance requirements. After just a few days of use with hardly >> any >> tweaking or optimization we're seeing message rates of 10-12k per >> second on a developer laptop with Erlang and Java AMQP clients. We >> expect this rate to increase when we get closer to deploy time after >> we've optimized our code and have access to server-class machines. >> >> --Kevin >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> > > -- > View this message in context: http://www.nabble.com/Shortnames-tp21789500p21800189.html > Sent from the Erlang Questions mailing list archive at Nabble.com. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From klphanikar@REDACTED Tue Feb 3 04:48:02 2009 From: klphanikar@REDACTED (Phanikar.K) Date: Tue, 3 Feb 2009 09:18:02 +0530 Subject: [erlang-questions] Distributed Erlang Application Message-ID: Hi, I am trying to implement OTP distributed application. But as mentioned in the doc it explains only about the fail over and take over nature of the distributed application that is (active -passive). Actually my requirement is to make active-active distributed application where the distributed nodes need to loadbalanced, in this context can I use global registration of the process? Waiting for your assistance. Thank you, Phanikar. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Tue Feb 3 06:22:05 2009 From: ok@REDACTED (Richard O'Keefe) Date: Tue, 3 Feb 2009 18:22:05 +1300 Subject: [erlang-questions] Compiling functions returning large ground tuples Message-ID: <53CA4A83-F6BD-4C40-9308-B29450444667@cs.otago.ac.nz> I was enchanted to discover that the Mercury (strongly statically typed and moded logic programming with Clean-like uniqueness typing) system has an Erlang back-end. I was less enchanted to discover that its originators "lost interest", mainly because they needed to generate functions that return large ground tuples. In a message today, they said "those tuples (which can be rather large) would be reconstructed each time the function was called. HiPE was better, but (I think at that time) tuples containing binaries wouldn't be statically allocated." I though the default compiler now generated code to make static copies of large ground terms. Was I mistaken about that? Did HiPE ever/does it now have any problem generating static copies of large ground terms containing binaries? From zerthurd@REDACTED Tue Feb 3 06:32:01 2009 From: zerthurd@REDACTED (Maxim Treskin) Date: Tue, 3 Feb 2009 11:32:01 +0600 Subject: [erlang-questions] Dialyzer and record MatchSpec warnings Message-ID: Hello I found incomprehensible thing in dialyzer's output for MatchSpec using records. This is my module: ======================================= -module(loc). -export([get_ctrl_good/1, get_ctrl_bad/1]). -record(controller, { id :: integer(), address :: any(), type :: any(), name :: string(), profile :: integer() }). get_ctrl_good(CtrlId) -> CtrlMS = [{#controller{id = CtrlId, _='_'}, [], ['$_']}], case mnesia:dirty_select(controller, CtrlMS) of [Controller] -> [Controller]; _ -> not_found end. get_ctrl_bad(CtrlId) -> CtrlMS = [{#controller{id = CtrlId}, [], ['$_']}], case mnesia:dirty_select(controller, CtrlMS) of [Controller] -> [Controller]; _ -> not_found end. ======================================= So, when I make dialyzer --src -c loc.erl, I see following output: >>>>>>> Checking whether the PLT /home/zert/.dialyzer_plt is up-to-date... yes Proceeding with analysis... loc.erl:13: Function get_ctrl_good/1 has no local return loc.erl:14: Record construction #controller{id::any(),address::'_',type::'_',name::'_',profile::'_'} violates the declared type for #controller{} done in 0m0.59s done (warnings were emitted) >>>>>>> get_ctrl_bad/1 not contains _='_' in MatchSpec for dirty_select query and does not work due to unassignet fileds of record became to undefined value. get_ctrl_good/1 works fine, but dialyzer not think so. BTW, I know about ets:ms2fun, it gave me same results as in get_ctrl_good/1 My OTP release is R12B-5. How I can make this code right? Thank you -- Maxim Treskin -------------- next part -------------- An HTML attachment was scrubbed... URL: From zerthurd@REDACTED Tue Feb 3 06:42:20 2009 From: zerthurd@REDACTED (Maxim Treskin) Date: Tue, 3 Feb 2009 11:42:20 +0600 Subject: [erlang-questions] Dialyzer and record MatchSpec warnings In-Reply-To: References: Message-ID: And when I removes type specifications in record definition, all works fine and dialyzer does not warn. -- Maxim Treskin -------------- next part -------------- An HTML attachment was scrubbed... URL: From yubao.liu@REDACTED Tue Feb 3 07:01:12 2009 From: yubao.liu@REDACTED (Liu Yubao) Date: Tue, 03 Feb 2009 14:01:12 +0800 Subject: [erlang-questions] why can't use anonymous function in escript scripts? Message-ID: <4987DDA8.5010404@gmail.com> Hi, `escript a.erl` complains: escript: exception error: undefined function erl_eval:myfun/0 If uncomment the second line, the script works well. It's strange I can eval "fun io:format/2." in erl shell. Another related counterintuitive thing is I can't evaluate function definition in erl shell directly. a.erl: ----------------- #!erl %-mode(compile). myfun() -> 2. main(_) -> io:format("~p~n", [fun myfun/0]). From yubao.liu@REDACTED Tue Feb 3 07:46:14 2009 From: yubao.liu@REDACTED (Liu Yubao) Date: Tue, 03 Feb 2009 14:46:14 +0800 Subject: [erlang-questions] Is there any erlang code formatting tool? Message-ID: <4987E836.2070608@gmail.com> Hi, I prefer Vim to edit and Emacs to format erlang code but switching between two editors is very inconvenient. Is there any erlang code formatting tool? Or how can I use emacs to format erlang source files in batch? The default setting of erlang-mode indent code by tab characters and spaces, I prefer four spaces to one tab, how to change the setting of erlang-mode to make it indent code with four spaces? Below is output from vim(et ts=4 sw=4) and emacs(default setting): ---------------vim, formatted with "gg=G": {ehtml, {table, [{border, "1"}, {cellpadding, "2"}, {cellspacing, "2"}], [{thead, [], {tr, [], [{th, [], "File path"}, {th, [], "Module name"}, {th, [], "Last modified time"}, {th, [], "Status"}]}}, {tbody, [], Rows}]}}. ----------------emacs: {ehtml, {table, [{border, "1"}, {cellpadding, "2"}, {cellspacing, "2"}], [{thead, [], {tr, [], [{th, [], "File path"}, {th, [], "Module name"}, {th, [], "Last modified time"}, {th, [], "Status"}]}}, {tbody, [], Rows}]}}. From bengt.kleberg@REDACTED Tue Feb 3 07:59:09 2009 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 03 Feb 2009 07:59:09 +0100 Subject: [erlang-questions] Is there any erlang code formatting tool? In-Reply-To: <4987E836.2070608@gmail.com> References: <4987E836.2070608@gmail.com> Message-ID: <1233644349.4910.4.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Greetings, I have used parts of the Syntax_Tools (http://erlang.org/doc/apps/syntax_tools/index.html) for Erlang formatting without Emacs. For batch processing of files you might want to look at erl_tidy (http://erlang.org/doc/man/erl_tidy.html). If you want a tool that takes care of a function in a file, you can talk to me. bengt On Tue, 2009-02-03 at 14:46 +0800, Liu Yubao wrote: > Hi, > > I prefer Vim to edit and Emacs to format erlang code but > switching between two editors is very inconvenient. Is > there any erlang code formatting tool? Or how can I use emacs > to format erlang source files in batch? > > The default setting of erlang-mode indent code by tab characters > and spaces, I prefer four spaces to one tab, how to change the > setting of erlang-mode to make it indent code with four spaces? > > Below is output from vim(et ts=4 sw=4) and emacs(default setting): > > ---------------vim, formatted with "gg=G": > {ehtml, > {table, [{border, "1"}, {cellpadding, "2"}, {cellspacing, "2"}], > [{thead, [], > {tr, [], > [{th, [], "File path"}, > {th, [], "Module name"}, > {th, [], "Last modified time"}, > {th, [], "Status"}]}}, > {tbody, [], Rows}]}}. > > ----------------emacs: > {ehtml, > {table, [{border, "1"}, {cellpadding, "2"}, {cellspacing, "2"}], > [{thead, [], > {tr, [], > [{th, [], "File path"}, > {th, [], "Module name"}, > {th, [], "Last modified time"}, > {th, [], "Status"}]}}, > {tbody, [], Rows}]}}. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From sandeepkampati@REDACTED Tue Feb 3 08:09:24 2009 From: sandeepkampati@REDACTED (sandeep_k) Date: Mon, 2 Feb 2009 23:09:24 -0800 (PST) Subject: [erlang-questions] Query about tsung, how to set http cookies value in HTTP post method body Message-ID: <21804844.post@talk.nabble.com> In tsung configuration file: I want to set the cookies value in HTTP request POST method body, is there a way to do this using ?Dynamic variables? or any things else. -- View this message in context: http://www.nabble.com/Query-about-tsung%2C-how-to-set-http-cookies-value-in-HTTP-post-method-body-tp21804844p21804844.html Sent from the Erlang Questions mailing list archive at Nabble.com. From sandeepkampati@REDACTED Tue Feb 3 08:15:36 2009 From: sandeepkampati@REDACTED (sandeep_k) Date: Mon, 2 Feb 2009 23:15:36 -0800 (PST) Subject: [erlang-questions] Query about tsung, how to set http cookies value in HTTP post method body Message-ID: <21804844.post@talk.nabble.com> Hi All, In tsung configuration file: I want to set the cookies value in HTTP request POST method body, is there a way to do this using ?Dynamic variables? or any other way . Thanks, sandeep -- View this message in context: http://www.nabble.com/Query-about-tsung%2C-how-to-set-http-cookies-value-in-HTTP-post-method-body-tp21804844p21804844.html Sent from the Erlang Questions mailing list archive at Nabble.com. From yubao.liu@REDACTED Tue Feb 3 08:19:29 2009 From: yubao.liu@REDACTED (Liu Yubao) Date: Tue, 03 Feb 2009 15:19:29 +0800 Subject: [erlang-questions] The document shipped with erlang otp is inconvenient to lookup Message-ID: <4987F001.3080907@gmail.com> Hi, I'm a newbie to erlang, I often forget which application a module belongs to and which module a function belongs to, it's quite annoying to expand all nodes in the navigator frame, click an application, search a module name or function name with Ctrl-F in the web browser, back to top page, do the above actions again... I want a help system like this: application:________[1] module:________[2] function:________[3] ======================= ================== ==================== all application set_path/1 (highlighted) kernel (highlighted) auth get_path/0 stdlib code (highlighted) add_path/1 .... [4] .... [5] ..... [6] ---------------------------------------------------------------------- | | | document for code:set_path/1 [7] | | | ---------------------------------------------------------------------- [1,2,3]: three inputboxes to input regular expression to filter entries in [4,5,6] [4,5,6]: three listboxes to list entries in corresponding class [7] : a html viewer to render document for specified function Is there already a tool like this? If not I plan to write one, I have some experience with Perl/Tk, but it's a pity Tk doesn't have a html viewer widget. From bgustavsson@REDACTED Tue Feb 3 08:35:58 2009 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Tue, 3 Feb 2009 08:35:58 +0100 Subject: [erlang-questions] Compiling functions returning large ground tuples In-Reply-To: <53CA4A83-F6BD-4C40-9308-B29450444667@cs.otago.ac.nz> References: <53CA4A83-F6BD-4C40-9308-B29450444667@cs.otago.ac.nz> Message-ID: <6672d0160902022335i5e109b02yf4a1d7b685782935@mail.gmail.com> On Tue, Feb 3, 2009 at 6:22 AM, Richard O'Keefe wrote: > I was enchanted to discover that the Mercury (strongly statically > typed and moded logic programming with Clean-like uniqueness typing) > system has an Erlang back-end. > > I was less enchanted to discover that its originators > "lost interest", mainly because they needed to generate > functions that return large ground tuples. In a message > today, they said "those tuples (which can be rather large) > would be reconstructed each time the function was called. > HiPE was better, but (I think at that time) tuples > containing binaries wouldn't be statically allocated." > > I though the default compiler now generated code to make > static copies of large ground terms. Was I mistaken about > that? Did HiPE ever/does it now have any problem > generating static copies of large ground terms containing > binaries? I am not exactly sure what you mean with "ground term". In R12B, constant terms (for instance, {a,b,c,[e,f,g]} or {a,<<1,2,3>>}) will be stored in a constant pool and not reconstructed every time. That includes binaries. (The same mechanism is used for both BEAM code and native code.) Before R12B, I don't think binaries were treated as constants by the HiPE compiler. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From massimo.cesaro@REDACTED Tue Feb 3 09:11:44 2009 From: massimo.cesaro@REDACTED (Massimo Cesaro) Date: Tue, 3 Feb 2009 09:11:44 +0100 Subject: [erlang-questions] [spam?] Are there any companies that hire Erlangers? In-Reply-To: <4c7f9e8d0810131102q83cfeb4tfaefb285e0a751d6@mail.gmail.com> References: <2a67d3ff0810091808x2c4be63dpbe1ef8f79654593c@mail.gmail.com> <4c7f9e8d0810131102q83cfeb4tfaefb285e0a751d6@mail.gmail.com> Message-ID: <7ae16d50902030011h436e1f91se238fddd189090d2@mail.gmail.com> I apologize for posting here, but I still have to figure out how to put a job announce on trapexit. We have a couple of open positions for Erlang software developers in Northern Italy (Venice Area) and in Rome. Positions are permanent and require MSc or BSc in Computer Science, Software Engineering or equivalent. Required skills are Erlang/OTP, Mnesia and Yaws. Network programming and telecommunications experience are a plus. The developer's tasks involves both new development and maintaining of carrier grade soft switch and service delivery platforms. Interested parties should send resumes to jobs at nesit dot it Massimo Cesaro 2008/10/13 Josh Goldberg > I've gotten a couple job inquiries from linkedin.com with erlang in my > profile. > > 2008/10/9 G.S. > >> Hello All, >> >> I have yet to find a company that programs using Erlang, and I'd really >> like to work for one. Am I looking in the wrong place, do any of you know a >> company that uses Erlang as the main language? >> >> -Gene >> >> _______________________________________________ >> 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 > -- - Is there anything I can do? - Computer says "no". -------------- next part -------------- An HTML attachment was scrubbed... URL: From kostis@REDACTED Tue Feb 3 09:20:20 2009 From: kostis@REDACTED (Kostis Sagonas) Date: Tue, 03 Feb 2009 10:20:20 +0200 Subject: [erlang-questions] Dialyzer and record MatchSpec warnings In-Reply-To: References: Message-ID: <4987FE44.7080408@cs.ntua.gr> Maxim Treskin wrote: > Hello > > I found incomprehensible thing in dialyzer's output for MatchSpec using > records. > > This is my module: > ======================================= > -module(loc). > -export([get_ctrl_good/1]). > > -record(controller, { > id :: integer(), > address :: any(), > type :: any(), > name :: string(), > profile :: integer() > }). > > get_ctrl_good(CtrlId) -> > CtrlMS = [{#controller{id = CtrlId, _='_'}, [], ['$_']}], > case mnesia:dirty_select(controller, CtrlMS) of > [Controller] -> [Controller]; > _ -> not_found > end. > ======================================= > > So, when I make dialyzer --src -c loc.erl, I see following output: > > >>>>>>> > Checking whether the PLT /home/zert/.dialyzer_plt is up-to-date... yes > Proceeding with analysis... > loc.erl:13: Function get_ctrl_good/1 has no local return > loc.erl:14: Record construction > #controller{id::any(),address::'_',type::'_',name::'_',profile::'_'} > violates the declared type for #controller{} > done in 0m0.59s > done (warnings were emitted) > >>>>>>> > > get_ctrl_good/1 works fine, but dialyzer not think so. The problem is that Dialyzer is agnostic about the language of match specs, which looks like Erlang but in reality is a totally different language. What happens here is that you declared some record fields (e.g. profile) to contain integers only and then, as far as *Erlang* is concerned, your code contains a record construction where these fields get a value which is an atom, not an integer. I am not so convinced that Dialyzer is to blame here... I think that having match specs expand to code with Erlang syntax but not Erlang semantics is a bad design choice and perhaps it should be revised. We will discuss this with the OTP folks and see what can be done about it. In the meantime, you can bypass this particular problem by allowing all record fields that need it to include the atom '_' in their set of allowed types. I.e. change the record specification to: -record(controller, { id :: integer(), address :: any(), type :: any(), name :: string() | '_', profile :: integer() | '_' }). Definitely not pretty, but it will do the trick. Kostis From tobias.lindahl@REDACTED Tue Feb 3 09:36:00 2009 From: tobias.lindahl@REDACTED (Tobias Lindahl) Date: Tue, 03 Feb 2009 09:36:00 +0100 Subject: [erlang-questions] Dialyzer and record MatchSpec warnings In-Reply-To: References: Message-ID: <498801F0.10304@kreditor.se> Maxim Treskin wrote: > Hello > > I found incomprehensible thing in dialyzer's output for MatchSpec using > records. > > This is my module: > ======================================= > -module(loc). > -export([get_ctrl_good/1, get_ctrl_bad/1]). > > -record(controller, { > id :: integer(), > address :: any(), > type :: any(), > name :: string(), > profile :: integer() > }). > > get_ctrl_good(CtrlId) -> > CtrlMS = [{#controller{id = CtrlId, _='_'}, [], ['$_']}], > case mnesia:dirty_select(controller, CtrlMS) of > [Controller] -> [Controller]; > _ -> not_found > end. > > get_ctrl_bad(CtrlId) -> > CtrlMS = [{#controller{id = CtrlId}, [], ['$_']}], > case mnesia:dirty_select(controller, CtrlMS) of > [Controller] -> [Controller]; > _ -> not_found > end. > ======================================= > > So, when I make dialyzer --src -c loc.erl, I see following output: > > Checking whether the PLT /home/zert/.dialyzer_plt is up-to-date... yes > Proceeding with analysis... > loc.erl:13: Function get_ctrl_good/1 has no local return > loc.erl:14: Record construction > #controller{id::any(),address::'_',type::'_',name::'_',profile::'_'} > violates the declared type for #controller{} > done in 0m0.59s > done (warnings were emitted) > > get_ctrl_bad/1 not contains _='_' in MatchSpec for dirty_select query and > does not work due to unassignet fileds of record became to undefined value. > get_ctrl_good/1 works fine, but dialyzer not think so. > BTW, I know about ets:ms2fun, it gave me same results as in get_ctrl_good/1 Yes, you found a bit of a problem there. You are indeed constructing a record that do not conform to the specification you have given. The atom '_' is not part of the declared type, so Dialyzer tells you that you have broken the contract, which you arguably have done. However, you do want to give that assignment for the match spec to work correctly. The quick fix is to include '_' in the specified type for all fields you want to assign to '_'. A more general fix might be that Dialyzer always accepts '_' for construction since match specs are quite common. We'll have to think about that. Thanks for the report. Tobias > > My OTP release is R12B-5. > > How I can make this code right? > > Thank you > > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From kostis@REDACTED Tue Feb 3 09:40:45 2009 From: kostis@REDACTED (Kostis Sagonas) Date: Tue, 03 Feb 2009 10:40:45 +0200 Subject: [erlang-questions] Compiling functions returning large ground tuples In-Reply-To: <53CA4A83-F6BD-4C40-9308-B29450444667@cs.otago.ac.nz> References: <53CA4A83-F6BD-4C40-9308-B29450444667@cs.otago.ac.nz> Message-ID: <4988030D.1000604@cs.ntua.gr> Richard O'Keefe wrote: > I was enchanted to discover that the Mercury (strongly statically > typed and moded logic programming with Clean-like uniqueness typing) > system has an Erlang back-end. > > I was less enchanted to discover that its originators > "lost interest", mainly because they needed to generate > functions that return large ground tuples. In a message > today, they said "those tuples (which can be rather large) > would be reconstructed each time the function was called. > HiPE was better, but (I think at that time) tuples > containing binaries wouldn't be statically allocated." IMHO, this is not a very good reason to "lose interest" in this project. Also, if that was indeed the issue, they should have contacted us and we would have known about this and possibly have investigated whether something could have been done. > I though the default compiler now generated code to make > static copies of large ground terms. Was I mistaken about > that? Did HiPE ever/does it now have any problem > generating static copies of large ground terms containing > binaries? The current HiPE compiler (and for quite some time now, but I do not recall exactly from when) places structured terms with statically known subterms in a constant pool area. This includes binary subterms. Kostis From zerthurd@REDACTED Tue Feb 3 10:14:05 2009 From: zerthurd@REDACTED (Maxim Treskin) Date: Tue, 3 Feb 2009 15:14:05 +0600 Subject: [erlang-questions] [spam?] Are there any companies that hire Erlangers? In-Reply-To: <7ae16d50902030011h436e1f91se238fddd189090d2@mail.gmail.com> References: <2a67d3ff0810091808x2c4be63dpbe1ef8f79654593c@mail.gmail.com> <4c7f9e8d0810131102q83cfeb4tfaefb285e0a751d6@mail.gmail.com> <7ae16d50902030011h436e1f91se238fddd189090d2@mail.gmail.com> Message-ID: There is Erlang job in Novosibirsk, Russia. Our company is telecommunication hardware and solutions vendor. We have development of VoIP software (embedded and server-side) using Erlang OTP. -- Maxim Treskin -------------- next part -------------- An HTML attachment was scrubbed... URL: From ed.stow@REDACTED Tue Feb 3 10:31:46 2009 From: ed.stow@REDACTED (Edward Stow) Date: Tue, 3 Feb 2009 20:31:46 +1100 Subject: [erlang-questions] Singleton Process Message-ID: Hi, I have been teaching myself Erlang and had an epiphany regarding the use of processes to record state without variables (in the imperative programming sense). However, I would like to know if this is how you would produce a counter object that returns an incrementally increasing value. The counter needs to be unique across processes. (A singleton process -- is that a correct term in fp / erlang ). -module(counter). -export([next_id/0]). next_id() -> next_id(start()). start() -> case whereis(counter) of undefined -> Pid = spawn(fun () -> loop(read_next_id()) end), register(counter, Pid), Pid; Pid -> Pid end. next_id(Pid) -> rpc(Pid, next_id). rpc(Pid, Request) -> Pid ! {self(), Request}, receive {Pid, Response} -> Response end. loop(Counter) -> receive {From, next_id} -> From ! {self(), Counter}, save_next_id(Counter + 1), loop(Counter + 1) end. read_next_id() -> {ok, [Term]} = file:consult("next_id.dat"), {next_id, Number} = Term, Number. save_next_id(Number) -> {ok, S} = file:open("next_id.dat", write), io:format(S, "~p.~n", [{next_id, Number}]), file:close(S). Thanks -- Edward Stow From ed.stow@REDACTED Tue Feb 3 10:33:51 2009 From: ed.stow@REDACTED (Edward Stow) Date: Tue, 3 Feb 2009 20:33:51 +1100 Subject: [erlang-questions] Path of the current module Message-ID: Hi My question simple, but I could not find the answer: What function will return the path of the currently executing module? Thanks -- Edward Stow From bernie@REDACTED Tue Feb 3 10:57:03 2009 From: bernie@REDACTED (Bernard Duggan) Date: Tue, 03 Feb 2009 20:57:03 +1100 Subject: [erlang-questions] Singleton Process In-Reply-To: References: Message-ID: <498814EF.7060203@m5net.com> Hi Edward, Your code is a pretty reasonable attempt at a basic implementation (and I don't mean that in any derogatory or rude sense - much of my code from not very long ago follows a similar pattern). The most obvious problem I can see with it is the race condition in start() - if two processes call next_id() at the same time, they could both call whereis(counter) and receive 'undefined' as the response - they'd both then try to spawn and register the process, and while both spawns would succeed, only the first register() would. Generally I find it's best to spawn such "singleton" (I have no idea if that's the correct terminology, sorry) processes at the start of your app, before any calls to them are ever made rather than trying to spawn it dynamically on first use. Other than that I can't see any serious problem with it. I'd personally be more inclined to implement something as simple as this with an mnesia counter (which can handle both the disc persistence and protected get/update operations for you in very few lines of code). Others more experienced than I can probably suggest an even better way. For more complex things like resource allocation, though, I've found this kind of pattern to be perfectly good. Cheers, Bernard Edward Stow wrote: > Hi, > > I have been teaching myself Erlang and had an epiphany regarding the > use of processes to record state without variables (in the imperative > programming sense). > > However, I would like to know if this is how you would produce a > counter object that returns an incrementally increasing value. The > counter needs to be unique across processes. (A singleton process -- > is that a correct term in fp / erlang ). > > -module(counter). > -export([next_id/0]). > > next_id() -> > next_id(start()). > > start() -> > case whereis(counter) of > undefined -> > Pid = spawn(fun () -> loop(read_next_id()) end), > register(counter, Pid), > Pid; > Pid -> > Pid > end. > > next_id(Pid) -> rpc(Pid, next_id). > > rpc(Pid, Request) -> > Pid ! {self(), Request}, > receive > {Pid, Response} -> > Response > end. > > loop(Counter) -> > receive > {From, next_id} -> > From ! {self(), Counter}, > save_next_id(Counter + 1), > loop(Counter + 1) > end. > > read_next_id() -> > {ok, [Term]} = file:consult("next_id.dat"), > {next_id, Number} = Term, > Number. > > save_next_id(Number) -> > {ok, S} = file:open("next_id.dat", write), > io:format(S, "~p.~n", [{next_id, Number}]), > file:close(S). > > > Thanks > From bengt.kleberg@REDACTED Tue Feb 3 10:56:35 2009 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 03 Feb 2009 10:56:35 +0100 Subject: [erlang-questions] Path of the current module In-Reply-To: References: Message-ID: <1233654995.4910.16.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Greetings, You might want to use code:is_loaded/1 (http://erlang.org/doc/man/code.html), which will return {file, Loaded} | false, where Loaded = Absname | preloaded | cover_compiled (you want Absname). The current module is ?MODULE. bengt On Tue, 2009-02-03 at 20:33 +1100, Edward Stow wrote: > Hi > > > My question simple, but I could not find the answer: What function > will return the path of the currently executing module? > > Thanks > From bgustavsson@REDACTED Tue Feb 3 11:03:55 2009 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Tue, 3 Feb 2009 11:03:55 +0100 Subject: [erlang-questions] Path of the current module In-Reply-To: References: Message-ID: <6672d0160902030203u5c2be5rbbdc70824143cee9@mail.gmail.com> On Tue, Feb 3, 2009 at 10:33 AM, Edward Stow wrote: > Hi > > > My question simple, but I could not find the answer: What function > will return the path of the currently executing module? code:which(?MODULE) If you only want the directory part, use filename:dirname(code:which(?MODULE)) /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From ed.stow@REDACTED Tue Feb 3 11:26:24 2009 From: ed.stow@REDACTED (Edward Stow) Date: Tue, 3 Feb 2009 21:26:24 +1100 Subject: [erlang-questions] Singleton Process In-Reply-To: <498814EF.7060203@m5net.com> References: <498814EF.7060203@m5net.com> Message-ID: Bernard 2009/2/3 Bernard Duggan : > Hi Edward, > Your code is a pretty reasonable attempt at a basic implementation (and > I don't mean that in any derogatory or rude sense - much of my code from > not very long ago follows a similar pattern). > The most obvious problem I can see with it is the race condition in > start() - if two processes call next_id() at the same time, they could > both call whereis(counter) and receive 'undefined' as the response - > they'd both then try to spawn and register the process, and while both > spawns would succeed, only the first register() would. Generally I find > it's best to spawn such "singleton" (I have no idea if that's the > correct terminology, sorry) processes at the start of your app, before > any calls to them are ever made rather than trying to spawn it > dynamically on first use. Great this was the sort of advice I needed about potential race conditions. > Other than that I can't see any serious problem with it. I'd > personally be more inclined to implement something as simple as this > with an mnesia counter (which can handle both the disc persistence and > protected get/update operations for you in very few lines of code). mnesia seemed like a bit of overkill and I was keen to learn from 'first principles' how to ensure synchronous access to the counter resource. -- Edward Stow From ed.stow@REDACTED Tue Feb 3 11:27:25 2009 From: ed.stow@REDACTED (Edward Stow) Date: Tue, 3 Feb 2009 21:27:25 +1100 Subject: [erlang-questions] Path of the current module In-Reply-To: <6672d0160902030203u5c2be5rbbdc70824143cee9@mail.gmail.com> References: <6672d0160902030203u5c2be5rbbdc70824143cee9@mail.gmail.com> Message-ID: 2009/2/3 Bjorn Gustavsson : > On Tue, Feb 3, 2009 at 10:33 AM, Edward Stow wrote: >> Hi >> >> >> My question simple, but I could not find the answer: What function >> will return the path of the currently executing module? > > code:which(?MODULE) > > If you only want the directory part, use > > filename:dirname(code:which(?MODULE)) That was just what I was looking for. It was the ?MODULE that I didn't know about. Thanks -- Edward Stow From ulf.wiger@REDACTED Tue Feb 3 13:20:06 2009 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Tue, 03 Feb 2009 13:20:06 +0100 Subject: [erlang-questions] Dialyzer and record MatchSpec warnings In-Reply-To: <498801F0.10304@kreditor.se> References: <498801F0.10304@kreditor.se> Message-ID: <49883676.3030805@ericsson.com> Tobias Lindahl skrev: > > The quick fix is to include '_' in the specified type for all fields you > want to assign to '_'. A more general fix might be that Dialyzer always > accepts '_' for construction since match specs are quite common. We'll > have to think about that. I think that Dialyzer will have trouble dealing with match specs as a distinct entity. Personally, I often try to structure complex match specs e.g. as MatchHead = ..., Guards = ... Result = ..., Pattern = {MatchHead, Guards, Result} (which also seems like recommended practice judging from the docs). For a more complex treatment of match specs, you could look at gproc: http://svn.ulf.wiger.net/gproc/src/gproc.erl which rewrites match spec patterns as part of using QLC (some of it, but not all, should happen at compile-time.) I will confess that I haven't tried running Dialyzer on gproc. (: BR, Ulf W From sverker@REDACTED Tue Feb 3 13:55:38 2009 From: sverker@REDACTED (Sverker Eriksson) Date: Tue, 03 Feb 2009 13:55:38 +0100 Subject: [erlang-questions] newbie question about port driver. In-Reply-To: References: Message-ID: <49883ECA.4090804@erix.ericsson.se> Salonee Sinha Roy wrote: > I have isolated the issue to the following 2 lines in the function > ei_x_new_with_version(&x_buff); > ret = ei_x_encode_string(&x_buff,arg1); > > Commenting these 2 lines,results in erl_ddll:load_driver working > find. The need to link your driver against the erl_interface library where these two functions are implemented. /Sverker, Erlang/OTP From jeedward@REDACTED Tue Feb 3 14:20:51 2009 From: jeedward@REDACTED (John Edward) Date: Tue, 3 Feb 2009 05:20:51 -0800 (PST) Subject: [erlang-questions] Paper submission deadline extended: MULTICONF-09 Message-ID: <152819.25203.qm@web45908.mail.sp1.yahoo.com> Paper submission deadline extended: MULTICONF-09 ? The deadline for draft paper submission at the 2009 Multi Conference in Computer Science, Information Technology and Control systems and Computational Science and Computer Engineering (MULTICONF-09) (website: http://www.PromoteResearch.org) is extended due to numerous requests from the authors. The conference will be held during July 13-16 2009 in Orlando, FL, USA. We invite draft paper submissions. The event consists of the following conferences: ????????? International Conference on Artificial Intelligence and Pattern Recognition (AIPR-09) ????????? International Conference on Automation, Robotics and Control Systems (ARCS-09) ????????? International Conference on Bioinformatics, Computational Biology, Genomics and Chemoinformatics (BCBGC-09) ????????? International Conference on Enterprise Information Systems and Web Technologies (EISWT-09) ????????? International Conference on High Performance Computing, Networking and Communication Systems (HPCNCS-09) ????????? International Conference on Information Security and Privacy (ISP-09) ????????? International Conference on Recent Advances in Information Technology and Applications (RAITA-09) ????????? International Conference on Software Engineering Theory and Practice (SETP-09) ????????? International Conference on Theory and Applications of Computational Science (TACS-09) ????????? International Conference on Theoretical and Mathematical Foundations of Computer Science (TMFCS-09) ? The website http://www.PromoteResearch.org? contains more details. ? Sincerely John Edward Publicity committee ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicola.lugato@REDACTED Tue Feb 3 16:59:51 2009 From: nicola.lugato@REDACTED (Nicola Lugato) Date: Tue, 3 Feb 2009 16:59:51 +0100 Subject: [erlang-questions] Questions about processes and message queues Message-ID: <59bbf6e10902030759p44ec370dh5d8e6f5c800647dc@mail.gmail.com> Hello! i have some doubt about processes and message queues. What does happend if a fast process keeps sending messages to a slow process? Does the queue keeps growing arbitrarly or is there some kind of limiting mechanism ? If so, how does it work exacly? Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From elias@REDACTED Tue Feb 3 17:35:25 2009 From: elias@REDACTED (Elias Torres) Date: Tue, 3 Feb 2009 11:35:25 -0500 Subject: [erlang-questions] Questions about processes and message queues In-Reply-To: <59bbf6e10902030759p44ec370dh5d8e6f5c800647dc@mail.gmail.com> References: <59bbf6e10902030759p44ec370dh5d8e6f5c800647dc@mail.gmail.com> Message-ID: I'm not an Erlang expert and don't know if there are built-in mechanisms for limiting a process' inbox. But like with everything else, machines have limits (disk, memory, etc) so you have to decide what to do during failure. For example, you could decide on a timer to shed load by flushing your inbox instead of never catching up. Here's the basic snippet for flushing your inbox. flush() -> receive Any -> flush() after 0 -> true end. Of course, you could forward those messages to another process or machine for load sharing. -Elias 2009/2/3 Nicola Lugato : > Hello! > i have some doubt about processes and message queues. > What does happend if a fast process keeps sending messages to a slow > process? Does the queue keeps growing arbitrarly or is there some kind of > limiting mechanism ? If so, how does it work exacly? > > Thanks > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From dnonnenm@REDACTED Tue Feb 3 19:24:51 2009 From: dnonnenm@REDACTED (David Nonnenmacher) Date: Tue, 3 Feb 2009 19:24:51 +0100 Subject: [erlang-questions] Emakefile and macro Message-ID: <706aa0500902031024j548fafedja3c8cc67c77d4cad@mail.gmail.com> Hello, I would like to compile some erlang files that contains a macro. The Emakefile has the following contents: *{"/home/dnonnenm/PROJECTS/lib/my_appli/src/*", [{i,"/home/dnonnenm/PROJECTS/lib/"}, {d,"MY_MACRO", "ITS_VALUE"}, {outdir,"/home/dnonnenm/PROJECTS/lib/my_appli/ebin"}]}. * The problem is that there is no generated beam. The output command (ie erl -make) is the following: *Recompile: /home/dnonnenm/PROJECTS/lib/my_appli/src/module_1 Recompile: **/home/dnonnenm/PROJECTS/lib/my_appli/src/module_2 Recompile: **/home/dnonnenm/PROJECTS/lib/my_appli/src/module_3* There are no errors, no warnings. I did the same but removing the macro definition (ie {d, ....}), and there are some beam generated. But I have an error dur to the missing macro. Is this a bug ? or did i write something bad ? David -------------- next part -------------- An HTML attachment was scrubbed... URL: From rvirding@REDACTED Tue Feb 3 19:28:01 2009 From: rvirding@REDACTED (Robert Virding) Date: Tue, 3 Feb 2009 19:28:01 +0100 Subject: [erlang-questions] why can't use anonymous function in escript scripts? In-Reply-To: <4987DDA8.5010404@gmail.com> References: <4987DDA8.5010404@gmail.com> Message-ID: <3dbc6d1c0902031028h69b4748dl3b2d5e8a616ba99f@mail.gmail.com> 2009/2/3 Liu Yubao > Hi, > > `escript a.erl` complains: > escript: exception error: undefined function erl_eval:myfun/0 > > If uncomment the second line, the script works well. It's strange > I can eval "fun io:format/2." in erl shell. The reason you can evaluate "fun io:format/2" is that it is a reference to a function in another module (io) which means that the compiler cannot check the validity of that reference and so allows it and leaves it up to the runtime to check if it actually exists. Try evaluating "fun sune:format/2" to see what happens if module or function does not exist. I don't know enough about escript to explain why you need to uncomment the -mode(compile) line, and I don't really understand why it doesn't work. I think it should. > Another related counterintuitive thing is I can't evaluate function > definition in erl shell directly. The shell evaluates expressions but a function definition is not an expression. Generally speaking Erlang does not support a seemless interaction between compiled and interpreted code like most lisp and prolog systems. All functions must belong to a module and internally there are only (compiled) modules containing compiled code. To be able to define functions in the shell which are reachable from other code the shell would have to (re)compile all its function definitions each time they are changed. It is not really very much of a hindrance to define functions in a module and recompile it. Robert > a.erl: > ----------------- > #!erl > %-mode(compile). > > myfun() -> 2. > > main(_) -> > io:format("~p~n", [fun myfun/0]). > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mm@REDACTED Tue Feb 3 20:17:44 2009 From: mm@REDACTED (marmll) Date: Tue, 3 Feb 2009 11:17:44 -0800 (PST) Subject: [erlang-questions] HowTo: Stored Procedure Message-ID: <21809763.post@talk.nabble.com> Hi, i must call a stored procedure on a MS SQL Server 2005 database. How can i do it with erlang ? I have an ODBC Driver installed and everything works fine. I can make select, insert over param_query but how can i execute an parameter stored procedure ? a code snip was very nice Thanks for help -- View this message in context: http://www.nabble.com/HowTo%3A-Stored-Procedure-tp21809763p21809763.html Sent from the Erlang Questions mailing list archive at Nabble.com. From norbu09@REDACTED Tue Feb 3 22:09:56 2009 From: norbu09@REDACTED (lenz) Date: Wed, 4 Feb 2009 10:09:56 +1300 Subject: [erlang-questions] erlounge wellington wrapup Message-ID: hi, we had a good turn out yesterday, there were not too many guys but those attending had a good time. i pushed the sources to github and the slides to slideshare in case some of those that were not able to be here can have a look at it. also make sure you sign up for our mailing list to reduce my cross posts :-) slides: http://www.slideshare.net/norbu09/umleitung-a-tiny-mochiwebcouchdb-app source: http://github.com/norbu09/umleitung/tree/master cheers lenz -- iWantMyName.com painless domain registration (finally) -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicola.lugato@REDACTED Tue Feb 3 21:47:00 2009 From: nicola.lugato@REDACTED (Nicola Lugato) Date: Tue, 3 Feb 2009 21:47:00 +0100 Subject: [erlang-questions] SSL: SSL_set_verify callback (Nicola Lugato) In-Reply-To: <488DCAA0.2000109@erix.ericsson.se> References: <488DCAA0.2000109@erix.ericsson.se> Message-ID: <59bbf6e10902031247n1335ffdak48ee3893e72fbe29@mail.gmail.com> Hello, could you update me on this issue?What's the status of the new implementation? (btw, is it the "new_ssl" explained here http://erlang.org/doc/man/new_ssl.html or something else?) Many thanks, Nicola On Mon, Jul 28, 2008 at 2:33 PM, Ingela Anderton Andin < ingela@REDACTED> wrote: > Hi, > > I am not sure that the existing Erlang API towards openssl lets you get > at this functionallity, however we are working > on a new ssl-implementation, that does not use openssl for > communication only for cryptographics, > where you will be able to do the corresponding. I can not make any > promises regarding when we > can release this but it is in the pipeline and should be ready in a not > too distant future. There is a beta-version of new ssl in R12B > but you would have to hack it as that functionality is not yet included > in the API. (That code has also changed quite a lot since the R12B > release) > > Regards - Ingela Erlang/OTP, Ericsson > > > > >>> > > >>> Hello, > > >>> i'm considering porting some code of mine to erlang. It's a network > > >>> server that uses SSL. > > >>> It makes use of the callback that you can specify on SSL_set_verify > (and > > >>> similar) to check if a peer is allowed to connect, based on data in > its > > >>> certificate. > > >>> > > >>> (see: http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html) > > >>> > > >>> I've checked the documentation of the SSL application in Erlang > > >>> (http://www.erlang.org/doc/apps/ssl/index.html), but i couldn't find > a way > > >>> to supply such a callback. Is it possible? > > >>> This is a fundamental feature of my server so it would be a blocking > > >>> problem. > > >>> > > >>> Thanks, Nicola > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vik@REDACTED Tue Feb 3 23:04:07 2009 From: vik@REDACTED (Vik Olliver) Date: Wed, 04 Feb 2009 11:04:07 +1300 Subject: [erlang-questions] erlounge wellington wrapup In-Reply-To: References: Message-ID: <4988BF57.7050303@catalyst.net.nz> Sorry I couldn't make it guys. I was holed up in my hotel room being unwell. VIk :v) On 04/02/09 lenz wrote: > we had a good turn out yesterday, there were not too many guys but > those attending had a good time. i pushed the sources to github and > the slides to slideshare in case some of those that were not able to > be here can have a look at it. > > also make sure you sign up for our mailing list to reduce my cross > posts :-) > > slides: > http://www.slideshare.net/norbu09/umleitung-a-tiny-mochiwebcouchdb-app > source: http://github.com/norbu09/umleitung/tree/master From ok@REDACTED Wed Feb 4 00:27:02 2009 From: ok@REDACTED (Richard O'Keefe) Date: Wed, 4 Feb 2009 12:27:02 +1300 Subject: [erlang-questions] Compiling functions returning large ground tuples In-Reply-To: <6672d0160902022335i5e109b02yf4a1d7b685782935@mail.gmail.com> References: <53CA4A83-F6BD-4C40-9308-B29450444667@cs.otago.ac.nz> <6672d0160902022335i5e109b02yf4a1d7b685782935@mail.gmail.com> Message-ID: <8707988B-DE13-4352-8D63-06FE016004A1@cs.otago.ac.nz> On 3 Feb 2009, at 8:35 pm, Bjorn Gustavsson wrote: > I am not exactly sure what you mean with "ground term". What I mean by "ground term" should be fairly obvious: any constant (atom, number, binary, []) is a ground term, any pair of ground terms is a ground term, and any tuple of ground terms is a ground term. > > > In R12B, constant terms (for instance, {a,b,c,[e,f,g]} or > {a,<<1,2,3>>}) > will be stored in a constant pool and not reconstructed every time. > That includes binaries. (The same mechanism is used for both > BEAM code and native code.) Thanks. I've forwarded this to the Mercury mailing list. Maybe the Mercury->Erlang back end will be revivified. From yubao.liu@REDACTED Wed Feb 4 02:45:52 2009 From: yubao.liu@REDACTED (Liu Yubao) Date: Wed, 04 Feb 2009 09:45:52 +0800 Subject: [erlang-questions] A simple gen_server to rebuild dtl templates [Was: What's the recommended template engine for web development with erlang?] In-Reply-To: References: <4976DAF3.7030301@gmail.com> Message-ID: <4988F350.6050409@gmail.com> Christian wrote: >> * erldtl >> >> Pros: The template notation seems good(I hate and <%...%> :-) >> templates are compiled to erlang modules; >> Cons: not completed yet. > > What is a show-stopper for you about erlydtl? What is not complete > enough for you? > > The features I use, they work well. > > I'm about to get annoyed enough with rebuilding all template modules > each time i run make that i am ready to add something that only builds > the templates that have changed or use dependencies that have changed. > But other than that, it works fine. > I wrote a little gen_server to rebuild template files, maybe you'll be interested in it, below is the usage: hello.yaws: out(Arg) -> M = dtl_server:lookup("path/to/hello.dtl"), {ok, L} = M:render(), {html, L}. Accessing http://your-host/path/to/dtlmake.yaws to rebuild template files that are changed (or their dependencies change) *and* lookuped at least one time. The dtl:lookup/1 will compile the template for the first time. To use this little server, a patch to erlydtl may be required, see attachments for all related files, there is a simple explanation in the patch. Best regards, Liu Yubao -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: erlydtl_compiler.patch URL: -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: dtl_server.erl URL: From ed.stow@REDACTED Wed Feb 4 02:57:30 2009 From: ed.stow@REDACTED (Edward Stow) Date: Wed, 4 Feb 2009 12:57:30 +1100 Subject: [erlang-questions] List Reply to options Message-ID: Hi, Can the default reply to for messages from the list set to the list itself. I have been caught a few times with replies to the OP rather than then list. In my recent exchange on Singleton Processes I have two replies that may be of interest to other beginners. These are now lost to others that may be interested in following the conversation. (I will post these replies back to the list if Bernard and Richard agree.) -- Edward Stow From mog-lists@REDACTED Wed Feb 4 03:32:24 2009 From: mog-lists@REDACTED (Matthew O'Gorman) Date: Tue, 3 Feb 2009 20:32:24 -0600 Subject: [erlang-questions] List Reply to options In-Reply-To: References: Message-ID: <550d55060902031832j25493a3y530f05d9df60843d@mail.gmail.com> On Tue, Feb 3, 2009 at 7:57 PM, Edward Stow wrote: > Hi, > > Can the default reply to for messages from the list set to the list > itself. > Before we have a huge argument on this list again about this can you please search the list where this has been discussed at least twice while I have been on it. Mog -------------- next part -------------- An HTML attachment was scrubbed... URL: From yubao.liu@REDACTED Wed Feb 4 04:10:22 2009 From: yubao.liu@REDACTED (Liu Yubao) Date: Wed, 4 Feb 2009 11:10:22 +0800 Subject: [erlang-questions] The document shipped with erlang otp is inconvenient to lookup In-Reply-To: <50A6BF69-6D02-4248-A8DB-DE87EC8A463B@cs.otago.ac.nz> References: <4987F001.3080907@gmail.com> <50A6BF69-6D02-4248-A8DB-DE87EC8A463B@cs.otago.ac.nz> Message-ID: <7e5dd98f0902031910m43bb6f0cqfb4ecabf5e216e0@mail.gmail.com> On Wed, Feb 4, 2009 at 7:17 AM, Richard O'Keefe wrote: > You're not by any chance a Smalltalk programmer, are you? > That looks a whole lot like the Classic (and well-beloved) > Smalltalk Browser to me. Good idea. > I'm not a Smalltalk programmer indeed :-) I remember some old version Mathematica has such help system, it's very convenient but the newest version Mathematica 7 removes this feature@REDACTED@ Yesterday night I looked the source code of Erlang standard modules, it seems the document of each module isn't generated from the source code, I had thought I could extract document for a function with docbuilder and edoc:-( From yubao.liu@REDACTED Wed Feb 4 04:21:13 2009 From: yubao.liu@REDACTED (Liu Yubao) Date: Wed, 4 Feb 2009 11:21:13 +0800 Subject: [erlang-questions] Is there any erlang code formatting tool? In-Reply-To: <1233644349.4910.4.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> References: <4987E836.2070608@gmail.com> <1233644349.4910.4.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Message-ID: <7e5dd98f0902031921u623fb68xeeaf81b1a5cdd438@mail.gmail.com> Hi, Thank you very much, I should have digged the document more carefully. On Tue, Feb 3, 2009 at 2:59 PM, Bengt Kleberg wrote: > Greetings, > > I have used parts of the Syntax_Tools > (http://erlang.org/doc/apps/syntax_tools/index.html) for Erlang > formatting without Emacs. > For batch processing of files you might want to look at erl_tidy > (http://erlang.org/doc/man/erl_tidy.html). > If you want a tool that takes care of a function in a file, you can talk > to me. > > > bengt > > On Tue, 2009-02-03 at 14:46 +0800, Liu Yubao wrote: >> Hi, >> >> I prefer Vim to edit and Emacs to format erlang code but >> switching between two editors is very inconvenient. Is >> there any erlang code formatting tool? Or how can I use emacs >> to format erlang source files in batch? >> >> The default setting of erlang-mode indent code by tab characters >> and spaces, I prefer four spaces to one tab, how to change the >> setting of erlang-mode to make it indent code with four spaces? >> >> Below is output from vim(et ts=4 sw=4) and emacs(default setting): >> >> ---------------vim, formatted with "gg=G": >> {ehtml, >> {table, [{border, "1"}, {cellpadding, "2"}, {cellspacing, "2"}], >> [{thead, [], >> {tr, [], >> [{th, [], "File path"}, >> {th, [], "Module name"}, >> {th, [], "Last modified time"}, >> {th, [], "Status"}]}}, >> {tbody, [], Rows}]}}. >> >> ----------------emacs: >> {ehtml, >> {table, [{border, "1"}, {cellpadding, "2"}, {cellspacing, "2"}], >> [{thead, [], >> {tr, [], >> [{th, [], "File path"}, >> {th, [], "Module name"}, >> {th, [], "Last modified time"}, >> {th, [], "Status"}]}}, >> {tbody, [], Rows}]}}. >> _______________________________________________ >> 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 vik@REDACTED Wed Feb 4 03:05:32 2009 From: vik@REDACTED (Vik Olliver) Date: Wed, 04 Feb 2009 15:05:32 +1300 Subject: [erlang-questions] YAWS queryvar for empty variables Message-ID: <4988F7EC.2090901@catalyst.net.nz> If a URL with args like: http://.../...&foo=sometext&bar= is passed to queryvar/2, how do I determine that the variable "bar" has been defined and contains an empty list, as opposed to the non-existent variable "cow" that hasn't been defined at all? Vik :v) From vinoski@REDACTED Wed Feb 4 05:12:14 2009 From: vinoski@REDACTED (Steve Vinoski) Date: Tue, 3 Feb 2009 23:12:14 -0500 Subject: [erlang-questions] YAWS queryvar for empty variables In-Reply-To: <4988F7EC.2090901@catalyst.net.nz> References: <4988F7EC.2090901@catalyst.net.nz> Message-ID: <65b2728e0902032012h46989bcchcfe9e7f925ae3d2b@mail.gmail.com> On 2/3/09, Vik Olliver wrote: > If a URL with args like: > > http://.../...&foo=sometext&bar= > > is passed to queryvar/2, how do I determine that the variable "bar" has > been defined and contains an empty list, as opposed to the non-existent > variable "cow" that hasn't been defined at all? Given an #arg record named Arg (as in ), just do this: case lists:keysearch("bar", 1, yaws_api:parse_query(Arg)) of {value, {"bar", Bar}} -> bar_is_present; false -> bar_is_not_present end. If "bar" is present in the query portion of the URI like in the example you've shown, you'll hit the first case and the value of Bar will be the atom undefined. If you instead searched for "cow", which is not present in the URI, it would hit the false case. --steve From bengt.kleberg@REDACTED Wed Feb 4 08:31:43 2009 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 04 Feb 2009 08:31:43 +0100 Subject: [erlang-questions] Emakefile and macro In-Reply-To: <706aa0500902031024j548fafedja3c8cc67c77d4cad@mail.gmail.com> References: <706aa0500902031024j548fafedja3c8cc67c77d4cad@mail.gmail.com> Message-ID: <1233732703.4724.7.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Greetings, Try to change {d,"MY_MACRO", "ITS_VALUE"} to {d,'MY_MACRO', 'ITS_VALUE'} bengt On Tue, 2009-02-03 at 19:24 +0100, David Nonnenmacher wrote: > Hello, > > I would like to compile some erlang files that contains a macro. The > Emakefile has the following contents: > > {"/home/dnonnenm/PROJECTS/lib/my_appli/src/*", > [{i,"/home/dnonnenm/PROJECTS/lib/"}, > {d,"MY_MACRO", "ITS_VALUE"}, > {outdir,"/home/dnonnenm/PROJECTS/lib/my_appli/ebin"}]}. > > The problem is that there is no generated beam. The output command (ie > erl -make) is the following: > > Recompile: /home/dnonnenm/PROJECTS/lib/my_appli/src/module_1 > Recompile: /home/dnonnenm/PROJECTS/lib/my_appli/src/module_2 > Recompile: /home/dnonnenm/PROJECTS/lib/my_appli/src/module_3 > > There are no errors, no warnings. > > I did the same but removing the macro definition (ie {d, ....}), and > there are some beam generated. But I have an error dur to the missing > macro. > > Is this a bug ? or did i write something bad ? > > David > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From ingela@REDACTED Wed Feb 4 08:35:43 2009 From: ingela@REDACTED (Ingela Anderton Andin) Date: Wed, 04 Feb 2009 08:35:43 +0100 Subject: [erlang-questions] SSL: SSL_set_verify callback (Nicola Lugato) In-Reply-To: References: Message-ID: <4989454F.7040407@erix.ericsson.se> Hi! Nicola Lugato wrote: > Hello, could you update me on this issue? > What's the status of the new implementation? (btw, is it the "new_ssl" > explained here http://erlang.org/doc/man/new_ssl.html or something else?) Yes it is the ssl explained there. There will be a new version in in the R13 release sometime in the end of Mars that will include possibilities to do such things that you want. New ssl will still not be a 100 % complete but there will be a possibility to add handling of policy and CRL-list cert extensions yourself if you have critical extensions of that kind. Regards - Ingela Erlang/OTP, Ericsson > > Many thanks, Nicola > On Mon, Jul 28, 2008 at 2:33 PM, Ingela Anderton Andin > > wrote: > > Hi, > > I am not sure that the existing Erlang API towards openssl lets > you get > at this functionallity, however we are working > on a new ssl-implementation, that does not use openssl for > communication only for cryptographics, > where you will be able to do the corresponding. I can not make any > promises regarding when we > can release this but it is in the pipeline and should be ready in > a not > too distant future. There is a beta-version of new ssl in R12B > but you would have to hack it as that functionality is not yet > included > in the API. (That code has also changed quite a lot since the R12B > release) > > Regards - Ingela Erlang/OTP, Ericsson > > > > >>> > > >>> Hello, > > >>> i'm considering porting some code of mine to erlang. It's a > network > > >>> server that uses SSL. > > >>> It makes use of the callback that you can specify on > SSL_set_verify (and > > >>> similar) to check if a peer is allowed to connect, based on > data in its > > >>> certificate. > > >>> > > >>> (see: http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html) > > >>> > > >>> I've checked the documentation of the SSL application in Erlang > > >>> (http://www.erlang.org/doc/apps/ssl/index.html), but i > couldn't find a way > > >>> to supply such a callback. Is it possible? > > >>> This is a fundamental feature of my server so it would be a > blocking > > >>> problem. > > >>> > > >>> Thanks, Nicola > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > From bgustavsson@REDACTED Wed Feb 4 10:59:38 2009 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Wed, 4 Feb 2009 10:59:38 +0100 Subject: [erlang-questions] why can't use anonymous function in escript scripts? In-Reply-To: <4987DDA8.5010404@gmail.com> References: <4987DDA8.5010404@gmail.com> Message-ID: <6672d0160902040159i13864f1bsc035ff9ea3971f3b@mail.gmail.com> On Tue, Feb 3, 2009 at 7:01 AM, Liu Yubao wrote: > Hi, > > `escript a.erl` complains: > escript: exception error: undefined function erl_eval:myfun/0 We will try to fix that in R13A. Meanwhile, you can use the following simple workaround: fun() -> myfun() end > If uncomment the second line, the script works well. It's strange > I can eval "fun io:format/2." in erl shell. > Yes, but that is a completely different thing. You cannot evaluate "fun myfun/0" in the shell: 1> fun myfun/0. ** exception error: undefined function erl_eval:myfun/0 /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From rtrlists@REDACTED Wed Feb 4 10:45:30 2009 From: rtrlists@REDACTED (Robert Raschke) Date: Wed, 4 Feb 2009 09:45:30 +0000 Subject: [erlang-questions] HowTo: Stored Procedure In-Reply-To: <21809763.post@talk.nabble.com> References: <21809763.post@talk.nabble.com> Message-ID: <6a3ae47e0902040145o785a8aa8wfe3b632229f43b4c@mail.gmail.com> On Tue, Feb 3, 2009 at 7:17 PM, marmll wrote: > i must call a stored procedure on a MS SQL Server 2005 database. How can i > do it with erlang ? I have an ODBC Driver installed and everything works > fine. I can make select, insert over param_query but how can i execute an > parameter stored procedure ? a code snip was very nice This an ODBC question rather than an Erlang one. In ODBC you can say: {call storedproc(params)} For example: 19> odbc:sql_query(R1, "{call sp_server_info}"). {selected,["attribute_id","attribute_name", "attribute_value"], [{1,"DBMS_NAME","Microsoft SQL Server"}, {2,"DBMS_VER","Microsoft SQL Server Yukon - 9.00.3042"}, {10,"OWNER_TERM","owner"}, {11,"TABLE_TERM","table"}, etc. Any params have to be given by position, rather than named. I have no idea how in/out params work. Robby From bgustavsson@REDACTED Wed Feb 4 11:10:50 2009 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Wed, 4 Feb 2009 11:10:50 +0100 Subject: [erlang-questions] lists:keyfind as an alternative to lists:keysearch In-Reply-To: References: Message-ID: <6672d0160902040210h5e7d406fk77b8bd9224323495@mail.gmail.com> On Tue, Jan 20, 2009 at 4:15 PM, James Hague wrote: > > I would like to propose the addition of lists:keyfind/3, which is > identical in structure to lists:keysearch/3, except that it returns > either 'false' or the found tuple, with no additional wrapping of the > result. This can be trivially added to the lists module: > > keyfind(K, N, L) -> > case keysearch(K, N, L) of > {_, Tuple} -> Tuple; > X -> X > end. > > But ideally it would be a BIF (like lists:keysearch) to avoid > construction of the tagged tuple. At the moment, association lists > and the "key" functions are one of the best alternatives to > lightweight dictionaries. With this proposed change, they'd be even > lighter weight and simpler to use. We have decided to implement lists:keyfind/3 as a BIF in R13. Its behavior will be exactly as suggested. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bgustavsson@REDACTED Wed Feb 4 11:18:22 2009 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Wed, 4 Feb 2009 11:18:22 +0100 Subject: [erlang-questions] file documentation bug In-Reply-To: <5AE0C655-DCDD-4239-AF9F-EDABF9457BCD@rogvall.se> References: <5AE0C655-DCDD-4239-AF9F-EDABF9457BCD@rogvall.se> Message-ID: <6672d0160902040218n59ffd274o7d2f85db5f4680b9@mail.gmail.com> On Thu, Jan 15, 2009 at 10:57 PM, Tony Rogvall wrote: > Hi. > > I found a small bug in the documentation of file:open/2. > > > It says > > binary > This option can only be used if the raw option is specified as well. > When specified, read operations on the file using the read/2 function > will return binaries rather than lists. > > However the binary option may be used even without the raw option. Thanks! It will be corrected in the documentation for R13A. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bgustavsson@REDACTED Wed Feb 4 11:48:38 2009 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Wed, 4 Feb 2009 11:48:38 +0100 Subject: [erlang-questions] '--' BIF to be used with caution? In-Reply-To: <707529930901130404y5418466bmc375525ef765e615@mail.gmail.com> References: <707529930901130404y5418466bmc375525ef765e615@mail.gmail.com> Message-ID: <6672d0160902040248n4ef30e0cm4e4e0cb718a04349@mail.gmail.com> 2009/1/13 Malcolm Dowse : > Hello, > > I ran into an issue with Erlang the other day. I'm not sure if it's a bug, > but I thought I should warn others. > > I was using '--' to get the difference between two large lists. As expected > it was very slow, but, to my surprise, ERTS became completely unresponsive > for a long time. (Only one CPU was maxed out, and there was still plenty of > memory available.) > > To reproduce (on Ubuntu 7.x, R12B-x), open an Erlang shell and type: > > spawn(fun() -> lists:seq(1,1000000) -- lists:seq(1,1000000,2) end). > > The unresponsiveness seems to be caused by '--' being a BIF. Is there a good > reason for making it a BIF if it's not always an improvement? I suppose it is a BIF because it is an operator (although that is not strictly necessary). Nowadays we always make new BIFs non-blocking ("trapping" as we call it) if they can run for a long time, but we usually only fix old BIFs if there is a real problem in a real application. I have added a warning note to the reference manual and to the documentation for lists:subtract/2. (Will appear in R13A.) /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From otokan@REDACTED Wed Feb 4 13:22:31 2009 From: otokan@REDACTED (Onur Tokan) Date: Wed, 4 Feb 2009 14:22:31 +0200 Subject: [erlang-questions] Message passing via shared memory Message-ID: Hi - I would like to rerise the following discussion: http://www.erlang.org/pipermail/erlang-questions/2006-September/022739.html I'd like to know what's the current status. Stated on 2006, it depends on the erlang implementation, and there is no direct pitfalls if it is encapsulated from the developer. Is there any work in progress to support message passing via shared memory or It's already done. I'm pretty interested in this method, because while memory copying is OK for MPP or clustered environments, its is much slower than memory sharing on SMP environments if you are deailing with certain amount of data. Best Regards, Onur PS: I really like the commercial quality documentation of erlang, but I think It would be great to have one that concentrate on internals of the language like: optimizations, message passing, virtual machine, lightweight processes, garbage collector etc. From bekesa@REDACTED Wed Feb 4 14:09:18 2009 From: bekesa@REDACTED (Andras Georgy Bekes) Date: Wed, 04 Feb 2009 14:09:18 +0100 Subject: [erlang-questions] Message passing via shared memory In-Reply-To: References: Message-ID: <200902041409.18292.bekesa@sch.bme.hu> > I'm pretty interested in this method, because while memory copying is > OK for MPP or clustered environments, its is much slower than memory > sharing on SMP environments if you are deailing with certain amount > of data. Memory sharing is faster only if the number of processors (cores) is small. As the number of cores increases, the environment is getting similar to a cluster. On the long term, going into a shared memory direction is a bad idea I think. Georgy From vychodil.hynek@REDACTED Wed Feb 4 15:03:04 2009 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Wed, 4 Feb 2009 15:03:04 +0100 Subject: [erlang-questions] Message passing via shared memory In-Reply-To: <200902041409.18292.bekesa@sch.bme.hu> References: <200902041409.18292.bekesa@sch.bme.hu> Message-ID: <4d08db370902040603p66df7ce7xa1c2e994208a71d0@mail.gmail.com> I agree with you. I would like mentioned also GC issues which appear even in one core. Current Erlang GC blocks only one process each time and provide soft realtime behavior of Erlang system. IMHO for example SBCL Lisp/Hunchentoot problems at Chart-6 in this blog http://berlinbrowndev.blogspot.com/2008/08/application-server-benchmarks-including.htmlcomes from global GC. See Erlang response time deviation in first table for comparison. If share memory between proceses soft realtime characteristic of GC will gone and/or GC complexity will rise. On Wed, Feb 4, 2009 at 2:09 PM, Andras Georgy Bekes wrote: > > I'm pretty interested in this method, because while memory copying is > > OK for MPP or clustered environments, its is much slower than memory > > sharing on SMP environments if you are deailing with certain amount > > of data. > Memory sharing is faster only if the number of processors (cores) is > small. As the number of cores increases, the environment is getting > similar to a cluster. > > On the long term, going into a shared memory direction is a bad idea I > think. > > Georgy > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try Good Data now for free: www.gooddata.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From ssroy1979@REDACTED Wed Feb 4 15:12:37 2009 From: ssroy1979@REDACTED (Salonee Sinha Roy) Date: Wed, 4 Feb 2009 06:12:37 -0800 Subject: [erlang-questions] erl_publish(port) always returns -1 Message-ID: Hi All I am trying to write a C node and call erl_publish in the C code. However this function always returns -1. I am trying to find the possible reasons for this. Would really appreciate it if someone could educate me on this. My code is below int sockfd; ErlConnect erlc; int fd; int identification_number = 1; int creation=1; char *cookie="cookie"; /* An example */ string errcom; int port = atoi(argv[1]); printf("THe port is %d,",port); try { erl_init(NULL, 0); if (erl_connect_init(identification_number, cookie,creation) == -1) erl_err_quit("erl_connect_init"); //fprintf(stderr, "connected\n"); if ((sockfd = my_listen(PORT)) <= 0) erl_err_quit("error: my_listen"); // fprintf(stderr, "listening\n"); printf("PORT is %d",PORT); if ( erl_publish(PORT) == -1) erl_err_quit("error: publish"); -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Wed Feb 4 15:40:40 2009 From: erlang@REDACTED (Dominic Williams) Date: Wed, 4 Feb 2009 09:40:40 -0500 (EST) Subject: [erlang-questions] Questions about processes and message queues In-Reply-To: <59bbf6e10902030759p44ec370dh5d8e6f5c800647dc@mail.gmail.com> References: <59bbf6e10902030759p44ec370dh5d8e6f5c800647dc@mail.gmail.com> Message-ID: <22362ab747d4c4c903ffbed7c5796080.squirrel@www.geekisp.com> Hello Nicola, > i have some doubt about processes and message queues. > What does happend if a fast process keeps sending messages to a slow > process? Does the queue keeps growing arbitrarly or is there some kind of > limiting mechanism ? If so, how does it work exacly? Have you tried to see what happens if a process sends itself messages and never reads them? In the shell: 1> F = fun (G) -> self() ! hello, G(G) end. #Fun 2> Report = fun (Pid, R) -> io: fwrite ("~p~n", [erlang: process_info (Pid, [memory, message_queue_len])]), timer: sleep (5000), R(Pid, R) end. #Fun 3> Report (spawn (fun () -> F(F) end), Report). [{memory,1316},{message_queue_len,0}] [{memory,361752},{message_queue_len,22433}] [{memory,510536},{message_queue_len,31732}] [{memory,617176},{message_queue_len,38397}] [{memory,705640},{message_queue_len,43926}] [{memory,782744},{message_queue_len,48745}] [{memory,850888},{message_queue_len,53004}] [{memory,912008},{message_queue_len,56824}] [{memory,966408},{message_queue_len,60224}] As you see, the message queue just keeps growing. The language does not allow you to limit the length of the queue. You must design your application in such a way as to have end-to-end flow control. Regards, Dominic Williams http://dominicwilliams.net ---- From Philip.Fennell@REDACTED Wed Feb 4 14:04:02 2009 From: Philip.Fennell@REDACTED (Philip Fennell) Date: Wed, 4 Feb 2009 13:04:02 -0000 Subject: [erlang-questions] HTTP requests and the meaning of eaddrinuse In-Reply-To: <200902012027.n11KRgCY028793@pluto.hedeland.org> References: <498440A3.7070001@softjar.se> <200902012027.n11KRgCY028793@pluto.hedeland.org> Message-ID: Thank you everyone for your input. I must admit that a lot of that was way outside of my area but from what I gather I'm running-out of available ports, and netstat tells me, by its last line of output: > TCP PC-S051049:5000 pal.sandbox.dev.bbc.co.uk:5984 TIME_WAIT That I have 5000 ports in the TIME_WAIT state. I guess that the best way to work-round this issue is to use the batch document creation mode for CouchDB and chunk the data set into thousand or many thousand sets. That way I won't consume the ports at such a fearsome rate. Regards Philip Fennell -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Per Hedeland Sent: 01 February 2009 20:28 To: bqt@REDACTED Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] HTTP requests and the meaning of eaddrinuse Johnny Billquist wrote: > >Per Hedeland wrote: >> >> Yes, that's what you get (on connect()) on all Unices where I have >> seen it, and it does make some amount of sense I think - if there are >> no local ports left, any attempt to form a connection would have to >> use a port that is already "in use". > >Well, I think that it's a flaw in the design of the interface. If you >use port 0 (ask the system to give you a port) you should never get >eaddrinuse. That is sort of guaranteed by the call (the semantic is to >give you a free port). Well, we're talking about connect() here - you're not asking for a free port, you're asking for a connection - just that the stack has to give you a port to establish the connection (unless you have bound the socket, which is "unusual" on connect()). > I wonder if all systems do this, or if different systems have >different "solutions". If noone can tell for other systems than Linux I >guess I'll have to go in and examine the source myself soon. :-) Looking at the FreeBSD kernel code, it seems it will actually return EADDRNOTAVAIL or possibly EAGAIN if it fails to find a "free" port - but will return EADDRINUSE if the chosen port ends up conflicting with a connection in TIME_WAIT. The latter is probably the most common failure case. >You have the sockopt SO_REUSEADDR which circumvents this check. Is it >possible to set that from Erlang? Certainly (read the man page), but I'm not sure how or if it applies to connect() (and can't be bothered to figure out that part of the kernel code:-). It obviously wouldn't make sense to not try to find a "free" port at all if it is set (but it may affect the exact meaning of "free"), and it certainly won't allow a connection that conflicts with an existing one. >> Forgot one that I actually used recently on FreeBSD - it randomizes >> the selection of local port to make spoofing harder, and every now >> and then a test case that did a bunch of localhost connections would >> get the EADDRINUSE. Turning off the randomization (sysctl >> net.inet.ip.portrange.randomized 1 -> 0) made it cycle nicely through >> the available range => problem solved. A quick check on a Linux >> 2.6.20 system doesn't show any such randomization nor reveal a way to >> turn it on or off, but it may well be there somewhere... > >Whoa? It don't actually check that the random port is actually free >before giving it to you??? The check is the same whether randomizing or not, but the probability of hitting one of your own old connections in TIME_WAIT is higher when randomizing is used. But anyway, I think we're getting rather off-topic here, and the original answer of "you're running out of ports" to the original question is probably as good as it gets - I'll shut up now. --Per _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions http://www.bbc.co.uk/ This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated. If you have received it in error, please delete it from your system. Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately. Please note that the BBC monitors e-mails sent or received. Further communication will signify your consent to this. From thomasl_erlang@REDACTED Wed Feb 4 14:53:18 2009 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 4 Feb 2009 05:53:18 -0800 (PST) Subject: [erlang-questions] Questions about processes and message queues In-Reply-To: <59bbf6e10902030759p44ec370dh5d8e6f5c800647dc@mail.gmail.com> Message-ID: <791384.56003.qm@web111409.mail.gq1.yahoo.com> --- On Tue, 2/3/09, Nicola Lugato wrote: > i have some doubt about processes and message queues. > What does happend if a fast process keeps sending messages > to a slow > process? Does the queue keeps growing arbitrarly or is > there some kind of > limiting mechanism ? If so, how does it work exacly? There is no builtin limiting mechanism in Erlang itself. For example, it has traditionally been easy to overwhelm processes receiving trace messages (which can be generated at a high rate). And while recent schedulers prefer to run processes with long message queues, which relieves such problems, you can still mess around with process priorities yourself and force the same problem to appear. Well, there is nature's own rate limiter: node crash. If this is an issue, you will have to design your process communication to have some sort of backstop, and/or tolerate node failures. Best, Thomas From erlang@REDACTED Wed Feb 4 16:13:05 2009 From: erlang@REDACTED (Dominic Williams) Date: Wed, 4 Feb 2009 10:13:05 -0500 (EST) Subject: [erlang-questions] Questions about processes and message queues In-Reply-To: <22362ab747d4c4c903ffbed7c5796080.squirrel@www.geekisp.com> References: <59bbf6e10902030759p44ec370dh5d8e6f5c800647dc@mail.gmail.com> <22362ab747d4c4c903ffbed7c5796080.squirrel@www.geekisp.com> Message-ID: Hello again Nicola, I suggested: > Have you tried to see what happens if a process sends itself > messages and never reads them? In the shell: > > 1> F = fun (G) -> self() ! hello, G(G) end. This version crashes the VM a lot faster, because the messages get bigger and bigger: 1> Fun = fun (M, F) -> F (self () ! [M | M], F) end. #Fun 2> Report = fun (Pid, R) -> io: fwrite ("~p~n", [erlang: process_info (Pid, [memory, message_queue_len])]), timer: sleep (5000), R(Pid, R) end. #Fun 3> Report (spawn (fun () -> Fun ("hello", Fun) end), Report). [{memory,1892},{message_queue_len,0}] [{memory,3174684},{message_queue_len,107349}] [{memory,6921076},{message_queue_len,194185}] ... Regards, Dominic Williams http://dominicwilliams.net From james.hague@REDACTED Wed Feb 4 16:55:37 2009 From: james.hague@REDACTED (James Hague) Date: Wed, 4 Feb 2009 09:55:37 -0600 Subject: [erlang-questions] lists:keyfind as an alternative to lists:keysearch In-Reply-To: <6672d0160902040210h5e7d406fk77b8bd9224323495@mail.gmail.com> References: <6672d0160902040210h5e7d406fk77b8bd9224323495@mail.gmail.com> Message-ID: > We have decided to implement lists:keyfind/3 as a BIF in R13. Wonderful! Now I know this was my original suggestion, and I certainly never expect any or all of my ideas to be hailed as useful enough to be incorporated into Erlang proper, but there does seem to be accelerating progress in regard to smoothing out rough parts of the language and libraries. That's a great thing. From imre@REDACTED Wed Feb 4 17:26:40 2009 From: imre@REDACTED (Imre Palik) Date: Wed, 4 Feb 2009 18:26:40 +0200 Subject: [erlang-questions] Message passing via shared memory Message-ID: <3BE6DBA1F3BE9D4798255806113D5654421594C3FD@utx-exchange.utx.local> > From: Andras Georgy Bekes > >> I'm pretty interested in this method, because while memory copying is >> OK for MPP or clustered environments, its is much slower than memory >> sharing on SMP environments if you are deailing with certain amount >> of data. > Memory sharing is faster only if the number of processors (cores) is > small. As the number of cores increases, the environment is getting > similar to a cluster. Could you explain this? I always had the impression, that because there aren't any variables in erlang, cache issues won't hurt the speed (though it would make the GC more tricky). What am I missing? What would cause the slowdown? I. From francesco@REDACTED Wed Feb 4 18:11:17 2009 From: francesco@REDACTED (Francesco Cesarini) Date: Wed, 4 Feb 2009 17:11:17 +0000 (GMT) Subject: [erlang-questions] Bay Area Erlang Factory Conference 27/4-1/5 Message-ID: <20546813.2241233767477052.JavaMail.root@zimbra> A note to say that we've launched the rebranded Erlang eXchange as the Erlang Factory and are in the process of completing the website. As promised, it is going to be the largest Erlang event ever held on the West Coast, with over 30 talks and tutorials. Book the week of April 27th - May 1st and join us in Palo Alto. We will start with three days of University and wrap up with two days of conference. Courses we will be offering include Erlang, OTP, Quick Check and CouchDB. Conference speakers include Robert Virding, Damien Katz, John Hughes, Ezra Zygmuntowicz, Mickael Remond, Kevin Smith, Ulf Wiger, Richard Carlsson and many many more. Among written Erlang books and Erlang books in the writing, we counted a total of 8 authors among the speakers! Tentative tracks include cool applications, tools and gadgets, Erlang and TDD, Relax with CouchDB, Erlang and IM as well as a non Erlang track for those who have had enough: Give me a break from Erlang! We are adding new speakers and talks (as well as website features) daily. Come by and have a look: http://www.erlang-factory.com As to reduce the traffic on this list, please subscribe to the mailing list on the site to receive news on the latest speakers, talks and features. First in line is the ability to register and pay online. We hope to see you there and make this an even bigger and more successful event than last year's Erlang eXchange. We are also in the process of working on our London dates, and expect to move the event to the end of June. Please sign up to the mailing list also for the London announcments. Francesco & everyone else at ETC -- http://www.erlang-consulting.com From mm@REDACTED Wed Feb 4 19:54:11 2009 From: mm@REDACTED (marmll) Date: Wed, 4 Feb 2009 10:54:11 -0800 (PST) Subject: [erlang-questions] HowTo: Stored Procedure In-Reply-To: <6a3ae47e0902040145o785a8aa8wfe3b632229f43b4c@mail.gmail.com> References: <21809763.post@talk.nabble.com> <6a3ae47e0902040145o785a8aa8wfe3b632229f43b4c@mail.gmail.com> Message-ID: <21836974.post@talk.nabble.com> Robert Raschke-5 wrote: > > On Tue, Feb 3, 2009 at 7:17 PM, marmll wrote: >> i must call a stored procedure on a MS SQL Server 2005 database. How can >> i >> do it with erlang ? I have an ODBC Driver installed and everything works >> fine. I can make select, insert over param_query but how can i execute an >> parameter stored procedure ? a code snip was very nice > > This an ODBC question rather than an Erlang one. In ODBC you can say: > > {call storedproc(params)} > > For example: > > 19> odbc:sql_query(R1, "{call sp_server_info}"). > {selected,["attribute_id","attribute_name", > "attribute_value"], > [{1,"DBMS_NAME","Microsoft SQL Server"}, > {2,"DBMS_VER","Microsoft SQL Server Yukon - 9.00.3042"}, > {10,"OWNER_TERM","owner"}, > {11,"TABLE_TERM","table"}, > etc. > > Any params have to be given by position, rather than named. I have no > idea how in/out params work. > > Robby > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > Hi and thanks for yout help. I need the return parameter from my own stored procedure ! How can i get this value ? Thanks once again -- View this message in context: http://www.nabble.com/HowTo%3A-Stored-Procedure-tp21809763p21836974.html Sent from the Erlang Questions mailing list archive at Nabble.com. From pfisher@REDACTED Wed Feb 4 20:29:07 2009 From: pfisher@REDACTED (Paul Fisher) Date: Wed, 04 Feb 2009 13:29:07 -0600 Subject: [erlang-questions] R12B-5 Help diagnosing erl_exit() from beam/copy.c:180 Message-ID: <4989EC83.9080405@alertlogic.net> We've had an abort raised out of erts_send_message() -> size_object() and I would like to ask for some assistance in troubleshooting it. (I only have a corefile because we run the vm with +d in order to diagnose driver problems from the corefiles.) In particular, I am having trouble understanding how to decode Eterm values, and therefore getting anywhere beyond basic "where it blew up". Is there any description of the encoding beyond pulling apart erl_term.h macros? Some minimal information about the crash context, the message, sender and receiver process information. (gdb) where #0 0x00002ab5b140f07b in raise () from /lib/libc.so.6 #1 0x00002ab5b141084e in abort () from /lib/libc.so.6 #2 0x0000000000442469 in erl_exit (n=-2147483647, fmt=0x5530ad "size_object: bad tag for %#x\n") at beam/erl_init.c:1243 #3 0x0000000000460311 in size_object (obj=6) at beam/copy.c:180 #4 0x000000000047c47a in erts_send_message (sender=0x2aaaaaaae490, receiver=0x2aaaafd18af0, receiver_locks=0x46889f0c, message=46959855828714, flags=0) at beam/erl_message.c:758 #5 0x000000000046ec46 in do_send (p=0x2aaaaaaae490, to=5075, msg=46959855828714, suspend=0) at beam/bif.c:1839 #6 0x000000000046f1c6 in send_2 (p=0x1116, to=4455, msg=6) at beam/bif.c:1915 #7 0x00000000004dae25 in process_main () at beam/beam_emu.c:1385 #8 0x000000000048100f in sched_thread_func (vesdp=) at beam/erl_process.c:752 #9 0x0000000000549f24 in thr_wrapper (vtwd=) at common/ethread.c:474 #10 0x00002ab5b11c6f1a in start_thread () from /lib/libpthread.so.0 #11 0x00002ab5b14a9602 in clone () from /lib/libc.so.6 #12 0x0000000000000000 in ?? () (gdb) up 4 #4 0x000000000047c47a in erts_send_message (sender=0x2aaaaaaae490, receiver=0x2aaaafd18af0, receiver_locks=0x46889f0c, message=46959855828714, flags=0) at beam/erl_message.c:758 758 beam/erl_message.c: No such file or directory. in beam/erl_message.c (gdb) p *sender $4 = {htop = 0x2ab5b1867f08, stop = 0x2ab5b186b590, heap = 0x2ab5b1866568, hend = 0x2ab5b186b628, heap_sz = 2584, min_heap_size = 233, fp_exception = 0, hipe = {nsp = 0x8b0340, nstack = 0x8affd0, nstend = 0x8b03d0, ncallee = 0x49091f84, closure = 2, nstgraylim = 0x0, nstblacklim = 0x8b03d0, ngra = 0, ncsp = 0x46889ed0, narity = 0}, arity = 2, arg_reg = 0x2aaaaaaae530, max_arg_reg = 6, def_arg_reg = {596363, 46959855828642, 46959855828529, 5, 0, 2000}, cp = 0x0, i = 0x2aaaaab8fef0, catches = 3, fcalls = 1989, status = 3, gcstatus = 3, rstatus = 0, rcount = 0, id = 19, prio = 2, skipped = 0, reds = 27697, error_handler = 9227, tracer_proc = 18446744073709551611, trace_flags = 0, group_leader = 467, flags = 1, fvalue = 3275, freason = 16, ftrace = 46959856237457, dist_entry = 0x0, next = 0x0, reg = 0x0, nlinks = 0x2aaaaaaaed40, monitors = 0x2aaab93eaee8, nodes_monitors = 0x0, suspend_monitors = 0x0, msg = {first = 0x0, last = 0x2aaaaaaae620, save = 0x2aaaaaaae620, len = 0}, bif_timers = 0x0, dictionary = 0x0, ct = 0x0, seq_trace_clock = 0, seq_trace_lastcnt = 0, seq_trace_token = 18446744073709551611, initial = {9099, 31307, 2}, current = 0x0, parent = 3, started = {tv_sec = 1233318945, tv_usec = 199426}, high_water = 0x2ab5b1866ad0, old_hend = 0x2ab5b18d3350, old_htop = 0x2ab5b18cbda0, old_heap = 0x2ab5b18cb0a8, gen_gcs = 20, max_gen_gcs = 65535, off_heap = {mso = 0x0, funs = 0x2ab5b1867668, externals = 0x0, overhead = 0}, mbuf = 0x0, mbuf_sz = 0, u = { ptimer = 0x0, exit_data = 0x0}, lock = {flags = {counter = 1}, queues = 0x0, refc = 1}, scheduler_data = 0x2aaaaaaf49c8, is_exiting = 0, scheduler_flags = 1, status_flags = 12, msg_inq = {first = 0x0, last = 0x2aaaaaaae738, len = 0}, suspendee = 18446744073709551611, pending_suspenders = 0x0, pending_exit = {reason = 0, bp = 0x0}, hipe_smp = { have_receive_locks = 0}} (gdb) p *receiver $5 = {htop = 0x2aaaac91e130, stop = 0x2aaaac9252b0, heap = 0x2aaaac91d050, hend = 0x2aaaac9252f8, heap_sz = 4181, min_heap_size = 233, fp_exception = 0, hipe = {nsp = 0x983c70, nstack = 0x983870, nstend = 0x983c70, ncallee = 0x49147218, closure = 5104401, nstgraylim = 0x0, nstblacklim = 0x983c70, ngra = 0, ncsp = 0x45887ed0, narity = 0}, arity = 0, arg_reg = 0x2aaaafd18b90, max_arg_reg = 6, def_arg_reg = {46912528048378, 46912528044250, 42571, 4, 0, 2000}, cp = 0x0, i = 0x2aaaaab916a0, catches = 1, fcalls = 1931, status = 2, gcstatus = 3, rstatus = 0, rcount = 0, id = 5075, prio = 2, skipped = 0, reds = 67415, error_handler = 9227, tracer_proc = 18446744073709551611, trace_flags = 0, group_leader = 5011, flags = 37, fvalue = 46912736747770, freason = 1, ftrace = 46912736747793, dist_entry = 0x0, next = 0x0, reg = 0x2aaaafd3e3d8, nlinks = 0x2aaaaaed2748, monitors = 0x2aaab93eaf30, nodes_monitors = 0x7861a8, suspend_monitors = 0x0, msg = {first = 0x0, last = 0x2aaaafd18c80, save = 0x2aaaafd18c80, len = 0}, bif_timers = 0x0, dictionary = 0x7ad200, ct = 0x0, seq_trace_clock = 0, seq_trace_lastcnt = 0, seq_trace_token = 18446744073709551611, initial = {114955, 128139, 5}, current = 0x0, parent = 5043, started = {tv_sec = 1233318946, tv_usec = 488602}, high_water = 0x2aaaac91d708, old_hend = 0x2aaab90399a8, old_htop = 0x2aaab9026690, old_heap = 0x2aaab9017030, gen_gcs = 8, max_gen_gcs = 65535, off_heap = {mso = 0x2aaaac91ddf0, funs = 0x2aaaac91d130, externals = 0x0, overhead = 12}, mbuf = 0x0, mbuf_sz = 0, u = {ptimer = 0x0, exit_data = 0x0}, lock = {flags = { counter = 12}, queues = 0x0, refc = 1}, scheduler_data = 0x0, is_exiting = 0, scheduler_flags = 0, status_flags = 4, msg_inq = { first = 0x0, last = 0x2aaaafd18d98, len = 0}, suspendee = 18446744073709551611, pending_suspenders = 0x0, pending_exit = { reason = 0, bp = 0x0}, hipe_smp = {have_receive_locks = 0}} -- paul From joe@REDACTED Wed Feb 4 22:56:37 2009 From: joe@REDACTED (Joe Williams) Date: Wed, 04 Feb 2009 13:56:37 -0800 Subject: [erlang-questions] Erlounge Seattle This Week. In-Reply-To: <49872160.7040807@joetify.com> References: <49872160.7040807@joetify.com> Message-ID: <498A0F15.4040109@joetify.com> Just a friendly reminder of the Seattle Erlounge tonight. Hope to see you there. -joe Joe Williams wrote: > Erlounge Seattle (http://erloungeseattle.org/) is coming up again this week. > > 7pm, Feb 4th 2009 @ Vivace Cafe > 550 East Broadway Seattle, WA, 98102 > > See you there! > > -Joe > > > > -- Name: Joseph A. Williams Email: joe@REDACTED Blog: http://www.joeandmotorboat.com/ From dnonnenm@REDACTED Wed Feb 4 22:57:15 2009 From: dnonnenm@REDACTED (David Nonnenmacher) Date: Wed, 4 Feb 2009 22:57:15 +0100 Subject: [erlang-questions] Emakefile and macro In-Reply-To: <1233732703.4724.7.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> References: <706aa0500902031024j548fafedja3c8cc67c77d4cad@mail.gmail.com> <1233732703.4724.7.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Message-ID: <706aa0500902041357o238003d2x2bfd477263f9101b@mail.gmail.com> Hello Bengt, It works better now using atom, thank you for your help. David 2009/2/4 Bengt Kleberg > Greetings, > > Try to change {d,"MY_MACRO", "ITS_VALUE"} to {d,'MY_MACRO', 'ITS_VALUE'} > > > bengt > > On Tue, 2009-02-03 at 19:24 +0100, David Nonnenmacher wrote: > > Hello, > > > > I would like to compile some erlang files that contains a macro. The > > Emakefile has the following contents: > > > > {"/home/dnonnenm/PROJECTS/lib/my_appli/src/*", > > [{i,"/home/dnonnenm/PROJECTS/lib/"}, > > {d,"MY_MACRO", "ITS_VALUE"}, > > {outdir,"/home/dnonnenm/PROJECTS/lib/my_appli/ebin"}]}. > > > > The problem is that there is no generated beam. The output command (ie > > erl -make) is the following: > > > > Recompile: /home/dnonnenm/PROJECTS/lib/my_appli/src/module_1 > > Recompile: /home/dnonnenm/PROJECTS/lib/my_appli/src/module_2 > > Recompile: /home/dnonnenm/PROJECTS/lib/my_appli/src/module_3 > > > > There are no errors, no warnings. > > > > I did the same but removing the macro definition (ie {d, ....}), and > > there are some beam generated. But I have an error dur to the missing > > macro. > > > > Is this a bug ? or did i write something bad ? > > > > David > > _______________________________________________ > > 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 ok@REDACTED Thu Feb 5 01:38:24 2009 From: ok@REDACTED (Richard O'Keefe) Date: Thu, 5 Feb 2009 13:38:24 +1300 Subject: [erlang-questions] '--' BIF to be used with caution? In-Reply-To: <6672d0160902040248n4ef30e0cm4e4e0cb718a04349@mail.gmail.com> References: <707529930901130404y5418466bmc375525ef765e615@mail.gmail.com> <6672d0160902040248n4ef30e0cm4e4e0cb718a04349@mail.gmail.com> Message-ID: L1 -- L2 *could* be implemented to run in O(|L1| + |L2|) (expected) time, by building a hash table from L2, then walking over L1. If that's not done (for sufficiently large inputs, anyway), it's a performance disaster waiting to happen, and we'd probably be better off without it. From kunthar@REDACTED Thu Feb 5 01:59:01 2009 From: kunthar@REDACTED (Kunthar) Date: Thu, 5 Feb 2009 02:59:01 +0200 Subject: [erlang-questions] Best approach for servers Message-ID: <9a09ca9a0902041659x73deba45rded57d7ca1cd8260@mail.gmail.com> Hi all, We have 5 of http://tinyurl.com/565gm2 and 6 of http://tinyurl.com/b7vuvm those models in our DC. My question is, in production how we should setup the erlang nodes? One huge server and individual erlang nodes started? (seems reasonable) Or VM's separated and ever y single vm node runs one erlang instance? For mnesia, what about data access? One large data array mounted to same entry like /data? Peace Kunth From dj3vande@REDACTED Thu Feb 5 04:31:05 2009 From: dj3vande@REDACTED (dj3vande@REDACTED) Date: Wed, 4 Feb 2009 22:31:05 -0500 (EST) Subject: [erlang-questions] Message passing via shared memory In-Reply-To: <3BE6DBA1F3BE9D4798255806113D5654421594C3FD@utx-exchange.utx.local> from "Imre Palik" at Feb 04, 2009 06:26:40 PM Message-ID: <200902050331.TAA29607@eskimo.com> Somebody claiming to be Imre Palik wrote: > > > From: Andras Georgy Bekes > > > >> I'm pretty interested in this method, because while memory copying is > >> OK for MPP or clustered environments, its is much slower than memory > >> sharing on SMP environments if you are deailing with certain amount > >> of data. > > Memory sharing is faster only if the number of processors (cores) is > > small. As the number of cores increases, the environment is getting > > similar to a cluster. > > Could you explain this? I always had the impression, that because > there aren't any variables in erlang, cache issues won't hurt the speed > (though it would make the GC more tricky). What am I missing? What > would cause the slowdown? Inter-core memory access would run up against latency and bandwidth restrictions pretty quickly if you don't arrange your access patterns carefully. Accesses to shared memory have more costs than just cache coherency on updates. (Especially with a GC that needs to resolve non-local references while collecting.) If the individual cores are busy enough, cache pressure is also likely to become a problem. (If you make your caches big enough to store all the data that the nearby cores will need, you've just reinvented copying, and you still need to deal with coherency for any bookkeeping the GC needs to do.) One possible intermediate strategy is to take advantage of a shared address space and do lazy copying: Sending a message to a process just gives it a reference, and if the object is too far away on access, a local copy is made. A sufficiently clever implementation of this would keep track of where all the copies of a particular object are, so if a reference is sent to a distant node that already has a local copy, the local copy can be used instead of making another copy.[1] (I have no idea whether this would actually provide enough benefit to be worth implementing, but it'd be interesting to hear expert opinions. The big problem with doing things this way would be latency of the copy-on-access; if there wasn't some way to hide the latency, it would need a fairly good prefetching strategy.) dave [1] I inadvertently constructed an excellent test case for this kind of smart copying recently: -------- loop(Last,Prev) -> receive stop -> ok; {next,Pid} -> Next = {Last,Prev}, Pid ! Next, loop(Next,Last) end. -------- This is a slightly simplified version of code I wrote for . The Erlang program (with a deep copy on the send) ground to a halt after consuming all the available memory before it finished the computation; re-implementing it in C (where I had control over reference vs. copying) gave me a much smaller and faster program. (I hastily revised my mental model of how Erlang manages memory shortly thereafter.) -- Dave Vandervies dj3vande@REDACTED Plan your future! Make God laugh! From fritchie@REDACTED Thu Feb 5 07:58:35 2009 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Thu, 05 Feb 2009 00:58:35 -0600 Subject: [erlang-questions] Singleton Process In-Reply-To: Message of "Tue, 03 Feb 2009 20:31:46 +1100." Message-ID: <12413.1233817115@snookles.snookles.com> Edward Stow wrote: eb> However, I would like to know if this is how you would produce a eb> counter object that returns an incrementally increasing value. Edward, a suggestion. Assuming there's no need for the counter to grow by exactly 1 each time, and that skipping some values is OK, then ... why bother updating the "next_id.dat" file each time? Why not update it very Nth time, e.g. every 100 or 7000 times? If the process crashes, it'll restart and start handing out values based on "next_id.dat" anyway. If you think disk/network/Mnesia/Amazon S3/whatever is going to be too slow, then at some interval before you reach N, spawn a proc to update it asynchronously. (Bonus: allow only one of them at a time, to avoid icky race conditions.) -Scott From bgustavsson@REDACTED Thu Feb 5 08:17:21 2009 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Thu, 5 Feb 2009 08:17:21 +0100 Subject: [erlang-questions] R12B-5 Help diagnosing erl_exit() from beam/copy.c:180 In-Reply-To: <4989EC83.9080405@alertlogic.net> References: <4989EC83.9080405@alertlogic.net> Message-ID: <6672d0160902042317i266bc7d9ra95aace13b33a8e2@mail.gmail.com> On Wed, Feb 4, 2009 at 8:29 PM, Paul Fisher wrote: > We've had an abort raised out of erts_send_message() -> size_object() > and I would like to ask for some assistance in troubleshooting it. (I > only have a corefile because we run the vm with +d in order to diagnose > driver problems from the corefiles.) > > In particular, I am having trouble understanding how to decode Eterm > values, and therefore getting anywhere beyond basic "where it blew up". > Is there any description of the encoding beyond pulling apart > erl_term.h macros? There is a file with gdb macros include in the source distribution of Erlang/OTP. The file is named etp-commands and is found in the erts/etc/unix directory. Use the source command inside gdb to source the file. The etp-help command will give some hints to get started. Use the etp command to decode and display tagged Erlang terms. If the current stack frame is process_main() in beam_emu.c (#7 in your listing), 'etp I' will print the name of the current module and function, and 'etp-stacktrace c_p' will show the complete call chain. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bgustavsson@REDACTED Thu Feb 5 08:36:36 2009 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Thu, 5 Feb 2009 08:36:36 +0100 Subject: [erlang-questions] '--' BIF to be used with caution? In-Reply-To: References: <707529930901130404y5418466bmc375525ef765e615@mail.gmail.com> <6672d0160902040248n4ef30e0cm4e4e0cb718a04349@mail.gmail.com> Message-ID: <6672d0160902042336l1476b632wb487134b507524da@mail.gmail.com> On Thu, Feb 5, 2009 at 1:38 AM, Richard O'Keefe wrote: > L1 -- L2 > *could* be implemented to run in O(|L1| + |L2|) (expected) time, > by building a hash table from L2, then walking over L1. Yes, we might do that one day. > If that's not done (for sufficiently large inputs, anyway), > it's a performance disaster waiting to happen, > and we'd probably be better off without it. Yes, we would be better without it, but it has been there since the R1 release, so it is a little bit late to remove it now. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From rtrlists@REDACTED Thu Feb 5 10:26:21 2009 From: rtrlists@REDACTED (Robert Raschke) Date: Thu, 5 Feb 2009 09:26:21 +0000 Subject: [erlang-questions] HowTo: Stored Procedure In-Reply-To: <21836974.post@talk.nabble.com> References: <21809763.post@talk.nabble.com> <6a3ae47e0902040145o785a8aa8wfe3b632229f43b4c@mail.gmail.com> <21836974.post@talk.nabble.com> Message-ID: <6a3ae47e0902050126y374de34btfc8486d93de935dc@mail.gmail.com> On Wed, Feb 4, 2009 at 6:54 PM, marmll wrote: > Hi and thanks for yout help. I need the return parameter from my own stored > procedure ! How can i get this value ? Hmm, I haven't checked the code, but my guess is that the Erlang odbc lib needs a result set to return values. So, you could try and change your stored proc to return a result set (i.e., end with a select). Or maybe something with ? params ({? = call sp})? Sorry, don't know any more and can't try anything at the moment. I remember the odbc lib code to be very straightforward, might be worth to have a quick read. Robby From colm.dougan@REDACTED Thu Feb 5 14:10:36 2009 From: colm.dougan@REDACTED (Colm Dougan) Date: Thu, 5 Feb 2009 13:10:36 +0000 Subject: [erlang-questions] Adding the mochinum functions to erlang Message-ID: <24d4f39c0902050510u79064973o5e198eb87eb06e96@mail.gmail.com> Hi, I find Bob Ippolito's mochinum module to be very useful : http://mochiweb.googlecode.com/svn/trunk/src/mochinum.erl Particularly when representing floats as strings, as detailed here : http://bob.pythonmac.org/archives/2007/12/17/printing-floats-with-erlang/ I also notice that the source file or beam, or some code based on it gets duplicated in a lot of open source projects. I think it would be useful to add these functions to erlang itself. What do other people think? Colm From bekesa@REDACTED Thu Feb 5 12:05:59 2009 From: bekesa@REDACTED (Andras Georgy Bekes) Date: Thu, 05 Feb 2009 12:05:59 +0100 Subject: [erlang-questions] Message passing via shared memory In-Reply-To: <3BE6DBA1F3BE9D4798255806113D5654421594C3FD@utx-exchange.utx.local> References: <3BE6DBA1F3BE9D4798255806113D5654421594C3FD@utx-exchange.utx.local> Message-ID: <200902051205.59593.bekesa@sch.bme.hu> > > Memory sharing is faster only if the number of processors (cores) > > is small. As the number of cores increases, the environment is > > getting similar to a cluster. > Could you explain this? I always had the impression, that because > there aren't any variables in erlang, cache issues won't hurt the > speed (though it would make the GC more tricky). What am I missing? > What would cause the slowdown? Well, I am not an expert in this topic, so my thoughts might be wrong, but my impression is that inter-core communication should not be done through the main memory (on a many-core processor). Consider two (Erlang) processes running on two different cores on a manycore, sending messages to each other. Assuming that they don't share the L2 (or L3 or L4 or... cache), their communication goes through main memory i.e. when they send a message with memory-sharing, the memory area containing the message will eventually be pushed to main memory. I think manycore processors will have some kind of inter-core communication network (the TILE64 has), which should be utilized when sending messages between processes running on different cores. This is what I meant by "similar to a cluster". Now if you use the shared-memory message passing approach, the processor might use the inter-core network to copy the message directly from the cache of one core to another (this is what the TILE64 does I think with its "virtual L3 cache which is an aggregate of all the L2 caches"), but your message is copied eventually. So if it is copied anyways, why implement message sharing that makes GCing difficult and, as the number of cores increases, slower and slower. Yes, I ended up in the only problem of a less efficient GC. Note that what the current Erlang VM does is not what I've descibed above. It's what it should do on a manycore. Hope the Erlang VM guys will share their thoughts on this topic. To answer someone else's question, this is only true for small messages. For really large messages, it might be better to share them, and copy only the actually used parts on-demand to the other core's cache, but if the whole message is used by the recipient, you end up with copying the message anyways and the only advantage is that you saved some space in the main memory (in the nearest common cache). Georgy From malcolm@REDACTED Thu Feb 5 15:30:02 2009 From: malcolm@REDACTED (Malcolm Dowse) Date: Thu, 5 Feb 2009 14:30:02 +0000 Subject: [erlang-questions] '--' BIF to be used with caution? In-Reply-To: <6672d0160902040248n4ef30e0cm4e4e0cb718a04349@mail.gmail.com> References: <707529930901130404y5418466bmc375525ef765e615@mail.gmail.com> <6672d0160902040248n4ef30e0cm4e4e0cb718a04349@mail.gmail.com> Message-ID: <707529930902050630l250a8ae4nedbfa71e5d63460e@mail.gmail.com> > > > The unresponsiveness seems to be caused by '--' being a BIF. Is there a > good > > reason for making it a BIF if it's not always an improvement? > > I suppose it is a BIF because it is an operator (although that is not > strictly necessary). > Nowadays we always make new BIFs non-blocking ("trapping" as we call it) if > they > can run for a long time, but we usually only fix old BIFs if there is > a real problem in a real > application. > > I have added a warning note to the reference manual and to the > documentation > for lists:subtract/2. (Will appear in R13A.) I don't mind too much if '--' remains O(N^2). But the fact that it made ERTS unresponsive is more of a worry, to me, because this seemed to go against the spirit of the language. I my case, I knew that my algorithm was fairly brutal, but I thought to myself "Ah, it will only take a few minutes, and I'll execute it in a background process, so it will be OK". Personally, I have no problem with this being left as a "known issue" for the time being. But maybe that's just because I now know about it. :-) Malcolm > > > /Bjorn > > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB > > ______________________________________________________________________ > This email has been scanned by the MessageLabs Email Security System. > For more information please visit http://www.messagelabs.com/email > ______________________________________________________________________ > -------------- next part -------------- An HTML attachment was scrubbed... URL: From colm.dougan@REDACTED Thu Feb 5 15:34:35 2009 From: colm.dougan@REDACTED (Colm Dougan) Date: Thu, 5 Feb 2009 14:34:35 +0000 Subject: [erlang-questions] Adding the mochinum functions to erlang In-Reply-To: <24d4f39c0902050510u79064973o5e198eb87eb06e96@mail.gmail.com> References: <24d4f39c0902050510u79064973o5e198eb87eb06e96@mail.gmail.com> Message-ID: <24d4f39c0902050634y142124d4ud80d5ecda11dc1ac@mail.gmail.com> On Thu, Feb 5, 2009 at 1:10 PM, Colm Dougan wrote: > Hi, > > I find Bob Ippolito's mochinum module to be very useful : .... > > I think it would be useful to add these functions to erlang itself. > What do other people think? It has been pointed out to me that the following is in the 12B-2 changes file : OTP-7084 The functions io_lib:write/1,2 and io_lib:print/1,4 have been changed when it comes to writing floating point numbers. This change affects the control sequences p, P, w, and W of the io_lib module. (Thanks to Bob Ippolito for code contribution.) So perhaps these functions are effectively in the core? Colm From vychodil.hynek@REDACTED Thu Feb 5 17:00:01 2009 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Thu, 5 Feb 2009 17:00:01 +0100 Subject: [erlang-questions] Emakefile and macro In-Reply-To: <1233732703.4724.7.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> References: <706aa0500902031024j548fafedja3c8cc67c77d4cad@mail.gmail.com> <1233732703.4724.7.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Message-ID: <4d08db370902050800m18ecfb83i900d4e8ed09ae576@mail.gmail.com> On Wed, Feb 4, 2009 at 8:31 AM, Bengt Kleberg wrote: > Greetings, > > Try to change {d,"MY_MACRO", "ITS_VALUE"} to {d,'MY_MACRO', 'ITS_VALUE'} > Value can be string or any erlang term. > > > bengt > > On Tue, 2009-02-03 at 19:24 +0100, David Nonnenmacher wrote: > > Hello, > > > > I would like to compile some erlang files that contains a macro. The > > Emakefile has the following contents: > > > > {"/home/dnonnenm/PROJECTS/lib/my_appli/src/*", > > [{i,"/home/dnonnenm/PROJECTS/lib/"}, > > {d,"MY_MACRO", "ITS_VALUE"}, > > {outdir,"/home/dnonnenm/PROJECTS/lib/my_appli/ebin"}]}. > > > > The problem is that there is no generated beam. The output command (ie > > erl -make) is the following: > > > > Recompile: /home/dnonnenm/PROJECTS/lib/my_appli/src/module_1 > > Recompile: /home/dnonnenm/PROJECTS/lib/my_appli/src/module_2 > > Recompile: /home/dnonnenm/PROJECTS/lib/my_appli/src/module_3 > > > > There are no errors, no warnings. > > > > I did the same but removing the macro definition (ie {d, ....}), and > > there are some beam generated. But I have an error dur to the missing > > macro. > > > > Is this a bug ? or did i write something bad ? > > > > David > > _______________________________________________ > > 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 > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try Good Data now for free: www.gooddata.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From chandrashekhar.mullaparthi@REDACTED Thu Feb 5 17:33:26 2009 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Thu, 5 Feb 2009 16:33:26 +0000 Subject: [erlang-questions] Erlang emacs mode update for -type and -spec? Message-ID: Hi, Does anyone have an update to the Emacs erlang mode to colour the -type and -spec declarations differently. When used a lot, they are making it slightly harder to read the code. ta, Chandru -------------- next part -------------- An HTML attachment was scrubbed... URL: From exta7@REDACTED Fri Feb 6 00:32:29 2009 From: exta7@REDACTED (Zvi) Date: Thu, 5 Feb 2009 15:32:29 -0800 (PST) Subject: [erlang-questions] Singleton Process In-Reply-To: <498814EF.7060203@m5net.com> References: <498814EF.7060203@m5net.com> Message-ID: <21863642.post@talk.nabble.com> Bernard Duggan-2 wrote: > > Hi Edward, > Your code is a pretty reasonable attempt at a basic implementation (and > I don't mean that in any derogatory or rude sense - much of my code from > not very long ago follows a similar pattern). > The most obvious problem I can see with it is the race condition in > start() - if two processes call next_id() at the same time, they could > both call whereis(counter) and receive 'undefined' as the response - > they'd both then try to spawn and register the process, Hi, Bernard what's your suggested workarround for this problem? I think the calls to whereis must be serialized in some way... Zvi -- View this message in context: http://www.nabble.com/Singleton-Process-tp21806559p21863642.html Sent from the Erlang Questions mailing list archive at Nabble.com. From bernie@REDACTED Fri Feb 6 00:36:28 2009 From: bernie@REDACTED (Bernard Duggan) Date: Fri, 06 Feb 2009 10:36:28 +1100 Subject: [erlang-questions] Deleting from a duplicate_bag ets table In-Reply-To: <4977A37E.3010600@m5net.com> References: <4977A37E.3010600@m5net.com> Message-ID: <498B77FC.2030602@m5net.com> Bernard Duggan wrote: > ...If I have an ets table of type duplicate_bag, and I put > two of the same item in it, how do I delete just one of them? > Since no answers have been forthcoming, I'm going to assume that there is no one-step way to do this at present. In which case... > ...might I suggest adding a ets:select_delete/3, in the same > style as ets:select/3? The function I'm envisaging is essentially: ets:select_delete(Tab, MatchSpec, Limit) -> NumDeleted which behaves identically to ets:select_delete/2, but deletes a maximum of Limit items. I guess an analogous function should probably be added for dets as well. Cheers, Bernard From bernie@REDACTED Fri Feb 6 00:59:20 2009 From: bernie@REDACTED (Bernard Duggan) Date: Fri, 06 Feb 2009 10:59:20 +1100 Subject: [erlang-questions] Singleton Process In-Reply-To: <21863642.post@talk.nabble.com> References: <498814EF.7060203@m5net.com> <21863642.post@talk.nabble.com> Message-ID: <498B7D58.2080402@m5net.com> Zvi wrote: > Bernard Duggan-2 wrote: > >> Hi Edward, >> Your code is a pretty reasonable attempt at a basic implementation (and >> I don't mean that in any derogatory or rude sense - much of my code from >> not very long ago follows a similar pattern). >> The most obvious problem I can see with it is the race condition in >> start() - if two processes call next_id() at the same time, they could >> both call whereis(counter) and receive 'undefined' as the response - >> they'd both then try to spawn and register the process, >> > > Hi, Bernard > > what's your suggested workarround for this problem? > I think the calls to whereis must be serialized in some way... > > Zvi > Hi Zvi, The simple answer is, if you know you're going to need one and only one, to explicitly start it at the beginning of your app, before you start up anything that might use it, rather than trying to have it lazily started on first use. Besides fixing the race condition, this also simplifies the code a little. Remember that erlang processes are very cheap, so the cost of starting up one a while before it actually gets used is negligible. Cheers, Beranrd From taum.xd@REDACTED Fri Feb 6 02:27:23 2009 From: taum.xd@REDACTED (Thomas Brian) Date: Fri, 6 Feb 2009 02:27:23 +0100 Subject: [erlang-questions] sinan build fails: internal error in beam_asm Message-ID: <9b5143660902051727q72de168cic00025a2f73367c6@mail.gmail.com> Hi, I'm trying to get a little bit more familiar with Erlang, and so far have only done the very basics: playing with the shell, writing a basic network server with gen_tcp and gen_server, etc. I am now interested in Sinan to help me build a bigger app. I started with sinan gen which builds what looks like a sensible template to me. But sinan build fails to compile anything : $ sinan build [build] start [build] Building /Users/Taum/Documents/Erlang/testapp/lib/foo/src/foo_sup.erl [build] /Users/Taum/Documents/Erlang/testapp/lib/foo/src/foo_sup.erl:none:error:internal error in beam_asm; crash reason: {{badmatch,{error,enoent}}, [{filename,absname,1}, {compile,beam_asm,1}, {compile,'-internal_comp/4-anonymous-1-',2}, {compile,fold_comp,3}, {compile,internal_comp,4}, {compile,internal,3}]} On a side note, I'm also having a very hard time finding basic documentation about how to manage an app in Erlang/OTP: how to get started, run it, etc. Are there any good ressources out there I might have overlooked ? Cheers, Thomas -------------- next part -------------- An HTML attachment was scrubbed... URL: From carnildo@REDACTED Fri Feb 6 03:50:22 2009 From: carnildo@REDACTED (Mark Wagner) Date: Thu, 5 Feb 2009 18:50:22 -0800 Subject: [erlang-questions] beginner: Generating a list of prime numbers Message-ID: <31073ef90902051850h2377c242s9f25d39ff47c6166@mail.gmail.com> As a way of learning the basics of Erlang, I'm solving various problems from Project Euler (http://projecteuler.net/). Problem #10 involves generating a list of prime numbers. The naive solution to this is to generate a list of numbers and test each of them individually to see if it's prime; a more sophisticated solution uses the list of primes already found to speed up the testing. My code for the sophisticated solution is: is_prime(PrimesSoFar, Candidate) -> not lists:any(fun(X) -> Candidate rem X =:= 0 end, PrimesSoFar). list_primes(PrimesSoFar, Max, Candidate) when (Candidate > Max) -> PrimesSoFar; list_primes(PrimesSoFar, Max, Candidate) -> case is_prime(PrimesSoFar, Candidate) of true -> list_primes([Candidate|PrimesSoFar], Max, Candidate + 2); false -> list_primes(PrimesSoFar, Max, Candidate + 2) end. list_primes(N) when N < 2 -> []; list_primes(2) -> [2]; list_primes(N) -> list_primes([2], N, 3). The problem with this is that the list of prime numbers is ordered largest-first, so that the small primes (the ones most likely to be factors of a given number) are tested last. This makes the sophisticated solution slower than the naive one, which tests small factors first. Any suggestions on how to fix this? -- Mark Wagner From sand@REDACTED Fri Feb 6 05:03:36 2009 From: sand@REDACTED (sand@REDACTED) Date: Thu, 5 Feb 2009 20:03:36 -0800 Subject: [erlang-questions] Erlang emacs mode update for -type and -spec? In-Reply-To: References: Message-ID: <18827.46744.75715.372555@priss.frightenedpiglet.com> Chandru writes: > Does anyone have an update to the Emacs erlang mode to colour the -type and > -spec declarations differently. When used a lot, they are making it slightly > harder to read the code. More generally: * Who maintains erlang.el? * Is 2.5.2 the latest version? * How can we submit patches? * How far back does compatibility need to extend? I have a fix against 2.5.2 for "erlang-get-function-arrow" such that it won't match arrows in strings and comments. Erlang's major mode should also run "after-change-major-mode-hook", but it doesn't. Derek -- Derek Upham sand@REDACTED From mpalmer@REDACTED Fri Feb 6 07:18:08 2009 From: mpalmer@REDACTED (Matthew Palmer) Date: Fri, 6 Feb 2009 17:18:08 +1100 Subject: [erlang-questions] beginner: Generating a list of prime numbers In-Reply-To: <31073ef90902051850h2377c242s9f25d39ff47c6166@mail.gmail.com> References: <31073ef90902051850h2377c242s9f25d39ff47c6166@mail.gmail.com> Message-ID: <20090206061808.GQ11448@hezmatt.org> On Thu, Feb 05, 2009 at 06:50:22PM -0800, Mark Wagner wrote: > As a way of learning the basics of Erlang, I'm solving various > problems from Project Euler (http://projecteuler.net/). Well, that's kinda spooky -- so am I. > Problem #10 > involves generating a list of prime numbers. The naive solution to > this is to generate a list of numbers and test each of them > individually to see if it's prime; a more sophisticated solution uses > the list of primes already found to speed up the testing. My code for > the sophisticated solution is: > > is_prime(PrimesSoFar, Candidate) -> not lists:any(fun(X) -> Candidate > rem X =:= 0 end, PrimesSoFar). > > list_primes(PrimesSoFar, Max, Candidate) when (Candidate > Max) -> PrimesSoFar; > list_primes(PrimesSoFar, Max, Candidate) -> > case is_prime(PrimesSoFar, Candidate) of > true -> list_primes([Candidate|PrimesSoFar], Max, Candidate + 2); > false -> list_primes(PrimesSoFar, Max, Candidate + 2) > end. > > list_primes(N) when N < 2 -> []; > list_primes(2) -> [2]; > list_primes(N) -> list_primes([2], N, 3). > > The problem with this is that the list of prime numbers is ordered > largest-first, so that the small primes (the ones most likely to be > factors of a given number) are tested last. This makes the > sophisticated solution slower than the naive one, which tests small > factors first. Any suggestions on how to fix this? You could use lists:reverse a couple of times to append the new value to the end of the list, like so: list_primes(lists:reverse([Candidate|lists:reverse(PrimesSoFar)])), ...); You can also optimise a little further by only doing primality checking for primes less than or equal to sqrt(Candidate), since if there's a factor F greater than sqrt(Candidate) there must also be one less than it (Candidate div F). For that to work, of course, you'd need to re-order your list to be smallest first, and not use lists:any, but rather your own list-walking function, to do the testing. BTW, isn't Erlang a *good* language to do this sort of thing in? I'm loving it, myself -- trivial to debug things, and the problems solve themselves so quick (I'm fairly sure that I'm writing these Euler problems quicker than I would in Ruby, my current favourite language). - Matt From adam@REDACTED Fri Feb 6 08:15:16 2009 From: adam@REDACTED (Adam Lindberg) Date: Fri, 6 Feb 2009 07:15:16 +0000 (GMT) Subject: [erlang-questions] Erlang emacs mode update for -type and -spec? In-Reply-To: <18827.46744.75715.372555@priss.frightenedpiglet.com> Message-ID: <24072882.5011233904516947.JavaMail.root@zimbra> The Erlware Mode is a bugfixed / updated version I've been using a lot. Contains a lot of useful fixes for indentation and syntax highlighting etc. I don't know if they've incorporated the -spec and -type highlights though. http://code.google.com/p/erlware-mode/ Cheers, Adam ----- sand@REDACTED wrote: > Chandru writes: > > Does anyone have an update to the Emacs erlang mode to colour the > -type and > > -spec declarations differently. When used a lot, they are making it > slightly > > harder to read the code. > > More generally: > > * Who maintains erlang.el? > * Is 2.5.2 the latest version? > * How can we submit patches? > * How far back does compatibility need to extend? > > I have a fix against 2.5.2 for "erlang-get-function-arrow" such that > it > won't match arrows in strings and comments. Erlang's major mode > should > also run "after-change-major-mode-hook", but it doesn't. > > Derek > > -- > Derek Upham > sand@REDACTED > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From per@REDACTED Fri Feb 6 09:02:17 2009 From: per@REDACTED (Per Hedeland) Date: Fri, 6 Feb 2009 09:02:17 +0100 (CET) Subject: [erlang-questions] HTTP requests and the meaning of eaddrinuse In-Reply-To: Message-ID: <200902060802.n1682Hot010521@pluto.hedeland.org> "Philip Fennell" wrote: > >I must admit that a lot of that was way outside of my area but from what >I gather I'm running-out of available ports, and netstat tells me, by >its last line of output: > >> TCP PC-S051049:5000 pal.sandbox.dev.bbc.co.uk:5984 >TIME_WAIT > >That I have 5000 ports in the TIME_WAIT state. Unless netstat output on Windows is radically different from *nix, it doesn't mean that - each line represents (at most) one connection. The above would represent a connection between a local port 5000 and a remote port 5984, that is in the TIME_WAIT state (i.e. a potential "troublemaker"). Now if you have 5000 lines with TIME_WAIT... - or at least a "large number", which may be the (default) size of the "port range" (as discussed in the thread) on Windows - you probably have the reason. In which case one way to avoid it may be to increase the port range - if it's possible on Windows, google can probably tell you how it's done. --Per From mjtruog@REDACTED Fri Feb 6 09:43:07 2009 From: mjtruog@REDACTED (Michael Truog) Date: Fri, 06 Feb 2009 00:43:07 -0800 Subject: [erlang-questions] Generic Erlang Port Driver V0.5 Released Message-ID: <498BF81B.1000606@gmail.com> Release of the Generic Erlang Port Driver (GEPD), version 0.5 PURPOSE ------------------------------------------------- I thought it would be nice to automatically generate an Erlang port driver for C/C++ bindings using a single self-contained file. test_drv.cpp provides: - a function binding with only a single line tuple - efficient passing of function types with no intermediate character buffer - functionality like the Erlang Driver Tool Kit (EDTK) (no fd handling though) - macro expansion to avoid code duplication errors (boost is required) - floating point type handling The test_drv.erl code provides a simplistic test of the Erlang port driver code. Get the code here: http://emuddy.svn.sourceforge.net/viewvc/emuddy/lib/emuddy/src/gepd/ From imre@REDACTED Fri Feb 6 12:23:39 2009 From: imre@REDACTED (Imre Palik) Date: Fri, 6 Feb 2009 13:23:39 +0200 Subject: [erlang-questions] beginner: Generating a list of prime numbers Message-ID: <3BE6DBA1F3BE9D4798255806113D5654421594C3FF@utx-exchange.utx.local> As for the primes: sieve([H|T], M) when H=< M -> [H|sieve([X || X<- T, X rem H /= 0])]; sieve(L, _) -> L. call it as: Primes = [2|sieve(lists:seq(3, N, 2), math:sqrt(N))], You could also do it with tail recursion, but if N>10^6 the speedup is negligible. The real morale of the thing is that you want to use list comprehension whenever you can. It tends to be much faster than recursion. BTW for such things the project euler forum si your friend. From: Matthew Palmer > BTW, isn't Erlang a *good* language to do this sort of thing in? I'm loving > it, myself -- trivial to debug things, and the problems solve themselves so > quick (I'm fairly sure that I'm writing these Euler problems quicker than I > would in Ruby, my current favourite language). It depends on your definition of good. You won't be able to brute force anything. Not even those that you could in TCL. Sometimes even the optimal algorithm will run for several minutes. Also, if you try to use gb_trees for memo in dynamic programming, programming, it becomes really damn slow after a few million entries. I. From cureadvocate@REDACTED Fri Feb 6 12:29:33 2009 From: cureadvocate@REDACTED (Steven Edwards) Date: Fri, 6 Feb 2009 06:29:33 -0500 Subject: [erlang-questions] beginner: Generating a list of prime Message-ID: Mark, You can use lists:append(List, [Term]) to add larger primes to the back of the list, but I'd suggest approaching your problem in a different way: N is prime if the GCD of ((N-1)!, N) is 1. Write a GCD function and use an accumulator to store the FactorialSoFar. If you need any hep, let me know. Steven > Message: 2 > Date: Thu, 5 Feb 2009 18:50:22 -0800 > From: Mark Wagner > Subject: [erlang-questions] beginner: Generating a list of prime > numbers > To: erlang-questions@REDACTED > Message-ID: > <31073ef90902051850h2377c242s9f25d39ff47c6166@REDACTED> > Content-Type: text/plain; charset=UTF-8 > > As a way of learning the basics of Erlang, I'm solving various > problems from Project Euler (http://projecteuler.net/). Problem #10 > involves generating a list of prime numbers. The naive solution to > this is to generate a list of numbers and test each of them > individually to see if it's prime; a more sophisticated solution uses > the list of primes already found to speed up the testing. My code for > the sophisticated solution is: > > is_prime(PrimesSoFar, Candidate) -> not lists:any(fun(X) -> Candidate > rem X =:= 0 end, PrimesSoFar). > > list_primes(PrimesSoFar, Max, Candidate) when (Candidate > Max) -> > PrimesSoFar; > list_primes(PrimesSoFar, Max, Candidate) -> > case is_prime(PrimesSoFar, Candidate) of > true -> list_primes([Candidate|PrimesSoFar], Max, Candidate > + 2); > false -> list_primes(PrimesSoFar, Max, Candidate + 2) > end. > > list_primes(N) when N < 2 -> []; > list_primes(2) -> [2]; > list_primes(N) -> list_primes([2], N, 3). > > The problem with this is that the list of prime numbers is ordered > largest-first, so that the small primes (the ones most likely to be > factors of a given number) are tested last. This makes the > sophisticated solution slower than the naive one, which tests small > factors first. Any suggestions on how to fix this? > > -- > Mark Wagner > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bekesa@REDACTED Fri Feb 6 13:28:30 2009 From: bekesa@REDACTED (Andras Georgy Bekes) Date: Fri, 06 Feb 2009 13:28:30 +0100 Subject: [erlang-questions] '--' BIF to be used with caution? In-Reply-To: <707529930902050630l250a8ae4nedbfa71e5d63460e@mail.gmail.com> References: <707529930901130404y5418466bmc375525ef765e615@mail.gmail.com> <6672d0160902040248n4ef30e0cm4e4e0cb718a04349@mail.gmail.com> <707529930902050630l250a8ae4nedbfa71e5d63460e@mail.gmail.com> Message-ID: <200902061328.30922.bekesa@sch.bme.hu> > I don't mind too much if '--' remains O(N^2). But the fact that it > made ERTS unresponsive is more of a worry, to me, because this seemed > to go against the spirit of the language. I wouldn't care too much for '--' being VM-blocking BIF until it is not the only one. You can block the whole VM with a pattern match as well! See: http://www.erlang.org/pipermail/erlang-questions/2008-March/033838.html So if this problem with '--' is considered serious, then pattern-matching should also be made non-blocking ("trapping"). Georgy From vychodil.hynek@REDACTED Fri Feb 6 15:39:46 2009 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Fri, 6 Feb 2009 15:39:46 +0100 Subject: [erlang-questions] beginner: Generating a list of prime numbers In-Reply-To: <3BE6DBA1F3BE9D4798255806113D5654421594C3FF@utx-exchange.utx.local> References: <3BE6DBA1F3BE9D4798255806113D5654421594C3FF@utx-exchange.utx.local> Message-ID: <4d08db370902060639r46110849q30d07eac43723796@mail.gmail.com> I should like notice that your algorithm is not The Sieve of Eratosthenes. For example in sieve algorithm should not be 'rem' operation but just '+'. For more details see http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf On Fri, Feb 6, 2009 at 12:23 PM, Imre Palik wrote: > > As for the primes: > > sieve([H|T], M) when H=< M -> [H|sieve([X || X<- T, X rem H /= 0])]; > sieve(L, _) -> L. > > call it as: > > Primes = [2|sieve(lists:seq(3, N, 2), math:sqrt(N))], > > You could also do it with tail recursion, but if N>10^6 the speedup is > negligible. The real morale of the thing is that you want to use list > comprehension whenever you can. It tends to be much faster than recursion. > > BTW for such things the project euler forum si your friend. > > > From: Matthew Palmer > > > BTW, isn't Erlang a *good* language to do this sort of thing in? I'm > loving > > it, myself -- trivial to debug things, and the problems solve themselves > so > > quick (I'm fairly sure that I'm writing these Euler problems quicker than > I > > would in Ruby, my current favourite language). > > It depends on your definition of good. You won't be able to brute force > anything. Not even those that you could in TCL. Sometimes even the optimal > algorithm will run for several minutes. Also, if you try to use gb_trees > for memo in dynamic programming, programming, it becomes really damn slow > after a few million entries. > > I. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try Good Data now for free: www.gooddata.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From bgustavsson@REDACTED Fri Feb 6 17:11:08 2009 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Fri, 6 Feb 2009 17:11:08 +0100 Subject: [erlang-questions] beginner: Generating a list of prime numbers In-Reply-To: <3BE6DBA1F3BE9D4798255806113D5654421594C3FF@utx-exchange.utx.local> References: <3BE6DBA1F3BE9D4798255806113D5654421594C3FF@utx-exchange.utx.local> Message-ID: <6672d0160902060811q2aa97ebbn4689ff5285263c79@mail.gmail.com> On Fri, Feb 6, 2009 at 12:23 PM, Imre Palik wrote: > The real morale of the thing is that you want to use list comprehension whenever you can. It tends to be much faster than recursion. That surprises me, because I happen to know how list comprehensions are implemented. Do you have any measurements to back up your statement? /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From imre@REDACTED Fri Feb 6 17:49:07 2009 From: imre@REDACTED (Imre Palik) Date: Fri, 6 Feb 2009 18:49:07 +0200 Subject: [erlang-questions] beginner: Generating a list of prime numbers In-Reply-To: <6672d0160902060811q2aa97ebbn4689ff5285263c79@mail.gmail.com> References: <3BE6DBA1F3BE9D4798255806113D5654421594C3FF@utx-exchange.utx.local>, <6672d0160902060811q2aa97ebbn4689ff5285263c79@mail.gmail.com> Message-ID: <3BE6DBA1F3BE9D4798255806113D5654421594C402@utx-exchange.utx.local> Felad?: Bjorn Gustavsson [bgustavsson@REDACTED] > On Fri, Feb 6, 2009 at 12:23 PM, Imre Palik wrote: > >> The real morale of the thing is that you want to use list comprehension whenever you can. It tends to be much faster than recursion. > > That surprises me, because I happen to know how list comprehensions > are implemented. > > Do you have any measurements to back up your statement? Here it is: % code start here -module(prime_test). -export([run/1]). sieve1([H|T], S) when H =< S -> [H|sieve1([X||X<-T, X rem H /= 0], S)]; sieve1(L, _) -> L. filter(_, [], A) -> lists:reverse(A); filter(P, [H|T], A) when H rem P == 0 -> filter(P, T, A); filter(P, [H|T], A) -> filter(P, T, [H|A]). sieve2([H|T], S) when H =< S -> [H|sieve2(filter(H, T, []), S)]; sieve2(L, _) -> L. run(N) -> erlang:display({start, now()}), P1 = sieve1(lists:seq(3, N), math:sqrt(N)), erlang:display({p1, now()}), P2 = sieve2(lists:seq(3, N), math:sqrt(N)), erlang:display({p2, now()}). % code ends here 15> prime_test:run(10000000). {start,{1233,938342,764000}} {p1,{1233,938385,702000}} {p2,{1233,938441,827000}} true 16> prime_test:run(10000000). {start,{1233,938718,296000}} {p1,{1233,938760,608000}} {p2,{1233,938816,702000}} true 17> prime_test:run(10000000). {start,{1233,938821,827000}} {p1,{1233,938864,30000}} {p2,{1233,938919,952000}} true 18> ?. I. From imre@REDACTED Fri Feb 6 18:11:23 2009 From: imre@REDACTED (Imre Palik) Date: Fri, 6 Feb 2009 19:11:23 +0200 Subject: [erlang-questions] Crash on alloc Message-ID: <3BE6DBA1F3BE9D4798255806113D5654421594C403@utx-exchange.utx.local> Hi, can anybody explain why I'm getting this: 3> {lists:seq(3, 40000000, 2), lists:seq(3, 40000000, 2)}. Crash dump was written to: erl_crash.dump eheap_alloc: Cannot allocate 373662860 bytes of memory (of type "heap"). This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. Process inferior-erlang finished Thx. I. From francesco@REDACTED Fri Feb 6 19:13:22 2009 From: francesco@REDACTED (Francesco Cesarini (Erlang Training and Consulting)) Date: Fri, 06 Feb 2009 18:13:22 +0000 Subject: [erlang-questions] Crash on alloc In-Reply-To: <3BE6DBA1F3BE9D4798255806113D5654421594C403@utx-exchange.utx.local> References: <3BE6DBA1F3BE9D4798255806113D5654421594C403@utx-exchange.utx.local> Message-ID: <498C7DC2.8090607@erlang-consulting.com> This is the standard behaviour when the VM runs out of memory.... Try generating smaller lists or adding more memory to your computer. Francesco -- http://www.erlang-consulting.com Imre Palik wrote: > Hi, > > can anybody explain why I'm getting this: > > 3> {lists:seq(3, 40000000, 2), lists:seq(3, 40000000, 2)}. > > Crash dump was written to: erl_crash.dump > eheap_alloc: Cannot allocate 373662860 bytes of memory (of type "heap"). > > This application has requested the Runtime to terminate it in an unusual way. > Please contact the application's support team for more information. > > Process inferior-erlang finished > > > Thx. > > I. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From imre@REDACTED Fri Feb 6 19:19:26 2009 From: imre@REDACTED (Imre Palik) Date: Fri, 6 Feb 2009 20:19:26 +0200 Subject: [erlang-questions] Crash on alloc Message-ID: <3BE6DBA1F3BE9D4798255806113D5654421594C404@utx-exchange.utx.local> Felad?: Francesco Cesarini (Erlang Training and Consulting) [francesco@REDACTED] > > This is the standard behaviour when the VM runs out of memory.... Try > generating smaller lists or adding more memory to your computer. I have 3 Gigs, and as far as I can see, this fails on an alloc of less then 400 Megs. Does this quite reliably, even as the first command of the shell. > Imre Palik wrote: >> Hi, >> >> can anybody explain why I'm getting this: >> >> 3> {lists:seq(3, 40000000, 2), lists:seq(3, 40000000, 2)}. >> >> Crash dump was written to: erl_crash.dump >> eheap_alloc: Cannot allocate 373662860 bytes of memory (of type "heap"). >> >> This application has requested the Runtime to terminate it in an unusual way. >> Please contact the application's support team for more information. >> >> Process inferior-erlang finished From dave.smith.to@REDACTED Fri Feb 6 19:36:38 2009 From: dave.smith.to@REDACTED (Dave Smith) Date: Fri, 6 Feb 2009 13:36:38 -0500 Subject: [erlang-questions] Crash on alloc In-Reply-To: <498C7DC2.8090607@erlang-consulting.com> References: <3BE6DBA1F3BE9D4798255806113D5654421594C403@utx-exchange.utx.local> <498C7DC2.8090607@erlang-consulting.com> Message-ID: <5ea453f90902061036w1b076aa6je60fda1fae086936@mail.gmail.com> This is the type of thing Haskell is good at :) ([3,5..40000000],[3,5..40000000]) , or if you really wanted it to be unbounded... ([3,5..],[3,5..]) Unfortunately Erlang doesn't do lazy evaluation (and can't for good reason), so allocation is all done upfront. --DS 2009/2/6 Francesco Cesarini (Erlang Training and Consulting) < francesco@REDACTED> > standard behaviour when the VM runs out of memory.... Try > generating smaller lists or adding more memory to your computer. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From francesco@REDACTED Fri Feb 6 19:39:14 2009 From: francesco@REDACTED (Francesco Cesarini (Erlang Training and Consulting)) Date: Fri, 06 Feb 2009 18:39:14 +0000 Subject: [erlang-questions] Crash on alloc In-Reply-To: <3BE6DBA1F3BE9D4798255806113D5654421594C404@utx-exchange.utx.local> References: <3BE6DBA1F3BE9D4798255806113D5654421594C404@utx-exchange.utx.local> Message-ID: <498C83D2.8030408@erlang-consulting.com> What it fails to allocate does not include the memory which has already been allocated. Memory is allocated when needed... And as Erlang lacks Lazy evaluation*, this is the result when dealing with large data structures. Francesco * You can simulate lazy evaluations using Funs. -- http://www.erlang-consulting.com Imre Palik wrote: > Felad?: Francesco Cesarini (Erlang Training and Consulting) [francesco@REDACTED] > >> This is the standard behaviour when the VM runs out of memory.... Try >> generating smaller lists or adding more memory to your computer. >> > > I have 3 Gigs, and as far as I can see, this fails on an alloc of less then 400 Megs. Does this quite reliably, even as the first command of the shell. > > > >> Imre Palik wrote: >> >>> Hi, >>> >>> can anybody explain why I'm getting this: >>> >>> 3> {lists:seq(3, 40000000, 2), lists:seq(3, 40000000, 2)}. >>> >>> Crash dump was written to: erl_crash.dump >>> eheap_alloc: Cannot allocate 373662860 bytes of memory (of type "heap"). >>> >>> This application has requested the Runtime to terminate it in an unusual way. >>> Please contact the application's support team for more information. >>> >>> Process inferior-erlang finished >>> From dave.smith.to@REDACTED Fri Feb 6 19:43:59 2009 From: dave.smith.to@REDACTED (Dave Smith) Date: Fri, 6 Feb 2009 13:43:59 -0500 Subject: [erlang-questions] Crash on alloc In-Reply-To: <3BE6DBA1F3BE9D4798255806113D5654421594C404@utx-exchange.utx.local> References: <3BE6DBA1F3BE9D4798255806113D5654421594C404@utx-exchange.utx.local> Message-ID: <5ea453f90902061043t6f4439f5w7e442252eb8deca5@mail.gmail.com> If you google "373662860 bytes", Erlang is well represented in the results. There must be something significant to this limit... http://www.google.ca/search?q=373662860+bytes --DS 2009/2/6 Imre Palik > Felad?: Francesco Cesarini (Erlang Training and Consulting) [ > francesco@REDACTED] > > > > This is the standard behaviour when the VM runs out of memory.... Try > > generating smaller lists or adding more memory to your computer. > > I have 3 Gigs, and as far as I can see, this fails on an alloc of less then > 400 Megs. Does this quite reliably, even as the first command of the shell. > > > > Imre Palik wrote: > >> Hi, > >> > >> can anybody explain why I'm getting this: > >> > >> 3> {lists:seq(3, 40000000, 2), lists:seq(3, 40000000, 2)}. > >> > >> Crash dump was written to: erl_crash.dump > >> eheap_alloc: Cannot allocate 373662860 bytes of memory (of type "heap"). > >> > >> This application has requested the Runtime to terminate it in an unusual > way. > >> Please contact the application's support team for more information. > >> > >> Process inferior-erlang finished > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From freza@REDACTED Fri Feb 6 19:46:41 2009 From: freza@REDACTED (Jachym Holecek) Date: Fri, 6 Feb 2009 19:46:41 +0100 Subject: [erlang-questions] Crash on alloc In-Reply-To: <3BE6DBA1F3BE9D4798255806113D5654421594C404@utx-exchange.utx.local> References: <3BE6DBA1F3BE9D4798255806113D5654421594C404@utx-exchange.utx.local> Message-ID: <20090206184641.GA13932@hanele> # Imre Palik 2009-02-06: > Felad?: Francesco Cesarini (Erlang Training and Consulting) [francesco@REDACTED] > > > > This is the standard behaviour when the VM runs out of memory.... Try > > generating smaller lists or adding more memory to your computer. > > I have 3 Gigs, and as far as I can see, this fails on an alloc of less then 400 Megs. Does this quite reliably, even as the first command of the shell. Assuming you're running a Unix-like OS: try increasing your data area limit (man ulimit). -- Jachym From bqt@REDACTED Fri Feb 6 20:02:57 2009 From: bqt@REDACTED (Johnny Billquist) Date: Fri, 06 Feb 2009 20:02:57 +0100 Subject: [erlang-questions] Crash on alloc In-Reply-To: <3BE6DBA1F3BE9D4798255806113D5654421594C404@utx-exchange.utx.local> References: <3BE6DBA1F3BE9D4798255806113D5654421594C404@utx-exchange.utx.local> Message-ID: <498C8961.9020000@softjar.se> Imre Palik wrote: > Felad?: Francesco Cesarini (Erlang Training and Consulting) [francesco@REDACTED] >> This is the standard behaviour when the VM runs out of memory.... Try >> generating smaller lists or adding more memory to your computer. > > I have 3 Gigs, and as far as I can see, this fails on an alloc of less then 400 Megs. Does this quite reliably, even as the first command of the shell. Unix system? What are the process limits? Johnny > > >> Imre Palik wrote: >>> Hi, >>> >>> can anybody explain why I'm getting this: >>> >>> 3> {lists:seq(3, 40000000, 2), lists:seq(3, 40000000, 2)}. >>> >>> Crash dump was written to: erl_crash.dump >>> eheap_alloc: Cannot allocate 373662860 bytes of memory (of type "heap"). >>> >>> This application has requested the Runtime to terminate it in an unusual way. >>> Please contact the application's support team for more information. >>> >>> Process inferior-erlang finished > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Johnny Billquist || "I'm on a bus || on a psychedelic trip email: bqt@REDACTED || Reading murder books pdp is alive! || tryin' to stay hip" - B. Idol From erlangy@REDACTED Fri Feb 6 20:46:55 2009 From: erlangy@REDACTED (Michael McDaniel) Date: Fri, 6 Feb 2009 11:46:55 -0800 Subject: [erlang-questions] Crash on alloc In-Reply-To: <20090206184641.GA13932@hanele> References: <3BE6DBA1F3BE9D4798255806113D5654421594C404@utx-exchange.utx.local> <20090206184641.GA13932@hanele> Message-ID: <20090206194655.GR22018@delora.autosys.us> I only have 1/2 GB memory and the operation works ... mmcdanie@REDACTED:~$ erl Erlang (BEAM) emulator version 5.6.5 [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.6.5 (abort with ^G) 1> {lists:seq(3, 40000000, 2), lists:seq(3, 40000000, 2)}. {[3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41, 43,45,47,49,51,53,55,57|...], [3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43, 45,47,49,51,53,55|...]} 2> q(). ok 3> mmcdanie@REDACTED:~$ uname -a Linux phemora 2.6.27-9-generic #1 SMP Thu Nov 20 21:57:00 UTC 2008 i686 GNU/Linux mmcdanie@REDACTED:~$ dmesg | egrep Memory [ 0.004000] Memory: 472772k/491456k available (2572k kernel code, 18024k reserved, 1160k data, 424k init, 0k highmem) mmcdanie@REDACTED:~$ ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 3839 max locked memory (kbytes, -l) 32 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 3839 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited ~M On Fri, Feb 06, 2009 at 07:46:41PM +0100, Jachym Holecek wrote: > # Imre Palik 2009-02-06: > > Felad?: Francesco Cesarini (Erlang Training and Consulting) [francesco@REDACTED] > > > > > > This is the standard behaviour when the VM runs out of memory.... Try > > > generating smaller lists or adding more memory to your computer. > > > > I have 3 Gigs, and as far as I can see, this fails on an alloc of less then 400 Megs. Does this quite reliably, even as the first command of the shell. > > Assuming you're running a Unix-like OS: try increasing your data area > limit (man ulimit). > > -- Jachym > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Michael McDaniel Portland, Oregon, USA http://trip.autosys.us http://autosys.us From matthias@REDACTED Fri Feb 6 22:51:14 2009 From: matthias@REDACTED (Matthias Lang) Date: Fri, 6 Feb 2009 22:51:14 +0100 Subject: [erlang-questions] beginner: Generating a list of prime numbers In-Reply-To: <3BE6DBA1F3BE9D4798255806113D5654421594C402@utx-exchange.utx.local> References: <6672d0160902060811q2aa97ebbn4689ff5285263c79@mail.gmail.com> <3BE6DBA1F3BE9D4798255806113D5654421594C402@utx-exchange.utx.local> Message-ID: <20090206215114.GB2494@contorpis.lisalinda.com> On Friday, February 06, Imre Palik wrote: Imre> >> The real morale of the thing is that you want to use Imre> >> list comprehension whenever you can. It tends to be Imre> >> much faster than recursion. ... I see no big difference between code variants when running on my machine: Erlang (BEAM) emulator version 5.6.5 [source] [64-bit] [smp:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.6.5 (abort with ^G) 1> c(prime_test). ./prime_test.erl:16: Warning: variable 'P1' is unused ./prime_test.erl:18: Warning: variable 'P2' is unused {ok,prime_test} 2> prime_test:run(10000000). {start,{1233,954836,637538}} {p1,{1233,954948,700238}} {p2,{1233,955063,218981}} true I tried adding a plain recursive version of filter (see code below), but didn't get any significant differences there either: 19> prime_test:run(10000000). {start,{1233,955375,697367}} {p1,{1233,955488,314905}} {p2,{1233,955603,458047}} {p3,{1233,955717,964138}} Repeating on a 32-bit version of R11B-5 on a different machine didn't produce anything spectacular either: 3> prime_test:run(10000000). {start,{1233,955391,95580}} {p1,{1233,955426,572019}} {p2,{1233,955465,160014}} {p3,{1233,955503,541756}} Aside: that call to lists:seq(3, N) looks suspicious. Matt ---------------------------------------------------------------------- -module(prime_test). -export([run/1]). sieve1([H|T], S) when H =< S -> [H|sieve1([X||X<-T, X rem H /= 0], S)]; sieve1(L, _) -> L. filter(_, [], A) -> lists:reverse(A); filter(P, [H|T], A) when H rem P == 0 -> filter(P, T, A); filter(P, [H|T], A) -> filter(P, T, [H|A]). rfilter(P, [H|T]) when H rem P == 0 -> rfilter(P, T); rfilter(P, [H|T]) -> [H|rfilter(P,T)]; rfilter(_, []) -> []. sieve2([H|T], S) when H =< S -> [H|sieve2(filter(H, T, []), S)]; sieve2(L, _) -> L. sieve3([H|T], S) when H =< S -> [H|sieve3(rfilter(H, T), S)]; sieve3(L, _) -> L. run(N) -> erlang:display({start, now()}), P1 = sieve1(lists:seq(3, N), math:sqrt(N)), erlang:display({p1, now()}), P2 = sieve2(lists:seq(3, N), math:sqrt(N)), erlang:display({p2, now()}), P3 = sieve2(lists:seq(3, N), math:sqrt(N)), erlang:display({p3, now()}). From rvirding@REDACTED Sat Feb 7 02:56:13 2009 From: rvirding@REDACTED (Robert Virding) Date: Sat, 7 Feb 2009 02:56:13 +0100 Subject: [erlang-questions] erl_parse:abstract on a fun In-Reply-To: <4980522F.9000803@sidvind.com> References: <4980522F.9000803@sidvind.com> Message-ID: <3dbc6d1c0902061756t525cbbe8g9e83742cd283550a@mail.gmail.com> 2009/1/28 David Sveningsson > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi, I recently ran into an issue where I am calling erl_parse:abstract > on a fun which fails with function_clause. What I need is to convert any > term to abstract form and in this case it was a stacktrace containing a > fun. The basic problem is that there is no abstract form for a fun, not at least for a fun term. In the same way there is no abstract form for a function. It's the same with pids and refs. > Now I see two alternatives for solving this: > > 1) Try to convert the fun to abstract form for and wrap it somehow. > 2) Replace the fun with erlang:fun_to_list/1 or similar, and live having > the "string representation". > > Either way seems a bit difficult as it would involve traversing an > unknown term and replacing funs as needed. > > Is this possible to do? Or is there a simpler way? What are you trying to do? Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From ssroy1979@REDACTED Sat Feb 7 03:12:31 2009 From: ssroy1979@REDACTED (Salonee Sinha Roy) Date: Fri, 6 Feb 2009 18:12:31 -0800 Subject: [erlang-questions] yaws wont start ssl error. Message-ID: Hello All First some background I am running erlang on ubuntu. Initially I installed R11 using apt-get install erlang. I then installed yaws after downloading the file from http://yaws.hyber.org and following instructions from there. Subsequently I uninstalled R11 by doing a apt-get remove erlang and then reinstalled by hand after downloading the R12 install files from http://www.erlang.org and following the instructions. I then reinstalled yaws by doing the following the yaws package. ./configure && make make install. Now when I try to start yaws as root I get the following error root@REDACTED:~# yaws Erlang (BEAM) emulator version 5.6.5 [source] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.6.5 (abort with ^G) 1> =INFO REPORT==== 6-Feb-2009::18:07:02 === Yaws: Using config file /usr/local/etc/yaws.conf =ERROR REPORT==== 6-Feb-2009::18:07:02 === Failed to start ssl: {'EXIT',{undef,[{ssl,start,[]}, {yaws_config,ssl_start,0}, {yaws_config,fload,7}, {yaws_config,load,1}, {yaws_server,init,1}, {gen_server,init_it,6}, {proc_lib,init_p_do_apply,3}]}} =ERROR REPORT==== 6-Feb-2009::18:07:02 === Failed to start: undef Any help would be great. Thanks Salonee -------------- next part -------------- An HTML attachment was scrubbed... URL: From elias@REDACTED Sat Feb 7 03:45:34 2009 From: elias@REDACTED (Elias Torres) Date: Fri, 6 Feb 2009 21:45:34 -0500 Subject: [erlang-questions] yaws wont start ssl error. In-Reply-To: References: Message-ID: I did this recently (manual install on Ubuntu) and just './configure --disable-hipe' did the trick. It might be the case that you don't have the SSL dev libraries, if not you should install those. sudo apt-get install libssl-dev Then try configure again. Except beware that you must either unpack the source fresh again or run "gmake clean", if not it won't compile even with the right settings. Last resource, would be to point to the exact location of your ssl libraries like this: ./configure --with-ssl-includes=/usr/include/openssl --with-ssl-libraries=/usr/lib Then to test simply type: erl -s ssl -Elias 2009/2/6 Salonee Sinha Roy : > Hello All > First some background > I am running erlang on ubuntu. Initially I installed R11 using apt-get > install erlang. I then installed yaws after downloading the file from > http://yaws.hyber.org and following instructions from there. > > Subsequently I uninstalled R11 by doing a apt-get remove erlang and then > reinstalled by hand after downloading the R12 install files from > http://www.erlang.org and following the instructions. > > I then reinstalled yaws by doing the following the yaws package. > > ./configure && make > make install. > > Now when I try to start yaws as root I get the following error > > root@REDACTED:~# yaws > Erlang (BEAM) emulator version 5.6.5 [source] [async-threads:0] [hipe] > [kernel-poll:false] > > Eshell V5.6.5 (abort with ^G) > 1> > =INFO REPORT==== 6-Feb-2009::18:07:02 === > Yaws: Using config file /usr/local/etc/yaws.conf > > =ERROR REPORT==== 6-Feb-2009::18:07:02 === > Failed to start ssl: {'EXIT',{undef,[{ssl,start,[]}, > {yaws_config,ssl_start,0}, > {yaws_config,fload,7}, > {yaws_config,load,1}, > {yaws_server,init,1}, > {gen_server,init_it,6}, > {proc_lib,init_p_do_apply,3}]}} > > =ERROR REPORT==== 6-Feb-2009::18:07:02 === > Failed to start: undef > > > Any help would be great. > > Thanks > Salonee > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From ssroy1979@REDACTED Sat Feb 7 05:39:42 2009 From: ssroy1979@REDACTED (Salonee Sinha Roy) Date: Fri, 6 Feb 2009 20:39:42 -0800 Subject: [erlang-questions] yaws wont start ssl error. In-Reply-To: References: Message-ID: Do I need to reinstall erlang with ssl enabled? On Fri, Feb 6, 2009 at 6:45 PM, Elias Torres wrote: > I did this recently (manual install on Ubuntu) and just './configure > --disable-hipe' did the trick. > > It might be the case that you don't have the SSL dev libraries, if not > you should install those. > > sudo apt-get install libssl-dev > > Then try configure again. Except beware that you must either unpack > the source fresh again or run "gmake clean", if not it won't compile > even with the right settings. > > Last resource, would be to point to the exact location of your ssl > libraries like this: > > ./configure --with-ssl-includes=/usr/include/openssl > --with-ssl-libraries=/usr/lib > > Then to test simply type: > > erl -s ssl > > -Elias > > 2009/2/6 Salonee Sinha Roy : > > Hello All > > First some background > > I am running erlang on ubuntu. Initially I installed R11 using apt-get > > install erlang. I then installed yaws after downloading the file from > > http://yaws.hyber.org and following instructions from there. > > > > Subsequently I uninstalled R11 by doing a apt-get remove erlang and then > > reinstalled by hand after downloading the R12 install files from > > http://www.erlang.org and following the instructions. > > > > I then reinstalled yaws by doing the following the yaws package. > > > > ./configure && make > > make install. > > > > Now when I try to start yaws as root I get the following error > > > > root@REDACTED:~# yaws > > Erlang (BEAM) emulator version 5.6.5 [source] [async-threads:0] [hipe] > > [kernel-poll:false] > > > > Eshell V5.6.5 (abort with ^G) > > 1> > > =INFO REPORT==== 6-Feb-2009::18:07:02 === > > Yaws: Using config file /usr/local/etc/yaws.conf > > > > =ERROR REPORT==== 6-Feb-2009::18:07:02 === > > Failed to start ssl: {'EXIT',{undef,[{ssl,start,[]}, > > {yaws_config,ssl_start,0}, > > {yaws_config,fload,7}, > > {yaws_config,load,1}, > > {yaws_server,init,1}, > > {gen_server,init_it,6}, > > {proc_lib,init_p_do_apply,3}]}} > > > > =ERROR REPORT==== 6-Feb-2009::18:07:02 === > > Failed to start: undef > > > > > > Any help would be great. > > > > Thanks > > Salonee > > > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ssroy1979@REDACTED Sat Feb 7 07:23:57 2009 From: ssroy1979@REDACTED (Salonee Sinha Roy) Date: Fri, 6 Feb 2009 22:23:57 -0800 Subject: [erlang-questions] yaws wont start ssl error. In-Reply-To: References: Message-ID: I installed the libssl using apt-get install libssl-dev I reinstalled erlang with the following commands. ./configure --with-ssl-includes=/usr/include/openssl --with-ssl-libraries=/usr/lib make make install Now my issue is resolved. Thanks for your help with this. -------------- next part -------------- An HTML attachment was scrubbed... URL: From v@REDACTED Sat Feb 7 07:41:44 2009 From: v@REDACTED (Valentin Micic) Date: Sat, 7 Feb 2009 08:41:44 +0200 Subject: [erlang-questions] Crash on alloc In-Reply-To: <20090206194655.GR22018@delora.autosys.us> Message-ID: <200902070639.n176djKn005996@mail.pharos-avantgard.com> Hmmm... just tried it on windoze with mixed results: Erlang (BEAM) emulator version 5.6.5 [smp:2] [async-threads:0] Allocates the memory and then crashes. OTOH: Erlang (BEAM) emulator version 5.5.4 [async-threads:0] Note that 5.5.4 does not have smp support. Then I got my imagination going, so I've started 5.6.5 with SMP support and the thing worked. Erlang (BEAM) emulator version 5.6.5 [async-threads:0] Eshell V5.6.5 (abort with ^G) (gsmat@REDACTED)1> {lists:seq(3, 40000000, 2), lists:seq(3, 40000000, 2)}. {[3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41, 43,45,47,49,51,53,55,57|...], [3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43, 45,47,49,51,53,55|...]} (gsmat@REDACTED)2> Hope this helps someone, somewhat, somewhere. V -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Michael McDaniel Sent: 06 February 2009 09:47 PM To: erlang-questions@REDACTED Subject: Re: [erlang-questions] Crash on alloc I only have 1/2 GB memory and the operation works ... mmcdanie@REDACTED:~$ erl Erlang (BEAM) emulator version 5.6.5 [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.6.5 (abort with ^G) 1> {lists:seq(3, 40000000, 2), lists:seq(3, 40000000, 2)}. {[3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41, 43,45,47,49,51,53,55,57|...], [3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43, 45,47,49,51,53,55|...]} 2> q(). ok 3> mmcdanie@REDACTED:~$ uname -a Linux phemora 2.6.27-9-generic #1 SMP Thu Nov 20 21:57:00 UTC 2008 i686 GNU/Linux mmcdanie@REDACTED:~$ dmesg | egrep Memory [ 0.004000] Memory: 472772k/491456k available (2572k kernel code, 18024k reserved, 1160k data, 424k init, 0k highmem) mmcdanie@REDACTED:~$ ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 3839 max locked memory (kbytes, -l) 32 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 3839 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited ~M On Fri, Feb 06, 2009 at 07:46:41PM +0100, Jachym Holecek wrote: > # Imre Palik 2009-02-06: > > Felad?: Francesco Cesarini (Erlang Training and Consulting) [francesco@REDACTED] > > > > > > This is the standard behaviour when the VM runs out of memory.... Try > > > generating smaller lists or adding more memory to your computer. > > > > I have 3 Gigs, and as far as I can see, this fails on an alloc of less then 400 Megs. Does this quite reliably, even as the first command of the shell. > > Assuming you're running a Unix-like OS: try increasing your data area > limit (man ulimit). > > -- Jachym > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Michael McDaniel Portland, Oregon, USA http://trip.autosys.us http://autosys.us _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From john.hughes@REDACTED Sat Feb 7 12:50:32 2009 From: john.hughes@REDACTED (John Hughes) Date: Sat, 7 Feb 2009 12:50:32 +0100 Subject: [erlang-questions] Charging your phone with Erlang In-Reply-To: References: Message-ID: Here's a little tip. Imagine you're in a hotel room with your laptop, but you forgot your phone charger. Luckily, you can plug in the lap-top, connect your phone to it with a USB cable, and then the phone charges... but only while the laptop remains awake. So you need a way to prevent Windows (in my case) from putting the laptop into stand-by mode during the night. Simple! Start the Erlang shell, and type 1> F=fun(F)->F(F)end, F(F). The shell will sit there 'till morning, keeping your machine awake and your phone charging. (Thank you, tail-call optimisation!) It's no doubt more environmentally friendly to remember your phone charger, but I'm only human and this tip has served me well a number of times! John From valentin@REDACTED Sat Feb 7 14:48:39 2009 From: valentin@REDACTED (Valentin Micic) Date: Sat, 7 Feb 2009 15:48:39 +0200 Subject: [erlang-questions] Crash on alloc References: <200902070639.n176djKn005996@mail.pharos-avantgard.com> Message-ID: <763B544C8ED94E3988EF8A403BF122CB@moneymaker2> What was I thinking (drinking?)... Sorry for an incoherent posting. What I've meant to say was: I've been trying to reproduce problem related to {lists:seq(3, 40000000, 2), lists:seq(3, 40000000, 2)}crashes using different emulators. The results (Windows only) are below: 1) 5.6.5 emulator with SMP support crashes, as reported. 2) 5.5.4 without SMP support does not crash! 3) 5.6.5 without SMP support does not crash! It seems that the problem may be somehow related to SMP support. Regards etc. V. ----- Original Message ----- From: "Valentin Micic" To: Sent: Saturday, February 07, 2009 8:41 AM Subject: Re: [erlang-questions] Crash on alloc Hmmm... just tried it on windoze with mixed results: Erlang (BEAM) emulator version 5.6.5 [smp:2] [async-threads:0] Allocates the memory and then crashes. OTOH: Erlang (BEAM) emulator version 5.5.4 [async-threads:0] Note that 5.5.4 does not have smp support. Then I got my imagination going, so I've started 5.6.5 with SMP support and the thing worked. Erlang (BEAM) emulator version 5.6.5 [async-threads:0] Eshell V5.6.5 (abort with ^G) (gsmat@REDACTED)1> {lists:seq(3, 40000000, 2), lists:seq(3, 40000000, 2)}. {[3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41, 43,45,47,49,51,53,55,57|...], [3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43, 45,47,49,51,53,55|...]} (gsmat@REDACTED)2> Hope this helps someone, somewhat, somewhere. V -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Michael McDaniel Sent: 06 February 2009 09:47 PM To: erlang-questions@REDACTED Subject: Re: [erlang-questions] Crash on alloc I only have 1/2 GB memory and the operation works ... mmcdanie@REDACTED:~$ erl Erlang (BEAM) emulator version 5.6.5 [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.6.5 (abort with ^G) 1> {lists:seq(3, 40000000, 2), lists:seq(3, 40000000, 2)}. {[3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41, 43,45,47,49,51,53,55,57|...], [3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43, 45,47,49,51,53,55|...]} 2> q(). ok 3> mmcdanie@REDACTED:~$ uname -a Linux phemora 2.6.27-9-generic #1 SMP Thu Nov 20 21:57:00 UTC 2008 i686 GNU/Linux mmcdanie@REDACTED:~$ dmesg | egrep Memory [ 0.004000] Memory: 472772k/491456k available (2572k kernel code, 18024k reserved, 1160k data, 424k init, 0k highmem) mmcdanie@REDACTED:~$ ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 3839 max locked memory (kbytes, -l) 32 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 3839 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited ~M On Fri, Feb 06, 2009 at 07:46:41PM +0100, Jachym Holecek wrote: > # Imre Palik 2009-02-06: > > Felad?: Francesco Cesarini (Erlang Training and Consulting) [francesco@REDACTED] > > > > > > This is the standard behaviour when the VM runs out of memory.... Try > > > generating smaller lists or adding more memory to your computer. > > > > I have 3 Gigs, and as far as I can see, this fails on an alloc of less then 400 Megs. Does this quite reliably, even as the first command of the shell. > > Assuming you're running a Unix-like OS: try increasing your data area > limit (man ulimit). > > -- Jachym > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Michael McDaniel Portland, Oregon, USA http://trip.autosys.us http://autosys.us _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From exta7@REDACTED Sat Feb 7 18:55:48 2009 From: exta7@REDACTED (Zvi) Date: Sat, 7 Feb 2009 09:55:48 -0800 (PST) Subject: [erlang-questions] Charging your phone with Erlang In-Reply-To: References: Message-ID: <21890719.post@talk.nabble.com> Sorry John, but you better charge your phone with Basic with it's superior GOTO technology: 10 GOTO 10 ;) Zvi John Hughes-7 wrote: > > Here's a little tip. > > Imagine you're in a hotel room with your laptop, but you forgot your phone > charger. Luckily, you can plug in the lap-top, connect your phone to it > with > a USB cable, and then the phone charges... but only while the laptop > remains > awake. So you need a way to prevent Windows (in my case) from putting the > laptop into stand-by mode during the night. > > Simple! Start the Erlang shell, and type > > 1> F=fun(F)->F(F)end, F(F). > > The shell will sit there 'till morning, keeping your machine awake and > your > phone charging. (Thank you, tail-call optimisation!) > > It's no doubt more environmentally friendly to remember your phone > charger, > but I'm only human and this tip has served me well a number of times! > > John > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- View this message in context: http://www.nabble.com/Charging-your-phone-with-Erlang-tp21887632p21890719.html Sent from the Erlang Questions mailing list archive at Nabble.com. From taum.xd@REDACTED Sat Feb 7 20:55:04 2009 From: taum.xd@REDACTED (Thomas Brian) Date: Sat, 7 Feb 2009 20:55:04 +0100 Subject: [erlang-questions] sinan build fails: internal error in beam_asm In-Reply-To: <4d08db370902060617r52aaca16k1bc1e08e81257dd9@mail.gmail.com> References: <9b5143660902051727q72de168cic00025a2f73367c6@mail.gmail.com> <4d08db370902060617r52aaca16k1bc1e08e81257dd9@mail.gmail.com> Message-ID: <9b5143660902071155t57b62e9eoec55e762ddfa3ff@mail.gmail.com> Thanks, actually I already saw that documentation and knew about application:start(). I was looking for a simpler way to do that, because spawning a shell and typing that everytime is rather tedious. Also, my application -- as I would guess most erlang apps -- is a server, so having to spawn a shell is not very practical as I need to logout after I started the application. After some extensive search, I found that I could start my app with : erl -pa _build/development/apps/foo-0.1.0/ebin/ -boot _build/development/releases/0.1.0.0/testapp It seems weird to me that sinan does not provide a quick command such as "sinan run" to start the app. Moreover I couldn't find this command (erl -pa ... -boot ...) in any tutorial I read. My assumption was that this was a really basic task most people would need. Am I wrong in guessing that? Besides, sinan build still spits this cryptic message in my face on my development machine (Mac OS 10.5.6). I couldn't find anything interesting on google. I was able to get sinan to work on Ubuntu, but I'd much rather have it on my main OS. On Fri, Feb 6, 2009 at 3:17 PM, Hynek Vychodil wrote: > May be this should be helpful: > http://www.erlang.org/doc/design_principles/part_frame.html > Starting and Stopping Applications: > http://www.erlang.org/doc/design_principles/applications.html#7.7 > > 2009/2/6 Thomas Brian > >> Hi, >> I'm trying to get a little bit more familiar with Erlang, and so far have >> only done the very basics: playing with the shell, writing a basic network >> server with gen_tcp and gen_server, etc. >> >> I am now interested in Sinan to help me build a bigger app. I started with >> sinan gen which builds what looks like a sensible template to me. But sinan >> build fails to compile anything : >> >> $ sinan build >> [build] start >> [build] Building >> /Users/Taum/Documents/Erlang/testapp/lib/foo/src/foo_sup.erl >> [build] >> /Users/Taum/Documents/Erlang/testapp/lib/foo/src/foo_sup.erl:none:error:internal >> error in beam_asm; >> crash reason: {{badmatch,{error,enoent}}, >> [{filename,absname,1}, >> {compile,beam_asm,1}, >> {compile,'-internal_comp/4-anonymous-1-',2}, >> {compile,fold_comp,3}, >> {compile,internal_comp,4}, >> {compile,internal,3}]} >> >> >> On a side note, I'm also having a very hard time finding basic >> documentation about how to manage an app in Erlang/OTP: how to get started, >> run it, etc. Are there any good ressources out there I might have overlooked >> ? >> >> Cheers, >> Thomas >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > > -- > --Hynek (Pichi) Vychodil > > Analyze your data in minutes. Share your insights instantly. Thrill your > boss. Be a data hero! > Try Good Data now for free: www.gooddata.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rec@REDACTED Sat Feb 7 21:34:11 2009 From: rec@REDACTED (Roger Critchlow) Date: Sat, 7 Feb 2009 13:34:11 -0700 Subject: [erlang-questions] Charging your phone with Erlang In-Reply-To: <21890719.post@talk.nabble.com> References: <21890719.post@talk.nabble.com> Message-ID: <66d1c98f0902071234k5e20a8f2ndafd6f312920651@mail.gmail.com> Better, get a laptop that is able to power the usb ports when it's plugged in whether the computer is on or not. It's a BIOS option on my current Thinkpad, my dinky Averatec had it years ago, and my wife claims that her MacBooks do it. -- rec -- From elias@REDACTED Sun Feb 8 01:16:23 2009 From: elias@REDACTED (Elias Torres) Date: Sat, 7 Feb 2009 19:16:23 -0500 Subject: [erlang-questions] sinan build fails: internal error in beam_asm In-Reply-To: <9b5143660902071155t57b62e9eoec55e762ddfa3ff@mail.gmail.com> References: <9b5143660902051727q72de168cic00025a2f73367c6@mail.gmail.com> <4d08db370902060617r52aaca16k1bc1e08e81257dd9@mail.gmail.com> <9b5143660902071155t57b62e9eoec55e762ddfa3ff@mail.gmail.com> Message-ID: Hi Thomas, http://erlang.org/doc/man/erl.html has all of the information you need regarding command line arguments. -pa simply adds your directories to the beginning of the code path. When I write an application I simply use -s mod_name which calls by default mod_name:start/0 which then call application:start(my_app) or whatever. I too tried faxien/sinan/etc at first and ended up with a non-fully working setup that made me very uncomfortable because I didn't know everything that was happening on my behalf. Have you read Mitchell's tutorials? These might be very beneficial since they build everything from the ground up and eventually will lead you to a good starting template. http://spawnlink.com/articles/bundling-erlybank-as-an-application/ Cheers, -Elias 2009/2/7 Thomas Brian : > Thanks, actually I already saw that documentation and knew about > application:start(). I was looking for a simpler way to do that, because > spawning a shell and typing that everytime is rather tedious. > Also, my application -- as I would guess most erlang apps -- is a server, so > having to spawn a shell is not very practical as I need to logout after I > started the application. > After some extensive search, I found that I could start my app with : > erl -pa _build/development/apps/foo-0.1.0/ebin/ -boot > _build/development/releases/0.1.0.0/testapp > It seems weird to me that sinan does not provide a quick command such as > "sinan run" to start the app. Moreover I couldn't find this command (erl -pa > ... -boot ...) in any tutorial I read. My assumption was that this was a > really basic task most people would need. Am I wrong in guessing that? > > Besides, sinan build still spits this cryptic message in my face on my > development machine (Mac OS 10.5.6). I couldn't find anything interesting on > google. I was able to get sinan to work on Ubuntu, but I'd much rather have > it on my main OS. > > On Fri, Feb 6, 2009 at 3:17 PM, Hynek Vychodil > wrote: >> >> May be this should be helpful: >> http://www.erlang.org/doc/design_principles/part_frame.html >> Starting and Stopping Applications: >> http://www.erlang.org/doc/design_principles/applications.html#7.7 >> >> 2009/2/6 Thomas Brian >>> >>> Hi, >>> I'm trying to get a little bit more familiar with Erlang, and so far have >>> only done the very basics: playing with the shell, writing a basic network >>> server with gen_tcp and gen_server, etc. >>> I am now interested in Sinan to help me build a bigger app. I started >>> with sinan gen which builds what looks like a sensible template to me. But >>> sinan build fails to compile anything : >>> $ sinan build >>> [build] start >>> [build] Building >>> /Users/Taum/Documents/Erlang/testapp/lib/foo/src/foo_sup.erl >>> [build] >>> /Users/Taum/Documents/Erlang/testapp/lib/foo/src/foo_sup.erl:none:error:internal >>> error in beam_asm; >>> crash reason: {{badmatch,{error,enoent}}, >>> [{filename,absname,1}, >>> {compile,beam_asm,1}, >>> {compile,'-internal_comp/4-anonymous-1-',2}, >>> {compile,fold_comp,3}, >>> {compile,internal_comp,4}, >>> {compile,internal,3}]} >>> >>> On a side note, I'm also having a very hard time finding basic >>> documentation about how to manage an app in Erlang/OTP: how to get started, >>> run it, etc. Are there any good ressources out there I might have overlooked >>> ? >>> Cheers, >>> Thomas >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> >> >> -- >> --Hynek (Pichi) Vychodil >> >> Analyze your data in minutes. Share your insights instantly. Thrill your >> boss. Be a data hero! >> Try Good Data now for free: www.gooddata.com > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From steven.charles.davis@REDACTED Sun Feb 8 15:39:26 2009 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sun, 08 Feb 2009 08:39:26 -0600 Subject: [erlang-questions] Inets and SSL In-Reply-To: References: <0e922b47-ccf3-42dc-9f37-5f2d52ac2988@v5g2000pre.googlegroups.com> Message-ID: <498EEE9E.2050800@gmail.com> Hi, I'm having difficulty getting ssl to work with inets httpd, and would be very grateful for input/help on this one! The server starts fine, returns a pid. The port (443) is definitely open and listening according to the OS net stats. However, a connection from a browser just hangs with "connecting" (TIME_WAIT). It all just stays that way unless I stop inets in which case the browser will immediately report "page not available". Everything works fine for standard ip_comm. Also, if I move the pem files, then inets won't start (so I'm sure it can "see" them). Also these same cert/key pem files work fine if they are used for ssl with Nginx, so I'm sure they are not corrupt. Finally, it seems to make no difference at all if I have the "actual" erlang ssl application started or not. Here's the bare bones startup in which I've been trying all variants I can think of (including ssl's keyfile, certfile, ssl_ca_certificate_file, etc etc). start_ssl() -> inets:start(), {ok, Pid} = inets:start(httpd, [ {port, 443}, {server_name,"localhost"}, {server_root,"./tmp"}, {document_root,"./tmp/htdocs"}, {bind_address, "localhost"}, {socket_type, ssl}, {ssl_verify_client, 0}, {ssl_certificate_file, "../ssl/cacert.pem"}, {ssl_certificate_key_file, "../ssl/cakey.pem"}, {modules, [my_mod, mod_head, mod_get]}, {mimetypes, [ {"css", "text/css"}, {"js", "text/javascript"}, {"html", "text/html"} ]} ]), Pid. I'm probably doing something dumb, so any observations would be very much appreciated! /s From steven.charles.davis@REDACTED Sun Feb 8 16:04:12 2009 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sun, 08 Feb 2009 09:04:12 -0600 Subject: [erlang-questions] Inets and SSL Message-ID: <498EF46C.6050600@gmail.com> Hi, I'm having difficulty getting ssl to work with inets httpd, and would be very grateful for input/help on this one! The server starts fine, returns a pid. The port (443) is definitely open and listening according to the OS net stats. However, a connection from a browser just hangs with "connecting" (TIME_WAIT). It all just stays that way unless I stop inets in which case the browser will immediately report "page not available". Everything works fine for standard ip_comm. Also, if I move the pem files, then inets won't start (so I'm sure it can "see" them). Also these same cert/key pem files work fine if they are used for ssl with Nginx, so I'm sure they are not corrupt. Finally, it seems to make no difference at all if I have the "actual" erlang ssl application started or not. Here's the bare bones startup in which I've been trying all variants I can think of (including ssl's keyfile, certfile, ssl_ca_certificate_file, etc etc). start_ssl() -> inets:start(), {ok, Pid} = inets:start(httpd, [ {port, 443}, {server_name,"localhost"}, {server_root,"./tmp"}, {document_root,"./tmp/htdocs"}, {bind_address, "localhost"}, {socket_type, ssl}, {ssl_verify_client, 0}, {ssl_certificate_file, "../ssl/cacert.pem"}, {ssl_certificate_key_file, "../ssl/cakey.pem"}, {modules, [my_mod, mod_head, mod_get]}, {mimetypes, [ {"css", "text/css"}, {"js", "text/javascript"}, {"html", "text/html"} ]} ]), Pid. I'm probably doing something dumb, so any observations would be very much appreciated! /s From anton.belyaev@REDACTED Sun Feb 8 17:52:10 2009 From: anton.belyaev@REDACTED (Anton Belyaev) Date: Sun, 8 Feb 2009 19:52:10 +0300 Subject: [erlang-questions] Crash dump: processes_used and processes Message-ID: Hello, I am debugging an application. Slogan: eheap_alloc: Cannot allocate 298930300 bytes of memory (of type "old_heap"). I found a discrepancy between memory summary and actuals sum of processes' memory. Memory summary: =memory total: 1255206488 processes: 1150931020 processes_used: 1149949812 system: 104275468 atom: 622745 atom_used: 603397 binary: 10536328 code: 5789631 ets: 74272220 And then I summed all the memory params of processes: {'OldHeap unused': 138758171, 'Message queue length': 42888, 'OldHeap': 138758171, 'Stack+heap': 147839948, 'Heap unused': 24663410} Sack+heap is certainly less then "processes" in memory summary. Where does this discrepancy come from? What really does "processes" and "processes_used" stand for? Are messages in queue counted as memory, consumed by processes? Thanks. From dawsdesign@REDACTED Sun Feb 8 19:32:08 2009 From: dawsdesign@REDACTED (Matt Williamson) Date: Sun, 8 Feb 2009 13:32:08 -0500 Subject: [erlang-questions] Best approach for servers In-Reply-To: <9a09ca9a0902041659x73deba45rded57d7ca1cd8260@mail.gmail.com> References: <9a09ca9a0902041659x73deba45rded57d7ca1cd8260@mail.gmail.com> Message-ID: Have a VM started for each machine, that way there is no single point of failure. The /data question meaning you have a NAS and moint it to /data on every server? On Wed, Feb 4, 2009 at 7:59 PM, Kunthar wrote: > Hi all, > > We have > 5 of http://tinyurl.com/565gm2 > and 6 of http://tinyurl.com/b7vuvm > those models in our DC. > My question is, in production how we should setup the erlang nodes? > One huge server and individual erlang nodes started? (seems reasonable) > Or VM's separated and ever y single vm node runs one erlang instance? > For mnesia, what about data access? One large data array mounted to > same entry like /data? > > Peace > Kunth > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ssroy1979@REDACTED Sun Feb 8 20:43:12 2009 From: ssroy1979@REDACTED (Salonee Sinha Roy) Date: Sun, 8 Feb 2009 11:43:12 -0800 Subject: [erlang-questions] ErlTl question In-Reply-To: References: Message-ID: I am trying to use an ErlTL template to generate Xml strings. My template is a follows. <%! This template prints a sample XML %> <%? {Title} = Data %> <% XML_Elem %> I render this template using the following command erltl:compile("xml.et"). xml:render({<<"Test">>}). which returns [<<"\n\n">>,<<"Test">>,<<"\n\n">>] How do I use this to generate the xml string "Test". I dont really care about the white space. It can remain in the final xml string. I would really appreciate help with this. Thanks Salonee -------------- next part -------------- An HTML attachment was scrubbed... URL: From ssroy1979@REDACTED Sun Feb 8 20:46:15 2009 From: ssroy1979@REDACTED (Salonee Sinha Roy) Date: Sun, 8 Feb 2009 11:46:15 -0800 Subject: [erlang-questions] How to set the toot tag with xmerl. Message-ID: Hi All I have the following erlang code from the xmerl sample in the documentation. Data = {bike, [{year,"2003"},{color,"black"},{condition,"new"}], [{name, [{manufacturer,["Harley Davidsson"]}, {brandName,["XL1200C"]}, {additionalName,["Sportster"]}]}, {engine, ["V-engine, 2-cylinders, 1200 cc"]}, {kind,["custom"]}, {drive,["belt"]}]} , NewContent = lists:flatten([Data]), RootEl = #xmlElement{content=NewContent}, Export=xmerl:export_simple([RootEl],xmerl_xml), io:format("~p",[lists:flatten(Export)]). Running this method generates the following xml string "Harley DavidssonXL1200CSportsterV-engine, 2-cylinders, 1200 cccustombelt" The root tag is . How do I change this so that the root tag is "" Thanks Salonee -------------- next part -------------- An HTML attachment was scrubbed... URL: From jwecker@REDACTED Sun Feb 8 21:17:38 2009 From: jwecker@REDACTED (Joseph Wecker) Date: Sun, 08 Feb 2009 13:17:38 -0700 Subject: [erlang-questions] ErlTl question In-Reply-To: References: Message-ID: <498F3DE2.6040307@entride.com> Salonee Sinha Roy wrote: > > > which returns > [<<"\n\n">>,<<"Test">>,<<"\n\n">>] > > How do I use this to generate the xml string > "Test". I dont really care about the white space. > It can remain in the final xml string. If you're writing to a file or screen you're already done- just feed that straight in. For example, try file:write_file/2 your result there and then opening it in an editor. -Joseph From vychodil.hynek@REDACTED Sun Feb 8 21:28:29 2009 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Sun, 8 Feb 2009 21:28:29 +0100 Subject: [erlang-questions] ErlTl question In-Reply-To: <498F3DE2.6040307@entride.com> References: <498F3DE2.6040307@entride.com> Message-ID: <4d08db370902081228n7a52ebb9qef6ec5aadce7bc58@mail.gmail.com> Or past it to iolist_to_binary/1 and than binary_to_list/1. As Joseph mentioned, you rarely need to do it. Just send it by socket, write to file or console. For example io:fwrite([<<"\n\n">>,<<"Test">>,<<"\n\n">>]). On Sun, Feb 8, 2009 at 9:17 PM, Joseph Wecker wrote: > Salonee Sinha Roy wrote: > > > > > > which returns > > [<<"\n\n">>,<<"Test">>,<<"\n\n">>] > > > > How do I use this to generate the xml string > > "Test". I dont really care about the white space. > > It can remain in the final xml string. > If you're writing to a file or screen you're already done- just feed > that straight in. For example, try file:write_file/2 your result there > and then opening it in an editor. > > -Joseph > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try Good Data now for free: www.gooddata.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From elias@REDACTED Sun Feb 8 23:08:27 2009 From: elias@REDACTED (Elias Torres) Date: Sun, 8 Feb 2009 17:08:27 -0500 Subject: [erlang-questions] http client bug in inets when following relative redirects Message-ID: Here's the example: [eliast@REDACTED] /usr/local/lib/erlang/lib/inets-5.0.12/src $ erl -s inets Eshell V5.6.5 (abort with ^G) 1> http:request(get, {"http://mohegansun.com/",[]}, [{autoredirect, true},{relaxed, true}],[]). {error,{badarg,[{erlang,'++',[80,"//gateway/index.html"]}, {httpc_response,fix_relative_uri,2}, {httpc_response,redirect,2}, {httpc_handler,handle_response,1}, {gen_server,handle_msg,5}, {proc_lib,init_p_do_apply,3}]}} In httpc_response.erl:fix_relative_uri/2 I found the following: fix_relative_uri(Request, RedirUrl) -> {Server, Port} = Request#request.address, Path = Request#request.path, atom_to_list(Request#request.scheme) ++ "://" ++ Server ++ ":" ++ Port ++ Path ++ RedirUrl. It's choking when concatenating Port which is an integer. For now I have wrapped Port with an integer_to_list call, but this function really smells bad. For example, it grabs the original path and simply concatenates it with the redirect path. In this case "/" + "/gateway/index.html" == "//gateway/index.html" but what if the original path was /old_working_link"? Thanks for you attention to the matter. If there's an official place to submit this bug please let me know. -Elias From steven.charles.davis@REDACTED Sun Feb 8 23:11:16 2009 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sun, 8 Feb 2009 14:11:16 -0800 (PST) Subject: [erlang-questions] Inets and SSL In-Reply-To: <498EF46C.6050600@gmail.com> References: <498EF46C.6050600@gmail.com> Message-ID: <140df379-ba12-4fe1-b027-ced18fd3fbab@l33g2000pri.googlegroups.com> Hmmm a search of erlang-r12b5/lib for the atom ssl_certificate_file only appears to show it in appearing in the source for httpd_conf... ...UMMMMM... is ssl actually implemented for inets?!? The httpd user guide intro (4.1 of inets) says "The server implements numerous features such as SSL (Secure Sockets Layer), ...", but I'm struggling to see how! I sure hope I have got this very very wrong somehow... /s On Feb 8, 9:04?am, Steve Davis wrote: > Hi, > > I'm having difficulty getting ssl to work with inets httpd, and would be > very grateful for input/help on this one! > > The server starts fine, returns a pid. The port (443) is definitely open > and listening according to the OS net stats. However, a connection from > a browser just hangs with "connecting" (TIME_WAIT). It all just stays > that way unless I stop inets in which case the browser will immediately > report "page not available". > > Everything works fine for standard ip_comm. Also, if I move the pem > files, then inets won't start (so I'm sure it can "see" them). Also > these same cert/key pem files work fine if they are used for ssl with > Nginx, so I'm sure they are not corrupt. Finally, it seems to make no > difference at all if I have the "actual" erlang ssl application started > or not. > > Here's the bare bones startup in which I've been trying all variants I > can think of (including ssl's keyfile, certfile, > ssl_ca_certificate_file, etc etc). > > start_ssl() -> > ? ? ?inets:start(), > ? ? ?{ok, Pid} = inets:start(httpd, [ > ? ? ? ? ?{port, 443}, > ? ? ? ? ?{server_name,"localhost"}, > ? ? ? ? ?{server_root,"./tmp"}, > ? ? ? ? ?{document_root,"./tmp/htdocs"}, > ? ? ? ? ?{bind_address, "localhost"}, > ? ? ? ? ?{socket_type, ssl}, > ? ? ? ? ?{ssl_verify_client, 0}, > ? ? ? ? ?{ssl_certificate_file, "../ssl/cacert.pem"}, > ? ? ? ? ?{ssl_certificate_key_file, "../ssl/cakey.pem"}, > ? ? ? ? ?{modules, [my_mod, mod_head, mod_get]}, > ? ? ? ? ?{mimetypes, [ > ? ? ? ? ? ? ?{"css", "text/css"}, > ? ? ? ? ? ? ?{"js", "text/javascript"}, > ? ? ? ? ? ? ?{"html", "text/html"} > ? ? ? ? ?]} > ? ? ?]), > ? ? ?Pid. > > I'm probably doing something dumb, so any observations would be very > much appreciated! > > /s > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions From ok@REDACTED Mon Feb 9 01:20:46 2009 From: ok@REDACTED (Richard O'Keefe) Date: Mon, 9 Feb 2009 13:20:46 +1300 Subject: [erlang-questions] '--' BIF to be used with caution? In-Reply-To: <707529930902050630l250a8ae4nedbfa71e5d63460e@mail.gmail.com> References: <707529930901130404y5418466bmc375525ef765e615@mail.gmail.com> <6672d0160902040248n4ef30e0cm4e4e0cb718a04349@mail.gmail.com> <707529930902050630l250a8ae4nedbfa71e5d63460e@mail.gmail.com> Message-ID: <13728F3E-6CF3-4B58-B55B-88950019D370@cs.otago.ac.nz> On 6 Feb 2009, at 3:30 am, Malcolm Dowse wrote: > > I don't mind too much if '--' remains O(N^2). But the fact that it > made ERTS unresponsive is more of a worry, to me, because this > seemed to go against the spirit of the language. Since -- is seriously inefficient (you can easily get O(|l1|.lg|l2|) in pure Erlang, so what's the point of doing O(|l1|.|l2|) in C?), why not fix the blocking issue by just turning it into ordinary Erlang code? Is there any reason why an operator can't be implemented in Erlang? From ok@REDACTED Mon Feb 9 01:55:46 2009 From: ok@REDACTED (Richard O'Keefe) Date: Mon, 9 Feb 2009 13:55:46 +1300 Subject: [erlang-questions] beginner: Generating a list of prime numbers In-Reply-To: <31073ef90902051850h2377c242s9f25d39ff47c6166@mail.gmail.com> References: <31073ef90902051850h2377c242s9f25d39ff47c6166@mail.gmail.com> Message-ID: <4E2C3295-E0E9-4A24-A034-19AC820680F3@cs.otago.ac.nz> On 6 Feb 2009, at 3:50 pm, Mark Wagner wrote: > The problem with this is that the list of prime numbers is ordered > largest-first, so that the small primes (the ones most likely to be > factors of a given number) are tested last. This makes the > sophisticated solution slower than the naive one, which tests small > factors first. Any suggestions on how to fix this? Brute force. You test O(N) numbers, but find only O(log N) primes. Using Prime_List ++ [New_Prime] will thus add O((log N)**2)) time to your search, which must already be taking O(N) at least. This is one of the few cases where List ++ [Element] makes sense. > From kris_prieb@REDACTED Mon Feb 9 05:57:31 2009 From: kris_prieb@REDACTED (kprieb) Date: Sun, 8 Feb 2009 20:57:31 -0800 (PST) Subject: [erlang-questions] Runtime update of inetrc configuration Message-ID: <21902726.post@talk.nabble.com> Hello, I have the exact same question. Has anyone answered this yet? KP -- View this message in context: http://www.nabble.com/Runtime-update-of-inetrc-configuration-tp21485465p21902726.html Sent from the Erlang Questions mailing list archive at Nabble.com. From alpar@REDACTED Mon Feb 9 07:49:40 2009 From: alpar@REDACTED (=?ISO-8859-1?Q?Alp=E1r_J=FCttner?=) Date: Mon, 09 Feb 2009 06:49:40 +0000 Subject: [erlang-questions] beginner: Generating a list of prime numbers In-Reply-To: <4E2C3295-E0E9-4A24-A034-19AC820680F3@cs.otago.ac.nz> References: <31073ef90902051850h2377c242s9f25d39ff47c6166@mail.gmail.com> <4E2C3295-E0E9-4A24-A034-19AC820680F3@cs.otago.ac.nz> Message-ID: <1234162180.4649.7.camel@piko> On Mon, 2009-02-09 at 13:55 +1300, Richard O'Keefe wrote: > On 6 Feb 2009, at 3:50 pm, Mark Wagner wrote: > > The problem with this is that the list of prime numbers is ordered > > largest-first, so that the small primes (the ones most likely to be > > factors of a given number) are tested last. This makes the > > sophisticated solution slower than the naive one, which tests small > > factors first. Any suggestions on how to fix this? > > Brute force. You test O(N) numbers, but find only O(log N) primes. There are much more primes than that. (According to the "Prime number theorem", there are around N/lnN primes less then N.) Regards, Alpar From vladdu55@REDACTED Mon Feb 9 08:52:18 2009 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 9 Feb 2009 08:52:18 +0100 Subject: [erlang-questions] [erlide] poll: version support? Message-ID: <95be1d3b0902082352n867371dua5c488d7a4066449@mail.gmail.com> Hello everyone! This is the time of the year when I get to ask the questions about which minimum versions to support. Eclipse 3.5 is coming and the last erlide users that I know were using 3.3 are upgrading to 3.4. * Is there still anyone using erlide that runs Eclipse 3.3 and can't upgrade? (no answer = "I can upgrade or already did") * If yes, when do you think you will be able to upgrade? And the similar question about Erlang versions. * Is there still anyone using erlide that runs Erlang R11 and can't upgrade? (no answer = "I can upgrade or already did") * If yes, when do you think you will be able to upgrade? And why not consider even the Java versions, since Java 1.5 will reach its end of service life October 8th, 2009: * Is there still anyone using erlide that runs Java 1.5 on your development machines and can't upgrade? (no answer = "I can upgrade or already did") * If yes, when do you think you will be able to upgrade? best regards, Vlad From ingela@REDACTED Mon Feb 9 09:38:33 2009 From: ingela@REDACTED (Ingela Anderton Andin) Date: Mon, 09 Feb 2009 09:38:33 +0100 Subject: [erlang-questions] erlang-questions] Inets and SSL In-Reply-To: References: Message-ID: <498FEB89.8080903@erix.ericsson.se> Hi ! Your are probably not doing anything dumb :) This is a know bug that has been fixed and will be part of the upcoming release. The release note says: Ssl did not work correctly with the use of new style configuration due to an old internal format that was not changed correctly in all places. So a workaround would be to use old-style apache-like configuration files. ( I know that is not very appealing ;)) or wait for R13 that is due in the end of Mars. Regards Ingela Erlang/OTP - Ericsson > > Hi, > > I'm having difficulty getting ssl to work with inets httpd, and would be > very grateful for input/help on this one! > > The server starts fine, returns a pid. The port (443) is definitely open > and listening according to the OS net stats. However, a connection from > a browser just hangs with "connecting" (TIME_WAIT). It all just stays > that way unless I stop inets in which case the browser will immediately > report "page not available". > > Everything works fine for standard ip_comm. Also, if I move the pem > files, then inets won't start (so I'm sure it can "see" them). Also > these same cert/key pem files work fine if they are used for ssl with > Nginx, so I'm sure they are not corrupt. Finally, it seems to make no > difference at all if I have the "actual" erlang ssl application started > or not. > > Here's the bare bones startup in which I've been trying all variants I > can think of (including ssl's keyfile, certfile, > ssl_ca_certificate_file, etc etc). > > start_ssl() -> > inets:start(), > {ok, Pid} = inets:start(httpd, [ > {port, 443}, > {server_name,"localhost"}, > {server_root,"./tmp"}, > {document_root,"./tmp/htdocs"}, > {bind_address, "localhost"}, > {socket_type, ssl}, > {ssl_verify_client, 0}, > {ssl_certificate_file, "../ssl/cacert.pem"}, > {ssl_certificate_key_file, "../ssl/cakey.pem"}, > {modules, [my_mod, mod_head, mod_get]}, > {mimetypes, [ > {"css", "text/css"}, > {"js", "text/javascript"}, > {"html", "text/html"} > ]} > ]), > Pid. > > I'm probably doing something dumb, so any observations would be very > much appreciated! > > From bertil.karlsson@REDACTED Mon Feb 9 09:52:11 2009 From: bertil.karlsson@REDACTED (Bertil Karlsson) Date: Mon, 09 Feb 2009 09:52:11 +0100 Subject: [erlang-questions] How to set the toot tag with xmerl. In-Reply-To: References: Message-ID: <498FEEBB.6050501@ericsson.com> Hi, all record fields that are not set get their default values when the record is created. So, you have to set the name field of the xmlElement RootEl to your desired value. /Bertil Salonee Sinha Roy wrote: > Hi All > I have the following erlang code from the xmerl sample in the > documentation. > > Data = > {bike, > [{year,"2003"},{color,"black"},{condition,"new"}], > [{name, > [{manufacturer,["Harley Davidsson"]}, > {brandName,["XL1200C"]}, > {additionalName,["Sportster"]}]}, > {engine, > ["V-engine, 2-cylinders, 1200 cc"]}, > {kind,["custom"]}, > {drive,["belt"]}]} , > > NewContent = lists:flatten([Data]), > RootEl = #xmlElement{content=NewContent}, > Export=xmerl:export_simple([RootEl],xmerl_xml), > io:format("~p",[lists:flatten(Export)]). > > Running this method generates the following xml string > > " condition=\"new\">Harley > DavidssonXL1200CSportsterV-engine, > 2-cylinders, 1200 > cccustombelt" > > The root tag is . How do I change this so that the root tag > is "" > > Thanks > Salonee > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From ingela@REDACTED Mon Feb 9 10:43:43 2009 From: ingela@REDACTED (Ingela Anderton Andin) Date: Mon, 09 Feb 2009 10:43:43 +0100 Subject: [erlang-questions] Re : http client bug in inets when following relative redirects In-Reply-To: References: Message-ID: <498FFACF.30400@erix.ericsson.se> Hi! > [eliast@REDACTED] /usr/local/lib/erlang/lib/inets-5.0.12/src $ erl -s inets > Eshell V5.6.5 (abort with ^G) > 1> http:request(get, {"http://mohegansun.com/",[]}, [{autoredirect, > true},{relaxed, true}],[]). > error,{badarg,[{erlang,'++',[80,"//gateway/index.html"]}, {httpc_response,fix_relative_uri,2}, {httpc_response,redirect,2}, {httpc_handler,handle_response,1}, {gen_server,handle_msg,5}, {proc_lib,init_p_do_apply,3}]}} > In httpc_response.erl:fix_relative_uri/2 I found the following: > fix_relative_uri(Request, RedirUrl) -> > {Server, Port} = Request#request.address, > Path = Request#request.path, > atom_to_list(Request#request.scheme) ++ "://" ++ Server ++ ":" ++ Port > ++ Path ++ RedirUrl. > It's choking when concatenating Port which is an integer. For now I > have wrapped Port with an integer_to_list call, but this function > really smells bad. For example, it grabs the original path and simply > concatenates it with the redirect path. In this case "/" + > "/gateway/index.html" == "//gateway/index.html" but what if the >original path was /old_working_link"? Thank you for pointing this out, we will look into the issue. > Thanks for you attention to the matter. If there's an official place > to submit this bug please let me know. erlang-bugserlang.org Change to @ You can subscrie to it here: http://www.erlang.org/faq.html Ingela Erlang/OTP - Ericsson From imre@REDACTED Mon Feb 9 10:49:01 2009 From: imre@REDACTED (Imre Palik) Date: Mon, 9 Feb 2009 11:49:01 +0200 Subject: [erlang-questions] Crash on alloc - Email found in subject Message-ID: <3BE6DBA1F3BE9D4798255806113D5654421594C407@utx-exchange.utx.local> Felad?: Jachym Holecek [freza@REDACTED] >> > >> > This is the standard behaviour when the VM runs out of memory.... Try >> > generating smaller lists or adding more memory to your computer. >> >> I have 3 Gigs, and as far as I can see, this fails on an alloc of less then 400 Megs. Does this quite reliably, even as the first command of the shell. > > Assuming you're running a Unix-like OS: try increasing your data area > limit (man ulimit). Nowdays, most of the time I am playing on windows. I tried the same alloc on Linux, and there it seems to work OK. Can it be that I have all the weirdness (I.e., memory problems, recursion slower than list comprehension) because of windows? I. From otokan@REDACTED Mon Feb 9 14:39:56 2009 From: otokan@REDACTED (Onur Tokan) Date: Mon, 9 Feb 2009 15:39:56 +0200 Subject: [erlang-questions] Erlang for Windows XP 64bit Message-ID: Hello, Is there any build available for Windows 64bit? From steven.charles.davis@REDACTED Mon Feb 9 15:41:35 2009 From: steven.charles.davis@REDACTED (Steve Davis) Date: Mon, 9 Feb 2009 06:41:35 -0800 (PST) Subject: [erlang-questions] erlang-questions] Inets and SSL In-Reply-To: <498FEB89.8080903@erix.ericsson.se> References: <498FEB89.8080903@erix.ericsson.se> Message-ID: <9b2892ed-7dc8-49de-9096-d258ff123218@o2g2000prl.googlegroups.com> Thanks, Ingela. That would indeed explain it! It did "feel" like a bug but I couldn't track it down exactly, so I was using the principle of "it's you until you can prove otherwise". Thanks for confirming, I will stop struggling :) /s On Feb 9, 2:38?am, Ingela Anderton Andin wrote: > Hi ! > > Your are probably not doing anything dumb :) ?This is a know bug that > has been fixed > and will be part of the upcoming release. > > The release note says: > > Ssl did not work correctly with the use of new style configuration due > to an old internal format that was not > changed correctly in all places. > > So a workaround would be to use old-style apache-like configuration > files. ( I know that is not very appealing ;)) > or wait for R13 that is due in the end of Mars. > > Regards Ingela Erlang/OTP - Ericsson > > > > > > > Hi, > > > I'm having difficulty getting ssl to work with inets httpd, and would be > > very grateful for input/help on this one! > > > The server starts fine, returns a pid. The port (443) is definitely open > > and listening according to the OS net stats. However, a connection from > > a browser just hangs with "connecting" (TIME_WAIT). It all just stays > > that way unless I stop inets in which case the browser will immediately > > report "page not available". > > > Everything works fine for standard ip_comm. Also, if I move the pem > > files, then inets won't start (so I'm sure it can "see" them). Also > > these same cert/key pem files work fine if they are used for ssl with > > Nginx, so I'm sure they are not corrupt. Finally, it seems to make no > > difference at all if I have the "actual" erlang ssl application started > > or not. > > > Here's the bare bones startup in which I've been trying all variants I > > can think of (including ssl's keyfile, certfile, > > ssl_ca_certificate_file, etc etc). > > > start_ssl() -> > > ? ? ?inets:start(), > > ? ? ?{ok, Pid} = inets:start(httpd, [ > > ? ? ? ? ?{port, 443}, > > ? ? ? ? ?{server_name,"localhost"}, > > ? ? ? ? ?{server_root,"./tmp"}, > > ? ? ? ? ?{document_root,"./tmp/htdocs"}, > > ? ? ? ? ?{bind_address, "localhost"}, > > ? ? ? ? ?{socket_type, ssl}, > > ? ? ? ? ?{ssl_verify_client, 0}, > > ? ? ? ? ?{ssl_certificate_file, "../ssl/cacert.pem"}, > > ? ? ? ? ?{ssl_certificate_key_file, "../ssl/cakey.pem"}, > > ? ? ? ? ?{modules, [my_mod, mod_head, mod_get]}, > > ? ? ? ? ?{mimetypes, [ > > ? ? ? ? ? ? ?{"css", "text/css"}, > > ? ? ? ? ? ? ?{"js", "text/javascript"}, > > ? ? ? ? ? ? ?{"html", "text/html"} > > ? ? ? ? ?]} > > ? ? ?]), > > ? ? ?Pid. > > > I'm probably doing something dumb, so any observations would be very > > much appreciated! > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions From kris_prieb@REDACTED Mon Feb 9 16:39:02 2009 From: kris_prieb@REDACTED (kprieb) Date: Mon, 9 Feb 2009 07:39:02 -0800 (PST) Subject: [erlang-questions] Runtime update of inetrc configuration In-Reply-To: <65691fa00901151144s231ac3c5mf8b80648539a8bd1@mail.gmail.com> References: <65691fa00901151144s231ac3c5mf8b80648539a8bd1@mail.gmail.com> Message-ID: <21915366.post@talk.nabble.com> Hello, I have the exact same question. Has anyone answered this yet? KP kdronnqvist wrote: > > Hello, > > I'm wondering if it's possible to update the kernel inetrc configuration > at > runtime? What I want to do is to add more host aliases without restarting > Erlang. > > BR, > Daniel > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- View this message in context: http://www.nabble.com/Runtime-update-of-inetrc-configuration-tp21485465p21915366.html Sent from the Erlang Questions mailing list archive at Nabble.com. From qiulang@REDACTED Mon Feb 9 17:05:28 2009 From: qiulang@REDACTED (lang qiu) Date: Tue, 10 Feb 2009 00:05:28 +0800 Subject: [erlang-questions] Can someone provide a makefile to run the messenger examples in "getting started with erlang" ? Message-ID: Hi all, Can someone provide a makefile to run the messenger examples in "getting started with erlang" please ? So with this makefile, among other things, I don't provide a node name manually every time I start a new messenger client. Thanks a lot Qiulang -------------- next part -------------- An HTML attachment was scrubbed... URL: From nem@REDACTED Mon Feb 9 17:40:33 2009 From: nem@REDACTED (Geoff Cant) Date: Mon, 09 Feb 2009 17:40:33 +0100 Subject: [erlang-questions] Runtime update of inetrc configuration In-Reply-To: <21915366.post@talk.nabble.com> (kprieb's message of "Mon, 9 Feb 2009 07:39:02 -0800 (PST)") References: <65691fa00901151144s231ac3c5mf8b80648539a8bd1@mail.gmail.com> <21915366.post@talk.nabble.com> Message-ID: Well, you can follow the code that populates inet_db from resolv.conf and friends at http://github.com/mfoemmel/erlang-otp/blob/master/lib/kernel/src/inet_db.erl and http://github.com/mfoemmel/erlang-otp/blob/master/lib/kernel/src/inet_parse.erl The inet_db module itself has functions to update nameservers, domain search lists etc. inet_db:add_host({127,0,0,1}, "yourhostnamehere") might do what you want. It's all undocumented, so it wouldn't pay to write code using it unless you want to pay the maintenance cost later. --Geoff kprieb writes: > Hello, > > I have the exact same question. Has anyone answered this yet? > > KP > > > kdronnqvist wrote: >> >> Hello, >> >> I'm wondering if it's possible to update the kernel inetrc configuration >> at >> runtime? What I want to do is to add more host aliases without restarting >> Erlang. >> >> BR, >> Daniel From ad.sergey@REDACTED Mon Feb 9 22:36:29 2009 From: ad.sergey@REDACTED (Sergey S) Date: Mon, 9 Feb 2009 13:36:29 -0800 Subject: [erlang-questions] Is there something like fprof but for memory profiling? Message-ID: Hello. I'm looking for a tool which can help me to find out how much memory a function has consumed during its execution. I haven't just found anything about it in Efficiency Guide. Is it possible to measure it? Thanks. -- Sergey From mrad-direct-erlang@REDACTED Mon Feb 9 23:03:59 2009 From: mrad-direct-erlang@REDACTED (Michael Radford) Date: Mon, 9 Feb 2009 14:03:59 -0800 Subject: [erlang-questions] Is there something like fprof but for memory profiling? In-Reply-To: References: Message-ID: <20090209220359.GA4814@herbie> Sergey S writes: > I'm looking for a tool which can help me to find out how much memory a > function has consumed during its execution. For a single invocation, you can get a rough answer by spawning a fresh process: Measure = fun (F) -> Parent = self (), Pid = spawn (fun () -> { memory, M0 } = erlang:process_info (self (), memory), F (), { memory, M1 } = erlang:process_info (self (), memory), Parent ! { self (), M1 - M0 } end), receive { Pid, Bytes } when is_integer (Bytes) -> Bytes end end. 2> Measure (fun () -> ok end). 2440 3> Measure (fun () -> lists:seq(1,100000) end). 1267296 But you are probably interested in measuring an average over a long run of your server... For that, I have no good answer, except maybe look at running the emulator in instrumented mode (-instr) and see if the output of instrument:descr(instrument:memory_data()) is helpful. It will give you blocks allocated by process id, which can often narrow things down to a single module, but not a single function. Unfortunately, the instrumented emulator adds a lot of overhead, so your program will run slow and require a lot more memory. It would be fantastic to have a Erlang tool like valgrind's massif, which tagged each allocation with a stacktrace and showed you statistics on heap usage over time. Mike From dave@REDACTED Fri Feb 6 17:02:45 2009 From: dave@REDACTED (Dave Peticolas) Date: Fri, 06 Feb 2009 08:02:45 -0800 Subject: [erlang-questions] Erlang emacs mode update for -type and -spec? In-Reply-To: <24072882.5011233904516947.JavaMail.root@zimbra> References: <24072882.5011233904516947.JavaMail.root@zimbra> Message-ID: <498C5F25.4010004@krondo.com> It doesn't, but if you forward your patches to me, I will get them into the erlware version. Adam Lindberg wrote: > The Erlware Mode is a bugfixed / updated version I've been using a lot. Contains a lot of useful fixes for indentation and syntax highlighting etc. I don't know if they've incorporated the -spec and -type highlights though. > > http://code.google.com/p/erlware-mode/ > > Cheers, > Adam > > ----- sand@REDACTED wrote: > >> Chandru writes: >>> Does anyone have an update to the Emacs erlang mode to colour the >> -type and >>> -spec declarations differently. When used a lot, they are making it >> slightly >>> harder to read the code. >> More generally: >> >> * Who maintains erlang.el? >> * Is 2.5.2 the latest version? >> * How can we submit patches? >> * How far back does compatibility need to extend? >> >> I have a fix against 2.5.2 for "erlang-get-function-arrow" such that >> it >> won't match arrows in strings and comments. Erlang's major mode >> should >> also run "after-change-major-mode-hook", but it doesn't. >> >> Derek >> >> -- >> Derek Upham >> sand@REDACTED >> _______________________________________________ >> 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 erlangy@REDACTED Mon Feb 9 23:18:34 2009 From: erlangy@REDACTED (Michael McDaniel) Date: Mon, 9 Feb 2009 14:18:34 -0800 Subject: [erlang-questions] Is there something like fprof but for memory profiling? In-Reply-To: References: Message-ID: <20090209221834.GA22018@delora.autosys.us> http://code.google.com Search: erlang performance find eper : http://code.google.com/p/eper/ which may be useful. Check out the dtop program. ~Michael On Mon, Feb 09, 2009 at 01:36:29PM -0800, Sergey S wrote: > Hello. > > I'm looking for a tool which can help me to find out how much memory a > function has consumed during its execution. > > I haven't just found anything about it in Efficiency Guide. Is it > possible to measure it? > > Thanks. > > -- > Sergey > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Michael McDaniel Portland, Oregon, USA http://autosys.us From ok@REDACTED Tue Feb 10 01:43:34 2009 From: ok@REDACTED (Richard O'Keefe) Date: Tue, 10 Feb 2009 13:43:34 +1300 Subject: [erlang-questions] beginner: Generating a list of prime numbers In-Reply-To: <1234162180.4649.7.camel@piko> References: <31073ef90902051850h2377c242s9f25d39ff47c6166@mail.gmail.com> <4E2C3295-E0E9-4A24-A034-19AC820680F3@cs.otago.ac.nz> <1234162180.4649.7.camel@piko> Message-ID: On 9 Feb 2009, at 7:49 pm, Alp?r J?ttner wrote: >> Brute force. You test O(N) numbers, but find only O(log N) primes. > > There are much more primes than that. Yes, typo. I meant O(N/log N), and it's precisely the Prime number theorem I was referring to. The list of numbers to be checked against only needs to grow to O(sqrt(N)). In any case, the bulk of the checks are going to be against the first few primes. If you step through numbers in, say, blocks of 30 (= 2*3*5), there are only 8 candidates in each block (the others all being a multiple of 2, 3, or 5). From elias@REDACTED Tue Feb 10 02:47:48 2009 From: elias@REDACTED (Elias Torres) Date: Mon, 9 Feb 2009 20:47:48 -0500 Subject: [erlang-questions] Re : http client bug in inets when following relative redirects In-Reply-To: <498FFACF.30400@erix.ericsson.se> References: <498FFACF.30400@erix.ericsson.se> Message-ID: Ingela, Thanks for looking into this. I wanted to give you something better than just 'this code smells' so I did a first pass of implementing urlsplit, urlunsplit, urljoin a la 'python' based on RFC 3986. In case you don't get the attached code, I've uploaded to pastebin. http://pastebin.com/m139cf371 I would appreciate anybody taking a look at the code and giving me feedback, I'm sure things could be done better. If ibrowse/mochiweb folks are interested in the function, please feel free to take it as well. -Elias On Mon, Feb 9, 2009 at 4:43 AM, Ingela Anderton Andin wrote: > Hi! > >> [eliast@REDACTED] /usr/local/lib/erlang/lib/inets-5.0.12/src $ erl -s inets > >> Eshell V5.6.5 (abort with ^G) >> 1> http:request(get, {"http://mohegansun.com/",[]}, [{autoredirect, >> true},{relaxed, true}],[]). >> error,{badarg,[{erlang,'++',[80,"//gateway/index.html"]}, > {httpc_response,fix_relative_uri,2}, > {httpc_response,redirect,2}, > {httpc_handler,handle_response,1}, > {gen_server,handle_msg,5}, > {proc_lib,init_p_do_apply,3}]}} > >> In httpc_response.erl:fix_relative_uri/2 I found the following: > >> fix_relative_uri(Request, RedirUrl) -> >> {Server, Port} = Request#request.address, >> Path = Request#request.path, >> atom_to_list(Request#request.scheme) ++ "://" ++ Server ++ ":" ++ Port >> ++ Path ++ RedirUrl. > >> It's choking when concatenating Port which is an integer. For now I >> have wrapped Port with an integer_to_list call, but this function >> really smells bad. For example, it grabs the original path and simply >> concatenates it with the redirect path. In this case "/" + >> "/gateway/index.html" == "//gateway/index.html" but what if the >>original path was /old_working_link"? > > Thank you for pointing this out, we will look into the issue. > >> Thanks for you attention to the matter. If there's an official place >> to submit this bug please let me know. > > erlang-bugserlang.org Change to @ > > You can subscrie to it here: > http://www.erlang.org/faq.html > > Ingela Erlang/OTP - Ericsson > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- A non-text attachment was scrubbed... Name: http_uri_elias.erl Type: application/octet-stream Size: 10079 bytes Desc: not available URL: From ok@REDACTED Tue Feb 10 04:11:19 2009 From: ok@REDACTED (Richard O'Keefe) Date: Tue, 10 Feb 2009 16:11:19 +1300 Subject: [erlang-questions] Library proposal: O(N+M) suffix/2 Message-ID: <273A52D7-CA8E-498E-97D8-E175342C364A@cs.otago.ac.nz> The lists module in Erlang's standard library offers a function lists:suffix(Suffix, List) which takes O(|Suffix|.|Lists|) time. Most of this is spent inside the head testing whether List is equal to Suffix yet; the rest of the work is O(|List|). It is possible to implement this function in O(|Suffix| + |Lists|) time, and I propose that it should be done. Here's the code: suffix(Suffix, List) -> Delta = length(List) - length(Suffix), ( Delta >= 0 andalso nthtail(Delta, List) =:= Suffix ). From bgustavsson@REDACTED Tue Feb 10 08:00:34 2009 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Tue, 10 Feb 2009 08:00:34 +0100 Subject: [erlang-questions] Library proposal: O(N+M) suffix/2 In-Reply-To: <273A52D7-CA8E-498E-97D8-E175342C364A@cs.otago.ac.nz> References: <273A52D7-CA8E-498E-97D8-E175342C364A@cs.otago.ac.nz> Message-ID: <6672d0160902092300g1ab4779ft8fbd2fed312821e8@mail.gmail.com> On Tue, Feb 10, 2009 at 4:11 AM, Richard O'Keefe wrote: > The lists module in Erlang's standard library > offers a function lists:suffix(Suffix, List) > which takes O(|Suffix|.|Lists|) time. > Most of this is spent inside the head testing > whether List is equal to Suffix yet; the rest > of the work is O(|List|). > > It is possible to implement this function in > O(|Suffix| + |Lists|) time, and I propose that > it should be done. Here's the code: > > suffix(Suffix, List) -> > Delta = length(List) - length(Suffix), > ( Delta >= 0 andalso nthtail(Delta, List) =:= Suffix ). > Thanks! Since this is a compatible change, we will include it R13A. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From vychodil.hynek@REDACTED Tue Feb 10 09:44:20 2009 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Tue, 10 Feb 2009 09:44:20 +0100 Subject: [erlang-questions] '--' BIF to be used with caution? In-Reply-To: <13728F3E-6CF3-4B58-B55B-88950019D370@cs.otago.ac.nz> References: <707529930901130404y5418466bmc375525ef765e615@mail.gmail.com> <6672d0160902040248n4ef30e0cm4e4e0cb718a04349@mail.gmail.com> <707529930902050630l250a8ae4nedbfa71e5d63460e@mail.gmail.com> <13728F3E-6CF3-4B58-B55B-88950019D370@cs.otago.ac.nz> Message-ID: <4d08db370902100044y4ea7c5cbl5e3bb9cefb9caafa@mail.gmail.com> On Mon, Feb 9, 2009 at 1:20 AM, Richard O'Keefe wrote: > > On 6 Feb 2009, at 3:30 am, Malcolm Dowse wrote: > > > > I don't mind too much if '--' remains O(N^2). But the fact that it > > made ERTS unresponsive is more of a worry, to me, because this > > seemed to go against the spirit of the language. > > Since -- is seriously inefficient (you can easily get O(|l1|.lg|l2|) > in pure Erlang, so what's the point of doing O(|l1|.|l2|) in C?), > why not fix the blocking issue by just turning it into ordinary > Erlang code? Is there any reason why an operator can't be implemented > in Erlang? It's easy, constants for serious amount |2|. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try Good Data now for free: www.gooddata.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From Philip.Fennell@REDACTED Tue Feb 10 10:21:38 2009 From: Philip.Fennell@REDACTED (Philip Fennell) Date: Tue, 10 Feb 2009 09:21:38 -0000 Subject: [erlang-questions] HTTP requests and the meaning of eaddrinuse In-Reply-To: <200902060802.n1682Hot010521@pluto.hedeland.org> References: <200902060802.n1682Hot010521@pluto.hedeland.org> Message-ID: Per wrote: > Now if you have 5000 lines with TIME_WAIT... - or at least > a "large number", which may be the (default) size of the > "port range" (as discussed in the thread) on Windows - you > probably have the reason. Yes I believe that was the case. For anyone who is interested, I get one of our clever Ops chaps to create me the following 5 lined .reg script that updates the registry: Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters] "MaxUserPort"=dword:00001388 "TcpTimedWaitDelay"=dword:0000001e Where: MaxUserPOrts = 5000 TcpTimedWaitDelay = 30 (seconds I presume, or maybe milliseconds?) Once I double-clicked on the file and re-started my PC I no longer got any eaddrinuse errors. Just that that might be useful to someone. Regards and thanks for everyone's help, Philip Fennell -----Original Message----- From: Per Hedeland [mailto:per@REDACTED] Sent: 06 February 2009 08:02 To: Philip Fennell Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] HTTP requests and the meaning of eaddrinuse "Philip Fennell" wrote: > >I must admit that a lot of that was way outside of my area but from >what I gather I'm running-out of available ports, and netstat tells me, >by its last line of output: > >> TCP PC-S051049:5000 pal.sandbox.dev.bbc.co.uk:5984 >TIME_WAIT > >That I have 5000 ports in the TIME_WAIT state. Unless netstat output on Windows is radically different from *nix, it doesn't mean that - each line represents (at most) one connection. The above would represent a connection between a local port 5000 and a remote port 5984, that is in the TIME_WAIT state (i.e. a potential "troublemaker"). Now if you have 5000 lines with TIME_WAIT... - or at least a "large number", which may be the (default) size of the "port range" (as discussed in the thread) on Windows - you probably have the reason. In which case one way to avoid it may be to increase the port range - if it's possible on Windows, google can probably tell you how it's done. --Per http://www.bbc.co.uk/ This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated. If you have received it in error, please delete it from your system. Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately. Please note that the BBC monitors e-mails sent or received. Further communication will signify your consent to this. From ssroy1979@REDACTED Tue Feb 10 15:06:31 2009 From: ssroy1979@REDACTED (Salonee Sinha Roy) Date: Tue, 10 Feb 2009 06:06:31 -0800 Subject: [erlang-questions] yaws crashes Message-ID: Hi I am trying to write a simple facebook app with iframes using yaws. My code is below out(Arg) -> {ok,User} = queryvar(Arg,"fb_sig_user"), case queryvar(Arg,"fb_sig_user_add") of {ok,Page} -> %% check if the user has added the app if Page == "0" -> {redirect_local,string:concat("/www/terms_cond.html?soc=fb&uid=",User)}; Page == "1" -> {redirect_local,string:concat("/www/mask_flash.html?soc=fb&uid=",User)} end end. When I try going to the page above I get the following error ERROR erlang code crashed: File: /home/owner/Desktop/erlang/yaws/mask/mask.yaws:1 Reason: {{case_clause,undefined}, [{m5,out,1}, {yaws_server,deliver_dyn_part,8}, {yaws_server,aloop,3}, {yaws_server,acceptor0,2}, {proc_lib,init_p_do_apply,3}]} Req: {http_request,'GET', {abs_path,"/mask.yaws?fb_sig_in_iframe=1&fb_sig_locale=en_US&fb_sig_in_new_facebook=1&fb_sig_time=1234274303.4696&fb_sig_added=1&fb_sig_profile_update_time=1216854205&fb_sig_expires=0&fb_sig_user=713876569&fb_sig_session_key=e96b0d4702c06f34e28a68df-713876569&fb_sig_ss=0c2b63ba80e8ef2151b978a0ecd57fe7&fb_sig_ext_perms=offline_access%2Cemail&fb_sig_api_key=648e964d7625f3ed0d49cbb55b46c96a&fb_sig_app_id=2408954250&fb_sig=d34f0ce1ef76b40561a6e0e29dee2db9"}, {1,1}} Stack: [{m5,out,1}, {yaws_server,deliver_dyn_part,8}, {yaws_server,aloop,3}, {yaws_server,acceptor0,2 {proc_lib,init_p_do_apply,3}] Any help would be appreciated. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rvirding@REDACTED Tue Feb 10 15:36:16 2009 From: rvirding@REDACTED (Robert Virding) Date: Tue, 10 Feb 2009 15:36:16 +0100 Subject: [erlang-questions] yaws crashes In-Reply-To: References: Message-ID: <3dbc6d1c0902100636q52e65585qebe519b92f048c27@mail.gmail.com> I am not a yaws expert, but ... The error reason, {case_clause,undefined}, says that in the case in out/1 there is no clause which matches the value returned by the call to queryvar/1. The returned value is 'undefined' but there is only a clause which matches {ok,Page}. An error is generated if there is no matching clause in a case. Note that an error will also be generated if the first call to queryvar/1 does not return a value which matches {ok,User}. I hope this helps, Robert 2009/2/10 Salonee Sinha Roy > Hi > I am trying to write a simple facebook app with iframes using yaws. My code > is below > > > out(Arg) -> > {ok,User} = queryvar(Arg,"fb_sig_user"), > case queryvar(Arg,"fb_sig_user_add") of > {ok,Page} -> > %% check if the user has added the app > if > Page == "0" -> > > {redirect_local,string:concat("/www/terms_cond.html?soc=fb&uid=",User)}; > Page == "1" -> > > {redirect_local,string:concat("/www/mask_flash.html?soc=fb&uid=",User)} > end > end. > > > > When I try going to the page above I get the following error > > ERROR erlang code crashed: > File: /home/owner/Desktop/erlang/yaws/mask/mask.yaws:1 > Reason: {{case_clause,undefined}, > [{m5,out,1}, > {yaws_server,deliver_dyn_part,8}, > {yaws_server,aloop,3}, > > > {yaws_server,acceptor0,2}, > {proc_lib,init_p_do_apply,3}]} > Req: {http_request,'GET', > {abs_path,"/mask.yaws?fb_sig_in_iframe=1&fb_sig_locale=en_US&fb_sig_in_new_facebook=1&fb_sig_time=1234274303.4696&fb_sig_added=1&fb_sig_profile_update_time=1216854205&fb_sig_expires=0&fb_sig_user=713876569&fb_sig_session_key=e96b0d4702c06f34e28a68df-713876569&fb_sig_ss=0c2b63ba80e8ef2151b978a0ecd57fe7&fb_sig_ext_perms=offline_access%2Cemail&fb_sig_api_key=648e964d7625f3ed0d49cbb55b46c96a&fb_sig_app_id=2408954250&fb_sig=d34f0ce1ef76b40561a6e0e29dee2db9"}, > > > {1,1}} > Stack: [{m5,out,1}, > {yaws_server,deliver_dyn_part,8}, > {yaws_server,aloop,3}, > {yaws_server,acceptor0,2 > {proc_lib,init_p_do_apply,3}] > > > Any help would be appreciated. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bqt@REDACTED Tue Feb 10 15:44:08 2009 From: bqt@REDACTED (Johnny Billquist) Date: Tue, 10 Feb 2009 15:44:08 +0100 Subject: [erlang-questions] yaws crashes In-Reply-To: References: Message-ID: <499192B8.7080200@softjar.se> Salonee Sinha Roy wrote: > Hi > I am trying to write a simple facebook app with iframes using yaws. My > code is below > > > out(Arg) -> > {ok,User} = queryvar(Arg,"fb_sig_user"), > case queryvar(Arg,"fb_sig_user_add") of > {ok,Page} -> > %% check if the user has added the app > if > Page == "0" -> > > {redirect_local,string:concat("/www/terms_cond.html?soc=fb&uid=",User)}; > Page == "1" -> > > {redirect_local,string:concat("/www/mask_flash.html?soc=fb&uid=",User)} > end > end. > > > > When I try going to the page above I get the following error [...] Simple. queryvar(Arg,"fb_sig_user_add") is not returning one of the values you have listed in the case. :-) And if I may give a suggestion, I would write it like this: out(Arg) -> {ok,User} = queryvar(Arg,"fb_sig_user"), case queryvar(Arg,"fb_sig_user_add") of {ok,"0"} -> {redirect_local,string:concat("/www/terms_cond.html?soc=fb&uid=",User)}; {ok,"1"} -> {redirect_local,string:concat("/www/mask_flash.html?soc=fb&uid=",User)}; _ -> %% Don't know what I might do here end. It makes it nicer to view and understand I think. And I hope you see where you end up in the code above for your test. :-) Johnny -- Johnny Billquist || "I'm on a bus || on a psychedelic trip email: bqt@REDACTED || Reading murder books pdp is alive! || tryin' to stay hip" - B. Idol From adam@REDACTED Tue Feb 10 16:22:24 2009 From: adam@REDACTED (Adam Lindberg) Date: Tue, 10 Feb 2009 15:22:24 +0000 (GMT) Subject: [erlang-questions] Human readable errors in lists module In-Reply-To: <31309437.10521234279023327.JavaMail.root@zimbra> Message-ID: <23377730.10541234279344155.JavaMail.root@zimbra> Hi, Is there any reason that for example lists:zipwith/3 returns a function clause instead of a human readable error when the lists are of different length? It might seem obvious at first but the reason I'm asking is because a colleague of mine just spent a long time debugging code with used list:zipwith/3 and it threw this error. What he did at first was to check that all arguments to lists:zipwith/3 was not zero (this is what the function clause error indicated). lists:zipwith/3 could have been implemented as below (or something similar): zipwith(F, [X | Xs], [Y | Ys]) -> [F(X, Y) | zipwith(F, Xs, Ys)]; zipwith(F, [], []) when is_function(F, 2) -> []. zipwith(F, [], Ys) -> error(lists_of_different_length). %% Just a proposal, insert zipwith(F, Xs, []) -> error(lists_of_different_length). %% preferred error mechanism here. The function clause, noting the arguments as [#Fun..., [], [5,6,7,...]], is kind of misleading since it happens inside the lists:zipwith/3 function. I can see the purists' argument here "that it is really a function clause" but I also see the pragmatist argument "that it is much easier to debug." Cheers, Adam From raimo+erlang-questions@REDACTED Tue Feb 10 16:51:36 2009 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Tue, 10 Feb 2009 16:51:36 +0100 Subject: [erlang-questions] Human readable errors in lists module In-Reply-To: <23377730.10541234279344155.JavaMail.root@zimbra> References: <31309437.10521234279023327.JavaMail.root@zimbra> <23377730.10541234279344155.JavaMail.root@zimbra> Message-ID: <20090210155136.GA4118@erix.ericsson.se> On Tue, Feb 10, 2009 at 03:22:24PM +0000, Adam Lindberg wrote: > Hi, > > Is there any reason that for example lists:zipwith/3 returns a function clause instead of a human readable error when the lists are of different length? It might seem obvious at first but the reason I'm asking is because a colleague of mine just spent a long time debugging code with used list:zipwith/3 and it threw this error. What he did at first was to check that all arguments to lists:zipwith/3 was not zero (this is what the function clause error indicated). > > lists:zipwith/3 could have been implemented as below (or something similar): > > zipwith(F, [X | Xs], [Y | Ys]) -> [F(X, Y) | zipwith(F, Xs, Ys)]; > zipwith(F, [], []) when is_function(F, 2) -> []. > zipwith(F, [], Ys) -> error(lists_of_different_length). %% Just a proposal, insert > zipwith(F, Xs, []) -> error(lists_of_different_length). %% preferred error mechanism here. That would be: zipwith(F, [X | Xs], [Y | Ys]) -> [F(X, Y) | zipwith(F, Xs, Ys)]; zipwith(F, [], []) when is_function(F, 2) -> []; zipwith(F, [], [_ | _]) when is_function(F, 2) -> erlang:error({badarg,lists_of_different_length}); zipwith(F, [_ | _], []) when is_function(F, 2) -> erlang:error({badarg,lists_of_different_length}); zipwith(F, Xs, Ys) -> erlang:error(badarg, [F, Xs, Ys]). or else it would give the wrong error reason for zipwith(Fun, [], atom). Yes, zipwith/2,3 are very good candidates for this change. It is a minor change and it is unlikely that the change from a runtime error functin clause to badarg would break old code. Note that a {badarg,Reason} tuple is not that common in OTP, but an lists_of_different_length reason or any other odd error atom is less common. But if we change zipwith/2,3 we must in the name of consistency do it for all functions in the lists module, and for all other modules in stdlib, and kernel, and erts. And for some other functions it may not be obvious that a simple erlang:error/1 at the bottom of an iteration could know the cause as it is obvious for zipwith. Then we would have to think about using a try..catch at the top level and perhaps throw a cause and figure out in the try..catch what was wrong. And the same applies when a library function calls helper functions and you get a hard time knowing what was the API function you gave the wrong arguments really... So users that get a weird function clause and a stack trace pretty soon figure out how to debug. And it improves their degbugging skills for their own code. It could be better but this works rather good. > > The function clause, noting the arguments as [#Fun..., [], [5,6,7,...]], is kind of misleading since it happens inside the lists:zipwith/3 function. > > I can see the purists' argument here "that it is really a function clause" but I also see the pragmatist argument "that it is much easier to debug." > > Cheers, > Adam > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From ulf@REDACTED Tue Feb 10 17:13:39 2009 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 10 Feb 2009 17:13:39 +0100 Subject: [erlang-questions] Human readable errors in lists module In-Reply-To: <20090210155136.GA4118@erix.ericsson.se> References: <31309437.10521234279023327.JavaMail.root@zimbra> <23377730.10541234279344155.JavaMail.root@zimbra> <20090210155136.GA4118@erix.ericsson.se> Message-ID: <8209f740902100813m17cdd66fw73e21fe9de62e0bd@mail.gmail.com> 2009/2/10 Raimo Niskanen : > > But if we change zipwith/2,3 we must in the name of consistency > do it for all functions in the lists module, and for all other > modules in stdlib, and kernel, and erts. ... Hmm... isn't this a case where "the better is the enemy of the good"* ? No one in their right mind would try to write code that traps a function_clause exception from inside a library module. In other words, you have an exception that is unusable *and* hard to debug. So, in the name of consistency... ;-) BR, Ulf W * Often quoted as "The best is the enemy of the good", and attributed to Voltaire, but according to http://en.wikiquote.org/wiki/Voltaire, the above stems from "Le mieux est l'ennemi du bien", or "Il meglio ? l'inimico del bene" - for whatever reason, Voltaire apparently felt obliged to express it in Italian too. While we're abusing Voltaire quotes, here are a few more: "It is dangerous to be right in matters where established men are wrong." (also a famous erlang proverb) and indeed, "A witty saying proves nothing." (And I'm struggling with submitting expense reports and sorting receipts, in case you're wondering why this sudden interest in trivia.) From sten.gruener@REDACTED Tue Feb 10 18:08:16 2009 From: sten.gruener@REDACTED (Sten Gruener) Date: Tue, 10 Feb 2009 17:08:16 +0000 Subject: [erlang-questions] Pass a pattern to a function Message-ID: Hello, I try to write a function to scan the message queue and discard matched messages. Like this: discard(Pattern) -> receive Pattern -> discard(Pattern) after 0 -> ok end. the problem is, that I cannot call discard({_, {msg}}) since _ is a wildcard representation. Are there any solutions? Regards, Sten Gruener -------------- next part -------------- An HTML attachment was scrubbed... URL: From freza@REDACTED Tue Feb 10 19:18:59 2009 From: freza@REDACTED (Jachym Holecek) Date: Tue, 10 Feb 2009 19:18:59 +0100 Subject: [erlang-questions] Pass a pattern to a function In-Reply-To: References: Message-ID: <20090210181859.GA8250@hanele> Hello, # Sten Gruener 2009-02-10: > I try to write a function to scan the message queue and discard matched > messages. > > Like this: > > discard(Pattern) -> > receive > Pattern -> > discard(Pattern) > after 0 -> > ok > end. > > the problem is, that I cannot call discard({_, {msg}}) since _ is a wildcard > representation. Are there any solutions? Patterns aren't first class objects so I'm afraid you're SOL. You could implement your discard/1 as a parse transform, but under the hood that would just create per-pattern-specialised discard functions. Alternatively, it would be doable with a macro, but I can't imagine that not being ugly. -- Jachym From erlangy@REDACTED Tue Feb 10 19:43:29 2009 From: erlangy@REDACTED (Michael McDaniel) Date: Tue, 10 Feb 2009 10:43:29 -0800 Subject: [erlang-questions] Pass a pattern to a function In-Reply-To: <20090210181859.GA8250@hanele> References: <20090210181859.GA8250@hanele> Message-ID: <20090210184329.GL22018@delora.autosys.us> not sure if it will help you, but possibly of interest in the Erlang docs, Basic Applications -> erts -> Erts Users Guide -> Match specifications ~M On Tue, Feb 10, 2009 at 07:18:59PM +0100, Jachym Holecek wrote: > Hello, > > # Sten Gruener 2009-02-10: > > I try to write a function to scan the message queue and discard matched > > messages. > > > > Like this: > > > > discard(Pattern) -> > > receive > > Pattern -> > > discard(Pattern) > > after 0 -> > > ok > > end. > > > > the problem is, that I cannot call discard({_, {msg}}) since _ is a wildcard > > representation. Are there any solutions? > > Patterns aren't first class objects so I'm afraid you're SOL. You could > implement your discard/1 as a parse transform, but under the hood that > would just create per-pattern-specialised discard functions. Alternatively, > it would be doable with a macro, but I can't imagine that not being ugly. > > -- Jachym > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Michael McDaniel Portland, Oregon, USA http://autosys.us From lenartlad@REDACTED Tue Feb 10 20:31:41 2009 From: lenartlad@REDACTED (Ladislav Lenart) Date: Tue, 10 Feb 2009 20:31:41 +0100 Subject: [erlang-questions] Pass a pattern to a function In-Reply-To: <20090210181859.GA8250@hanele> References: <20090210181859.GA8250@hanele> Message-ID: <4991D61D.3080903@volny.cz> Jachym Holecek wrote: > Hello, > > # Sten Gruener 2009-02-10: >> I try to write a function to scan the message queue and discard matched >> messages. >> >> Like this: >> >> discard(Pattern) -> >> receive >> Pattern -> >> discard(Pattern) >> after 0 -> >> ok >> end. >> >> the problem is, that I cannot call discard({_, {msg}}) since _ is a wildcard >> representation. Are there any solutions? > > Patterns aren't first class objects so I'm afraid you're SOL. You could > implement your discard/1 as a parse transform, but under the hood that > would just create per-pattern-specialised discard functions. Alternatively, > it would be doable with a macro, but I can't imagine that not being ugly. Hello, the suggested macro solution, if applicable to your needs, is not that ugly actually (the code below is not tested)... %% Definition: -define(discard(Pattern), fun () -> F = fun (G) -> receive Pattern -> G(G) after 0 -> ok end end, F(F), end()). %% Usage: ?discard({_, X}), HTH, Ladislav Lenart From rvirding@REDACTED Tue Feb 10 20:35:03 2009 From: rvirding@REDACTED (Robert Virding) Date: Tue, 10 Feb 2009 20:35:03 +0100 Subject: [erlang-questions] Pass a pattern to a function In-Reply-To: <20090210184329.GL22018@delora.autosys.us> References: <20090210181859.GA8250@hanele> <20090210184329.GL22018@delora.autosys.us> Message-ID: <3dbc6d1c0902101135j577cd833y423853a12da90901@mail.gmail.com> Yes, but match specs can only be used in ETS and in tracing, they are not a general purpose construction. Basically they are a normal Erlang data structure which is interpreted in a special way by ETS and the tracer. Robert 2009/2/10 Michael McDaniel > > not sure if it will help you, but possibly of interest in the > Erlang docs, > > Basic Applications -> erts -> Erts Users Guide -> Match specifications > > ~M > > > > > On Tue, Feb 10, 2009 at 07:18:59PM +0100, Jachym Holecek wrote: > > Hello, > > > > # Sten Gruener 2009-02-10: > > > I try to write a function to scan the message queue and discard matched > > > messages. > > > > > > Like this: > > > > > > discard(Pattern) -> > > > receive > > > Pattern -> > > > discard(Pattern) > > > after 0 -> > > > ok > > > end. > > > > > > the problem is, that I cannot call discard({_, {msg}}) since _ is a > wildcard > > > representation. Are there any solutions? > > > > Patterns aren't first class objects so I'm afraid you're SOL. You could > > implement your discard/1 as a parse transform, but under the hood that > > would just create per-pattern-specialised discard functions. > Alternatively, > > it would be doable with a macro, but I can't imagine that not being ugly. > > > > -- Jachym > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- > Michael McDaniel > Portland, Oregon, USA > http://autosys.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 ulf@REDACTED Tue Feb 10 22:35:17 2009 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 10 Feb 2009 22:35:17 +0100 Subject: [erlang-questions] Human readable errors in lists module In-Reply-To: <4991CFED.8030703@it.uu.se> References: <31309437.10521234279023327.JavaMail.root@zimbra> <23377730.10541234279344155.JavaMail.root@zimbra> <20090210155136.GA4118@erix.ericsson.se> <8209f740902100813m17cdd66fw73e21fe9de62e0bd@mail.gmail.com> <4991CFED.8030703@it.uu.se> Message-ID: <8209f740902101335v43edc55ey83634c1122fbc94b@mail.gmail.com> 2009/2/10 Per Gustafsson : > Off-topic answer below; >> >> * Often quoted as "The best is the enemy of the good", and attributed to >> Voltaire, but according to http://en.wikiquote.org/wiki/Voltaire, the >> above >> stems from "Le mieux est l'ennemi du bien", or "Il meglio ? l'inimico del >> bene" - for whatever reason, Voltaire apparently felt obliged to express >> it >> in Italian too. >> >> > > I'm pretty sure "le mieux" is the superlative form of bien so the "The best > is the enemy of the good" is probably the best translation. So it seems that > you escape that dangerous position of being correct in matters where > established men are wrong and you can instead relax in my favorite place: > being wrong in matters where established men are right. Indeed. (: My French is non-existent, and my Italian is only marginally better. I was pretty sure that "meglio" meant "better", but I hadn't yet come to learn (or had forgotten) that putting "il" in front of it makes it a relative superlative, i.e. "meglio" = "better", "il meglio" = "best". At least I stay true to the scientific tradition of citing your sources well enough that others can point out the error in your reasoning. I stand corrected on the trivia, but maintain that keeping poor exception behaviour in the name of consistency is a questionable strategy. /U From erlang@REDACTED Tue Feb 10 22:46:15 2009 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 10 Feb 2009 22:46:15 +0100 Subject: [erlang-questions] Human readable errors in lists module In-Reply-To: <23377730.10541234279344155.JavaMail.root@zimbra> References: <31309437.10521234279023327.JavaMail.root@zimbra> <23377730.10541234279344155.JavaMail.root@zimbra> Message-ID: <9b08084c0902101346r166b4b77l14e68ac0dc2e6b8b@mail.gmail.com> On Tue, Feb 10, 2009 at 4:22 PM, Adam Lindberg wrote: > Hi, > > Is there any reason that for example lists:zipwith/3 returns a function clause instead of a human readable error when the lists are of different length? Yes Everything has a cost - if we applied this principle rigidly to all functions in the system then every function in the entire system would be extended with additional code. This make the code more difficult to read, and makes the program larger (think cache hits). Suppose we have a function that maps a to 1 and b to 2, I'd write it like this: f(a) -> 1; f(b) -> 2. should I then add an additional clause to warn for bad arguments? f(a) -> 1; f(b) -> 2; f(_) -> error('arg is not a or b'). This adds nothing to the clarity of the code since the original expresses exact the intention of the program *and nothing else* Programs that are cluttered with additional error messages are difficult to read (which increases the chances of an error) an less efficient (everything has a cost) > It might seem obvious at first but the reason I'm asking is because a colleague of >mine just spent a long time debugging code with used list:zipwith/3 and it threw >this error. What he did at first was to check that all arguments to lists:zipwith/3 > > was not zero (this is what the function clause error indicated). *everybody* spends a long time figuring out what when wrong the first time they get an error of a particular type - then they learn - when you've seen these errors a few times you'll find that you can find the error very quickly The fact that erlang crashes at the first error and prints something really aids debugging ... > > lists:zipwith/3 could have been implemented as below (or something similar): > > zipwith(F, [X | Xs], [Y | Ys]) -> [F(X, Y) | zipwith(F, Xs, Ys)]; > zipwith(F, [], []) when is_function(F, 2) -> []. > zipwith(F, [], Ys) -> error(lists_of_different_length). %% Just a proposal, insert > zipwith(F, Xs, []) -> error(lists_of_different_length). %% preferred error mechanism here. > > The function clause, noting the arguments as [#Fun..., [], [5,6,7,...]], is kind of misleading since it happens inside the lists:zipwith/3 function. > > I can see the purists' argument here "that it is really a function clause" but I also see the pragmatist argument "that it is much easier to debug." Nw let's look at the error message - here's an experiment 1> lists:zipwith(fun(X,Y) -> X + Y end, [1,2,3],[4,5]). ** exception error: no function clause matching lists:zipwith(#Fun,[3],[]) in function lists:zipwith/3 To the experienced eye the error is clear zipwith(Fun, [3], []) doesn't match any of the clauses defining zipwith Show me the code Luke ... (just run less on /usr/local/lib/erlang/stdlib ... ish) zipwith(F, [X | Xs], [Y | Ys]) -> [F(X, Y) | zipwith(F, Xs, Ys)]; zipwith(F, [], []) when is_function(F, 2) -> []. This is two lines of code. So zipwith(Fun, [3], []) doesn't match one of these two lines of code ... this is actually *shorter* than the documentation (a lot shorter) what does the documentation say? zipwith(Combine, List1, List2) -> List3 Types Combine = fun(X, Y) -> T List1 = [X] List2 = [Y] List3 = [T] X = Y = T = term() Combine the elements of two lists of equal length into one list. ************** What I have noticed teaching Erlang is that beginners make almost exactly the same mistakes as experienced users - the difference is in the time it takes them to debug an error. The first time is *always* slow - then you learn. (this is universally true - while I can fix erlang programs pretty quickly I can stare at simple javascript errors for ages before twigging what went wrong) But there's a more subtle problem. Let's try your suggestion. (I put your zipwith in a module test4) try4:zipwith(fun(X,Y) -> X + Y end, [1,2,3],[4,5]). ** exception error: lists_of_different_length in function try4:zipwith/3 in call from try4:zipwith/3 It works - great - we think ... but what about this? try4:zipwith(fun(X,Y) -> X + Y end, {1,2},[4,5]). ** exception error: no function clause matching try4:zipwith(#Fun,{1,2},[4,5]) Now what? Opps the guards were wrong - need to add a few when is_list(..) guards. Or do we want an error message that says error,arg1 should not be a tuple .... There are a very large number of ways we can supply incorrect arguments and we can't program all of them. So what do we do - we only write patterns that match the desired cases *and nothing else* - this is part of the erlang "let it crash" philosophy. In erlang we don't do defensive programming - (or rather we do do it using patterns) Best /Joe Armstrong > Cheers, > Adam > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From kunthar@REDACTED Tue Feb 10 23:02:23 2009 From: kunthar@REDACTED (Kunthar) Date: Wed, 11 Feb 2009 00:02:23 +0200 Subject: [erlang-questions] Human readable errors in lists module In-Reply-To: <9b08084c0902101346r166b4b77l14e68ac0dc2e6b8b@mail.gmail.com> References: <31309437.10521234279023327.JavaMail.root@zimbra> <23377730.10541234279344155.JavaMail.root@zimbra> <9b08084c0902101346r166b4b77l14e68ac0dc2e6b8b@mail.gmail.com> Message-ID: <9a09ca9a0902101402u27ca5660u59b0584dce75da8e@mail.gmail.com> I love "let it crash" way :) Simplicity is the ultimate sophistication! Leonardo Da Vinci, da great Italian magician Peace Kunth On Tue, Feb 10, 2009 at 11:46 PM, Joe Armstrong wrote: > On Tue, Feb 10, 2009 at 4:22 PM, Adam Lindberg > wrote: >> Hi, >> >> Is there any reason that for example lists:zipwith/3 returns a function clause instead of a human readable error when the lists are of different length? > > Yes > > Everything has a cost - if we applied this principle rigidly to all > functions in > the system then every function in the entire system would be extended with > additional code. This make the code more difficult to read, and makes the > program larger (think cache hits). > > Suppose we have a function that maps a to 1 and b to 2, I'd write it like this: > > f(a) -> 1; > f(b) -> 2. > > should I then add an additional clause to warn for bad arguments? > > f(a) -> 1; > f(b) -> 2; > f(_) -> error('arg is not a or b'). > > This adds nothing to the clarity of the code since the original expresses exact > the intention of the program *and nothing else* > > Programs that are cluttered with additional error messages are difficult to read > (which increases the chances of an error) an less efficient > (everything has a cost) > >> It might seem obvious at first but the reason I'm asking is because a colleague of >mine just spent a long time debugging code with used list:zipwith/3 and it threw >this error. What he did at first was to check that all arguments to lists:zipwith/3 >> > was not zero (this is what the function clause error indicated). > > *everybody* spends a long time figuring out what when wrong the first time > they get an error of a particular type - then they learn - when you've seen > these errors a few times you'll find that you can find the error very quickly > > The fact that erlang crashes at the first error and prints something really > aids debugging ... >> >> lists:zipwith/3 could have been implemented as below (or something similar): >> >> zipwith(F, [X | Xs], [Y | Ys]) -> [F(X, Y) | zipwith(F, Xs, Ys)]; >> zipwith(F, [], []) when is_function(F, 2) -> []. >> zipwith(F, [], Ys) -> error(lists_of_different_length). %% Just a proposal, insert >> zipwith(F, Xs, []) -> error(lists_of_different_length). %% preferred error mechanism here. >> >> The function clause, noting the arguments as [#Fun..., [], [5,6,7,...]], is kind of misleading since it happens inside the lists:zipwith/3 function. >> >> I can see the purists' argument here "that it is really a function clause" but I also see the pragmatist argument "that it is much easier to debug." > > Nw let's look at the error message - here's an experiment > > 1> lists:zipwith(fun(X,Y) -> X + Y end, [1,2,3],[4,5]). > ** exception error: no function clause matching > lists:zipwith(#Fun,[3],[]) > in function lists:zipwith/3 > > To the experienced eye the error is clear > > zipwith(Fun, [3], []) doesn't match any of the clauses defining zipwith > > Show me the code Luke ... (just run less on > /usr/local/lib/erlang/stdlib ... ish) > > zipwith(F, [X | Xs], [Y | Ys]) -> [F(X, Y) | zipwith(F, Xs, Ys)]; > zipwith(F, [], []) when is_function(F, 2) -> []. > > This is two lines of code. > > So zipwith(Fun, [3], []) doesn't match one of these two lines of code ... > > this is actually *shorter* than the documentation (a lot shorter) > > what does the documentation say? > > zipwith(Combine, List1, List2) -> List3 > Types Combine = fun(X, Y) -> T > List1 = [X] > List2 = [Y] > List3 = [T] > X = Y = T = term() > Combine the elements of two lists of equal length into one list. > ************** > What I have noticed teaching Erlang is that beginners make almost exactly > the same mistakes as experienced users - the difference is in the time > it takes them to debug an error. > > The first time is *always* slow - then you learn. > > (this is universally true - while I can fix erlang programs pretty quickly > I can stare at simple javascript errors for ages before twigging what > went wrong) > > But there's a more subtle problem. > > Let's try your suggestion. (I put your zipwith in a module test4) > > try4:zipwith(fun(X,Y) -> X + Y end, [1,2,3],[4,5]). > ** exception error: lists_of_different_length > in function try4:zipwith/3 > in call from try4:zipwith/3 > > It works - great - we think ... but what about this? > > try4:zipwith(fun(X,Y) -> X + Y end, {1,2},[4,5]). > ** exception error: no function clause matching > try4:zipwith(#Fun,{1,2},[4,5]) > > Now what? Opps the guards were wrong - need to add a few > when is_list(..) guards. Or do we want an error message that says > error,arg1 should not be a tuple .... > > There are a very large number of ways we can supply incorrect arguments > and we can't program all of them. > > So what do we do - we only write patterns that match the desired cases > *and nothing else* - this is part of the erlang "let it crash" philosophy. > > In erlang we don't do defensive programming - (or rather we do do it using > patterns) > > Best > > /Joe Armstrong > > >> Cheers, >> Adam >> _______________________________________________ >> 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 ok@REDACTED Wed Feb 11 01:25:38 2009 From: ok@REDACTED (Richard O'Keefe) Date: Wed, 11 Feb 2009 13:25:38 +1300 Subject: [erlang-questions] '--' BIF to be used with caution? In-Reply-To: <4d08db370902100044y4ea7c5cbl5e3bb9cefb9caafa@mail.gmail.com> References: <707529930901130404y5418466bmc375525ef765e615@mail.gmail.com> <6672d0160902040248n4ef30e0cm4e4e0cb718a04349@mail.gmail.com> <707529930902050630l250a8ae4nedbfa71e5d63460e@mail.gmail.com> <13728F3E-6CF3-4B58-B55B-88950019D370@cs.otago.ac.nz> <4d08db370902100044y4ea7c5cbl5e3bb9cefb9caafa@mail.gmail.com> Message-ID: I asked why (--) could not be implemented in Erlang instead of C. On 10 Feb 2009, at 9:44 pm, Hynek Vychodil wrote: > It's easy, constants for serious amount |2|. I am not sure how to interpret this. Let's face it, *as currently implemented* -- is not only inefficient, it can block scheduling for non- trivial amounts of time. So as things stand now, fully informed programmers are unlikely to make very much use of it, so in any program where the constant factors are likely to make much difference, it is _already_ so slow that something else should be done. For example, I just measured some times: 681.69 msec, bag difference of unsorted lists using -- 0.64 msec, bag difference of sorted lists using own sorted list difference code in Erlang 24.97 msec, bag difference of unsorted lists by sorting then using sorted list difference. The one relying on a C coded -- is the slowest of them. OK, so the lists were 10,000 elements long. Make them 10 times smaller, and the times are 5.24 msec unsorted then -- 0.08 msec presorted, use own Erlang 1.63 msec unsorted, use sort then own Erlang. Still the same conclusion: even coded in C, -- is too slow to use with any lists that might be nontrivial. So who cares about the constant factors in an operation that you shouldn't be using? Every time we move something out of C into Erlang we simplify the trusted base. From ok@REDACTED Wed Feb 11 02:00:56 2009 From: ok@REDACTED (Richard O'Keefe) Date: Wed, 11 Feb 2009 14:00:56 +1300 Subject: [erlang-questions] Pass a pattern to a function In-Reply-To: References: Message-ID: <3917D94F-954D-4FAB-81FB-CC738D460421@cs.otago.ac.nz> On 11 Feb 2009, at 6:08 am, Sten Gruener wrote: > Hello, > > I try to write a function to scan the message queue and discard > matched messages. > > Like this: > > discard(Pattern) -> > receive > Pattern -> > discard(Pattern) > after 0 -> > ok > end. > > the problem is, that I cannot call discard({_, {msg}}) since _ is a > wildcard representation. Are there any solutions? Patterns are not values in Erlang. It's not just wildcards that get in the way. It sounds very much as though you want to do Message_Queue := filter(fun (Pattern) -> false; (_) -> true end, Message_Queue) except that you can't do that either. What you *can* do is write a macro that constructs a recursive function. -define(DISCARD(Pat), (F = fun (G) -> receive Pat -> G(G) after 0 -> ok end end, F(F) )). I haven't tried this, and I avoid macros when I can, so expect to have to debug it. If I've got this right, then ?DISCARD({_, {msg}}) should do the trick. Having said that, I would urge you to restructure your program so that this no longer seems useful to you. Instead of letting the messages build up in the queue and purging them later, try to structure the program so that they never enter the queue in the first place (perhaps by arranging for the messages to be sent to an intermediate filtering process) or that catches them earlier. From devdoer2@REDACTED Wed Feb 11 06:01:10 2009 From: devdoer2@REDACTED (devdoer bird) Date: Wed, 11 Feb 2009 13:01:10 +0800 Subject: [erlang-questions] How to set expire time for mneisa QLC cache Message-ID: HI: Is there a way to set expire time for mnesia QLC cache? The QLC manual doesn't say enough about the cache option. Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From vychodil.hynek@REDACTED Wed Feb 11 09:54:51 2009 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Wed, 11 Feb 2009 09:54:51 +0100 Subject: [erlang-questions] Human readable errors in lists module In-Reply-To: <9a09ca9a0902101402u27ca5660u59b0584dce75da8e@mail.gmail.com> References: <31309437.10521234279023327.JavaMail.root@zimbra> <23377730.10541234279344155.JavaMail.root@zimbra> <9b08084c0902101346r166b4b77l14e68ac0dc2e6b8b@mail.gmail.com> <9a09ca9a0902101402u27ca5660u59b0584dce75da8e@mail.gmail.com> Message-ID: <4d08db370902110054o27a8931fj35f943529237210e@mail.gmail.com> Yes, I love it too. I love Erlang because enables this. On Tue, Feb 10, 2009 at 11:02 PM, Kunthar wrote: > I love "let it crash" way :) > > Simplicity is the ultimate sophistication! > Leonardo Da Vinci, da great Italian magician > > Peace > Kunth > > > On Tue, Feb 10, 2009 at 11:46 PM, Joe Armstrong wrote: > > On Tue, Feb 10, 2009 at 4:22 PM, Adam Lindberg > > wrote: > >> Hi, > >> > >> Is there any reason that for example lists:zipwith/3 returns a function > clause instead of a human readable error when the lists are of different > length? > > > > Yes > > > > Everything has a cost - if we applied this principle rigidly to all > > functions in > > the system then every function in the entire system would be extended > with > > additional code. This make the code more difficult to read, and makes the > > program larger (think cache hits). > > > > Suppose we have a function that maps a to 1 and b to 2, I'd write it like > this: > > > > f(a) -> 1; > > f(b) -> 2. > > > > should I then add an additional clause to warn for bad arguments? > > > > f(a) -> 1; > > f(b) -> 2; > > f(_) -> error('arg is not a or b'). > > > > This adds nothing to the clarity of the code since the original expresses > exact > > the intention of the program *and nothing else* > > > > Programs that are cluttered with additional error messages are difficult > to read > > (which increases the chances of an error) an less efficient > > (everything has a cost) > > > >> It might seem obvious at first but the reason I'm asking is because a > colleague of >mine just spent a long time debugging code with used > list:zipwith/3 and it threw >this error. What he did at first was to check > that all arguments to lists:zipwith/3 > >> > was not zero (this is what the function clause error indicated). > > > > *everybody* spends a long time figuring out what when wrong the first > time > > they get an error of a particular type - then they learn - when you've > seen > > these errors a few times you'll find that you can find the error very > quickly > > > > The fact that erlang crashes at the first error and prints something > really > > aids debugging ... > >> > >> lists:zipwith/3 could have been implemented as below (or something > similar): > >> > >> zipwith(F, [X | Xs], [Y | Ys]) -> [F(X, Y) | zipwith(F, Xs, Ys)]; > >> zipwith(F, [], []) when is_function(F, 2) -> []. > >> zipwith(F, [], Ys) -> error(lists_of_different_length). %% Just a > proposal, insert > >> zipwith(F, Xs, []) -> error(lists_of_different_length). %% preferred > error mechanism here. > >> > >> The function clause, noting the arguments as [#Fun..., [], [5,6,7,...]], > is kind of misleading since it happens inside the lists:zipwith/3 function. > >> > >> I can see the purists' argument here "that it is really a function > clause" but I also see the pragmatist argument "that it is much easier to > debug." > > > > Nw let's look at the error message - here's an experiment > > > > 1> lists:zipwith(fun(X,Y) -> X + Y end, [1,2,3],[4,5]). > > ** exception error: no function clause matching > > lists:zipwith(#Fun,[3],[]) > > in function lists:zipwith/3 > > > > To the experienced eye the error is clear > > > > zipwith(Fun, [3], []) doesn't match any of the clauses defining zipwith > > > > Show me the code Luke ... (just run less on > > /usr/local/lib/erlang/stdlib ... ish) > > > > zipwith(F, [X | Xs], [Y | Ys]) -> [F(X, Y) | zipwith(F, Xs, Ys)]; > > zipwith(F, [], []) when is_function(F, 2) -> []. > > > > This is two lines of code. > > > > So zipwith(Fun, [3], []) doesn't match one of these two lines of code ... > > > > this is actually *shorter* than the documentation (a lot shorter) > > > > what does the documentation say? > > > > zipwith(Combine, List1, List2) -> List3 > > Types Combine = fun(X, Y) -> T > > List1 = [X] > > List2 = [Y] > > List3 = [T] > > X = Y = T = term() > > Combine the elements of two lists of equal length into one list. > > > ************** > > What I have noticed teaching Erlang is that beginners make almost exactly > > the same mistakes as experienced users - the difference is in the time > > it takes them to debug an error. > > > > The first time is *always* slow - then you learn. > > > > (this is universally true - while I can fix erlang programs pretty > quickly > > I can stare at simple javascript errors for ages before twigging what > > went wrong) > > > > But there's a more subtle problem. > > > > Let's try your suggestion. (I put your zipwith in a module test4) > > > > try4:zipwith(fun(X,Y) -> X + Y end, [1,2,3],[4,5]). > > ** exception error: lists_of_different_length > > in function try4:zipwith/3 > > in call from try4:zipwith/3 > > > > It works - great - we think ... but what about this? > > > > try4:zipwith(fun(X,Y) -> X + Y end, {1,2},[4,5]). > > ** exception error: no function clause matching > > try4:zipwith(#Fun,{1,2},[4,5]) > > > > Now what? Opps the guards were wrong - need to add a few > > when is_list(..) guards. Or do we want an error message that says > > error,arg1 should not be a tuple .... > > > > There are a very large number of ways we can supply incorrect arguments > > and we can't program all of them. > > > > So what do we do - we only write patterns that match the desired cases > > *and nothing else* - this is part of the erlang "let it crash" > philosophy. > > > > In erlang we don't do defensive programming - (or rather we do do it > using > > patterns) > > > > Best > > > > /Joe Armstrong > > > > > >> Cheers, > >> Adam > >> _______________________________________________ > >> 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 > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try Good Data now for free: www.gooddata.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From vychodil.hynek@REDACTED Wed Feb 11 09:58:38 2009 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Wed, 11 Feb 2009 09:58:38 +0100 Subject: [erlang-questions] '--' BIF to be used with caution? In-Reply-To: References: <707529930901130404y5418466bmc375525ef765e615@mail.gmail.com> <6672d0160902040248n4ef30e0cm4e4e0cb718a04349@mail.gmail.com> <707529930902050630l250a8ae4nedbfa71e5d63460e@mail.gmail.com> <13728F3E-6CF3-4B58-B55B-88950019D370@cs.otago.ac.nz> <4d08db370902100044y4ea7c5cbl5e3bb9cefb9caafa@mail.gmail.com> Message-ID: <4d08db370902110058y37db088bwfdab93d579e508d0@mail.gmail.com> On Wed, Feb 11, 2009 at 1:25 AM, Richard O'Keefe wrote: > I asked why (--) could not be implemented in Erlang instead of C. > > On 10 Feb 2009, at 9:44 pm, Hynek Vychodil wrote: > >> It's easy, constants for serious amount |2|. >> > > I am not sure how to interpret this. > Let's face it, *as currently implemented* -- is not > only inefficient, it can block scheduling for non- > trivial amounts of time. So as things stand now, > fully informed programmers are unlikely to make very > much use of it, so in any program where the constant > factors are likely to make much difference, it is > _already_ so slow that something else should be done. > For example, I just measured some times: > > 681.69 msec, bag difference of unsorted lists using -- > 0.64 msec, bag difference of sorted lists using own > sorted list difference code in Erlang > 24.97 msec, bag difference of unsorted lists by > sorting then using sorted list difference. > > The one relying on a C coded -- is the slowest of them. > > OK, so the lists were 10,000 elements long. Make them > 10 times smaller, and the times are > 5.24 msec unsorted then -- > 0.08 msec presorted, use own Erlang > 1.63 msec unsorted, use sort then own Erlang. > Still the same conclusion: even coded in C, -- is too > slow to use with any lists that might be nontrivial. > So who cares about the constant factors in an operation > that you shouldn't be using? Every time we move something > out of C into Erlang we simplify the trusted base. > > > Nice, and now measure this for 5 element long lists. -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try Good Data now for free: www.gooddata.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From devdoer2@REDACTED Wed Feb 11 11:42:37 2009 From: devdoer2@REDACTED (devdoer bird) Date: Wed, 11 Feb 2009 18:42:37 +0800 Subject: [erlang-questions] How to do " paging" with QLC? Message-ID: HI: With QLC I can access mnesia with a cursor in which I specify how many answers I want. But there is no way to specify a start ponit. Like I want to get 10 records from 1000th to 1010th of user table sorted by username . How can I to this by QLC? -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Wed Feb 11 13:33:38 2009 From: erlang@REDACTED (Dominic Williams) Date: Wed, 11 Feb 2009 07:33:38 -0500 (EST) Subject: [erlang-questions] Human readable errors in lists module In-Reply-To: <8209f740902101335v43edc55ey83634c1122fbc94b@mail.gmail.com> References: <31309437.10521234279023327.JavaMail.root@zimbra> <23377730.10541234279344155.JavaMail.root@zimbra> <20090210155136.GA4118@erix.ericsson.se> <8209f740902100813m17cdd66fw73e21fe9de62e0bd@mail.gmail.com> <4991CFED.8030703@it.uu.se> <8209f740902101335v43edc55ey83634c1122fbc94b@mail.gmail.com> Message-ID: <4edafa7e5a4daefe0305579361293855.squirrel@www.geekisp.com> Per Gustafsson wrote: > I'm pretty sure "le mieux" is the superlative form of bien > so the "The best is the enemy of the good" is probably the > best translation. As a native french speaker, I would argue that the correct translation is "better". Indeed, although "le mieux" can mean "the best", in this sense it is used to mean "improvement". Of course the proper thing to do in English is just to quote Shakespeare: "Striving to better, oft we mar what's well." Regards, Dominic Williams http://dominicwilliams.net From kenneth.lundin@REDACTED Wed Feb 11 15:04:14 2009 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Wed, 11 Feb 2009 15:04:14 +0100 Subject: [erlang-questions] Human readable errors in lists module In-Reply-To: <9b08084c0902101346r166b4b77l14e68ac0dc2e6b8b@mail.gmail.com> References: <31309437.10521234279023327.JavaMail.root@zimbra> <23377730.10541234279344155.JavaMail.root@zimbra> <9b08084c0902101346r166b4b77l14e68ac0dc2e6b8b@mail.gmail.com> Message-ID: Hi, As responsible for the Erlang/OTP team at Ericsson I can just say that we agree with Joe in this matter. We have no intention to add human readable errors to the list module or other library modules in standard lib. As a matter of fact I think a crash with function clause is quite clear because it informs you about that a named function did not have any clause which matched the arguments you called it with. And the arguments are also available in the crash info. As the source code and the documentation for lists in this case is available it should be possible to understand why the arguments was not accepted. A beginner might not have so easy to understand whats wrong but after just a few occurences of errors like that it should be quite obvious. /Kenneth Erlang/OTP Ericsson On Tue, Feb 10, 2009 at 10:46 PM, Joe Armstrong wrote: > On Tue, Feb 10, 2009 at 4:22 PM, Adam Lindberg > wrote: >> Hi, >> >> Is there any reason that for example lists:zipwith/3 returns a function clause instead of a human readable error when the lists are of different length? > > Yes > > Everything has a cost - if we applied this principle rigidly to all > functions in > the system then every function in the entire system would be extended with > additional code. This make the code more difficult to read, and makes the > program larger (think cache hits). > > Suppose we have a function that maps a to 1 and b to 2, I'd write it like this: > > f(a) -> 1; > f(b) -> 2. > > should I then add an additional clause to warn for bad arguments? > > f(a) -> 1; > f(b) -> 2; > f(_) -> error('arg is not a or b'). > > This adds nothing to the clarity of the code since the original expresses exact > the intention of the program *and nothing else* > > Programs that are cluttered with additional error messages are difficult to read > (which increases the chances of an error) an less efficient > (everything has a cost) > >> It might seem obvious at first but the reason I'm asking is because a colleague of >mine just spent a long time debugging code with used list:zipwith/3 and it threw >this error. What he did at first was to check that all arguments to lists:zipwith/3 >> > was not zero (this is what the function clause error indicated). > > *everybody* spends a long time figuring out what when wrong the first time > they get an error of a particular type - then they learn - when you've seen > these errors a few times you'll find that you can find the error very quickly > > The fact that erlang crashes at the first error and prints something really > aids debugging ... >> >> lists:zipwith/3 could have been implemented as below (or something similar): >> >> zipwith(F, [X | Xs], [Y | Ys]) -> [F(X, Y) | zipwith(F, Xs, Ys)]; >> zipwith(F, [], []) when is_function(F, 2) -> []. >> zipwith(F, [], Ys) -> error(lists_of_different_length). %% Just a proposal, insert >> zipwith(F, Xs, []) -> error(lists_of_different_length). %% preferred error mechanism here. >> >> The function clause, noting the arguments as [#Fun..., [], [5,6,7,...]], is kind of misleading since it happens inside the lists:zipwith/3 function. >> >> I can see the purists' argument here "that it is really a function clause" but I also see the pragmatist argument "that it is much easier to debug." > > Nw let's look at the error message - here's an experiment > > 1> lists:zipwith(fun(X,Y) -> X + Y end, [1,2,3],[4,5]). > ** exception error: no function clause matching > lists:zipwith(#Fun,[3],[]) > in function lists:zipwith/3 > > To the experienced eye the error is clear > > zipwith(Fun, [3], []) doesn't match any of the clauses defining zipwith > > Show me the code Luke ... (just run less on > /usr/local/lib/erlang/stdlib ... ish) > > zipwith(F, [X | Xs], [Y | Ys]) -> [F(X, Y) | zipwith(F, Xs, Ys)]; > zipwith(F, [], []) when is_function(F, 2) -> []. > > This is two lines of code. > > So zipwith(Fun, [3], []) doesn't match one of these two lines of code ... > > this is actually *shorter* than the documentation (a lot shorter) > > what does the documentation say? > > zipwith(Combine, List1, List2) -> List3 > Types Combine = fun(X, Y) -> T > List1 = [X] > List2 = [Y] > List3 = [T] > X = Y = T = term() > Combine the elements of two lists of equal length into one list. > ************** > What I have noticed teaching Erlang is that beginners make almost exactly > the same mistakes as experienced users - the difference is in the time > it takes them to debug an error. > > The first time is *always* slow - then you learn. > > (this is universally true - while I can fix erlang programs pretty quickly > I can stare at simple javascript errors for ages before twigging what > went wrong) > > But there's a more subtle problem. > > Let's try your suggestion. (I put your zipwith in a module test4) > > try4:zipwith(fun(X,Y) -> X + Y end, [1,2,3],[4,5]). > ** exception error: lists_of_different_length > in function try4:zipwith/3 > in call from try4:zipwith/3 > > It works - great - we think ... but what about this? > > try4:zipwith(fun(X,Y) -> X + Y end, {1,2},[4,5]). > ** exception error: no function clause matching > try4:zipwith(#Fun,{1,2},[4,5]) > > Now what? Opps the guards were wrong - need to add a few > when is_list(..) guards. Or do we want an error message that says > error,arg1 should not be a tuple .... > > There are a very large number of ways we can supply incorrect arguments > and we can't program all of them. > > So what do we do - we only write patterns that match the desired cases > *and nothing else* - this is part of the erlang "let it crash" philosophy. > > In erlang we don't do defensive programming - (or rather we do do it using > patterns) > > Best > > /Joe Armstrong > > >> Cheers, >> Adam >> _______________________________________________ >> 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 adam@REDACTED Wed Feb 11 16:04:54 2009 From: adam@REDACTED (Adam Lindberg) Date: Wed, 11 Feb 2009 15:04:54 +0000 (GMT) Subject: [erlang-questions] Human readable errors in lists module In-Reply-To: <11154509.12651234364679776.JavaMail.root@zimbra> Message-ID: <3685675.12671234364694230.JavaMail.root@zimbra> I agree with most arguments here. I think the only thing that bothers me is that the function returns an internal error, not an interface error. As a side question, would adding a guard "when length(Ys) == length(Xs)" produce any overhead? That is, does length take time to compute or is it store in memory? Cheers, Adam ----- "Kenneth Lundin" wrote: > Hi, > > As responsible for the Erlang/OTP team at Ericsson I can just say > that > we agree with Joe in this matter. > We have no intention to add human readable errors to the list module > or other library modules in standard lib. > > As a matter of fact I think a crash with function clause is quite > clear because it informs you about > that a named function did not have any clause which matched the > arguments you called it with. And the arguments > are also available in the crash info. > As the source code and the documentation for lists in this case is > available it should be possible to understand why the arguments was > not accepted. > > A beginner might not have so easy to understand whats wrong but after > just a few occurences of errors like that it should be > quite obvious. > > /Kenneth Erlang/OTP Ericsson > > On Tue, Feb 10, 2009 at 10:46 PM, Joe Armstrong > wrote: > > On Tue, Feb 10, 2009 at 4:22 PM, Adam Lindberg > > wrote: > >> Hi, > >> > >> Is there any reason that for example lists:zipwith/3 returns a > function clause instead of a human readable error when the lists are > of different length? > > > > Yes > > > > Everything has a cost - if we applied this principle rigidly to all > > functions in > > the system then every function in the entire system would be > extended with > > additional code. This make the code more difficult to read, and > makes the > > program larger (think cache hits). > > > > Suppose we have a function that maps a to 1 and b to 2, I'd write it > like this: > > > > f(a) -> 1; > > f(b) -> 2. > > > > should I then add an additional clause to warn for bad arguments? > > > > f(a) -> 1; > > f(b) -> 2; > > f(_) -> error('arg is not a or b'). > > > > This adds nothing to the clarity of the code since the original > expresses exact > > the intention of the program *and nothing else* > > > > Programs that are cluttered with additional error messages are > difficult to read > > (which increases the chances of an error) an less efficient > > (everything has a cost) > > > >> It might seem obvious at first but the reason I'm asking is because > a colleague of >mine just spent a long time debugging code with used > list:zipwith/3 and it threw >this error. What he did at first was to > check that all arguments to lists:zipwith/3 > >> > was not zero (this is what the function clause error indicated). > > > > *everybody* spends a long time figuring out what when wrong the > first time > > they get an error of a particular type - then they learn - when > you've seen > > these errors a few times you'll find that you can find the error > very quickly > > > > The fact that erlang crashes at the first error and prints something > really > > aids debugging ... > >> > >> lists:zipwith/3 could have been implemented as below (or something > similar): > >> > >> zipwith(F, [X | Xs], [Y | Ys]) -> [F(X, Y) | zipwith(F, Xs, Ys)]; > >> zipwith(F, [], []) when is_function(F, 2) -> []. > >> zipwith(F, [], Ys) -> error(lists_of_different_length). %% Just a > proposal, insert > >> zipwith(F, Xs, []) -> error(lists_of_different_length). %% > preferred error mechanism here. > >> > >> The function clause, noting the arguments as [#Fun..., [], > [5,6,7,...]], is kind of misleading since it happens inside the > lists:zipwith/3 function. > >> > >> I can see the purists' argument here "that it is really a function > clause" but I also see the pragmatist argument "that it is much easier > to debug." > > > > Nw let's look at the error message - here's an experiment > > > > 1> lists:zipwith(fun(X,Y) -> X + Y end, [1,2,3],[4,5]). > > ** exception error: no function clause matching > > > lists:zipwith(#Fun,[3],[]) > > in function lists:zipwith/3 > > > > To the experienced eye the error is clear > > > > zipwith(Fun, [3], []) doesn't match any of the clauses defining > zipwith > > > > Show me the code Luke ... (just run less on > > /usr/local/lib/erlang/stdlib ... ish) > > > > zipwith(F, [X | Xs], [Y | Ys]) -> [F(X, Y) | zipwith(F, Xs, Ys)]; > > zipwith(F, [], []) when is_function(F, 2) -> []. > > > > This is two lines of code. > > > > So zipwith(Fun, [3], []) doesn't match one of these two lines of > code ... > > > > this is actually *shorter* than the documentation (a lot shorter) > > > > what does the documentation say? > > > > zipwith(Combine, List1, List2) -> List3 > > Types Combine = fun(X, Y) -> T > > List1 = [X] > > List2 = [Y] > > List3 = [T] > > X = Y = T = term() > > Combine the elements of two lists of equal length into one > list. > > > ************** > > What I have noticed teaching Erlang is that beginners make almost > exactly > > the same mistakes as experienced users - the difference is in the > time > > it takes them to debug an error. > > > > The first time is *always* slow - then you learn. > > > > (this is universally true - while I can fix erlang programs pretty > quickly > > I can stare at simple javascript errors for ages before twigging > what > > went wrong) > > > > But there's a more subtle problem. > > > > Let's try your suggestion. (I put your zipwith in a module test4) > > > > try4:zipwith(fun(X,Y) -> X + Y end, [1,2,3],[4,5]). > > ** exception error: lists_of_different_length > > in function try4:zipwith/3 > > in call from try4:zipwith/3 > > > > It works - great - we think ... but what about this? > > > > try4:zipwith(fun(X,Y) -> X + Y end, {1,2},[4,5]). > > ** exception error: no function clause matching > > > try4:zipwith(#Fun,{1,2},[4,5]) > > > > Now what? Opps the guards were wrong - need to add a few > > when is_list(..) guards. Or do we want an error message that says > > error,arg1 should not be a tuple .... > > > > There are a very large number of ways we can supply incorrect > arguments > > and we can't program all of them. > > > > So what do we do - we only write patterns that match the desired > cases > > *and nothing else* - this is part of the erlang "let it crash" > philosophy. > > > > In erlang we don't do defensive programming - (or rather we do do it > using > > patterns) > > > > Best > > > > /Joe Armstrong > > > > > >> Cheers, > >> Adam > >> _______________________________________________ > >> 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 mazen.harake@REDACTED Wed Feb 11 16:18:47 2009 From: mazen.harake@REDACTED (Mazen Harake) Date: Wed, 11 Feb 2009 17:18:47 +0200 Subject: [erlang-questions] Human readable errors in lists module In-Reply-To: References: <31309437.10521234279023327.JavaMail.root@zimbra> <23377730.10541234279344155.JavaMail.root@zimbra> <9b08084c0902101346r166b4b77l14e68ac0dc2e6b8b@mail.gmail.com> Message-ID: <4992EC57.50003@erlang-consulting.com> Lets hope it stays like it is... Relieved to hear this. thumbs up /M Kenneth Lundin wrote: > Hi, > > As responsible for the Erlang/OTP team at Ericsson I can just say that > we agree with Joe in this matter. > We have no intention to add human readable errors to the list module > or other library modules in standard lib. > > As a matter of fact I think a crash with function clause is quite > clear because it informs you about > that a named function did not have any clause which matched the > arguments you called it with. And the arguments > are also available in the crash info. > As the source code and the documentation for lists in this case is > available it should be possible to understand why the arguments was > not accepted. > > A beginner might not have so easy to understand whats wrong but after > just a few occurences of errors like that it should be > quite obvious. > > /Kenneth Erlang/OTP Ericsson > > On Tue, Feb 10, 2009 at 10:46 PM, Joe Armstrong wrote: > >> On Tue, Feb 10, 2009 at 4:22 PM, Adam Lindberg >> wrote: >> >>> Hi, >>> >>> Is there any reason that for example lists:zipwith/3 returns a function clause instead of a human readable error when the lists are of different length? >>> >> Yes >> >> Everything has a cost - if we applied this principle rigidly to all >> functions in >> the system then every function in the entire system would be extended with >> additional code. This make the code more difficult to read, and makes the >> program larger (think cache hits). >> >> Suppose we have a function that maps a to 1 and b to 2, I'd write it like this: >> >> f(a) -> 1; >> f(b) -> 2. >> >> should I then add an additional clause to warn for bad arguments? >> >> f(a) -> 1; >> f(b) -> 2; >> f(_) -> error('arg is not a or b'). >> >> This adds nothing to the clarity of the code since the original expresses exact >> the intention of the program *and nothing else* >> >> Programs that are cluttered with additional error messages are difficult to read >> (which increases the chances of an error) an less efficient >> (everything has a cost) >> >> >>> It might seem obvious at first but the reason I'm asking is because a colleague of >mine just spent a long time debugging code with used list:zipwith/3 and it threw >this error. What he did at first was to check that all arguments to lists:zipwith/3 >>> >>>> was not zero (this is what the function clause error indicated). >>>> >> *everybody* spends a long time figuring out what when wrong the first time >> they get an error of a particular type - then they learn - when you've seen >> these errors a few times you'll find that you can find the error very quickly >> >> The fact that erlang crashes at the first error and prints something really >> aids debugging ... >> >>> lists:zipwith/3 could have been implemented as below (or something similar): >>> >>> zipwith(F, [X | Xs], [Y | Ys]) -> [F(X, Y) | zipwith(F, Xs, Ys)]; >>> zipwith(F, [], []) when is_function(F, 2) -> []. >>> zipwith(F, [], Ys) -> error(lists_of_different_length). %% Just a proposal, insert >>> zipwith(F, Xs, []) -> error(lists_of_different_length). %% preferred error mechanism here. >>> >>> The function clause, noting the arguments as [#Fun..., [], [5,6,7,...]], is kind of misleading since it happens inside the lists:zipwith/3 function. >>> >>> I can see the purists' argument here "that it is really a function clause" but I also see the pragmatist argument "that it is much easier to debug." >>> >> Nw let's look at the error message - here's an experiment >> >> 1> lists:zipwith(fun(X,Y) -> X + Y end, [1,2,3],[4,5]). >> ** exception error: no function clause matching >> lists:zipwith(#Fun,[3],[]) >> in function lists:zipwith/3 >> >> To the experienced eye the error is clear >> >> zipwith(Fun, [3], []) doesn't match any of the clauses defining zipwith >> >> Show me the code Luke ... (just run less on >> /usr/local/lib/erlang/stdlib ... ish) >> >> zipwith(F, [X | Xs], [Y | Ys]) -> [F(X, Y) | zipwith(F, Xs, Ys)]; >> zipwith(F, [], []) when is_function(F, 2) -> []. >> >> This is two lines of code. >> >> So zipwith(Fun, [3], []) doesn't match one of these two lines of code ... >> >> this is actually *shorter* than the documentation (a lot shorter) >> >> what does the documentation say? >> >> zipwith(Combine, List1, List2) -> List3 >> Types Combine = fun(X, Y) -> T >> List1 = [X] >> List2 = [Y] >> List3 = [T] >> X = Y = T = term() >> Combine the elements of two lists of equal length into one list. >> ************** >> What I have noticed teaching Erlang is that beginners make almost exactly >> the same mistakes as experienced users - the difference is in the time >> it takes them to debug an error. >> >> The first time is *always* slow - then you learn. >> >> (this is universally true - while I can fix erlang programs pretty quickly >> I can stare at simple javascript errors for ages before twigging what >> went wrong) >> >> But there's a more subtle problem. >> >> Let's try your suggestion. (I put your zipwith in a module test4) >> >> try4:zipwith(fun(X,Y) -> X + Y end, [1,2,3],[4,5]). >> ** exception error: lists_of_different_length >> in function try4:zipwith/3 >> in call from try4:zipwith/3 >> >> It works - great - we think ... but what about this? >> >> try4:zipwith(fun(X,Y) -> X + Y end, {1,2},[4,5]). >> ** exception error: no function clause matching >> try4:zipwith(#Fun,{1,2},[4,5]) >> >> Now what? Opps the guards were wrong - need to add a few >> when is_list(..) guards. Or do we want an error message that says >> error,arg1 should not be a tuple .... >> >> There are a very large number of ways we can supply incorrect arguments >> and we can't program all of them. >> >> So what do we do - we only write patterns that match the desired cases >> *and nothing else* - this is part of the erlang "let it crash" philosophy. >> >> In erlang we don't do defensive programming - (or rather we do do it using >> patterns) >> >> Best >> >> /Joe Armstrong >> >> >> >>> Cheers, >>> Adam >>> _______________________________________________ >>> 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 raimo+erlang-questions@REDACTED Wed Feb 11 16:52:36 2009 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Wed, 11 Feb 2009 16:52:36 +0100 Subject: [erlang-questions] : Human readable errors in lists module In-Reply-To: <3685675.12671234364694230.JavaMail.root@zimbra> References: <11154509.12651234364679776.JavaMail.root@zimbra> <3685675.12671234364694230.JavaMail.root@zimbra> Message-ID: <20090211155236.GA19467@erix.ericsson.se> On Wed, Feb 11, 2009 at 03:04:54PM +0000, Adam Lindberg wrote: > I agree with most arguments here. I think the only thing that bothers me is that the function returns an internal error, not an interface error. Yes, but sometimes an interface error is hard to find at the interface. > > As a side question, would adding a guard "when length(Ys) == length(Xs)" produce any overhead? That is, does length take time to compute or is it store in memory? It produces O(length(Ys)) overhead. The length is not available without traversing. In this case, for correct arguments, if done only at the interface that is having an entry function with a guard and traversing without guard, it would change the current O(length(Ys) to K * O(length(Ys)). List Ys first traversed by length(Ys), then Xs by length(Ks), and then Ys and Xs by the loop producing the result. Since length/1 is written in C I would estimate it would to be less overhead than double, but measurable. And the code will become two functions (uglier). For the error case when length(Ys) =/= length(Xs) the run time would be O(max(length(Ys), length(Xs)) instead of O(min(length(Ys), length(Xs)) since both lists always are traversed. And if any of the lists is an improper list the symptom will be a (confusing) function clause at the interface. So, there are a number of small reasons Joe Armstrong has his philosophy of writing small and beautiful code and letting it crash. > > Cheers, > Adam > > ----- "Kenneth Lundin" wrote: > > > Hi, > > > > As responsible for the Erlang/OTP team at Ericsson I can just say > > that > > we agree with Joe in this matter. > > We have no intention to add human readable errors to the list module > > or other library modules in standard lib. > > > > As a matter of fact I think a crash with function clause is quite > > clear because it informs you about > > that a named function did not have any clause which matched the > > arguments you called it with. And the arguments > > are also available in the crash info. > > As the source code and the documentation for lists in this case is > > available it should be possible to understand why the arguments was > > not accepted. > > > > A beginner might not have so easy to understand whats wrong but after > > just a few occurences of errors like that it should be > > quite obvious. > > > > /Kenneth Erlang/OTP Ericsson > > > > On Tue, Feb 10, 2009 at 10:46 PM, Joe Armstrong > > wrote: > > > On Tue, Feb 10, 2009 at 4:22 PM, Adam Lindberg > > > wrote: > > >> Hi, > > >> > > >> Is there any reason that for example lists:zipwith/3 returns a > > function clause instead of a human readable error when the lists are > > of different length? > > > > > > Yes > > > > > > Everything has a cost - if we applied this principle rigidly to all > > > functions in > > > the system then every function in the entire system would be > > extended with > > > additional code. This make the code more difficult to read, and > > makes the > > > program larger (think cache hits). > > > > > > Suppose we have a function that maps a to 1 and b to 2, I'd write it > > like this: > > > > > > f(a) -> 1; > > > f(b) -> 2. > > > > > > should I then add an additional clause to warn for bad arguments? > > > > > > f(a) -> 1; > > > f(b) -> 2; > > > f(_) -> error('arg is not a or b'). > > > > > > This adds nothing to the clarity of the code since the original > > expresses exact > > > the intention of the program *and nothing else* > > > > > > Programs that are cluttered with additional error messages are > > difficult to read > > > (which increases the chances of an error) an less efficient > > > (everything has a cost) > > > > > >> It might seem obvious at first but the reason I'm asking is because > > a colleague of >mine just spent a long time debugging code with used > > list:zipwith/3 and it threw >this error. What he did at first was to > > check that all arguments to lists:zipwith/3 > > >> > was not zero (this is what the function clause error indicated). > > > > > > *everybody* spends a long time figuring out what when wrong the > > first time > > > they get an error of a particular type - then they learn - when > > you've seen > > > these errors a few times you'll find that you can find the error > > very quickly > > > > > > The fact that erlang crashes at the first error and prints something > > really > > > aids debugging ... > > >> > > >> lists:zipwith/3 could have been implemented as below (or something > > similar): > > >> > > >> zipwith(F, [X | Xs], [Y | Ys]) -> [F(X, Y) | zipwith(F, Xs, Ys)]; > > >> zipwith(F, [], []) when is_function(F, 2) -> []. > > >> zipwith(F, [], Ys) -> error(lists_of_different_length). %% Just a > > proposal, insert > > >> zipwith(F, Xs, []) -> error(lists_of_different_length). %% > > preferred error mechanism here. > > >> > > >> The function clause, noting the arguments as [#Fun..., [], > > [5,6,7,...]], is kind of misleading since it happens inside the > > lists:zipwith/3 function. > > >> > > >> I can see the purists' argument here "that it is really a function > > clause" but I also see the pragmatist argument "that it is much easier > > to debug." > > > > > > Nw let's look at the error message - here's an experiment > > > > > > 1> lists:zipwith(fun(X,Y) -> X + Y end, [1,2,3],[4,5]). > > > ** exception error: no function clause matching > > > > > lists:zipwith(#Fun,[3],[]) > > > in function lists:zipwith/3 > > > > > > To the experienced eye the error is clear > > > > > > zipwith(Fun, [3], []) doesn't match any of the clauses defining > > zipwith > > > > > > Show me the code Luke ... (just run less on > > > /usr/local/lib/erlang/stdlib ... ish) > > > > > > zipwith(F, [X | Xs], [Y | Ys]) -> [F(X, Y) | zipwith(F, Xs, Ys)]; > > > zipwith(F, [], []) when is_function(F, 2) -> []. > > > > > > This is two lines of code. > > > > > > So zipwith(Fun, [3], []) doesn't match one of these two lines of > > code ... > > > > > > this is actually *shorter* than the documentation (a lot shorter) > > > > > > what does the documentation say? > > > > > > zipwith(Combine, List1, List2) -> List3 > > > Types Combine = fun(X, Y) -> T > > > List1 = [X] > > > List2 = [Y] > > > List3 = [T] > > > X = Y = T = term() > > > Combine the elements of two lists of equal length into one > > list. > > > > > ************** > > > What I have noticed teaching Erlang is that beginners make almost > > exactly > > > the same mistakes as experienced users - the difference is in the > > time > > > it takes them to debug an error. > > > > > > The first time is *always* slow - then you learn. > > > > > > (this is universally true - while I can fix erlang programs pretty > > quickly > > > I can stare at simple javascript errors for ages before twigging > > what > > > went wrong) > > > > > > But there's a more subtle problem. > > > > > > Let's try your suggestion. (I put your zipwith in a module test4) > > > > > > try4:zipwith(fun(X,Y) -> X + Y end, [1,2,3],[4,5]). > > > ** exception error: lists_of_different_length > > > in function try4:zipwith/3 > > > in call from try4:zipwith/3 > > > > > > It works - great - we think ... but what about this? > > > > > > try4:zipwith(fun(X,Y) -> X + Y end, {1,2},[4,5]). > > > ** exception error: no function clause matching > > > > > try4:zipwith(#Fun,{1,2},[4,5]) > > > > > > Now what? Opps the guards were wrong - need to add a few > > > when is_list(..) guards. Or do we want an error message that says > > > error,arg1 should not be a tuple .... > > > > > > There are a very large number of ways we can supply incorrect > > arguments > > > and we can't program all of them. > > > > > > So what do we do - we only write patterns that match the desired > > cases > > > *and nothing else* - this is part of the erlang "let it crash" > > philosophy. > > > > > > In erlang we don't do defensive programming - (or rather we do do it > > using > > > patterns) > > > > > > Best > > > > > > /Joe Armstrong > > > > > > > > >> Cheers, > > >> Adam > > >> _______________________________________________ > > >> 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 -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From ulf@REDACTED Wed Feb 11 17:29:26 2009 From: ulf@REDACTED (Ulf Wiger) Date: Wed, 11 Feb 2009 17:29:26 +0100 Subject: [erlang-questions] Human readable errors in lists module In-Reply-To: References: <31309437.10521234279023327.JavaMail.root@zimbra> <23377730.10541234279344155.JavaMail.root@zimbra> <9b08084c0902101346r166b4b77l14e68ac0dc2e6b8b@mail.gmail.com> Message-ID: <8209f740902110829tdebfdf2t23b6007148d1299f@mail.gmail.com> I think there exists a refined version of this philosophy, but zipwith() is perhaps not the best example to illustrate it. I agree that 'let it crash' is the first principle, but the owner of the interface has a responsibility to try to make the API behave in a manner that doesn't confound the user. I'd be upset if, e.g., mnesia:activity() exited with function_clause in mnesia_trans, mnesia_dumper etc, as a result of mistakes in using the interface. Even crashes must give the user some reasonable indication of who's at fault. BR, Ulf W 2009/2/11, Kenneth Lundin : > Hi, > > As responsible for the Erlang/OTP team at Ericsson I can just say that > we agree with Joe in this matter. > We have no intention to add human readable errors to the list module > or other library modules in standard lib. > > As a matter of fact I think a crash with function clause is quite > clear because it informs you about > that a named function did not have any clause which matched the > arguments you called it with. And the arguments > are also available in the crash info. > As the source code and the documentation for lists in this case is > available it should be possible to understand why the arguments was > not accepted. > > A beginner might not have so easy to understand whats wrong but after > just a few occurences of errors like that it should be > quite obvious. > > /Kenneth Erlang/OTP Ericsson > > On Tue, Feb 10, 2009 at 10:46 PM, Joe Armstrong wrote: >> On Tue, Feb 10, 2009 at 4:22 PM, Adam Lindberg >> wrote: >>> Hi, >>> >>> Is there any reason that for example lists:zipwith/3 returns a function >>> clause instead of a human readable error when the lists are of different >>> length? >> >> Yes >> >> Everything has a cost - if we applied this principle rigidly to all >> functions in >> the system then every function in the entire system would be extended with >> additional code. This make the code more difficult to read, and makes the >> program larger (think cache hits). >> >> Suppose we have a function that maps a to 1 and b to 2, I'd write it like >> this: >> >> f(a) -> 1; >> f(b) -> 2. >> >> should I then add an additional clause to warn for bad arguments? >> >> f(a) -> 1; >> f(b) -> 2; >> f(_) -> error('arg is not a or b'). >> >> This adds nothing to the clarity of the code since the original expresses >> exact >> the intention of the program *and nothing else* >> >> Programs that are cluttered with additional error messages are difficult >> to read >> (which increases the chances of an error) an less efficient >> (everything has a cost) >> >>> It might seem obvious at first but the reason I'm asking is because a >>> colleague of >mine just spent a long time debugging code with used >>> list:zipwith/3 and it threw >this error. What he did at first was to >>> check that all arguments to lists:zipwith/3 >>> > was not zero (this is what the function clause error indicated). >> >> *everybody* spends a long time figuring out what when wrong the first time >> they get an error of a particular type - then they learn - when you've >> seen >> these errors a few times you'll find that you can find the error very >> quickly >> >> The fact that erlang crashes at the first error and prints something >> really >> aids debugging ... >>> >>> lists:zipwith/3 could have been implemented as below (or something >>> similar): >>> >>> zipwith(F, [X | Xs], [Y | Ys]) -> [F(X, Y) | zipwith(F, Xs, Ys)]; >>> zipwith(F, [], []) when is_function(F, 2) -> []. >>> zipwith(F, [], Ys) -> error(lists_of_different_length). %% Just a >>> proposal, insert >>> zipwith(F, Xs, []) -> error(lists_of_different_length). %% preferred >>> error mechanism here. >>> >>> The function clause, noting the arguments as [#Fun..., [], [5,6,7,...]], >>> is kind of misleading since it happens inside the lists:zipwith/3 >>> function. >>> >>> I can see the purists' argument here "that it is really a function >>> clause" but I also see the pragmatist argument "that it is much easier to >>> debug." >> >> Nw let's look at the error message - here's an experiment >> >> 1> lists:zipwith(fun(X,Y) -> X + Y end, [1,2,3],[4,5]). >> ** exception error: no function clause matching >> lists:zipwith(#Fun,[3],[]) >> in function lists:zipwith/3 >> >> To the experienced eye the error is clear >> >> zipwith(Fun, [3], []) doesn't match any of the clauses defining zipwith >> >> Show me the code Luke ... (just run less on >> /usr/local/lib/erlang/stdlib ... ish) >> >> zipwith(F, [X | Xs], [Y | Ys]) -> [F(X, Y) | zipwith(F, Xs, Ys)]; >> zipwith(F, [], []) when is_function(F, 2) -> []. >> >> This is two lines of code. >> >> So zipwith(Fun, [3], []) doesn't match one of these two lines of code ... >> >> this is actually *shorter* than the documentation (a lot shorter) >> >> what does the documentation say? >> >> zipwith(Combine, List1, List2) -> List3 >> Types Combine = fun(X, Y) -> T >> List1 = [X] >> List2 = [Y] >> List3 = [T] >> X = Y = T = term() >> Combine the elements of two lists of equal length into one list. >> >> ************** >> What I have noticed teaching Erlang is that beginners make almost exactly >> the same mistakes as experienced users - the difference is in the time >> it takes them to debug an error. >> >> The first time is *always* slow - then you learn. >> >> (this is universally true - while I can fix erlang programs pretty quickly >> I can stare at simple javascript errors for ages before twigging what >> went wrong) >> >> But there's a more subtle problem. >> >> Let's try your suggestion. (I put your zipwith in a module test4) >> >> try4:zipwith(fun(X,Y) -> X + Y end, [1,2,3],[4,5]). >> ** exception error: lists_of_different_length >> in function try4:zipwith/3 >> in call from try4:zipwith/3 >> >> It works - great - we think ... but what about this? >> >> try4:zipwith(fun(X,Y) -> X + Y end, {1,2},[4,5]). >> ** exception error: no function clause matching >> try4:zipwith(#Fun,{1,2},[4,5]) >> >> Now what? Opps the guards were wrong - need to add a few >> when is_list(..) guards. Or do we want an error message that says >> error,arg1 should not be a tuple .... >> >> There are a very large number of ways we can supply incorrect arguments >> and we can't program all of them. >> >> So what do we do - we only write patterns that match the desired cases >> *and nothing else* - this is part of the erlang "let it crash" philosophy. >> >> In erlang we don't do defensive programming - (or rather we do do it using >> patterns) >> >> Best >> >> /Joe Armstrong >> >> >>> Cheers, >>> Adam >>> _______________________________________________ >>> 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 getyourcontacts@REDACTED Wed Feb 11 17:46:31 2009 From: getyourcontacts@REDACTED (Yang Zhang) Date: Thu, 12 Feb 2009 00:46:31 +0800 Subject: [erlang-questions] Is erlang a web language? Message-ID: <4535f6cd0902110846w1180516u7dfbf83ce8c87970@mail.gmail.com> I saw eralng has its own webserver and distribute database. These looks quite good. But after I wrote some web programs, I found erlang even doesn't have a strong enough htmlentities or urlencode , urldecode function. What's the problem here? Isnot erlang a web language? From getyourcontacts@REDACTED Wed Feb 11 18:09:31 2009 From: getyourcontacts@REDACTED (Yang Zhang) Date: Thu, 12 Feb 2009 01:09:31 +0800 Subject: [erlang-questions] Is mnesia/erlang/ETP strong enough? Message-ID: <4535f6cd0902110909h47e6430fgbbd2b45b01a0030c@mail.gmail.com> After 2 weeks programming and running with erlang program, I got lots of memory error and erl crashed more than 50 times. I was trying to run 400 processes + mnesia on one node. The 400 processes was designed to scrape data from web then save them to mnesia database. At first, after about 2 or 3 hours running, I found erl crashed(not program). Then I restart then 2 or 3 hours erl crashed again. I found the erl process consume about 1.3G memory then it crashed, I start to wonder if there are some things wrong with too many processes. So I minus to 200 processes and split them to 10 nodes, with run 20 processes and the main one running mnesia database. Things went well untill 2 days later, I found the main erl node crashed again. After restart it, after 1 or 2 minutes it crashed again. Eventually I found it is the table type's problem, so I changed data type from disc_* to disc_only. Then problem solved. Then it keeps running for 4 days, everything goes well until I want to check how many data I have. So I open table viewer: tv:start(). The see there are 6M records in my table, quite happy. Then double-click, both node crashed. Sign~~ I got clever. Now I never opened that table. I choose a small one which only have 120K records. Open it. No crash. Safty. The search for some words, only 2K. OK. No crash. Then search for another one, the number is climbing, when it hits 4K. oh My god. Both nodes crash again only show me the ugly Crash dump was written to: erl_crash.dump eheap_alloc: Cannot allocate 373662860 bytes of memory (of type "heap"). damm~~~ I am using C#/SqlServer to develop program. I haven't seen anytime sqlserver open a table with 6M table will crash itself, I even tried to open a 50M records table. Why erl system so volunerable? Is crash the better way than only ternimate the problem process? Don't know why. Also I have fell in love with erlang, but its so unstable behavior make it far away from my commerial program. Any option? http://harbork.com/Is-mnesia-erlang-ETP-strong-enough/Is-mnesia-erlang-ETP-strong-enough-4b4vyEV84t2fjviIJHLw.html From masklinn@REDACTED Wed Feb 11 18:09:44 2009 From: masklinn@REDACTED (Masklinn) Date: Wed, 11 Feb 2009 18:09:44 +0100 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <4535f6cd0902110846w1180516u7dfbf83ce8c87970@mail.gmail.com> References: <4535f6cd0902110846w1180516u7dfbf83ce8c87970@mail.gmail.com> Message-ID: <11FD06F7-C93B-4801-947E-7A78E72EE641@masklinn.net> On 11 f?vr. 09, at 17:46, Yang Zhang wrote: > I saw eralng has its own webserver and distribute database. These > looks quite good. > But after I wrote some web programs, I found erlang even doesn't have > a strong enough htmlentities or urlencode , urldecode function. What's > the problem here? > Isnot erlang a web language I'm not really sure of what you mean by "a web language but: * if you mean "a language in which it's possible to write a website, then erlang works (yaws, erlyweb, mochi*) * if you mean "a language made to create websites (php, coldfusion) then definitely not * if you mean "a language in which writing websites is enjoyable (python+django, ruby+rails) then I'd tend to say no, but I'm sure others will disagree. And in any case, Erlang doesn't bundle website-related stuff in the stdlib. It's not "web ready out of the box", that's not its main usage domain. From kevin@REDACTED Wed Feb 11 18:35:03 2009 From: kevin@REDACTED (Kevin Scaldeferri) Date: Wed, 11 Feb 2009 09:35:03 -0800 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <4535f6cd0902110846w1180516u7dfbf83ce8c87970@mail.gmail.com> References: <4535f6cd0902110846w1180516u7dfbf83ce8c87970@mail.gmail.com> Message-ID: <49E5F9E1-3526-4D93-B01E-E0830694939F@scaldeferri.com> Could you be a little more specific about what "not strong enough" means? This complaint is almost comical. Entity encoding and url escaping are nearly trivial code. Someone has given you a distributed database and you're brushing it off because you might have to write 20 lines of code that require practically no thought? -k On Feb 11, 2009, at 8:46 AM, Yang Zhang wrote: > I saw eralng has its own webserver and distribute database. These > looks quite good. > But after I wrote some web programs, I found erlang even doesn't have > a strong enough htmlentities or urlencode , urldecode function. What's > the problem here? > Isnot erlang a web language? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From getyourcontacts@REDACTED Wed Feb 11 19:37:46 2009 From: getyourcontacts@REDACTED (Yang Zhang) Date: Thu, 12 Feb 2009 02:37:46 +0800 Subject: [erlang-questions] Is mnesia/erlang/ETP strong enough? In-Reply-To: <7EFF3E64-63EC-47C2-B87F-431CF536EF4C@uninet.ee> References: <4535f6cd0902110909h47e6430fgbbd2b45b01a0030c@mail.gmail.com> <7EFF3E64-63EC-47C2-B87F-431CF536EF4C@uninet.ee> Message-ID: <4535f6cd0902111037l2d6334adn7150c296b1182b0c@mail.gmail.com> Hi. Taavi. Thanks. http://erlang.org/faq/how_do_i.html#5.15 really help. Although I insist on I wrote the correct program(Use tail recursion, etc), but I confess I know little how to " Limit atom table growth. Check message queues size. Look for runaway processes. use erlang:system_monitor/1,/2" . I think erlang/mnesia designers and implementors are doing well so I can use it like a idiot. (I lost confidence in SqlServer because its perfomance when dealing with 100M records, need create big index and is still slow. So I move to mnesia and continue finding some database except Oracle. Hope it can solve my problem.) ----------------------------------------------------------------------------------------- If you run out of memory, strange things will start to happen regardless of language.. ---------------------------------------------------------------------------------------- I agree, but just few hours after encounter erlang memory problem, I start to think about the memory problem. I am running erlang on a server(win2003 server R2) with 8 CPUs and 10G memory. I found when erlang consumed ~800M - 1.5G memory, it will crash itself. Actually meantime OS have ~7G memory free but erl can't use it. I start to wonder why can't erlang spawn another real OS erlang process then share some memory, then it can have memory more than 1.5G. I know on 32bit system each process has 4G limitation and actually it can only use less than 3G. ( I tested my C# program, it would throw OutOfMemory exception too when it consumed ~800M - 1.5G memory. But it didn't crash.) That's why in my previous I have to create several nodes to spawn processes, with each node run 20 proceses, each node only consume ~100M memory so it didn't crash. Thanks again for reply. Just hope erlang can have a more elegant way to handle memory problem. On Thu, Feb 12, 2009 at 2:09 AM, Taavi Talvik wrote: > > On Feb 11, 2009, at 7:09 PM, Yang Zhang wrote: > > After 2 weeks programming and running with erlang program, I got lots >> of memory error and erl crashed more than 50 times >> > > ... > > Crash dump was written to: erl_crash.dump >> eheap_alloc: Cannot allocate 373662860 bytes of memory (of type "heap"). >> > > http://erlang.org/faq/how_do_i.html#5.15 > > Look around for processes which grow uncontrolled. > Split them up. Use tail recursion. Limit atom table growth. Check > message queues size. Look for runaway processes. use > erlang:system_monitor/1,/2 > > I am using C#/SqlServer to develop program. I haven't seen anytime >> sqlserver open a table with 6M table will crash itself, I even tried >> to open a 50M records table. >> Why erl system so volunerable? >> >> Is crash the better way than only ternimate the problem process? Don't >> know why. >> >> Also I have fell in love with erlang, but its so unstable behavior >> make it far away from my commerial program. >> > > > If you run out of memory, strange things will start to happen regardless of > language.. > > best regards, > taavi > -------------- next part -------------- An HTML attachment was scrubbed... URL: From taavi@REDACTED Wed Feb 11 19:27:46 2009 From: taavi@REDACTED (Taavi Talvik) Date: Wed, 11 Feb 2009 20:27:46 +0200 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <4535f6cd0902110846w1180516u7dfbf83ce8c87970@mail.gmail.com> References: <4535f6cd0902110846w1180516u7dfbf83ce8c87970@mail.gmail.com> Message-ID: <3EC78F9B-5873-4E10-9A1E-A38649F96B0F@uninet.ee> On Feb 11, 2009, at 6:46 PM, Yang Zhang wrote: > I saw eralng has its own webserver and distribute database. These > looks quite good. > But after I wrote some web programs, I found erlang even doesn't have > a strong enough htmlentities or urlencode , urldecode function. What's > the problem here? > Isnot erlang a web language? htmlentities, urlencode/decode are easy part. Supplied by any erlang web frameworks. It starts to be interesting there: Web chatroom in 57 lines: http://nitrogenproject.com/web/samples/comet2 Million connections: http://www.metabrew.com/article/a-million-user-comet-application-with-mochiweb-part-1/ putting data into cloud: http://couchdb.apache.org/ http://aws.amazon.com/simpledb/ wikipedia on on fraction of hardware: http://www.onscale.de/scalaris.html http://www.onscale.de/Schuett_Google_Scalability.pdf best regards, taavi From getyourcontacts@REDACTED Wed Feb 11 19:58:05 2009 From: getyourcontacts@REDACTED (Yang Zhang) Date: Thu, 12 Feb 2009 02:58:05 +0800 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <3EC78F9B-5873-4E10-9A1E-A38649F96B0F@uninet.ee> References: <4535f6cd0902110846w1180516u7dfbf83ce8c87970@mail.gmail.com> <3EC78F9B-5873-4E10-9A1E-A38649F96B0F@uninet.ee> Message-ID: <4535f6cd0902111058x32bcaf64r8536c89ad9546cc1@mail.gmail.com> Thanks all for replying. Just think erlang's database and distribute feature are so great so it is the best way I can think to make a distribute crawler and web page analyzor(what I am doing), then found it doesn't have strong built in web library like urlencode/htmlentities for me to process url and html. And it builtin httpclient even ibrowse doesn't support bind IP when initial http request. Never mind a function is complex or easy, what in my mind is erlang didn't have it so it is incomplete. No one like to write the simple code again and again. And I'm not sure I could write it right one the first time i wrote it. Glad see it has another library to compensate the missing ones so everything is ok now. Thanks. I will check these links. On Thu, Feb 12, 2009 at 2:27 AM, Taavi Talvik wrote: > > On Feb 11, 2009, at 6:46 PM, Yang Zhang wrote: > > I saw eralng has its own webserver and distribute database. These >> looks quite good. >> But after I wrote some web programs, I found erlang even doesn't have >> a strong enough htmlentities or urlencode , urldecode function. What's >> the problem here? >> Isnot erlang a web language? >> > > htmlentities, urlencode/decode are easy part. Supplied by > any erlang web frameworks. > > It starts to be interesting there: > > Web chatroom in 57 lines: > http://nitrogenproject.com/web/samples/comet2 > > Million connections: > > http://www.metabrew.com/article/a-million-user-comet-application-with-mochiweb-part-1/ > > putting data into cloud: > http://couchdb.apache.org/ > http://aws.amazon.com/simpledb/ > > wikipedia on on fraction of hardware: > http://www.onscale.de/scalaris.html > http://www.onscale.de/Schuett_Google_Scalability.pdf > > best regards, > taavi > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cliff@REDACTED Wed Feb 11 21:45:00 2009 From: cliff@REDACTED (Cliff Moon) Date: Wed, 11 Feb 2009 12:45:00 -0800 Subject: [erlang-questions] foldl over dets with concurrent updates Message-ID: <499338CC.2010301@moonpolysoft.com> Does anyone know what will happen if you fold over a dets table while some other process is making a concurrent update? I've done some tests on this and it appears that a foldl doesn't lock the table. So I'm wondering if it will break or do something else goofy if the table gets concurrently modified. From ok@REDACTED Wed Feb 11 22:31:36 2009 From: ok@REDACTED (Richard O'Keefe) Date: Thu, 12 Feb 2009 10:31:36 +1300 Subject: [erlang-questions] '--' BIF to be used with caution? In-Reply-To: <4d08db370902110058y37db088bwfdab93d579e508d0@mail.gmail.com> References: <707529930901130404y5418466bmc375525ef765e615@mail.gmail.com> <6672d0160902040248n4ef30e0cm4e4e0cb718a04349@mail.gmail.com> <707529930902050630l250a8ae4nedbfa71e5d63460e@mail.gmail.com> <13728F3E-6CF3-4B58-B55B-88950019D370@cs.otago.ac.nz> <4d08db370902100044y4ea7c5cbl5e3bb9cefb9caafa@mail.gmail.com> <4d08db370902110058y37db088bwfdab93d579e508d0@mail.gmail.com> Message-ID: On 11 Feb 2009, at 9:58 pm, Hynek Vychodil wrote: > Nice, and now measure this for 5 element long lists. Who *cares*? For teeny tiny lists, they are all too fast to measure reliably, which means that for teeny tiny lists there is no point in keeping the C code. Anyone remember UNIX V7 for PDP-11? The designers had pretty much done "the simplest thing that could possibly work". Time and again, faced with the need for a data structure, they had done their calculations and found that on a PDP-11 the data structures just couldn't get big enough for linear searches to be a problem. Then the code got ported to the VAX, and performance was *horrible*, because on a VAX the data structures *could* get that big. From kerr.rainey@REDACTED Wed Feb 11 22:35:26 2009 From: kerr.rainey@REDACTED (kerr) Date: Wed, 11 Feb 2009 13:35:26 -0800 (PST) Subject: [erlang-questions] Hacked Group Home Page? Message-ID: Is anyone else seeing the porn advert at http://groups.google.com/group/erlang-questions ? We were getting something similar on the mochiweb group. Bob Ippolito couldn't see it, but edited the welcome page and it went away. Could the manager of this group try that? -- Kerr From ulf@REDACTED Wed Feb 11 22:53:32 2009 From: ulf@REDACTED (Ulf Wiger) Date: Wed, 11 Feb 2009 22:53:32 +0100 Subject: [erlang-questions] Is mnesia/erlang/ETP strong enough? In-Reply-To: <4535f6cd0902110909h47e6430fgbbd2b45b01a0030c@mail.gmail.com> References: <4535f6cd0902110909h47e6430fgbbd2b45b01a0030c@mail.gmail.com> Message-ID: <8209f740902111353y6f7dedc3lb612c0fa348c6c03@mail.gmail.com> If the erlang VM gets an OutOfMemoryException, it will terminate. If both Erlang and C# get an OOM exception at around 1.3G, perhaps you should review your settings in Windows 2003? I've not used Windows Server 2003, but it has a lot of weird stuff like application recycling etc, in order to protect itself against runaway processes. http://www.ironspeed.com/Designer/5.2.1/WebHelp/Part_II/Windows_2003_Application_Performance_Suggestions.htm Perhaps you have some system settings limiting the available memory for the application? BR, Ulf W 2009/2/11 Yang Zhang : > After 2 weeks programming and running with erlang program, I got lots > of memory error and erl crashed more than 50 times. > > I was trying to run 400 processes + mnesia on one node. The 400 > processes was designed to scrape data from web then save them to > mnesia database. > At first, after about 2 or 3 hours running, I found erl crashed(not > program). Then I restart then 2 or 3 hours erl crashed again. > I found the erl process consume about 1.3G memory then it crashed, I > start to wonder if there are some things wrong with too many > processes. So I minus to 200 processes and split them to 10 nodes, > with run 20 processes and the main one running mnesia database. > > Things went well untill 2 days later, I found the main erl node > crashed again. After restart it, after 1 or 2 minutes it crashed > again. Eventually I found it is the table type's problem, so I changed > data type from disc_* to disc_only. Then problem solved. > > Then it keeps running for 4 days, everything goes well until I want to > check how many data I have. So I open table viewer: > tv:start(). > The see there are 6M records in my table, quite happy. Then > double-click, both node crashed. Sign~~ > > I got clever. Now I never opened that table. I choose a small one > which only have 120K records. Open it. No crash. Safty. The search for > some words, only 2K. OK. No crash. Then search for another one, the > number is climbing, when it hits 4K. oh My god. Both nodes crash again > only show me the ugly > > Crash dump was written to: erl_crash.dump > eheap_alloc: Cannot allocate 373662860 bytes of memory (of type "heap"). > > > damm~~~ > > I am using C#/SqlServer to develop program. I haven't seen anytime > sqlserver open a table with 6M table will crash itself, I even tried > to open a 50M records table. > Why erl system so volunerable? > > Is crash the better way than only ternimate the problem process? Don't know why. > > Also I have fell in love with erlang, but its so unstable behavior > make it far away from my commerial program. > > Any option? > > > http://harbork.com/Is-mnesia-erlang-ETP-strong-enough/Is-mnesia-erlang-ETP-strong-enough-4b4vyEV84t2fjviIJHLw.html > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From stondage123@REDACTED Wed Feb 11 23:00:55 2009 From: stondage123@REDACTED (Andrew Stone) Date: Wed, 11 Feb 2009 14:00:55 -0800 (PST) Subject: [erlang-questions] Hacked Group Home Page? References: Message-ID: <44984.99456.qm@web35902.mail.mud.yahoo.com> yep. I see it. I thought it was intentional. ;) ----- Original Message ---- From: kerr To: erlang-questions@REDACTED Sent: Wednesday, February 11, 2009 4:35:26 PM Subject: [erlang-questions] Hacked Group Home Page? Is anyone else seeing the porn advert at http://groups.google.com/group/erlang-questions ? We were getting something similar on the mochiweb group. Bob Ippolito couldn't see it, but edited the welcome page and it went away. Could the manager of this group try that? -- Kerr _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From getyourcontacts@REDACTED Thu Feb 12 07:00:39 2009 From: getyourcontacts@REDACTED (Yang Zhang) Date: Thu, 12 Feb 2009 14:00:39 +0800 Subject: [erlang-questions] Is mnesia/erlang/ETP strong enough? In-Reply-To: <8209f740902111353y6f7dedc3lb612c0fa348c6c03@mail.gmail.com> References: <4535f6cd0902110909h47e6430fgbbd2b45b01a0030c@mail.gmail.com> <8209f740902111353y6f7dedc3lb612c0fa348c6c03@mail.gmail.com> Message-ID: <4535f6cd0902112200r4baabfa8j4ba5d4d42c9f0981@mail.gmail.com> Hi. Ulf W. I was facing the win2003 server memory problem whether erlang or C#. I will check your links. Thank you for sharing. On Thu, Feb 12, 2009 at 5:53 AM, Ulf Wiger wrote: > If the erlang VM gets an OutOfMemoryException, it will terminate. > > If both Erlang and C# get an OOM exception at around 1.3G, > perhaps you should review your settings in Windows 2003? > > I've not used Windows Server 2003, but it has a lot of weird > stuff like application recycling etc, in order to protect itself against > runaway processes. > > > http://www.ironspeed.com/Designer/5.2.1/WebHelp/Part_II/Windows_2003_Application_Performance_Suggestions.htm > > Perhaps you have some system settings limiting the available > memory for the application? > > BR, > Ulf W > > 2009/2/11 Yang Zhang : > > After 2 weeks programming and running with erlang program, I got lots > > of memory error and erl crashed more than 50 times. > > > > I was trying to run 400 processes + mnesia on one node. The 400 > > processes was designed to scrape data from web then save them to > > mnesia database. > > At first, after about 2 or 3 hours running, I found erl crashed(not > > program). Then I restart then 2 or 3 hours erl crashed again. > > I found the erl process consume about 1.3G memory then it crashed, I > > start to wonder if there are some things wrong with too many > > processes. So I minus to 200 processes and split them to 10 nodes, > > with run 20 processes and the main one running mnesia database. > > > > Things went well untill 2 days later, I found the main erl node > > crashed again. After restart it, after 1 or 2 minutes it crashed > > again. Eventually I found it is the table type's problem, so I changed > > data type from disc_* to disc_only. Then problem solved. > > > > Then it keeps running for 4 days, everything goes well until I want to > > check how many data I have. So I open table viewer: > > tv:start(). > > The see there are 6M records in my table, quite happy. Then > > double-click, both node crashed. Sign~~ > > > > I got clever. Now I never opened that table. I choose a small one > > which only have 120K records. Open it. No crash. Safty. The search for > > some words, only 2K. OK. No crash. Then search for another one, the > > number is climbing, when it hits 4K. oh My god. Both nodes crash again > > only show me the ugly > > > > Crash dump was written to: erl_crash.dump > > eheap_alloc: Cannot allocate 373662860 bytes of memory (of type "heap"). > > > > > > damm~~~ > > > > I am using C#/SqlServer to develop program. I haven't seen anytime > > sqlserver open a table with 6M table will crash itself, I even tried > > to open a 50M records table. > > Why erl system so volunerable? > > > > Is crash the better way than only ternimate the problem process? Don't > know why. > > > > Also I have fell in love with erlang, but its so unstable behavior > > make it far away from my commerial program. > > > > Any option? > > > > > > > http://harbork.com/Is-mnesia-erlang-ETP-strong-enough/Is-mnesia-erlang-ETP-strong-enough-4b4vyEV84t2fjviIJHLw.html > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From imre@REDACTED Thu Feb 12 08:46:26 2009 From: imre@REDACTED (Imre Palik) Date: Thu, 12 Feb 2009 09:46:26 +0200 Subject: [erlang-questions] Hot standby? Message-ID: <3BE6DBA1F3BE9D4798255806113D5654421594C409@utx-exchange.utx.local> Hi, I am currently reading the Design Principles document, and as far as I understand, what it calls as distributed application is effectively a cold redundancy scheme. Does erlang provide any tools to run e.g., two nodes in a hot standby failover configuration? Thx, Imre From ulf@REDACTED Thu Feb 12 09:25:45 2009 From: ulf@REDACTED (Ulf Wiger) Date: Thu, 12 Feb 2009 09:25:45 +0100 Subject: [erlang-questions] Hot standby? In-Reply-To: <3BE6DBA1F3BE9D4798255806113D5654421594C409@utx-exchange.utx.local> References: <3BE6DBA1F3BE9D4798255806113D5654421594C409@utx-exchange.utx.local> Message-ID: <8209f740902120025k6834bf38s631b21eb8b2cb54c@mail.gmail.com> Yes, but the nature of hot standby, IMHO, is such that it requires more cooperation from the application. Mnesia is hot standby, and there's a benchmark program included with mnesia that handles subscriber database information in a cluster configuration. The global name server, global, is fully replicated. The pg2 module can also be used to implement hot standby. Outside of OTP, gen_leader (http://www.cs.chalmers.se/~hanssv/leader_election/) is specifically a behaviour for hot standby. You can even use the application controller, by creating a sentinel app which triggers the hot standby logic when moved. The AXD 301 did something along these lines, where a 'standby' application would trigger stable-state replication. If the primary died, it would wake up next to the standby application, and could recover quickly, since all the necessary data had been prepared. Let's call this "warm standby". ;-) Basically, there are ways to make sure that the data is replicated to the standby. Depending on your time constraints for recovery, you can turn up the heat using various techniques. One thing to consider is that some of the local recovery mechanisms, such as restart escalation in the supervision tree, and the net tick logic for Distributed Erlang, can sometimes be at odds with hot standby. While it's relatively easy to make the actual switchover fast, it can be challenging to speed up the time to error discovery. This is of course application-dependent. BR, Ulf W 2009/2/12 Imre Palik : > Hi, > > I am currently reading the Design Principles document, and as far as I understand, what it calls as distributed application is effectively a cold redundancy scheme. Does erlang provide any tools to run e.g., two nodes in a hot standby failover configuration? > > Thx, > > Imre > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From Lennart.Ohman@REDACTED Thu Feb 12 09:33:47 2009 From: Lennart.Ohman@REDACTED (=?iso-8859-1?Q?Lennart_=D6hman?=) Date: Thu, 12 Feb 2009 09:33:47 +0100 Subject: [erlang-questions] Hot standby? In-Reply-To: <3BE6DBA1F3BE9D4798255806113D5654421594C409@utx-exchange.utx.local> References: <3BE6DBA1F3BE9D4798255806113D5654421594C409@utx-exchange.utx.local> Message-ID: Hi, not any specific other than that it is "easy" to create a hot-standby by means of consistently replicate a state to the other node. For instance by using Mnesia as data storage. I am working something I have named Fotos to address these problems. I'll send you a private email about that. Lennart -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Imre Palik Sent: den 12 februari 2009 08:46 To: erlang-questions@REDACTED Subject: [erlang-questions] Hot standby? Hi, I am currently reading the Design Principles document, and as far as I understand, what it calls as distributed application is effectively a cold redundancy scheme. Does erlang provide any tools to run e.g., two nodes in a hot standby failover configuration? Thx, Imre _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From mm@REDACTED Thu Feb 12 11:11:31 2009 From: mm@REDACTED (marmll) Date: Thu, 12 Feb 2009 02:11:31 -0800 (PST) Subject: [erlang-questions] https connection Message-ID: <21973154.post@talk.nabble.com> Hi, i have a certfile, a keyfile and password to connect to a https url. How can i connect to the url send a POST Message and wait until i will receive the Response ? Give me please an example ! Thanks for your help -- View this message in context: http://www.nabble.com/https-connection-tp21973154p21973154.html Sent from the Erlang Questions mailing list archive at Nabble.com. From kerr.rainey@REDACTED Thu Feb 12 11:31:02 2009 From: kerr.rainey@REDACTED (Kerr Rainey) Date: Thu, 12 Feb 2009 10:31:02 +0000 Subject: [erlang-questions] Hacked Group Home Page? In-Reply-To: <44984.99456.qm@web35902.mail.mud.yahoo.com> References: <44984.99456.qm@web35902.mail.mud.yahoo.com> Message-ID: <5e6458d0902120231l1633b351qcebe1567aeeff047@mail.gmail.com> 2009/2/11 Andrew Stone : > yep. I see it. I thought it was intentional. ;) Anyone else? It might be useful, to give an indication of location and platform to see if we can narrow down why some people see it and others don't. -- Kerr From oscar@REDACTED Thu Feb 12 11:34:03 2009 From: oscar@REDACTED (=?ISO-8859-1?Q?Oscar_Hellstr=F6m?=) Date: Thu, 12 Feb 2009 10:34:03 +0000 Subject: [erlang-questions] Hacked Group Home Page? In-Reply-To: <5e6458d0902120231l1633b351qcebe1567aeeff047@mail.gmail.com> References: <44984.99456.qm@web35902.mail.mud.yahoo.com> <5e6458d0902120231l1633b351qcebe1567aeeff047@mail.gmail.com> Message-ID: <4993FB1B.2070802@erlang-consulting.com> I can see it as well. Firefox 3.0.5, Suse Linux, using a UK (London) IP. Kerr Rainey wrote: > 2009/2/11 Andrew Stone : > >> yep. I see it. I thought it was intentional. ;) >> > > Anyone else? It might be useful, to give an indication of location and > platform to see if we can narrow down why some people see it and > others don't. > > -- > Kerr > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > Cheers -- Oscar Hellstr?m, oscar@REDACTED Office: +44 20 7655 0337 Mobile: +44 798 45 44 773 Erlang Training and Consulting http://www.erlang-consulting.com/ From xapwing@REDACTED Thu Feb 12 11:35:55 2009 From: xapwing@REDACTED (Arie van Wingerden) Date: Thu, 12 Feb 2009 11:35:55 +0100 Subject: [erlang-questions] Experiments with Programming Languages and Techniques for Telecommunications Applications Message-ID: <5949aaa30902120235l6177f3darf6aba1e24543b00f@mail.gmail.com> Hello, does anybody have a link to this document: "Experiments with Programming Languages and Techniques for Telecommunications Applications" written by Bjarne D?cker, Nabiel Elshiewy, Per Hedeland, Carl Wilhelm Welin and Mike Williams? Thanx, Arie -------------- next part -------------- An HTML attachment was scrubbed... URL: From vychodil.hynek@REDACTED Thu Feb 12 11:37:16 2009 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Thu, 12 Feb 2009 11:37:16 +0100 Subject: [erlang-questions] '--' BIF to be used with caution? In-Reply-To: References: <707529930901130404y5418466bmc375525ef765e615@mail.gmail.com> <6672d0160902040248n4ef30e0cm4e4e0cb718a04349@mail.gmail.com> <707529930902050630l250a8ae4nedbfa71e5d63460e@mail.gmail.com> <13728F3E-6CF3-4B58-B55B-88950019D370@cs.otago.ac.nz> <4d08db370902100044y4ea7c5cbl5e3bb9cefb9caafa@mail.gmail.com> <4d08db370902110058y37db088bwfdab93d579e508d0@mail.gmail.com> Message-ID: <4d08db370902120237p14f61175pe9e128f2258f0312@mail.gmail.com> On Wed, Feb 11, 2009 at 10:31 PM, Richard O'Keefe wrote: > > On 11 Feb 2009, at 9:58 pm, Hynek Vychodil wrote: > >> Nice, and now measure this for 5 element long lists. >> > > Who *cares*? For teeny tiny lists, they are all too fast > to measure reliably, which means that for teeny tiny lists > there is no point in keeping the C code. Hundreds hares are wolf's death. Keep in mind that Erlang systems is supposed to be soft real time in some application. There is latency matter in those applications. If in one task you have to do hundreds of '--' operations even with short lists you need do it in ns or us times and BIF is worth solution there. > > > > Anyone remember UNIX V7 for PDP-11? > The designers had pretty much done "the simplest thing that > could possibly work". Time and again, faced with the need > for a data structure, they had done their calculations and > found that on a PDP-11 the data structures just couldn't > get big enough for linear searches to be a problem. > > Then the code got ported to the VAX, and performance was > *horrible*, because on a VAX the data structures *could* > get that big. > > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try Good Data now for free: www.gooddata.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From kerr.rainey@REDACTED Thu Feb 12 11:40:38 2009 From: kerr.rainey@REDACTED (Kerr Rainey) Date: Thu, 12 Feb 2009 10:40:38 +0000 Subject: [erlang-questions] Hacked Group Home Page? In-Reply-To: <5e6458d0902120231l1633b351qcebe1567aeeff047@mail.gmail.com> References: <44984.99456.qm@web35902.mail.mud.yahoo.com> <5e6458d0902120231l1633b351qcebe1567aeeff047@mail.gmail.com> Message-ID: <5e6458d0902120240w56b784c6w1bab716eb3e9a75@mail.gmail.com> 2009/2/12 Kerr Rainey : > Anyone else? It might be useful, to give an indication of location and > platform to see if we can narrow down why some people see it and > others don't. Obviously it would be useful if people that couldn't see it posted too. Is there supposed to be some other welcome message on the home page? Can anyone see that or is it just blank? -- Kerr From jlprasantha@REDACTED Thu Feb 12 11:41:26 2009 From: jlprasantha@REDACTED (prasantha kumara) Date: Thu, 12 Feb 2009 16:11:26 +0530 Subject: [erlang-questions] emerl_scan:file/1 Message-ID: Hi all, I tried write an erlang programe to read a xml file. i wrote a xml file and the dtd file. When i tried to compile the {ParsResult,Misc}=xmerl_scan:file("motorcycles.xml"). in erl prompt. it gives following errors. ** exception error: no case clause matching {error,enoent} in function xmerl_scan:fetch_DTD/2 in call from xmerl_scan:scan_doctype2/3 in call from xmerl_scan:scan_prolog/3 in call from xmerl_scan:scan_document/2 in call from xmerl_scan:file/2 Can anybody tell me the reason of that exception? thanks prasantha -------------- next part -------------- An HTML attachment was scrubbed... URL: From kunthar@REDACTED Thu Feb 12 12:02:25 2009 From: kunthar@REDACTED (Kunthar) Date: Thu, 12 Feb 2009 13:02:25 +0200 Subject: [erlang-questions] Hacked Group Home Page? In-Reply-To: <9a09ca9a0902120250qe12b2d2ga4ec116140425f75@mail.gmail.com> References: <44984.99456.qm@web35902.mail.mud.yahoo.com> <5e6458d0902120231l1633b351qcebe1567aeeff047@mail.gmail.com> <5e6458d0902120240w56b784c6w1bab716eb3e9a75@mail.gmail.com> <9a09ca9a0902120250qe12b2d2ga4ec116140425f75@mail.gmail.com> Message-ID: <9a09ca9a0902120302m43da4d4q50ac68f4c0dc4e5a@mail.gmail.com> It would be useful to follow a way like mochiweb guys done; "I clicked edit on the welcome message and then I clicked save. I also turned off editing pages and uploading files for non-managers. I still never saw anything weird myself." Ads are still there for now. From bertil.karlsson@REDACTED Thu Feb 12 12:19:54 2009 From: bertil.karlsson@REDACTED (Bertil Karlsson) Date: Thu, 12 Feb 2009 12:19:54 +0100 Subject: [erlang-questions] emerl_scan:file/1 In-Reply-To: References: Message-ID: <499405DA.1000200@ericsson.com> If the file is from the xmerl docs you need a motorcycles.dtd file as well, also available in the docs I guess. /Bertil prasantha kumara wrote: > Hi all, > I tried write an erlang programe to read a xml file. i wrote a xml > file and the dtd file. > When i tried to compile the > {ParsResult,Misc}=xmerl_scan:file("motorcycles.xml"). > in erl prompt. it gives following errors. > ** exception error: no case clause matching {error,enoent} > in function xmerl_scan:fetch_DTD/2 > in call from xmerl_scan:scan_doctype2/3 > in call from xmerl_scan:scan_prolog/3 > in call from xmerl_scan:scan_document/2 > in call from xmerl_scan:file/2 > > Can anybody tell me the reason of that exception? > thanks > prasantha > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From ville.silventoinen@REDACTED Thu Feb 12 12:35:20 2009 From: ville.silventoinen@REDACTED (Ville Silventoinen) Date: Thu, 12 Feb 2009 11:35:20 +0000 Subject: [erlang-questions] Newbie questions about file module Message-ID: <4f0695950902120335u6f5f994cu87ca05dcf894276a@mail.gmail.com> Hi, I've written a small Erlang program that copies directory trees. I cannot figure out how to set the owner (Unix UID and GID) for symbolic links, because file:write_file_info/2 modifies the target file, not the symlink. Unix command chown has -h option for this purpose. Is there any way of doing this in Erlang? Why isn't there file:write_link_info/2? Perhaps I've missed something, is there a way to copy the symlink as it is? (I do use read_link and read_link_info.) My second question relates to eprof. I analysed the execution of my program (copying /usr/local/lib to NFS directory). The eprof:total_analyse/0 results are below ("mirror11" is my module). It shows that 82% of the time goes in file_name_1/1, which "Generates a flat file name from a deep list of atoms and characters (integers)". Does this really mean that 82% of time is spent here, instead of doing disk I/O? I would have expected file:copy/2 to be on the top of the list. (There are 481 directories and 6744 files in my /usr/local/lib.) Any comments would be appreciated! Thanks, Ville 7> eprof:total_analyse(). FUNCTION CALLS TIME file:file_name_1/1 3086234 82 % gen:do_call/4 29869 2 % file:check_args/1 93941 2 % gen:wait_resp_mon/3 29869 1 % mirror11:get_file_info/2 21195 1 % file:check_and_call/2 29869 1 % file:call/2 29869 1 % gen:call/4 29869 1 % file:file_name/1 36615 1 % gen_server:call/3 29869 1 % mirror11:do_file/4 6744 1 % erlang:'++'/2 21680 0 % erlang:monitor/2 29869 0 % file:read_link_info/1 14451 0 % file:copy_int/3 13488 0 % erlang:whereis/1 29869 0 % erlang:demonitor/1 29869 0 % erlang:list_to_tuple/1 29869 0 % erlang:list_to_binary/1 21195 0 % mirror11:by_type/6 7707 0 % lists:foreach/2 7708 0 % ets:lookup/2 21195 0 % mirror11:log_debug/2 6748 0 % file:write_file_info/2 7225 0 % ets:insert/2 7707 0 % mirror11:do_dir/3 481 0 % mirror11:'-do_dir/3-fun-5-'/4 6744 0 % file:copy/2 6744 0 % mirror11:start_dir_workers/5 963 0 % ets:delete/1 481 0 % file:list_dir/1 962 0 % mirror11:rendezvous/1 963 0 % erlang:apply/2 481 0 % erlang:spawn/3 481 0 % file:make_dir/1 481 0 % ets:new/2 481 0 % erlang:spawn/1 481 0 % mirror11:'-start_dir_workers/5-fun-0-'/3 481 0 % mirror11:do_symlink/4 2 0 % mirror11:master_loop/0 1 0 % file:read_link/1 4 0 % file:make_symlink/2 2 0 % mirror11:'-do_dir/3-fun-6-'/4 2 0 % Total time: 51.30 Measurement overhead: 13.48 ok -------------- next part -------------- An HTML attachment was scrubbed... URL: From hackers.are.rockstars@REDACTED Thu Feb 12 12:40:27 2009 From: hackers.are.rockstars@REDACTED (Mauro Pompilio) Date: Thu, 12 Feb 2009 12:40:27 +0100 Subject: [erlang-questions] Hacked Group Home Page? In-Reply-To: <5e6458d0902120231l1633b351qcebe1567aeeff047@mail.gmail.com> References: <44984.99456.qm@web35902.mail.mud.yahoo.com> <5e6458d0902120231l1633b351qcebe1567aeeff047@mail.gmail.com> Message-ID: <80519c2a0902120340l426c31c1if5eacb931d702510@mail.gmail.com> On Thu, Feb 12, 2009 at 11:31 AM, Kerr Rainey wrote: > 2009/2/11 Andrew Stone : > > yep. I see it. I thought it was intentional. ;) > > Anyone else? It might be useful, to give an indication of location and > platform to see if we can narrow down why some people see it and > others don't. > > -- > Kerr > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > OMFG! Erlang, the hottest language ever! xD As seen on FF 3.0.6 - Mac OSX - Barcelona Best, Mauro. -- Vi, Vi, Vi. The Editor of the Beast! http://www.vim.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From jlprasantha@REDACTED Thu Feb 12 12:47:59 2009 From: jlprasantha@REDACTED (prasantha kumara) Date: Thu, 12 Feb 2009 17:17:59 +0530 Subject: [erlang-questions] merl_scan:file/1 Message-ID: Hi all, I tried write an erlang programe to read a xml file. i wrote a xml file and the dtd file. When i tried to compile the {ParsResult,Misc}=xmerl_scan: file("motorcycles.xml"). in erl prompt. it gives following errors. ** exception error: no case clause matching {error,enoent} in function xmerl_scan:fetch_DTD/2 in call from xmerl_scan:scan_doctype2/3 in call from xmerl_scan:scan_prolog/3 in call from xmerl_scan:scan_document/2 in call from xmerl_scan:file/2 Can anybody tell me the reason of that exception? thanks prasantha -------------- next part -------------- An HTML attachment was scrubbed... URL: From twoggle@REDACTED Thu Feb 12 12:50:08 2009 From: twoggle@REDACTED (Tim Fletcher) Date: Thu, 12 Feb 2009 03:50:08 -0800 (PST) Subject: [erlang-questions] Hacked Group Home Page? In-Reply-To: <5e6458d0902120231l1633b351qcebe1567aeeff047@mail.gmail.com> References: <44984.99456.qm@web35902.mail.mud.yahoo.com> <5e6458d0902120231l1633b351qcebe1567aeeff047@mail.gmail.com> Message-ID: <5fe629c6-3b90-4108-9fd5-5d5d23ad59c7@d32g2000yqe.googlegroups.com> > Anyone else? It might be useful, to give an indication of location and > platform to see if we can narrow down why some people see it and > others don't. UK, Mac (Safari and Firefox). It's been there for quite a while, on and off. From cguimaraes.br@REDACTED Thu Feb 12 13:11:04 2009 From: cguimaraes.br@REDACTED (Christian Guimaraes) Date: Thu, 12 Feb 2009 12:11:04 +0000 Subject: [erlang-questions] Hacked Group Home Page? In-Reply-To: <5fe629c6-3b90-4108-9fd5-5d5d23ad59c7@d32g2000yqe.googlegroups.com> References: <44984.99456.qm@web35902.mail.mud.yahoo.com> <5e6458d0902120231l1633b351qcebe1567aeeff047@mail.gmail.com> <5fe629c6-3b90-4108-9fd5-5d5d23ad59c7@d32g2000yqe.googlegroups.com> Message-ID: So... Erlang girls are too hot!!! I love this language... ;) Portugal, Linux, FireFox Cheers. Christian. On Thu, Feb 12, 2009 at 11:50 AM, Tim Fletcher wrote: > > Anyone else? It might be useful, to give an indication of location and > > platform to see if we can narrow down why some people see it and > > others don't. > > UK, Mac (Safari and Firefox). > > It's been there for quite a while, on and off. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rvirding@REDACTED Thu Feb 12 13:15:53 2009 From: rvirding@REDACTED (Robert Virding) Date: Thu, 12 Feb 2009 13:15:53 +0100 Subject: [erlang-questions] Hacked Group Home Page? In-Reply-To: <5e6458d0902120231l1633b351qcebe1567aeeff047@mail.gmail.com> References: <44984.99456.qm@web35902.mail.mud.yahoo.com> <5e6458d0902120231l1633b351qcebe1567aeeff047@mail.gmail.com> Message-ID: <3dbc6d1c0902120415xb985ddic15e2db19d520b3d@mail.gmail.com> I see it Sweden, Stockholm, both Firefox 3.0.6 and IExplorer 7.0 Robert 2009/2/12 Kerr Rainey > 2009/2/11 Andrew Stone : > > yep. I see it. I thought it was intentional. ;) > > Anyone else? It might be useful, to give an indication of location and > platform to see if we can narrow down why some people see it and > others don't. > > -- > Kerr > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam@REDACTED Thu Feb 12 13:19:29 2009 From: adam@REDACTED (Adam Lindberg) Date: Thu, 12 Feb 2009 12:19:29 +0000 (GMT) Subject: [erlang-questions] Hacked Group Home Page? In-Reply-To: <3dbc6d1c0902120415xb985ddic15e2db19d520b3d@mail.gmail.com> Message-ID: <15938288.14781234441169264.JavaMail.root@zimbra> People who're not seeing it could check if they have any ad blockers enabled. I doubt people would see different things depending on where they browse from. (I see it too, with adblock plus enabled, on Firefox 2.0.0.8 on Suse 10.1 from Stockholm). Cheers, Adam ----- "Robert Virding" wrote: > I see it > > Sweden, Stockholm, both Firefox 3.0.6 and IExplorer 7.0 > > Robert > > 2009/2/12 Kerr Rainey > > > 2009/2/11 Andrew Stone : > > > yep. I see it. I thought it was intentional. ;) > > > > Anyone else? It might be useful, to give an indication of location > and > > platform to see if we can narrow down why some people see it and > > others don't. > > > > -- > > Kerr > > _______________________________________________ > > 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 zambal@REDACTED Thu Feb 12 14:06:38 2009 From: zambal@REDACTED (zambal) Date: Thu, 12 Feb 2009 05:06:38 -0800 (PST) Subject: [erlang-questions] merl_scan:file/1 In-Reply-To: References: Message-ID: enoent usually means that the file could not be found (or is being used by another process) From bbmaj7@REDACTED Thu Feb 12 13:08:23 2009 From: bbmaj7@REDACTED (Richard Andrews) Date: Thu, 12 Feb 2009 04:08:23 -0800 (PST) Subject: [erlang-questions] https connection References: <21973154.post@talk.nabble.com> Message-ID: <93483.53079.qm@web65513.mail.ac4.yahoo.com> > i have a certfile, a keyfile and password to connect to a https url. How can > i connect to the url send a POST Message and wait until i will receive the > Response ? You want to be an HTTPS client right? I've never done this personally but I did happen to read one way to do it in the man pages recently. See man 3 http (erlang module). The http:request function takes ssl related parameters as well as URL. Looks like you specify "https://" at the start of the URL string. Make Yahoo!7 your homepage and win a trip to the Quiksilver Pro. Find out more From gijsbert_de_haan@REDACTED Thu Feb 12 13:49:41 2009 From: gijsbert_de_haan@REDACTED (Gijsbert de Haan) Date: Thu, 12 Feb 2009 13:49:41 +0100 Subject: [erlang-questions] Hacked Group Home Page? In-Reply-To: <15938288.14781234441169264.JavaMail.root@zimbra> References: <15938288.14781234441169264.JavaMail.root@zimbra> Message-ID: <1234442981.1934.1299981211@webmail.messagingengine.com> I see it too: Amsterdam, Firefox 3.0.6, MacOS, AdBlock Plus. The group front page http://groups.google.com/group/erlang-questions has one file (at the bottom of the page) named "brunette cutie ...". Perhaps removing that one will make them go away... On Thu, 12 Feb 2009 12:19:29 +0000 (GMT), "Adam Lindberg" said: > People who're not seeing it could check if they have any ad blockers > enabled. > > I doubt people would see different things depending on where they browse > from. > > (I see it too, with adblock plus enabled, on Firefox 2.0.0.8 on Suse 10.1 > from Stockholm). > > Cheers, > Adam > > ----- "Robert Virding" wrote: > > > I see it > > > > Sweden, Stockholm, both Firefox 3.0.6 and IExplorer 7.0 > > > > Robert > > > > 2009/2/12 Kerr Rainey > > > > > 2009/2/11 Andrew Stone : > > > > yep. I see it. I thought it was intentional. ;) > > > > > > Anyone else? It might be useful, to give an indication of location > > and > > > platform to see if we can narrow down why some people see it and > > > others don't. > > > > > > -- > > > Kerr > > > _______________________________________________ > > > 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 vychodil.hynek@REDACTED Thu Feb 12 15:26:19 2009 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Thu, 12 Feb 2009 15:26:19 +0100 Subject: [erlang-questions] Hacked Group Home Page? In-Reply-To: <1234442981.1934.1299981211@webmail.messagingengine.com> References: <15938288.14781234441169264.JavaMail.root@zimbra> <1234442981.1934.1299981211@webmail.messagingengine.com> Message-ID: <4d08db370902120626vf97fcc2iea86a25590ae38cd@mail.gmail.com> After some investigation It seems like hackers attack. They done some bug because links can't be followed. It should pointing to http:[slash][slash]blow-jobsbolsterkostandinsaintjohns2514.googlegroups.com [slash]web[slash]?gda=l43-TTIAAAC4cNb0bwxsJdLC1niPuKI_-DiiGCeWnJ4-4tmsSexb31Xi7dpriIAjJhAipsb2do-CHqjxxwsG8_oKG53kozMh Pages linked from there are fakes and seems not pointing to adult content but to hackers pages which contain fake ActiveX video players which should enforce dumb users to launch .exe Trojan horse. May be spam bot or such. On Thu, Feb 12, 2009 at 1:49 PM, Gijsbert de Haan < gijsbert_de_haan@REDACTED> wrote: > I see it too: Amsterdam, Firefox 3.0.6, MacOS, AdBlock Plus. > > The group front page http://groups.google.com/group/erlang-questions has > one file (at the bottom of the page) named "brunette cutie ...". Perhaps > removing that one will make them go away... > > On Thu, 12 Feb 2009 12:19:29 +0000 (GMT), "Adam Lindberg" > said: > > People who're not seeing it could check if they have any ad blockers > > enabled. > > > > I doubt people would see different things depending on where they browse > > from. > > > > (I see it too, with adblock plus enabled, on Firefox 2.0.0.8 on Suse 10.1 > > from Stockholm). > > > > Cheers, > > Adam > > > > ----- "Robert Virding" wrote: > > > > > I see it > > > > > > Sweden, Stockholm, both Firefox 3.0.6 and IExplorer 7.0 > > > > > > Robert > > > > > > 2009/2/12 Kerr Rainey > > > > > > > 2009/2/11 Andrew Stone : > > > > > yep. I see it. I thought it was intentional. ;) > > > > > > > > Anyone else? It might be useful, to give an indication of location > > > and > > > > platform to see if we can narrow down why some people see it and > > > > others don't. > > > > > > > > -- > > > > Kerr > > > > _______________________________________________ > > > > 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 > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try Good Data now for free: www.gooddata.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From lk@REDACTED Thu Feb 12 16:10:07 2009 From: lk@REDACTED (=?iso-8859-1?Q?Ladv=E1nszky_K=E1roly?=) Date: Thu, 12 Feb 2009 16:10:07 +0100 Subject: [erlang-questions] Irregular list Message-ID: Just getting acquainted with this wonderful system, I?ve run into the following issue: The shell seems to accept a structure like this: [a | b]. is_list([a | b]) returns true but length([a | b]) raises an exception. Is it like an ?open list? found in some programming languages? Any help would be appreciated, LKaroly -------------- next part -------------- An HTML attachment was scrubbed... URL: From freza@REDACTED Thu Feb 12 16:28:01 2009 From: freza@REDACTED (Jachym Holecek) Date: Thu, 12 Feb 2009 16:28:01 +0100 Subject: [erlang-questions] Irregular list In-Reply-To: References: Message-ID: <20090212152800.GA3892@hanele> # Ladv?nszky K?roly 2009-02-12: > Just getting acquainted with this wonderful system, I?ve run into the > following issue: > > The shell seems to accept a structure like this: [a | b]. > > is_list([a | b]) returns true but length([a | b]) raises an exception. > > Is it like an ?open list? found in some programming languages? What might be confusing here is that 'is_list()' is actually a slight misnomer, [_ | _] is really just a pair (aka "cons cell") regardless of what values are held as head + tail. The length() function expects a "proper list", which is [] or a pair such that its second component is a proper list. I'm not familiar with the term "open list", but hope the above helps. -- Jachym From erlang@REDACTED Thu Feb 12 16:30:18 2009 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 12 Feb 2009 16:30:18 +0100 Subject: [erlang-questions] Irregular list In-Reply-To: References: Message-ID: <9b08084c0902120730s1dea7423nbc9a5a39897e88b2@mail.gmail.com> This is a "improper list". A list is really just a cons cell (think lisp, or think "liknked list" in C) - internally it's a pair of tagged values - the first value in the pair is the head of the list. The second value is the tail of the list, an so should point to a list or nil. If the tail points to nil or a list then it is a proper list, otherwise it's an improper list. Most library functions will behave strangely when presented with improper lists - so don't use them! /Joe Armstrong 2009/2/12 Ladv?nszky K?roly : > Just getting acquainted with this wonderful system, I?ve run into the > following issue: > > > > The shell seems to accept a structure like this: [a | b]. > > > > is_list([a | b]) returns true but length([a | b]) raises an exception. > > > > Is it like an ?open list? found in some programming languages? > > > > > > > > Any help would be appreciated, > > > > LKaroly > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From jongretar@REDACTED Thu Feb 12 16:37:25 2009 From: jongretar@REDACTED (Jon Gretar Borgthorsson) Date: Thu, 12 Feb 2009 15:37:25 +0000 Subject: [erlang-questions] Hacked Group Home Page? In-Reply-To: <4d08db370902120626vf97fcc2iea86a25590ae38cd@mail.gmail.com> References: <15938288.14781234441169264.JavaMail.root@zimbra> <1234442981.1934.1299981211@webmail.messagingengine.com> <4d08db370902120626vf97fcc2iea86a25590ae38cd@mail.gmail.com> Message-ID: <4ecde87b0902120737o295bedb7m93f11a1dd981c02f@mail.gmail.com> Umm...Why this whole discussion about this? Why doesn't someone with manager access simply remove this? And of story. 2009/2/12 Hynek Vychodil > After some investigation It seems like hackers attack. They done some bug > because links can't be followed. It should pointing to > > http:[slash][slash] > blow-jobsbolsterkostandinsaintjohns2514.googlegroups.com > [slash]web[slash]?gda=l43-TTIAAAC4cNb0bwxsJdLC1niPuKI_-DiiGCeWnJ4-4tmsSexb31Xi7dpriIAjJhAipsb2do-CHqjxxwsG8_oKG53kozMh > > Pages linked from there are fakes and seems not pointing to adult content > but to hackers pages which contain fake ActiveX video players which should > enforce dumb users to launch .exe Trojan horse. May be spam bot or such. > > > On Thu, Feb 12, 2009 at 1:49 PM, Gijsbert de Haan < > gijsbert_de_haan@REDACTED> wrote: > >> I see it too: Amsterdam, Firefox 3.0.6, MacOS, AdBlock Plus. >> >> The group front page http://groups.google.com/group/erlang-questions has >> one file (at the bottom of the page) named "brunette cutie ...". Perhaps >> removing that one will make them go away... >> >> On Thu, 12 Feb 2009 12:19:29 +0000 (GMT), "Adam Lindberg" >> said: >> > People who're not seeing it could check if they have any ad blockers >> > enabled. >> > >> > I doubt people would see different things depending on where they browse >> > from. >> > >> > (I see it too, with adblock plus enabled, on Firefox 2.0.0.8 on Suse >> 10.1 >> > from Stockholm). >> > >> > Cheers, >> > Adam >> > >> > ----- "Robert Virding" wrote: >> > >> > > I see it >> > > >> > > Sweden, Stockholm, both Firefox 3.0.6 and IExplorer 7.0 >> > > >> > > Robert >> > > >> > > 2009/2/12 Kerr Rainey >> > > >> > > > 2009/2/11 Andrew Stone : >> > > > > yep. I see it. I thought it was intentional. ;) >> > > > >> > > > Anyone else? It might be useful, to give an indication of location >> > > and >> > > > platform to see if we can narrow down why some people see it and >> > > > others don't. >> > > > >> > > > -- >> > > > Kerr >> > > > _______________________________________________ >> > > > 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 >> > > > > -- > --Hynek (Pichi) Vychodil > > Analyze your data in minutes. Share your insights instantly. Thrill your > boss. Be a data hero! > Try Good Data now for free: www.gooddata.com > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mikpe@REDACTED Thu Feb 12 16:38:03 2009 From: mikpe@REDACTED (Mikael Pettersson) Date: Thu, 12 Feb 2009 16:38:03 +0100 Subject: [erlang-questions] Irregular list In-Reply-To: References: Message-ID: <18836.16987.946339.166095@harpo.it.uu.se> Ladv?nszky K?roly writes: > Just getting acquainted with this wonderful system, I?ve run into the > following issue: > > > > The shell seems to accept a structure like this: [a | b]. > > > > is_list([a | b]) returns true but length([a | b]) raises an exception. is_list/1 only inspects the top-most node of the structure and tests if it's a "list cell" or not. It's poorly named and corresponds to testing for a "cons" in Lisp dialects. > Is it like an ?open list? found in some programming languages? Wouldn't know. Never heard of that one. From erlang@REDACTED Thu Feb 12 16:53:51 2009 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 12 Feb 2009 16:53:51 +0100 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <4535f6cd0902111058x32bcaf64r8536c89ad9546cc1@mail.gmail.com> References: <4535f6cd0902110846w1180516u7dfbf83ce8c87970@mail.gmail.com> <3EC78F9B-5873-4E10-9A1E-A38649F96B0F@uninet.ee> <4535f6cd0902111058x32bcaf64r8536c89ad9546cc1@mail.gmail.com> Message-ID: <9b08084c0902120753p4785d045l366c076330a3936f@mail.gmail.com> 2009/2/11 Yang Zhang : > Thanks all for replying. > > Just think erlang's database and distribute feature are so great so it is > the best way I can think to make a distribute crawler and web page > analyzor(what I am doing), then found it doesn't have strong built in web > library like urlencode/htmlentities for me to process url and html. And it > builtin httpclient even ibrowse doesn't support bind IP when initial http > request. > > Never mind a function is complex or easy, what in my mind is erlang didn't > have it so it? is incomplete. But it does - I leave it to you as an exercise in Googling to find such routines. I read your initial mail and did a Quick google search and quickly found *exactly* what you wanted - at least I think it was what you wanted. No language serves up library code to you on a plate with no effort involved. I've recently written a load of javascript - here there is a plethora of library code a very quick Google searches reveals what I want. After a while I found it was better to learn javascript *properly* than waste time looking for library functions. Even if you find a library function it is unlikely that it will do *exactly* what you want - so you have to read the code and fix it in any case. At the end of the day most good programmers end up writing the code they want because it is *quicker* than searching in vain for library code that may or may not work and may of may not do what they want. Even if they find the code they cannot be sure that it is 100% correct. This is just life - even if you find library A that has what you want, library A might depend upon B. And C which you also want might also might depend upon B (but perhaps, *a different version of B*) - this happens so often that after about a year it becomes completely impossible to recompile the latest version of some code in your favorite operating system because all the dependencies are buggered up. The only known way of connecting things in a future proof way is to isolate them through message passing interfaces with defined protocols. If you find the fabelled "web language" let us know - I have never seen anything remotely usable - every single framework and library I have tried is deeply flawed in one way or another. Some things are easy, other things hard. In Erlang making a fault-tolerant fail-over database is not impossibly difficuly - writing urldecode might be a pain - but as they say "no pain no gain" If we take (for example PHP) I imagine writing urldecode is a no-brainer - but writing a fault-tolerent database with hot standby might just be on the tricky side. Have a nice day /Joe Armstrong > No one like to write the simple code again and > again. And I'm not sure I could write it right one the first time i wrote > it. Glad see it has another library to compensate the missing ones so > everything is ok now. > > Thanks. I will check these links. > > On Thu, Feb 12, 2009 at 2:27 AM, Taavi Talvik wrote: >> >> On Feb 11, 2009, at 6:46 PM, Yang Zhang wrote: >> >>> I saw eralng has its own webserver and distribute database. These >>> looks quite good. >>> But after I wrote some web programs, I found erlang even doesn't have >>> a strong enough htmlentities or urlencode , urldecode function. What's >>> the problem here? >>> Isnot erlang a web language? >> >> htmlentities, urlencode/decode are easy part. Supplied by >> any erlang web frameworks. >> >> It starts to be interesting there: >> >> Web chatroom in 57 lines: >> http://nitrogenproject.com/web/samples/comet2 >> >> Million connections: >> >> http://www.metabrew.com/article/a-million-user-comet-application-with-mochiweb-part-1/ >> >> putting data into cloud: >> http://couchdb.apache.org/ >> http://aws.amazon.com/simpledb/ >> >> wikipedia on on fraction of hardware: >> http://www.onscale.de/scalaris.html >> http://www.onscale.de/Schuett_Google_Scalability.pdf >> >> best regards, >> taavi > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From erlang@REDACTED Thu Feb 12 16:56:49 2009 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 12 Feb 2009 16:56:49 +0100 Subject: [erlang-questions] Human readable errors in lists module In-Reply-To: <8209f740902110829tdebfdf2t23b6007148d1299f@mail.gmail.com> References: <31309437.10521234279023327.JavaMail.root@zimbra> <23377730.10541234279344155.JavaMail.root@zimbra> <9b08084c0902101346r166b4b77l14e68ac0dc2e6b8b@mail.gmail.com> <8209f740902110829tdebfdf2t23b6007148d1299f@mail.gmail.com> Message-ID: <9b08084c0902120756v69b11277oa2d0cab7839331aa@mail.gmail.com> Absolutely, "the system should act in a manner so as to cause the least possible astonishment to the user" It's this in the programming rules? /Joe Armstrong On Wed, Feb 11, 2009 at 5:29 PM, Ulf Wiger wrote: > I think there exists a refined version of this philosophy, but > zipwith() is perhaps not the best example to illustrate it. I agree > that 'let it crash' is the first principle, but the owner of the > interface has a responsibility to try to make the API behave in a > manner that doesn't confound the user. I'd be upset if, e.g., > mnesia:activity() exited with function_clause in mnesia_trans, > mnesia_dumper etc, as a result of mistakes in using the interface. > Even crashes must give the user some reasonable indication of who's at > fault. > > BR, > Ulf W > > 2009/2/11, Kenneth Lundin : >> Hi, >> >> As responsible for the Erlang/OTP team at Ericsson I can just say that >> we agree with Joe in this matter. >> We have no intention to add human readable errors to the list module >> or other library modules in standard lib. >> >> As a matter of fact I think a crash with function clause is quite >> clear because it informs you about >> that a named function did not have any clause which matched the >> arguments you called it with. And the arguments >> are also available in the crash info. >> As the source code and the documentation for lists in this case is >> available it should be possible to understand why the arguments was >> not accepted. >> >> A beginner might not have so easy to understand whats wrong but after >> just a few occurences of errors like that it should be >> quite obvious. >> >> /Kenneth Erlang/OTP Ericsson >> >> On Tue, Feb 10, 2009 at 10:46 PM, Joe Armstrong wrote: >>> On Tue, Feb 10, 2009 at 4:22 PM, Adam Lindberg >>> wrote: >>>> Hi, >>>> >>>> Is there any reason that for example lists:zipwith/3 returns a function >>>> clause instead of a human readable error when the lists are of different >>>> length? >>> >>> Yes >>> >>> Everything has a cost - if we applied this principle rigidly to all >>> functions in >>> the system then every function in the entire system would be extended with >>> additional code. This make the code more difficult to read, and makes the >>> program larger (think cache hits). >>> >>> Suppose we have a function that maps a to 1 and b to 2, I'd write it like >>> this: >>> >>> f(a) -> 1; >>> f(b) -> 2. >>> >>> should I then add an additional clause to warn for bad arguments? >>> >>> f(a) -> 1; >>> f(b) -> 2; >>> f(_) -> error('arg is not a or b'). >>> >>> This adds nothing to the clarity of the code since the original expresses >>> exact >>> the intention of the program *and nothing else* >>> >>> Programs that are cluttered with additional error messages are difficult >>> to read >>> (which increases the chances of an error) an less efficient >>> (everything has a cost) >>> >>>> It might seem obvious at first but the reason I'm asking is because a >>>> colleague of >mine just spent a long time debugging code with used >>>> list:zipwith/3 and it threw >this error. What he did at first was to >>>> check that all arguments to lists:zipwith/3 >>>> > was not zero (this is what the function clause error indicated). >>> >>> *everybody* spends a long time figuring out what when wrong the first time >>> they get an error of a particular type - then they learn - when you've >>> seen >>> these errors a few times you'll find that you can find the error very >>> quickly >>> >>> The fact that erlang crashes at the first error and prints something >>> really >>> aids debugging ... >>>> >>>> lists:zipwith/3 could have been implemented as below (or something >>>> similar): >>>> >>>> zipwith(F, [X | Xs], [Y | Ys]) -> [F(X, Y) | zipwith(F, Xs, Ys)]; >>>> zipwith(F, [], []) when is_function(F, 2) -> []. >>>> zipwith(F, [], Ys) -> error(lists_of_different_length). %% Just a >>>> proposal, insert >>>> zipwith(F, Xs, []) -> error(lists_of_different_length). %% preferred >>>> error mechanism here. >>>> >>>> The function clause, noting the arguments as [#Fun..., [], [5,6,7,...]], >>>> is kind of misleading since it happens inside the lists:zipwith/3 >>>> function. >>>> >>>> I can see the purists' argument here "that it is really a function >>>> clause" but I also see the pragmatist argument "that it is much easier to >>>> debug." >>> >>> Nw let's look at the error message - here's an experiment >>> >>> 1> lists:zipwith(fun(X,Y) -> X + Y end, [1,2,3],[4,5]). >>> ** exception error: no function clause matching >>> ? ? ? ? ? ? ? ? ? ?lists:zipwith(#Fun,[3],[]) >>> ? ? in function ?lists:zipwith/3 >>> >>> To the experienced eye the error is clear >>> >>> zipwith(Fun, [3], []) doesn't match any of the clauses defining zipwith >>> >>> Show me the code Luke ... (just run less on >>> /usr/local/lib/erlang/stdlib ... ish) >>> >>> zipwith(F, [X | Xs], [Y | Ys]) -> [F(X, Y) | zipwith(F, Xs, Ys)]; >>> zipwith(F, [], []) when is_function(F, 2) -> []. >>> >>> This is two lines of code. >>> >>> So zipwith(Fun, [3], []) doesn't match one of these two lines of code ... >>> >>> this is actually *shorter* than the documentation (a lot shorter) >>> >>> what does the documentation say? >>> >>> ?zipwith(Combine, List1, List2) -> List3 >>> ? ? ? Types ?Combine = fun(X, Y) -> T >>> ? ? ? List1 = [X] >>> ? ? ? List2 = [Y] >>> ? ? ? List3 = [T] >>> ? ? ? X = Y = T = term() >>> ? ? ?Combine the elements of two lists of equal length into one list. >>> >>> ************** >>> What I have noticed teaching Erlang is that beginners make almost exactly >>> the same mistakes as experienced users - the difference is in the time >>> it takes them to debug an error. >>> >>> The first time is *always* slow - then you learn. >>> >>> (this is universally true - while I can fix erlang programs pretty quickly >>> I can stare at simple javascript errors for ages before twigging what >>> went wrong) >>> >>> But there's a more subtle problem. >>> >>> Let's try your suggestion. (I put your zipwith in a module test4) >>> >>> try4:zipwith(fun(X,Y) -> X + Y end, [1,2,3],[4,5]). >>> ** exception error: lists_of_different_length >>> ? ? in function ?try4:zipwith/3 >>> ? ? in call from try4:zipwith/3 >>> >>> It works - great - we think ... but what about this? >>> >>> try4:zipwith(fun(X,Y) -> X + Y end, {1,2},[4,5]). >>> ** exception error: no function clause matching >>> ? ? ? ? ? ? ? ? ? ?try4:zipwith(#Fun,{1,2},[4,5]) >>> >>> Now what? Opps the guards were wrong - need to add a few >>> when is_list(..) guards. Or do we want an error message that says >>> error,arg1 should not be a tuple .... >>> >>> There are a very large number of ways we can supply incorrect arguments >>> and we can't program all of them. >>> >>> So what do we do - we only write patterns that match the desired cases >>> *and nothing else* - this is part of the erlang "let it crash" philosophy. >>> >>> In erlang we don't do defensive programming - (or rather we do do it using >>> patterns) >>> >>> Best >>> >>> /Joe Armstrong >>> >>> >>>> Cheers, >>>> Adam >>>> _______________________________________________ >>>> 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 kerr.rainey@REDACTED Thu Feb 12 17:40:55 2009 From: kerr.rainey@REDACTED (Kerr Rainey) Date: Thu, 12 Feb 2009 16:40:55 +0000 Subject: [erlang-questions] Hacked Group Home Page? In-Reply-To: <4ecde87b0902120737o295bedb7m93f11a1dd981c02f@mail.gmail.com> References: <15938288.14781234441169264.JavaMail.root@zimbra> <1234442981.1934.1299981211@webmail.messagingengine.com> <4d08db370902120626vf97fcc2iea86a25590ae38cd@mail.gmail.com> <4ecde87b0902120737o295bedb7m93f11a1dd981c02f@mail.gmail.com> Message-ID: <5e6458d0902120840x42614ac9l4a7e45bc90cb368@mail.gmail.com> 2009/2/12 Jon Gretar Borgthorsson : > Umm... > Why this whole discussion about this? Why doesn't someone with manager > access simply remove this? And of story. In the first instance, just trying to establish where it was coming from. Now we just need it dealt with. So who has manager access to the Google Group to fix it? On a side, can the group not be set up to add itself into the reply-to field? Doh! -- Kerr From exta7@REDACTED Thu Feb 12 17:43:53 2009 From: exta7@REDACTED (Zvi) Date: Thu, 12 Feb 2009 08:43:53 -0800 (PST) Subject: [erlang-questions] Irregular list In-Reply-To: References: Message-ID: <21979837.post@talk.nabble.com> technicaly [a|b] is not a proper list, it's what called in LISP a "cons-cell" (a . b) in proper list cdr (i.e. tail) field of last element must be nil (or [] ) in Erlang. Ladv?nszky K?roly-2 wrote: > > Just getting acquainted with this wonderful system, I?ve run into the > following issue: > > > > The shell seems to accept a structure like this: [a | b]. > > > > is_list([a | b]) returns true but length([a | b]) raises an exception. > > > > Is it like an ?open list? found in some programming languages? > > > > > > > > Any help would be appreciated, > > > > LKaroly > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- View this message in context: http://www.nabble.com/Irregular-list-tp21977982p21979837.html Sent from the Erlang Questions mailing list archive at Nabble.com. From lcastro@REDACTED Thu Feb 12 15:45:58 2009 From: lcastro@REDACTED (Laura M. Castro Souto) Date: Thu, 12 Feb 2009 15:45:58 +0100 Subject: [erlang-questions] Hacked Group Home Page? In-Reply-To: References: <5fe629c6-3b90-4108-9fd5-5d5d23ad59c7@d32g2000yqe.googlegroups.com> Message-ID: <200902121545.58313.lcastro@udc.es> On Thursday, 12 de Febrero de 2009 Christian Guimaraes wrote: > So... Erlang girls are too hot!!! I love this language... ;) Of course we are, you didn't know yet? ;o) Spain, Linux, both Firefox (Iceweasel) and Konqueror. -- Laura M. Castro MADS Group - Computer Science Department University of A Corunna http://www.madsgroup.org/staff/laura/index_en.html From exta7@REDACTED Thu Feb 12 17:57:13 2009 From: exta7@REDACTED (Zvi) Date: Thu, 12 Feb 2009 08:57:13 -0800 (PST) Subject: [erlang-questions] Irregular list In-Reply-To: <20090212152800.GA3892@hanele> References: <20090212152800.GA3892@hanele> Message-ID: <21980109.post@talk.nabble.com> too bad there is no single pattern to test for list, instead of [] and [_|_] . To test for proper list: is_proper_list([_|T]) -> is_proper_list(T); is_proper_list([]) -> true; is_proper_list(_) -> false. or from shell: 5> F = fun([_|T],F) -> F(T,F); ([],_) -> true; (_,_) -> false end. #Fun 6> 7> F([a|b],F). false 8> F([a,b],F). true 9> F([],F). true 10> F([a,b|c],F). false 11> F([a,b|[]],F). true Zvi -- View this message in context: http://www.nabble.com/Irregular-list-tp21977982p21980109.html Sent from the Erlang Questions mailing list archive at Nabble.com. From tsuraan@REDACTED Thu Feb 12 18:03:45 2009 From: tsuraan@REDACTED (tsuraan) Date: Thu, 12 Feb 2009 11:03:45 -0600 Subject: [erlang-questions] tempfile, or O_EXCL In-Reply-To: <84fb38e30811171125u14276c03l53af6e5107a52ab4@mail.gmail.com> References: <84fb38e30811171125u14276c03l53af6e5107a52ab4@mail.gmail.com> Message-ID: <84fb38e30902120903n1fcd992dj24382eab0cb3a684@mail.gmail.com> Since this posting is now google's top hit for erlang tempfile, I'll self-reply with a port-based implementation of tempfile:mktemp. It's quick and dirty, but seems to work reasonably well, and I assume the underlying unix mktemp program does use O_EXCL, so it should be reasonably safe. If anybody has any improvements, comments, etc, feel free to post them. -module(tempfile). -export([mktemp/0, mktemp/1]). mktemp() -> mktemp([{dir, "/var/tmp"}, {template, "tmp.XXXXXXXXXX"}]). mktemp(Args) -> Cmd = process_args(Args, "mktemp"), Port = open_port({spawn, Cmd}, [{line, 1000}, use_stdio, exit_status, stderr_to_stdout]), get_response(Port, nil). process_args([], Cmd) -> Cmd; process_args([{Flag, Value} | Rest], Cmd) -> case Flag of dir -> process_args(Rest, Cmd ++ " " ++ "--tmpdir=" ++ Value); template -> process_args(Rest, Cmd ++ " " ++ Value) end. get_response(Port, Resp) -> case Resp of nil -> receive { Port, {data, {_, Line}}} -> get_response(Port, Line); { Port, {exit_status, _ }} -> { error, "No response from mktemp" } end; Resp -> receive { Port, {data, _}} -> get_response(Port, Resp); { Port, {exit_status, 0}} -> { ok, Resp }; { Port, {exit_status, _}} -> { error, Resp } end end. On 17/11/2008, tsuraan wrote: > Is there any way to specify exclusive (posix O_EXCL) with write when > opening a file in Erlang? I couldn't find a mkstemp anywhere in the > standard library, so I wrote one myself, but without EXCL, it's not > very safe. I'd like to fix that, but I don't see how to do so without > being able to open a file in exclusive write mode. > From kevin@REDACTED Thu Feb 12 18:12:55 2009 From: kevin@REDACTED (Kevin Scaldeferri) Date: Thu, 12 Feb 2009 09:12:55 -0800 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <9b08084c0902120753p4785d045l366c076330a3936f@mail.gmail.com> References: <4535f6cd0902110846w1180516u7dfbf83ce8c87970@mail.gmail.com> <3EC78F9B-5873-4E10-9A1E-A38649F96B0F@uninet.ee> <4535f6cd0902111058x32bcaf64r8536c89ad9546cc1@mail.gmail.com> <9b08084c0902120753p4785d045l366c076330a3936f@mail.gmail.com> Message-ID: <489C6085-CC01-4C4D-BC84-BE26A9266324@scaldeferri.com> On Feb 12, 2009, at 7:53 AM, Joe Armstrong wrote: > > > No language serves up library code to you on a plate with no effort > involved. This is true, but OTOH, Erlang requires much more effort than many other language (Perl being the gold standard here, I would say; with Ruby and, increasingly, Haskell making good showings). A good repository of reusable code is a huge boon to a language. > > At the end of the day most good programmers end up writing the code > they want > because it is *quicker* than searching in vain for library code that > may or may not work and may of may not do what they want. Even if they > find the code they cannot > be sure that it is 100% correct. Respectfully, I think that's quite untrue. Perhaps there are some problem domains where it holds, but there are many others where it's not the case. It would be pure arrogance to think that you are just going to whip out an XML parser or an implementation of many of the common internet protocols that is more correct than library code that's been used by many people over many months or years. -kevin From exta7@REDACTED Thu Feb 12 18:22:28 2009 From: exta7@REDACTED (Zvi) Date: Thu, 12 Feb 2009 09:22:28 -0800 (PST) Subject: [erlang-questions] Human readable errors in lists module In-Reply-To: <23377730.10541234279344155.JavaMail.root@zimbra> References: <23377730.10541234279344155.JavaMail.root@zimbra> Message-ID: <21980676.post@talk.nabble.com> I think instead of "fixing" lists:zipwith, it's better to add parallel list comprehensions, i.e.: lists:zipwith(F, Xs, Ys) = [F(X,Y) || X<-Xs ; Y<-Ys]. Note ";" instead of ",". Zvi -- View this message in context: http://www.nabble.com/Human-readable-errors-in-lists-module-tp21936024p21980676.html Sent from the Erlang Questions mailing list archive at Nabble.com. From lk@REDACTED Thu Feb 12 18:35:07 2009 From: lk@REDACTED (=?iso-8859-1?Q?Ladv=E1nszky_K=E1roly?=) Date: Thu, 12 Feb 2009 18:35:07 +0100 Subject: [erlang-questions] Irregular list Message-ID: Thanks everybody for the help. Sorry for the confusing term ?open list?; I wished to refer to Lisp?s/Scheme?s unterminated lists. LKaroly _____ From: Ladv?nszky K?roly [mailto:lk@REDACTED] Sent: 2009. febru?r 12. 16:10 To: 'erlang-questions@REDACTED' Subject: Irregular list Just getting acquainted with this wonderful system, I?ve run into the following issue: The shell seems to accept a structure like this: [a | b]. is_list([a | b]) returns true but length([a | b]) raises an exception. Is it like an ?open list? found in some programming languages? Any help would be appreciated, LKaroly -------------- next part -------------- An HTML attachment was scrubbed... URL: From raimo+erlang-questions@REDACTED Thu Feb 12 18:51:09 2009 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 12 Feb 2009 18:51:09 +0100 Subject: [erlang-questions] : Hacked Group Home Page? In-Reply-To: <5e6458d0902120840x42614ac9l4a7e45bc90cb368@mail.gmail.com> References: <15938288.14781234441169264.JavaMail.root@zimbra> <1234442981.1934.1299981211@webmail.messagingengine.com> <4d08db370902120626vf97fcc2iea86a25590ae38cd@mail.gmail.com> <4ecde87b0902120737o295bedb7m93f11a1dd981c02f@mail.gmail.com> <5e6458d0902120840x42614ac9l4a7e45bc90cb368@mail.gmail.com> Message-ID: <20090212175109.GA24656@erix.ericsson.se> On Thu, Feb 12, 2009 at 04:40:55PM +0000, Kerr Rainey wrote: > 2009/2/12 Jon Gretar Borgthorsson : > > Umm... > > Why this whole discussion about this? Why doesn't someone with manager > > access simply remove this? And of story. > > In the first instance, just trying to establish where it was coming > from. Now we just need it dealt with. So who has manager access to > the Google Group to fix it? The only one with manager access as I know of is the group owner, and the group owner can be found among the members, e.g by sorting on member type. I tried to contact this group owner about a year ago to find out if he/she felt like transferring the group ownership to the Erlang/OTP group. But I got no answer. So now it pops up again. The settings for the group is far to sloppy. It allows anyone to join and any member to post pages and files. And there is a long history of porn and spam among the pages and files. Nice users seem to continously edit these pages to remove the porn ads, so this is the first time it has come to our attention. Rouge users join, post their crap and then unsubscribe. It is apparently a known issue within Google Groups (I Googled to find this out :-). This time the welcome page apparently has been hacked, so perhaps the group owner password is cracked. I guess only the group owner and group managers can alter the welcome page, and I saw no group managers on the members list (but did not look that hard, i only wanted the owner). I have again mailed the group owner to get a response. I have also mailed support at google groups, but it seems (according to the Google Groups Help Forum) that they seldom bother with these problems. There are advice there that you create a new group and convince the users to abandon the old. So if neither the group owner nor google groups support answers my prairs that is what we will have to do. > > On a side, can the group not be set up to add itself into the reply-to > field? Doh! Google for "reply-to considered harmful" and search the erlang-questions archives for numerous older reply-to discussions... > > -- > Kerr > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From v@REDACTED Thu Feb 12 18:51:02 2009 From: v@REDACTED (Valentin Micic) Date: Thu, 12 Feb 2009 19:51:02 +0200 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <489C6085-CC01-4C4D-BC84-BE26A9266324@scaldeferri.com> Message-ID: <200902121748.n1CHmmRc015509@mail.pharos-avantgard.com> > It would be pure arrogance to think that you are just > going to whip out an XML parser [...] > library code that's been used by many people over > many months or years. Arrogance or not, it is usually much easier to write "your own" than to try to fit a square through a round hole. As for "used by many people..." assertion, IMO, the "safety in numbers" is a fool's paradise when it comes to programming. There are far more projects that fail than one that are successful, and of these that are "successful", even fewer deliver to expectations. A logical destination of such reasoning would be that you're more likely to fail if you do what everybody else is doing. So, stop pushing this square trough a triangular hole and start using your imagination. As No.44 would say -- with Erlang, you can! V. From steven.charles.davis@REDACTED Thu Feb 12 18:52:09 2009 From: steven.charles.davis@REDACTED (Steve Davis) Date: Thu, 12 Feb 2009 09:52:09 -0800 (PST) Subject: [erlang-questions] Human readable errors in lists module In-Reply-To: <9b08084c0902101346r166b4b77l14e68ac0dc2e6b8b@mail.gmail.com> References: <31309437.10521234279023327.JavaMail.root@zimbra> <23377730.10541234279344155.JavaMail.root@zimbra> <9b08084c0902101346r166b4b77l14e68ac0dc2e6b8b@mail.gmail.com> Message-ID: If you are coming from java et al. the "let it crash" style is actually quite hard to get used to at first. Defensive programming is a strong habit and it is a good habit when writing java/cpp etc. But with Erlang, the "let it crash" style is absolutely the *right thing to do*. You will soon realize that this is a liberating license to write the kind of aggressive code that would love to be able to write in java/php/c/younameit --- when you get used to it you will enjoy programming more and will find your productivity soaring! /s From mihai@REDACTED Thu Feb 12 19:12:22 2009 From: mihai@REDACTED (Mihai Balea) Date: Thu, 12 Feb 2009 13:12:22 -0500 Subject: [erlang-questions] Irregular list In-Reply-To: <9b08084c0902120730s1dea7423nbc9a5a39897e88b2@mail.gmail.com> References: <9b08084c0902120730s1dea7423nbc9a5a39897e88b2@mail.gmail.com> Message-ID: Maybe I'm missing something, but what is the point of even allowing the concept of cons cells? Wouldn't a tuple be more generic? Is there any practical use of "improper lists" in Erlang? Mihai On Feb 12, 2009, at 10:30 AM, Joe Armstrong wrote: > This is a "improper list". A list is really just a cons cell (think > lisp, or think > "liknked list" in C) - internally it's a pair > of tagged values - the first value in the pair is the head of the > list. The second value > is the tail of the list, an so should point to a list or nil. If the > tail points to > nil or a list then it is a proper list, otherwise it's an improper > list. > Most library functions will behave strangely when presented with > improper > lists - so don't use them! > > /Joe Armstrong From pfisher@REDACTED Thu Feb 12 19:25:22 2009 From: pfisher@REDACTED (Paul Fisher) Date: Thu, 12 Feb 2009 12:25:22 -0600 Subject: [erlang-questions] Irregular list In-Reply-To: References: <9b08084c0902120730s1dea7423nbc9a5a39897e88b2@mail.gmail.com> Message-ID: <49946992.1060705@alertlogic.net> Mihai Balea wrote: > Maybe I'm missing something, but what is the point of even allowing > the concept of cons cells? Wouldn't a tuple be more generic? > Is there any practical use of "improper lists" in Erlang? FWIW, the dict module uses them... -- paul From fess-erlang@REDACTED Thu Feb 12 19:30:52 2009 From: fess-erlang@REDACTED (fess) Date: Thu, 12 Feb 2009 10:30:52 -0800 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <200902121748.n1CHmmRc015509@mail.pharos-avantgard.com> References: <200902121748.n1CHmmRc015509@mail.pharos-avantgard.com> Message-ID: <7B217408-C4EC-474F-9F96-6BA9B45B1670@fess.org> On Feb 12, 2009, at 9:51 AM, Valentin Micic wrote: >> It would be pure arrogance to think that you are just >> going to whip out an XML parser > [...] >> library code that's been used by many people over >> many months or years. > > Arrogance or not, it is usually much easier to write "your own" than > to try > to fit a square through a round hole. > > As for "used by many people..." assertion, IMO, the "safety in > numbers" is a > fool's paradise when it comes to programming. There are far more > projects > that fail than one that are successful, and of these that are > "successful", > even fewer deliver to expectations. A logical destination of such > reasoning > would be that you're more likely to fail if you do what everybody > else is > doing. So, stop pushing this square trough a triangular hole and > start using > your imagination. As No.44 would say -- with Erlang, you can! Wow, Joe's post disappointed me. Valentin's post has inflamed me. I have to back kevin up here. To use Valintin's metaphor: There are times when it is easier to fit the round peg of the correct diameter provided by the public library tested and used by people all solving the same common sub problem of their larger problem. much easier than carving out your own peg which turns out to be not quite so round and doesn't quite fit right but sort of gets the job done and wasted a lot of your time which should have been spent on the part of the your problem where your innovation was actually required. It is an arrogant fools paradise to think that every part of your problem is so unique that you can do it better than all those who collaborated before you, or that it is even worth your time to do so. A logical destination of such reasoning would be that we should each individually rewrite erlang because to quote joe: "At the end of the day most good programmers end up writing the code they want because it is *quicker* than searching in vain for library code that may or may not work and may of may not do what they want. Even if they find the code they cannot be sure that it is 100% correct." IMO a seemingly hostile attitude toward improving libraries and availability of libraries is bad for everybody. We all stand on the backs of Giants, those who don't believe so should spend their days rewriting kernels, perhaps we'll stand on their backs some day but if we all did it, well, we wouldn't be very tall giants. I hope this email is not too inflamatory, and I apologize because it probably is, but there's something going on here that really worries me about erlang. --fess so, sad that he took the fall into this thread. I hope that ulf says something sage to make it all better. *grin* --fess From hasan.veldstra@REDACTED Thu Feb 12 19:37:21 2009 From: hasan.veldstra@REDACTED (Hasan Veldstra) Date: Thu, 12 Feb 2009 18:37:21 +0000 Subject: [erlang-questions] startups using Erlang Message-ID: <8D7FE22F-5637-433D-8C9D-93C127F6E8B3@gmail.com> i'm putting together a small promotional website for Erlang (think whygitisbetterthanx.com) and i'm compiling a list of startups that are using Erlang. so far i've got: Hypernumbers, MochiMedia, Github, Powerset, Engine Yard, Heysan, N54, and Streamfile. anyone know of or working for any other such startups? /Hasan From hasan.veldstra@REDACTED Thu Feb 12 19:40:33 2009 From: hasan.veldstra@REDACTED (Hasan Veldstra) Date: Thu, 12 Feb 2009 18:40:33 +0000 Subject: [erlang-questions] startups using Erlang In-Reply-To: <8D7FE22F-5637-433D-8C9D-93C127F6E8B3@gmail.com> References: <8D7FE22F-5637-433D-8C9D-93C127F6E8B3@gmail.com> Message-ID: i should've also said that i'm also making a list of larger well- established companies that are using Erlang. if you know of any, please tell. On 12 Feb 2009, at 18:37PM, Hasan Veldstra wrote: > > i'm putting together a small promotional website for Erlang (think > whygitisbetterthanx.com) and i'm compiling a list of startups that > are using Erlang. > > so far i've got: Hypernumbers, MochiMedia, Github, Powerset, Engine > Yard, Heysan, N54, and Streamfile. > > anyone know of or working for any other such startups? > > /Hasan From freza@REDACTED Thu Feb 12 19:53:40 2009 From: freza@REDACTED (Jachym Holecek) Date: Thu, 12 Feb 2009 19:53:40 +0100 Subject: [erlang-questions] Irregular list In-Reply-To: References: <9b08084c0902120730s1dea7423nbc9a5a39897e88b2@mail.gmail.com> Message-ID: <20090212185340.GA19059@hanele> # Mihai Balea 2009-02-12: > Is there any practical use of "improper lists" in Erlang? A 2-tuple is larger than a cons-cell by one word (or 50% if you prefer :-), so choosing cons over 2-tuple makes practical sense if you're about to work with a huge amount of pairs. The dict module from stdlib seems to be an example. Note this argument isn't inherent to the problem: With some amount of work, you could probably tweak erts to represent 2-tuples without the extra overhead. Other than size, someone has recently proposed a new function for a stdlib module (sorry, I forgot the details) that used improper lists, and after reading the explanation, it felt very intuitive (more so than the 2-tuple based analogy). So forbidding improper lists altogether might perhaps be something to regret later on. Just my two cents, anyway. -- Jachym From rvirding@REDACTED Thu Feb 12 20:11:53 2009 From: rvirding@REDACTED (Robert Virding) Date: Thu, 12 Feb 2009 20:11:53 +0100 Subject: [erlang-questions] Irregular list In-Reply-To: References: <9b08084c0902120730s1dea7423nbc9a5a39897e88b2@mail.gmail.com> Message-ID: <3dbc6d1c0902121111le5454d3lc6982069302f46e@mail.gmail.com> 2009/2/12 Mihai Balea > Maybe I'm missing something, but what is the point of even allowing > the concept of cons cells? Wouldn't a tuple be more generic? > Is there any practical use of "improper lists" in Erlang? Tuples and lists have different properties and different uses. Tuples have fixed a size and are typically used when you know how many elements there are. Changing the size of a tuple is basically impossible so if you want to add/remove an another element to a tuple you have to create a new tuple which is different from the old tuple. A typical use for a tuple is when you want to return more than one value from a function where you return a tuple containg the values. Lists, on the other hand, are dynamic objects. It is easy and cheap to add/remove elements to/from the front of the list, the without having to copy the rest of the list. It is also very easy to step over the elements of a list. A list is built up of pairs, cons cells, where the first element, the head, of the pair is the element of the list while second element, the tail, points to the next pair/cons cell of the list. A pair is written in Erlang as [a|b] and a list as [a,b,c,d] which is syntactic sugar for the actual representation which is written as [a|[b|[c|[d|[]]]]]. Note that the tail of the last pair is []. This makes it a what is called a proper list. If the tail of the last pair is not a [] then it is not a proper list. [] is therefore considered to be the empty list as it contains no elements. Many (most) list processing functions assume that the lists they work on are proper lists, typically by stepping down the list as long as they tail is another list pair until they get to a []. Length/1 is like this. The test is_list/1 is very simple and test whether its arguments is a pair or the empty list []. It does not check the whole list. Re: Paul Fisher and the dict module. Dict uses lists for example to keep all the values which have the same key. There is one place in dict where a cons-cell is used in what would normally be a 2-element tuple, it does [Key|Listof Values] instead of {Key,ListofValues}, but that is just joke and serves no practical purpose. I hope this clears up some issues and doesn't add to the confusion, Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From v@REDACTED Thu Feb 12 20:21:50 2009 From: v@REDACTED (Valentin Micic) Date: Thu, 12 Feb 2009 21:21:50 +0200 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <7B217408-C4EC-474F-9F96-6BA9B45B1670@fess.org> Message-ID: <200902121919.n1CJJaRc015818@mail.pharos-avantgard.com> > Valentin's post has inflamed me. I can see that. Not sure why, but so be it. V. From kevin@REDACTED Thu Feb 12 20:39:17 2009 From: kevin@REDACTED (Kevin A. Smith) Date: Thu, 12 Feb 2009 14:39:17 -0500 Subject: [erlang-questions] startups using Erlang In-Reply-To: <8D7FE22F-5637-433D-8C9D-93C127F6E8B3@gmail.com> References: <8D7FE22F-5637-433D-8C9D-93C127F6E8B3@gmail.com> Message-ID: <34A0FEB5-024B-4A15-8C67-C2AF501E1FD6@hypotheticalabs.com> Rupture (http://www.rupture.com) Basho (http://www.basho.com) --Kevin On Feb 12, 2009, at 1:37 PM, Hasan Veldstra wrote: > > i'm putting together a small promotional website for Erlang (think > whygitisbetterthanx.com) and i'm compiling a list of startups that > are using Erlang. > > so far i've got: Hypernumbers, MochiMedia, Github, Powerset, Engine > Yard, Heysan, N54, and Streamfile. > > anyone know of or working for any other such startups? > > /Hasan > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From nick@REDACTED Thu Feb 12 20:57:46 2009 From: nick@REDACTED (Nick Gerakines) Date: Thu, 12 Feb 2009 11:57:46 -0800 Subject: [erlang-questions] startups using Erlang In-Reply-To: <34A0FEB5-024B-4A15-8C67-C2AF501E1FD6@hypotheticalabs.com> References: <8D7FE22F-5637-433D-8C9D-93C127F6E8B3@gmail.com> <34A0FEB5-024B-4A15-8C67-C2AF501E1FD6@hypotheticalabs.com> Message-ID: Rupture (my team) isn't a start-up, it's owned by EA. -- nkg On Thu, Feb 12, 2009 at 11:39 AM, Kevin A. Smith wrote: > Rupture (http://www.rupture.com) > Basho (http://www.basho.com) > > --Kevin > On Feb 12, 2009, at 1:37 PM, Hasan Veldstra wrote: > >> >> i'm putting together a small promotional website for Erlang (think >> whygitisbetterthanx.com) and i'm compiling a list of startups that >> are using Erlang. >> >> so far i've got: Hypernumbers, MochiMedia, Github, Powerset, Engine >> Yard, Heysan, N54, and Streamfile. >> >> anyone know of or working for any other such startups? >> >> /Hasan >> _______________________________________________ >> 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 tuncer.ayaz@REDACTED Thu Feb 12 21:00:40 2009 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Thu, 12 Feb 2009 21:00:40 +0100 Subject: [erlang-questions] startups using Erlang In-Reply-To: <8D7FE22F-5637-433D-8C9D-93C127F6E8B3@gmail.com> References: <8D7FE22F-5637-433D-8C9D-93C127F6E8B3@gmail.com> Message-ID: <4ac8254d0902121200i78eb4fccrbcd19cd28448918a@mail.gmail.com> On Thu, Feb 12, 2009 at 7:37 PM, Hasan Veldstra wrote: > > i'm putting together a small promotional website for Erlang (think > whygitisbetterthanx.com) and i'm compiling a list of startups that > are using Erlang. > > so far i've got: Hypernumbers, MochiMedia, Github, Powerset, Engine > Yard, Heysan, N54, and Streamfile. Nimbuzz. From tuncer.ayaz@REDACTED Thu Feb 12 21:01:10 2009 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Thu, 12 Feb 2009 21:01:10 +0100 Subject: [erlang-questions] startups using Erlang In-Reply-To: References: <8D7FE22F-5637-433D-8C9D-93C127F6E8B3@gmail.com> Message-ID: <4ac8254d0902121201r65a0f3d8of9397fc7a310542e@mail.gmail.com> On Thu, Feb 12, 2009 at 7:40 PM, Hasan Veldstra wrote: > > i should've also said that i'm also making a list of larger well- > established companies that are using Erlang. if you know of any, > please tell. Process-One is well-established. > On 12 Feb 2009, at 18:37PM, Hasan Veldstra wrote: > >> >> i'm putting together a small promotional website for Erlang (think >> whygitisbetterthanx.com) and i'm compiling a list of startups that >> are using Erlang. >> >> so far i've got: Hypernumbers, MochiMedia, Github, Powerset, Engine >> Yard, Heysan, N54, and Streamfile. >> >> anyone know of or working for any other such startups? >> >> /Hasan > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From tuncer.ayaz@REDACTED Thu Feb 12 21:02:09 2009 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Thu, 12 Feb 2009 21:02:09 +0100 Subject: [erlang-questions] startups using Erlang In-Reply-To: References: <8D7FE22F-5637-433D-8C9D-93C127F6E8B3@gmail.com> <34A0FEB5-024B-4A15-8C67-C2AF501E1FD6@hypotheticalabs.com> Message-ID: <4ac8254d0902121202xfce8675n94280b6179814dd4@mail.gmail.com> On Thu, Feb 12, 2009 at 8:57 PM, Nick Gerakines wrote: > Rupture (my team) isn't a start-up, it's owned by EA. -- nkg How do you define a start-up? Curious. > On Thu, Feb 12, 2009 at 11:39 AM, Kevin A. Smith > wrote: >> Rupture (http://www.rupture.com) >> Basho (http://www.basho.com) >> >> --Kevin >> On Feb 12, 2009, at 1:37 PM, Hasan Veldstra wrote: >> >>> >>> i'm putting together a small promotional website for Erlang (think >>> whygitisbetterthanx.com) and i'm compiling a list of startups that >>> are using Erlang. >>> >>> so far i've got: Hypernumbers, MochiMedia, Github, Powerset, Engine >>> Yard, Heysan, N54, and Streamfile. >>> >>> anyone know of or working for any other such startups? >>> >>> /Hasan >>> _______________________________________________ >>> 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 elias@REDACTED Thu Feb 12 21:04:12 2009 From: elias@REDACTED (Elias Torres) Date: Thu, 12 Feb 2009 15:04:12 -0500 Subject: [erlang-questions] startups using Erlang In-Reply-To: <8D7FE22F-5637-433D-8C9D-93C127F6E8B3@gmail.com> References: <8D7FE22F-5637-433D-8C9D-93C127F6E8B3@gmail.com> Message-ID: On Thu, Feb 12, 2009 at 1:37 PM, Hasan Veldstra wrote: > > i'm putting together a small promotional website for Erlang (think > whygitisbetterthanx.com) and i'm compiling a list of startups that > are using Erlang. > > so far i've got: Hypernumbers, MochiMedia, Github, Powerset, Engine > Yard, Heysan, N54, and Streamfile. > > anyone know of or working for any other such startups? Lookery > > /Hasan > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From nick@REDACTED Thu Feb 12 21:15:49 2009 From: nick@REDACTED (Nick Gerakines) Date: Thu, 12 Feb 2009 12:15:49 -0800 Subject: [erlang-questions] startups using Erlang In-Reply-To: <4ac8254d0902121202xfce8675n94280b6179814dd4@mail.gmail.com> References: <8D7FE22F-5637-433D-8C9D-93C127F6E8B3@gmail.com> <34A0FEB5-024B-4A15-8C67-C2AF501E1FD6@hypotheticalabs.com> <4ac8254d0902121202xfce8675n94280b6179814dd4@mail.gmail.com> Message-ID: It's not a start-up in the sense that Rupture is a component of EA Online which is a major subgroup of EA as a whole. EA employs thousands of people. I think it's safe to say that EA is not a start-up. I suppose it's all relative, but to me as an employee of EA on the Rupture team, I don't think we are a start-up. # Nick Gerakines Caveat: These thoughts are my own and they may vary from those of my co-workers and are not the "official" words from EA. On Thu, Feb 12, 2009 at 12:02 PM, Tuncer Ayaz wrote: > On Thu, Feb 12, 2009 at 8:57 PM, Nick Gerakines wrote: >> Rupture (my team) isn't a start-up, it's owned by EA. -- nkg > > How do you define a start-up? Curious. > >> On Thu, Feb 12, 2009 at 11:39 AM, Kevin A. Smith >> wrote: >>> Rupture (http://www.rupture.com) >>> Basho (http://www.basho.com) >>> >>> --Kevin >>> On Feb 12, 2009, at 1:37 PM, Hasan Veldstra wrote: >>> >>>> >>>> i'm putting together a small promotional website for Erlang (think >>>> whygitisbetterthanx.com) and i'm compiling a list of startups that >>>> are using Erlang. >>>> >>>> so far i've got: Hypernumbers, MochiMedia, Github, Powerset, Engine >>>> Yard, Heysan, N54, and Streamfile. >>>> >>>> anyone know of or working for any other such startups? >>>> >>>> /Hasan >>>> _______________________________________________ >>>> 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 kevin@REDACTED Thu Feb 12 21:21:56 2009 From: kevin@REDACTED (Kevin A. Smith) Date: Thu, 12 Feb 2009 15:21:56 -0500 Subject: [erlang-questions] startups using Erlang In-Reply-To: References: <8D7FE22F-5637-433D-8C9D-93C127F6E8B3@gmail.com> <34A0FEB5-024B-4A15-8C67-C2AF501E1FD6@hypotheticalabs.com> <4ac8254d0902121202xfce8675n94280b6179814dd4@mail.gmail.com> Message-ID: <302BB4C7-8EEA-40BC-9298-DAC095532BF4@hypotheticalabs.com> Point taken. I defer to Nick as to the best way to describe Rupture. I was unaware of its affiliation with EA. --Kevin On Feb 12, 2009, at 3:15 PM, Nick Gerakines wrote: > It's not a start-up in the sense that Rupture is a component of EA > Online which is a major subgroup of EA as a whole. EA employs > thousands of people. I think it's safe to say that EA is not a > start-up. I suppose it's all relative, but to me as an employee of EA > on the Rupture team, I don't think we are a start-up. > > # Nick Gerakines > > Caveat: These thoughts are my own and they may vary from those of my > co-workers and are not the "official" words from EA. > > On Thu, Feb 12, 2009 at 12:02 PM, Tuncer Ayaz > wrote: >> On Thu, Feb 12, 2009 at 8:57 PM, Nick Gerakines >> wrote: >>> Rupture (my team) isn't a start-up, it's owned by EA. -- nkg >> >> How do you define a start-up? Curious. >> >>> On Thu, Feb 12, 2009 at 11:39 AM, Kevin A. Smith >>> wrote: >>>> Rupture (http://www.rupture.com) >>>> Basho (http://www.basho.com) >>>> >>>> --Kevin >>>> On Feb 12, 2009, at 1:37 PM, Hasan Veldstra wrote: >>>> >>>>> >>>>> i'm putting together a small promotional website for Erlang (think >>>>> whygitisbetterthanx.com) and i'm compiling a list of startups that >>>>> are using Erlang. >>>>> >>>>> so far i've got: Hypernumbers, MochiMedia, Github, Powerset, >>>>> Engine >>>>> Yard, Heysan, N54, and Streamfile. >>>>> >>>>> anyone know of or working for any other such startups? >>>>> >>>>> /Hasan >>>>> _______________________________________________ >>>>> 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 massimo.cesaro@REDACTED Thu Feb 12 21:45:24 2009 From: massimo.cesaro@REDACTED (Massimo Cesaro) Date: Thu, 12 Feb 2009 21:45:24 +0100 Subject: [erlang-questions] startups using Erlang In-Reply-To: <8D7FE22F-5637-433D-8C9D-93C127F6E8B3@gmail.com> References: <8D7FE22F-5637-433D-8C9D-93C127F6E8B3@gmail.com> Message-ID: <7ae16d50902121245m56a1fdfasaa0d1c1e88a71509@mail.gmail.com> Nesit. Not a startup, however. Massimo On Thu, Feb 12, 2009 at 7:37 PM, Hasan Veldstra wrote: > > i'm putting together a small promotional website for Erlang (think > whygitisbetterthanx.com) and i'm compiling a list of startups that > are using Erlang. > > so far i've got: Hypernumbers, MochiMedia, Github, Powerset, Engine > Yard, Heysan, N54, and Streamfile. > > anyone know of or working for any other such startups? > > /Hasan > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mpalmer@REDACTED Thu Feb 12 20:28:32 2009 From: mpalmer@REDACTED (Matthew Palmer) Date: Fri, 13 Feb 2009 06:28:32 +1100 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <489C6085-CC01-4C4D-BC84-BE26A9266324@scaldeferri.com> References: <4535f6cd0902110846w1180516u7dfbf83ce8c87970@mail.gmail.com> <3EC78F9B-5873-4E10-9A1E-A38649F96B0F@uninet.ee> <4535f6cd0902111058x32bcaf64r8536c89ad9546cc1@mail.gmail.com> <9b08084c0902120753p4785d045l366c076330a3936f@mail.gmail.com> <489C6085-CC01-4C4D-BC84-BE26A9266324@scaldeferri.com> Message-ID: <20090212192832.GU23813@hezmatt.org> On Thu, Feb 12, 2009 at 09:12:55AM -0800, Kevin Scaldeferri wrote: > On Feb 12, 2009, at 7:53 AM, Joe Armstrong wrote: > > No language serves up library code to you on a plate with no effort > > involved. > > This is true, but OTOH, Erlang requires much more effort than many > other language (Perl being the gold standard here, I would say; with > Ruby and, increasingly, Haskell making good showings). A good > repository of reusable code is a huge boon to a language. When you find "a good repository of reusable code", for any language, please let us know. The examples I'm most familiar with (PECL, CPAN, Rubyforge) are large collections of utter crap, with the occasional jewel to keep your hopes alive. The vast majority of what's in any of them is buggy, limited in scope, doesn't do what it says on the box, poorly tested, undocumented, downright dangerous, conflicts with other stuff you've already picked, and/or depends on other modules that you either can't find or which fit the previous categories. Basically, "a large library of third-party modules" isn't something you want to be relying on when you're on a deadline to produce something mission-critical. Yes, your average webapp doesn't really fit that "mission critical" profile (at least, not in the same way as a telephone switch) and hence isn't Erlang's "traditional" market. Half-arsed injuhnearing works well enough for a webapp; it doesn't work for something where 5-nines uptime is a failed product. Personally, as an Erlang n00b, I like the different philosophies embodied in Erlang and it's surrounding community. I've gotten sick of half-arsed web frameworks and the dodgiest of dodgy code hanging on by the skin of it's teeth. I'm looking forward to building some slightly more robust systems from here on. - Matt -- I am cow, hear me moo, I weigh twice as much as you. I'm a cow, eating grass, methane gas comes out my ass. I'm a cow, you are too; join us all! Type apt-get moo. From harveyd@REDACTED Thu Feb 12 23:03:39 2009 From: harveyd@REDACTED (Dale Harvey) Date: Thu, 12 Feb 2009 22:03:39 +0000 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <20090212192832.GU23813@hezmatt.org> References: <4535f6cd0902110846w1180516u7dfbf83ce8c87970@mail.gmail.com> <3EC78F9B-5873-4E10-9A1E-A38649F96B0F@uninet.ee> <4535f6cd0902111058x32bcaf64r8536c89ad9546cc1@mail.gmail.com> <9b08084c0902120753p4785d045l366c076330a3936f@mail.gmail.com> <489C6085-CC01-4C4D-BC84-BE26A9266324@scaldeferri.com> <20090212192832.GU23813@hezmatt.org> Message-ID: 2009/2/12 Matthew Palmer > On Thu, Feb 12, 2009 at 09:12:55AM -0800, Kevin Scaldeferri wrote: > > On Feb 12, 2009, at 7:53 AM, Joe Armstrong wrote: > > > No language serves up library code to you on a plate with no effort > > > involved. > > > > This is true, but OTOH, Erlang requires much more effort than many > > other language (Perl being the gold standard here, I would say; with > > Ruby and, increasingly, Haskell making good showings). A good > > repository of reusable code is a huge boon to a language. > > When you find "a good repository of reusable code", for any language, > please > let us know. > > The examples I'm most familiar with (PECL, CPAN, Rubyforge) are large > collections of utter crap, with the occasional jewel to keep your hopes > alive. The vast majority of what's in any of them is buggy, limited in > scope, doesn't do what it says on the box, poorly tested, undocumented, > downright dangerous, conflicts with other stuff you've already picked, > and/or depends on other modules that you either can't find or which fit the > previous categories. > > Basically, "a large library of third-party modules" isn't something you > want > to be relying on when you're on a deadline to produce something > mission-critical. Yes, your average webapp doesn't really fit that > "mission > critical" profile (at least, not in the same way as a telephone switch) and > hence isn't Erlang's "traditional" market. Half-arsed injuhnearing works > well enough for a webapp; it doesn't work for something where 5-nines > uptime > is a failed product. > > Personally, as an Erlang n00b, I like the different philosophies embodied > in > Erlang and it's surrounding community. I've gotten sick of half-arsed web > frameworks and the dodgiest of dodgy code hanging on by the skin of it's > teeth. I'm looking forward to building some slightly more robust systems > from here on. > > - Matt > Erlang is written on top of "a large library of 3rd party modules" I dont think your point was to not depend on erlang? Should people use yaws, mochiweb, iserve, crary, or write their own web server for each application? If people are forced to write add hoc implementations of common problems that have been solved X times already, then libraries are doomed to be badly written, documented and tested. right now there are lots of well and badly written public libraries that cover lots of the common utility functions, however integrating them is often annoying, people are wary because they dont know which are the "bad" or the "good" projects, people cant find or search them. It seems unlikely that the "good" libraries will be introduced into otp, especially ones that are more web focused. I think a good package manager solves a lot of those problems, cean is older and doesnt seem to have gained traction, faxien seemed to have early teething problems but is looking like it could be maturing. http://erlware.org/documentation/index.html erlangs core doesnt need to be bloated to solve every problem well and 3rd party libraries dont need to be badly written and untested. > > -- > I am cow, hear me moo, I weigh twice as much as you. I'm a cow, eating > grass, methane gas comes out my ass. I'm a cow, you are too; join us all! > Type apt-get moo. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kevin@REDACTED Thu Feb 12 23:26:58 2009 From: kevin@REDACTED (Kevin Scaldeferri) Date: Thu, 12 Feb 2009 14:26:58 -0800 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <20090212192832.GU23813@hezmatt.org> References: <4535f6cd0902110846w1180516u7dfbf83ce8c87970@mail.gmail.com> <3EC78F9B-5873-4E10-9A1E-A38649F96B0F@uninet.ee> <4535f6cd0902111058x32bcaf64r8536c89ad9546cc1@mail.gmail.com> <9b08084c0902120753p4785d045l366c076330a3936f@mail.gmail.com> <489C6085-CC01-4C4D-BC84-BE26A9266324@scaldeferri.com> <20090212192832.GU23813@hezmatt.org> Message-ID: On Feb 12, 2009, at 11:28 AM, Matthew Palmer wrote: > Personally, as an Erlang n00b, I like the different philosophies > embodied in > Erlang and it's surrounding community. I've gotten sick of half- > arsed web > frameworks and the dodgiest of dodgy code hanging on by the skin of > it's > teeth. I'm looking forward to building some slightly more robust > systems > from here on. That's great, and I wish you luck, but once you're done it would be nice if you share some of that awesome code with the rest of us, so everyone doesn't have to be burdened to write their own perfect code for everything they do. -kevin From klacke@REDACTED Thu Feb 12 23:38:39 2009 From: klacke@REDACTED (Claes Wikstrom) Date: Thu, 12 Feb 2009 23:38:39 +0100 Subject: [erlang-questions] yaws 1.80 Message-ID: <4994A4EF.2050103@hyber.org> New release again. A number of bugfixes and small new features. Also a complete win32 .exe installer that should forever remove all the win32 problems we've had with yaws over the years. It's even possible to develop yaws under windows once it has been installed. No cygwin, or anything requirements - native win32 app. One important bugfix, a fairly serious DOS attack was found by Manuel Duran Aguete. If you're running yaws servers in production you may be interested in a backport. Contact me or Manuel for details. As usual code and docs at http://yaws.hyber.org Enjoy /klacke From dave.smith.to@REDACTED Thu Feb 12 23:39:41 2009 From: dave.smith.to@REDACTED (Dave Smith) Date: Thu, 12 Feb 2009 17:39:41 -0500 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <20090212192832.GU23813@hezmatt.org> References: <4535f6cd0902110846w1180516u7dfbf83ce8c87970@mail.gmail.com> <3EC78F9B-5873-4E10-9A1E-A38649F96B0F@uninet.ee> <4535f6cd0902111058x32bcaf64r8536c89ad9546cc1@mail.gmail.com> <9b08084c0902120753p4785d045l366c076330a3936f@mail.gmail.com> <489C6085-CC01-4C4D-BC84-BE26A9266324@scaldeferri.com> <20090212192832.GU23813@hezmatt.org> Message-ID: <5ea453f90902121439q1da3ee37vcccc72cad8ec83fa@mail.gmail.com> I generally agree with Joe and Valentin. I'm not saying I'd write my own XML parser; I try to avoid XML altogether if I can. How many time have I come across programmers using more code to glue a square peg in a round hole than it would take to construct the round peg in the first place. --DS -------------- next part -------------- An HTML attachment was scrubbed... URL: From nick@REDACTED Thu Feb 12 23:40:46 2009 From: nick@REDACTED (Nick Gerakines) Date: Thu, 12 Feb 2009 14:40:46 -0800 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: References: <4535f6cd0902110846w1180516u7dfbf83ce8c87970@mail.gmail.com> <3EC78F9B-5873-4E10-9A1E-A38649F96B0F@uninet.ee> <4535f6cd0902111058x32bcaf64r8536c89ad9546cc1@mail.gmail.com> <9b08084c0902120753p4785d045l366c076330a3936f@mail.gmail.com> <489C6085-CC01-4C4D-BC84-BE26A9266324@scaldeferri.com> <20090212192832.GU23813@hezmatt.org> Message-ID: I'd like to step in and say that Erlang is an awesome platform for writing web services. In fact, to back that statement up, I'll let you metaphorically peak into how we are using it for just that. Here at EA we are building a pretty large web service powered by Erlang to support different parts of the EA Online group. We've been using tools like MochiWeb, etap (github.com/ngerakines/etap), protocol buffers (github.com/ngerakines/erlang_protobuffs), dynomite (github.com/cliffmoon/dynomite) (CAVEAT: it's unofficial/unimplemented but we've got use cases that jive), log_roller (github.com/JacobVorreuter/log_roller), ejabberd and list goes on. To get it out of the way: No, we aren't building a game or MMOG with Erlang. Why? Because Erlang comes with the tools we need to rapidly prototype, improve and deliver production quality code. We can light up a small grid of modular services that tie into a public facing API within a day's development time. It's working really well and I sincerely hope that once more of our project is public, I'll be able to speak more on it. What you can do is follow us (ngerakines, JacobVorreuter, Tivoli) on GitHub and see what open source projects are coming out of this and what we are improving on. # Nick Gerakines 2009/2/12 Dale Harvey : > 2009/2/12 Matthew Palmer >> >> On Thu, Feb 12, 2009 at 09:12:55AM -0800, Kevin Scaldeferri wrote: >> > On Feb 12, 2009, at 7:53 AM, Joe Armstrong wrote: >> > > No language serves up library code to you on a plate with no effort >> > > involved. >> > >> > This is true, but OTOH, Erlang requires much more effort than many >> > other language (Perl being the gold standard here, I would say; with >> > Ruby and, increasingly, Haskell making good showings). A good >> > repository of reusable code is a huge boon to a language. >> >> When you find "a good repository of reusable code", for any language, >> please >> let us know. >> >> The examples I'm most familiar with (PECL, CPAN, Rubyforge) are large >> collections of utter crap, with the occasional jewel to keep your hopes >> alive. The vast majority of what's in any of them is buggy, limited in >> scope, doesn't do what it says on the box, poorly tested, undocumented, >> downright dangerous, conflicts with other stuff you've already picked, >> and/or depends on other modules that you either can't find or which fit >> the >> previous categories. >> >> Basically, "a large library of third-party modules" isn't something you >> want >> to be relying on when you're on a deadline to produce something >> mission-critical. Yes, your average webapp doesn't really fit that >> "mission >> critical" profile (at least, not in the same way as a telephone switch) >> and >> hence isn't Erlang's "traditional" market. Half-arsed injuhnearing works >> well enough for a webapp; it doesn't work for something where 5-nines >> uptime >> is a failed product. >> >> Personally, as an Erlang n00b, I like the different philosophies embodied >> in >> Erlang and it's surrounding community. I've gotten sick of half-arsed web >> frameworks and the dodgiest of dodgy code hanging on by the skin of it's >> teeth. I'm looking forward to building some slightly more robust systems >> from here on. >> >> - Matt > > Erlang is written on top of "a large library of 3rd party modules" > I dont think your point was to not depend on erlang? > > Should people use yaws, mochiweb, iserve, crary, or write > their own web server for each application? > > If people are forced to write add hoc implementations of > common problems that have been solved X times already, then libraries are > doomed to be badly written, documented and tested. > > right now there are lots of well and badly written public libraries > that cover lots of the common utility functions, however integrating > them is often annoying, people are wary because they dont know > which are the "bad" or the "good" projects, people cant find or > search them. > > It seems unlikely that the "good" libraries will be introduced > into otp, especially ones that are more web focused. > > I think a good package manager solves a lot of those problems, > cean is older and doesnt seem to have gained traction, faxien > seemed to have early teething problems but is looking like it could > be maturing. > > http://erlware.org/documentation/index.html > > erlangs core doesnt need to be bloated to solve every problem well > and 3rd party libraries dont need to be badly written and untested. > >> >> -- >> I am cow, hear me moo, I weigh twice as much as you. I'm a cow, eating >> grass, methane gas comes out my ass. I'm a cow, you are too; join us all! >> Type apt-get moo. >> _______________________________________________ >> 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 harveyd@REDACTED Thu Feb 12 23:50:50 2009 From: harveyd@REDACTED (Dale Harvey) Date: Thu, 12 Feb 2009 22:50:50 +0000 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: References: <4535f6cd0902110846w1180516u7dfbf83ce8c87970@mail.gmail.com> <3EC78F9B-5873-4E10-9A1E-A38649F96B0F@uninet.ee> <4535f6cd0902111058x32bcaf64r8536c89ad9546cc1@mail.gmail.com> <9b08084c0902120753p4785d045l366c076330a3936f@mail.gmail.com> <489C6085-CC01-4C4D-BC84-BE26A9266324@scaldeferri.com> <20090212192832.GU23813@hezmatt.org> Message-ID: 2009/2/12 Nick Gerakines > I'd like to step in and say that Erlang is an awesome platform for > writing web services. In fact, to back that statement up, I'll let you > metaphorically peak into how we are using it for just that. > > Here at EA we are building a pretty large web service powered by > Erlang to support different parts of the EA Online group. We've been > using tools like MochiWeb, etap (github.com/ngerakines/etap), protocol > buffers (github.com/ngerakines/erlang_protobuffs), dynomite > (github.com/cliffmoon/dynomite) (CAVEAT: it's unofficial/unimplemented > but we've got use cases that jive), log_roller > (github.com/JacobVorreuter/log_roller), ejabberd and list goes on. > > To get it out of the way: No, we aren't building a game or MMOG with > Erlang. > > Why? Because Erlang comes with the tools we need to rapidly prototype, > improve and deliver production quality code. We can light up a small > grid of modular services that tie into a public facing API within a > day's development time. It's working really well and I sincerely hope > that once more of our project is public, I'll be able to speak more on > it. What you can do is follow us (ngerakines, JacobVorreuter, Tivoli) > on GitHub and see what open source projects are coming out of this and > what we are improving on. > > # Nick Gerakines > > 2009/2/12 Dale Harvey : > > 2009/2/12 Matthew Palmer > >> > >> On Thu, Feb 12, 2009 at 09:12:55AM -0800, Kevin Scaldeferri wrote: > >> > On Feb 12, 2009, at 7:53 AM, Joe Armstrong wrote: > >> > > No language serves up library code to you on a plate with no effort > >> > > involved. > >> > > >> > This is true, but OTOH, Erlang requires much more effort than many > >> > other language (Perl being the gold standard here, I would say; with > >> > Ruby and, increasingly, Haskell making good showings). A good > >> > repository of reusable code is a huge boon to a language. > >> > >> When you find "a good repository of reusable code", for any language, > >> please > >> let us know. > >> > >> The examples I'm most familiar with (PECL, CPAN, Rubyforge) are large > >> collections of utter crap, with the occasional jewel to keep your hopes > >> alive. The vast majority of what's in any of them is buggy, limited in > >> scope, doesn't do what it says on the box, poorly tested, undocumented, > >> downright dangerous, conflicts with other stuff you've already picked, > >> and/or depends on other modules that you either can't find or which fit > >> the > >> previous categories. > >> > >> Basically, "a large library of third-party modules" isn't something you > >> want > >> to be relying on when you're on a deadline to produce something > >> mission-critical. Yes, your average webapp doesn't really fit that > >> "mission > >> critical" profile (at least, not in the same way as a telephone switch) > >> and > >> hence isn't Erlang's "traditional" market. Half-arsed injuhnearing > works > >> well enough for a webapp; it doesn't work for something where 5-nines > >> uptime > >> is a failed product. > >> > >> Personally, as an Erlang n00b, I like the different philosophies > embodied > >> in > >> Erlang and it's surrounding community. I've gotten sick of half-arsed > web > >> frameworks and the dodgiest of dodgy code hanging on by the skin of it's > >> teeth. I'm looking forward to building some slightly more robust > systems > >> from here on. > >> > >> - Matt > > > > Erlang is written on top of "a large library of 3rd party modules" > > I dont think your point was to not depend on erlang? > > > > Should people use yaws, mochiweb, iserve, crary, or write > > their own web server for each application? > > > > If people are forced to write add hoc implementations of > > common problems that have been solved X times already, then libraries are > > doomed to be badly written, documented and tested. > > > > right now there are lots of well and badly written public libraries > > that cover lots of the common utility functions, however integrating > > them is often annoying, people are wary because they dont know > > which are the "bad" or the "good" projects, people cant find or > > search them. > > > > It seems unlikely that the "good" libraries will be introduced > > into otp, especially ones that are more web focused. > > > > I think a good package manager solves a lot of those problems, > > cean is older and doesnt seem to have gained traction, faxien > > seemed to have early teething problems but is looking like it could > > be maturing. > > > > http://erlware.org/documentation/index.html > > > > erlangs core doesnt need to be bloated to solve every problem well > > and 3rd party libraries dont need to be badly written and untested. > > > >> > >> -- > >> I am cow, hear me moo, I weigh twice as much as you. I'm a cow, eating > >> grass, methane gas comes out my ass. I'm a cow, you are too; join us > all! > >> Type apt-get moo. > >> _______________________________________________ > >> 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 > > > Heh I wanted to make it clear if it wasnt from my first post that I also think erlang makes for a great platform to write web applications. having an embedded database and a proliferation of web servers to choose from are 2 big wins, and the principles behind erlangs fault tolerance and concurrency orientated programming are a great match. I agree with joe's premise that those advantages outweigh the disadvantages of not having a lot of the common utility libraries for a lot of people, but I dont agree that its a reason not to bother providing them as a community. -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomasl_erlang@REDACTED Fri Feb 13 01:25:37 2009 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Thu, 12 Feb 2009 16:25:37 -0800 (PST) Subject: [erlang-questions] Irregular list In-Reply-To: <49946992.1060705@alertlogic.net> Message-ID: <968858.30536.qm@web111409.mail.gq1.yahoo.com> --- On Thu, 2/12/09, Paul Fisher wrote: > Mihai Balea wrote: > > Maybe I'm missing something, but what is the point > of even allowing > > the concept of cons cells? Wouldn't a tuple be > more generic? > > Is there any practical use of "improper > lists" in Erlang? > > FWIW, the dict module uses them... There are a few of implementation reasons: First, a cons cell requires 2 words, while a 2-tuple needs 3 words. That's a 50% overhead, not to mention some extra checking. Second, requiring that lists be proper means you have to check the list cdr every time you cons something. (At least conceptually; a compiler can probably remove some checks where listness can be derived.) Third, what about using longer tuples to actually save memory? Here, garbage collection becomes an issue. For a list, it's easy to see whether a cons cell is unreachable. For a tuple, it's usually difficult to see that an element is dead and can be collected. Hence you can easily get space leaks. (Though it's not impossible to handle; e.g., lispmachines used cdr-coding, which is the moral equivalent.) Best, Thomas From ok@REDACTED Fri Feb 13 02:12:35 2009 From: ok@REDACTED (Richard O'Keefe) Date: Fri, 13 Feb 2009 14:12:35 +1300 Subject: [erlang-questions] '--' BIF to be used with caution? In-Reply-To: <4d08db370902120237p14f61175pe9e128f2258f0312@mail.gmail.com> References: <707529930901130404y5418466bmc375525ef765e615@mail.gmail.com> <6672d0160902040248n4ef30e0cm4e4e0cb718a04349@mail.gmail.com> <707529930902050630l250a8ae4nedbfa71e5d63460e@mail.gmail.com> <13728F3E-6CF3-4B58-B55B-88950019D370@cs.otago.ac.nz> <4d08db370902100044y4ea7c5cbl5e3bb9cefb9caafa@mail.gmail.com> <4d08db370902110058y37db088bwfdab93d579e508d0@mail.gmail.com> <4d08db370902120237p14f61175pe9e128f2258f0312@mail.gmail.com> Message-ID: <7F891A10-777E-47D9-B6AC-96995D49F658@cs.otago.ac.nz> I wrote: > > For teeny tiny lists, they are all too fast > to measure reliably, which means that for teeny tiny lists > there is no point in keeping the C code. > On 12 Feb 2009, at 11:37 pm, Hynek Vychodil wrote: > > Hundreds hares are wolf's death. Keep in mind that Erlang systems is > supposed to be soft real time in some application. There is latency > matter in those applications. If in one task you have to do hundreds > of '--' operations even with short lists you need do it in ns or us > times and BIF is worth solution there. I'm not familiar with the "hundred hares" proverb and am unable to grasp its meaning here. *Are* there any tasks where hundreds of '--' on short lists have to be done very fast? Any tasks where, say, using bit masks wouldn't be a better choice? I avoid using --, so I decided to poke around in the OTP sources to see what I could find. There was roughly one -- every three thousand lines. There are lots of uses of List -- [Elem], which is linear time. HiPE makes more use of -- than I expected; anyone in the HiPE team care to comment? For what it's worth, a loop evaluating Xs \ Ys 100,000 times, where Xs and Ys both had ten elements and did not intersect, took 4.3 micro-seconds per iteration using the native C-coded -- 4.2 micro-seconds per iteration using a merge-based set difference written in Erlang, not C. The machine was a 500MHz UltraSPARC II. So the C version doesn't seem to have much advantage for small lists either. I'll grant that there probably is an advantage for the case of List -- [Elem], but is that enough to justify a C BIF? From mpalmer@REDACTED Fri Feb 13 03:01:29 2009 From: mpalmer@REDACTED (Matthew Palmer) Date: Fri, 13 Feb 2009 13:01:29 +1100 Subject: [erlang-questions] '--' BIF to be used with caution? In-Reply-To: <7F891A10-777E-47D9-B6AC-96995D49F658@cs.otago.ac.nz> References: <707529930901130404y5418466bmc375525ef765e615@mail.gmail.com> <6672d0160902040248n4ef30e0cm4e4e0cb718a04349@mail.gmail.com> <707529930902050630l250a8ae4nedbfa71e5d63460e@mail.gmail.com> <13728F3E-6CF3-4B58-B55B-88950019D370@cs.otago.ac.nz> <4d08db370902100044y4ea7c5cbl5e3bb9cefb9caafa@mail.gmail.com> <4d08db370902110058y37db088bwfdab93d579e508d0@mail.gmail.com> <4d08db370902120237p14f61175pe9e128f2258f0312@mail.gmail.com> <7F891A10-777E-47D9-B6AC-96995D49F658@cs.otago.ac.nz> Message-ID: <20090213020129.GB23813@hezmatt.org> On Fri, Feb 13, 2009 at 02:12:35PM +1300, Richard O'Keefe wrote: > I wrote: > > > > For teeny tiny lists, they are all too fast > > to measure reliably, which means that for teeny tiny lists > > there is no point in keeping the C code. > > > On 12 Feb 2009, at 11:37 pm, Hynek Vychodil wrote: > > > > Hundreds hares are wolf's death. Keep in mind that Erlang systems is > > supposed to be soft real time in some application. There is latency > > matter in those applications. If in one task you have to do hundreds > > of '--' operations even with short lists you need do it in ns or us > > times and BIF is worth solution there. > > I'm not familiar with the "hundred hares" proverb and > am unable to grasp its meaning here. I'm not familiar with it myself either, but I'm pretty sure from the context that it's similar in concept to "death by a thousand cuts", or a variation on "the straw the broke the camel's back", that is, while doing something small once or twice might not have an impact, do it a large enough number of times and you'll have a problem. - Matt From zerthurd@REDACTED Fri Feb 13 05:27:27 2009 From: zerthurd@REDACTED (Maxim Treskin) Date: Fri, 13 Feb 2009 10:27:27 +0600 Subject: [erlang-questions] Does Emakefile support ASN.1 files? Message-ID: Hello I have Emakefile which contains one line: {"*.asn", [{outdir, "."}]}. So, when I type "erl -make", there is nothing done. It seems that erlang make does not support ASN.1 compilation. -- Maxim Treskin -------------- next part -------------- An HTML attachment was scrubbed... URL: From steven.charles.davis@REDACTED Fri Feb 13 08:06:11 2009 From: steven.charles.davis@REDACTED (Steve Davis) Date: Thu, 12 Feb 2009 23:06:11 -0800 (PST) Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <5ea453f90902121439q1da3ee37vcccc72cad8ec83fa@mail.gmail.com> References: <4535f6cd0902110846w1180516u7dfbf83ce8c87970@mail.gmail.com> <3EC78F9B-5873-4E10-9A1E-A38649F96B0F@uninet.ee> <4535f6cd0902111058x32bcaf64r8536c89ad9546cc1@mail.gmail.com> <9b08084c0902120753p4785d045l366c076330a3936f@mail.gmail.com> <489C6085-CC01-4C4D-BC84-BE26A9266324@scaldeferri.com> <20090212192832.GU23813@hezmatt.org> <5ea453f90902121439q1da3ee37vcccc72cad8ec83fa@mail.gmail.com> Message-ID: <40429b0e-837d-4c88-9222-25b1feab88e3@33g2000yqm.googlegroups.com> Dave, I respectfully offer you my "Joe sez: XML is for Docs not Apps!" t-shirt (tm), as I think you will appreciate it :) Good to see common sense making an ever more vocal comeback! On Feb 12, 4:39?pm, Dave Smith wrote: > I try to avoid XML altogether if I can. From bengt.kleberg@REDACTED Fri Feb 13 08:45:47 2009 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 13 Feb 2009 08:45:47 +0100 Subject: [erlang-questions] Does Emakefile support ASN.1 files? In-Reply-To: References: Message-ID: <1234511147.4510.6.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Greetings, Can you change the Emakefile to have your target first in the tuple? I have not worked with ASN1, but from what I know of Emakefiles the first entry in the tuple should be the target (module). According to the compile documentation ASN1 files are the source for targets, not targets. bengt On Fri, 2009-02-13 at 10:27 +0600, Maxim Treskin wrote: > Hello > > I have Emakefile which contains one line: > > {"*.asn", [{outdir, "."}]}. > > > So, when I type "erl -make", there is nothing done. > It seems that erlang make does not support ASN.1 compilation. > > -- > Maxim Treskin > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From zerthurd@REDACTED Fri Feb 13 08:57:41 2009 From: zerthurd@REDACTED (Maxim Treskin) Date: Fri, 13 Feb 2009 13:57:41 +0600 Subject: [erlang-questions] Does Emakefile support ASN.1 files? In-Reply-To: <1234511147.4510.6.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> References: <1234511147.4510.6.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Message-ID: 2009/2/13 Bengt Kleberg > Greetings, > > Can you change the Emakefile to have your target first in the tuple? > > I have not worked with ASN1, but from what I know of Emakefiles the > first entry in the tuple should be the target (module). According to the > compile documentation ASN1 files are the source for targets, not > targets. > > Now my Emakefile is: {"SSWConn", [{outdir, "."}]}. There is SSWConn.asn file in directory. "erl -make" prints: $ erl -make Recompile: SSWConn ./SSWConn.erl:none: no such file or directory BTW, for .erl files my Emakefile is: {"src/*", [debug_info, {i, "../asn"}, {warn_format, 1}, {outdir, "ebin"}]}. and all works fine. -- Maxim Treskin -------------- next part -------------- An HTML attachment was scrubbed... URL: From masse@REDACTED Fri Feb 13 09:05:57 2009 From: masse@REDACTED (mats cronqvist) Date: Fri, 13 Feb 2009 09:05:57 +0100 Subject: [erlang-questions] Is mnesia/erlang/ETP strong enough? In-Reply-To: <4535f6cd0902111037l2d6334adn7150c296b1182b0c@mail.gmail.com> (Yang Zhang's message of "Thu\, 12 Feb 2009 02\:37\:46 +0800") References: <4535f6cd0902110909h47e6430fgbbd2b45b01a0030c@mail.gmail.com> <7EFF3E64-63EC-47C2-B87F-431CF536EF4C@uninet.ee> <4535f6cd0902111037l2d6334adn7150c296b1182b0c@mail.gmail.com> Message-ID: <87eiy2wyl6.fsf@sterlett.hq.kred> Yang Zhang writes: > I am running erlang on a server(win2003 server R2) with 8 CPUs and 10G > memory. I found when erlang consumed ~800M - 1.5G memory, it will crash > itself. I'm running Erlang on a very similar machine, but with Debian. It has never crashed due to OutOfMemory, even though it rarely uses less that 3GB of memory. Your problems come from Redmond. mats From masse@REDACTED Fri Feb 13 09:19:13 2009 From: masse@REDACTED (mats cronqvist) Date: Fri, 13 Feb 2009 09:19:13 +0100 Subject: [erlang-questions] emerl_scan:file/1 In-Reply-To: (prasantha kumara's message of "Thu\, 12 Feb 2009 16\:11\:26 +0530") References: Message-ID: <87ab8qwxz2.fsf@sterlett.hq.kred> prasantha kumara writes: > ** exception error: no case clause matching {error,enoent} enoent means that the file cannot be found. http://www.opengroup.org/onlinepubs/009695399/basedefs/errno.h.html From dmitriid@REDACTED Fri Feb 13 09:23:25 2009 From: dmitriid@REDACTED (Dmitrii Dimandt) Date: Fri, 13 Feb 2009 10:23:25 +0200 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: References: <4535f6cd0902110846w1180516u7dfbf83ce8c87970@mail.gmail.com> <3EC78F9B-5873-4E10-9A1E-A38649F96B0F@uninet.ee> <4535f6cd0902111058x32bcaf64r8536c89ad9546cc1@mail.gmail.com> <9b08084c0902120753p4785d045l366c076330a3936f@mail.gmail.com> <489C6085-CC01-4C4D-BC84-BE26A9266324@scaldeferri.com> <20090212192832.GU23813@hezmatt.org> Message-ID: <426C6DFA-9359-4F0C-BAD8-D1E620BC0A14@gmail.com> On Feb 13, 2009, at 12:40 AM, Nick Gerakines wrote: > I'd like to step in and say that Erlang is an awesome platform for > writing web services. In fact, to back that statement up, I'll let you > metaphorically peak into how we are using it for just that. > > Here at EA we are building a pretty large web service powered by > Erlang to support different parts of the EA Online group. We've been > using tools like MochiWeb, etap (github.com/ngerakines/etap), protocol > buffers (github.com/ngerakines/erlang_protobuffs), dynomite > (github.com/cliffmoon/dynomite) (CAVEAT: it's unofficial/unimplemented > but we've got use cases that jive), log_roller > (github.com/JacobVorreuter/log_roller), ejabberd and list goes on. That's exactly what fess was talking about. Had you not mentioned these projects, no one would ever discover them (well, I would, but I run a Russian Erlang-related-news site, so I scour the web, blogs and mailing lists for news and bits and pieces of info) Erlang should really get a repositroy that is as ubiquitous and as easy to use as Ruby's gem or Perl's CPAN. Yes, there is a lot of utter crap in those repositories, but they are valuable for the fact that you can easily search and instal necessary modules. For instance, I can name at least three mutually incompatible JSON encoding/decoding libraries written for erlang (there are at least 5, I think). Definitely at least two libraries dealing with utf-8. Two OpenID projects. Two dedicated wrappers for traditional RDBMs (and a third, which is a more general ORM-style library). At least three (I think) projects that connect to Amazon's web services in one way or another. Two projects interfacing with memcached. And the list *will* grow. These are just projects I can name off the top of my head "Let a hundred flowers blossom" (c) Mao Zedong Quite often I don't think that authors of some of these project even now that similar projects exist. Forget the users, they will *never* even discover some of them :) -------------- next part -------------- An HTML attachment was scrubbed... URL: From boris.okner@REDACTED Fri Feb 13 09:27:29 2009 From: boris.okner@REDACTED (Boris Okner) Date: Fri, 13 Feb 2009 03:27:29 -0500 Subject: [erlang-questions] "Symmetrical" function Message-ID: This must be a trivial question, and it's probably more related to functional programming in general, rather then to Erlang. I have a function f(A,B) for which f(A,B) is ALWAYS equivalent to f(B,A). So I call it "symmetrical". Arguments A and B are patterns, and f is legal for some of combinations of A and B. So I have a (long) list of clauses like so: f(P1, P1) -> expr11; f(P1, P2) -> expr12; f(P1, P3) -> expr13; f(P2, P3) -> expr23; ....... f(Pm, Pn) -> expr_m_n; %Other pairs are illegal f(_, _) ->throw(illegalPairException). My problem that I don't want to manually write clauses like f(P2, P1), f(P3, P1) etc., because symmetrical cases would have been already described (i.e. f(P1, P2) is equivalent to f(P2,P1)). And I can't use f(A, B) -> f(B,A) because "illegal" clause already covers this case. Thank you for suggestions! From ulf.wiger@REDACTED Fri Feb 13 09:32:30 2009 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Fri, 13 Feb 2009 09:32:30 +0100 Subject: [erlang-questions] Human readable errors in lists module In-Reply-To: <21980676.post@talk.nabble.com> References: <23377730.10541234279344155.JavaMail.root@zimbra> <21980676.post@talk.nabble.com> Message-ID: <4995301E.2000303@ericsson.com> Zvi skrev: > I think instead of "fixing" lists:zipwith, it's better to add > parallel list comprehensions, i.e.: > > lists:zipwith(F, Xs, Ys) = [F(X,Y) || X<-Xs ; Y<-Ys]. > > Note ";" instead of ",". This is actually more difficult than it seems at first glance. I went through parallelization of lists:map/2 as an exercise in a recent presentation: http://ulf.wiger.net/weblog/wp-content/uploads/2009/01/damp09-erlang-multicore.pdf The things that need careful consideration are side-effects and exceptions. It's not obvious how a generic implementation should behave, as there is a cost/safety tradeoff. BR, Ulf W From michal.ptaszek@REDACTED Fri Feb 13 09:34:52 2009 From: michal.ptaszek@REDACTED (Michal Ptaszek) Date: Fri, 13 Feb 2009 08:34:52 +0000 (GMT) Subject: [erlang-questions] "Symmetrical" function In-Reply-To: Message-ID: <30702991.15211234514092726.JavaMail.root@zimbra> Maybe try this one: f(P1, P2) when P1 > P2 -> f1(P1, P2); f(P1, P2) -> f1(P2, P1). f1(P1, P1) -> expr11; f1(P1, P2) -> expr12; f1(P1, P3) -> expr13; f1(P2, P3) -> expr23; ....... f1(Pm, Pn) -> expr_m_n; ----- "Boris Okner" wrote: > This must be a trivial question, and it's probably more related to > functional programming in general, rather then to Erlang. > I have a function f(A,B) for which f(A,B) is ALWAYS equivalent to > f(B,A). So I call it "symmetrical". > Arguments A and B are patterns, and f is legal for some of > combinations of A and B. > So I have a (long) list of clauses like so: > f(P1, P1) -> expr11; > f(P1, P2) -> expr12; > f(P1, P3) -> expr13; > f(P2, P3) -> expr23; > ....... > f(Pm, Pn) -> expr_m_n; > > %Other pairs are illegal > f(_, _) ->throw(illegalPairException). > > My problem that I don't want to manually write clauses like f(P2, > P1), f(P3, P1) etc., because symmetrical cases would have been already > > described (i.e. f(P1, P2) is equivalent to f(P2,P1)). > And I can't use > f(A, B) -> f(B,A) > because "illegal" clause already covers this case. > > Thank you for suggestions! > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions Best regards, -- Michal Ptaszek www.erlang-consulting.com From bertil.karlsson@REDACTED Fri Feb 13 09:40:55 2009 From: bertil.karlsson@REDACTED (Bertil Karlsson) Date: Fri, 13 Feb 2009 09:40:55 +0100 Subject: [erlang-questions] Does Emakefile support ASN.1 files? In-Reply-To: References: <1234511147.4510.6.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Message-ID: <49953217.3080405@ericsson.com> What if you change the entry to for instance: {"SSWConn", [{outdir, "."},ber_bin]}. /Bertil Maxim Treskin wrote: > > > 2009/2/13 Bengt Kleberg > > > Greetings, > > Can you change the Emakefile to have your target first in the tuple? > > I have not worked with ASN1, but from what I know of Emakefiles the > first entry in the tuple should be the target (module). According > to the > compile documentation ASN1 files are the source for targets, not > targets. > > > Now my Emakefile is: > > {"SSWConn", [{outdir, "."}]}. > > There is SSWConn.asn file in directory. "erl -make" prints: > > $ erl -make > Recompile: SSWConn > ./SSWConn.erl:none: no such file or directory > > > BTW, for .erl files my Emakefile is: > {"src/*", [debug_info, {i, "../asn"}, {warn_format, 1}, {outdir, > "ebin"}]}. > > and all works fine. > > > -- > Maxim Treskin > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From zerthurd@REDACTED Fri Feb 13 09:46:26 2009 From: zerthurd@REDACTED (Maxim Treskin) Date: Fri, 13 Feb 2009 14:46:26 +0600 Subject: [erlang-questions] Does Emakefile support ASN.1 files? In-Reply-To: <49953217.3080405@ericsson.com> References: <1234511147.4510.6.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> <49953217.3080405@ericsson.com> Message-ID: 2009/2/13 Bertil Karlsson > What if you change the entry to for instance: > {"SSWConn", [{outdir, "."},ber_bin]}. > Same result -- Maxim Treskin -------------- next part -------------- An HTML attachment was scrubbed... URL: From nick@REDACTED Fri Feb 13 09:46:43 2009 From: nick@REDACTED (Nick Gerakines) Date: Fri, 13 Feb 2009 00:46:43 -0800 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <426C6DFA-9359-4F0C-BAD8-D1E620BC0A14@gmail.com> References: <4535f6cd0902110846w1180516u7dfbf83ce8c87970@mail.gmail.com> <3EC78F9B-5873-4E10-9A1E-A38649F96B0F@uninet.ee> <4535f6cd0902111058x32bcaf64r8536c89ad9546cc1@mail.gmail.com> <9b08084c0902120753p4785d045l366c076330a3936f@mail.gmail.com> <489C6085-CC01-4C4D-BC84-BE26A9266324@scaldeferri.com> <20090212192832.GU23813@hezmatt.org> <426C6DFA-9359-4F0C-BAD8-D1E620BC0A14@gmail.com> Message-ID: On Fri, Feb 13, 2009 at 12:23 AM, Dmitrii Dimandt wrote: > > On Feb 13, 2009, at 12:40 AM, Nick Gerakines wrote: > > I'd like to step in and say that Erlang is an awesome platform for > writing web services. In fact, to back that statement up, I'll let you > metaphorically peak into how we are using it for just that. > > Here at EA we are building a pretty large web service powered by > Erlang to support different parts of the EA Online group. We've been > using tools like MochiWeb, etap (github.com/ngerakines/etap), protocol > buffers (github.com/ngerakines/erlang_protobuffs), dynomite > (github.com/cliffmoon/dynomite) (CAVEAT: it's unofficial/unimplemented > but we've got use cases that jive), log_roller > (github.com/JacobVorreuter/log_roller), ejabberd and list goes on. > > That's exactly what fess was talking about. Had you not mentioned these > projects, no one would ever discover them (well, I would, but I run a > Russian Erlang-related-news site, so I scour the web, blogs and mailing > lists for news and bits and pieces of info) > Erlang should really get a repositroy that is as ubiquitous and as easy to > use as Ruby's gem or Perl's CPAN. Yes, there is a lot of utter crap in those > repositories, but they are valuable for the fact that you can easily search > and instal necessary modules. > For instance, I can name at least three mutually incompatible JSON > encoding/decoding libraries written for erlang (there are at least 5, I > think). Definitely at least two libraries dealing with utf-8. Two OpenID > projects. Two dedicated wrappers for traditional RDBMs (and a third, which > is a more general ORM-style library). At least three (I think) projects that > connect to Amazon's web services in one way or another. Two projects > interfacing with memcached. And the list *will* grow. These are just > projects I can name off the top of my head > "Let a hundred flowers blossom" (c) Mao Zedong > Quite often I don't think that authors of some of these project even now > that similar projects exist. Forget the users, they will *never* even > discover some of them :) I agree with what you are getting at. I would love it if there was some sort of standard packaging and installation system for Erlang. A gem equivalent or Module::Build, if you will. But there really isn't. At EA we've been using your standard `make`, `make test` and `make install` targets which works for what we want and is rpm/ebuild/deb friendly. I've been watching GitHub really grow with Erlang projects lately. That is where we put all of ours as well. # Nick Gerakines From zerthurd@REDACTED Fri Feb 13 09:56:59 2009 From: zerthurd@REDACTED (Maxim Treskin) Date: Fri, 13 Feb 2009 14:56:59 +0600 Subject: [erlang-questions] Does Emakefile support ASN.1 files? In-Reply-To: <49953217.3080405@ericsson.com> References: <1234511147.4510.6.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> <49953217.3080405@ericsson.com> Message-ID: There is expand/2 in make.erl, which handles only .erl files. I can make patch for handling .asn files too, but I don't know, which behaviour must be used here without conflicts with previous case. -- Maxim Treskin -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrad-direct-erlang@REDACTED Fri Feb 13 09:57:30 2009 From: mrad-direct-erlang@REDACTED (Michael Radford) Date: Fri, 13 Feb 2009 00:57:30 -0800 Subject: [erlang-questions] "Symmetrical" function In-Reply-To: References: Message-ID: <20090213085729.GA27293@herbie> If the patterns are of some form where you can always determine from the patterns alone when one of the two arguments is less than the other (and if you don't care about integer vs. float), you can use the term order: f (A, B) when A < B -> f_ordered (A, B); f (A, B) when A >= B -> f_ordered (B, A). f_ordered (P1, P1) -> expr11; f_ordered (P1, P2) -> expr12; ... But that won't work for patterns like: f ([_], [_,_]) -> 2; In that case, you could first map each argument to an atom individually using the same patterns, and then write the list of clauses in terms of the atoms: f (A, B) -> fp (p(A), p(B)). fp (A, B) when A < B -> fp_ordered (A, B); fp (A, B) when A >= B -> fp_ordered (B, A). p ([_]) -> p1; p ([_,_]) -> p2; fp_ordered (p1, p1) -> expr11; fp_ordered (p1, p2) -> expr12; ... Mike Boris Okner writes: > This must be a trivial question, and it's probably more related to > functional programming in general, rather then to Erlang. > I have a function f(A,B) for which f(A,B) is ALWAYS equivalent to > f(B,A). So I call it "symmetrical". > Arguments A and B are patterns, and f is legal for some of > combinations of A and B. > So I have a (long) list of clauses like so: > f(P1, P1) -> expr11; > f(P1, P2) -> expr12; > f(P1, P3) -> expr13; > f(P2, P3) -> expr23; > ....... > f(Pm, Pn) -> expr_m_n; > > %Other pairs are illegal > f(_, _) ->throw(illegalPairException). > > My problem that I don't want to manually write clauses like f(P2, > P1), f(P3, P1) etc., because symmetrical cases would have been already > described (i.e. f(P1, P2) is equivalent to f(P2,P1)). > And I can't use > f(A, B) -> f(B,A) > because "illegal" clause already covers this case. > > Thank you for suggestions! > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From raimo+erlang-questions@REDACTED Fri Feb 13 10:07:23 2009 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Fri, 13 Feb 2009 10:07:23 +0100 Subject: [erlang-questions] : Human readable errors in lists module In-Reply-To: <4995301E.2000303@ericsson.com> References: <23377730.10541234279344155.JavaMail.root@zimbra> <21980676.post@talk.nabble.com> <4995301E.2000303@ericsson.com> Message-ID: <20090213090723.GA1122@erix.ericsson.se> On Fri, Feb 13, 2009 at 09:32:30AM +0100, Ulf Wiger (TN/EAB) wrote: > Zvi skrev: > > I think instead of "fixing" lists:zipwith, it's better to add > > parallel list comprehensions, i.e.: > > > > lists:zipwith(F, Xs, Ys) = [F(X,Y) || X<-Xs ; Y<-Ys]. > > > > Note ";" instead of ",". > > > This is actually more difficult than it seems > at first glance. > Is not the suggestion that lists run in parallel, not execution. I.e in contrast to [F(X,Y) || X <- Xs, Y <- Ys] that will create a list of the result of calling F(X,Y) for every combination of X and Y from the lists Xs and Ys, [F(X,Y) || X <- Xs; Y <- Ys] would only call F(X,Y) for every pair X, Y from the same position in Xs and Ys, respectively. f(F, Xs, Ys) -> [F(X,Y) || X <- Xs, Y <- Ys]. <=> f(F, Xs, Ys) -> ff(F, Xs, Ys). ff(F, [X|Xs], Ys) -> fff(F, X, Ys); ff(_, [], _) -> []. fff(F, X, [Y|Ys]) -> [F(X,Y)|fff(F, X, Ys)]; fff(_, _, []) -> []. whereas f(F, Xs, Ys) -> [F(X,Y) || X <- Xs; Y <- Ys]. <=> f(F, [X|Xs], [Y|Ys]) -> [F(X,Y)|f(F, Xs, Ys); f(_, [], []) -> []. just like lists:zipwith/3. I think it is a neat idea to achieve a lists:zipwith/2.. but I do not know if it would work syntactically. Also, there will be arguments that a variant that produces a result list with the length of the shortest contributor is also desired, or prefered. So, to have this (list zip) as syntax may be to overdo things. > I went through parallelization of lists:map/2 > as an exercise in a recent presentation: > > http://ulf.wiger.net/weblog/wp-content/uploads/2009/01/damp09-erlang-multicore.pdf > > The things that need careful consideration are > side-effects and exceptions. It's not obvious how > a generic implementation should behave, as there is > a cost/safety tradeoff. > > BR, > Ulf W > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From jlprasantha@REDACTED Fri Feb 13 10:22:28 2009 From: jlprasantha@REDACTED (prasantha kumara) Date: Fri, 13 Feb 2009 14:52:28 +0530 Subject: [erlang-questions] httprequest using erlang Message-ID: Hi all! I am dealing with a erlang server which is accept http request from other frramework.i have sent a request to the server. following is the some code which i have used to do it. inet:setopts(Socket, [{active, once}]), receive % do something with the data you receive {tcp, Socket, Data} -> gen_tcp:send(Socket, "I Received " ++ Data), but when it is recieved from the java it gives following error. The server 127.0.0.1 failed to respond with a valid HTTP response at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1846) at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1590) at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:995) at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397) at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324) at httpRequest.Test.main(Test.java:24) Can any body help me to format the response correctly using erlang ? thanks prasantha. From ulf@REDACTED Fri Feb 13 10:59:04 2009 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 13 Feb 2009 10:59:04 +0100 Subject: [erlang-questions] : Human readable errors in lists module In-Reply-To: <20090213090723.GA1122@erix.ericsson.se> References: <23377730.10541234279344155.JavaMail.root@zimbra> <21980676.post@talk.nabble.com> <4995301E.2000303@ericsson.com> <20090213090723.GA1122@erix.ericsson.se> Message-ID: <8209f740902130159y7e291682ofb6499db6866859a@mail.gmail.com> 2009/2/13 Raimo Niskanen : > On Fri, Feb 13, 2009 at 09:32:30AM +0100, Ulf Wiger (TN/EAB) wrote: >> Zvi skrev: >> > I think instead of "fixing" lists:zipwith, it's better to add >> > parallel list comprehensions, i.e.: >> >> This is actually more difficult than it seems >> at first glance. >> > > Is not the suggestion that lists run in parallel, not execution. Of course. I was a bit hasty there... Sequence comprehensions in Cryptol are pretty cool: Rounds (State, (initialKey, rndKeys, finalKey)) = final where { istate = State ^ initialKey; rnds = [istate] # [| Round (state, key) | | state < - rnds | | key < - rndKeys | ]; final = FinalRound (last rnds, finalKey); }; "The value rnds is defined as a recursive sequence. The first element of the sequence is the value of istate. The second element is the result of applying the Round function on the first element of the rnds sequence (i.e. istate) and the first element of the rndKeys sequence. The third element of rnds is the result of applying the Round function on the second element of rnds (which is the result of the previous iteration) and the second element of rndKeys. This pattern continues until we exhaust rndKeys, at which point the sequence rnds is complete and its last element is the result of iterating the Round function once for each element of rndKeys." http://www.galois.com/files/Cryptol/Cryptol_Programming_Guide.pdf (page 46) There - both recursive and parallel list comprehensions. ;-) BR, Ulf W From vychodil.hynek@REDACTED Fri Feb 13 11:04:13 2009 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Fri, 13 Feb 2009 11:04:13 +0100 Subject: [erlang-questions] "Symmetrical" function In-Reply-To: References: Message-ID: <4d08db370902130204o251724beve202525d36187cfc@mail.gmail.com> You can try something like this f(A,B) -> try f1(A,B) catch error:function_clause -> f1(B,A) end. f1(P1, P1) -> expr11; f1(P1, P2) -> expr12; f1(P1, P3) -> expr13; f1(P2, P3) -> expr23; ....... f(Pm, Pn) -> expr_m_n. On Fri, Feb 13, 2009 at 9:27 AM, Boris Okner wrote: > This must be a trivial question, and it's probably more related to > functional programming in general, rather then to Erlang. > I have a function f(A,B) for which f(A,B) is ALWAYS equivalent to > f(B,A). So I call it "symmetrical". > Arguments A and B are patterns, and f is legal for some of > combinations of A and B. > So I have a (long) list of clauses like so: > f(P1, P1) -> expr11; > f(P1, P2) -> expr12; > f(P1, P3) -> expr13; > f(P2, P3) -> expr23; > ....... > f(Pm, Pn) -> expr_m_n; > > %Other pairs are illegal > f(_, _) ->throw(illegalPairException). > > My problem that I don't want to manually write clauses like f(P2, > P1), f(P3, P1) etc., because symmetrical cases would have been already > described (i.e. f(P1, P2) is equivalent to f(P2,P1)). > And I can't use > f(A, B) -> f(B,A) > because "illegal" clause already covers this case. > > Thank you for suggestions! > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try Good Data now for free: www.gooddata.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmitriid@REDACTED Fri Feb 13 11:15:49 2009 From: dmitriid@REDACTED (Dmitrii Dimandt) Date: Fri, 13 Feb 2009 12:15:49 +0200 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: References: <4535f6cd0902110846w1180516u7dfbf83ce8c87970@mail.gmail.com> <3EC78F9B-5873-4E10-9A1E-A38649F96B0F@uninet.ee> <4535f6cd0902111058x32bcaf64r8536c89ad9546cc1@mail.gmail.com> <9b08084c0902120753p4785d045l366c076330a3936f@mail.gmail.com> <489C6085-CC01-4C4D-BC84-BE26A9266324@scaldeferri.com> <20090212192832.GU23813@hezmatt.org> <426C6DFA-9359-4F0C-BAD8-D1E620BC0A14@gmail.com> Message-ID: > I've been watching GitHub really grow with Erlang projects lately. > That is where we put all of ours as well. > > # Nick Gerakines Yeah :) It should really be renamed into Erlangforge :) From vychodil.hynek@REDACTED Fri Feb 13 11:20:09 2009 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Fri, 13 Feb 2009 11:20:09 +0100 Subject: [erlang-questions] httprequest using erlang In-Reply-To: References: Message-ID: <4d08db370902130220ye7fbb6aqa65550ac7f458e90@mail.gmail.com> You should make HTTP response but you have made raw response directly to socket. Try this gen_tcp:send(Socket, ["HTTP/1.0 200 OK\r\nContent-Type:text/plain\r\n\r\nI Received ", Data]), On Fri, Feb 13, 2009 at 10:22 AM, prasantha kumara wrote: > Hi all! > I am dealing with a erlang server which is accept http request from > other frramework.i have sent a request to the server. following is the > some code which i have used to do it. > > inet:setopts(Socket, [{active, once}]), > receive > % do something with the data you receive > {tcp, Socket, Data} -> > gen_tcp:send(Socket, "I Received " ++ Data), > > but when it is recieved from the java it gives following error. > > > The server 127.0.0.1 failed to respond with a valid HTTP response > at > org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1846) > at > org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1590) > at > org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:995) > at > org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397) > at > org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170) > at > org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396) > at > org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324) > at httpRequest.Test.main(Test.java:24) > > > Can any body help me to format the response correctly using erlang ? > > thanks > prasantha. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try Good Data now for free: www.gooddata.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From michal.ptaszek@REDACTED Fri Feb 13 11:38:16 2009 From: michal.ptaszek@REDACTED (Michal Ptaszek) Date: Fri, 13 Feb 2009 10:38:16 +0000 (GMT) Subject: [erlang-questions] xmerl utf-8 encoding Message-ID: <17089046.15311234521496036.JavaMail.root@zimbra> Hi All, After the migration from R12B4 to R12B5 (xmerl version changed from 1.1.9 to 1.1.10) I have noticed something probably unwanted. During the document processing phase, the wfc_Legal_Character fatal error is thrown even if I use the proper header (). The previous version of xmerl was dealing with UTF-8 encoded characters flawlessly, the newest one unfortunately does not want to cooperate. Is it a xmerl bug/intended feature/my xmerl misunderstanding (if so, how to parse document containing UTF-8 encoded characters correctly)? Best regards, -- Michal Ptaszek www.erlang-consulting.com From mj@REDACTED Fri Feb 13 12:17:17 2009 From: mj@REDACTED (Mikkel Jensen) Date: Fri, 13 Feb 2009 12:17:17 +0100 Subject: [erlang-questions] xmerl utf-8 encoding In-Reply-To: <17089046.15311234521496036.JavaMail.root@zimbra> References: <17089046.15311234521496036.JavaMail.root@zimbra> Message-ID: I ran into the same problem in the latest release. I found out that if you tell the parser what encoding to expect like this: {Xml, _} = xmerl_scan:string(XmlString, [{encoding, "iso-10646-utf-1"}]), it will handle UTF-8 correctly. Of course it will only work if you know the encoding in advance. A better solution will be for the parser to understand the correct header and also default to UTF-8 like in the previous versions. - Mikkel On Fri, Feb 13, 2009 at 11:38 AM, Michal Ptaszek < michal.ptaszek@REDACTED> wrote: > Hi All, > > After the migration from R12B4 to R12B5 (xmerl version changed from 1.1.9 > to 1.1.10) > I have noticed something probably unwanted. > > During the document processing phase, the wfc_Legal_Character fatal error > is thrown even > if I use the proper header (). > > The previous version of xmerl was dealing with UTF-8 encoded characters > flawlessly, > the newest one unfortunately does not want to cooperate. > > Is it a xmerl bug/intended feature/my xmerl misunderstanding (if so, how to > parse document > containing UTF-8 encoded characters correctly)? > > Best regards, > -- > Michal Ptaszek > www.erlang-consulting.com > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jlprasantha@REDACTED Fri Feb 13 12:41:24 2009 From: jlprasantha@REDACTED (prasantha kumara) Date: Fri, 13 Feb 2009 17:11:24 +0530 Subject: [erlang-questions] get string from <<"string">> in erlang Message-ID: hi all i tried to authenticate the received request from erlang i recieved the follwing binary. <<"POST / HTTP/1.1\r\nCookie: x=y\r\nUser-Agent: Jakarta Commons-HttpClient/3.0.1\r\nHost: 127.0.0.1:9000\r\nContent-Length: 34\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\nUserName=prasantha&Password=abc123">>. ** exception error: no match of right hand side value <<"POST / HTTP/1.1\r\nCookie: x=y\r\nUser-Agent: Jakarta Commons-HttpClient/3.0.1\r\nHost: 127.0.0.1:9000\r\nContent-Length: 34"...>> i can split "POST / HTTP/1.1\r\nCookie: x=y\r\nUser-Agent: Jakarta Commons-HttpClient/3.0.1\r\nHost: 127.0.0.1:9000\r\nContent-Length: 34\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\nUserName=prasantha&Password=abc123">>. ** exception error: no match of right hand side value <<"POST / HTTP/1.1\r\nCookie: x=y\r\nUser-Agent: Jakarta Commons-HttpClient/3.0.1\r\nHost: 127.0.0.1:9000\r\nContent-Length: 34" using regexp:split(Request, "UserName=") request id the recived binary without the << and >>. but i cannot filter the the string without << >> signs.can any body help me to filter the string from the <<"string">>. thanking in advance. prasantha -------------- next part -------------- An HTML attachment was scrubbed... URL: From kunthar@REDACTED Fri Feb 13 12:42:09 2009 From: kunthar@REDACTED (Kunthar) Date: Fri, 13 Feb 2009 13:42:09 +0200 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: References: <4535f6cd0902110846w1180516u7dfbf83ce8c87970@mail.gmail.com> <4535f6cd0902111058x32bcaf64r8536c89ad9546cc1@mail.gmail.com> <9b08084c0902120753p4785d045l366c076330a3936f@mail.gmail.com> <489C6085-CC01-4C4D-BC84-BE26A9266324@scaldeferri.com> <20090212192832.GU23813@hezmatt.org> <426C6DFA-9359-4F0C-BAD8-D1E620BC0A14@gmail.com> Message-ID: <9a09ca9a0902130342k7932365ey182f7eedb112fc14@mail.gmail.com> I wish that all those fellas could combine efforts to bring one big hub for erlang; http://www.erlware.org/ http://cean.process-one.net/packages/index.yaws?action=all http://www.trapexit.org/Special:UserContributions (I would miss some more) I like FreeBSD way. If a project should be examined as located in monolithic structure, should be elected by main developers. If a project located in userland then users can submit to central repo to show their work to others. There should be a consensus about package usage, distribution and installation issues. I love git but it doesn't give me cean:display(installed) happiness. I do not want to waste my time to find a package for a one work. OTOH, world is parallel and each parallel worlds there are way too many details. I don't have to deal with all aspects of those bloody details. If i need a logger, fine then, can borrow from one fellow erlanger and use it. Sure that i can produce my own code and throw out for community too. If someone started to use Erlang, it means, they already smart enough, isn't it :-) Peace Kunthar On Fri, Feb 13, 2009 at 12:15 PM, Dmitrii Dimandt wrote: > >> I've been watching GitHub really grow with Erlang projects lately. >> That is where we put all of ours as well. >> >> # Nick Gerakines > > Yeah :) It should really be renamed into Erlangforge :) > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From mikpe@REDACTED Fri Feb 13 13:02:49 2009 From: mikpe@REDACTED (Mikael Pettersson) Date: Fri, 13 Feb 2009 13:02:49 +0100 Subject: [erlang-questions] '--' BIF to be used with caution? In-Reply-To: <7F891A10-777E-47D9-B6AC-96995D49F658@cs.otago.ac.nz> References: <707529930901130404y5418466bmc375525ef765e615@mail.gmail.com> <6672d0160902040248n4ef30e0cm4e4e0cb718a04349@mail.gmail.com> <707529930902050630l250a8ae4nedbfa71e5d63460e@mail.gmail.com> <13728F3E-6CF3-4B58-B55B-88950019D370@cs.otago.ac.nz> <4d08db370902100044y4ea7c5cbl5e3bb9cefb9caafa@mail.gmail.com> <4d08db370902110058y37db088bwfdab93d579e508d0@mail.gmail.com> <4d08db370902120237p14f61175pe9e128f2258f0312@mail.gmail.com> <7F891A10-777E-47D9-B6AC-96995D49F658@cs.otago.ac.nz> Message-ID: <18837.24937.453044.208389@harpo.it.uu.se> Richard O'Keefe writes: > HiPE makes more use of -- than I expected; > anyone in the HiPE team care to comment? Only that numerous people with different programming style preferences have been involved in the development of HiPE. Are there any particular uses of -- that you find questionable? (I'm always keen on eliminating useless overheads.) From adam@REDACTED Fri Feb 13 13:37:38 2009 From: adam@REDACTED (Adam Lindberg) Date: Fri, 13 Feb 2009 12:37:38 +0000 (GMT) Subject: [erlang-questions] "Symmetrical" function In-Reply-To: Message-ID: <15720446.15631234528658100.JavaMail.root@zimbra> A macro perhaps? -define(f(Pm, Pn, Expr_m_n), f(Pm, Pn) -> Expr_m_n; f(Pn, Pm) -> f(Pm, Pn)). So for the clause where the same patter exists twice you would write normally: f(P1, P1) -> expr11; And for the other clauses where you need symmetry you would write: ?f(P1, P2, expr12); Cheers, Adam ----- "Boris Okner" wrote: > This must be a trivial question, and it's probably more related to > functional programming in general, rather then to Erlang. > I have a function f(A,B) for which f(A,B) is ALWAYS equivalent to > f(B,A). So I call it "symmetrical". > Arguments A and B are patterns, and f is legal for some of > combinations of A and B. > So I have a (long) list of clauses like so: > f(P1, P1) -> expr11; > f(P1, P2) -> expr12; > f(P1, P3) -> expr13; > f(P2, P3) -> expr23; > ....... > f(Pm, Pn) -> expr_m_n; > > %Other pairs are illegal > f(_, _) ->throw(illegalPairException). > > My problem that I don't want to manually write clauses like f(P2, > P1), f(P3, P1) etc., because symmetrical cases would have been already > > described (i.e. f(P1, P2) is equivalent to f(P2,P1)). > And I can't use > f(A, B) -> f(B,A) > because "illegal" clause already covers this case. > > Thank you for suggestions! > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From vychodil.hynek@REDACTED Fri Feb 13 13:42:36 2009 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Fri, 13 Feb 2009 13:42:36 +0100 Subject: [erlang-questions] get string from <<"string">> in erlang In-Reply-To: References: Message-ID: <4d08db370902130442v68225526v205f3d683b93bd43@mail.gmail.com> try binary_to_list/1 2009/2/13 prasantha kumara > hi all i tried to authenticate the received request from erlang > i recieved the follwing binary. > <<"POST / HTTP/1.1\r\nCookie: x=y\r\nUser-Agent: Jakarta > Commons-HttpClient/3.0.1\r\nHost: 127.0.0.1:9000\r\nContent-Length: > 34\r\nContent-Type: > application/x-www-form-urlencoded\r\n\r\nUserName=prasantha&Password=abc123">>. > ** exception error: no match of right hand side value <<"POST / > HTTP/1.1\r\nCookie: x=y\r\nUser-Agent: Jakarta > Commons-HttpClient/3.0.1\r\nHost: 127.0.0.1:9000\r\nContent-Length: > 34"...>> > > > i can split "POST / HTTP/1.1\r\nCookie: x=y\r\nUser-Agent: Jakarta > Commons-HttpClient/3.0.1\r\nHost: 127.0.0.1:9000\r\nContent-Length: > 34\r\nContent-Type: > application/x-www-form-urlencoded\r\n\r\nUserName=prasantha&Password=abc123">>. > ** exception error: no match of right hand side value <<"POST / > HTTP/1.1\r\nCookie: x=y\r\nUser-Agent: Jakarta > Commons-HttpClient/3.0.1\r\nHost: 127.0.0.1:9000\r\nContent-Length: 34" > using > regexp:split(Request, "UserName=") > > request id the recived binary without the << and >>. > > but i cannot filter the the string without << >> > signs.can any body help me to filter the string from the <<"string">>. > > > thanking in advance. > prasantha > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try Good Data now for free: www.gooddata.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam@REDACTED Fri Feb 13 13:48:20 2009 From: adam@REDACTED (Adam Lindberg) Date: Fri, 13 Feb 2009 12:48:20 +0000 (GMT) Subject: [erlang-questions] get string from <<"string">> in erlang In-Reply-To: <23032732.15691234529098715.JavaMail.root@zimbra> Message-ID: <28837957.15711234529300508.JavaMail.root@zimbra> I don't know if it is exactly what you're after, but: "string" = binary_to_list(<<"string">>). That converts a binary to a string. Cheers, Adam ----- "prasantha kumara" wrote: > hi all i tried to authenticate the received request from erlang > i recieved the follwing binary. > <<"POST / HTTP/1.1\r\nCookie: x=y\r\nUser-Agent: Jakarta > Commons-HttpClient/3.0.1\r\nHost: 127.0.0.1:9000\r\nContent-Length: > 34\r\nContent-Type: > application/x-www-form-urlencoded\r\n\r\nUserName=prasantha&Password=abc123">>. > ** exception error: no match of right hand side value <<"POST / > HTTP/1.1\r\nCookie: x=y\r\nUser-Agent: Jakarta > Commons-HttpClient/3.0.1\r\nHost: 127.0.0.1:9000\r\nContent-Length: > 34"...>> > > > i can split "POST / HTTP/1.1\r\nCookie: x=y\r\nUser-Agent: Jakarta > Commons-HttpClient/3.0.1\r\nHost: 127.0.0.1:9000\r\nContent-Length: > 34\r\nContent-Type: > application/x-www-form-urlencoded\r\n\r\nUserName=prasantha&Password=abc123">>. > ** exception error: no match of right hand side value <<"POST / > HTTP/1.1\r\nCookie: x=y\r\nUser-Agent: Jakarta > Commons-HttpClient/3.0.1\r\nHost: 127.0.0.1:9000\r\nContent-Length: > 34" > using > regexp:split(Request, "UserName=") > > request id the recived binary without the << and >>. > > but i cannot filter the the string without << >> > signs.can any body help me to filter the string from the > <<"string">>. > > > thanking in advance. > prasantha > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From bekesa@REDACTED Fri Feb 13 14:00:04 2009 From: bekesa@REDACTED (Andras Georgy Bekes) Date: Fri, 13 Feb 2009 14:00:04 +0100 Subject: [erlang-questions] "Symmetrical" function In-Reply-To: <30702991.15211234514092726.JavaMail.root@zimbra> References: <30702991.15211234514092726.JavaMail.root@zimbra> Message-ID: <200902131400.06445.bekesa@sch.bme.hu> > Maybe try this one: > > f(P1, P2) when P1 > P2 -> > f1(P1, P2); > f(P1, P2) -> > f1(P2, P1). Bad idea. Comparing might take very long time! With this you can convert a function with runtime proportional to pattern size to a function with runtime proportional to parameter size. Try this: N=10000000, lists:seq(1,N) > lists:seq(1,N+1). It will also block the whole VM (one scheduler) for an arbitary time. See http://www.erlang.org/pipermail/erlang-questions/2008-March/033838.html Note that term comparisons like > are BIFs, just like '--'. I think the right solution for the problem is using macros: %%%%%%%%%%%%%%%%%%%%%%%%%%%% -define(fSYM(P1,P2,Result), f(P1,P2)->Result; f(P2,P1)->Result ). % XOR function ?fSYM(0,1,1); f(X,X)->0. %%%%%%%%%%%%%%%%%%%%%%%%%%%% Of course you can parametrise the macro with the function name as well. Georgy From exta7@REDACTED Fri Feb 13 16:07:04 2009 From: exta7@REDACTED (Zvi) Date: Fri, 13 Feb 2009 07:07:04 -0800 (PST) Subject: [erlang-questions] Human readable errors in lists module In-Reply-To: <4995301E.2000303@ericsson.com> References: <23377730.10541234279344155.JavaMail.root@zimbra> <21980676.post@talk.nabble.com> <4995301E.2000303@ericsson.com> Message-ID: <21998151.post@talk.nabble.com> I was talking about parallel-comprehensions aka zip-comprehensions, not parallelized comprehensions: http://en.wikipedia.org/wiki/List_comprehension#Parallel_list_comprehension Zvi Ulf Wiger (TN/EAB) wrote: > > Zvi skrev: >> I think instead of "fixing" lists:zipwith, it's better to add >> parallel list comprehensions, i.e.: >> >> lists:zipwith(F, Xs, Ys) = [F(X,Y) || X<-Xs ; Y<-Ys]. >> >> Note ";" instead of ",". > > > This is actually more difficult than it seems > at first glance. > > I went through parallelization of lists:map/2 > as an exercise in a recent presentation: > > http://ulf.wiger.net/weblog/wp-content/uploads/2009/01/damp09-erlang-multicore.pdf > > The things that need careful consideration are > side-effects and exceptions. It's not obvious how > a generic implementation should behave, as there is > a cost/safety tradeoff. > > BR, > Ulf W > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- View this message in context: http://www.nabble.com/Human-readable-errors-in-lists-module-tp21936024p21998151.html Sent from the Erlang Questions mailing list archive at Nabble.com. From csaba.hoch@REDACTED Fri Feb 13 16:10:33 2009 From: csaba.hoch@REDACTED (Csaba Hoch) Date: Fri, 13 Feb 2009 16:10:33 +0100 Subject: [erlang-questions] Is there any erlang code formatting tool? In-Reply-To: <4987E836.2070608@gmail.com> References: <4987E836.2070608@gmail.com> Message-ID: <49958D69.1030105@gmail.com> Liu Yubao wrote: > I prefer Vim to edit and Emacs to format erlang code but > switching between two editors is very inconvenient. Is > there any erlang code formatting tool? Or how can I use emacs > to format erlang source files in batch? Hi, If you put this in your .vimrc, you can ask Emacs to indent the file that you are editing by typing :IndentErl. command! IndentErl call IndentErlangWithEmacs() function! IndentErlangWithEmacs() exec '!emacs --eval "(progn (find-file \"' . expand('%:p') . '\")' . \ '(erlang-indent-current-buffer) (save-buffer) '. \ '(save-buffers-kill-emacs))"' endfunction Csaba From kevin@REDACTED Fri Feb 13 16:45:21 2009 From: kevin@REDACTED (Kevin Scaldeferri) Date: Fri, 13 Feb 2009 07:45:21 -0800 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <40429b0e-837d-4c88-9222-25b1feab88e3@33g2000yqm.googlegroups.com> References: <4535f6cd0902110846w1180516u7dfbf83ce8c87970@mail.gmail.com> <3EC78F9B-5873-4E10-9A1E-A38649F96B0F@uninet.ee> <4535f6cd0902111058x32bcaf64r8536c89ad9546cc1@mail.gmail.com> <9b08084c0902120753p4785d045l366c076330a3936f@mail.gmail.com> <489C6085-CC01-4C4D-BC84-BE26A9266324@scaldeferri.com> <20090212192832.GU23813@hezmatt.org> <5ea453f90902121439q1da3ee37vcccc72cad8ec83fa@mail.gmail.com> <40429b0e-837d-4c88-9222-25b1feab88e3@33g2000yqm.googlegroups.com> Message-ID: When I mentioned XML parsers as an example of something you do not want to write yourself, I didn't intend for anyone to think I was suggesting using XML for internal data storage. So, if you never have to worry about document exchange with an external party in an XML format, consider yourself fortunate and pass over that example. The sort of work I do often involves this requirement, though, and virtually every time the other party has decided to use some "interesting" corner of the XML spec, and I'm thankful someone else already wrote the library to handle it. -kevin On Feb 12, 2009, at 11:06 PM, Steve Davis wrote: > > Dave, I respectfully offer you my "Joe sez: XML is for Docs not Apps!" > t-shirt (tm), as I think you will appreciate it :) > > Good to see common sense making an ever more vocal comeback! > > > On Feb 12, 4:39 pm, Dave Smith wrote: >> I try to avoid XML altogether if I can. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From erlang@REDACTED Fri Feb 13 16:54:09 2009 From: erlang@REDACTED (Joe Armstrong) Date: Fri, 13 Feb 2009 16:54:09 +0100 Subject: [erlang-questions] Human readable errors in lists module In-Reply-To: References: <31309437.10521234279023327.JavaMail.root@zimbra> <23377730.10541234279344155.JavaMail.root@zimbra> <9b08084c0902101346r166b4b77l14e68ac0dc2e6b8b@mail.gmail.com> Message-ID: <9b08084c0902130754r5ab79ad0l6726495985e0c7a1@mail.gmail.com> An idiom I use quite a lot is: top(Arg1, Arg2) -> try begin {ok, S} = foo:bar(....), {X, Y} = baz(A, S), On Thu, Feb 12, 2009 at 6:52 PM, Steve Davis wrote: > If you are coming from java et al. the "let it crash" style is > actually quite hard to get used to at first. Defensive programming is > a strong habit and it is a good habit when writing java/cpp etc. But > with Erlang, the "let it crash" style is absolutely the *right thing > to do*. You will soon realize that this is a liberating license to > write the kind of aggressive code that would love to be able to write > in java/php/c/younameit --- when you get used to it you will enjoy > programming more and will find your productivity soaring! > > /s > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From erlang@REDACTED Fri Feb 13 17:00:23 2009 From: erlang@REDACTED (Joe Armstrong) Date: Fri, 13 Feb 2009 17:00:23 +0100 Subject: [erlang-questions] Human readable errors in lists module In-Reply-To: <9b08084c0902130754r5ab79ad0l6726495985e0c7a1@mail.gmail.com> References: <31309437.10521234279023327.JavaMail.root@zimbra> <23377730.10541234279344155.JavaMail.root@zimbra> <9b08084c0902101346r166b4b77l14e68ac0dc2e6b8b@mail.gmail.com> <9b08084c0902130754r5ab79ad0l6726495985e0c7a1@mail.gmail.com> Message-ID: <9b08084c0902130800y2fac3e17p7cce9303c9e23fa4@mail.gmail.com> Sorry the last mail got sent early I use this idiom top(Arg1, Arg2) -> ? ? try ? ? ? ? ?begin ? ? ? ? ? ? ? ? ?{ok, S} = foo(....), ? ? ? ? ? ? ? ? ?{X, Y} = bar(A, S), .... end catch _:X -> io:format("~p OOps~n",[X] end. The code between begin and end is written with no regard to errors the foos and bars are written with no regard to errors. top(...) either succeed or fails with an error message. Does that remind you of something? - It should. It's a tr..... Think of the code as a transaction that succeeds or fails with an error message Were did we write the unit tests and the assertions (answer: in the pattern matches that might fail) /Joe Armstrong > > > On Thu, Feb 12, 2009 at 6:52 PM, Steve Davis > wrote: >> If you are coming from java et al. the "let it crash" style is >> actually quite hard to get used to at first. Defensive programming is >> a strong habit and it is a good habit when writing java/cpp etc. But >> with Erlang, the "let it crash" style is absolutely the *right thing >> to do*. You will soon realize that this is a liberating license to >> write the kind of aggressive code that would love to be able to write >> in java/php/c/younameit --- when you get used to it you will enjoy >> programming more and will find your productivity soaring! >> >> /s >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > From kevin@REDACTED Fri Feb 13 16:46:13 2009 From: kevin@REDACTED (Kevin Scaldeferri) Date: Fri, 13 Feb 2009 07:46:13 -0800 Subject: [erlang-questions] httprequest using erlang In-Reply-To: <4d08db370902130220ye7fbb6aqa65550ac7f458e90@mail.gmail.com> References: <4d08db370902130220ye7fbb6aqa65550ac7f458e90@mail.gmail.com> Message-ID: <0639A802-D48E-47FB-8B92-23709275E96B@scaldeferri.com> Why don't you use one of the existing HTTP server implementations? -kevin On Feb 13, 2009, at 2:20 AM, Hynek Vychodil wrote: > You should make HTTP response but you have made raw response > directly to socket. > > Try this > > gen_tcp:send(Socket, ["HTTP/1.0 200 OK\r\nContent-Type:text/plain\r\n > \r\nI Received ", Data]), > > On Fri, Feb 13, 2009 at 10:22 AM, prasantha kumara > wrote: > Hi all! > I am dealing with a erlang server which is accept http request from > other frramework.i have sent a request to the server. following is the > some code which i have used to do it. > > inet:setopts(Socket, [{active, once}]), > receive > % do something with the data you receive > {tcp, Socket, Data} -> > gen_tcp:send(Socket, "I Received " ++ Data), > > but when it is recieved from the java it gives following error. > > > The server 127.0.0.1 failed to respond with a valid HTTP response > at > org > .apache > .commons > .httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1846) > at > org > .apache > .commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java: > 1590) > at > org > .apache > .commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:995) > at > org > .apache > .commons > .httpclient > .HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397) > at > org > .apache > .commons > .httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java: > 170) > at > org > .apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java: > 396) > at > org > .apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java: > 324) > at httpRequest.Test.main(Test.java:24) > > > Can any body help me to format the response correctly using erlang ? > > thanks > prasantha. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > -- > --Hynek (Pichi) Vychodil > > Analyze your data in minutes. Share your insights instantly. Thrill > your boss. Be a data hero! > Try Good Data now for free: www.gooddata.com > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From sten.gruener@REDACTED Fri Feb 13 19:40:37 2009 From: sten.gruener@REDACTED (Sten Gruener) Date: Fri, 13 Feb 2009 18:40:37 +0000 Subject: [erlang-questions] Undefined function call kills linked-in driver. Message-ID: Hello group, we are developing a linked-in driver. Unfortunately calling *any* undefined function causes the linked driver to die. Is it an Erlang bug? Are there any workouts? Greetings, Sten -------------- next part -------------- An HTML attachment was scrubbed... URL: From pfisher@REDACTED Fri Feb 13 19:46:16 2009 From: pfisher@REDACTED (Paul Fisher) Date: Fri, 13 Feb 2009 12:46:16 -0600 Subject: [erlang-questions] Undefined function call kills linked-in driver. In-Reply-To: References: Message-ID: <4995BFF8.9080005@alertlogic.net> Sten Gruener wrote: > Hello group, > > we are developing a linked-in driver. Unfortunately calling *any* > undefined function causes the linked driver to die. Is it an Erlang bug? > Are there any workouts? I'm guess at what is going on for you here, but this is probably what is happening... If the port owning process terminates (for example with a undef as suggest,) the port instance will be closed. If you want the port instance to remain available then you would need to have it owned by another process, and use driver_send_term() to send replies to non-owner processes making requests. -- paul From sten.gruener@REDACTED Fri Feb 13 21:05:40 2009 From: sten.gruener@REDACTED (Sten Gruener) Date: Fri, 13 Feb 2009 22:05:40 +0200 Subject: [erlang-questions] Undefined function call kills linked-in driver. In-Reply-To: <4995BFF8.9080005@alertlogic.net> References: <4995BFF8.9080005@alertlogic.net> Message-ID: Hello paul, the port owning process is the erl shell. It imho does not terminate with undef. Greetings, Sten 2009/2/13 Paul Fisher > Sten Gruener wrote: > >> Hello group, >> >> we are developing a linked-in driver. Unfortunately calling *any* >> undefined function causes the linked driver to die. Is it an Erlang bug? Are >> there any workouts? >> > > I'm guess at what is going on for you here, but this is probably what is > happening... > > If the port owning process terminates (for example with a undef as > suggest,) the port instance will be closed. If you want the port instance > to remain available then you would need to have it owned by another process, > and use driver_send_term() to send replies to non-owner processes making > requests. > > > -- > paul > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tsuraan@REDACTED Fri Feb 13 21:44:50 2009 From: tsuraan@REDACTED (tsuraan) Date: Fri, 13 Feb 2009 14:44:50 -0600 Subject: [erlang-questions] Undefined function call kills linked-in driver. In-Reply-To: References: <4995BFF8.9080005@alertlogic.net> Message-ID: <84fb38e30902131244u7b3c7437x25557440a63a1d90@mail.gmail.com> > Hello paul, > > the port owning process is the erl shell. It imho does not terminate with > undef. Try it out: Erlang (BEAM) emulator version 5.6.1 [source] [smp:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.6.1 (abort with ^G) 1> self(). <0.31.0> 2> foo(). ** exception error: undefined function shell_default:foo/0 3> self(). <0.34.0> When you typo in the shell, that process dies and a new one is started. From pfisher@REDACTED Fri Feb 13 21:10:41 2009 From: pfisher@REDACTED (Paul Fisher) Date: Fri, 13 Feb 2009 14:10:41 -0600 Subject: [erlang-questions] Undefined function call kills linked-in driver. In-Reply-To: References: <4995BFF8.9080005@alertlogic.net> Message-ID: <4995D3C1.7070500@alertlogic.net> Sten Gruener wrote: > Hello paul, > > the port owning process is the erl shell. It imho does not terminate > with undef. Yes it does... that's how the shell handles the undef exception. It fails the original shell process and then is restarted transparently. Do a self() b4 the error, then self() after the error to see. Welcome to the erlang shell! -- paul From tobbe@REDACTED Sat Feb 14 00:13:28 2009 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Sat, 14 Feb 2009 00:13:28 +0100 Subject: [erlang-questions] Is there any erlang code formatting tool? References: <4987E836.2070608@gmail.com> <49958D69.1030105@gmail.com> Message-ID: <873aeij5gn.fsf@sej.hq.kred> Csaba Hoch writes: > Liu Yubao wrote: >> I prefer Vim to edit and Emacs to format erlang code but >> switching between two editors is very inconvenient. Is >> there any erlang code formatting tool? Or how can I use emacs >> to format erlang source files in batch? Have a look here: http://blog.tornkvist.org/blog.yaws?id=1233867602690448 --Tobbe > > Hi, > > If you put this in your .vimrc, you can ask Emacs to indent the file > that you are editing by typing :IndentErl. > > command! IndentErl call IndentErlangWithEmacs() > > function! IndentErlangWithEmacs() > exec '!emacs --eval "(progn (find-file \"' . expand('%:p') . '\")' . > \ '(erlang-indent-current-buffer) (save-buffer) '. > \ '(save-buffers-kill-emacs))"' > endfunction > > Csaba -- KREDITOR EUROPE AB S:t Eriksgatan 117 SE-113 43 Stockholm, Sweden Tel: +46(0)8-120 120 00 Fax: +46(0)8-120 120 99 Email: torbjorn.tornkvist@REDACTED Web: www.kreditor.se From steve.e.123@REDACTED Sat Feb 14 05:04:41 2009 From: steve.e.123@REDACTED (steve ellis) Date: Fri, 13 Feb 2009 23:04:41 -0500 Subject: [erlang-questions] Concurrent requests with ibrowse Message-ID: <4cb4a7bf0902132004v3881a615j88ad193bdbcb4bbe@mail.gmail.com> We're trying to build an app that uses ibrowse to make concurrent requests. We are not able to get more than a few concurrent requests at a time to return successfully. We repeatedly get "conn_failed" (when we know the sites are available). It seems like we are running out of sockets when we loop through our list of URLs. Here's how it happens. We start ibrowse and run our test code. The first loop of about 60 requests so goes fine. A few seconds later, a second loop returns fewer; the third loop fewer still. The more requests we make, the fewer successful requests we have. Others appear to have had this problem (see http://www.trapexit.org/forum/viewtopic.php?p=44231). We've tried tweaking the settings of two machines with different distros (openSUSE 10.3 and Fedora Core 4). After making the adjustments on each machine, csh limit says we have 30000 descriptors (set through a modification we made to /etc/security/limits.conf. The /etc/sysctl.conf file has the following settings. net.ipv4.conf.all.rp_filter = 1 #net.ipv6.conf.all.forwarding = 1 fs.inotify.max_user_watches = 65536 net.core.rmem_max = 16777216 net.core.wmem_max = 16777216 net.ipv4.tcp_rmem = 4096 87380 16777216 net.ipv4.tcp_wmem = 4096 65536 16777216 net.ipv4.tcp_syncookies = 1 net.ipv4.ip_local_port_range = 1024 4999 net.ipv4.tcp_mem = 50576 64768 98152 net.core.netdev_max_backlog = 2500 kern.maxfiles = 25000 kern.maxfilesperproc = 20000 We'd be happy if we could get a few thousand requests to return successfully. What are we doing wrong? Here is one way we have tried invoking ibrowse (probably the simplest). -module(test7). -export([run/0, send_reqs/0, do_send_req/1]). run() -> proc_lib:spawn(?MODULE, send_reqs, []). some_urls() -> ["http://www.url1.com", "http://www.url2.com" %% and so on... ]. send_reqs() -> spawn_workers(some_urls()). spawn_workers(Urls) -> lists:foreach(fun do_spawn/1, Urls). do_spawn(Url) -> proc_lib:spawn_link(?MODULE, do_send_req, [Url]). do_send_req(Url) -> Result = (catch ibrowse:send_req(Url, [], get, [], [], 10000)), case Result of {ok, SCode, _H, _B} -> io:format("~p ~p~n", [Url, SCode]); Err -> io:format("~p~p~n", [Url, Err]) end. Here are some references that have helped us get this far (which unfortunately isn't that far at all). :) Sockets/File Descriptors http://oscar.hellstrom.st/blog/2007/04/benchmarking-with-tsung http://www.cs.uwaterloo.ca/~brecht/servers/openfiles.html TCP http://www.metabrew.com/article/tag/http/ http://ipsysctl-tutorial.frozentux.net/ipsysctl-tutorial.html Any help will be much appreciated! Steve -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Sat Feb 14 08:19:11 2009 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sat, 14 Feb 2009 02:19:11 -0500 Subject: [erlang-questions] Concurrent requests with ibrowse In-Reply-To: <4cb4a7bf0902132004v3881a615j88ad193bdbcb4bbe@mail.gmail.com> References: <4cb4a7bf0902132004v3881a615j88ad193bdbcb4bbe@mail.gmail.com> Message-ID: <6c2563b20902132319r5b4896dem79ddca3802c7e757@mail.gmail.com> You may be having an ephemeral port starvation problem. Try increasing the number of local ports: sudo /sbin/sysctl -w net.ipv4.ip_local_port_range='1024 65535' If that doesn't help, try decreasing TIME_WAIT (but first read http://www.erlang.org/pipermail/erlang-questions/2008-September/038154.htmland http://www.developerweb.net/forum/showthread.php?t=2941). # Set TIME_WAIT timeout to 30 seconds instead of 120 sudo /sbin/sysctl -w net.ipv4.tcp_fin_timeout=30 2009/2/13 steve ellis > We're trying to build an app that uses ibrowse to make concurrent requests. > We are not able to get more than a few concurrent requests at a time to > return successfully. We repeatedly get "conn_failed" (when we know the sites > are available). It seems like we are running out of sockets when we loop > through our list of URLs. > > Here's how it happens. We start ibrowse and run our test code. The first > loop of about 60 requests so goes fine. A few seconds later, a second loop > returns fewer; the third loop fewer still. The more requests we make, the > fewer successful requests we have. > > Others appear to have had this problem (see > http://www.trapexit.org/forum/viewtopic.php?p=44231). We've tried tweaking > the settings of two machines with different distros (openSUSE 10.3 and > Fedora Core 4). After making the adjustments on each machine, csh limit says > we have 30000 descriptors (set through a modification we made to > /etc/security/limits.conf. The /etc/sysctl.conf file has the following > settings. > > net.ipv4.conf.all.rp_filter = 1 > #net.ipv6.conf.all.forwarding = 1 > fs.inotify.max_user_watches = 65536 > net.core.rmem_max = 16777216 > net.core.wmem_max = 16777216 > net.ipv4.tcp_rmem = 4096 87380 16777216 > net.ipv4.tcp_wmem = 4096 65536 16777216 > net.ipv4.tcp_syncookies = 1 > net.ipv4.ip_local_port_range = 1024 4999 > net.ipv4.tcp_mem = 50576 64768 98152 > net.core.netdev_max_backlog = 2500 > kern.maxfiles = 25000 > kern.maxfilesperproc = 20000 > > We'd be happy if we could get a few thousand requests to return > successfully. What are we doing wrong? > > Here is one way we have tried invoking ibrowse (probably the simplest). > > -module(test7). > -export([run/0, send_reqs/0, do_send_req/1]). > > run() -> > proc_lib:spawn(?MODULE, send_reqs, []). > > some_urls() -> > ["http://www.url1.com", > "http://www.url2.com" > %% and so on... > ]. > send_reqs() -> > spawn_workers(some_urls()). > > spawn_workers(Urls) -> > lists:foreach(fun do_spawn/1, Urls). > > do_spawn(Url) -> > proc_lib:spawn_link(?MODULE, do_send_req, [Url]). > > do_send_req(Url) -> > Result = (catch ibrowse:send_req(Url, [], get, [], [], 10000)), > case Result of > {ok, SCode, _H, _B} -> > io:format("~p ~p~n", [Url, SCode]); > Err -> > io:format("~p~p~n", [Url, Err]) > end. > > Here are some references that have helped us get this far (which > unfortunately isn't that far at all). :) > > Sockets/File Descriptors > http://oscar.hellstrom.st/blog/2007/04/benchmarking-with-tsung > http://www.cs.uwaterloo.ca/~brecht/servers/openfiles.html > > TCP > http://www.metabrew.com/article/tag/http/ > http://ipsysctl-tutorial.frozentux.net/ipsysctl-tutorial.html > > Any help will be much 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 ulf@REDACTED Sat Feb 14 09:40:51 2009 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 14 Feb 2009 09:40:51 +0100 Subject: [erlang-questions] Human readable errors in lists module In-Reply-To: <21998151.post@talk.nabble.com> References: <23377730.10541234279344155.JavaMail.root@zimbra> <21980676.post@talk.nabble.com> <4995301E.2000303@ericsson.com> <21998151.post@talk.nabble.com> Message-ID: <8209f740902140040j7e4aab91x49776961e8b2bd38@mail.gmail.com> Yes, I caught that after having posted. I thought I had already commented on that, but perhaps it didn't go to the list? Oh, well... I posted a suggestion on this a while ago: http://erlang.org/pipermail/erlang-questions/2004-November/013637.html BR, Ulf W 2009/2/13 Zvi : > > I was talking about parallel-comprehensions aka zip-comprehensions, not > parallelized comprehensions: > > http://en.wikipedia.org/wiki/List_comprehension#Parallel_list_comprehension > > Zvi > > > Ulf Wiger (TN/EAB) wrote: >> >> Zvi skrev: >>> I think instead of "fixing" lists:zipwith, it's better to add >>> parallel list comprehensions, i.e.: >>> >>> lists:zipwith(F, Xs, Ys) = [F(X,Y) || X<-Xs ; Y<-Ys]. >>> >>> Note ";" instead of ",". >> >> >> This is actually more difficult than it seems >> at first glance. >> >> I went through parallelization of lists:map/2 >> as an exercise in a recent presentation: >> >> http://ulf.wiger.net/weblog/wp-content/uploads/2009/01/damp09-erlang-multicore.pdf >> >> The things that need careful consideration are >> side-effects and exceptions. It's not obvious how >> a generic implementation should behave, as there is >> a cost/safety tradeoff. >> >> BR, >> Ulf W >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> > > -- > View this message in context: http://www.nabble.com/Human-readable-errors-in-lists-module-tp21936024p21998151.html > Sent from the Erlang Questions mailing list archive at Nabble.com. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From ssroy1979@REDACTED Sat Feb 14 17:24:01 2009 From: ssroy1979@REDACTED (Salonee Sinha Roy) Date: Sat, 14 Feb 2009 08:24:01 -0800 Subject: [erlang-questions] erlang2facebook freinds_get is failing Message-ID: Hi All I am trying to write a facebook app. My code for calling erlang2facebook method facebook:friends_get/1 is {friends_get_Response,Attrs,[X]} = facebook:friends_get(Session), I get the following errror from yaws ERROR erlang code crashed: File: /home/owner/Desktop/erlang/yaws/mask/friends.yaws:3 Reason: {noproc, {gen_server,call, [httpc_manager, {request, {request,undefined,<0.71.0>,0,http, {"api.facebook.com",80}, "/restserver.php",[],post, {http_request_h,undefined,"keep-alive",undefined, undefined,undefined,undefined,undefined, undefined,undefined,undefined,undefined, undefined,undefined,undefined,undefined, undefined,"api.facebook.com ",undefined,undefined, undefined,undefined,undefined,undefined, undefined,undefined,undefined,[],undefined, undefined,undefined,undefined,"0",undefined, undefined,undefined,undefined,undefined, undefined,[]}, {"application/x-www-form-urlencoded", <<"sig=d2ca310df4f5d5a987bb2c6af23e7690&api_key=648e964d7625f3ed0d49cbb55b46c96a&call_id=1234628320520330&method=facebook.friends.get&session_key=e96b0d4702c06f34e28a68df-713876569&v=1.0">>}, {http_options,"HTTP/1.1",60000,true,[],undefined, false}, "http://api.facebook.com/restserver.php ",[],none,[]}}, infinity]}} Req: {http_request,'GET', {abs_path,"/friends.yaws?session=e96b0d4702c06f34e28a68df%2D713876569&soc=fb&uid=713876569"}, {1,1}} Stack: [{gen_server,call,3}, {http,handle_request,6}, {facebook,call,2}, {m2,out,1}, {yaws_server,deliver_dyn_part,8}, {yaws_server,aloop,3}, {yaws_server,acceptor0,2}, {proc_lib,init_p_do_apply,3}] Any idea what might be going wrong. Any help would be appreciated. -------------- next part -------------- An HTML attachment was scrubbed... URL: From kaczmarek.w@REDACTED Sat Feb 14 18:10:29 2009 From: kaczmarek.w@REDACTED (Wojciech Kaczmarek) Date: Sat, 14 Feb 2009 18:10:29 +0100 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <426C6DFA-9359-4F0C-BAD8-D1E620BC0A14@gmail.com> References: <4535f6cd0902110846w1180516u7dfbf83ce8c87970@mail.gmail.com> <3EC78F9B-5873-4E10-9A1E-A38649F96B0F@uninet.ee> <4535f6cd0902111058x32bcaf64r8536c89ad9546cc1@mail.gmail.com> <9b08084c0902120753p4785d045l366c076330a3936f@mail.gmail.com> <489C6085-CC01-4C4D-BC84-BE26A9266324@scaldeferri.com> <20090212192832.GU23813@hezmatt.org> <426C6DFA-9359-4F0C-BAD8-D1E620BC0A14@gmail.com> Message-ID: <31ae10910902140910q102d8c14n7a1ae137efb09def@mail.gmail.com> 2009/2/13 Dmitrii Dimandt > > That's exactly what fess was talking about. Had you not mentioned these > projects, no one would ever discover them (well, I would, but I run a > Russian Erlang-related-news site, so I scour the web, blogs and mailing > lists for news and bits and pieces of info) > > Erlang should really get a repositroy that is as ubiquitous and as easy to > use as Ruby's gem or Perl's CPAN. Yes, there is a lot of utter crap in those > repositories, but they are valuable for the fact that you can easily search > and instal necessary modules. > > For instance, I can name at least three mutually incompatible JSON > encoding/decoding libraries written for erlang (there are at least 5, I > think). Definitely at least two libraries dealing with utf-8. Two OpenID > projects. Two dedicated wrappers for traditional RDBMs (and a third, which > is a more general ORM-style library). At least three (I think) projects that > connect to Amazon's web services in one way or another. Two projects > interfacing with memcached. And the list *will* grow. These are just > projects I can name off the top of my head > > "Let a hundred flowers blossom" (c) Mao Zedong > > Quite often I don't think that authors of some of these project even now > that similar projects exist. Forget the users, they will *never* even > discover some of them :) > Hello, 3 cents from a perspective of someone who did a lot of searching of quality 3rd-party Erlang software during last two years, for the purposes of r&d first and later for the production use in a startup. Centralized repository is tempting (I missed it at the beginning), but it also requires lots of Q&A work. It can be obvious for anybody who participated in maintaining some Linux of *BSD distribution. Also it can reveal specific social incompatibilies between users, as they needs vary more than most of people would like to admit. And it's not very good for the perception of the community to start a centralized service which will fail later. The simpler step is to make searching easier. A website aggregating some automatically-retrieved info (from googlecode, github, sourceforge) with a human-entered content (by those authors who'd like to care about it) comes to mind. The results could be sorted somehow, with a raw google search output as a last resort. Something like that could be plugged into Planet Erlang. There's no silver bullet when it comes to managing external software. In production you usually want to stick with carefully chosen and often patched specific versions of 3rd party stuff, otherwise you easily introduce a new point of failure and make the release management pain in the ass. I'm very happy that Erlang is the first language making a sane conenction between HA-world, where you think about your production environment in a very specific way, and the usual "opensource libraries for all, let's grab it" approach. cheers, -- Wojtek -------------- next part -------------- An HTML attachment was scrubbed... URL: From kaczmarek.w@REDACTED Sat Feb 14 18:25:40 2009 From: kaczmarek.w@REDACTED (Wojciech Kaczmarek) Date: Sat, 14 Feb 2009 18:25:40 +0100 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: References: <4535f6cd0902110846w1180516u7dfbf83ce8c87970@mail.gmail.com> <3EC78F9B-5873-4E10-9A1E-A38649F96B0F@uninet.ee> <4535f6cd0902111058x32bcaf64r8536c89ad9546cc1@mail.gmail.com> <9b08084c0902120753p4785d045l366c076330a3936f@mail.gmail.com> <489C6085-CC01-4C4D-BC84-BE26A9266324@scaldeferri.com> <20090212192832.GU23813@hezmatt.org> <426C6DFA-9359-4F0C-BAD8-D1E620BC0A14@gmail.com> Message-ID: <31ae10910902140925q5ae7cb19y69e7c3cc943db7aa@mail.gmail.com> On Fri, Feb 13, 2009 at 9:46 AM, Nick Gerakines wrote: > > I agree with what you are getting at. I would love it if there was > some sort of standard packaging and installation system for Erlang. A > gem equivalent or Module::Build, if you will. But there really isn't. > At EA we've been using your standard `make`, `make test` and `make > install` targets which works for what we want and is rpm/ebuild/deb > friendly. > Good point. Popular, portable and enjoyable method of packaging is one thing, and central repository of those is another. Ruby gems or CPAN have them both. I guess the former is most important. Having it you can still choose where to pick it from (think quality). This way we could improve the process of building 3rd party stuff and of distributing our own stuff, commercial or open, whatever. 'Where to get the stuff' is just another problem and we are not forced to join those two domains together. Compare to python, when setup.py -- really cool method of bundling your package -- existed years before python eggs (gem-like solution). -------------- next part -------------- An HTML attachment was scrubbed... URL: From harveyd@REDACTED Sat Feb 14 18:38:08 2009 From: harveyd@REDACTED (Dale Harvey) Date: Sat, 14 Feb 2009 17:38:08 +0000 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <31ae10910902140910q102d8c14n7a1ae137efb09def@mail.gmail.com> References: <4535f6cd0902110846w1180516u7dfbf83ce8c87970@mail.gmail.com> <3EC78F9B-5873-4E10-9A1E-A38649F96B0F@uninet.ee> <4535f6cd0902111058x32bcaf64r8536c89ad9546cc1@mail.gmail.com> <9b08084c0902120753p4785d045l366c076330a3936f@mail.gmail.com> <489C6085-CC01-4C4D-BC84-BE26A9266324@scaldeferri.com> <20090212192832.GU23813@hezmatt.org> <426C6DFA-9359-4F0C-BAD8-D1E620BC0A14@gmail.com> <31ae10910902140910q102d8c14n7a1ae137efb09def@mail.gmail.com> Message-ID: 2009/2/14 Wojciech Kaczmarek > 2009/2/13 Dmitrii Dimandt > >> >> That's exactly what fess was talking about. Had you not mentioned these >> projects, no one would ever discover them (well, I would, but I run a >> Russian Erlang-related-news site, so I scour the web, blogs and mailing >> lists for news and bits and pieces of info) >> >> Erlang should really get a repositroy that is as ubiquitous and as easy to >> use as Ruby's gem or Perl's CPAN. Yes, there is a lot of utter crap in those >> repositories, but they are valuable for the fact that you can easily search >> and instal necessary modules. >> >> For instance, I can name at least three mutually incompatible JSON >> encoding/decoding libraries written for erlang (there are at least 5, I >> think). Definitely at least two libraries dealing with utf-8. Two OpenID >> projects. Two dedicated wrappers for traditional RDBMs (and a third, which >> is a more general ORM-style library). At least three (I think) projects that >> connect to Amazon's web services in one way or another. Two projects >> interfacing with memcached. And the list *will* grow. These are just >> projects I can name off the top of my head >> >> "Let a hundred flowers blossom" (c) Mao Zedong >> >> Quite often I don't think that authors of some of these project even now >> that similar projects exist. Forget the users, they will *never* even >> discover some of them :) >> > > Hello, > 3 cents from a perspective of someone who did a lot of searching of quality > 3rd-party Erlang software during last two years, for the purposes of r&d > first and later for the production use in a startup. > > Centralized repository is tempting (I missed it at the beginning), but it > also requires lots of Q&A work. It can be obvious for anybody who > participated in maintaining some Linux of *BSD distribution. Also it can > reveal specific social incompatibilies between users, as they needs vary > more than most of people would like to admit. And it's not very good for the > perception of the community to start a centralized service which will fail > later. > > The simpler step is to make searching easier. A website aggregating some > automatically-retrieved info (from googlecode, github, sourceforge) with a > human-entered content (by those authors who'd like to care about it) comes > to mind. The results could be sorted somehow, with a raw google search > output as a last resort. Something like that could be plugged into Planet > Erlang. > > There's no silver bullet when it comes to managing external software. In > production you usually want to stick with carefully chosen and often patched > specific versions of 3rd party stuff, otherwise you easily introduce a new > point of failure and make the release management pain in the ass. I'm very > happy that Erlang is the first language making a sane conenction between > HA-world, where you think about your production environment in a very > specific way, and the usual "opensource libraries for all, let's grab it" > approach. I registered erldocs.com with the intention of doing pretty much exactly that. right now I am waiting on the ability to fully generate the erlang documentation from source, then I was planning to improve usability / searchability, then on importing documentation of open source 3rd party libs however I am a bit torn because http://erlware.org/documentation/index.html does a large amount of what I was planning to do, the frontend could be improved quite a lot, but its a good start. So i think it comes down to, why arent people using faxien / sinan?, I tried them out a while ago and had some teething issues, however they seem to stabilising recently, I am going to give it a bit more of a thorough look and try packaging some applications for it. are there any core reasons why people dont use it, or was it purely a maturity issue. (just to note, it isnt a centralised repository, you can setup your own public and private repos) > > cheers, > > -- Wojtek > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nick@REDACTED Sat Feb 14 19:29:46 2009 From: nick@REDACTED (Nick Gerakines) Date: Sat, 14 Feb 2009 10:29:46 -0800 Subject: [erlang-questions] erlang2facebook freinds_get is failing In-Reply-To: References: Message-ID: Do you have inets running (aka `inets:start().`)? I don't know if erlang2facebook is maintained anymore either. I've been using Erlang for Facebook application development for a while now and put up a few Erlang/Facebook related tools and examples. * http://github.com/ngerakines/erlang_facebook * http://github.com/ngerakines/facebook_wiiinfo Hope that helps. # Nick Gerakines 2009/2/14 Salonee Sinha Roy : > Hi All > I am trying to write a facebook app. My code for calling erlang2facebook > method facebook:friends_get/1 is > > {friends_get_Response,Attrs,[X]} = facebook:friends_get(Session), > > > I get the following errror from yaws > ERROR erlang code crashed: > File: /home/owner/Desktop/erlang/yaws/mask/friends.yaws:3 > Reason: {noproc, > {gen_server,call, > [httpc_manager, > {request, > {request,undefined,<0.71.0>,0,http, > {"api.facebook.com",80}, > "/restserver.php",[],post, > {http_request_h,undefined,"keep-alive",undefined, > undefined,undefined,undefined,undefined, > undefined,undefined,undefined,undefined, > undefined,undefined,undefined,undefined, > > undefined,"api.facebook.com",undefined,undefined, > undefined,undefined,undefined,undefined, > undefined,undefined,undefined,[],undefined, > undefined,undefined,undefined,"0",undefined, > undefined,undefined,undefined,undefined, > undefined,[]}, > {"application/x-www-form-urlencoded", > > <<"sig=d2ca310df4f5d5a987bb2c6af23e7690&api_key=648e964d7625f3ed0d49cbb55b46c96a&call_id=1234628320520330&method=facebook.friends.get&session_key=e96b0d4702c06f34e28a68df-713876569&v=1.0">>}, > {http_options,"HTTP/1.1",60000,true,[],undefined, > false}, > > "http://api.facebook.com/restserver.php",[],none,[]}}, > infinity]}} > Req: {http_request,'GET', > > {abs_path,"/friends.yaws?session=e96b0d4702c06f34e28a68df%2D713876569&soc=fb&uid=713876569"}, > {1,1}} > Stack: [{gen_server,call,3}, > {http,handle_request,6}, > {facebook,call,2}, > {m2,out,1}, > {yaws_server,deliver_dyn_part,8}, > {yaws_server,aloop,3}, > {yaws_server,acceptor0,2}, > {proc_lib,init_p_do_apply,3}] > > > Any idea what might be going wrong. Any help would be appreciated. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From erlang-questions_efine@REDACTED Sat Feb 14 20:30:11 2009 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sat, 14 Feb 2009 14:30:11 -0500 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: References: <4535f6cd0902110846w1180516u7dfbf83ce8c87970@mail.gmail.com> <4535f6cd0902111058x32bcaf64r8536c89ad9546cc1@mail.gmail.com> <9b08084c0902120753p4785d045l366c076330a3936f@mail.gmail.com> <489C6085-CC01-4C4D-BC84-BE26A9266324@scaldeferri.com> <20090212192832.GU23813@hezmatt.org> <426C6DFA-9359-4F0C-BAD8-D1E620BC0A14@gmail.com> <31ae10910902140910q102d8c14n7a1ae137efb09def@mail.gmail.com> Message-ID: <6c2563b20902141130h51c6b591t11e5cbb5bb3d96d@mail.gmail.com> 2009/2/14 Dale Harvey > > > 2009/2/14 Wojciech Kaczmarek > > 2009/2/13 Dmitrii Dimandt >> >>> >>> That's exactly what fess was talking about. Had you not mentioned these >>> projects, no one would ever discover them (well, I would, but I run a >>> Russian Erlang-related-news site, so I scour the web, blogs and mailing >>> lists for news and bits and pieces of info) >>> >>> Erlang should really get a repositroy that is as ubiquitous and as easy >>> to use as Ruby's gem or Perl's CPAN. Yes, there is a lot of utter crap in >>> those repositories, but they are valuable for the fact that you can easily >>> search and instal necessary modules. >>> >>> For instance, I can name at least three mutually incompatible JSON >>> encoding/decoding libraries written for erlang (there are at least 5, I >>> think). Definitely at least two libraries dealing with utf-8. Two OpenID >>> projects. Two dedicated wrappers for traditional RDBMs (and a third, which >>> is a more general ORM-style library). At least three (I think) projects that >>> connect to Amazon's web services in one way or another. Two projects >>> interfacing with memcached. And the list *will* grow. These are just >>> projects I can name off the top of my head >>> >>> "Let a hundred flowers blossom" (c) Mao Zedong >>> >>> Quite often I don't think that authors of some of these project even now >>> that similar projects exist. Forget the users, they will *never* even >>> discover some of them :) >>> >> >> Hello, >> 3 cents from a perspective of someone who did a lot of searching of >> quality 3rd-party Erlang software during last two years, for the purposes of >> r&d first and later for the production use in a startup. >> >> Centralized repository is tempting (I missed it at the beginning), but it >> also requires lots of Q&A work. It can be obvious for anybody who >> participated in maintaining some Linux of *BSD distribution. Also it can >> reveal specific social incompatibilies between users, as they needs vary >> more than most of people would like to admit. And it's not very good for the >> perception of the community to start a centralized service which will fail >> later. >> >> The simpler step is to make searching easier. A website aggregating some >> automatically-retrieved info (from googlecode, github, sourceforge) with a >> human-entered content (by those authors who'd like to care about it) comes >> to mind. The results could be sorted somehow, with a raw google search >> output as a last resort. Something like that could be plugged into Planet >> Erlang. >> >> There's no silver bullet when it comes to managing external software. In >> production you usually want to stick with carefully chosen and often patched >> specific versions of 3rd party stuff, otherwise you easily introduce a new >> point of failure and make the release management pain in the ass. I'm very >> happy that Erlang is the first language making a sane conenction between >> HA-world, where you think about your production environment in a very >> specific way, and the usual "opensource libraries for all, let's grab it" >> approach. > > > I registered erldocs.com with the intention of doing pretty much exactly > that. right now I am waiting on the ability to fully generate the erlang > documentation from source, then I was planning to improve usability / > searchability, then on importing documentation of open source 3rd party libs > > however I am a bit torn because > http://erlware.org/documentation/index.html > does a large amount of what I was planning to do, the frontend could be > improved quite a lot, but its a good start. > > So i think it comes down to, why arent people using faxien / sinan?, I > tried them > out a while ago and had some teething issues, however they seem to > stabilising > recently, I am going to give it a bit more of a thorough look and try > packaging > some applications for it. are there any core reasons why people dont use > it, or > was it purely a maturity issue. > I am using sinan/faxien exclusively, and have installed and maintained four Erlang production systems with them. There were some teething issues, some of which were very annoying to the point that some people stopped using the software, but I soldiered on and the software is improving. Even with the bugs and problems, it's a while lot better than the make-based solution I was using before. I really hope that Faxien and Sinan make it because they are closer to what I want in a build/distribution system for Erlang than anything else I have used, even with their current limitations. I wish the whole OTP was distributed like this. > (just to note, it isnt a centralised repository, you can setup your own > public > and private repos) > > >> >> cheers, >> >> -- Wojtek >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Sat Feb 14 20:31:18 2009 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sat, 14 Feb 2009 14:31:18 -0500 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <6c2563b20902141130h51c6b591t11e5cbb5bb3d96d@mail.gmail.com> References: <4535f6cd0902110846w1180516u7dfbf83ce8c87970@mail.gmail.com> <9b08084c0902120753p4785d045l366c076330a3936f@mail.gmail.com> <489C6085-CC01-4C4D-BC84-BE26A9266324@scaldeferri.com> <20090212192832.GU23813@hezmatt.org> <426C6DFA-9359-4F0C-BAD8-D1E620BC0A14@gmail.com> <31ae10910902140910q102d8c14n7a1ae137efb09def@mail.gmail.com> <6c2563b20902141130h51c6b591t11e5cbb5bb3d96d@mail.gmail.com> Message-ID: <6c2563b20902141131p67247e8exa6418a8cccf1680@mail.gmail.com> > it's a while lot better > I meant a "whole lot better". -------------- next part -------------- An HTML attachment was scrubbed... URL: From ssroy1979@REDACTED Sat Feb 14 21:15:27 2009 From: ssroy1979@REDACTED (Salonee Sinha Roy) Date: Sat, 14 Feb 2009 12:15:27 -0800 Subject: [erlang-questions] erlang2facebook freinds_get is failing In-Reply-To: References: Message-ID: Nick That was the problem. I started inet and it started working fine. I will also take a look at the package you created. Thanks for your help Salonee On Sat, Feb 14, 2009 at 10:29 AM, Nick Gerakines wrote:That > Do you have inets running (aka `inets:start().`)? > > I don't know if erlang2facebook is maintained anymore either. I've > been using Erlang for Facebook application development for a while now > and put up a few Erlang/Facebook related tools and examples. > > * http://github.com/ngerakines/erlang_facebook > * http://github.com/ngerakines/facebook_wiiinfo > > Hope that helps. > > # Nick Gerakines > > > 2009/2/14 Salonee Sinha Roy : > > Hi All > > I am trying to write a facebook app. My code for calling erlang2facebook > > method facebook:friends_get/1 is > > > > {friends_get_Response,Attrs,[X]} = facebook:friends_get(Session), > > > > > > I get the following errror from yaws > > ERROR erlang code crashed: > > File: /home/owner/Desktop/erlang/yaws/mask/friends.yaws:3 > > Reason: {noproc, > > {gen_server,call, > > [httpc_manager, > > {request, > > {request,undefined,<0.71.0>,0,http, > > {"api.facebook.com",80}, > > "/restserver.php",[],post, > > > {http_request_h,undefined,"keep-alive",undefined, > > undefined,undefined,undefined,undefined, > > undefined,undefined,undefined,undefined, > > undefined,undefined,undefined,undefined, > > > > undefined,"api.facebook.com",undefined,undefined, > > undefined,undefined,undefined,undefined, > > undefined,undefined,undefined,[],undefined, > > undefined,undefined,undefined,"0",undefined, > > undefined,undefined,undefined,undefined, > > undefined,[]}, > > {"application/x-www-form-urlencoded", > > > > > <<"sig=d2ca310df4f5d5a987bb2c6af23e7690&api_key=648e964d7625f3ed0d49cbb55b46c96a&call_id=1234628320520330&method=facebook.friends.get&session_key=e96b0d4702c06f34e28a68df-713876569&v=1.0">>}, > > > {http_options,"HTTP/1.1",60000,true,[],undefined, > > false}, > > > > "http://api.facebook.com/restserver.php",[],none,[]}}, > > infinity]}} > > Req: {http_request,'GET', > > > > > {abs_path,"/friends.yaws?session=e96b0d4702c06f34e28a68df%2D713876569&soc=fb&uid=713876569"}, > > {1,1}} > > Stack: [{gen_server,call,3}, > > {http,handle_request,6}, > > {facebook,call,2}, > > {m2,out,1}, > > {yaws_server,deliver_dyn_part,8}, > > {yaws_server,aloop,3}, > > {yaws_server,acceptor0,2}, > > {proc_lib,init_p_do_apply,3}] > > > > > > Any idea what might be going wrong. Any help would be appreciated. > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmitriid@REDACTED Sat Feb 14 21:27:10 2009 From: dmitriid@REDACTED (Dmitrii Dimandt) Date: Sat, 14 Feb 2009 22:27:10 +0200 Subject: [erlang-questions] pool of jinterface noes Message-ID: <22DEB843-A230-4FE2-AABA-77709C31A275@gmail.com> What's the simplest way to create a load-balancing pool of jinterface nodes. I realize simplest is not always the most efficient, so if anyone has an efficient implementation, I'd love to learn that as well :) From mikyung_kang@REDACTED Fri Feb 13 21:33:54 2009 From: mikyung_kang@REDACTED (KangMikyung) Date: Fri, 13 Feb 2009 15:33:54 -0500 Subject: [erlang-questions] beginner: Message Passing Overhead in Erlang Message-ID: Dear All, When I tested pingpong test, Erlang takes long time even though the data size is 0/1/2/4/8 bytes. MPI takes around 0.0025 microseconds/iteration when the data size 0/1/2/4/8 bytes. However Erlang takes around 0.5 microseconds/iteration at least. (within one core) I tried to find the underlying reasons that there is higher overhead involved in message passing in Erlang when compared to MPI, but I couldn't find it yet at "The erlang-questions Archives". How can we explain the situation that Erlang takes long time even though the data size is very small (e.g. 0 or 1)? Why the communication overhead is very big? When the data size is 16KB, Erlang was slower than MPI at least thousands time. Where can I find the explanation? Also I tested two pingpong case: (1) with data('a') and (2) without data. (1) takes 0.336 us, but (2) takes 0.0000000059 us. It's very different. Can we tell initial data related setup takes long time? Thanks, Mikyung (1) -module(tut15). -export([run/0]). -include("imb.hrl"). ping(0, _, _) -> done; ping(R, D, Pong) -> Pong ! {self(), D}, receive {Pong, D} -> ping(R - 1, D, Pong) end. pong() -> receive {From, D} -> From ! {self(), D}, pong() end. run() -> R = 1000, D = 'a', %D = "abcdefghij", Pong = spawn(fun()-> pong() end), TimeStart = imb:time_microseconds(), ping(R, D, Pong), TimeEnd = imb:time_microseconds(), io:format("Time in microseconds: ~p~n", [TimeEnd - TimeStart]). (2) -module(tut15). -export([start/0, ping/2, pong/0]). -include("imb.hrl"). ping(0, Pong_PID) -> Pong_PID ! finished; ping(N, Pong_PID) -> Pong_PID ! {ping, self()}, receive pong -> ping(N - 1, Pong_PID) end. pong() -> receive {ping, Ping_PID} -> Ping_PID ! pong, pong() end. start() -> TimeStart = imb:time_microseconds(), Pong_PID = spawn(tut15, pong, []), spawn(tut15, ping, [1000, Pong_PID]), TimeEnd = imb:time_microseconds(), io:format("Time in microseconds: ~p~n", [TimeEnd - TimeStart]). ** time_microseconds() -> {MS, S, US} = now(), (MS * 1.0e+12) + (S * 1.0e+6) + US. _________________________________________________________________ ???? ???, ???? ?? ???? ???? ??? Windows Live Hotmail! ?? ???? ???! http://www.hotmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From steven.charles.davis@REDACTED Sat Feb 14 23:06:53 2009 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sat, 14 Feb 2009 14:06:53 -0800 (PST) Subject: [erlang-questions] I Hate Unit Testing (Part 0.2) Message-ID: <6891fae8-686e-456e-a147-7f2bf5e2465f@w1g2000prm.googlegroups.com> All, Thanks for the earlier discussions on this. I've pushed the results of my expanded experiment with text-based unit testing ("utest") to github for anybody to try who is sufficiently interested -- it works pretty well for me :) http://github.com/komone/utest/ All comments welcome. /sd From watson.timothy@REDACTED Sun Feb 15 03:29:28 2009 From: watson.timothy@REDACTED (Tim Watson) Date: Sun, 15 Feb 2009 02:29:28 +0000 Subject: [erlang-questions] Is erlang a web language? Message-ID: <8fa878b90902141829u6b94b867lc22826c03ae3df16@mail.gmail.com> > > I am using sinan/faxien exclusively, and have installed and maintained four > Erlang production systems with them. There were some teething issues, some This is interesting - I also started out with good feelings about sinan/faxien, but they appear to redistribute the core OTP libraries which is anathema where I work. We're simply not allowed (by law) to run code on "some version" of kernel/stdlib/etc that didn't come from a verified (official) sources, even if it did in reality (if you see what I mean). This is an issue of regulatory compliance, so we're stuck and can't use the tools, which are (I agree) very nice bar some minor usability issues. I suspect this puts a lot of people off - it's not as maven downloads and installs the JDK for you is it, and for good reason - I'd be surprised if that many people actually wanted this. Clearly there are mixed opinions about whether a repository for publishing applications and a distributed build system that can consume code from public/private repos, is a good approach. That's to be expected, but this idea of redistributing "Erlang itself" is another thing altogether. It seems like trying to force too many new ideas at once, and I suspect this is a big part of the problem. From erlang-questions_efine@REDACTED Sun Feb 15 04:31:05 2009 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sat, 14 Feb 2009 22:31:05 -0500 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <8fa878b90902141829u6b94b867lc22826c03ae3df16@mail.gmail.com> References: <8fa878b90902141829u6b94b867lc22826c03ae3df16@mail.gmail.com> Message-ID: <6c2563b20902141931w5ed58a53gf7291a591d0c20ce@mail.gmail.com> On Sat, Feb 14, 2009 at 9:29 PM, Tim Watson wrote: > > > > I am using sinan/faxien exclusively, and have installed and maintained > four > > Erlang production systems with them. There were some teething issues, > some > > This is interesting - I also started out with good feelings about > sinan/faxien, but they appear to redistribute the core OTP libraries > which is anathema where I work. Martin & Eric can speak for themselves, but my point of view is that, well, they don't really redistribute them *as such*. They are forced to build them using their own tools and put them in their WebDAV repository because (a) The OTP team doesn't support such a repository, and (b) they have to make minor tweaks to the add their metadata, which is necessary for the distribution mechanism. The metadata doesn't exist - or, in the case of .app files, sometimes doesn't quite fit in - in the OTP distribution. I am pretty (99%) sure there is no fiddling with the source code at all, it's just an alternative way to build it, no more suspicious than building OTP from the tarball. If there was a way to build OTP with their (Erlware) tools in a 100% automated way, then anyone could do it, but they are not quite there yet (as far as I know). So that is indeed a sticking point, I can see. We're simply not allowed (by law) to > run code on "some version" of kernel/stdlib/etc that didn't come from > a verified (official) sources, even if it did in reality (if you see > what I mean). This is an issue of regulatory compliance, so we're > stuck and can't use the tools, which are (I agree) very nice bar some > minor usability issues. I suspect this puts a lot of people off - it's > not as maven downloads and installs the JDK for you is it, and for > good reason - I'd be surprised if that many people actually wanted > this. > > Clearly there are mixed opinions about whether a repository for > publishing applications and a distributed build system that can > consume code from public/private repos, is a good approach. That's to > be expected, but this idea of redistributing "Erlang itself" is > another thing altogether. It seems like trying to force too many new > ideas at once, and I suspect this is a big part of the problem. Again, I believe they don't WANT to redistribute Erlang. It's a huge pain in the butt to have to tweak new Erlang releases to build with their toolset, and it's not really the fault of their toolset, it's just minor inconsistencies here and there that cause issues. If they could get it right that anyone could build Erlang itself using Sinan, and then put it in their own private Erlware repo with Faxien, these objections would largely go away. If you look at what Ruby has managed to achieve with Gems, and (I think) Python with "eggs", it is quite reasonable to expect that we should be able to distribute our own Erlang apps in a pre-built form in a way that makes it really easy to update. I use this mechanism to update production servers in a number of different countries, and the previous way I did it was just horrible. It's so much easier for me just to log into the remote server, type in "faxien upgrade-release myapp", maybe tweak the sys.config, and then restart the application (I don't need hot code update yet). The sad thing is that Erlware is *so* close to being really great, and is held back mostly because the authors are so busy actually earning a living that they don't have enough time to devote to ironing out the wrinkles. My great hope is that the Erlang/OTP team will see enough merit in this approach to make this a standard distribution mechanism, but I don't hold out much hope (not because the team is unreasonable or anything, but because of the overhead of supporting builds across many hardware platforms and version within the platforms.) An easier and even better thing would be if they actually used Erlware to build the Erlang source code; then we could all build it with Erlware and the main objection would be solved. Also, they could put some resources on it to help with the wrinkles. Just dreaming ;) -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Sun Feb 15 12:39:10 2009 From: erlang@REDACTED (Joe Armstrong) Date: Sun, 15 Feb 2009 12:39:10 +0100 Subject: [erlang-questions] UBF and JSON Protocols Message-ID: <9b08084c0902150339r791ff36bm5fc24d191e5f1b36@mail.gmail.com> For a long time I have been interested in describing protocols. In 2002 I published a contract system called UBF for defining protocols. This scheme was never widely adopted - perhaps it was just to strange... I have revised UBF and recast it in a form which I call JSON Protocols - since JSON is widely implemented, this method of described protocols might be more acceptable... Read the remainder of this on http://armstrongonsoftware.blogspot.com/2009/02/json-protocols-part-1.html /Joe Armstrong From erlang@REDACTED Sun Feb 15 12:56:19 2009 From: erlang@REDACTED (Joe Armstrong) Date: Sun, 15 Feb 2009 12:56:19 +0100 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <6c2563b20902141931w5ed58a53gf7291a591d0c20ce@mail.gmail.com> References: <8fa878b90902141829u6b94b867lc22826c03ae3df16@mail.gmail.com> <6c2563b20902141931w5ed58a53gf7291a591d0c20ce@mail.gmail.com> Message-ID: <9b08084c0902150356l36a1121do8bfdae7fe2d487fa@mail.gmail.com> This is my take on the matter. To start with I don't think one distribution scheme or library will ever work - the work making it consistent is colossal. I rather like what's happened in the javascript world. Here there is a core-language, and alternative sets of rather-good libraries. To me a good library has - a book (or books) - - community who contribute to the library - a unifying principle - a set of applications that use the library The javascript jquery and protoype libraries live up these criteria. After I finished the erlang book I started writing a library and a number of applications based on the library. My plan is: a) write a base library and applications b) open source it and invite community participial c) improve quality of library through participation d) write a book describing the library I'm in the middle of a) - I now have a dilemma, should I release now or later. advantages: early feedback disadvantages: quality problems - it's in a bit of a mess, so it gets a bad reputation. Or wait a year or so: advantages: higher quality of release disadvantage: loose user feedback Do you want software "early and buggy, badly documented" or "late and better documented, higher quality" I would welcome some feedback here /Joe Armstrong 2009/2/15 Edwin Fine : > > > On Sat, Feb 14, 2009 at 9:29 PM, Tim Watson > wrote: >> >> > >> > I am using sinan/faxien exclusively, and have installed and maintained >> > four >> > Erlang production systems with them. There were some teething issues, >> > some >> >> This is interesting - I also started out with good feelings about >> sinan/faxien, but they appear to redistribute the core OTP libraries >> which is anathema where I work. > > Martin & Eric can speak for themselves, but my point of view is that, well, > they don't really redistribute them as such. They are forced to build them > using their own tools and put them in their WebDAV repository because (a) > The OTP team doesn't support such a repository, and (b) they have to make > minor tweaks to the add their metadata, which is necessary for the > distribution mechanism. The metadata doesn't exist - or, in the case of .app > files, sometimes doesn't quite fit in - in the OTP distribution. I am pretty > (99%) sure there is no fiddling with the source code at all, it's just an > alternative way to build it, no more suspicious than building OTP from the > tarball. If there was a way to build OTP with their (Erlware) tools in a > 100% automated way, then anyone could do it, but they are not quite there > yet (as far as I know). So that is indeed a sticking point, I can see. > >> We're simply not allowed (by law) to >> run code on "some version" of kernel/stdlib/etc that didn't come from >> a verified (official) sources, even if it did in reality (if you see >> what I mean). This is an issue of regulatory compliance, so we're >> stuck and can't use the tools, which are (I agree) very nice bar some >> minor usability issues. I suspect this puts a lot of people off - it's >> not as maven downloads and installs the JDK for you is it, and for >> good reason - I'd be surprised if that many people actually wanted >> this. >> >> Clearly there are mixed opinions about whether a repository for >> publishing applications and a distributed build system that can >> consume code from public/private repos, is a good approach. That's to >> be expected, but this idea of redistributing "Erlang itself" is >> another thing altogether. It seems like trying to force too many new >> ideas at once, and I suspect this is a big part of the problem. > > > Again, I believe they don't WANT to redistribute Erlang. It's a huge pain in > the butt to have to tweak new Erlang releases to build with their toolset, > and it's not really the fault of their toolset, it's just minor > inconsistencies here and there that cause issues. If they could get it right > that anyone could build Erlang itself using Sinan, and then put it in their > own private Erlware repo with Faxien, these objections would largely go > away. > > If you look at what Ruby has managed to achieve with Gems, and (I think) > Python with "eggs", it is quite reasonable to expect that we should be able > to distribute our own Erlang apps in a pre-built form in a way that makes it > really easy to update. I use this mechanism to update production servers in > a number of different countries, and the previous way I did it was just > horrible. It's so much easier for me just to log into the remote server, > type in "faxien upgrade-release myapp", maybe tweak the sys.config, and then > restart the application (I don't need hot code update yet). The sad thing is > that Erlware is *so* close to being really great, and is held back mostly > because the authors are so busy actually earning a living that they don't > have enough time to devote to ironing out the wrinkles. > > My great hope is that the Erlang/OTP team will see enough merit in this > approach to make this a standard distribution mechanism, but I don't hold > out much hope (not because the team is unreasonable or anything, but because > of the overhead of supporting builds across many hardware platforms and > version within the platforms.) An easier and even better thing would be if > they actually used Erlware to build the Erlang source code; then we could > all build it with Erlware and the main objection would be solved. Also, they > could put some resources on it to help with the wrinkles. > > Just dreaming ;) > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From per@REDACTED Sun Feb 15 13:15:09 2009 From: per@REDACTED (Per Hedeland) Date: Sun, 15 Feb 2009 13:15:09 +0100 (CET) Subject: [erlang-questions] Concurrent requests with ibrowse In-Reply-To: <6c2563b20902132319r5b4896dem79ddca3802c7e757@mail.gmail.com> Message-ID: <200902151215.n1FCF9d7087822@pluto.hedeland.org> Edwin Fine wrote: > >If that doesn't help, try decreasing TIME_WAIT (but first read >http://www.erlang.org/pipermail/erlang-questions/2008-September/038154.htmland >http://www.developerweb.net/forum/showthread.php?t=2941). > ># Set TIME_WAIT timeout to 30 seconds instead of 120 >sudo /sbin/sysctl -w net.ipv4.tcp_fin_timeout=30 That may help, but change the TIME_WAIT time (which isn't really a "timeout", it's not waiting for anything to "happen") it does not, as one might guess from the name of the variable. It reduces the timeout waiting for a close from the peer in the FIN_WAIT_2 state (see the state diagram in RFC 793), by default 60 seconds on Linux I believe. Note that this is generally short duration, and you shouldn't hit the timeout unless connectivity with the peer is lost - but reducing it too agressively might cause loss of data. As far as I know there is no way to reduce the TIME_WAIT time on Linux other than modifying the kernel - it's a #define (60*HZ) in a kernel header file. There are other ways to deal with the problem of having a lot of connections in TIME_WAIT on Linux though. >2009/2/13 steve ellis > >> We're trying to build an app that uses ibrowse to make concurrent requests. >> We are not able to get more than a few concurrent requests at a time to >> return successfully. We repeatedly get "conn_failed" If that's all you get, I'm afraid it's pretty useless. Did it time out, get "connection refused" i.e. RST, was the connection established but immediately closed, or did it run into the "lack of ports" problem? I wouldn't say that unhandled "let it crash" is appropriate for problems occurring way below the user interface of an application, but a badmatch would at least have told us what gen_tcp said. Anyway if you get problems with connections in the low hundreds, "lack of ports" is really unlikely. So dig deeper instead of blindly trying to fix a problem that you may not have - find the place(s) in the source where 'conn_failed' is generated and make it/them report what actually happened, and/or use tcpdump or similar to figure out what goes wrong with the connections. --Per From watson.timothy@REDACTED Sun Feb 15 13:28:02 2009 From: watson.timothy@REDACTED (Tim Watson) Date: Sun, 15 Feb 2009 12:28:02 +0000 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <9b08084c0902150356l36a1121do8bfdae7fe2d487fa@mail.gmail.com> References: <8fa878b90902141829u6b94b867lc22826c03ae3df16@mail.gmail.com> <6c2563b20902141931w5ed58a53gf7291a591d0c20ce@mail.gmail.com> <9b08084c0902150356l36a1121do8bfdae7fe2d487fa@mail.gmail.com> Message-ID: <8fa878b90902150428i276098b2p7f48ae858cc3efed@mail.gmail.com> Hi all, Robert, I work at British Telecommunications. As the former state run monopoly, we are subject to a great deal of regulation. There's also a fair degree of paranoia about having safe and reliable code. Open source is a relatively new thing at BT and there's an understandable (and IMHO reasonable) desire to make sure that it comes from a verifiable and reliable source. Joe, I tend to agree that there isn't a single approach that works for everyone - even if you've chosen maven (which is ubiquitous in the java world) there are some jars that aren't in a repo and need to be manually added to your corporate repo/mirror server. As for the issue of when to release, I really want both. I like to know that a project is available, but I tend not to depend on projects that are still in alpha. I probably wont use an immature library which is poorly documented, but I might get involved in developing it if it offers functionality I need and is quite well underway. This aids with discovery and I don't tend to judge alpha releases on bugs/documentation anyway - I just don't use them. If it's alpha then it's not meant for production and any poor reputation is quite undeserved. I appreciate the conundrum though, as not everyone thinks this way. Edwin, I take your point about this being something Erlware is stuck with, but it's only because of design decisions really. The "mechanism" by which libs in the $ERL_TOP/lib folder are versioned appears to be a naming convention, so locating stdlib shouldn't be that hard. In addition to this, running one version of stdlib alongside another version of kernel is madness (because the Erlang team won't have tested this combination) so I don't think Erlware should be distributing these libraries at all. I don't understand why they're forced to, in order to distribute and build 3rd party packages. Maven does not put the JDK libraries in the repository. I don't get hold of the ruby 'stdlib' using the rubygems mechanism, it comes bundled with the distribution. You don't go to the cheeseshop to get hold of eggs for the 'os' or 'sys' modules, they just come with python. This is a design decision, not a technical constraint. If this were not the case (or if it was configurable), then I'd happily invest my time in helping with Erlware instead of working on our custom build system. Our build system does everything locally (build, test, doc, generate boot scripts based on content of the .app file, generate shell scripts for starting the app in priv/scripts, OTP package/tar, push to repo - appup/relup is still somewhat manual but we generate scripts to do it) and doesn't require any custom meta-data whatsoever. Our distribution mechanism is to generate install scripts alongside the app tarball, then put these into generated debian packages and push them into apt repositories. This is very much non-standard (unless you're company is standardised on debian - which we're not!) and so there are two reasons we didn't open source it. Firstly, when I asked "is it ok to make this public", I never got a reply. Secondly, I just assumed that the Erlware would be less environment specific - I was correct - and that everyone would use it - looks like this might not be the case. Decoupling our choice of repository is fairly simple, but it means we have no distribution mechanism at all (apart from nfs, which is where we started :-) None of the code relies on a specific format of repository, as in reality it is just a bit of glue around command line programs (erl, erlc, apt-get, etc). From pguyot@REDACTED Sun Feb 15 13:28:06 2009 From: pguyot@REDACTED (Paul Guyot) Date: Sun, 15 Feb 2009 13:28:06 +0100 Subject: [erlang-questions] Erlang BBEdit Language Module Message-ID: <08FF1F62-3656-4FB0-BC27-BA6FE8FFFF8B@kallisys.net> Dear all, I am pleased to announce the release of the Erlang BBEdit Language Module v1.1. This module introduces syntax colorizing, function navigation and auto- completion to BBEdit and TextWrangler for the Erlang programming language. It can be downloaded from the following URL: http://erlang-bblm.googlecode.com/files/ErlangBBLM-1.1.zip The module is open source and the source code is available under the MIT license on Google Code: http://code.google.com/p/erlang-bblm/ Regards, Paul From peter@REDACTED Sun Feb 15 13:30:32 2009 From: peter@REDACTED (Peter Sabaini) Date: Sun, 15 Feb 2009 13:30:32 +0100 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <9b08084c0902150356l36a1121do8bfdae7fe2d487fa@mail.gmail.com> References: <8fa878b90902141829u6b94b867lc22826c03ae3df16@mail.gmail.com> <6c2563b20902141931w5ed58a53gf7291a591d0c20ce@mail.gmail.com> <9b08084c0902150356l36a1121do8bfdae7fe2d487fa@mail.gmail.com> Message-ID: <200902151330.41024.peter@sabaini.at> On Sunday 15 February 2009 12:56:19 Joe Armstrong wrote: > This is my take on the matter. > > To start with I don't think one distribution scheme or library will > ever work - the work > making it consistent is colossal. Yet rubygems or PyPI seem to work out quite well. To me this is mostly about findability and having a uniform interface for meta data -- version numbers, homepage, release history etc., this makes a huge difference in choosing a lib. > I rather like what's happened in the javascript world. > > Here there is a core-language, and alternative sets of rather-good > libraries. > > To me a good library has > > - a book (or books) - > - community who contribute to the library > - a unifying principle > - a set of applications that use the library IMHO this rather depends on the library -- a small library that does one thing well and has only a small interface won't need a whole book for documentation. > The javascript jquery and protoype libraries live up these criteria. > > After I finished the erlang book I started writing a library and a number > of applications based on the library. My plan is: > > a) write a base library and applications > b) open source it and invite community participial > c) improve quality of library through participation > d) write a book describing the library > > I'm in the middle of a) - I now have a dilemma, should I release now or > later. > > advantages: early feedback > disadvantages: quality problems - it's in a bit of a mess, so it gets > a bad reputation. > > Or wait a year or so: > > advantages: higher quality of release > disadvantage: loose user feedback > > Do you want software "early and buggy, badly documented" or > "late and better documented, higher quality" The classical "Release Early, Release Often" is still a valid approach I think. As long as it clearly says on the box (with big bold letters) if something is alpha/beta/release quality you won't get a bad reputation. Or only from people who do not read :-) Just my 0.02eurocent... peter. > I would welcome some feedback here > > /Joe Armstrong > > 2009/2/15 Edwin Fine : > > On Sat, Feb 14, 2009 at 9:29 PM, Tim Watson > > > > wrote: > >> > I am using sinan/faxien exclusively, and have installed and maintained > >> > four > >> > Erlang production systems with them. There were some teething issues, > >> > some > >> > >> This is interesting - I also started out with good feelings about > >> sinan/faxien, but they appear to redistribute the core OTP libraries > >> which is anathema where I work. > > > > Martin & Eric can speak for themselves, but my point of view is that, > > well, they don't really redistribute them as such. They are forced to > > build them using their own tools and put them in their WebDAV repository > > because (a) The OTP team doesn't support such a repository, and (b) they > > have to make minor tweaks to the add their metadata, which is necessary > > for the distribution mechanism. The metadata doesn't exist - or, in the > > case of .app files, sometimes doesn't quite fit in - in the OTP > > distribution. I am pretty (99%) sure there is no fiddling with the source > > code at all, it's just an alternative way to build it, no more suspicious > > than building OTP from the tarball. If there was a way to build OTP with > > their (Erlware) tools in a 100% automated way, then anyone could do it, > > but they are not quite there yet (as far as I know). So that is indeed a > > sticking point, I can see. > > > >> We're simply not allowed (by law) to > >> run code on "some version" of kernel/stdlib/etc that didn't come from > >> a verified (official) sources, even if it did in reality (if you see > >> what I mean). This is an issue of regulatory compliance, so we're > >> stuck and can't use the tools, which are (I agree) very nice bar some > >> minor usability issues. I suspect this puts a lot of people off - it's > >> not as maven downloads and installs the JDK for you is it, and for > >> good reason - I'd be surprised if that many people actually wanted > >> this. > >> > >> Clearly there are mixed opinions about whether a repository for > >> publishing applications and a distributed build system that can > >> consume code from public/private repos, is a good approach. That's to > >> be expected, but this idea of redistributing "Erlang itself" is > >> another thing altogether. It seems like trying to force too many new > >> ideas at once, and I suspect this is a big part of the problem. > > > > Again, I believe they don't WANT to redistribute Erlang. It's a huge pain > > in the butt to have to tweak new Erlang releases to build with their > > toolset, and it's not really the fault of their toolset, it's just minor > > inconsistencies here and there that cause issues. If they could get it > > right that anyone could build Erlang itself using Sinan, and then put it > > in their own private Erlware repo with Faxien, these objections would > > largely go away. > > > > If you look at what Ruby has managed to achieve with Gems, and (I think) > > Python with "eggs", it is quite reasonable to expect that we should be > > able to distribute our own Erlang apps in a pre-built form in a way that > > makes it really easy to update. I use this mechanism to update production > > servers in a number of different countries, and the previous way I did it > > was just horrible. It's so much easier for me just to log into the remote > > server, type in "faxien upgrade-release myapp", maybe tweak the > > sys.config, and then restart the application (I don't need hot code > > update yet). The sad thing is that Erlware is *so* close to being really > > great, and is held back mostly because the authors are so busy actually > > earning a living that they don't have enough time to devote to ironing > > out the wrinkles. > > > > My great hope is that the Erlang/OTP team will see enough merit in this > > approach to make this a standard distribution mechanism, but I don't hold > > out much hope (not because the team is unreasonable or anything, but > > because of the overhead of supporting builds across many hardware > > platforms and version within the platforms.) An easier and even better > > thing would be if they actually used Erlware to build the Erlang source > > code; then we could all build it with Erlware and the main objection > > would be solved. Also, they could put some resources on it to help with > > the wrinkles. > > > > Just dreaming ;) > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part. URL: From rapsey@REDACTED Sun Feb 15 14:44:52 2009 From: rapsey@REDACTED (Rapsey) Date: Sun, 15 Feb 2009 14:44:52 +0100 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <9b08084c0902150356l36a1121do8bfdae7fe2d487fa@mail.gmail.com> References: <8fa878b90902141829u6b94b867lc22826c03ae3df16@mail.gmail.com> <6c2563b20902141931w5ed58a53gf7291a591d0c20ce@mail.gmail.com> <9b08084c0902150356l36a1121do8bfdae7fe2d487fa@mail.gmail.com> Message-ID: <97619b170902150544q67b8703o65af5e67816cc752@mail.gmail.com> How about a quality release with a small subset of the final functionality? Sergej On Sun, Feb 15, 2009 at 12:56 PM, Joe Armstrong wrote: > This is my take on the matter. > > To start with I don't think one distribution scheme or library will > ever work - the work > making it consistent is colossal. > > I rather like what's happened in the javascript world. > > Here there is a core-language, and alternative sets of rather-good > libraries. > > To me a good library has > > - a book (or books) - > - community who contribute to the library > - a unifying principle > - a set of applications that use the library > > The javascript jquery and protoype libraries live up these criteria. > > After I finished the erlang book I started writing a library and a number > of > applications based on the library. My plan is: > > a) write a base library and applications > b) open source it and invite community participial > c) improve quality of library through participation > d) write a book describing the library > > I'm in the middle of a) - I now have a dilemma, should I release now or > later. > > advantages: early feedback > disadvantages: quality problems - it's in a bit of a mess, so it gets > a bad reputation. > > Or wait a year or so: > > advantages: higher quality of release > disadvantage: loose user feedback > > Do you want software "early and buggy, badly documented" or > "late and better documented, higher quality" > > I would welcome some feedback here > > /Joe Armstrong > > > > 2009/2/15 Edwin Fine : > > > > > > On Sat, Feb 14, 2009 at 9:29 PM, Tim Watson > > wrote: > >> > >> > > >> > I am using sinan/faxien exclusively, and have installed and maintained > >> > four > >> > Erlang production systems with them. There were some teething issues, > >> > some > >> > >> This is interesting - I also started out with good feelings about > >> sinan/faxien, but they appear to redistribute the core OTP libraries > >> which is anathema where I work. > > > > Martin & Eric can speak for themselves, but my point of view is that, > well, > > they don't really redistribute them as such. They are forced to build > them > > using their own tools and put them in their WebDAV repository because (a) > > The OTP team doesn't support such a repository, and (b) they have to make > > minor tweaks to the add their metadata, which is necessary for the > > distribution mechanism. The metadata doesn't exist - or, in the case of > .app > > files, sometimes doesn't quite fit in - in the OTP distribution. I am > pretty > > (99%) sure there is no fiddling with the source code at all, it's just an > > alternative way to build it, no more suspicious than building OTP from > the > > tarball. If there was a way to build OTP with their (Erlware) tools in a > > 100% automated way, then anyone could do it, but they are not quite there > > yet (as far as I know). So that is indeed a sticking point, I can see. > > > >> We're simply not allowed (by law) to > >> run code on "some version" of kernel/stdlib/etc that didn't come from > >> a verified (official) sources, even if it did in reality (if you see > >> what I mean). This is an issue of regulatory compliance, so we're > >> stuck and can't use the tools, which are (I agree) very nice bar some > >> minor usability issues. I suspect this puts a lot of people off - it's > >> not as maven downloads and installs the JDK for you is it, and for > >> good reason - I'd be surprised if that many people actually wanted > >> this. > >> > >> Clearly there are mixed opinions about whether a repository for > >> publishing applications and a distributed build system that can > >> consume code from public/private repos, is a good approach. That's to > >> be expected, but this idea of redistributing "Erlang itself" is > >> another thing altogether. It seems like trying to force too many new > >> ideas at once, and I suspect this is a big part of the problem. > > > > > > Again, I believe they don't WANT to redistribute Erlang. It's a huge pain > in > > the butt to have to tweak new Erlang releases to build with their > toolset, > > and it's not really the fault of their toolset, it's just minor > > inconsistencies here and there that cause issues. If they could get it > right > > that anyone could build Erlang itself using Sinan, and then put it in > their > > own private Erlware repo with Faxien, these objections would largely go > > away. > > > > If you look at what Ruby has managed to achieve with Gems, and (I think) > > Python with "eggs", it is quite reasonable to expect that we should be > able > > to distribute our own Erlang apps in a pre-built form in a way that makes > it > > really easy to update. I use this mechanism to update production servers > in > > a number of different countries, and the previous way I did it was just > > horrible. It's so much easier for me just to log into the remote server, > > type in "faxien upgrade-release myapp", maybe tweak the sys.config, and > then > > restart the application (I don't need hot code update yet). The sad thing > is > > that Erlware is *so* close to being really great, and is held back mostly > > because the authors are so busy actually earning a living that they don't > > have enough time to devote to ironing out the wrinkles. > > > > My great hope is that the Erlang/OTP team will see enough merit in this > > approach to make this a standard distribution mechanism, but I don't hold > > out much hope (not because the team is unreasonable or anything, but > because > > of the overhead of supporting builds across many hardware platforms and > > version within the platforms.) An easier and even better thing would be > if > > they actually used Erlware to build the Erlang source code; then we could > > all build it with Erlware and the main objection would be solved. Also, > they > > could put some resources on it to help with the wrinkles. > > > > Just dreaming ;) > > > > > > _______________________________________________ > > 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 twoggle@REDACTED Sun Feb 15 15:10:15 2009 From: twoggle@REDACTED (Tim Fletcher) Date: Sun, 15 Feb 2009 06:10:15 -0800 (PST) Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <9b08084c0902150356l36a1121do8bfdae7fe2d487fa@mail.gmail.com> References: <8fa878b90902141829u6b94b867lc22826c03ae3df16@mail.gmail.com> <6c2563b20902141931w5ed58a53gf7291a591d0c20ce@mail.gmail.com> <9b08084c0902150356l36a1121do8bfdae7fe2d487fa@mail.gmail.com> Message-ID: > Do you want software "early and buggy, badly documented" or > "late and better documented, higher quality" > > I would welcome some feedback here Is this the "70 module library"[1] that you have referred to before? You're likely to be writing code that people want to use. Releasing it earlier would provide an opportunity for feedback on the APIs, and get you some help in finding/fixing some of those bugs. In addition, i think an insight into where you are heading would be of value, particularly if you are trying to develop tools, best practices, and standards for meta data as you suggest in the aforementioned discussion. For me, this all outweighs any disadvantages of opening up early. I would rather have something imperfect but that i could help improve. If nothing else, sharing some more of your ideas/goals would be a good place to start. [1]: http://www.erlang.org/pipermail/erlang-questions/2008-November/039918.html From cureadvocate@REDACTED Sun Feb 15 16:05:59 2009 From: cureadvocate@REDACTED (Steven Edwards) Date: Sun, 15 Feb 2009 10:05:59 -0500 Subject: [erlang-questions] pool of jinterface noes Message-ID: Using the queue module seems like the easiest to me. http://www.erlang.org/doc/man/queue.html Spawn the JInterface nodes, push them into a queue as they come online with queue:in/2. queue:out/1 when you need to dispatch to one, then push it back when its done. On Sun, Feb 15, 2009 at 6:00 AM, wrote: > Message: 1 > Date: Sat, 14 Feb 2009 22:27:10 +0200 > From: Dmitrii Dimandt > Subject: [erlang-questions] pool of jinterface noes > To: erlang-questions@REDACTED > Message-ID: <22DEB843-A230-4FE2-AABA-77709C31A275@REDACTED> > Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes > > What's the simplest way to create a load-balancing pool of jinterface > nodes. > > I realize simplest is not always the most efficient, so if anyone has > an efficient implementation, I'd love to learn that as well :) > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bryan.fink@REDACTED Sun Feb 15 16:24:38 2009 From: bryan.fink@REDACTED (Bryan Fink) Date: Sun, 15 Feb 2009 10:24:38 -0500 Subject: [erlang-questions] erlang2facebook freinds_get is failing In-Reply-To: References: Message-ID: 2009/2/14 Salonee Sinha Roy : > That was the problem. I started inet and it started working fine. Hey, glad to see that Nick got you up and running. Please announce when your app is up - I love seeing what people use erlang2facebook for. On Sat, Feb 14, 2009 at 1:29 PM, Nick Gerakines wrote: > I don't know if erlang2facebook is maintained anymore either. Since you asked, no I haven't done any fresh development on erlang2facebook in a while. I know that everything still worked as of a couple of weeks ago, but I've backed off on my own site's facebook integration, so I don't have any short-term plans to implement new erlang2facebook functionality. I'd be happy to accept any patches you make, though. -Bryan From qiulang@REDACTED Sun Feb 15 17:00:53 2009 From: qiulang@REDACTED (lang qiu) Date: Mon, 16 Feb 2009 00:00:53 +0800 Subject: [erlang-questions] Has anyone actually run the final example messenger in "Getting Started with Erlang" ? Some weird problem Message-ID: Hi, Has anyone actually run the final example in "Getting started with Erlang", that messenger example with macro and record ? I hit some weird problem. So I can log in to the server successfully but whenever sending a message to other (including myself), the erlang shell always return "*receiver_not_found*" error. I print the User_List and find something weird. So User_List is constructed as [{From, Name} | User_List], but when print it (using ~p), User_list looks like User list = [{<5241.36.0>,*[qiu]*},{<5164.36.0>,*[tom]*}] instead of User list = [{<5241.36.0>,*qiu*},{<5164.36.0>,*tom*}]. I am not sure it is the print issue or the element of User_List does become { From, [Name] } instead of { From, Name }. I guess this is the reason why *lists:keysearch*(To, 2, User_List) does not find the login user. So has anyone ever hit this problem ? Thanks! BTW I run it on Windows XP. -------------- next part -------------- An HTML attachment was scrubbed... URL: From norton@REDACTED Sun Feb 15 15:30:46 2009 From: norton@REDACTED (Joseph Wayne Norton) Date: Sun, 15 Feb 2009 23:30:46 +0900 Subject: [erlang-questions] UBF and JSON Protocols In-Reply-To: <9b08084c0902150339r791ff36bm5fc24d191e5f1b36@mail.gmail.com> References: <9b08084c0902150339r791ff36bm5fc24d191e5f1b36@mail.gmail.com> Message-ID: Joe - Using the decoder/encoder of the erlang-rfc46267 (http://www.lshift.net/blog/2007/02/17/json-and-json-rpc-for-erlang) module, here is an informal description for *one* approach to encode "erlang" UBF into JSON (and vice versa). Comments and feedback are welcome. thanks, - Joe N. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% encode(ubf::value()) -> json::value() %% %% ubf::tuple() = {obj, [{"$T", ubf::list()}]} %% %% ubf::list() = [value()] %% %% ubf::number() = integer() | float() %% %% ubf::string() = {obj, [{"$S", binary()}]} %% %% ubf::binary() = binary() %% %% ubf::true() = true %% ubf::false() = false %% ubf::undefined() = null %% %% ubf::atom() = {obj, [{"$A", atomname()} %% atomname() = binary() % a.k.a. list_to_binary(atom_to_list()) for the actual atom %% %% ubf::record() = {obj, [{"$R", recordname()}] ++ [recordpair()]} %% recordname = binary() % a.k.a. list_to_binary(atom_to_list()) for the record's name %% recordpair() = {recordkey(), value()} %% recordkey() = binary() % a.k.a. list_to_binary(atom_to_list()) for the record key's name %% %% value() = ubf::tuple() | ubf::list() | ubf::number() | ubf::string() | ubf::binary() | ubf::true() | ubf::false() | ubf::undefined() | ubf::atom() | ubf::record() %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% ubf %% %% ubf::tuple() = tuple() %% %% ubf::list() = list() %% %% ubf::number = integer() | float() %% %% ubf::string() = {'$S', [integer()]} %% %% ubf::binary() = binary() %% %% ubf::true() = true %% ubf::false() = false %% ubf::undefined() = undefined %% %% ubf::atom() = atom() %% %% ubf::record() = record() %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% erlang-rfc46267 %% %% json::object() = {obj, [json::pair()]} %% %% json::pair() = {string(), json::value()} %% string() = [byte()] %% byte() = integer() %% %% json::array() = [json::value()] %% %% json::value() = json::object() | json::array() | json::number() | json::string() | json::true() | json::false() | json::null() %% %% json::number() = integer() | float() %% %% json::string() = binary() %% %% json::true() = true %% json::false() = false %% json::null() = null %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% json %% %% object %% {} %% { members } %% members %% pair %% pair, members %% pair %% string : value %% array %% [] %% [ elements ] %% elements %% value %% value, elements %% value %% string %% number %% object %% true (atom) %% false (atom) %% null (atom) On Sun, 15 Feb 2009 20:39:10 +0900, Joe Armstrong wrote: > For a long time I have been interested in describing protocols. In > 2002 I published a contract system called UBF for defining protocols. > This scheme was never widely adopted - perhaps it was just to > strange... > > I have revised UBF and recast it in a form which I call JSON Protocols > - since JSON is widely implemented, this method of described protocols > might be more acceptable... > > Read the remainder of this on > > http://armstrongonsoftware.blogspot.com/2009/02/json-protocols-part-1.html > > /Joe Armstrong > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- norton@REDACTED From dmitriid@REDACTED Sun Feb 15 18:00:57 2009 From: dmitriid@REDACTED (Dmitrii Dimandt) Date: Sun, 15 Feb 2009 19:00:57 +0200 Subject: [erlang-questions] pool of jinterface noes In-Reply-To: References: Message-ID: <1B552DE1-4577-4265-8635-DB200F3511BB@gmail.com> Very nice! Thank you!! On Feb 15, 2009, at 5:05 PM, Steven Edwards wrote: > Using the queue module seems like the easiest to me. > > http://www.erlang.org/doc/man/queue.html > > Spawn the JInterface nodes, push them into a queue as they come > online with queue:in/2. queue:out/1 when you need to dispatch to > one, then push it back when its done. > > On Sun, Feb 15, 2009 at 6:00 AM, request@REDACTED> wrote: > Message: 1 > Date: Sat, 14 Feb 2009 22:27:10 +0200 > From: Dmitrii Dimandt > Subject: [erlang-questions] pool of jinterface noes > To: erlang-questions@REDACTED > Message-ID: <22DEB843-A230-4FE2-AABA-77709C31A275@REDACTED> > Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes > > What's the simplest way to create a load-balancing pool of jinterface > nodes. > > I realize simplest is not always the most efficient, so if anyone has > an efficient implementation, I'd love to learn that as well :) > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan@REDACTED Sun Feb 15 18:13:09 2009 From: jan@REDACTED (Jan Lehnardt) Date: Sun, 15 Feb 2009 18:13:09 +0100 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <9b08084c0902150356l36a1121do8bfdae7fe2d487fa@mail.gmail.com> References: <8fa878b90902141829u6b94b867lc22826c03ae3df16@mail.gmail.com> <6c2563b20902141931w5ed58a53gf7291a591d0c20ce@mail.gmail.com> <9b08084c0902150356l36a1121do8bfdae7fe2d487fa@mail.gmail.com> Message-ID: <4146A7EA-203F-43C0-991F-50B291ADA627@apache.org> On 15 Feb 2009, at 12:56, Joe Armstrong wrote: > I'm in the middle of a) - I now have a dilemma, should I release now > or later. Release early & often. Cheers Jan -- From getyourcontacts@REDACTED Sun Feb 15 18:39:11 2009 From: getyourcontacts@REDACTED (Yang Zhang) Date: Mon, 16 Feb 2009 01:39:11 +0800 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <4146A7EA-203F-43C0-991F-50B291ADA627@apache.org> References: <8fa878b90902141829u6b94b867lc22826c03ae3df16@mail.gmail.com> <6c2563b20902141931w5ed58a53gf7291a591d0c20ce@mail.gmail.com> <9b08084c0902150356l36a1121do8bfdae7fe2d487fa@mail.gmail.com> <4146A7EA-203F-43C0-991F-50B291ADA627@apache.org> Message-ID: <4535f6cd0902150939u6b3fa511o2b89af6e7a5ca880@mail.gmail.com> Just see a small question become a long long discussion. It has taken me 30+ minutes to check all posts above. As most people talked here, I saw the point is the erlang distributors or communities don't have central repository or proper library management. That lead to DIVERSITIES(*diversities*). Many people implement what they need, what they want and what they think to be useful,helpful and correct. But I am wondering who can say fee's "urlencode" is better than Jan's "urlencode", and who can promise Tim's implementation of "urlencode" is correct? (Sorry. No mean to offend, just take name for example.) If .NET/PHP/Python(I am not using Ruby or perl) don't provide their urlencode or many common functions and leave them to people to implement themselves, do you think they will become so popular? Be easy! Be simple! .NET/Python drived me leave C/C++ because they are simple and with easy use builtin libraries. And erlang's distribute feature drive me to writ distribute server/application from .NET. When I was talking about the distribute feature of erlang, it is so powerful, wonderful with .NET guys, they were suggesting me to read some .NET books to learn MS's API, they said .NET has builtin support to spawn process on another machine although they know .NET don't have a mnesia. Then they concluded .NET is the best language on windows platform. At least comparing to erlang, .NET is easier and more stable(with excepted memory crash). Erlang vm's crash was one thing someone was laughing at(If you check my another mail). Anyway, *diversities *is the bad thing here, for common/fundermental functions, I really appreciate we can have an *offical *release so onbody can write his own copy(saving time and be stable). Sorry to extend this long discussion again. Regards. Scott On Mon, Feb 16, 2009 at 1:13 AM, Jan Lehnardt wrote: > > On 15 Feb 2009, at 12:56, Joe Armstrong wrote: > > > I'm in the middle of a) - I now have a dilemma, should I release now > > or later. > > Release early & often. > > Cheers > Jan > -- > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From getyourcontacts@REDACTED Sun Feb 15 18:44:44 2009 From: getyourcontacts@REDACTED (Yang Zhang) Date: Mon, 16 Feb 2009 01:44:44 +0800 Subject: [erlang-questions] Is mnesia/erlang/ETP strong enough? In-Reply-To: <87eiy2wyl6.fsf@sterlett.hq.kred> References: <4535f6cd0902110909h47e6430fgbbd2b45b01a0030c@mail.gmail.com> <7EFF3E64-63EC-47C2-B87F-431CF536EF4C@uninet.ee> <4535f6cd0902111037l2d6334adn7150c296b1182b0c@mail.gmail.com> <87eiy2wyl6.fsf@sterlett.hq.kred> Message-ID: <4535f6cd0902150944t1ed90142u7faa58a882b348a9@mail.gmail.com> Hi. Mats. I thought it really depends on how many processes you are trying to run and how many memory each process would consume. I do think there is the possibility for erlang vm to run out of the memory it can hold. Sorry. I don't understand what do you mean "Your problems come from Redmond." Regards. On Fri, Feb 13, 2009 at 4:05 PM, mats cronqvist wrote: > Yang Zhang writes: > > > I am running erlang on a server(win2003 server R2) with 8 CPUs and 10G > > memory. I found when erlang consumed ~800M - 1.5G memory, it will crash > > itself. > > I'm running Erlang on a very similar machine, but with Debian. It > has never crashed due to OutOfMemory, even though it rarely uses less > that 3GB of memory. Your problems come from Redmond. > > mats > -------------- next part -------------- An HTML attachment was scrubbed... URL: From twoggle@REDACTED Sun Feb 15 19:50:37 2009 From: twoggle@REDACTED (Tim Fletcher) Date: Sun, 15 Feb 2009 10:50:37 -0800 (PST) Subject: [erlang-questions] Is mnesia/erlang/ETP strong enough? In-Reply-To: <4535f6cd0902150944t1ed90142u7faa58a882b348a9@mail.gmail.com> References: <4535f6cd0902110909h47e6430fgbbd2b45b01a0030c@mail.gmail.com> <7EFF3E64-63EC-47C2-B87F-431CF536EF4C@uninet.ee> <4535f6cd0902111037l2d6334adn7150c296b1182b0c@mail.gmail.com> <87eiy2wyl6.fsf@sterlett.hq.kred> <4535f6cd0902150944t1ed90142u7faa58a882b348a9@mail.gmail.com> Message-ID: > I don't understand what do you mean "Your problems come from Redmond." Microsoft's headquarters are in Redmond. I think mats is suggesting that you might be having memory issues because of Windows. If you have access to a linux machine then it might be worth running your code on it to compare. From cureadvocate@REDACTED Sun Feb 15 22:30:09 2009 From: cureadvocate@REDACTED (Steven Edwards) Date: Sun, 15 Feb 2009 16:30:09 -0500 Subject: [erlang-questions] Newton's Forward Difference Formula implementation available at GitHub Message-ID: If anyone's interested, I put a naive implementation of Newton's Forward Difference Formula up at GitHub: http://github.com/cureadvocate/newton-s-forward-difference-formula/tree/master For those who don't know the formula, you give it a list of known values and it will return the coefficients of a function f(x) needed to reproduce the sequence you entered and produce any subsequent numbers. As an example, say you're asked to find an f(x) whose first three values (x=1,2,3) are [15, 28, 39]. You would just need to ask: --- newton:solve([15, 28, 39]). --- ...and it would answer [-1, 16, 0], meaning [f(x) = -x^2 + 16x + 0] or [f(x) = 16x - x^2]. The return value of newton:solve/1 can be fed into the following function [for Coefficients] to produce other values: --- fofx(X, Coefficients) -> Len = length(Coefficients), Exponents = lists:seq(Len-1, 0, -1), lists:sum(lists:zipwith(fun(Coefficient, Exponent) -> Coefficient * tmath:pow(X, Exponent) end, Coefficients, Exponents)). --- Notes: -I wrote this for use in the shell, so stability in a real-world application is unknown. -It currently only solves when it's given values starting from x=1. -I have only tested it up to producing equations of degree 4, but it should work for others. -newton:solve/1 provides a solution as accurate as it can determine, which is dependent on: lack of typos and initial inputs. If anyone finds it useful, great! If not, no biggie--I'm just using it to learn how to use GitHub. :) Best, Steven -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Mon Feb 16 00:25:42 2009 From: ok@REDACTED (Richard O'Keefe) Date: Mon, 16 Feb 2009 12:25:42 +1300 Subject: [erlang-questions] "Symmetrical" function In-Reply-To: <20090213085729.GA27293@herbie> References: <20090213085729.GA27293@herbie> Message-ID: <800885F9-69BB-4236-982D-A0D5F771B04A@cs.otago.ac.nz> There are two approaches to the problem of writing a symmetric function, depending on what you think the problem is. If the problem is WRITING every clause twice, then don't. Use the parse tools to take an annotation such as -symmentric([{{f,2},{1,2}}]). % function f/2 is symmetric in arguments 1 and 2 and rewrite f(P11, P12) -> E1; ... f(Pn1, Pn2) -> En. to f(P12, P11) -> E1; f(P11, P12) -> E1; ... f(Pn2, Pn1) -> En; f(Pn1, Pn2) -> En. If the problem is HAVING two versions of each clause, then f(X, Y) -> try f'(X, Y) catch your special exception -> try f'(Y, X) -> catch your special exception -> fake a "no matching clause" exception end end. f'(P11, P12) -> E1; ... f'(Pn1, Pn2) -> En; f(_, _) -> throw your special exception. Note that there is a behavioural difference: the first version interleaves the swapped clauses with the originals, while the second puts all the swapped clauses after the originals. The first approach can be modified to get the effect of the second, but the second cannot _easily_ be modified to get the effect of the first. From bernie@REDACTED Mon Feb 16 00:51:56 2009 From: bernie@REDACTED (Bernard Duggan) Date: Mon, 16 Feb 2009 10:51:56 +1100 Subject: [erlang-questions] Emake on a SMP VM In-Reply-To: <6672d0160901290212r44e43da5n9b72b65a1e2acd65@mail.gmail.com> References: <49817CEF.9050807@charpi.net> <6672d0160901290212r44e43da5n9b72b65a1e2acd65@mail.gmail.com> Message-ID: <4998AA9C.3080806@m5net.com> Bjorn Gustavsson wrote: > On Thu, Jan 29, 2009 at 10:54 AM, Nicolas Charpentier wrote: > >> Hi, >> >> Is there any good reason why make:all/0 don't try to compile concurrently ? >> > > No. > So I figured this sounded like an interesting project to spend a couple of hours on. I've put together a patch that takes the relatively naive approach of spawning a new process for each file in the list and having that do the compilation. I originally implemented a more complex system of specifying a number of worker processes and farming new work out to them as they completed each compile, but testing on our project showed this to actually perform a little worse than the naive implementation (though how that scales to sets of hundreds or thousands of files I wouldn't like to think). > If we'll receive a patch of good quality, we will include it in a > future release. > I'm neither experienced nor conceited enough to imagine that my patch would be considered "good quality", but if anyone would like to make suggestions on what sucks about it I'm always grateful for an opportunity to learn and make improvements :) A patch against R12-5 is attached. To enable concurrent building, you need to add 'concurrent' to your make flags, otherwise the behaviour should be unchanged. Cheers, Bernard -------------- next part -------------- A non-text attachment was scrubbed... Name: erl_make_concurrent.patch Type: text/x-diff Size: 1899 bytes Desc: not available URL: From exta7@REDACTED Mon Feb 16 14:17:29 2009 From: exta7@REDACTED (Zvi) Date: Mon, 16 Feb 2009 05:17:29 -0800 (PST) Subject: [erlang-questions] Erlang marketing materials Message-ID: <22037059.post@talk.nabble.com> Is there are new Erlang marketing materials? Or should I show my prospective client "Erlang The Movie" [1] infomercial? ;) Zvi 1. http://www.youtube.com/watch?v=uKfKtXYLG78 -- View this message in context: http://www.nabble.com/Erlang-marketing-materials-tp22037059p22037059.html Sent from the Erlang Questions mailing list archive at Nabble.com. From jan@REDACTED Mon Feb 16 14:37:22 2009 From: jan@REDACTED (Jan Lehnardt) Date: Mon, 16 Feb 2009 14:37:22 +0100 Subject: [erlang-questions] License Clarification about EUnit in OTP needed Message-ID: Hi, if this is not the right place to ask, please let me know. The OTP team is reading here, so I think it's good to make this a public discussion :) The CouchDB team is looking at adopting EUnit for unit testing. Since EUnit is now shipped with OTP since R12B-5, we're happy to adopt it. Since we are with the ASF there are some licensing restrictions we need to take care of. The easiest for us is if we could treat EUnit as yet another standard OTP library released under the EPL license. The R12B-5 source still includes all LGPL boilerplate and the COPYING file. We understand that this means that while EUnit ships with OTP, the license remains LGPL. Now this discussion took place earlier today: http://twitter.com/janl/status/1214902936 http://twitter.com/mickael/status/1215085264 http://twitter.com/janl/status/1215153939 We're wondering if the LGPL mentions in the source are mere leftovers or if they are still valid. In any case, it would be nice to see a definite and public statement about this that we can link and refer to in the future. Both readings of the license-possibility came up in our thread and I am sure we're not the only ones. Cheers Jan -- From r.b.lists@REDACTED Mon Feb 16 14:53:31 2009 From: r.b.lists@REDACTED (Roland Braito) Date: Mon, 16 Feb 2009 14:53:31 +0100 Subject: [erlang-questions] Erlang marketing materials In-Reply-To: <22037059.post@talk.nabble.com> References: <22037059.post@talk.nabble.com> Message-ID: <20090216135331.96740@gmx.net> Hi! Maybe have a look at http://www.erlang.org/doc.html plus the erlang whitepaper (although a bit old) http://erlang.org/white_paper.html Best Regards, Roland -------- Original-Nachricht -------- > Datum: Mon, 16 Feb 2009 05:17:29 -0800 (PST) > Von: Zvi > An: erlang-questions@REDACTED > Betreff: [erlang-questions] Erlang marketing materials > > Is there are new Erlang marketing materials? > Or should I show my prospective client "Erlang The Movie" [1] infomercial? > ;) > > Zvi > > 1. http://www.youtube.com/watch?v=uKfKtXYLG78 > > -- > View this message in context: > http://www.nabble.com/Erlang-marketing-materials-tp22037059p22037059.html > Sent from the Erlang Questions mailing list archive at Nabble.com. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Psssst! Schon vom neuen GMX MultiMessenger geh?rt? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01 From steve.e.123@REDACTED Mon Feb 16 15:28:01 2009 From: steve.e.123@REDACTED (steve ellis) Date: Mon, 16 Feb 2009 09:28:01 -0500 Subject: [erlang-questions] Concurrent requests with ibrowse In-Reply-To: <200902151215.n1FCF9d7087822@pluto.hedeland.org> References: <6c2563b20902132319r5b4896dem79ddca3802c7e757@mail.gmail.com> <200902151215.n1FCF9d7087822@pluto.hedeland.org> Message-ID: <4cb4a7bf0902160628y78dad1daq276876712c6cfd2e@mail.gmail.com> Thank you Edwin and Per for your suggestions. So far no solution... Lowering TIME_WAIT didn't have a noticeable effect. We're getting the best results on our EC2 Fedora Core Release 4 test machine (1.7 GB of memory). On this machine we're now we're able to push ~300 ibrowse http request/responses through before we start to get a large number of conn_failed and req_timedout messages from ibrowse. Digging deeper into ibrowse... conn_failed is a timeout error from gen_tcp:connect(). This would appear to mean that gen_tcp:connect() isn't able to establish a connection at all. req_timedout is triggered when the socket stays open(?) for too long (for longer than the user supplied timeout (in our case 10 seconds)). (BTW, all of the sites we're hitting are available in a 10 second window. Only rarely should we get this type of timeout. Our test run hits 500 urls.) It still seems like we don't have enough sockets available to us. I dug deeper on this. How do you tell how many sockets a given process has open? It seems like one way is to do a ls on /proc/[the beam process id]/fd. This gives a list of numbers that presumably correspond to the file descriptors (sockets) for a process. On the first pass of the test (right after starting the erlang process), the number of fds shown are approximately the number of successful requests (around 300). Yet, on repeat runs the number of fds doesn't exceed approximately 1000 (they stay open for a while), which would seem to mean that erlang still doesn't have more than 1024 sockets available to it, despite what ulimit says. This doesn't explain why it doesn't work right on the first pass though (since we're only looping through 500 urls). I have tried setting ERL_MAX_PORTS to 50000 before starting erlang from the command prompt. This doesn't appear to do anything. What to try next? Approximately how many good request/reponse cycles should we *expect* to get if everything is working right? (It would seem like from what I read we should expect many many more....) Do the ibrowse folks have any insight on any of this? Is there anything we can do to get the system to give us more information about what is going on? Is there an erlang error log we can look at? PS I tried looking at the tcpdump of one of our request loops but wasn't able to see anything meaningful there. Any idea what I should be looking for in the tcpdump output? Thanks! Steve On Sun, Feb 15, 2009 at 7:15 AM, Per Hedeland wrote: > Edwin Fine wrote: > > > >If that doesn't help, try decreasing TIME_WAIT (but first read > > > http://www.erlang.org/pipermail/erlang-questions/2008-September/038154.htmland > >http://www.developerweb.net/forum/showthread.php?t=2941). > > > ># Set TIME_WAIT timeout to 30 seconds instead of 120 > >sudo /sbin/sysctl -w net.ipv4.tcp_fin_timeout=30 > > That may help, but change the TIME_WAIT time (which isn't really a > "timeout", it's not waiting for anything to "happen") it does not, as > one might guess from the name of the variable. It reduces the timeout > waiting for a close from the peer in the FIN_WAIT_2 state (see the state > diagram in RFC 793), by default 60 seconds on Linux I believe. Note that > this is generally short duration, and you shouldn't hit the timeout > unless connectivity with the peer is lost - but reducing it too > agressively might cause loss of data. > > As far as I know there is no way to reduce the TIME_WAIT time on Linux > other than modifying the kernel - it's a #define (60*HZ) in a kernel > header file. There are other ways to deal with the problem of having a > lot of connections in TIME_WAIT on Linux though. > > >2009/2/13 steve ellis > > > >> We're trying to build an app that uses ibrowse to make concurrent > requests. > >> We are not able to get more than a few concurrent requests at a time to > >> return successfully. We repeatedly get "conn_failed" > > If that's all you get, I'm afraid it's pretty useless. Did it time out, > get "connection refused" i.e. RST, was the connection established but > immediately closed, or did it run into the "lack of ports" problem? I > wouldn't say that unhandled "let it crash" is appropriate for problems > occurring way below the user interface of an application, but a badmatch > would at least have told us what gen_tcp said. > > Anyway if you get problems with connections in the low hundreds, "lack > of ports" is really unlikely. So dig deeper instead of blindly trying to > fix a problem that you may not have - find the place(s) in the source > where 'conn_failed' is generated and make it/them report what actually > happened, and/or use tcpdump or similar to figure out what goes wrong > with the connections. > > --Per > -------------- next part -------------- An HTML attachment was scrubbed... URL: From daniel.goertzen@REDACTED Mon Feb 16 17:21:10 2009 From: daniel.goertzen@REDACTED (Daniel Goertzen) Date: Mon, 16 Feb 2009 10:21:10 -0600 Subject: [erlang-questions] Erlang marketing materials In-Reply-To: <22037059.post@talk.nabble.com> References: <22037059.post@talk.nabble.com> Message-ID: I showed that video to a colleague of mine and his first response was "C++ would never have allowed a typo like that to compile in the first place." ... so maybe that video isn't the best piece of marketing material. :) Dialyzer would nail something like that these days, right? Dan. On Mon, Feb 16, 2009 at 7:17 AM, Zvi wrote: > > Is there are new Erlang marketing materials? > Or should I show my prospective client "Erlang The Movie" [1] infomercial? > ;) > > Zvi > > 1. http://www.youtube.com/watch?v=uKfKtXYLG78 > > -- > View this message in context: > http://www.nabble.com/Erlang-marketing-materials-tp22037059p22037059.html > Sent from the Erlang Questions mailing list archive at Nabble.com. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Daniel Goertzen email: dang@REDACTED phone: 1 443 303 8525 cell: 1 204 470 8360 sip: 945050@REDACTED -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardc@REDACTED Mon Feb 16 17:39:54 2009 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 16 Feb 2009 17:39:54 +0100 Subject: [erlang-questions] Erlang marketing materials In-Reply-To: References: <22037059.post@talk.nabble.com> Message-ID: <499996DA.9070604@it.uu.se> Daniel Goertzen wrote: > I showed that video to a colleague of mine and his first response was "C++ > would never have allowed a typo like that to compile in the first place." With C++, how can you ever tell if it is a typo? /R From ok@REDACTED Mon Feb 16 22:21:38 2009 From: ok@REDACTED (Richard O'Keefe) Date: Tue, 17 Feb 2009 10:21:38 +1300 Subject: [erlang-questions] "Symmetrical" function In-Reply-To: <101E61D2FF7642D595E2FEF3D1DFBF1E@SSI.CORP> References: <20090213085729.GA27293@herbie> <800885F9-69BB-4236-982D-A0D5F771B04A@cs.otago.ac.nz> <101E61D2FF7642D595E2FEF3D1DFBF1E@SSI.CORP> Message-ID: <31D2BB91-CFE9-46F4-8F39-B4B94B4A7AB0@cs.otago.ac.nz> On 17 Feb 2009, at 4:13 am, David Mercer wrote: > Why not just catch the function_clause error? To make life really simple for the reader, by making it really really obvious that the exception is *deliberate*. Also, being somewhat lazy, to avoid the trouble of checking that it is the *right* function_clause exit. >> Note that there is a behavioural difference: >> the first version interleaves the swapped clauses with the >> originals, while the second puts all the swapped clauses >> after the originals. The first approach can be modified >> to get the effect of the second, but the second cannot >> _easily_ be modified to get the effect of the first. > > Can you explain some more. I don't understand the difference. Suppose we start with f(a, _) -> 1; f(b, _) -> 2. The "preprocessor" approach generates f(_, a) -> 1; f(a, _) -> 1; f(_, b) -> 2; f(b, _) -> 2. The "exception" approach generates f(X, Y) -> try f1(X, Y) catch throw:flip -> try f1(Y, X) catch throw:flip -> erlang:error(function_clause, [X,Y]) end end. f1(a, _) -> 1; f1(b, _) -> 2; f1(_, _) -> throw(flip). Now what happens if we ask for f(b, a)? The version that interleaves the rules will return 1; the version that first tries all the rules as written and then tries all the rules swapped will return 2. Since functional languages like ML, Erlang, and even Haskell adopt a "first match" rule for functions, you cannot expect re-ordering function rules to work. But if you want to automatically force a function to be symmetric, you *have* to mix up two sets of rules somehow. In addition to the (B,A,B,A,...) and (A,A,...B,B,...) patterns, there are obviously others like (A,B,A,B,...) and (B,B,...,A,A,...) and many others. In the absence of guards, detecting when the order of interleavings might matter would be fairly straightforward: if {X1,Y1} and {Y2,X2} unify, there is a problem. (Here, {a,_} and {_,b} unify.) Guards make it a lot harder to tell. From mpalmer@REDACTED Mon Feb 16 20:07:40 2009 From: mpalmer@REDACTED (Matthew Palmer) Date: Tue, 17 Feb 2009 06:07:40 +1100 Subject: [erlang-questions] Erlang marketing materials In-Reply-To: <499996DA.9070604@it.uu.se> References: <22037059.post@talk.nabble.com> <499996DA.9070604@it.uu.se> Message-ID: <20090216190739.GR23813@hezmatt.org> On Mon, Feb 16, 2009 at 05:39:54PM +0100, Richard Carlsson wrote: > Daniel Goertzen wrote: > > I showed that video to a colleague of mine and his first response was "C++ > > would never have allowed a typo like that to compile in the first place." > > With C++, how can you ever tell if it is a typo? Because the compiler tells you. "If it builds, ship it!" - Matt -- Everybody knows that a hail of _edge-sharpened_ AOL CDs is the _polite_ way of saying "keep the noise down, chaps". -- Tanuki, ASR From mrad-direct-erlang@REDACTED Mon Feb 16 22:41:23 2009 From: mrad-direct-erlang@REDACTED (Michael Radford) Date: Mon, 16 Feb 2009 13:41:23 -0800 Subject: [erlang-questions] "Symmetrical" function In-Reply-To: <31D2BB91-CFE9-46F4-8F39-B4B94B4A7AB0@cs.otago.ac.nz> References: <800885F9-69BB-4236-982D-A0D5F771B04A@cs.otago.ac.nz> <101E61D2FF7642D595E2FEF3D1DFBF1E@SSI.CORP> <31D2BB91-CFE9-46F4-8F39-B4B94B4A7AB0@cs.otago.ac.nz> Message-ID: <20090216214123.GA3058@herbie> Richard O'Keefe writes: > >>Note that there is a behavioural difference: > >>the first version interleaves the swapped clauses with the > >>originals, while the second puts all the swapped clauses > >>after the originals. The first approach can be modified > >>to get the effect of the second, but the second cannot > >>_easily_ be modified to get the effect of the first. > > > >Can you explain some more. I don't understand the difference. > > Suppose we start with > > f(a, _) -> 1; > f(b, _) -> 2. But you are supposing that the function is not symmetrical. f(a,b) =/= f(b,a). For functions that are actually symmetrical, as the original poster was asking about, either approach should give the same results when either the upper or lower half of the matrix of clauses is correctly specified. Mike From ok@REDACTED Mon Feb 16 23:31:17 2009 From: ok@REDACTED (Richard O'Keefe) Date: Tue, 17 Feb 2009 11:31:17 +1300 Subject: [erlang-questions] "Symmetrical" function In-Reply-To: <20090216214123.GA3058@herbie> References: <800885F9-69BB-4236-982D-A0D5F771B04A@cs.otago.ac.nz> <101E61D2FF7642D595E2FEF3D1DFBF1E@SSI.CORP> <31D2BB91-CFE9-46F4-8F39-B4B94B4A7AB0@cs.otago.ac.nz> <20090216214123.GA3058@herbie> Message-ID: <8A7359A9-8328-4C2B-B486-CD54D1607264@cs.otago.ac.nz> On 17 Feb 2009, at 10:41 am, Michael Radford wrote: > But you are supposing that the function is not symmetrical. > f(a,b) =/= f(b,a). > > For functions that are actually symmetrical, as the original poster > was > asking about, either approach should give the same results when either > the upper or lower half of the matrix of clauses is correctly > specified. There is the function that one *wants* to implement, and there is the code that has been *written* to implement half of it. Michael Radford is assuming that the actually written code is correct ("is CORRECTLY specified"). I'm not. Just writing half of the clauses of a function and then pasting together two suitably adjusted copies may not give you what you expect. He is also assuming that one of the halves of the matrix has been consistently chosen ("either the upper or lower half"). I didn't say anything in the original message to indicate that this was so. I don't think we really disagree; it's a theory-vs-practice issue. From mrad-direct-erlang@REDACTED Mon Feb 16 23:56:00 2009 From: mrad-direct-erlang@REDACTED (Michael Radford) Date: Mon, 16 Feb 2009 14:56:00 -0800 Subject: [erlang-questions] "Symmetrical" function In-Reply-To: <8A7359A9-8328-4C2B-B486-CD54D1607264@cs.otago.ac.nz> References: <800885F9-69BB-4236-982D-A0D5F771B04A@cs.otago.ac.nz> <101E61D2FF7642D595E2FEF3D1DFBF1E@SSI.CORP> <31D2BB91-CFE9-46F4-8F39-B4B94B4A7AB0@cs.otago.ac.nz> <20090216214123.GA3058@herbie> <8A7359A9-8328-4C2B-B486-CD54D1607264@cs.otago.ac.nz> Message-ID: <20090216225600.GA20349@herbie> Richard O'Keefe writes: > >But you are supposing that the function is not symmetrical. > >f(a,b) =/= f(b,a). > > > >For functions that are actually symmetrical, as the original poster was > >asking about, either approach should give the same results when either > >the upper or lower half of the matrix of clauses is correctly > >specified. > > There is the function that one *wants* to implement, > and there is the code that has been *written* to implement half > of it. Michael Radford is assuming that the actually written > code is correct ("is CORRECTLY specified"). > I'm not. Just writing half of the clauses of > a function and then pasting together two suitably adjusted copies > may not give you what you expect. So you're saying that if your code has bugs, it may not do what you expect. No argument there. :) (The original poster was rather emphatic: "I have a function f(A,B) for which f(A,B) is ALWAYS equivalent to f(B,A)".) > He is also assuming that one of the halves of the matrix has been > consistently chosen ("either the upper or lower half"). I didn't > say anything in the original message to indicate that this was so. Actually, that assumption was unnecessary. I guess I should have said, "when at least one of the two possible clauses for each pair of legal patterns has been correctly specified." Mike From toby@REDACTED Sat Feb 14 19:51:27 2009 From: toby@REDACTED (Toby Thain) Date: Sat, 14 Feb 2009 13:51:27 -0500 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <489C6085-CC01-4C4D-BC84-BE26A9266324@scaldeferri.com> References: <4535f6cd0902110846w1180516u7dfbf83ce8c87970@mail.gmail.com> <3EC78F9B-5873-4E10-9A1E-A38649F96B0F@uninet.ee> <4535f6cd0902111058x32bcaf64r8536c89ad9546cc1@mail.gmail.com> <9b08084c0902120753p4785d045l366c076330a3936f@mail.gmail.com> <489C6085-CC01-4C4D-BC84-BE26A9266324@scaldeferri.com> Message-ID: <4A2DF34D-DC9B-43BB-B7DB-AD64912E8E38@telegraphics.com.au> On 12-Feb-09, at 12:12 PM, Kevin Scaldeferri wrote: > > On Feb 12, 2009, at 7:53 AM, Joe Armstrong wrote: > >> >> >> No language serves up library code to you on a plate with no effort >> involved. > > This is true, but OTOH, Erlang requires much more effort than many > other language (Perl being the gold standard here, I would say; Or arguably Java - where the libraries are indeed delivered on a plate, and are generally very high quality. --Toby > with > Ruby and, increasingly, Haskell making good showings). A good > repository of reusable code is a huge boon to a language. > > >> >> At the end of the day most good programmers end up writing the code >> they want >> because it is *quicker* than searching in vain for library code that >> may or may not work and may of may not do what they want. Even if >> they >> find the code they cannot >> be sure that it is 100% correct. > > Respectfully, I think that's quite untrue. Perhaps there are some > problem domains where it holds, but there are many others where it's > not the case. It would be pure arrogance to think that you are just > going to whip out an XML parser or an implementation of many of the > common internet protocols that is more correct than library code > that's been used by many people over many months or years. > > > -kevin > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From toby@REDACTED Sat Feb 14 19:56:51 2009 From: toby@REDACTED (Toby Thain) Date: Sat, 14 Feb 2009 13:56:51 -0500 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: References: <4535f6cd0902110846w1180516u7dfbf83ce8c87970@mail.gmail.com> <3EC78F9B-5873-4E10-9A1E-A38649F96B0F@uninet.ee> <4535f6cd0902111058x32bcaf64r8536c89ad9546cc1@mail.gmail.com> <9b08084c0902120753p4785d045l366c076330a3936f@mail.gmail.com> <489C6085-CC01-4C4D-BC84-BE26A9266324@scaldeferri.com> <20090212192832.GU23813@hezmatt.org> Message-ID: On 12-Feb-09, at 5:26 PM, Kevin Scaldeferri wrote: > > On Feb 12, 2009, at 11:28 AM, Matthew Palmer wrote: > >> Personally, as an Erlang n00b, I like the different philosophies >> embodied in >> Erlang and it's surrounding community. I've gotten sick of half- >> arsed web >> frameworks and the dodgiest of dodgy code hanging on by the skin of >> it's >> teeth. I'm looking forward to building some slightly more robust >> systems >> from here on. > > > That's great, and I wish you luck, but once you're done it would be > nice if you share some of that awesome code with the rest of us, so > everyone doesn't have to be burdened to write their own perfect code > for everything they do. TOUCH?! --Toby > > > -kevin > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From toby@REDACTED Sat Feb 14 19:55:44 2009 From: toby@REDACTED (Toby Thain) Date: Sat, 14 Feb 2009 13:55:44 -0500 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <200902121919.n1CJJaRc015818@mail.pharos-avantgard.com> References: <200902121919.n1CJJaRc015818@mail.pharos-avantgard.com> Message-ID: <982DA072-8217-400A-AA72-9D542B692CA5@telegraphics.com.au> On 12-Feb-09, at 2:21 PM, Valentin Micic wrote: >> Valentin's post has inflamed me. > > I can see that. Not sure why, but so be it. Because there are some serious problems created by constant reinvention of the wheel. 1) enormous wasted effort (good libraries are expensive to write!) 2) typically worse result (not every programmer is a genius) 3) much higher maintenance cost due to inflated codebase and ignorance of established standards (i.e. methods and tools that other people might already have skills in). 4) others, no doubt. But the only argument in your favour is, "I think I can do a better job than anyone else". Perhaps that's true of you, but it's not true of 99.9% of programmers. - And nor does that 99.9% have the time and energy to expend rewriting existing libraries. Without clear justification, I'd consider it a serious misdemeanor in a workplace. --Toby > > V. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From masklinn@REDACTED Tue Feb 17 00:33:59 2009 From: masklinn@REDACTED (Masklinn) Date: Tue, 17 Feb 2009 00:33:59 +0100 Subject: [erlang-questions] Is erlang a web language? In-Reply-To: <200902151330.41024.peter@sabaini.at> References: <8fa878b90902141829u6b94b867lc22826c03ae3df16@mail.gmail.com> <6c2563b20902141931w5ed58a53gf7291a591d0c20ce@mail.gmail.com> <9b08084c0902150356l36a1121do8bfdae7fe2d487fa@mail.gmail.com> <200902151330.41024.peter@sabaini.at> Message-ID: <3967AD6E-7031-494E-8E6C-4EC533EEA9AF@masklinn.net> On 15 Feb 2009, at 13:30 , Peter Sabaini wrote: > On Sunday 15 February 2009 12:56:19 Joe Armstrong wrote: >> This is my take on the matter. >> >> To start with I don't think one distribution scheme or library will >> ever work - the work >> making it consistent is colossal. > > Yet rubygems or PyPI seem to work out quite well. Or Cabal for haskell, or CPAN for perl, or the various OS package systems. All of these typically have issues here and there (pypi/easy_install being the worst of the bunch imo), but that's a case of "practically beats purity" and "now is better than never". Lib packaging/ distribution is a fairly hard (and not-yet-completely-solved) problem, but having something that kinda works clearly beats having nothing at all. And one can step on the shoulders of giants to learn from their mistakes. From michael.truog@REDACTED Tue Feb 17 00:39:42 2009 From: michael.truog@REDACTED (michael.truog@REDACTED) Date: Tue, 17 Feb 2009 00:39:42 +0100 Subject: [erlang-questions] beginner: Message Passing Overhead in Erlang In-Reply-To: References: Message-ID: <227455977C217E4C8E1B1E066A3C370D27E80F101D@NOK-EUMSG-01.mgdnok.nokia.com> Are you sure that MPI was using the TCP layer over the same interconnect? Otherwise it could be using a custom driver and/or hardware to provide faster messaging. If it is the same interconnect and path through TCP, then wouldn't the delay be due to the VM scheduling? Kilim might also require investigation on the Java side of things (since they claim to be faster than Erlang): http://www.malhar.net/sriram/kilim/ ________________________________ From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of ext KangMikyung Sent: Friday, February 13, 2009 12:34 PM To: erlang-questions@REDACTED Subject: [erlang-questions] beginner: Message Passing Overhead in Erlang Dear All, When I tested pingpong test, Erlang takes long time even though the data size is 0/1/2/4/8 bytes. MPI takes around 0.0025 microseconds/iteration when the data size 0/1/2/4/8 bytes. However Erlang takes around 0.5 microseconds/iteration at least. (within one core) I tried to find the underlying reasons that there is higher overhead involved in message passing in Erlang when compared to MPI, but I couldn't find it yet at "The erlang-questions Archives". How can we explain the situation that Erlang takes long time even though the data size is very small (e.g. 0 or 1)? Why the communication overhead is very big? When the data size is 16KB, Erlang was slower than MPI at least thousands time. Where can I find the explanation? Also I tested two pingpong case: (1) with data('a') and (2) without data. (1) takes 0.336 us, but (2) takes 0.0000000059 us. It's very different. Can we tell initial data related setup takes long time? Thanks, Mikyung (1) -module(tut15). -export([run/0]). -include("imb.hrl"). ping(0, _, _) -> done; ping(R, D, Pong) -> Pong ! {self(), D}, receive {Pong, D} -> ping(R - 1! , D, Pong) end. pong() -> receive {From, D} -> From ! {self(), D}, pong() end. run() -> R = 1000, D = 'a', %D = "abcdefghij", Pong = spawn(fun()-> pong() end), TimeStart = imb:time_microseconds(), ping(R, D, Pong), TimeEnd = imb:time_microseconds(), io:format("Time in microseconds: ~p~n", [TimeEnd - TimeStart]). (2) -module(tut15). -export([start/0, ping/2, pong/0]). -include("imb.hrl"). ping(0, Pong_PID) -> Pong_PID ! finished; ping(N, Pong_PID) -> Pong_PID ! {ping, self()}, receive pong -> ping(N - 1, Pong_PID) end. pong() -> receive {ping, Ping_PID} -> Ping_PID ! pong, pong() end. start() -> TimeStart = imb:time_microseconds(), Pong_PID = spawn(tut15, pong, []), spawn(tut15, ping, [1000, Pong_PID]), TimeEnd = imb:time_microseconds(), io:format("Time in microseconds: ~p~n", [TimeEnd - TimeStart]). ** time_microseconds() -> {MS, S, US} = now(), (MS * 1.0e+12) + (S * 1.0e+6) + US. ________________________________ ???? ???, ???? ?? ???? ???? ??? Windows Live Hotmail! ??? ?? ???, Windows Live Hotmail? ????! -------------- next part -------------- An HTML attachment was scrubbed... URL: From fritchie@REDACTED Tue Feb 17 00:45:46 2009 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Mon, 16 Feb 2009 17:45:46 -0600 Subject: [erlang-questions] Newbie questions about file module In-Reply-To: Message of "Thu, 12 Feb 2009 11:35:20 GMT." <4f0695950902120335u6f5f994cu87ca05dcf894276a@mail.gmail.com> Message-ID: <33591.1234827946@snookles.snookles.com> Ville Silventoinen wrote: vs> [...] It shows that 82% of the time goes in file_name_1/1, vs> which "Generates a flat file name from a deep list of atoms and vs> characters (integers)". Ville, I don't have a good reply (other than, yes, 82% of the app's user time is probably being used there ... but eprof can't measure system/in-kernel time well). But I do have a "yeah, me too!" message for the OTP gang. I've got an app that does a *lot* of file opening & closing. 1. Figure out what file a key is stored in. 2. Open that file. 3. Seek to some position within the file 4. Read some bytes. 5. Close the file 6. Lather, rinse, repeat... ... across tens of thousands of files in the local file system (representing gazillions of smaller objects). After I discovered the cost of erlang:md5/1 vs. crypto:md5/1 (see message to the list a little while ago), the 2nd biggest time sucker was the same function that Ville is complaining about: file:file_name_1/1. How frequent is it to use a deep I/O list as a file name? (Perhaps I've been in C land for too long to think that using a deep I/O list like that is actually a good idea?) Doesn't an argument like that get automatically flattened when passed to the efile_drv driver? If yes, why bother flattening on the Erlang side? -Scott From vances@REDACTED Tue Feb 17 02:51:55 2009 From: vances@REDACTED (Vance Shipley) Date: Mon, 16 Feb 2009 20:51:55 -0500 Subject: [erlang-questions] gen_[server|fsm|event]:format_status/2 no longer called Message-ID: <20090217015151.GA221@h216-235-12-174.host.egate.net> In R12B-5 I find that sys:get_status/1,2 no longer returns status formatted for the type of process it is. I have long used the undocumented gen_server et. al. callback to format the process state data. A call to sys:get_status/1,2 would result in call to gen_server:format_status/2 which would format the state data for a gen_server process. If you had exported format_status/2 from your callback module it would be called to format the state data for your application. This all seemed quite sensible to me and I used this often. Now I will miss it. -- -Vance From ok@REDACTED Tue Feb 17 05:05:10 2009 From: ok@REDACTED (Richard O'Keefe) Date: Tue, 17 Feb 2009 17:05:10 +1300 Subject: [erlang-questions] "Symmetrical" function In-Reply-To: <20090216225600.GA20349@herbie> References: <800885F9-69BB-4236-982D-A0D5F771B04A@cs.otago.ac.nz> <101E61D2FF7642D595E2FEF3D1DFBF1E@SSI.CORP> <31D2BB91-CFE9-46F4-8F39-B4B94B4A7AB0@cs.otago.ac.nz> <20090216214123.GA3058@herbie> <8A7359A9-8328-4C2B-B486-CD54D1607264@cs.otago.ac.nz> <20090216225600.GA20349@herbie> Message-ID: <7B0F2841-FBFD-472A-A922-684218BEC630@cs.otago.ac.nz> On 17 Feb 2009, at 11:56 am, Michael Radford wrote: > (The original poster was rather emphatic: "I have a function f(A,B) > for > which f(A,B) is ALWAYS equivalent to f(B,A)".) That is, the *abstract* function he wanted to implement is symmetric, but he wanted to know how to halve the work of writing it. > Actually, that assumption was unnecessary. Whether that is so depends on how the function is to be implemented. As several people pointed out, sometimes the answer is f(X, Y) when X =< Y -> f1(X, Y); f(X, Y) -> f1(Y, X). If the f1 clauses are a mix of choices from both sides of the main diagonal of the matrix, that won't work. Some obvious questions are "for the intended symmetric f : A x A -> B, what is #A? And how many clauses would you have for the implemented f without using any trickery? Why do you think it is feasible to write half of the function?" Let's take the intersection of two sorted lists as an example of a symmetric function: oi([X|Xs], [Y|Ys]) -> if X < Y -> oi(Xs, [Y|Ys]) ; X > Y -> oi([X|Xs], Ys) ; true -> oi(Xs, Ys) end; oi(_, _) -> []. Here #A is infinite, the number of clauses is 2, and I don't see any good way to write half of f. From mrad-direct-erlang@REDACTED Tue Feb 17 07:13:42 2009 From: mrad-direct-erlang@REDACTED (Michael Radford) Date: Mon, 16 Feb 2009 22:13:42 -0800 Subject: [erlang-questions] "Symmetrical" function In-Reply-To: <7B0F2841-FBFD-472A-A922-684218BEC630@cs.otago.ac.nz> References: <800885F9-69BB-4236-982D-A0D5F771B04A@cs.otago.ac.nz> <101E61D2FF7642D595E2FEF3D1DFBF1E@SSI.CORP> <31D2BB91-CFE9-46F4-8F39-B4B94B4A7AB0@cs.otago.ac.nz> <20090216214123.GA3058@herbie> <8A7359A9-8328-4C2B-B486-CD54D1607264@cs.otago.ac.nz> <20090216225600.GA20349@herbie> <7B0F2841-FBFD-472A-A922-684218BEC630@cs.otago.ac.nz> Message-ID: <20090217061342.GA19440@herbie> Richard O'Keefe writes: > >Actually, that assumption was unnecessary. > > Whether that is so depends on how the function is to be implemented. > As several people pointed out, sometimes the answer is > > f(X, Y) when X =< Y -> f1(X, Y); > f(X, Y) -> f1(Y, X). > > If the f1 clauses are a mix of choices from both sides of the > main diagonal of the matrix, that won't work. I thought we were talking about the behavior of the "interleaved parse transform method" vs. the "exception method." (Of course if f1 is consistent with symmetry, and and it uses either of those methods to generate the other half of its clauses, its behavior will be the same, regardless of the method. And f would be redundant.) I think what you mean is that if you use the above "comparison method" to generate half the clauses of f, you have to implement the f1 clauses for which X <= Y. Which is true. [snip] > oi([X|Xs], [Y|Ys]) -> > if X < Y -> oi(Xs, [Y|Ys]) > ; X > Y -> oi([X|Xs], Ys) > ; true -> oi(Xs, Ys) > end; > oi(_, _) -> > []. > > Here #A is infinite, the number of clauses is 2, and I don't see > any good way to write half of f. I think you can write just the diagonal... oi(_, _) -> []. Mike From ssroy1979@REDACTED Tue Feb 17 07:20:06 2009 From: ssroy1979@REDACTED (Salonee Sinha Roy) Date: Mon, 16 Feb 2009 22:20:06 -0800 Subject: [erlang-questions] getting rid of whitespace from ErlTL rendered xml Message-ID: Hello All I have an ErlTl template defined as follows <%? {Users} = Data %><% [user(User) || User <- Users] %> <%@ user %> <%? {Uid,Name} = Data %> <% Uid %><% Name %> When I compile and render it using a list of friends, it always puts 2 newline characters before each entry of the tag. I would like to know if there is a way of getting rid of the white space completely. Any help would be appreciated Salonee. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrad-direct-erlang@REDACTED Tue Feb 17 09:01:58 2009 From: mrad-direct-erlang@REDACTED (Michael Radford) Date: Tue, 17 Feb 2009 00:01:58 -0800 Subject: [erlang-questions] "Symmetrical" function In-Reply-To: <20090217061342.GA19440@herbie> References: <800885F9-69BB-4236-982D-A0D5F771B04A@cs.otago.ac.nz> <101E61D2FF7642D595E2FEF3D1DFBF1E@SSI.CORP> <31D2BB91-CFE9-46F4-8F39-B4B94B4A7AB0@cs.otago.ac.nz> <20090216214123.GA3058@herbie> <8A7359A9-8328-4C2B-B486-CD54D1607264@cs.otago.ac.nz> <20090216225600.GA20349@herbie> <7B0F2841-FBFD-472A-A922-684218BEC630@cs.otago.ac.nz> <20090217061342.GA19440@herbie> Message-ID: <20090217080158.GB19440@herbie> Richard O'Keefe writes: > > oi([X|Xs], [Y|Ys]) -> > > if X < Y -> oi(Xs, [Y|Ys]) > > ; X > Y -> oi([X|Xs], Ys) > > ; true -> oi(Xs, Ys) > > end; > > oi(_, _) -> > > []. > > > > Here #A is infinite, the number of clauses is 2, and I don't see > > any good way to write half of f. Joking aside, your example got me thinking -- and there is another way to look at the function I think you meant: oi([], []) -> []; oi([], [_|_]) -> []; oi([_|_], []) -> []; % * oi([X|Xs], [Y|Ys]) when X < Y -> oi(Xs, [Y|Ys]); oi([X|Xs], [Y|Ys]) when X == Y -> [X | oi(Xs, Ys)]; oi([X|Xs], [Y|Ys]) when X > Y -> oi([X|Xs], Ys). % * (I think this is the simplest way to write the function without relying on the evaluation order of clauses.) Seen this way, you have already managed to write fewer than half of the mutually exclusive clauses. Also, note that either the "parse transform" or "exception" methods would allow half of the off-diagonal clauses to be omitted (*), if only Erlang had a syntax for guards that could live inside the parameter list: oi([X (when X < Y) | Xs], [Y|Ys])-> oi(Xs, [Y|Ys]); Mike P.S. Wouldn't it be nice if regular matches had the same syntax, e.g., X (when X < 3) = f(X) I think "(when" is never currently legal, so it's even unambiguous. From john.hughes@REDACTED Tue Feb 17 09:21:10 2009 From: john.hughes@REDACTED (John Hughes) Date: Tue, 17 Feb 2009 09:21:10 +0100 Subject: [erlang-questions] SWIG and Erlang? References: Message-ID: <4FDB644378A741719DDF385E5428A0B5@JTablet2007> Every now and then someone comments that an Erlang back-end for SWIG would be nice, but there doesn't seem to be anything available. Just wondering if anyone is sitting on a prototype, or just has looked hard at the problem of creating one? John H From bgustavsson@REDACTED Tue Feb 17 09:30:04 2009 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Tue, 17 Feb 2009 09:30:04 +0100 Subject: [erlang-questions] Newbie questions about file module In-Reply-To: <33591.1234827946@snookles.snookles.com> References: <4f0695950902120335u6f5f994cu87ca05dcf894276a@mail.gmail.com> <33591.1234827946@snookles.snookles.com> Message-ID: <6672d0160902170030r1d0c0805k603e05fbd31dd03a@mail.gmail.com> On Tue, Feb 17, 2009 at 12:45 AM, Scott Lystig Fritchie wrote: > Ville Silventoinen wrote: > > How frequent is it to use a deep I/O list as a file name? (Perhaps I've > been in C land for too long to think that using a deep I/O list like > that is actually a good idea?) Doesn't an argument like that get > automatically flattened when passed to the efile_drv driver? If yes, > why bother flattening on the Erlang side? Unfortunately, for historical reasons, filenames are allowed to contain atoms and atoms are not allowed in I/O lists. At one time in OTP's history, we wanted to disallowed atoms in filenames, but it turned out that many applications used atoms in filenames. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From vychodil.hynek@REDACTED Tue Feb 17 11:05:55 2009 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Tue, 17 Feb 2009 11:05:55 +0100 Subject: [erlang-questions] Erlang marketing materials In-Reply-To: References: <22037059.post@talk.nabble.com> Message-ID: <4d08db370902170205jf10d56dgf58637f138102e2f@mail.gmail.com> 2009/2/16 Daniel Goertzen > I showed that video to a colleague of mine and his first response was "C++ > would never have allowed a typo like that to compile in the first place." > > ... so maybe that video isn't the best piece of marketing material. :) > > Dialyzer would nail something like that these days, right? > > Dan. And your reaction should be "C++ would never allowed you finish project of this sort and size in meaningful time and effort (AXD 301)". > > > On Mon, Feb 16, 2009 at 7:17 AM, Zvi wrote: > >> >> Is there are new Erlang marketing materials? >> Or should I show my prospective client "Erlang The Movie" [1] infomercial? >> ;) >> >> Zvi >> >> 1. http://www.youtube.com/watch?v=uKfKtXYLG78 >> >> -- >> View this message in context: >> http://www.nabble.com/Erlang-marketing-materials-tp22037059p22037059.html >> Sent from the Erlang Questions mailing list archive at Nabble.com. >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > > -- > Daniel Goertzen > email: dang@REDACTED > phone: 1 443 303 8525 > cell: 1 204 470 8360 > sip: 945050@REDACTED > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try Good Data now for free: www.gooddata.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From bgustavsson@REDACTED Tue Feb 17 11:10:26 2009 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Tue, 17 Feb 2009 11:10:26 +0100 Subject: [erlang-questions] Newbie questions about file module In-Reply-To: <4f0695950902120335u6f5f994cu87ca05dcf894276a@mail.gmail.com> References: <4f0695950902120335u6f5f994cu87ca05dcf894276a@mail.gmail.com> Message-ID: <6672d0160902170210t6c24e8c9wdc952be080fdbd6e@mail.gmail.com> 2009/2/12 Ville Silventoinen : > Hi, > > My second question relates to eprof. I analysed the execution of my program > (copying /usr/local/lib to NFS directory). The eprof:total_analyse/0 results > are below ("mirror11" is my module). It shows that 82% of the time goes in > file_name_1/1, which "Generates a flat file name from a deep list of atoms > and characters (integers)". Does this really mean that 82% of time is spent > here, instead of doing disk I/O? I would have expected file:copy/2 to be on > the top of the list. (There are 481 directories and 6744 files in my > /usr/local/lib.) > Unless you specifically included the file_server_2 process in the set of processes to profile, you are only profiling the time spent in your own processes and not code that is executed in other processes. (And since I don't see no calls from the file_server or prim_file module in the output from eprof, I assume that you did not include the file_server_2 process.) /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From vladdu55@REDACTED Tue Feb 17 11:13:33 2009 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 17 Feb 2009 11:13:33 +0100 Subject: [erlang-questions] beam process dies with code 135 (SIGBUS) Message-ID: <95be1d3b0902170213t27bf876ere0f481066d02e483@mail.gmail.com> Hi! Does anyone have any experience of runtimes dying with code 135, meaning by signal 7 (SIGBUS) (i.e. Bus error (bad memory access)) on Linux? We have seen nodes going down with this reason relatively often (but randomly) and I don't know how to locate the problem. There doesn't seem to be any code dump. Could this be triggered by something internal? This is a SUSE distribution with > uname -a Linux selnx120 2.6.16.53-0.16-bigsmp #1 SMP Tue Oct 2 16:57:49 UTC 2007 i686 i686 i386 GNU/Linux best regards, Vlad From bbmaj7@REDACTED Tue Feb 17 11:59:30 2009 From: bbmaj7@REDACTED (Richard Andrews) Date: Tue, 17 Feb 2009 02:59:30 -0800 (PST) Subject: [erlang-questions] beam process dies with SIGBUS References: <95be1d3b0902170213t27bf876ere0f481066d02e483@mail.gmail.com> Message-ID: <94915.53900.qm@web65512.mail.ac4.yahoo.com> > Does anyone have any experience of runtimes dying with code 135, > meaning by signal 7 (SIGBUS) (i.e. Bus error (bad memory access)) on > Linux? Have you tried building OTP for i386? IIRC x86_32 has no alignment restrictions meaning SIGBUS should not ever be generated on the architecture. But I read somewhere recently that SSE2 instructions and x86_64 do have alignment restrictions, hence the i386 suggestion above. Could something be sending SIGBUS to beam? Are you mixing 64-bit and 32-bit components? Make Yahoo!7 your homepage and win a trip to the Quiksilver Pro. Find out more From raimo+erlang-questions@REDACTED Tue Feb 17 12:30:22 2009 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Tue, 17 Feb 2009 12:30:22 +0100 Subject: [erlang-questions] Hacked group home page Message-ID: <20090217113022.GA22897@erix.ericsson.se> Hi all! Since we get no response from the group owner of the Google group "Erlang Questions" nor from Google Groups regarding the unsuitable content on the welcome page and among Pages and Files, we have started a new group "Erlang Programming": http://groups.google.com/group/erlang-programming The new group has been preloaded with archives since 2007, and we (the Erlang/OTP team) are the owners. It has more restrictive security settings and we will do what we can to avoid a similar situation. The old group will be disconnected as soon as this mail arrives there, so its archives will no longer be updated. All Google groups members are hereby welcome over to http://groups.google.com/group/erlang-programming For now anyone can join but we will see if we must have an invitation procedure later on... -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From vladdu55@REDACTED Tue Feb 17 12:32:45 2009 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 17 Feb 2009 12:32:45 +0100 Subject: [erlang-questions] beam process dies with SIGBUS In-Reply-To: <94915.53900.qm@web65512.mail.ac4.yahoo.com> References: <95be1d3b0902170213t27bf876ere0f481066d02e483@mail.gmail.com> <94915.53900.qm@web65512.mail.ac4.yahoo.com> Message-ID: <95be1d3b0902170332o5e98417oc46a5edad593972c@mail.gmail.com> Hi, On Tue, Feb 17, 2009 at 11:59, Richard Andrews wrote: >> Does anyone have any experience of runtimes dying with code 135, >> meaning by signal 7 (SIGBUS) (i.e. Bus error (bad memory access)) on >> Linux? > > Have you tried building OTP for i386? > > IIRC x86_32 has no alignment restrictions meaning SIGBUS should not ever be generated on the architecture. But I read somewhere recently that SSE2 instructions and x86_64 do have alignment restrictions, hence the i386 suggestion above. Unfortunately I can't easily rebuild. This happens in a restricted environment where I don't have too much freedom. BTW the Erlang version is R12B-4. > Could something be sending SIGBUS to beam? Not that I know of. > Are you mixing 64-bit and 32-bit components? That's a good question too. I will check. Thanks! regards, Vlad From ville.silventoinen@REDACTED Tue Feb 17 12:39:24 2009 From: ville.silventoinen@REDACTED (Ville Silventoinen) Date: Tue, 17 Feb 2009 11:39:24 +0000 Subject: [erlang-questions] Newbie questions about file module In-Reply-To: <6672d0160902170210t6c24e8c9wdc952be080fdbd6e@mail.gmail.com> References: <4f0695950902120335u6f5f994cu87ca05dcf894276a@mail.gmail.com> <6672d0160902170210t6c24e8c9wdc952be080fdbd6e@mail.gmail.com> Message-ID: <4f0695950902170339y3ee06c66y45bb1330c4ba7ff6@mail.gmail.com> Hi Bjorn, Thank you very much for your help, you were right that I only included my own module in the eprof. I ran it again now with file_server_2, the time in file_name_1 has now dropped to 27%: 6> eprof:total_analyse(). FUNCTION CALLS TIME erlang:port_command/2 65075 53 % file:file_name_1/1 3086234 27 % prim_file:get_uint32s/1 231210 3 % prim_file:drv_get_response/1 72301 1 % prim_file:uint32/4 223503 1 % gen:do_call/4 29869 1 % prim_file:drv_command/4 65075 1 % prim_file:translate_response/2 72301 1 % gen_server:handle_msg/5 29869 1 % prim_file:drv_command/3 65075 1 % file:check_args/1 93941 0 % gen:wait_resp_mon/3 29869 0 % file_server:handle_call/3 29869 0 % mirror11:get_file_info/2 21195 0 % erlang:iolist_to_binary/1 44100 0 % prim_file:get_uint64/1 28462 0 % prim_file:drv_get_response/2 72301 0 % file:check_and_call/2 29869 0 % gen:call/4 29869 0 % prim_file:open_int/4 26976 0 % file:file_name/1 36615 0 % file:call/2 29869 0 % prim_file:open_mode/4 40464 0 % gen_server:call/3 29869 0 % prim_file:drv_command/2 64113 0 % erlang:bump_reductions/1 72301 0 % gen_server:loop/6 29869 0 % prim_file:write_file_info_int/3 7225 0 % mirror11:do_file/4 6744 0 % prim_file:reverse/1 26976 0 % prim_file:get_uint32/1 56924 0 % gen_server:reply/2 29869 0 % prim_file:transform_info_ints/1 7707 0 % file:read_link_info/1 14451 0 % file:copy_int/3 13488 0 % prim_file:drv_close/1 13488 0 % erlang:'++'/2 21680 0 % erlang:monitor/2 29869 0 % gen_server:decode_msg/8 29869 0 % erlang:whereis/1 29869 0 % erlang:open_port/2 13488 0 % prim_file:open/2 13488 0 % erlang:list_to_tuple/1 29869 0 % prim_file:close/1 13488 0 % erlang:list_to_binary/1 21195 0 % erlang:port_close/1 13488 0 % erlang:demonitor/1 29869 0 % prim_file:drv_open/2 13488 0 % prim_file:open_mode/1 13488 0 % file:copy_opened_int/4 7487 0 % mirror11:by_type/6 7707 0 % ets:lookup/2 21195 0 % lists:reverse/2 26976 0 % lists:foreach/2 7708 0 % prim_file:int_to_bytes/1 21675 0 % mirror11:log_debug/2 6748 0 % prim_file:date_to_bytes/1 21675 0 % file:write_file_info/2 7225 0 % prim_file:read/2 7487 0 % prim_file:write/2 7487 0 % prim_file:read_link_info/2 14451 0 % prim_file:read_link_info_int/2 14451 0 % ets:insert/2 7707 0 % prim_file:open_int_setopts/3 13488 0 % erlang:list_to_atom/1 7227 0 % file:read/2 7487 0 % file:write/2 7487 0 % mirror11:do_dir/3 481 0 % prim_file:copy/3 6744 0 % prim_file:write_file_info/3 7225 0 % prim_file:file_access/1 7707 0 % file:copy_opened_int/3 6744 0 % prim_file:file_type/1 7707 0 % file:copy_opened/3 6744 0 % mirror11:'-do_dir/3-fun-5-'/4 6744 0 % file:copy/2 6744 0 % ets:delete/1 481 0 % mirror11:start_dir_workers/5 963 0 % file:list_dir/1 962 0 % mirror11:rendezvous/1 963 0 % file:make_dir/1 481 0 % erlang:apply/2 481 0 % erlang:spawn/3 481 0 % ets:new/2 481 0 % prim_file:list_dir/2 962 0 % erlang:spawn/1 481 0 % prim_file:list_dir_int/2 962 0 % prim_file:make_dir/2 481 0 % prim_file:make_dir_int/2 481 0 % mirror11:'-start_dir_workers/5-fun-0-'/3 481 0 % mirror11:do_symlink/4 2 0 % file:read_link/1 4 0 % mirror11:master_loop/0 1 0 % file:make_symlink/2 2 0 % prim_file:read_link/2 4 0 % prim_file:read_link_int/2 4 0 % mirror11:'-do_dir/3-fun-6-'/4 2 0 % prim_file:make_symlink/3 2 0 % prim_file:make_symlink_int/3 2 0 % Total time: 157.56 Measurement overhead: 20.49 Thanks, Ville On Tue, Feb 17, 2009 at 10:10 AM, Bjorn Gustavsson wrote: > Unless you specifically included the file_server_2 process in the set > of processes > to profile, you are only profiling the time spent in your own > processes and not code > that is executed in other processes. (And since I don't see no calls > from the file_server or prim_file > module in the output from eprof, I assume that you did not include the > file_server_2 process.) > > /Bjorn > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mikpe@REDACTED Tue Feb 17 13:26:25 2009 From: mikpe@REDACTED (Mikael Pettersson) Date: Tue, 17 Feb 2009 13:26:25 +0100 Subject: [erlang-questions] beam process dies with code 135 (SIGBUS) In-Reply-To: <95be1d3b0902170213t27bf876ere0f481066d02e483@mail.gmail.com> References: <95be1d3b0902170213t27bf876ere0f481066d02e483@mail.gmail.com> Message-ID: <18842.44273.592250.534330@harpo.it.uu.se> Vlad Dumitrescu writes: > Hi! > > Does anyone have any experience of runtimes dying with code 135, > meaning by signal 7 (SIGBUS) (i.e. Bus error (bad memory access)) on > Linux? > > We have seen nodes going down with this reason relatively often (but > randomly) and I don't know how to locate the problem. There doesn't > seem to be any code dump. SIGBUS on x86 can AFAIK only be triggered by alignment errors, which for x86 user-mode code means largish data transfers using SSE instructions. (That is, unless the environment foolishly sets the #AC bit in eflags, in which case even plain misaligned integer loads/stores will trap.) Debugging this requires a core dump and the corresponding beam executable. If you're not getting core dumps, see if they've been disabled by default (man ulimit or limit). From dmitriid@REDACTED Tue Feb 17 13:47:01 2009 From: dmitriid@REDACTED (Dmitrii Dimandt) Date: Tue, 17 Feb 2009 14:47:01 +0200 Subject: [erlang-questions] Hacked group home page In-Reply-To: <20090217113022.GA22897@erix.ericsson.se> References: <20090217113022.GA22897@erix.ericsson.se> Message-ID: <4AC3804D-3D0D-4924-93E3-8B29617DCE6E@gmail.com> On Feb 17, 2009, at 1:30 PM, Raimo Niskanen wrote: > Hi all! > > Since we get no response from the group owner of the > Google group "Erlang Questions" nor from Google Groups > regarding the unsuitable content on the welcome page > and among Pages and Files, we have started a new group > "Erlang Programming": > http://groups.google.com/group/erlang-programming > > The new group has been preloaded with archives since 2007, > and we (the Erlang/OTP team) are the owners. It has more > restrictive security settings and we will do what we can > to avoid a similar situation. > > The old group will be disconnected as soon as this mail > arrives there, so its archives will no longer be updated. > > All Google groups members are hereby welcome over to > http://groups.google.com/group/erlang-programming > For now anyone can join but we will see if we must have > an invitation procedure later on... > Since the group currently works as an archive, I cannot join using the "Email" option in the "How do you want to read this group" page From q2h46uw02@REDACTED Tue Feb 17 14:31:55 2009 From: q2h46uw02@REDACTED (Kevin) Date: Tue, 17 Feb 2009 08:31:55 -0500 Subject: [erlang-questions] supervisor behaves differently if started from command line Message-ID: <8803-08702@sneakemail.com> Hello, I'll post the relevant two files below. One is a supervisor and the other a gen_server, and both are barely anything more than slightly modified skeletons from the erlang emacs mode. When I run the supervisor from the command line "erl -s mysup" I find that all the startup and init functions are called, but then there is nothing there, whereis(mygen) returns undefined and a cal to mygen:doit() returns a noproc error. However, when I run this from the erlang shell I have no problems Eshell V5.6.5 (abort with ^G) 1> mysup:start(). {ok,<0.32.0>} 2> whereis(mygen). <0.33.0> 3> mygen:doit("asdf"). in handle call, request is "asdf" ok 4> When I put in io:format debug statements in, I find that all the same functions are called, its just that starting from the command line seems to be shooting blanks. I hope this is not because I decided to decapitate my code of the "application" behavior. I did that because its just too many layers, I like to keep things simple. Is it ok to use a supervisor at the top? I think it makes more sense if you are starting things with a unix style init script Thanks! === mysup.erl ========================================= -module(mysup). -behaviour(supervisor). -export([start/0, start_link/0]). -export([init/1]). -define(SERVER, ?MODULE). start() -> start_link(). start_link() -> supervisor:start_link({local, ?SERVER}, ?MODULE, []). init([]) -> AChild = {mygen,{mygen,start_link,[]}, permanent,2000,worker,[]}, {ok,{{one_for_one,10,10}, [AChild]}}. === mygen.erl =================================== -module(mygen). -behaviour(gen_server). -export([start_link/0, doit/1]). -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). -record(state, {}). start_link() -> gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). init([]) -> {ok, #state{}}. doit(Text) -> gen_server:call(?MODULE, Text). handle_call(Request, _From, State) -> io:format("in handle call, request is ~p~n", [Request]), {reply, ok, State}. handle_cast(_Msg, State) -> {noreply, State}. handle_info(_Info, State) -> {noreply, State}. terminate(_Reason, _State) -> ok. code_change(_OldVsn, State, _Extra) -> {ok, State}. From vladdu55@REDACTED Tue Feb 17 14:34:03 2009 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 17 Feb 2009 14:34:03 +0100 Subject: [erlang-questions] beam process dies with code 135 (SIGBUS) In-Reply-To: <18842.44273.592250.534330@harpo.it.uu.se> References: <95be1d3b0902170213t27bf876ere0f481066d02e483@mail.gmail.com> <18842.44273.592250.534330@harpo.it.uu.se> Message-ID: <95be1d3b0902170534r30bc7725wf87436850a0d524a@mail.gmail.com> On Tue, Feb 17, 2009 at 13:26, Mikael Pettersson wrote: > Vlad Dumitrescu writes: > > Does anyone have any experience of runtimes dying with code 135, > > meaning by signal 7 (SIGBUS) (i.e. Bus error (bad memory access)) on > > Linux? > > SIGBUS on x86 can AFAIK only be triggered by alignment errors, > which for x86 user-mode code means largish data transfers using > SSE instructions. > Debugging this requires a core dump and the corresponding beam > executable. If you're not getting core dumps, see if they've > been disabled by default (man ulimit or limit). Thanks! Yes, the core dumps are disabled. I'll see what I can do about that. regards, Vlad From ext@REDACTED Tue Feb 17 15:25:41 2009 From: ext@REDACTED (David Sveningsson) Date: Tue, 17 Feb 2009 15:25:41 +0100 Subject: [erlang-questions] Attribute named type Message-ID: <499AC8E5.6020203@sidvind.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I'm using some user-defined attributes in my modules. I want to use one named type but I doesn't show up with module_info/1 or even module_info/0. Is it reserved by something or am I doing something else wrong? I tried to lookup the predefined attributes but I couldn't find anything about 'type'. I can read the other attributes fine. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkmayOUACgkQ6pa1H/H5pqVdRwCfUIXGqMyO2OKudeMSnMPMfjfy D8cAnRsWX4kLdtMnv/V10zW9j2VA28NI =Aj/8 -----END PGP SIGNATURE----- From admin.erlang.programming@REDACTED Tue Feb 17 16:12:25 2009 From: admin.erlang.programming@REDACTED (Webmaster Erlang/OTP) Date: Tue, 17 Feb 2009 07:12:25 -0800 (PST) Subject: [erlang-questions] Hacked group home page In-Reply-To: <4AC3804D-3D0D-4924-93E3-8B29617DCE6E@gmail.com> References: <20090217113022.GA22897@erix.ericsson.se> <4AC3804D-3D0D-4924-93E3-8B29617DCE6E@gmail.com> Message-ID: On Feb 17, 1:47 pm, Dmitrii Dimandt wrote: > On Feb 17, 2009, at 1:30 PM, Raimo Niskanen wrote: > : > > All Google groups members are hereby welcome over to > >http://groups.google.com/group/erlang-programming > > For now anyone can join but we will see if we must have > > an invitation procedure later on... > > Since the group currently works as an archive, I cannot join using the > "Email" option in the "How do you want to read this group" page > I see... You could perhaps subscribe to the erlang-questions mailing list. I also thought you had to be subscribed to the mailing list anyway to be able to post. Could you set the "Email" option on the old group? I assumed it also had to be an archive since it is the only way I have found to connect it to an external mailing list. > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions From getyourcontacts@REDACTED Tue Feb 17 16:21:44 2009 From: getyourcontacts@REDACTED (Yang Zhang) Date: Tue, 17 Feb 2009 23:21:44 +0800 Subject: [erlang-questions] ibrowse compile error Message-ID: <4535f6cd0902170721j61f34565kd978c43177e6a351@mail.gmail.com> Hi. All. I am trying to find a better httpclient library of Erlang. So I am trying ibrowse. But I got a compile error. make[3]: Entering directory `/home/scott/erlang/jungerl/lib/ucs/priv' erl -noshell -pa ../ebin -s ucs rebuild_database mibenum -s init stop ERROR: {undef,[{httpd_util,to_lower,["ANSI_X3.4-1968"]}, {ucs_data_build,scan_name_line,1}, {ucs_data_build,process_mibenum_data_file,1}, {ucs_data_build,mibenum,1}, {ucs_data,rebuild_database,2}, {init,start_it,1}, {init,start_em,1}]}make[3]: Leaving directory `/home/scott/erlang/jungerl/lib/ucs/priv' make[2]: Leaving directory `/home/scott/erlang/jungerl/lib/ucs' any idea? thanks. Regards. Scott -------------- next part -------------- An HTML attachment was scrubbed... URL: From essiene@REDACTED Tue Feb 17 16:30:48 2009 From: essiene@REDACTED (Essien Essien) Date: Tue, 17 Feb 2009 16:30:48 +0100 Subject: [erlang-questions] supervisor behaves differently if started from command line In-Reply-To: <8803-08702@sneakemail.com> References: <8803-08702@sneakemail.com> Message-ID: <88b82c90902170730n4f729a1bo23e402122ef990c5@mail.gmail.com> Hi Kevin, On Tue, Feb 17, 2009 at 2:31 PM, Kevin wrote: > > Hello, I'll post the relevant two files below. One is a supervisor and > the other a gen_server, and both are barely anything more than slightly > modified skeletons from the erlang emacs mode. > > When I run the supervisor from the command line "erl -s mysup" I find > that all the startup and init functions are called, but > then there is nothing there, whereis(mygen) returns undefined and a cal > to mygen:doit() returns a noproc error. The supervisor has run and exited, taking with it all its child processes. > > However, when I run this from the erlang shell I have no problems > > Eshell V5.6.5 (abort with ^G) > 1> mysup:start(). > {ok,<0.32.0>} > 2> whereis(mygen). > <0.33.0> > 3> mygen:doit("asdf"). > in handle call, request is "asdf" > ok > 4> The supervisor is still alive. > > > When I put in io:format debug statements in, I find that all the same > functions are called, its just that starting from the command line seems > to be shooting blanks. > > I hope this is not because I decided to decapitate my code of the > "application" behavior. I did that because its just too many layers, I > like to keep > things simple. Is it ok to use a supervisor at the top? I think it > makes more sense if you are starting things with a unix style init script Actually that is the problem. Other more experienced users may have more to say here, but from what I've observed, a supervisor is _suposed_ to be started by an application, not alone. If you check the man page for supervisor, you'll notice there's no start function, only start_link. And start_link, creates a link to the calling process, which means that once the calling process runs to an end and dies, the called process will also die. When you invoke your supervisor as erl -s mysup The top level starts mysup.erl, runs the init callback and exits hence taking the supervisor with it. But when you start it via an application, the application blocks till it is explicitly killed. Hope that helps. (I'm also somewhat of an erlang newbie :) ) cheers, Essien > > Thanks! > > > === mysup.erl ========================================= > > -module(mysup). > -behaviour(supervisor). > -export([start/0, start_link/0]). > > -export([init/1]). > > -define(SERVER, ?MODULE). > > start() -> > start_link(). > > start_link() -> > supervisor:start_link({local, ?SERVER}, ?MODULE, []). > > init([]) -> > AChild = {mygen,{mygen,start_link,[]}, > permanent,2000,worker,[]}, > {ok,{{one_for_one,10,10}, [AChild]}}. > > > === mygen.erl =================================== > -module(mygen). > -behaviour(gen_server). > -export([start_link/0, doit/1]). > -export([init/1, handle_call/3, handle_cast/2, handle_info/2, > terminate/2, code_change/3]). > > -record(state, {}). > > start_link() -> > gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). > > init([]) -> > {ok, #state{}}. > > doit(Text) -> > gen_server:call(?MODULE, Text). > > handle_call(Request, _From, State) -> > io:format("in handle call, request is ~p~n", [Request]), > {reply, ok, State}. > > handle_cast(_Msg, State) -> > {noreply, State}. > > handle_info(_Info, State) -> > {noreply, State}. > > terminate(_Reason, _State) -> > ok. > > code_change(_OldVsn, State, _Extra) -> > {ok, State}. > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From dmitriid@REDACTED Tue Feb 17 16:37:11 2009 From: dmitriid@REDACTED (Dmitrii Dimandt) Date: Tue, 17 Feb 2009 17:37:11 +0200 Subject: [erlang-questions] Hacked group home page In-Reply-To: References: <20090217113022.GA22897@erix.ericsson.se> <4AC3804D-3D0D-4924-93E3-8B29617DCE6E@gmail.com> Message-ID: On Feb 17, 2009, at 5:12 PM, Webmaster Erlang/OTP wrote: > On Feb 17, 1:47 pm, Dmitrii Dimandt wrote: >> On Feb 17, 2009, at 1:30 PM, Raimo Niskanen wrote: >> > : >>> All Google groups members are hereby welcome over to >>> http://groups.google.com/group/erlang-programming >>> For now anyone can join but we will see if we must have >>> an invitation procedure later on... >> >> Since the group currently works as an archive, I cannot join using >> the >> "Email" option in the "How do you want to read this group" page >> > > I see... You could perhaps subscribe to the erlang-questions mailing > list. > I also thought you had to be subscribed to the mailing list anyway > to be able to post. > > Could you set the "Email" option on the old group? I assumed it also > had to be an archive since it is the only way I have found to connect > it to an external mailing list. > Oh. That's probably it :) From gleber.p@REDACTED Tue Feb 17 16:37:48 2009 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 17 Feb 2009 16:37:48 +0100 Subject: [erlang-questions] ibrowse compile error In-Reply-To: <4535f6cd0902170721j61f34565kd978c43177e6a351@mail.gmail.com> References: <4535f6cd0902170721j61f34565kd978c43177e6a351@mail.gmail.com> Message-ID: <14f0e3620902170737o2f067e04m5054f4c99461707c@mail.gmail.com> Since you need only a HTTP client (not the whole jungerl package) try to fetch ibrowse from github: git clone git://github.com/dizzyd/ibrowse.git cd ibrowse make 2009/2/17 Yang Zhang : > Hi. All. > > I am trying to find a better httpclient library of Erlang. > > So I am trying ibrowse. But I got a compile error. > > make[3]: Entering directory `/home/scott/erlang/jungerl/lib/ucs/priv' > erl -noshell -pa ../ebin -s ucs rebuild_database mibenum -s init stop > ERROR: {undef,[{httpd_util,to_lower,["ANSI_X3.4-1968"]}, > {ucs_data_build,scan_name_line,1}, > {ucs_data_build,process_mibenum_data_file,1}, > {ucs_data_build,mibenum,1}, > {ucs_data,rebuild_database,2}, > {init,start_it,1}, > {init,start_em,1}]}make[3]: Leaving directory > `/home/scott/erlang/jungerl/lib/ucs/priv' > make[2]: Leaving directory `/home/scott/erlang/jungerl/lib/ucs' > > any idea? > > thanks. > > Regards. > > Scott > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From tamas.nagy@REDACTED Tue Feb 17 16:38:30 2009 From: tamas.nagy@REDACTED (Tamas Nagy) Date: Tue, 17 Feb 2009 15:38:30 +0000 Subject: [erlang-questions] ibrowse compile error In-Reply-To: <4535f6cd0902170721j61f34565kd978c43177e6a351@mail.gmail.com> References: <4535f6cd0902170721j61f34565kd978c43177e6a351@mail.gmail.com> Message-ID: <5080023A-7048-495C-9EBF-B2484DD2DF61@erlang-consulting.com> Hi! The ucs application seem to depend on an older version of httpd_util (pre R12). Try to change httpd_util:to_lower/1 to string:to_lower/1 or use it with an earlier version of erlang. Regards, Tamas Tamas Nagy Erlang Training & Consulting http://www.erlang-consulting.com On 17 Feb 2009, at 15:21, Yang Zhang wrote: > Hi. All. > > I am trying to find a better httpclient library of Erlang. > > So I am trying ibrowse. But I got a compile error. > > make[3]: Entering directory `/home/scott/erlang/jungerl/lib/ucs/priv' > erl -noshell -pa ../ebin -s ucs rebuild_database mibenum -s init stop > ERROR: {undef,[{httpd_util,to_lower,["ANSI_X3.4-1968"]}, > {ucs_data_build,scan_name_line,1}, > {ucs_data_build,process_mibenum_data_file,1}, > {ucs_data_build,mibenum,1}, > {ucs_data,rebuild_database,2}, > {init,start_it,1}, > {init,start_em,1}]}make[3]: Leaving directory `/home/scott/erlang/ > jungerl/lib/ucs/priv' > make[2]: Leaving directory `/home/scott/erlang/jungerl/lib/ucs' > > any idea? > > > thanks. > > Regards. > > Scott > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From rtrlists@REDACTED Tue Feb 17 16:41:05 2009 From: rtrlists@REDACTED (Robert Raschke) Date: Tue, 17 Feb 2009 15:41:05 +0000 Subject: [erlang-questions] ibrowse compile error In-Reply-To: <4535f6cd0902170721j61f34565kd978c43177e6a351@mail.gmail.com> References: <4535f6cd0902170721j61f34565kd978c43177e6a351@mail.gmail.com> Message-ID: <6a3ae47e0902170741y20973492jd3ddcc1e580e222c@mail.gmail.com> 2009/2/17 Yang Zhang : > So I am trying ibrowse. But I got a compile error. > > make[3]: Entering directory `/home/scott/erlang/jungerl/lib/ucs/priv' > erl -noshell -pa ../ebin -s ucs rebuild_database mibenum -s init stop > ERROR: {undef,[{httpd_util,to_lower,["ANSI_X3.4-1968"]}, > {ucs_data_build,scan_name_line,1}, > {ucs_data_build,process_mibenum_data_file,1}, > {ucs_data_build,mibenum,1}, > {ucs_data,rebuild_database,2}, > {init,start_it,1}, > {init,start_em,1}]}make[3]: Leaving directory > `/home/scott/erlang/jungerl/lib/ucs/priv' > make[2]: Leaving directory `/home/scott/erlang/jungerl/lib/ucs' Not sure which version of Erlang you're using, but in R12B it looks like there's no httpd_util:to_lower/1, but there is a string:to_lower/1. So you could replace the call in ucs_data_build:scan_name_line/1 perhaps? Robby From nthauvin@REDACTED Tue Feb 17 16:49:33 2009 From: nthauvin@REDACTED (Nicolas Thauvin) Date: Tue, 17 Feb 2009 16:49:33 +0100 Subject: [erlang-questions] prim_inet:async_accept/2 Message-ID: Hello, prim_inet:async_accept/2 looks like a very interesting function to use in a gen_server. However, it is not documented. Several examples on the Internet already use it (like http://www.trapexit.org/Building_a_Non-blocking_TCP_server_using_OTP_principles). Questions are: - Why isn't it wrapped in gen_tcp ? - Is it safe to use it (will it be obsolete in the next release ?) ? Cheers, -- Nicolas From chsu79@REDACTED Tue Feb 17 16:57:37 2009 From: chsu79@REDACTED (Christian) Date: Tue, 17 Feb 2009 16:57:37 +0100 Subject: [erlang-questions] prim_inet:async_accept/2 In-Reply-To: References: Message-ID: Why not use plain gen_tcp:accept() and then gen_server:enter_loop() ? With an accept timout you can fall out and poll for mailbox messages and get back into trying to accept again, making it semi-active. About prim_inet being safe to use, what I have picked up pretty clearly from OTP is that if-it-isnt-documented-it-should-not-be-depended-on. On Tue, Feb 17, 2009 at 16:49, Nicolas Thauvin wrote: > Hello, > > prim_inet:async_accept/2 looks like a very interesting function to use in > a gen_server. However, it is not documented. > Several examples on the Internet already use it (like > > http://www.trapexit.org/Building_a_Non-blocking_TCP_server_using_OTP_principles > ). > > Questions are: > - Why isn't it wrapped in gen_tcp ? > - Is it safe to use it (will it be obsolete in the next release ?) ? > > Cheers, > > -- Nicolas > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From getyourcontacts@REDACTED Tue Feb 17 17:23:43 2009 From: getyourcontacts@REDACTED (Yang Zhang) Date: Wed, 18 Feb 2009 00:23:43 +0800 Subject: [erlang-questions] ibrowse compile error In-Reply-To: <6a3ae47e0902170741y20973492jd3ddcc1e580e222c@mail.gmail.com> References: <4535f6cd0902170721j61f34565kd978c43177e6a351@mail.gmail.com> <6a3ae47e0902170741y20973492jd3ddcc1e580e222c@mail.gmail.com> Message-ID: <4535f6cd0902170823u56321a94yc29ec2e4436880d0@mail.gmail.com> Thanks. I thing I am using R12B-5. Here is my erl shell output when it start. Erlang (BEAM) emulator version 5.6.5 [source] [smp:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.6.5 (abort with ^G). I tried replace httpd_util:to_lower with string:to_lower and now it complies ok. Thanks for all your help. Regards. Scott On Tue, Feb 17, 2009 at 11:41 PM, Robert Raschke wrote: > 2009/2/17 Yang Zhang : > > So I am trying ibrowse. But I got a compile error. > > > > make[3]: Entering directory `/home/scott/erlang/jungerl/lib/ucs/priv' > > erl -noshell -pa ../ebin -s ucs rebuild_database mibenum -s init stop > > ERROR: {undef,[{httpd_util,to_lower,["ANSI_X3.4-1968"]}, > > {ucs_data_build,scan_name_line,1}, > > {ucs_data_build,process_mibenum_data_file,1}, > > {ucs_data_build,mibenum,1}, > > {ucs_data,rebuild_database,2}, > > {init,start_it,1}, > > {init,start_em,1}]}make[3]: Leaving directory > > `/home/scott/erlang/jungerl/lib/ucs/priv' > > make[2]: Leaving directory `/home/scott/erlang/jungerl/lib/ucs' > > Not sure which version of Erlang you're using, but in R12B it looks > like there's no httpd_util:to_lower/1, but there is a > string:to_lower/1. So you could replace the call in > ucs_data_build:scan_name_line/1 perhaps? > > Robby > -------------- next part -------------- An HTML attachment was scrubbed... URL: From getyourcontacts@REDACTED Tue Feb 17 17:27:25 2009 From: getyourcontacts@REDACTED (Yang Zhang) Date: Wed, 18 Feb 2009 00:27:25 +0800 Subject: [erlang-questions] ibrowse compile error In-Reply-To: <14f0e3620902170737o2f067e04m5054f4c99461707c@mail.gmail.com> References: <4535f6cd0902170721j61f34565kd978c43177e6a351@mail.gmail.com> <14f0e3620902170737o2f067e04m5054f4c99461707c@mail.gmail.com> Message-ID: <4535f6cd0902170827j35079251ub960bd4f301e77f4@mail.gmail.com> Hi. Gleb. I tried use git to get ibrowse as you wrote. (To save time in case I need another thing next time.) Then I got a copy, then I typed cd ibrowse make scott@REDACTED:/windows/d/erlang/us/ibrowse> make make: *** No targets specified and no makefile found. Stop. Yes. I didn't see Makefile in that directory too. Is there anything mistake? Regards. Scott On Tue, Feb 17, 2009 at 11:37 PM, Gleb Peregud wrote: > Since you need only a HTTP client (not the whole jungerl package) try > to fetch ibrowse from github: > > git clone git://github.com/dizzyd/ibrowse.git > cd ibrowse > make > > 2009/2/17 Yang Zhang : > > Hi. All. > > > > I am trying to find a better httpclient library of Erlang. > > > > So I am trying ibrowse. But I got a compile error. > > > > make[3]: Entering directory `/home/scott/erlang/jungerl/lib/ucs/priv' > > erl -noshell -pa ../ebin -s ucs rebuild_database mibenum -s init stop > > ERROR: {undef,[{httpd_util,to_lower,["ANSI_X3.4-1968"]}, > > {ucs_data_build,scan_name_line,1}, > > {ucs_data_build,process_mibenum_data_file,1}, > > {ucs_data_build,mibenum,1}, > > {ucs_data,rebuild_database,2}, > > {init,start_it,1}, > > {init,start_em,1}]}make[3]: Leaving directory > > `/home/scott/erlang/jungerl/lib/ucs/priv' > > make[2]: Leaving directory `/home/scott/erlang/jungerl/lib/ucs' > > > > any idea? > > > > thanks. > > > > Regards. > > > > Scott > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > -- > Gleb Peregud > http://gleber.pl/ > > Every minute is to be grasped. > Time waits for nobody. > -- Inscription on a Zen Gong > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kenneth.lundin@REDACTED Tue Feb 17 17:33:31 2009 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Tue, 17 Feb 2009 17:33:31 +0100 Subject: [erlang-questions] ibrowse compile error In-Reply-To: <4535f6cd0902170721j61f34565kd978c43177e6a351@mail.gmail.com> References: <4535f6cd0902170721j61f34565kd978c43177e6a351@mail.gmail.com> Message-ID: Hi Yang, What do you mean with better http client library? Is it the http client included in the Erlang/OTP distribution you are referring to? In that case what problems have you had with that one? or what functions are you missing? I know that there are weaknesses in it but the functionality is more or less the same as Ibrowse but with a different API. It would be interesting to hear you opinion so we can improve. /Kenneth Erlang/OTP , Ericsson 2009/2/17 Yang Zhang : > Hi. All. > > I am trying to find a better httpclient library of Erlang. > > So I am trying ibrowse. But I got a compile error. > > make[3]: Entering directory `/home/scott/erlang/jungerl/lib/ucs/priv' > erl -noshell -pa ../ebin -s ucs rebuild_database mibenum -s init stop > ERROR: {undef,[{httpd_util,to_lower,["ANSI_X3.4-1968"]}, > {ucs_data_build,scan_name_line,1}, > {ucs_data_build,process_mibenum_data_file,1}, > {ucs_data_build,mibenum,1}, > {ucs_data,rebuild_database,2}, > {init,start_it,1}, > {init,start_em,1}]}make[3]: Leaving directory > `/home/scott/erlang/jungerl/lib/ucs/priv' > make[2]: Leaving directory `/home/scott/erlang/jungerl/lib/ucs' > > any idea? > > thanks. > > Regards. > > Scott > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From getyourcontacts@REDACTED Tue Feb 17 17:42:14 2009 From: getyourcontacts@REDACTED (Yang Zhang) Date: Wed, 18 Feb 2009 00:42:14 +0800 Subject: [erlang-questions] ibrowse compile error In-Reply-To: References: <4535f6cd0902170721j61f34565kd978c43177e6a351@mail.gmail.com> Message-ID: <4535f6cd0902170842s56871d0bl44d2cc23c194e0b4@mail.gmail.com> Hi. Kenneth. No mean to offend. I am glad you team provided so great erlang/OTP distribution. Just checked some old erlang-questions discussions. Someone was talking about the difference between ibrowse and http client in distribution. He said sometime the default http client won't work with some servers but ibrowse can work. And based on my observation, ibrowse seems integrated a builtin loadbancer. Actually I didn't care this much. Use default http client or ibrowse is same to me. Just want to have a different try. BTW, if default http client is good enough, why these guys were trying to creating ibrowse? If default http client can let me bind IP when I initial the http request, that will be perfect. Thanks. Regards. Scott Zhang ( I should change my name. :) ) On Wed, Feb 18, 2009 at 12:33 AM, Kenneth Lundin wrote: > Hi Yang, > > What do you mean with better http client library? > Is it the http client included in the Erlang/OTP distribution you are > referring to? > In that case what problems have you had with that one? > or what functions are you missing? > > I know that there are weaknesses in it but the functionality is more > or less the same as Ibrowse but with a > different API. > > It would be interesting to hear you opinion so we can improve. > > /Kenneth Erlang/OTP , Ericsson > > 2009/2/17 Yang Zhang : > > Hi. All. > > > > I am trying to find a better httpclient library of Erlang. > > > > So I am trying ibrowse. But I got a compile error. > > > > make[3]: Entering directory `/home/scott/erlang/jungerl/lib/ucs/priv' > > erl -noshell -pa ../ebin -s ucs rebuild_database mibenum -s init stop > > ERROR: {undef,[{httpd_util,to_lower,["ANSI_X3.4-1968"]}, > > {ucs_data_build,scan_name_line,1}, > > {ucs_data_build,process_mibenum_data_file,1}, > > {ucs_data_build,mibenum,1}, > > {ucs_data,rebuild_database,2}, > > {init,start_it,1}, > > {init,start_em,1}]}make[3]: Leaving directory > > `/home/scott/erlang/jungerl/lib/ucs/priv' > > make[2]: Leaving directory `/home/scott/erlang/jungerl/lib/ucs' > > > > any idea? > > > > thanks. > > > > Regards. > > > > Scott > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mjtruog@REDACTED Tue Feb 17 18:32:03 2009 From: mjtruog@REDACTED (Michael Truog) Date: Tue, 17 Feb 2009 09:32:03 -0800 Subject: [erlang-questions] SWIG and Erlang? In-Reply-To: <4FDB644378A741719DDF385E5428A0B5@JTablet2007> References: <4FDB644378A741719DDF385E5428A0B5@JTablet2007> Message-ID: <499AF493.9010908@gmail.com> John Hughes wrote: > Every now and then someone comments that an Erlang back-end for SWIG would > be nice, but there doesn't seem to be anything available. Just wondering if > anyone is sitting on a prototype, or just has looked hard at the problem of > creating one? > I know that many people use SWIG. However, for fun, I created a way of making Erlang->C/C++ bindings using macros. It just seemed like a no-nonsense way to learn more about the details of port drivers and ports. Also, the compile time dependency is Boost instead of SWIG. The bindings then use C++ instead of C. Otherwise, the code you generate should be easier to customize. The code is called the "Generic Erlang Port [Driver]" and version 0.6 can be found here: http://forum.trapexit.org/viewtopic.php?p=44406#44406 I can look at doing the same thing for SWIG. However, I was hoping for feedback as to whether the generated port driver code has any problems anyone can point out that relate to the Erlang code in test_bindings.erl. I have read that production quality linked in port drivers must use monitors and I don't understand why, if only one process manages the port driver. I also am wondering if outputv() can always be more efficient than control(), command(), or output() (from the driver_entry struct), since I haven't seen if ErlIOVec is allocated with a char buffer passed to one of the other functions mentioned. I also am using native endianess because I don't see a good reason to always use big endian, if the managing process is always on the same host as the port/port_driver. If there is a better pattern for sending to the port from many separate processes and receiving from the owner in an efficient way that is less synchronous, I would like to know. Any thoughts would be appreciated. > John H > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > Thanks, Michael From getyourcontacts@REDACTED Tue Feb 17 18:43:04 2009 From: getyourcontacts@REDACTED (Scott Zhang) Date: Wed, 18 Feb 2009 01:43:04 +0800 Subject: [erlang-questions] What database can I use with erlang to store 100M records and select single one in 0.1s Message-ID: <4535f6cd0902170943s12d15872t7c5a713fe5c1986e@mail.gmail.com> Hi. I opened a question about mnesia days ago. Now I am facing another question. I am going to scrape large amount of data and put them into database. Previously, my program was written in .NET/C# and saved the records into SqlServer, after 10 days running, I have 63M records in database which make SqlServer really slow, select single record need more than 1 minute which is unacceptable. And days ago, I tried to save 7M records in mnesia with table type= disc_only_copies. I tested , select single one from that talbe need more than 20 seconds which is unacceptable too. ( I don't want to conclude mnesia's performance is worse than SqlServer.) Lenz suggested me to use couchDB, just checked, couchDB depends on too much things and these depends make it hard to configure on window system. So here, does anyone has a good suggestion for a database can fit 63M(this time may get 2billion) and select one node within 1 sec? Thanks. Regards. Scott -------------- next part -------------- An HTML attachment was scrubbed... URL: From bryan.fink@REDACTED Tue Feb 17 18:54:18 2009 From: bryan.fink@REDACTED (Bryan Fink) Date: Tue, 17 Feb 2009 12:54:18 -0500 Subject: [erlang-questions] getting rid of whitespace from ErlTL rendered xml In-Reply-To: References: Message-ID: 2009/2/17 Salonee Sinha Roy : > Hello All > I have an ErlTl template defined as follows > > <%? {Users} = Data %><% [user(User) || User <- Users] %> > <%@ user %> > <%? {Uid,Name} = Data %> > <% Uid %><% Name %> > > When I compile and render it using a list of friends, it always puts 2 > newline characters before each entry of the tag. > > I would like to know if there is a way of getting rid of the white space > completely. Any help would be appreciated Hi, Salonee. It has been a little while since I wrote any ErlTL, but if memory serves, the only way to get rid of whitespace in your output is to get rid of whitespace in your input. That is, write the whole 'user' function definition on one line: <%@ user %><%? {Uid,Name} = Data %>... You may also be able to play games with ErlTL comments. Something like: <%@ user %><%! %><%? {Uid,Name} = Data %><%! %>... but, I don't remember. -Bryan From rapsey@REDACTED Tue Feb 17 19:21:38 2009 From: rapsey@REDACTED (Rapsey) Date: Tue, 17 Feb 2009 19:21:38 +0100 Subject: [erlang-questions] What database can I use with erlang to store 100M records and select single one in 0.1s In-Reply-To: <4535f6cd0902170943s12d15872t7c5a713fe5c1986e@mail.gmail.com> References: <4535f6cd0902170943s12d15872t7c5a713fe5c1986e@mail.gmail.com> Message-ID: <97619b170902171021tbece67cw2d1f694aceb3218e@mail.gmail.com> I hope this does not sound too rude, but what you're asking is a database optimization question that does not really have much to do with Erlang. I'm sure there is a ton of information out there on how to efficiently save a large amount of data in a DB. Figure that out first, then bother with Erlang. Sergej 2009/2/17 Scott Zhang > Hi. > > I opened a question about mnesia days ago. Now I am facing another > question. > > I am going to scrape large amount of data and put them into database. > Previously, my program was written in .NET/C# and saved the records into > SqlServer, after 10 days running, I have 63M records in database which make > SqlServer really slow, select single record need more than 1 minute which is > unacceptable. > > And days ago, I tried to save 7M records in mnesia with table type= > disc_only_copies. I tested , select single one from that talbe need more > than 20 seconds which is unacceptable too. ( I don't want to conclude > mnesia's performance is worse than SqlServer.) > > Lenz suggested me to use couchDB, just checked, couchDB depends on too much > things and these depends make it hard to configure on window system. > > So here, does anyone has a good suggestion for a database can fit 63M(this > time may get 2billion) and select one node within 1 sec? > > Thanks. > > Regards. > > Scott > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From getyourcontacts@REDACTED Tue Feb 17 19:30:36 2009 From: getyourcontacts@REDACTED (Scott Zhang) Date: Wed, 18 Feb 2009 02:30:36 +0800 Subject: [erlang-questions] What database can I use with erlang to store 100M records and select single one in 0.1s In-Reply-To: <97619b170902171021tbece67cw2d1f694aceb3218e@mail.gmail.com> References: <4535f6cd0902170943s12d15872t7c5a713fe5c1986e@mail.gmail.com> <97619b170902171021tbece67cw2d1f694aceb3218e@mail.gmail.com> Message-ID: <4535f6cd0902171030r165f2710o2949e10fb09e6a92@mail.gmail.com> Thanks. Sergej. I think you're right. As the question turn into a database optimization question, I found, at last, the complex/dirty work left database and reply on our programmers again. I am doing research at the meanwhile. Thanks for your suggestion. Regards. Scott 2009/2/18 Rapsey > I hope this does not sound too rude, but what you're asking is a database > optimization question that does not really have much to do with Erlang. I'm > sure there is a ton of information out there on how to efficiently save a > large amount of data in a DB. Figure that out first, then bother with > Erlang. > > > Sergej > > 2009/2/17 Scott Zhang > >> Hi. >> >> I opened a question about mnesia days ago. Now I am facing another >> question. >> >> I am going to scrape large amount of data and put them into database. >> Previously, my program was written in .NET/C# and saved the records into >> SqlServer, after 10 days running, I have 63M records in database which make >> SqlServer really slow, select single record need more than 1 minute which is >> unacceptable. >> >> And days ago, I tried to save 7M records in mnesia with table type= >> disc_only_copies. I tested , select single one from that talbe need more >> than 20 seconds which is unacceptable too. ( I don't want to conclude >> mnesia's performance is worse than SqlServer.) >> >> Lenz suggested me to use couchDB, just checked, couchDB depends on too >> much things and these depends make it hard to configure on window system. >> >> So here, does anyone has a good suggestion for a database can fit 63M(this >> time may get 2billion) and select one node within 1 sec? >> >> Thanks. >> >> Regards. >> >> Scott >> >> _______________________________________________ >> 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 jan@REDACTED Tue Feb 17 19:36:41 2009 From: jan@REDACTED (Jan Lehnardt) Date: Tue, 17 Feb 2009 19:36:41 +0100 Subject: [erlang-questions] What database can I use with erlang to store 100M records and select single one in 0.1s In-Reply-To: <4535f6cd0902170943s12d15872t7c5a713fe5c1986e@mail.gmail.com> References: <4535f6cd0902170943s12d15872t7c5a713fe5c1986e@mail.gmail.com> Message-ID: <5CAF73D4-82B7-4EFC-A6E7-DC6E2C7E616F@apache.org> Hi, On 17 Feb 2009, at 18:43, Scott Zhang wrote: > So here, does anyone has a good suggestion for a database can fit > 63M(this time may get 2billion) and select one node within 1 sec? > I'd give CouchDB* a shot, but then, I'm biased :) Cheers Jan -- * http://couchdb.org/ From erlang@REDACTED Tue Feb 17 19:42:16 2009 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 17 Feb 2009 19:42:16 +0100 Subject: [erlang-questions] What database can I use with erlang to store 100M records and select single one in 0.1s In-Reply-To: <4535f6cd0902170943s12d15872t7c5a713fe5c1986e@mail.gmail.com> References: <4535f6cd0902170943s12d15872t7c5a713fe5c1986e@mail.gmail.com> Message-ID: <9b08084c0902171042x7146e595w9abe2df90a0b6066@mail.gmail.com> What are the types of the keys and records? Is there are systematic structure in the keys? are the records fixed or variable lengths? How about using a SSD? /Joe Armstrong 2009/2/17 Scott Zhang : > Hi. > > I opened a question about mnesia days ago. Now I am facing another question. > > I am going to scrape large amount of data and put them into database. > Previously, my program was written in .NET/C# and saved the records into > SqlServer, after 10 days running, I have 63M records in database which make > SqlServer really slow, select single record need more than 1 minute which is > unacceptable. > > And days ago, I tried to save 7M records in mnesia with table type= > disc_only_copies. I tested , select single one from that talbe need more > than 20 seconds which is unacceptable too. ( I don't want to conclude > mnesia's performance is worse than SqlServer.) > > Lenz suggested me to use couchDB, just checked, couchDB depends on too much > things and these depends make it hard to configure on window system. > > So here, does anyone has a good suggestion for a database can fit 63M(this > time may get 2billion) and select one node within 1 sec? > > Thanks. > > Regards. > > Scott > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From babo.online@REDACTED Tue Feb 17 20:11:43 2009 From: babo.online@REDACTED (Attila Babo) Date: Tue, 17 Feb 2009 20:11:43 +0100 Subject: [erlang-questions] unexpected matching in re 12B5 Message-ID: <597c69660902171111s16227c11s8f53f068b40da65d@mail.gmail.com> 1> re:run("a b", "\\w\s\\w"). {match,[{0,3}]} While fixing a typo in my code I've found that \s with a single backslash is matching with a space in re:run but not the other general characters. Is this is bug or feature of re? :-) /Attila From erlangy@REDACTED Tue Feb 17 20:19:52 2009 From: erlangy@REDACTED (Michael McDaniel) Date: Tue, 17 Feb 2009 11:19:52 -0800 Subject: [erlang-questions] unexpected matching in re 12B5 In-Reply-To: <597c69660902171111s16227c11s8f53f068b40da65d@mail.gmail.com> References: <597c69660902171111s16227c11s8f53f068b40da65d@mail.gmail.com> Message-ID: <20090217191952.GR22018@delora.autosys.us> On Tue, Feb 17, 2009 at 08:11:43PM +0100, Attila Babo wrote: > 1> re:run("a b", "\\w\s\\w"). > {match,[{0,3}]} > > While fixing a typo in my code I've found that \s with a single > backslash is matching with a space in re:run but not the other general > characters. Is this is bug or feature of re? :-) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ From the re module docs at http://erlang.org/doc/man/re.html " Generic character types ... \s any whitespace character ... " ~M > /Attila > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Michael McDaniel Portland, Oregon, USA http://autosys.us http://mmcdaniel.com/erlview From babo.online@REDACTED Tue Feb 17 20:26:58 2009 From: babo.online@REDACTED (Attila Babo) Date: Tue, 17 Feb 2009 20:26:58 +0100 Subject: [erlang-questions] unexpected matching in re 12B5 In-Reply-To: <20090217191952.GR22018@delora.autosys.us> References: <597c69660902171111s16227c11s8f53f068b40da65d@mail.gmail.com> <20090217191952.GR22018@delora.autosys.us> Message-ID: <597c69660902171126s619fb0f1ub41dace4f22030ee@mail.gmail.com> Let me reply from a quote from the very same document: The Erlang literal syntax for strings give special meaning to the "\" (backslash) character. To literally write a regular expression or a replacement string containing a backslash in your code or in the shell, two backslashes have to be written: "\\". From gleber.p@REDACTED Tue Feb 17 20:30:29 2009 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 17 Feb 2009 20:30:29 +0100 Subject: [erlang-questions] unexpected matching in re 12B5 In-Reply-To: <597c69660902171126s619fb0f1ub41dace4f22030ee@mail.gmail.com> References: <597c69660902171111s16227c11s8f53f068b40da65d@mail.gmail.com> <20090217191952.GR22018@delora.autosys.us> <597c69660902171126s619fb0f1ub41dace4f22030ee@mail.gmail.com> Message-ID: <14f0e3620902171130r5fda2e5q26c5f6f89ccf37f5@mail.gmail.com> On Tue, Feb 17, 2009 at 20:26, Attila Babo wrote: > Let me reply from a quote from the very same document: > > The Erlang literal syntax for strings give special meaning to the "\" > (backslash) character. To literally write a regular expression or a > replacement string containing a backslash in your code or in the > shell, two backslashes have to be written: "\\". It turns out that \s is parsed as a character with ASCII code 32 - i.e. a space. > io:fwrite("~b~n", [hd("\s")]). 32 -- Gleb Peregud http://gleber.pl/ From joe@REDACTED Tue Feb 17 20:36:20 2009 From: joe@REDACTED (Joe Williams) Date: Tue, 17 Feb 2009 11:36:20 -0800 Subject: [erlang-questions] Seattle Erlounge Tomorrow Message-ID: <499B11B4.2080109@joetify.com> Erlounge Seattle (http://erloungeseattle.org/) tomorrow evening. *7pm, Feb 18th 2009 @ Stumptown Coffee* 1115 12th Ave Seattle, WA 98122 See you there. -Joe -- Name: Joseph A. Williams Email: joe@REDACTED Blog: http://www.joeandmotorboat.com/ From erlangy@REDACTED Tue Feb 17 20:37:31 2009 From: erlangy@REDACTED (Michael McDaniel) Date: Tue, 17 Feb 2009 11:37:31 -0800 Subject: [erlang-questions] unexpected matching in re 12B5 In-Reply-To: <597c69660902171126s619fb0f1ub41dace4f22030ee@mail.gmail.com> References: <597c69660902171111s16227c11s8f53f068b40da65d@mail.gmail.com> <20090217191952.GR22018@delora.autosys.us> <597c69660902171126s619fb0f1ub41dace4f22030ee@mail.gmail.com> Message-ID: <20090217193731.GT22018@delora.autosys.us> On Tue, Feb 17, 2009 at 08:26:58PM +0100, Attila Babo wrote: > Let me reply from a quote from the very same document: > > The Erlang literal syntax for strings give special meaning to the "\" > (backslash) character. To literally write a regular expression or a > replacement string containing a backslash in your code or in the > shell, two backslashes have to be written: "\\". > _______________________________________________ Ah, I see your point, thanks. ~M > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Michael McDaniel Portland, Oregon, USA http://autosys.us http://mmcdaniel.com/erlview From babo.online@REDACTED Tue Feb 17 20:38:33 2009 From: babo.online@REDACTED (Attila Babo) Date: Tue, 17 Feb 2009 20:38:33 +0100 Subject: [erlang-questions] unexpected matching in re 12B5 In-Reply-To: <14f0e3620902171130r5fda2e5q26c5f6f89ccf37f5@mail.gmail.com> References: <597c69660902171111s16227c11s8f53f068b40da65d@mail.gmail.com> <20090217191952.GR22018@delora.autosys.us> <597c69660902171126s619fb0f1ub41dace4f22030ee@mail.gmail.com> <14f0e3620902171130r5fda2e5q26c5f6f89ccf37f5@mail.gmail.com> Message-ID: <597c69660902171138t28b4d9e7vd7e47b59ad5fdb48@mail.gmail.com> > It turns out that \s is parsed as a character with ASCII code 32 - i.e. a space. > >> io:fwrite("~b~n", [hd("\s")]). > 32 Neat! From jebenitez@REDACTED Tue Feb 17 20:45:53 2009 From: jebenitez@REDACTED (Jose Enrique Benitez Jimenez) Date: Tue, 17 Feb 2009 14:45:53 -0500 Subject: [erlang-questions] broadcast messages Message-ID: hello, everyone, I have several process that each one control an object in a game, I need a way to one process send a message to the others, a kind of broadcast message, an alternative could be use one process for delivery the message to the correct process, Are there another way ?? Thanks a lot. From masse@REDACTED Tue Feb 17 21:18:30 2009 From: masse@REDACTED (mats cronqvist) Date: Tue, 17 Feb 2009 21:18:30 +0100 Subject: [erlang-questions] Attribute named type In-Reply-To: <499AC8E5.6020203@sidvind.com> (David Sveningsson's message of "Tue\, 17 Feb 2009 15\:25\:41 +0100") References: <499AC8E5.6020203@sidvind.com> Message-ID: <87tz6svmuh.fsf@sterlett.hq.kred> David Sveningsson writes: > Hi, I'm using some user-defined attributes in my modules. I want to use > one named type but I doesn't show up with module_info/1 or even > module_info/0. > > Is it reserved by something or am I doing something else wrong? I tried > to lookup the predefined attributes but I couldn't find anything about > 'type'. I can read the other attributes fine. -type and -spec are reserved. for type declarations and contract specifications, respectively. AFAIK, they're only used by dialyzer. mats From babo.online@REDACTED Tue Feb 17 21:22:36 2009 From: babo.online@REDACTED (Attila Babo) Date: Tue, 17 Feb 2009 21:22:36 +0100 Subject: [erlang-questions] unexpected matching in re 12B5 In-Reply-To: <20090217193731.GT22018@delora.autosys.us> References: <597c69660902171111s16227c11s8f53f068b40da65d@mail.gmail.com> <20090217191952.GR22018@delora.autosys.us> <597c69660902171126s619fb0f1ub41dace4f22030ee@mail.gmail.com> <20090217193731.GT22018@delora.autosys.us> Message-ID: <597c69660902171222v75c3065ge1c59bc1a8084f24@mail.gmail.com> 2.14 Escape Sequences Within strings and quoted atoms, the following escape sequences are recognized: ... \s space Oh well! From norbu09@REDACTED Tue Feb 17 22:27:22 2009 From: norbu09@REDACTED (lenz) Date: Wed, 18 Feb 2009 10:27:22 +1300 Subject: [erlang-questions] What database can I use with erlang to store 100M records and select single one in 0.1s In-Reply-To: References: <4535f6cd0902170943s12d15872t7c5a713fe5c1986e@mail.gmail.com> <9b08084c0902171042x7146e595w9abe2df90a0b6066@mail.gmail.com> Message-ID: hi, searching for solutions to this type of problem is a challenge and there are many ways to solve it. give this site (http://highscalability.com) a thorough read and you might find something. again, i am with jan, try CouchDB and it might pay off to use a unix based machine for stuff like that. i think you are trying to trick your OS to do things it is not meant for. not going into flame wars about windows here but a basic linux setup is really done in no time and gives you way more control for an application that is "non standard" :-) cheers lenz On Wed, Feb 18, 2009 at 10:26 AM, lenz wrote: > hi, > searching for solutions to this type of problem is a challenge and there > are many ways to solve it. give this site (http://highscalability.com) a > thorough read and you might find something. > again, i am with jan, try CouchDB and it might pay off to use a unix based > machine for stuff like that. i think you are trying to trick your OS to do > things it is not meant for. not going into flame wars about windows here but > a basic linux setup is really done in no time and gives you way more control > for an application that is "non standard" :-) > > cheers > lenz > > On Wed, Feb 18, 2009 at 7:42 AM, Joe Armstrong wrote: > >> What are the types of the keys and records? Is there are systematic >> structure in >> the keys? are the records fixed or variable lengths? How about using a >> SSD? >> >> /Joe Armstrong >> >> >> 2009/2/17 Scott Zhang : >> > Hi. >> > >> > I opened a question about mnesia days ago. Now I am facing another >> question. >> > >> > I am going to scrape large amount of data and put them into database. >> > Previously, my program was written in .NET/C# and saved the records into >> > SqlServer, after 10 days running, I have 63M records in database which >> make >> > SqlServer really slow, select single record need more than 1 minute >> which is >> > unacceptable. >> > >> > And days ago, I tried to save 7M records in mnesia with table type= >> > disc_only_copies. I tested , select single one from that talbe need more >> > than 20 seconds which is unacceptable too. ( I don't want to conclude >> > mnesia's performance is worse than SqlServer.) >> > >> > Lenz suggested me to use couchDB, just checked, couchDB depends on too >> much >> > things and these depends make it hard to configure on window system. >> > >> > So here, does anyone has a good suggestion for a database can fit >> 63M(this >> > time may get 2billion) and select one node within 1 sec? >> > >> > Thanks. >> > >> > Regards. >> > >> > Scott >> > >> > _______________________________________________ >> > 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 >> > > > > -- > iWantMyName.com > painless domain registration (finally) > -- iWantMyName.com painless domain registration (finally) -------------- next part -------------- An HTML attachment was scrubbed... URL: From kevin@REDACTED Tue Feb 17 23:10:47 2009 From: kevin@REDACTED (Kevin Scaldeferri) Date: Tue, 17 Feb 2009 14:10:47 -0800 Subject: [erlang-questions] What database can I use with erlang to store 100M records and select single one in 0.1s In-Reply-To: References: <4535f6cd0902170943s12d15872t7c5a713fe5c1986e@mail.gmail.com> <9b08084c0902171042x7146e595w9abe2df90a0b6066@mail.gmail.com> Message-ID: I'm not sure what's "non-standard" about what the OP is trying to do. A select on a properly indexed key should be quite fast on any database system you choose. I have to assume that he doesn't have his schema set up properly. -k On Feb 17, 2009, at 1:27 PM, lenz wrote: > hi, > > searching for solutions to this type of problem is a challenge and > there are many ways to solve it. give this site (http://highscalability.com > ) a thorough read and you might find something. > again, i am with jan, try CouchDB and it might pay off to use a unix > based machine for stuff like that. i think you are trying to trick > your OS to do things it is not meant for. not going into flame wars > about windows here but a basic linux setup is really done in no time > and gives you way more control for an application that is "non > standard" :-) > > cheers > lenz > > On Wed, Feb 18, 2009 at 10:26 AM, lenz wrote: > hi, > > searching for solutions to this type of problem is a challenge and > there are many ways to solve it. give this site (http://highscalability.com > ) a thorough read and you might find something. > again, i am with jan, try CouchDB and it might pay off to use a unix > based machine for stuff like that. i think you are trying to trick > your OS to do things it is not meant for. not going into flame wars > about windows here but a basic linux setup is really done in no time > and gives you way more control for an application that is "non > standard" :-) > > cheers > lenz > > On Wed, Feb 18, 2009 at 7:42 AM, Joe Armstrong > wrote: > What are the types of the keys and records? Is there are systematic > structure in > the keys? are the records fixed or variable lengths? How about using > a SSD? > > /Joe Armstrong > > > 2009/2/17 Scott Zhang : > > Hi. > > > > I opened a question about mnesia days ago. Now I am facing another > question. > > > > I am going to scrape large amount of data and put them into > database. > > Previously, my program was written in .NET/C# and saved the > records into > > SqlServer, after 10 days running, I have 63M records in database > which make > > SqlServer really slow, select single record need more than 1 > minute which is > > unacceptable. > > > > And days ago, I tried to save 7M records in mnesia with table type= > > disc_only_copies. I tested , select single one from that talbe > need more > > than 20 seconds which is unacceptable too. ( I don't want to > conclude > > mnesia's performance is worse than SqlServer.) > > > > Lenz suggested me to use couchDB, just checked, couchDB depends on > too much > > things and these depends make it hard to configure on window system. > > > > So here, does anyone has a good suggestion for a database can fit > 63M(this > > time may get 2billion) and select one node within 1 sec? > > > > Thanks. > > > > Regards. > > > > Scott > > > > _______________________________________________ > > 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 > > > > -- > iWantMyName.com > painless domain registration (finally) > > > > -- > iWantMyName.com > painless domain registration (finally) > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrad-direct-erlang@REDACTED Tue Feb 17 23:13:50 2009 From: mrad-direct-erlang@REDACTED (Michael Radford) Date: Tue, 17 Feb 2009 14:13:50 -0800 Subject: [erlang-questions] Floating guard sequences Message-ID: <20090217221350.GA6592@herbie> This is a very preliminary proposal to extend Erlang's guard syntax (based on an idea I briefly mentioned in another thread). I'd like to hear people's reactions....if there is interest, and if the OTP team doesn't say it's impossible for some reason, I'd be happy to write an EEP. So, what if... Anywhere [*] in a function parameter list, the pattern of a case (or try or receive) clause, or the left-hand side of a match (=) expression, a "floating guard sequence" was allowed: (when GUARD-SEQUENCE) The floating guard sequence is just syntactic sugar for the same guard sequence promoted to the normal guard position of the enclosing expression. Or in the case of a plain match, promoted to a following 'if' as described below. When there is more than one floating guard sequence (or they are mixed with normal guards), they are combined in the obvious way into disjunctive normal form. ([*] "Anywhere" suitably restricted to make parsing easy, for example, maybe only following a complete term, not following ',', '|', '||', operators, etc.) Examples... 1. In a function parameter list: f ({ X (when X < 0; X > 3), [Y (when Y > 0, Y < 7) | Ys] }) -> BODY; would be equivalent to: f ({X, [Y | Ys]}) when X < 0, Y > 0, Y < 7 ; X > 3, Y > 0, Y < 7 -> BODY; 2. Similarly, in a case pattern: case EXPR of { X (when X < 0; X > 3), [Y (when Y < 0; Y > 7) | Ys] } -> EXPR1; ... end would be equivalent to: case EXPR of {X, [Y | Ys]} when X < 0, Y < 0 ; X < 0, Y > 7 ; X > 3, Y < 0 ; X > 3, Y > 7 -> EXPR1; ... end 3. Finally, floating guard sequences in the LHS of a match would be equivalent to wrapping all following expressions in the same sequence in an 'if' with the same guards, and failing with 'badmatch' instead of 'if_clause': { X (when X < 0; X > 3), [Y (when Y > 0, Y < 7) | Ys] } = f(Z), EXPRESSION-SEQUENCE would be equivalent to something like: __Match_1234 = {X, [Y | Ys]} = f(Z), if X < 0, Y > 0, Y < 7 ; X > 3, Y > 0, Y < 7 -> EXPRESSION-SEQUENCE; true -> erlang:error ({badmatch, __Match_1234}) end I see the main advantages of this syntax as: (1) often being more concise, and (2) allowing guard tests that are conceptually part of the "type" of a variable to be right next to the location where the variable is defined. (In addition, this would allow macros that expand to patterns to include guards.) Also, allowing any form of guard on an '=' match would make things much easier in situations where you want to assert some property of the matched value, since the {badmatch, Value} exception contains the value that failed the guard. Currently, you have to introduce a case statement to get an exception containing the value that failed a guard. Mike From ok@REDACTED Wed Feb 18 00:05:06 2009 From: ok@REDACTED (Richard O'Keefe) Date: Wed, 18 Feb 2009 12:05:06 +1300 Subject: [erlang-questions] "Symmetrical" function In-Reply-To: <20090217061342.GA19440@herbie> References: <800885F9-69BB-4236-982D-A0D5F771B04A@cs.otago.ac.nz> <101E61D2FF7642D595E2FEF3D1DFBF1E@SSI.CORP> <31D2BB91-CFE9-46F4-8F39-B4B94B4A7AB0@cs.otago.ac.nz> <20090216214123.GA3058@herbie> <8A7359A9-8328-4C2B-B486-CD54D1607264@cs.otago.ac.nz> <20090216225600.GA20349@herbie> <7B0F2841-FBFD-472A-A922-684218BEC630@cs.otago.ac.nz> <20090217061342.GA19440@herbie> Message-ID: On 17 Feb 2009, at 7:13 pm, Michael Radford wrote: >> oi([X|Xs], [Y|Ys]) -> >> if X < Y -> oi(Xs, [Y|Ys]) >> ; X > Y -> oi([X|Xs], Ys) >> ; true -> oi(Xs, Ys) >> end; >> oi(_, _) -> >> []. >> >> Here #A is infinite, the number of clauses is 2, and I don't see >> any good way to write half of f. > > I think you can write just the diagonal... > > oi(_, _) -> []. Yeah, thinko there. Change that to oi([X|Xs], [Y|Ys]) -> if X < Y -> oi(Xs, [Y|Ys]) ; X > Y -> oi([X|Xs], Ys) ; true -> [X|oi(Xs, Ys)] % the mistake was here end; oi(_, _) -> []. The substantive point remains. I don't see any good way to write half of . From ok@REDACTED Wed Feb 18 00:07:22 2009 From: ok@REDACTED (Richard O'Keefe) Date: Wed, 18 Feb 2009 12:07:22 +1300 Subject: [erlang-questions] "Symmetrical" function In-Reply-To: <20090217080158.GB19440@herbie> References: <800885F9-69BB-4236-982D-A0D5F771B04A@cs.otago.ac.nz> <101E61D2FF7642D595E2FEF3D1DFBF1E@SSI.CORP> <31D2BB91-CFE9-46F4-8F39-B4B94B4A7AB0@cs.otago.ac.nz> <20090216214123.GA3058@herbie> <8A7359A9-8328-4C2B-B486-CD54D1607264@cs.otago.ac.nz> <20090216225600.GA20349@herbie> <7B0F2841-FBFD-472A-A922-684218BEC630@cs.otago.ac.nz> <20090217061342.GA19440@herbie> <20090217080158.GB19440@herbie> Message-ID: <14C5DC3F-4B13-4803-B848-4198E23C7461@cs.otago.ac.nz> On 17 Feb 2009, at 9:01 pm, Michael Radford wrote: > P.S. Wouldn't it be nice if regular matches had the same syntax, e.g., > X (when X < 3) = f(X) > I think "(when" is never currently legal, so it's even unambiguous. There has already been a proposal to allow (X when X < 3) = f(X) Abstract patterns would subsume this. > From kunthar@REDACTED Wed Feb 18 00:48:35 2009 From: kunthar@REDACTED (Kunthar) Date: Wed, 18 Feb 2009 01:48:35 +0200 Subject: [erlang-questions] What database can I use with erlang to store 100M records and select single one in 0.1s In-Reply-To: References: <4535f6cd0902170943s12d15872t7c5a713fe5c1986e@mail.gmail.com> <9b08084c0902171042x7146e595w9abe2df90a0b6066@mail.gmail.com> Message-ID: <9a09ca9a0902171548p5df932cbmf661fd2a7819e20c@mail.gmail.com> I agree with -k and also AFAIK 63~MB is not so big even for sickqlserver too. OTOH, Check those solutions if one of them fit to your needs. Mysql, http://yarivsblog.com/articles/2006/09/13/erlang-mysql-driver-reloaded/ Postgresql http://code.google.com/p/erlang-psql-driver/ http://archives.postgresql.org/pgsql-sql/2007-11/msg00081.php http://www.erlangatwork.com/2009/01/erlang-and-postgresql.html I dunno which one is better, but both of them should work under Windows. Sophisticated ones :D Tokyo Tyrant http://blog.poundbang.in/post/72848626/releasing-tora-0-1-erlang-client-for-tokyo-tyrant http://www.scribd.com/doc/12016121/Tokyo-Cabinet-and-Tokyo-Tyrant-Presentation Voldemort http://project-voldemort.com/ A better organized list is here; http://www.metabrew.com/article/anti-rdbms-a-list-of-distributed-key-value-stores/ Good luck Kunth 2009/2/18 Kevin Scaldeferri : > I'm not sure what's "non-standard" about what the OP is trying to do. A > select on a properly indexed key should be quite fast on any database system > you choose. I have to assume that he doesn't have his schema set up > properly. > > -k From ok@REDACTED Wed Feb 18 01:51:15 2009 From: ok@REDACTED (Richard O'Keefe) Date: Wed, 18 Feb 2009 13:51:15 +1300 Subject: [erlang-questions] Floating guard sequences In-Reply-To: <20090217221350.GA6592@herbie> References: <20090217221350.GA6592@herbie> Message-ID: <2BE36673-CDE2-405D-8336-FE45304A16FE@cs.otago.ac.nz> On 18 Feb 2009, at 11:13 am, Michael Radford wrote: > This is a very preliminary proposal to extend Erlang's guard > syntax (based on an idea I briefly mentioned in another thread). 1. The proposal does not increase expressiveness. All it does is move constraints from after the head to inside the head. 2. It is far from clear to me that this improves readability. (I am being polite here.) 3. There is an existing problem which such proposals should address. Consider f(X, ...) when is_integer(X), X >= 0, ... -> f(..., Y) when is_integer(Y), Y >= 0, ... -> ... The concept "is a natural number" cannot be defined once and thereafter used by name. Just moving the guards around doesn't begin to help with this. Abstract patterns, however, do increase expressiveness, can improve readability, and do solve the "no way to name a repeated condition" problem, *without* introducing potentially unbounded or side-effective computation into matching. And they're hygienic, not like macros. #natural(X) when is_integer(X), X >= 0 -> X. f(#natural(X), ...) when ... -> ... f(..., #natural(Y)) when ... -> ... Abstract patterns really are a good idea. Having said this, the nicest way to implement them -- though it isn't always doable -- is via inline expansion, which would mean that an Erlang compiler might have a use for something very like Michael Radford's suggestion *as an internal form*. From steven.charles.davis@REDACTED Wed Feb 18 01:57:19 2009 From: steven.charles.davis@REDACTED (Steve Davis) Date: Tue, 17 Feb 2009 16:57:19 -0800 (PST) Subject: [erlang-questions] I Hate Unit Testing Part 0.2 now Part 0.3 In-Reply-To: <6891fae8-686e-456e-a147-7f2bf5e2465f@w1g2000prm.googlegroups.com> References: <6891fae8-686e-456e-a147-7f2bf5e2465f@w1g2000prm.googlegroups.com> Message-ID: Hi, I've pushed a 0.3 version of utest (textfile based unit testing) to github, including: - html reports (now the default) - support for records - a number of bugfixes - better (but not complete) wiki documentation http://github.com/komone/utest/ /sd On Feb 14, 4:06?pm, Steve Davis wrote: > All, > > Thanks for the earlier discussions on this. > > I've pushed the results of my expanded experiment with text-based unit > testing ("utest") to github for anybody to try who is sufficiently > interested -- it works pretty well for me :) > > http://github.com/komone/utest/ > > All comments welcome. > > /sd From james.hague@REDACTED Wed Feb 18 02:10:51 2009 From: james.hague@REDACTED (James Hague) Date: Tue, 17 Feb 2009 19:10:51 -0600 Subject: [erlang-questions] writing a delay loop without now() Message-ID: I need more resolution than timer:sleep() will give me. (timer:sleep gives widely varying results, based on the underlying operating system). Ugly though it may be, I've been using a spin loop based on now() and timer:now_diff(). While this appears to work, based on the values returned by now(), it runs much faster than wall clock time. I'm assuming it's because of this: "It is also guaranteed that subsequent calls to this BIF returns continuously increasing values." Is there another BIF I should be using? I'm hoping I don't have to write my own linked-in driver for this. James From pfisher@REDACTED Wed Feb 18 02:32:05 2009 From: pfisher@REDACTED (Paul Fisher) Date: Tue, 17 Feb 2009 19:32:05 -0600 Subject: [erlang-questions] writing a delay loop without now() In-Reply-To: References: Message-ID: <499B6515.4010009@alertlogic.net> James Hague wrote: > I need more resolution than timer:sleep() will give me. (timer:sleep > gives widely varying results, based on the underlying operating > system). Ugly though it may be, I've been using a spin loop based on > now() and timer:now_diff(). While this appears to work, based on the > values returned by now(), it runs much faster than wall clock time. > I'm assuming it's because of this: > > "It is also guaranteed that subsequent calls to this BIF returns > continuously increasing values." > > Is there another BIF I should be using? I'm hoping I don't have to > write my own linked-in driver for this. sleep( Milliseconds ) -> receive after Milliseconds -> ok end. -- paul From matthew@REDACTED Wed Feb 18 04:31:30 2009 From: matthew@REDACTED (Matthew Dempsky) Date: Tue, 17 Feb 2009 19:31:30 -0800 Subject: [erlang-questions] writing a delay loop without now() In-Reply-To: <499B6515.4010009@alertlogic.net> References: <499B6515.4010009@alertlogic.net> Message-ID: On Tue, Feb 17, 2009 at 5:32 PM, Paul Fisher wrote: > sleep( Milliseconds ) -> > receive after Milliseconds -> ok end. That's exactly how timer:sleep/1 is implemented, which he already mentioned. From getyourcontacts@REDACTED Wed Feb 18 07:59:18 2009 From: getyourcontacts@REDACTED (Scott Zhang) Date: Wed, 18 Feb 2009 14:59:18 +0800 Subject: [erlang-questions] ibrowse compile error In-Reply-To: <4535f6cd0902170842s56871d0bl44d2cc23c194e0b4@mail.gmail.com> References: <4535f6cd0902170721j61f34565kd978c43177e6a351@mail.gmail.com> <4535f6cd0902170842s56871d0bl44d2cc23c194e0b4@mail.gmail.com> Message-ID: <4535f6cd0902172259k410032a8r86631a731d47f407@mail.gmail.com> Hi. All. Another big issue with http client within erlang distribution and ibrowse. That makes me start to wonder is ibrowse/http client really working? Please try following url. http://www.cisworldwide.com/xweb/xweb_parser.php?premiumredirect=http%3A%2F%2Fwww.cisworldwide.com%2Fxweb%2Fpremiumsearches%2FxmlNewBackgroundSearch.php%3Fatype%3Dcaps%26fname%3Dscott%26middle_initial%3D%26lname%3Dzhang%26city%3D%26state%3D%26zip%3D%26client_reference%3Dplutux%40harbork.%26cisrestype%3Dunlimited_background&code=11111111&cemail=macromarship@REDACTED it can be opened in firefox or IE or any browse and it returns search result of my name. But whether I use http client or ibrowse, they never returns, just hang there, even I wait for 10 minutes. I tried with http client/ibrowse to download www.google.com or www.erlang.com, they are working. But for this one. NO. And I tried use .NET HttpRequest to download premiumredirect=http%3A%2F% 2Fwww.cisworldwide.com %2Fxweb%2Fpremiumsearches%2FxmlNewBackgroundSearch.php%3Fatype%3Dcaps%26fname%3Dscott%26middle_initial%3D%26lname%3Dzhang%26city%3D%26state%3D%26zip%3D%26client_reference%3Dplutux%40harbork.%26cisrestype%3Dunlimited_background&code=11111111&cemail= macromarship@REDACTED .NET program is working too. So what is the problem? 1. http client get_url(Url) -> case http:request(get, {Url, []}, [], []) of {ok, {{Version, 200, ReasonPhrase}, Headers, Body}} -> Body; _ -> sleep(500),get_url(Url) end. 2. ibrowse (node2@REDACTED)18> ibrowse:send_req(" http://www.cisworldwide.com/xweb/xweb_parser.php?premiumredirect=http%3A%2F%2Fwww.cisworldwide.com%2Fxweb%2Fpremiumsearches%2FxmlNewBackgroundSearch.php%3Fatype%3Dcaps%26fname%3Dscott%26middle_initial%3D%26lname%3Dzhang%26city%3D%26state%3D%26zip%3D%26client_reference%3Dplutux%40harbork.%26cisrestype%3Dunlimited_background&code=11111111&cemail=macromarship@REDACTED ",[],get) Both of http client and ibrowse are hung there. Thanks. Regards. Scott Zhang On Wed, Feb 18, 2009 at 12:42 AM, Yang Zhang wrote: > Hi. Kenneth. > > No mean to offend. > > I am glad you team provided so great erlang/OTP distribution. Just checked > some old erlang-questions discussions. Someone was talking about the > difference between ibrowse and http client in distribution. He said sometime > the default http client won't work with some servers but ibrowse can work. > > And based on my observation, ibrowse seems integrated a builtin loadbancer. > Actually I didn't care this much. Use default http client or ibrowse is same > to me. Just want to have a different try. BTW, if default http client is > good enough, why these guys were trying to creating ibrowse? > > If default http client can let me bind IP when I initial the http request, > that will be perfect. > > Thanks. > > Regards. > > Scott Zhang ( I should change my name. :) ) > > On Wed, Feb 18, 2009 at 12:33 AM, Kenneth Lundin > wrote: > >> Hi Yang, >> >> What do you mean with better http client library? >> Is it the http client included in the Erlang/OTP distribution you are >> referring to? >> In that case what problems have you had with that one? >> or what functions are you missing? >> >> I know that there are weaknesses in it but the functionality is more >> or less the same as Ibrowse but with a >> different API. >> >> It would be interesting to hear you opinion so we can improve. >> >> /Kenneth Erlang/OTP , Ericsson >> >> 2009/2/17 Yang Zhang : >> > Hi. All. >> > >> > I am trying to find a better httpclient library of Erlang. >> > >> > So I am trying ibrowse. But I got a compile error. >> > >> > make[3]: Entering directory `/home/scott/erlang/jungerl/lib/ucs/priv' >> > erl -noshell -pa ../ebin -s ucs rebuild_database mibenum -s init stop >> > ERROR: {undef,[{httpd_util,to_lower,["ANSI_X3.4-1968"]}, >> > {ucs_data_build,scan_name_line,1}, >> > {ucs_data_build,process_mibenum_data_file,1}, >> > {ucs_data_build,mibenum,1}, >> > {ucs_data,rebuild_database,2}, >> > {init,start_it,1}, >> > {init,start_em,1}]}make[3]: Leaving directory >> > `/home/scott/erlang/jungerl/lib/ucs/priv' >> > make[2]: Leaving directory `/home/scott/erlang/jungerl/lib/ucs' >> > >> > any idea? >> > >> > thanks. >> > >> > Regards. >> > >> > Scott >> > >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://www.erlang.org/mailman/listinfo/erlang-questions >> > >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From v@REDACTED Wed Feb 18 08:19:34 2009 From: v@REDACTED (Valentin Micic) Date: Wed, 18 Feb 2009 09:19:34 +0200 Subject: [erlang-questions] writing a delay loop without now() In-Reply-To: Message-ID: <200902180715.n1I7FcRc015926@mail.pharos-avantgard.com> Would you consider calling erlang:yield() between two subsequent calls to now()? NOTE: I've tried it from shell and it didn't make any difference, possibly because the shell is the only process that is actually doing something, hence nobody to yield the CPU usage to. Also not sure how this would behave under the heavy system load, however, according to the manual, the erlang:yield() is faster than receive after 1 -> ok end. If you indeed try this approach, could you please give me some feedback on your observations? V. -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of James Hague Sent: 18 February 2009 03:11 AM To: Erlang Questions Subject: [erlang-questions] writing a delay loop without now() I need more resolution than timer:sleep() will give me. (timer:sleep gives widely varying results, based on the underlying operating system). Ugly though it may be, I've been using a spin loop based on now() and timer:now_diff(). While this appears to work, based on the values returned by now(), it runs much faster than wall clock time. I'm assuming it's because of this: "It is also guaranteed that subsequent calls to this BIF returns continuously increasing values." Is there another BIF I should be using? I'm hoping I don't have to write my own linked-in driver for this. James _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From nc@REDACTED Wed Feb 18 08:34:36 2009 From: nc@REDACTED (Nicolas Charpentier) Date: Wed, 18 Feb 2009 08:34:36 +0100 Subject: [erlang-questions] ibrowse compile error In-Reply-To: <4535f6cd0902172259k410032a8r86631a731d47f407@mail.gmail.com> References: <4535f6cd0902170721j61f34565kd978c43177e6a351@mail.gmail.com> <4535f6cd0902170842s56871d0bl44d2cc23c194e0b4@mail.gmail.com> <4535f6cd0902172259k410032a8r86631a731d47f407@mail.gmail.com> Message-ID: <499BBA0C.4060109@charpi.net> Hi, Scott Zhang wrote: > Hi. All. > Another big issue with http client within erlang distribution and > ibrowse. That makes me start to wonder is ibrowse/http client really > working? > > Please try following url. > http://www.cisworldwide.com/xweb/xweb_parser.php?premiumredirect=http%3A%2F%2Fwww.cisworldwide.com%2Fxweb%2Fpremiumsearches%2FxmlNewBackgroundSearch.php%3Fatype%3Dcaps%26fname%3Dscott%26middle_initial%3D%26lname%3Dzhang%26city%3D%26state%3D%26zip%3D%26client_reference%3Dplutux%40harbork.%26cisrestype%3Dunlimited_background&code=11111111&cemail=macromarship@REDACTED > ... > But whether I use http client or ibrowse, they never returns, just hang > there, even I wait for 10 minutes. > ... > 1. http client > get_url(Url) -> > case http:request(get, {Url, []}, [], []) of > {ok, {{Version, 200, ReasonPhrase}, Headers, Body}} -> > Body; > _ -> sleep(500),get_url(Url) > end. It tried inets http client with your url and it works for me. Looking at your code, there is an infinite loop if the response isn't ok (and response code 2000). Did you tried just this ? 1> inets:start(). 2> Url = "your long url". 3> http:request(get, {Url, []}, [], []). The inets application must be started before the request otherwise you'll get an noproc error (I thing that it's your case). Regards, ----- Nicolas Charpentier http://charpi.net From richardc@REDACTED Wed Feb 18 08:39:08 2009 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 18 Feb 2009 08:39:08 +0100 Subject: [erlang-questions] writing a delay loop without now() In-Reply-To: References: Message-ID: <499BBB1C.4080004@it.uu.se> James Hague wrote: > I need more resolution than timer:sleep() will give me. (timer:sleep > gives widely varying results, based on the underlying operating > system). Ugly though it may be, I've been using a spin loop based on > now() and timer:now_diff(). While this appears to work, based on the > values returned by now(), it runs much faster than wall clock time. > I'm assuming it's because of this: > > "It is also guaranteed that subsequent calls to this BIF returns > continuously increasing values." > > Is there another BIF I should be using? I'm hoping I don't have to > write my own linked-in driver for this. Try erlang:statistics(runtime) or erlang:statistics(wall_clock). The resolution is still milliseconds, but you could perhaps combine them with a simple loop that you calibrate at startup, for sub- millisecond delays. /Richard From getyourcontacts@REDACTED Wed Feb 18 09:06:19 2009 From: getyourcontacts@REDACTED (Scott Zhang) Date: Wed, 18 Feb 2009 16:06:19 +0800 Subject: [erlang-questions] ibrowse compile error In-Reply-To: <4535f6cd0902172358s4a9096basd916f32669e653ec@mail.gmail.com> References: <4535f6cd0902170721j61f34565kd978c43177e6a351@mail.gmail.com> <4535f6cd0902170842s56871d0bl44d2cc23c194e0b4@mail.gmail.com> <4535f6cd0902172259k410032a8r86631a731d47f407@mail.gmail.com> <499BBA0C.4060109@charpi.net> <4535f6cd0902172358s4a9096basd916f32669e653ec@mail.gmail.com> Message-ID: <4535f6cd0902180006v3caa5918h781791e397b575a@mail.gmail.com> Actually I tried on 2 server one in China and one in US. Both of them are not working. And more, I have to use wireshark to track the package for this http session. I saw when I was using firefox and .NET program to get this url. I saw the correct GET + many many continueous and at end, it get an Response Code 200. Then everything is fine. When I am using http client and ibrowse, I saw the correct GET + many many continueous 30821 2503.516971 67.55.101.167 192.168.1.101 TCP [TCP segment of a reassembled PDU] then sometimes, I never saw the Response Code 200. Sometimes, I saw the response Code 200 but the erlang program is still blinking there? I have another question, is there a possibility erlang's low level TCP implement has flaw to make it unable to detect tcp shutdown or keepalive? If not why http client and ibrowse can't run correct? Regards. Scott On Wed, Feb 18, 2009 at 3:58 PM, Scott Zhang wrote: > Hi. Nicolas.Please check my attachment. > > I did exactly what you told. It is still not working. I'm glad if I can get > a no proc error instead a endless blinking. > > Regards. > Scott > > On Wed, Feb 18, 2009 at 3:34 PM, Nicolas Charpentier < > nc-dated-1240126482.4ea222@REDACTED> wrote: > >> Hi, >> >> Scott Zhang wrote: >> >>> Hi. All. Another big issue with http client within erlang distribution >>> and ibrowse. That makes me start to wonder is ibrowse/http client really >>> working? >>> >>> Please try following url. >>> http://www.cisworldwide.com/xweb/xweb_parser.php?premiumredirect=http%3A%2F%2Fwww.cisworldwide.com%2Fxweb%2Fpremiumsearches%2FxmlNewBackgroundSearch.php%3Fatype%3Dcaps%26fname%3Dscott%26middle_initial%3D%26lname%3Dzhang%26city%3D%26state%3D%26zip%3D%26client_reference%3Dplutux%40harbork.%26cisrestype%3Dunlimited_background&code=11111111&cemail=macromarship@REDACTED >>> But whether I use http client or ibrowse, they never returns, just hang >>> there, even I wait for 10 minutes. >>> >> > ... >> >> 1. http client >>> get_url(Url) -> >>> case http:request(get, {Url, []}, [], []) of >>> {ok, {{Version, 200, ReasonPhrase}, Headers, Body}} -> >>> Body; >>> _ -> sleep(500),get_url(Url) >>> end. >>> >> >> It tried inets http client with your url and it works for me. >> Looking at your code, there is an infinite loop if the response isn't ok >> (and response code 2000). Did you tried just this ? >> >> 1> inets:start(). >> 2> Url = "your long url". >> 3> http:request(get, {Url, []}, [], []). >> >> >> The inets application must be started before the request otherwise you'll >> get an noproc error (I thing that it's your case). >> >> >> Regards, >> ----- >> Nicolas Charpentier >> http://charpi.net >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ossareh@REDACTED Wed Feb 18 10:56:49 2009 From: ossareh@REDACTED (Michael Ossareh) Date: Wed, 18 Feb 2009 01:56:49 -0800 Subject: [erlang-questions] JInterface and rex Message-ID: Hi, Inspired by http://notdennisbyrne.blogspot.com/2008/07/using-jinterface-to-bridge-erlang-and.html I decided to mess around a bit with jinterface. I seem to be having some fundamental problems however. I have two classes; public class A { OtpNode node; OtpMbox mbox; A() throws Exception { node = new OtpNode("a"); mbox = new OtpMbox("a_mbox"); } public void method1() { // send value mbox.send("b", new OtpErlangInt(99)); } public void method2() { // remote execution OtpErlangTuple t = new OtpErlangTuple( new OtpErlangObject[] { mbox.self(), new OtpErlangTuple( new OtpErlangObject[] { new OtpErlangAtom("call"), new OtpErlangAtom("erlang"), new OtpErlangAtom("node"), new OtpErlangList(new OtpErlangObject[] {}), new OtpErlangAtom("user") } )} ); mbox.send("rex", "b", t); } public void pingOtherNode() { assert node.ping("b"); } } public class B implements Runnable { OtpNode node; OtpMbox mbox; B() throws Exception { node = new OtpNode("b"); mbox = new OtpMbox("b_mbox"); } run() { // loop continuously reading from mbox and output like below // OtpErlangObject obj = mbox.receive(1000); // if (obj!=null) System.out.println("rec "+obj); } } A.ping() successfully pings b when called and B is a running thread. If I change the name of the node to ping in A.ping it fails, so I'm sure they're aware of each others presence. A.method1 results in B.run's method outputting the int. However A.method2 results in no output in B.run(). Right now I'm working on the assumption that this is because "rex" isn't running on the other node (I guess unlike the erlang vm this doesn't happen by default?). So is there a way I can get rex to run? Slides 19 and 20 of http://www.slideshare.net/dennisbyrne/integrating-java-and-erlang-with-jinterface-presentation do not suggest anything along those lines needing to be run - however the actual presentation video suggests that rex is only used to an erlang vm. In essence I'm doing this so that I can build a test suite which lets me test my client code against a light weight version of our server code. Allowing me to unit test, etc. Thanks, mike -- god loves atheists, Fact: http://www.mrwiggleslovesyou.com/comics/rehab477.jpg From ext@REDACTED Wed Feb 18 12:33:55 2009 From: ext@REDACTED (David Sveningsson) Date: Wed, 18 Feb 2009 12:33:55 +0100 Subject: [erlang-questions] Attribute named type In-Reply-To: <87tz6svmuh.fsf@sterlett.hq.kred> References: <499AC8E5.6020203@sidvind.com> <87tz6svmuh.fsf@sterlett.hq.kred> Message-ID: <499BF223.1080802@sidvind.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 mats cronqvist wrote: > David Sveningsson writes: > >> Hi, I'm using some user-defined attributes in my modules. I want to use >> one named type but I doesn't show up with module_info/1 or even >> module_info/0. >> >> Is it reserved by something or am I doing something else wrong? I tried >> to lookup the predefined attributes but I couldn't find anything about >> 'type'. I can read the other attributes fine. > > -type and -spec are reserved. for type declarations and contract > specifications, respectively. AFAIK, they're only used by dialyzer. > > mats > Of course, why didn't I think of that? I am even using -spec in my code. Maybe the documentation should be updated. Anyway, thanks for your answer! -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkmb8iMACgkQ6pa1H/H5pqVUeACdGbr3jBvuveAAceG0fj3gHwQ0 S7AAoJUGr1YTptU/E20xdmN3b8ly1Xv1 =kybN -----END PGP SIGNATURE----- From bbmaj7@REDACTED Wed Feb 18 12:38:30 2009 From: bbmaj7@REDACTED (Richard Andrews) Date: Wed, 18 Feb 2009 03:38:30 -0800 (PST) Subject: [erlang-questions] supervisor behaves differently if started from command line References: <8803-08702@sneakemail.com> <88b82c90902170730n4f729a1bo23e402122ef990c5@mail.gmail.com> Message-ID: <982440.69209.qm@web65515.mail.ac4.yahoo.com> > erl -s mysup > > The top level starts mysup.erl, runs the init callback and exits hence > taking the supervisor with it. But when you start it via an > application, the application blocks till it is explicitly killed. If this is the problem, then using process_flag(trap_exit,true) should allow your supervisor to continue even though its linked parent has exited. Make Yahoo!7 your homepage and win a trip to the Quiksilver Pro. Find out more From pfisher@REDACTED Wed Feb 18 13:48:55 2009 From: pfisher@REDACTED (Paul Fisher) Date: Wed, 18 Feb 2009 06:48:55 -0600 Subject: [erlang-questions] writing a delay loop without now() In-Reply-To: References: <499B6515.4010009@alertlogic.net> Message-ID: <499C03B7.7000804@alertlogic.net> Matthew Dempsky wrote: > On Tue, Feb 17, 2009 at 5:32 PM, Paul Fisher wrote: >> sleep( Milliseconds ) -> >> receive after Milliseconds -> ok end. > > That's exactly how timer:sleep/1 is implemented, which he already mentioned. mea culpa! I did not look, and apologize profusely! -- paul From exta7@REDACTED Wed Feb 18 14:04:27 2009 From: exta7@REDACTED (Zvi) Date: Wed, 18 Feb 2009 05:04:27 -0800 (PST) Subject: [erlang-questions] Erlang marketing materials In-Reply-To: <4d08db370902170205jf10d56dgf58637f138102e2f@mail.gmail.com> References: <22037059.post@talk.nabble.com> <4d08db370902170205jf10d56dgf58637f138102e2f@mail.gmail.com> Message-ID: <22078194.post@talk.nabble.com> I looking for something like this, but for Erlang: http://www.vitanuova.com/mkt/press/Inferno_overview.pdf Compare Erlang/OTP against: 1. mainstream languages: C/C++,Java, .NET 2. dynamic languages: Python, Ruby 3. distributed programming frameworks: CORBA, SOAP, Message Queue Servers 4. parallel programming frameworks: MPI, OpenMP, etc. Erlang by domain: 1. Complex Soft Real-Time Control Systems 2. Mobile, VoIP and IM 3. Internet, Web 2.0 4. Grid / Cluster / Cloud Computing Hynek Vychodil wrote: > > 2009/2/16 Daniel Goertzen > >> I showed that video to a colleague of mine and his first response was >> "C++ >> would never have allowed a typo like that to compile in the first place." >> >> ... so maybe that video isn't the best piece of marketing material. :) >> >> Dialyzer would nail something like that these days, right? >> >> Dan. > > > And your reaction should be "C++ would never allowed you finish project of > this sort and size in meaningful time and effort (AXD 301)". > I see sometimes huge waterfall C++ projects finished more or less on time, but with crappy quality :) If Eran Hammer-Lahav was choosing Erlang for his microblogging startup, maybe today everybody were using Nouncer instead of Twitter. Yet Twitter built on slow-as-hell-Ruby is a winner now: http://www.hueniverse.com/hueniverse/2008/04/the-last-announ.html "The technology decision to use C++ was well founded. However, it failed to take into account, or at least prepare for the inevitable reality of being unable to find people to join me. Any major web company reaching massive scale eventually turns to C/C++ for performance. Given the fact that Nouncer had no competition at all when the idea was first conceived (and I am not claiming to have invented microblogging ? only that I came up with the idea independently), I decided to take a little bit longer before launching to build a solid foundation. This, of course, turned up as a big mistake ..." Zvi -- View this message in context: http://www.nabble.com/Erlang-marketing-materials-tp22037059p22078194.html Sent from the Erlang Questions mailing list archive at Nabble.com. From getyourcontacts@REDACTED Wed Feb 18 14:19:54 2009 From: getyourcontacts@REDACTED (Scott Zhang) Date: Wed, 18 Feb 2009 21:19:54 +0800 Subject: [erlang-questions] ibrowse compile error In-Reply-To: <4535f6cd0902180011y62e9780as4cf787d251ffe95b@mail.gmail.com> References: <4535f6cd0902170721j61f34565kd978c43177e6a351@mail.gmail.com> <4535f6cd0902170842s56871d0bl44d2cc23c194e0b4@mail.gmail.com> <4535f6cd0902172259k410032a8r86631a731d47f407@mail.gmail.com> <499BBA0C.4060109@charpi.net> <4535f6cd0902172358s4a9096basd916f32669e653ec@mail.gmail.com> <4535f6cd0902180006v3caa5918h781791e397b575a@mail.gmail.com> <4535f6cd0902180011y62e9780as4cf787d251ffe95b@mail.gmail.com> Message-ID: <4535f6cd0902180519p74b693bbrd32d74f9c6da599@mail.gmail.com> Hi. All. and kenneth. Just tested on my Linux machine. Both http client and ibrowse work. So the issue only happen on window. " windows 2003 server R2 " As I observed, seems erl's low level tcp can't detect tcp shutdown or things like. As tracked by wireshark, the tcp has been closed, But erlang hungs there. This only happen on windows server 2003 R2. (I tested on my 2 servers as I talked previously) I guess it is a bug in windows binary release. Where can we post a bug? Regards. scott On Wed, Feb 18, 2009 at 4:11 PM, Scott Zhang wrote: > wireshare screenshot. > Any idea? > > On Wed, Feb 18, 2009 at 4:06 PM, Scott Zhang wrote: > >> Actually I tried on 2 server one in China and one in US. Both of them are >> not working. >> And more, I have to use wireshark to track the package for this http >> session. I saw when I was using firefox and .NET program to get this url. I >> saw the correct GET + many many continueous and at end, it get an Response >> Code 200. Then everything is fine. >> >> When I am using http client and ibrowse, I saw the correct GET + many many >> continueous >> 30821 2503.516971 67.55.101.167 192.168.1.101 TCP [TCP segment of a >> reassembled PDU] >> >> then >> sometimes, I never saw the Response Code 200. Sometimes, I saw the >> response Code 200 but the erlang program is still blinking there? >> >> I have another question, is there a possibility erlang's low level TCP >> implement has flaw to make it unable to detect tcp shutdown or keepalive? If >> not why http client and ibrowse can't run correct? >> >> >> Regards. >> Scott >> >> >> >> On Wed, Feb 18, 2009 at 3:58 PM, Scott Zhang wrote: >> >>> Hi. Nicolas.Please check my attachment. >>> >>> I did exactly what you told. It is still not working. I'm glad if I can >>> get a no proc error instead a endless blinking. >>> >>> Regards. >>> Scott >>> >>> On Wed, Feb 18, 2009 at 3:34 PM, Nicolas Charpentier < >>> nc-dated-1240126482.4ea222@REDACTED> wrote: >>> >>>> Hi, >>>> >>>> Scott Zhang wrote: >>>> >>>>> Hi. All. Another big issue with http client within erlang distribution >>>>> and ibrowse. That makes me start to wonder is ibrowse/http client really >>>>> working? >>>>> >>>>> Please try following url. >>>>> http://www.cisworldwide.com/xweb/xweb_parser.php?premiumredirect=http%3A%2F%2Fwww.cisworldwide.com%2Fxweb%2Fpremiumsearches%2FxmlNewBackgroundSearch.php%3Fatype%3Dcaps%26fname%3Dscott%26middle_initial%3D%26lname%3Dzhang%26city%3D%26state%3D%26zip%3D%26client_reference%3Dplutux%40harbork.%26cisrestype%3Dunlimited_background&code=11111111&cemail=macromarship@REDACTED >>>>> But whether I use http client or ibrowse, they never returns, just hang >>>>> there, even I wait for 10 minutes. >>>>> >>>> > ... >>>> >>>> 1. http client >>>>> get_url(Url) -> >>>>> case http:request(get, {Url, []}, [], []) of >>>>> {ok, {{Version, 200, ReasonPhrase}, Headers, Body}} -> >>>>> Body; >>>>> _ -> sleep(500),get_url(Url) >>>>> end. >>>>> >>>> >>>> It tried inets http client with your url and it works for me. >>>> Looking at your code, there is an infinite loop if the response isn't ok >>>> (and response code 2000). Did you tried just this ? >>>> >>>> 1> inets:start(). >>>> 2> Url = "your long url". >>>> 3> http:request(get, {Url, []}, [], []). >>>> >>>> >>>> The inets application must be started before the request otherwise >>>> you'll get an noproc error (I thing that it's your case). >>>> >>>> >>>> Regards, >>>> ----- >>>> Nicolas Charpentier >>>> http://charpi.net >>>> >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From steven.charles.davis@REDACTED Wed Feb 18 15:03:40 2009 From: steven.charles.davis@REDACTED (Steve Davis) Date: Wed, 18 Feb 2009 06:03:40 -0800 (PST) Subject: [erlang-questions] please never make spec required Message-ID: Please, please *never* make spec a required part of Erlang. How can a spec be justified when a spec can be both longer and harder to read than the code. e.g.: from lists... -spec(append/2 :: ([T],[T]) -> [T]). append(L1, L2) -> L1 ++ L2. ...much like java generics which tried to make types compile-time safe, this is well-meaning BS in my book. I confidently predict that the cost(s) of spec will be far, far greater than the reward(s)... Major concerns for me are: - code bloat - source file obfuscation (yes it's harder to read a module with specs in it) - having to find and look up a type() to understand something - specs that include dynamic elements i.e. funs (yes, that's *code*, people, and they will need debugging) e.g. again from lists: -spec(merge/3 :: (fun((X, Y) -> bool()), [X], [Y]) -> [_]). - specs that are wrong or get out of sync with the code (which they will) Really, hold your hand on your heart, and tell me how... -spec(foldl/3 :: (fun((T, _) -> _), _, [T]) -> _). ...helps anyone at all? Well, that's my 2c -- do as you see fit, but please, please, never make me do this! /s From kenneth.lundin@REDACTED Wed Feb 18 16:14:33 2009 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Wed, 18 Feb 2009 16:14:33 +0100 Subject: [erlang-questions] please never make spec required In-Reply-To: References: Message-ID: -spec will always be optional we have no intention of making them mandatory. -spec is a formal specification of a functions signature and this is very useful for public API's. We will also use the information from -spec for the API documentation where we today use an informal syntax or edoc which already has something very similar to '-spec'. Edoc will soon support and use the '-spec' syntax. The consistency between what's in the -spec and the code can be checked so they will not get out of sync with the code. See more embedded comments below. On Wed, Feb 18, 2009 at 3:03 PM, Steve Davis wrote: > Please, please *never* make spec a required part of Erlang. > > How can a spec be justified when a spec can be both longer and harder > to read than the code. e.g.: from lists... > -spec(append/2 :: ([T],[T]) -> [T]). > append(L1, L2) -> L1 ++ L2. > > ...much like java generics which tried to make types compile-time > safe, this is well-meaning BS in my book. I confidently predict that > the cost(s) of spec will be far, far greater than the reward(s)... > > Major concerns for me are: > - code bloat Why? It is also possible to have all -spec's in one block, they need not be in front of each function. > - source file obfuscation (yes it's harder to read a module with specs > in it) How can it be harder? If you understand the code without reading the -spec what's the problem? > - having to find and look up a type() to understand something > - specs that include dynamic elements i.e. funs (yes, that's *code*, > people, and they will need debugging) e.g. again from lists: -spec's does not contain dynamic elements (i.e not code) > -spec(merge/3 :: (fun((X, Y) -> bool()), [X], [Y]) -> [_]). The -spec above means that the merge function takes 3 arguments where the first argument is a fun which should take 2 arguments and return a boolean (i.e. true or false). > - specs that are wrong or get out of sync with the code (which they > will) Since the compiler and dyalyzer can check the consistency of -specs they need not get out of sync. I see the specs as a big improvement since they provide a formal syntax for the function signatures which is any way needed for any documented public API. The formal syntax makes it possible to build tools which give added value. But as said earlier, -spec's will never be mandatory /Kenneth Erlang/OTP Ericsson > > Really, hold your hand on your heart, and tell me how... > -spec(foldl/3 :: (fun((T, _) -> _), _, [T]) -> _). > ...helps anyone at all? > > Well, that's my 2c -- do as you see fit, but please, please, never > make me do this! > > /s > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From kenneth.lundin@REDACTED Wed Feb 18 16:20:55 2009 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Wed, 18 Feb 2009 16:20:55 +0100 Subject: [erlang-questions] ibrowse compile error In-Reply-To: <4535f6cd0902180519p74b693bbrd32d74f9c6da599@mail.gmail.com> References: <4535f6cd0902170721j61f34565kd978c43177e6a351@mail.gmail.com> <4535f6cd0902170842s56871d0bl44d2cc23c194e0b4@mail.gmail.com> <4535f6cd0902172259k410032a8r86631a731d47f407@mail.gmail.com> <499BBA0C.4060109@charpi.net> <4535f6cd0902172358s4a9096basd916f32669e653ec@mail.gmail.com> <4535f6cd0902180006v3caa5918h781791e397b575a@mail.gmail.com> <4535f6cd0902180011y62e9780as4cf787d251ffe95b@mail.gmail.com> <4535f6cd0902180519p74b693bbrd32d74f9c6da599@mail.gmail.com> Message-ID: You can post the bug report preferably on the erlang-bugs mailing list but then you must provide more detailed info where you point at the actual error in the code or even provide a patch. Another option is to provide a minimal program example which shows the bug when run. /Kenneth Erlang/OTP Ericsson On Wed, Feb 18, 2009 at 2:19 PM, Scott Zhang wrote: > Hi. All. and kenneth. > > Just tested on my Linux machine. Both http client and ibrowse work. So the > issue only happen on window. > > " windows 2003 server R2 " > > As I observed, seems erl's low level tcp can't detect tcp shutdown or things > like. As tracked by wireshark, the tcp has been closed, But erlang hungs > there. This only happen on windows server 2003 R2. (I tested on my 2 servers > as I talked previously) > > I guess it is a bug in windows binary release. > > Where can we post a bug? > > Regards. > > scott > > On Wed, Feb 18, 2009 at 4:11 PM, Scott Zhang > wrote: >> >> wireshare screenshot. >> Any idea? >> >> On Wed, Feb 18, 2009 at 4:06 PM, Scott Zhang >> wrote: >>> >>> Actually I tried on 2 server one in China and one in US. Both of them are >>> not working. >>> And more, I have to use wireshark to track the package for this http >>> session. I saw when I was using firefox and .NET program to get this url. I >>> saw the correct GET + many many continueous and at end, it get an Response >>> Code 200. Then everything is fine. >>> When I am using http client and ibrowse, I saw the correct GET + many >>> many continueous >>> 30821 2503.516971 67.55.101.167 192.168.1.101 TCP [TCP segment of a >>> reassembled PDU] >>> >>> then >>> sometimes, I never saw the Response Code 200. Sometimes, I saw the >>> response Code 200 but the erlang program is still blinking there? >>> I have another question, is there a possibility erlang's low level TCP >>> implement has flaw to make it unable to detect tcp shutdown or keepalive? If >>> not why http client and ibrowse can't run correct? >>> >>> Regards. >>> Scott >>> >>> >>> On Wed, Feb 18, 2009 at 3:58 PM, Scott Zhang >>> wrote: >>>> >>>> Hi. Nicolas. >>>> Please check my attachment. >>>> I did exactly what you told. It is still not working. I'm glad if I can >>>> get a no proc error instead a endless blinking. >>>> Regards. >>>> Scott >>>> On Wed, Feb 18, 2009 at 3:34 PM, Nicolas Charpentier >>>> wrote: >>>>> >>>>> Hi, >>>>> >>>>> Scott Zhang wrote: >>>>>> >>>>>> Hi. All. Another big issue with http client within erlang distribution >>>>>> and ibrowse. That makes me start to wonder is ibrowse/http client really >>>>>> working? >>>>>> >>>>>> Please try following url. >>>>>> http://www.cisworldwide.com/xweb/xweb_parser.php?premiumredirect=http%3A%2F%2Fwww.cisworldwide.com%2Fxweb%2Fpremiumsearches%2FxmlNewBackgroundSearch.php%3Fatype%3Dcaps%26fname%3Dscott%26middle_initial%3D%26lname%3Dzhang%26city%3D%26state%3D%26zip%3D%26client_reference%3Dplutux%40harbork.%26cisrestype%3Dunlimited_background&code=11111111&cemail=macromarship@REDACTED >>>>>> ... >>>>>> But whether I use http client or ibrowse, they never returns, just >>>>>> hang there, even I wait for 10 minutes. >>>>> >>>>> > ... >>>>> >>>>>> 1. http client >>>>>> get_url(Url) -> >>>>>> case http:request(get, {Url, []}, [], []) of >>>>>> {ok, {{Version, 200, ReasonPhrase}, Headers, Body}} -> >>>>>> Body; >>>>>> _ -> sleep(500),get_url(Url) >>>>>> end. >>>>> >>>>> It tried inets http client with your url and it works for me. >>>>> Looking at your code, there is an infinite loop if the response isn't >>>>> ok (and response code 2000). Did you tried just this ? >>>>> >>>>> 1> inets:start(). >>>>> 2> Url = "your long url". >>>>> 3> http:request(get, {Url, []}, [], []). >>>>> >>>>> >>>>> The inets application must be started before the request otherwise >>>>> you'll get an noproc error (I thing that it's your case). >>>>> >>>>> >>>>> Regards, >>>>> ----- >>>>> Nicolas Charpentier >>>>> http://charpi.net >>>> >>> >> > > From exta7@REDACTED Wed Feb 18 16:53:19 2009 From: exta7@REDACTED (Zvi) Date: Wed, 18 Feb 2009 07:53:19 -0800 (PST) Subject: [erlang-questions] please never make spec required In-Reply-To: References: Message-ID: <22081703.post@talk.nabble.com> Steve Davis-5 wrote: > > Please, please *never* make spec a required part of Erlang. > > How can a spec be justified when a spec can be both longer and harder > to read than the code. e.g.: from lists... > -spec(append/2 :: ([T],[T]) -> [T]). > append(L1, L2) -> L1 ++ L2. > In Erlang arguments got duplicated 4 times (edoc, spec, arguments list/patterns and guards). Overtiem, it's guaranteed, that they will be out of sync: %%-------------------------------------------------------------------- %% @doc Concatenates two lists %% @spec append(list(),list()) -> list() %% @end %%-------------------------------------------------------------------- -spec(append/2 :: ([T],[T]) -> [T]). append(L1, L2) when is_list(L1), is_list(L2) -> L1 ++ L2. Compare this with C++ and Doxygen (arguments specified only once, thanks for type declarations and special doxygen syntax): /** * returns list, which is concatenations of two input lists */ template list append( const list &L1, /**< list of elements of type T */ const list &L2) const /**< list of elements of type T */ { list L(L1); L.insert(L.end(), L2.begin(), L2.end()); return L; } Zvi -- View this message in context: http://www.nabble.com/please-never-make-spec-required-tp22079518p22081703.html Sent from the Erlang Questions mailing list archive at Nabble.com. From mm@REDACTED Wed Feb 18 17:29:04 2009 From: mm@REDACTED (marmll) Date: Wed, 18 Feb 2009 08:29:04 -0800 (PST) Subject: [erlang-questions] Xml Parsing Message-ID: <22082508.post@talk.nabble.com> Hi, i need urgent your xml experience. We need a code snip to check if an Element is inside the xml Document or not. We know how we can read the value of an Element but whats going on when the element is not inside the xmlDocument. Please help Thanks -- View this message in context: http://www.nabble.com/Xml-Parsing-tp22082508p22082508.html Sent from the Erlang Questions mailing list archive at Nabble.com. From james.hague@REDACTED Wed Feb 18 22:44:36 2009 From: james.hague@REDACTED (James Hague) Date: Wed, 18 Feb 2009 15:44:36 -0600 Subject: [erlang-questions] writing a delay loop without now() In-Reply-To: References: <499BBB1C.4080004@it.uu.se> Message-ID: I'll look into the functions Richard suggested. One of those might work. What was the reason for enforcing that now/0 never return the same value twice? It means you can cause time to run faster by calling now/0 more frequently. And time accelerates faster on faster hardware. From kunthar@REDACTED Wed Feb 18 23:09:05 2009 From: kunthar@REDACTED (Kunthar) Date: Thu, 19 Feb 2009 00:09:05 +0200 Subject: [erlang-questions] Mongo DB driver Message-ID: <9a09ca9a0902181409s3dc279d8v1598896b85c3bf40@mail.gmail.com> Is there any erlang driver for Mongo DB? http://www.10gen.com/ http://www.mongodb.org/display/DOCS/Home Willing to collaborate if any erlanger things on it. Peace \|/ Kunth From steven.charles.davis@REDACTED Thu Feb 19 00:13:34 2009 From: steven.charles.davis@REDACTED (Steve Davis) Date: Wed, 18 Feb 2009 15:13:34 -0800 (PST) Subject: [erlang-questions] please never make spec required In-Reply-To: References: Message-ID: <218b7a7f-acc4-49e2-81e5-763dff10b49c@v39g2000yqm.googlegroups.com> Thanks, Kenneth for putting my mind at rest! As you can tell I'm not a big fan of "spec". I understand the reasoning behind it but don't see it as the solution. BR, Steve On Feb 18, 9:14?am, Kenneth Lundin wrote: > But as said earlier, -spec's will never be mandatory > > /Kenneth Erlang/OTP Ericsson From tobbe@REDACTED Thu Feb 19 01:56:33 2009 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Thu, 19 Feb 2009 01:56:33 +0100 Subject: [erlang-questions] Xml Parsing References: <22082508.post@talk.nabble.com> Message-ID: <87ab8jgs72.fsf@guppy.tornkvist.org> Have a look at: http://blog.tornkvist.org/blog.yaws?id=1193209275268448 for some examples. --Tobbe marmll writes: > Hi, > > i need urgent your xml experience. We need a code snip to check if an > Element is inside the xml Document or not. > We know how we can read the value of an Element but whats going on when the > element is not inside the xmlDocument. > > Please help > > Thanks > -- > View this message in context: http://www.nabble.com/Xml-Parsing-tp22082508p22082508.html > Sent from the Erlang Questions mailing list archive at Nabble.com. > From kevin@REDACTED Thu Feb 19 05:38:55 2009 From: kevin@REDACTED (Kevin A. Smith) Date: Wed, 18 Feb 2009 23:38:55 -0500 Subject: [erlang-questions] Memory Usage w/disc_copies Message-ID: I know this has been discussed on the list before but I haven't found a satisfactory answer either in the list archives or Google. I've got some test code which queries 9 disc_copies tables in a tight loop. The tables have been preloaded and no new data is created during the test. Querying is done via dirty_match_object/1. I've noticed that the memory footprint of the Erlang VM grows as long as I leave my test running. The VM will start with a low memory footprint, say around 3-4 MB, and then grow to over 360 MB in the space of a minute. I know I could use ets or dets directly and probably workaround this issue but I'm intrigued and I'd like to understand exactly what's happening. erlang:memory/0 reports this after a typical test run: [{total,385341784}, {processes,694596}, {processes_used,686596}, {system,384647188}, {atom,402833}, {atom_used,372656}, {binary,13728}, {code,2993679}, {ets,380521792}] It looks like ets is responsible for the lion's share of memory usage. I've tried all of the standard tricks: * setting fullsweep_after via erlang:system_flag/2 (before any test code is run) * calling erlang:garbage_collect/0 at the top of each loop iteration * calling mnesia_recover:allow_garb/0 and mnesia_recover:start_garb/0 frequently None of these changes have resulted in any measurable improvement. I did find this post from last year: http://tinyurl.com/mnesia I've verified that Dan Gudmundsson's changes (see the end of the above thread) are present in mnesia_dumper and mnesia_recover. I'm running R12B-5 so it looks like Dan's changes were incorporated at some point. The odd thing is if I change the table type to disc_only_copies the problem goes away. Memory usage peaks at around 20 MB and averages out around 11 MB. Can anyone shed some light on the behavior I'm seeing? Thanks, Kevin From masse@REDACTED Thu Feb 19 08:34:20 2009 From: masse@REDACTED (mats cronqvist) Date: Thu, 19 Feb 2009 08:34:20 +0100 Subject: [erlang-questions] Memory Usage w/disc_copies In-Reply-To: (Kevin A. Smith's message of "Wed\, 18 Feb 2009 23\:38\:55 -0500") References: Message-ID: <87tz6qsww3.fsf@sterlett.hq.kred> "Kevin A. Smith" writes: > I know this has been discussed on the list before but I haven't found > a satisfactory answer either in the list archives or Google. > > I've got some test code which queries 9 disc_copies tables in a tight > loop. The tables have been preloaded and no new data is created during > the test. Querying is done via dirty_match_object/1. > > I've noticed that the memory footprint of the Erlang VM grows as long > as I leave my test running. The VM will start with a low memory > footprint, say around 3-4 MB, and then grow to over 360 MB in the > space of a minute. I know I could use ets or dets directly and > probably workaround this issue but I'm intrigued and I'd like to > understand exactly what's happening. > > erlang:memory/0 reports this after a typical test run: > > [{total,385341784}, > {processes,694596}, > {processes_used,686596}, > {system,384647188}, > {atom,402833}, > {atom_used,372656}, > {binary,13728}, > {code,2993679}, > {ets,380521792}] what does erlang:memory/0 say before the run? what does mnesia:table_info(,memory/size) say? what does the test code look like? mats From matthew@REDACTED Thu Feb 19 10:14:56 2009 From: matthew@REDACTED (Matthew Dempsky) Date: Thu, 19 Feb 2009 01:14:56 -0800 Subject: [erlang-questions] writing a delay loop without now() In-Reply-To: References: <499BBB1C.4080004@it.uu.se> Message-ID: On Wed, Feb 18, 2009 at 1:44 PM, James Hague wrote: > What was the reason for enforcing that now/0 never return the same > value twice? More than that, the runtime enforces that now/0 returns monotonically increasing values, which makes it useful for timestamping events and ensuring they have a stable sort order. From getyourcontacts@REDACTED Thu Feb 19 11:09:37 2009 From: getyourcontacts@REDACTED (Scott Zhang) Date: Thu, 19 Feb 2009 18:09:37 +0800 Subject: [erlang-questions] Memory Usage w/disc_copies In-Reply-To: References: Message-ID: <4535f6cd0902190209p10be99f0h41ff2852c643ac35@mail.gmail.com> Hi. Kevin.I am not sure your exact question is. But based on my experience with mnesia with table type disc_copies. mnesia will keep a complete copy of table in ram too. The first time you access that table,(Ususally I am using tv:start()). It reside in RAM. Comsume your RAM until it crash your erlang VM. It is a potential dangerous to use ram_copies and disc_copies, because unconscious it will crash itself. Regards. Scott On Thu, Feb 19, 2009 at 12:38 PM, Kevin A. Smith wrote: > I know this has been discussed on the list before but I haven't found > a satisfactory answer either in the list archives or Google. > > I've got some test code which queries 9 disc_copies tables in a tight > loop. The tables have been preloaded and no new data is created during > the test. Querying is done via dirty_match_object/1. > > I've noticed that the memory footprint of the Erlang VM grows as long > as I leave my test running. The VM will start with a low memory > footprint, say around 3-4 MB, and then grow to over 360 MB in the > space of a minute. I know I could use ets or dets directly and > probably workaround this issue but I'm intrigued and I'd like to > understand exactly what's happening. > > erlang:memory/0 reports this after a typical test run: > > [{total,385341784}, > {processes,694596}, > {processes_used,686596}, > {system,384647188}, > {atom,402833}, > {atom_used,372656}, > {binary,13728}, > {code,2993679}, > {ets,380521792}] > > It looks like ets is responsible for the lion's share of memory usage. > > I've tried all of the standard tricks: > > * setting fullsweep_after via erlang:system_flag/2 (before any test > code is run) > * calling erlang:garbage_collect/0 at the top of each loop iteration > * calling mnesia_recover:allow_garb/0 and mnesia_recover:start_garb/0 > frequently > > None of these changes have resulted in any measurable improvement. I > did find this post from last year: > > http://tinyurl.com/mnesia > > I've verified that Dan Gudmundsson's changes (see the end of the above > thread) are present in mnesia_dumper and mnesia_recover. I'm running > R12B-5 so it looks like Dan's changes were incorporated at some point. > > The odd thing is if I change the table type to disc_only_copies the > problem goes away. Memory usage peaks at around 20 MB and averages out > around 11 MB. > > Can anyone shed some light on the behavior I'm seeing? > > Thanks, > Kevin > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Thu Feb 19 12:02:40 2009 From: gleber.p@REDACTED (Gleb Peregud) Date: Thu, 19 Feb 2009 12:02:40 +0100 Subject: [erlang-questions] Abstract patterns & frames/proper records In-Reply-To: References: <95be1d3b0803180514r40259e2bybaa04f9f1a7977cc@mail.gmail.com> Message-ID: <14f0e3620902190302o60969c6fl448980cf176594ef@mail.gmail.com> On Fri, Mar 21, 2008 at 13:46, Jachym Holecek wrote: > On Tue, 18 Mar 2008 13:14:08 +0100, Vlad Dumitrescu > wrote: >> What is the reason that Richard O'Keefe's abstract patterns proposal >> appears in the discussions quite often, but nothing is being done >> about it? If an EEP would be written about it, what would be missing >> in order to have it considered? Is it only the lack of an >> implementation, or are there problems with it that didn't surface yet? >> >> The same questions can also be asked about the frames, respectively >> the proper records proposals. > > I'm curious about this as well. What do OTP people think about the two > proposals? > Anybody happens to be working on proof-of-concept implementation? I second these questions. Is there any activity in these directions? -- Gleb Peregud http://gleber.pl/ From martin@REDACTED Thu Feb 19 12:42:20 2009 From: martin@REDACTED (Martin Gore) Date: Thu, 19 Feb 2009 11:42:20 -0000 Subject: [erlang-questions] Job Posting Message-ID: I'd like to post the following notice on the discussion board: We are looking for experienced Erland/Ejabberd developers for our client based in the Netherlands. This is an excellent opportunity with an innovative company and will offer a competitive salary and career progression. Any interested parties should forward a CV and contact details to martin@REDACTED Regards Martin Martin Gore Aquantra T +44 (0)1225 859900 (UK) T +44 (0)1225 859945 (International) F +44 (0)1225 859922 email: martin@REDACTED Web: http://www.aquantra.com/ The contents of this email and any attachments are sent for the attention of the addressee(s) only and may contain confidential and/or privileged material. If you have received this email in error, please notify the sender immediately and delete it from your system. If you are not the addressee, any review, retransmission, disclosure, copying or other use of this email and any attachments is prohibited. Statements and opinions expressed in this email may not represent those of the company and any representations or commitments in this email are subject to contract. Aquantra Limited P Please consider the environment before printing this e-mail ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.jpg Type: image/jpeg Size: 2361 bytes Desc: image001.jpg URL: From kevin@REDACTED Thu Feb 19 12:55:44 2009 From: kevin@REDACTED (Kevin A. Smith) Date: Thu, 19 Feb 2009 06:55:44 -0500 Subject: [erlang-questions] Memory Usage w/disc_copies In-Reply-To: <4535f6cd0902190209p10be99f0h41ff2852c643ac35@mail.gmail.com> References: <4535f6cd0902190209p10be99f0h41ff2852c643ac35@mail.gmail.com> Message-ID: <24B4D47D-A57F-4E81-ACDF-DC6755E9E872@hypotheticalabs.com> Right. I knew that disc_copies were RAM resident so I'd expect some increase in memory usage. The behavior I'm seeing is that successive identical queries which return the same results each time consume more memory with each invocation. If the data is in a steady state I'd expect the memory footprint to level off at some point, too. That's not happening and I don't understand why. --Kevin On Feb 19, 2009, at 5:09 AM, Scott Zhang wrote: > Hi. Kevin. > I am not sure your exact question is. But based on my experience > with mnesia with table type disc_copies. mnesia will keep a complete > copy of table in ram too. The first time you access that table, > (Ususally I am using tv:start()). It reside in RAM. Comsume your RAM > until it crash your erlang VM. > > It is a potential dangerous to use ram_copies and disc_copies, > because unconscious it will crash itself. > > > Regards. > Scott > > > > On Thu, Feb 19, 2009 at 12:38 PM, Kevin A. Smith > wrote: > I know this has been discussed on the list before but I haven't found > a satisfactory answer either in the list archives or Google. > > I've got some test code which queries 9 disc_copies tables in a tight > loop. The tables have been preloaded and no new data is created during > the test. Querying is done via dirty_match_object/1. > > I've noticed that the memory footprint of the Erlang VM grows as long > as I leave my test running. The VM will start with a low memory > footprint, say around 3-4 MB, and then grow to over 360 MB in the > space of a minute. I know I could use ets or dets directly and > probably workaround this issue but I'm intrigued and I'd like to > understand exactly what's happening. > > erlang:memory/0 reports this after a typical test run: > > [{total,385341784}, > {processes,694596}, > {processes_used,686596}, > {system,384647188}, > {atom,402833}, > {atom_used,372656}, > {binary,13728}, > {code,2993679}, > {ets,380521792}] > > It looks like ets is responsible for the lion's share of memory usage. > > I've tried all of the standard tricks: > > * setting fullsweep_after via erlang:system_flag/2 (before any test > code is run) > * calling erlang:garbage_collect/0 at the top of each loop iteration > * calling mnesia_recover:allow_garb/0 and mnesia_recover:start_garb/0 > frequently > > None of these changes have resulted in any measurable improvement. I > did find this post from last year: > > http://tinyurl.com/mnesia > > I've verified that Dan Gudmundsson's changes (see the end of the above > thread) are present in mnesia_dumper and mnesia_recover. I'm running > R12B-5 so it looks like Dan's changes were incorporated at some point. > > The odd thing is if I change the table type to disc_only_copies the > problem goes away. Memory usage peaks at around 20 MB and averages out > around 11 MB. > > Can anyone shed some light on the behavior I'm seeing? > > Thanks, > Kevin > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From bgustavsson@REDACTED Thu Feb 19 14:08:04 2009 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Thu, 19 Feb 2009 14:08:04 +0100 Subject: [erlang-questions] EEP 26: "Make andalso and orelse tail-recursive" has been approved Message-ID: <6672d0160902190508y685545f7haa8965e1df97b543@mail.gmail.com> EEP 26: "Make andalso and orelse tail-recursive" has been approved and will be implemented in R13A. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From thomasl_erlang@REDACTED Thu Feb 19 13:55:11 2009 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Thu, 19 Feb 2009 04:55:11 -0800 (PST) Subject: [erlang-questions] Abstract patterns & frames/proper records References: <95be1d3b0803180514r40259e2bybaa04f9f1a7977cc@mail.gmail.com> <14f0e3620902190302o60969c6fl448980cf176594ef@mail.gmail.com> Message-ID: <319414.24703.qm@web111406.mail.gq1.yahoo.com> ----- Original Message ---- > From: Gleb Peregud > To: Jachym Holecek > Cc: erlang-questions > Sent: Thursday, February 19, 2009 12:02:40 PM > Subject: Re: [erlang-questions] Abstract patterns & frames/proper records > > On Fri, Mar 21, 2008 at 13:46, Jachym Holecek > wrote: > > On Tue, 18 Mar 2008 13:14:08 +0100, Vlad Dumitrescu > > wrote: > >> What is the reason that Richard O'Keefe's abstract patterns proposal > >> appears in the discussions quite often, but nothing is being done > >> about it? If an EEP would be written about it, what would be missing > >> in order to have it considered? Is it only the lack of an > >> implementation, or are there problems with it that didn't surface yet? > >> > >> The same questions can also be asked about the frames, respectively > >> the proper records proposals. > > > > I'm curious about this as well. What do OTP people think about the two > > proposals? > > Anybody happens to be working on proof-of-concept implementation? > > I second these questions. Is there any activity in these directions? Do note that there have been many proposals by many people over the years, proposals that might or might not be currently useful, applicable, relevant, etc. I guess the live ones are being shepherded through the EEP thing. Abstract patterns seem potentially interesting. For starters, I think a prototype might be suitable for undergrad thesis work by a good student. Evaluate implementation options, implement a prototype, describe the implementation, and/or evaluate usefulness for programmers (or that could be a second thesis). Perhaps OTP can sponsor a visitor? If abstract patterns work well in practice, it could then be the basis of an EEP with implementation. Best, Thomas From erlang@REDACTED Thu Feb 19 16:48:39 2009 From: erlang@REDACTED (Dominic Williams) Date: Thu, 19 Feb 2009 10:48:39 -0500 (EST) Subject: [erlang-questions] Floating guard sequences In-Reply-To: <20090217221350.GA6592@herbie> References: <20090217221350.GA6592@herbie> Message-ID: <253769ca0264fd053564dd3660b86320.squirrel@www.geekisp.com> Hello Michael, > This is a very preliminary proposal to extend Erlang's > guard syntax (based on an idea I briefly mentioned in > another thread). I'd like to hear people's > reactions....if there is interest, and if the OTP team > doesn't say it's impossible for some reason, I'd be happy > to write an EEP. First, I find the resulting code very hard to read. Maybe I'm just used to the current language, but I know that I think first in terms of structure and algorithm, and only secondarily in terms of typing. With the floating guards interleaved with the structure of terms, I can't see what's happening anymore. Secondly, I am not favourable to anything which allows the same code to be written two ways purely as a matter of taste. Regards, Dominic Williams. http://dominicwilliams.net From james.hague@REDACTED Thu Feb 19 17:41:45 2009 From: james.hague@REDACTED (James Hague) Date: Thu, 19 Feb 2009 10:41:45 -0600 Subject: [erlang-questions] writing a delay loop without now() In-Reply-To: References: <499BBB1C.4080004@it.uu.se> Message-ID: > More than that, the runtime enforces that now/0 returns monotonically > increasing values, which makes it useful for timestamping events and > ensuring they have a stable sort order. Very useful...but not for now/0. A function that returns the current time shouldn't itself cause the time to change. now() is make_ref disguised as a clock. From matthew@REDACTED Thu Feb 19 18:12:17 2009 From: matthew@REDACTED (Matthew Dempsky) Date: Thu, 19 Feb 2009 09:12:17 -0800 Subject: [erlang-questions] writing a delay loop without now() In-Reply-To: References: <499BBB1C.4080004@it.uu.se> Message-ID: On Thu, Feb 19, 2009 at 8:41 AM, James Hague wrote: > Very useful...but not for now/0. A function that returns the current > time shouldn't itself cause the time to change. now() is make_ref > disguised as a clock. make_ref/0 doesn't return monotonically increasing references. From hasan.veldstra@REDACTED Thu Feb 19 18:51:00 2009 From: hasan.veldstra@REDACTED (Hasan Veldstra) Date: Thu, 19 Feb 2009 17:51:00 +0000 Subject: [erlang-questions] startups using Erlang In-Reply-To: <8D7FE22F-5637-433D-8C9D-93C127F6E8B3@gmail.com> References: <8D7FE22F-5637-433D-8C9D-93C127F6E8B3@gmail.com> Message-ID: thank you, everyone, for your replies. if anyone thinks of any more startups/companies, please post a note to this thread or email me directly. /Hasan From fess-erlang@REDACTED Thu Feb 19 19:48:07 2009 From: fess-erlang@REDACTED (fess) Date: Thu, 19 Feb 2009 10:48:07 -0800 Subject: [erlang-questions] Floating guard sequences In-Reply-To: <253769ca0264fd053564dd3660b86320.squirrel@www.geekisp.com> References: <20090217221350.GA6592@herbie> <253769ca0264fd053564dd3660b86320.squirrel@www.geekisp.com> Message-ID: On Feb 19, 2009, at 7:48 AM, Dominic Williams wrote: > Hello Michael, > >> This is a very preliminary proposal to extend Erlang's >> guard syntax (based on an idea I briefly mentioned in >> another thread). I'd like to hear people's >> reactions....if there is interest, and if the OTP team >> doesn't say it's impossible for some reason, I'd be happy >> to write an EEP. > > First, I find the resulting code very hard to read. Maybe > I'm just used to the current language, but I know that I > think first in terms of structure and algorithm, and only > secondarily in terms of typing. With the floating guards > interleaved with the structure of terms, I can't see what's > happening anymore. I think the first two cases Michael mentioned, floating guards in a function clause or case clause, do look more complicated so you wouldn't write them that way. However I find that I often reduce a rather common but complex record match in function clauses to a macro. it makes a rather complex record match much simpler, but you can't use guards there, so this proposal would allow that. So, I think that it could improve readability in the macro case, but it sounds somewhat like a fake way using them internally to do something like Richards abstract patterns. also floating guards on the LHS of a match seem like they could make code much more concise and readable, and erlang-like [ to me ] { X when is_integer(X), [ "x" | Rest ] } = string:to_integer(Str), { Y when is_integer(Y), _ } = string:to_integer(Rest), vs: Rest = case string:to_integer(Str) of { X, [ $x | R ] } when is_integer(X) -> R end, case string:to_integer(Rest) of { Y, _ } when is_integer(Y) -> { X, Y } end. this because string:to_integer/1 returns a 2 element tuple on success or failure, making the standard idiom of matching with '= ' or failing need a guard. maybe I've helped show how this proposal could improve readability? > Secondly, I am not favourable to anything which allows the > same code to be written two ways purely as a matter of > taste. You mean like case vs if ? *grin* [ I'm just joking there. ] --fess --fess From fess-erlang@REDACTED Thu Feb 19 19:53:54 2009 From: fess-erlang@REDACTED (fess) Date: Thu, 19 Feb 2009 10:53:54 -0800 Subject: [erlang-questions] abstract patterns vs macros was:( Floating guard sequences) In-Reply-To: <2BE36673-CDE2-405D-8336-FE45304A16FE@cs.otago.ac.nz> References: <20090217221350.GA6592@herbie> <2BE36673-CDE2-405D-8336-FE45304A16FE@cs.otago.ac.nz> Message-ID: <3E9FE23F-EA09-417A-8054-85135F4B6C71@fess.org> On Feb 17, 2009, at 4:51 PM, Richard O'Keefe wrote: > Abstract patterns, however, do increase expressiveness, > can improve readability, and do solve the "no way to name > a repeated condition" problem, *without* introducing > potentially unbounded or side-effective computation into > matching. And they're hygienic, not like macros. > > #natural(X) when is_integer(X), X >= 0 -> X. > > f(#natural(X), ...) when ... -> ... > f(..., #natural(Y)) when ... -> ... > > Abstract patterns really are a good idea. I do this sort of thing with macros, -define(is_natural(X), is_integer(X), X >= 0 ). f(X, ...) when ?is_natural(X) -> ... I'm sure I can learn something by asking, why not just do this with macros? --fess From per@REDACTED Thu Feb 19 21:06:16 2009 From: per@REDACTED (Per Hedeland) Date: Thu, 19 Feb 2009 21:06:16 +0100 (CET) Subject: [erlang-questions] writing a delay loop without now() In-Reply-To: Message-ID: <200902192006.n1JK6GkE052555@pluto.hedeland.org> James Hague wrote: > >> More than that, the runtime enforces that now/0 returns monotonically >> increasing values, which makes it useful for timestamping events and >> ensuring they have a stable sort order. > >Very useful...but not for now/0. A function that returns the current >time shouldn't itself cause the time to change. now() is make_ref >disguised as a clock. I don't know if you actually meant it, but of course calling now/0 has no effect on the VM's idea of time itself, only on subsequent return values from now/0. Once you stop calling it once per microsecond or more, the effect will go away. In the day when this nifty feature was implemented, there existed no HW/OS combination that could complete the underlying call to gettimeofday() in less than a microsecond. However implementations that kept returning the same number of microseconds until a timer interrupt bumped the value by 10000 or more were common. Maybe the time (sorry) has come to introduce really_now/0, which would return the unadjusted result of calling clock_gettime(CLOCK_REALTIME) as a single bignum (nanoseconds since the epoch). Using this number as the basis for timeout calculations would be strictly forbidden. --Per Hedeland From rvirding@REDACTED Thu Feb 19 21:16:44 2009 From: rvirding@REDACTED (Robert Virding) Date: Thu, 19 Feb 2009 21:16:44 +0100 Subject: [erlang-questions] Floating guard sequences In-Reply-To: References: <20090217221350.GA6592@herbie> <253769ca0264fd053564dd3660b86320.squirrel@www.geekisp.com> Message-ID: <3dbc6d1c0902191216o44956eb8v5fe5392badfb0b31@mail.gmail.com> 2009/2/19 fess > > something like Richards abstract patterns. > > also floating guards on the LHS of a match seem like they could make > code much more concise and readable, and erlang-like [ to me ] > > { X when is_integer(X), [ "x" | Rest ] } = string:to_integer(Str), > { Y when is_integer(Y), _ } = string:to_integer(Rest), Sorry, but I must point out that you can do this in LFE already: (let* ((#(x ("x" . rest)) (when (is_integer x)) (: string to_integer str)) (#(y _) (when (is_integer y)) (: string to_integer rest))) ... ) Anywhere you can have a pattern you can always follow it with a guard of the form (when ). Getting back to the question at hand I personally find then more difficult to read. But that may very well be because I am not used to it. One good point with this suggestion though is that it moves guards back to be what they originally were intended, simple tests which were parts the pattern matching which could not easily be written in the pattern. It might lessen the confusion of guards not being real expressions. Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From exta7@REDACTED Thu Feb 19 21:22:15 2009 From: exta7@REDACTED (Zvi) Date: Thu, 19 Feb 2009 12:22:15 -0800 (PST) Subject: [erlang-questions] Floating guard sequences In-Reply-To: References: <20090217221350.GA6592@herbie> <253769ca0264fd053564dd3660b86320.squirrel@www.geekisp.com> Message-ID: <22108890.post@talk.nabble.com> fess-3 wrote: > > ... > floating guards on the LHS of a match seem like they could make > code much more concise and readable, and erlang-like [ to me ] > > > { X when is_integer(X), [ "x" | Rest ] } = string:to_integer(Str), > { Y when is_integer(Y), _ } = string:to_integer(Rest), > much more readable, if we can marry patterns with guards: { X = int(), [ "x" | Rest ] } = string:to_integer(Str), { Y = int(), _ } = string:to_integer(Rest), where int() is patten matching any integer value. Or, if X and Y unused, like in the example above: { int(), [ "x" | Rest ] } = string:to_integer(Str), { int(), _ } = string:to_integer(Rest), similarly, pattern for each data type are needed (i.e. atom(), float(), pid(), ref(), fun(), etc.) Instead of writing something, like: map(F,L) when is_function(F,1) -> ... you can write: map(F = fun(_), L) -> ... or instead of: reduce(F,L) when is_function(F,2), is_list(L) -> ... you can write: reduce(F = fun(number(),number()), L = list()) -> ... Then patterns can be extended to ranges, i.e. instead of: month(M) when is_integer(M), 1= ... you can write something like: month(M = 1..12) -> ... or is_natural(1..inf) -> true; % inf - is reserved word for infinity range is_natural(num()) -> false. etc. Also I think it can be usefull to implement doxygen, like edoc: reduce(F = fun(number(),number()), %@@ function that takes two numbers and returns number L = list()) %@@input list of numbers -> ... Is short, pattern defines set of values, that will match it. In the same way as type defines set of values, which belongs to it. Also if pattern defines (ordered) set, it can be used for iteration, i.e.: [ month_name(Month) || Month <- 1..12 ] So, I propose to use the same construct for: 1. Construction of values (literal constructs value of itself) 2. Pattern matching (literal matches itself) 3. Dynamic type declaration 4. Iterators I think it's much more Erlangish way, than type specs. Zvi -- View this message in context: http://www.nabble.com/Floating-guard-sequences-tp22067566p22108890.html Sent from the Erlang Questions mailing list archive at Nabble.com. From abhay@REDACTED Thu Feb 19 22:40:55 2009 From: abhay@REDACTED (Abhay Kumar) Date: Thu, 19 Feb 2009 13:40:55 -0800 Subject: [erlang-questions] License Clarification about EUnit in OTP needed In-Reply-To: References: Message-ID: <47679224-E98A-4E1A-B405-9955E2C60B35@opensynapse.net> i tried to bring this up a little while ago but haven't heard back about it yet (http://erlang.org/pipermail/erlang-questions/2008-December/040313.html ). That tweet from Micka?l is promising. In the meantime you could also consider etap (http://github.com/ngerakines/etap ) which I believe is released under the MIT license. - abhay On Feb 16, 2009, at 5:37 AM, Jan Lehnardt wrote: > Hi, > > if this is not the right place to ask, please let me know. > The OTP team is reading here, so I think it's good to > make this a public discussion :) > > The CouchDB team is looking at adopting EUnit for > unit testing. Since EUnit is now shipped with OTP since > R12B-5, we're happy to adopt it. Since we are with > the ASF there are some licensing restrictions we need > to take care of. The easiest for us is if we could treat EUnit > as yet another standard OTP library released under the > EPL license. > > The R12B-5 source still includes all LGPL boilerplate > and the COPYING file. We understand that this means > that while EUnit ships with OTP, the license remains > LGPL. > > Now this discussion took place earlier today: > > http://twitter.com/janl/status/1214902936 > http://twitter.com/mickael/status/1215085264 > http://twitter.com/janl/status/1215153939 > > We're wondering if the LGPL mentions in the source are > mere leftovers or if they are still valid. > > In any case, it would be nice to see a definite and > public statement about this that we can link and refer > to in the future. Both readings of the license-possibility > came up in our thread and I am sure we're not the > only ones. > > Cheers > Jan > -- > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From mog-lists@REDACTED Thu Feb 19 22:52:26 2009 From: mog-lists@REDACTED (Matthew O'Gorman) Date: Thu, 19 Feb 2009 15:52:26 -0600 Subject: [erlang-questions] License Clarification about EUnit in OTP needed In-Reply-To: <47679224-E98A-4E1A-B405-9955E2C60B35@opensynapse.net> References: <47679224-E98A-4E1A-B405-9955E2C60B35@opensynapse.net> Message-ID: <550d55060902191352y42e65de0j4c1f56fbd4761184@mail.gmail.com> It would be nice if Ericsson updated epl to mpl 1.1 for erlang/otp, and did the troika on it to make code more accessible to others, like firefox and other mpl users have done. Or commented on this issue. Mog -------------- next part -------------- An HTML attachment was scrubbed... URL: From james.hague@REDACTED Fri Feb 20 00:10:32 2009 From: james.hague@REDACTED (James Hague) Date: Thu, 19 Feb 2009 17:10:32 -0600 Subject: [erlang-questions] writing a delay loop without now() In-Reply-To: <200902192006.n1JK6GkE052555@pluto.hedeland.org> References: <200902192006.n1JK6GkE052555@pluto.hedeland.org> Message-ID: Well, I didn't really mean to get into criticizing the design decisions behind now/0. Let me rewind a bit. I have a graphical application that runs at a fixed frame rate (60 frames per second). The processing takes up part of the frame, then I need to make sure that roughly 16,667 microseconds have passed before displaying the next frame. os:sleep() is VERY coarse and inconsistent across platforms. On some platforms os:sleep(1) is the same as sleep:(32000). Using a timeout value with receive gives the same results (that's actually how os:sleep is implemented). erlang:statistics(wall_clock) is just as coarse. So get around this, I resorted to just spinning in a tight loop using now/0 and timer:now_diff/2. But now/0 isn't designed to be used like this, because it always returns increasing values. This would have been so easy on an 8-bit system from 25 years ago, so surely there's a way to get raw microsecond time values in Erlang? From ok@REDACTED Fri Feb 20 00:15:20 2009 From: ok@REDACTED (Richard O'Keefe) Date: Fri, 20 Feb 2009 12:15:20 +1300 Subject: [erlang-questions] abstract patterns vs macros was:( Floating guard sequences) In-Reply-To: <3E9FE23F-EA09-417A-8054-85135F4B6C71@fess.org> References: <20090217221350.GA6592@herbie> <2BE36673-CDE2-405D-8336-FE45304A16FE@cs.otago.ac.nz> <3E9FE23F-EA09-417A-8054-85135F4B6C71@fess.org> Message-ID: On 20 Feb 2009, at 7:53 am, fess wrote: > I'm sure I can learn something by asking, why not just do this with > macros? Well, you could start by reading the paper. One of the things abstract patterns were invented for is to replace most uses of the preprocessor. They can, for example, be syntax checked at the point of *definition*, whereas macros can only be syntax checked at the point of *use*. There are no problems with variable name capture. Now that -type and -spec exist, they could be given types. As things with run-time semantics, they could be imported and exported just like functions (in fact they would -be- functions of a rather limited kind). They are bidirectional even in the presence of type tests. As things with run-time semantics, inlining is one of many compilation strategies, and they could be traced, profiled, and debugged. Right now, of course, macros are the closest approximation to abstract patterns that are available. > From abhay@REDACTED Fri Feb 20 00:39:14 2009 From: abhay@REDACTED (Abhay Kumar) Date: Thu, 19 Feb 2009 15:39:14 -0800 Subject: [erlang-questions] startups using Erlang In-Reply-To: References: <8D7FE22F-5637-433D-8C9D-93C127F6E8B3@gmail.com> Message-ID: <0B77D679-881B-4E5E-883C-3B1D81A3F27B@opensynapse.net> Since Rupture was bought by EA and Powerset (my company) was purchased by Microsoft, you can probably categorize them as operating units of larger companies and not really start-ups any more. You can also say, because of these acquisitions, that EA and Microsoft use Erlang (for your other list). Abhay On Feb 19, 2009, at 9:51 AM, Hasan Veldstra wrote: > > thank you, everyone, for your replies. > > if anyone thinks of any more startups/companies, please post a note > to this thread or email me directly. > > /Hasan > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From ok@REDACTED Fri Feb 20 00:53:52 2009 From: ok@REDACTED (Richard O'Keefe) Date: Fri, 20 Feb 2009 12:53:52 +1300 Subject: [erlang-questions] Floating guard sequences In-Reply-To: <22108890.post@talk.nabble.com> References: <20090217221350.GA6592@herbie> <253769ca0264fd053564dd3660b86320.squirrel@www.geekisp.com> <22108890.post@talk.nabble.com> Message-ID: On 20 Feb 2009, at 9:22 am, Zvi wrote: > > > fess-3 wrote: >> >> ... >> floating guards on the LHS of a match seem like they could make >> code much more concise and readable, and erlang-like [ to me ] >> >> >> { X when is_integer(X), [ "x" | Rest ] } = string:to_integer(Str), >> { Y when is_integer(Y), _ } = string:to_integer(Rest), >> > > much more readable, if we can marry patterns with guards: > > { X = int(), [ "x" | Rest ] } = string:to_integer(Str), > { Y = int(), _ } = string:to_integer(Rest), > > where int() is patten matching any integer value. int() would be a function call, which doesn't make much sense in a guard. This is a rather interesting example, because - string:to_integer/1 and string:to_float/1 ARE in the on-line documentation - they ARE accepted by 'erl' - but they are NOT in lib/stdlib/src/string.erl They both return either {Number,Tail} or {error,Cause}. I have to say that this interface is brain-dead. When a function can return one of several outcomes, it should be possible to tell one from another by a simple pattern match. A *good* result would be {ok,Number,Tail} or {error,Cause} The solution is not to bloat the pattern sublanguage beyond all recognition, but to fix the broken interface. better_to_integer(String) -> case string:to_integer(String) of {error,Cause} -> {error,Cause} ; {Number,Tail} -> {ok, Number,Tail} end. better_to_float(String) -> case string:to_float(String) of {error,Cause} -> {error,Cause} ; {Number,Tail} -> {ok,Number,Tail} end. and then to write a plain {ok,X,[$x|Rest]} = better_to_integer(Str), {ok,Y,_ } = better_to_integer(Rest) Testing whether X or Y is an integer ASKS THE WRONG QUESTION. A better question is "is this not the atom 'error'"? But the best question is the one we really want: "is this conversion ok?" And fixing the interface lets us ask very simply what we really mean. There's a common pattern I'm seeing in discussions like this. There is some ugly code, but people accept the *cause* of the ugliness and just want to put a glossy coat of paint over the *symptoms*. It's a basic principle of good data structure design in Prolog, which has carried over without change to Erlang, that when a data structure could be one of several alternatives, you should be able to recognise each of the alternatives with a single *positive* pattern match. (That is, nothing should be recognised by virtue of not being something else.) When I reimplemented the internal data structures of the Quintus Prolog compiler to follow this principle, not only was the code easier to read, the compiler ran 20% faster. > Or, if X and Y unused, like in the example above: > > { int(), [ "x" | Rest ] } = string:to_integer(Str), > { int(), _ } = string:to_integer(Rest), It's *still* better to write {ok,_,[$x|Rest]} = better_to_integer(Str), {ok,_,_ } = better_to_integer(Rest) By the way, the pattern ["x"|Rest] should be [$x|Rest] as I have it, or "x"++Rest. From tony@REDACTED Fri Feb 20 01:19:21 2009 From: tony@REDACTED (Tony Arcieri) Date: Thu, 19 Feb 2009 17:19:21 -0700 Subject: [erlang-questions] startups using Erlang In-Reply-To: References: <8D7FE22F-5637-433D-8C9D-93C127F6E8B3@gmail.com> Message-ID: On Thu, Feb 19, 2009 at 10:51 AM, Hasan Veldstra wrote: > > thank you, everyone, for your replies. > > if anyone thinks of any more startups/companies, please post a note > to this thread or email me directly. > Haven't seen this listed yet: http://slideaware.net Looks like they've since taken down their public facing web site though -- Tony Arcieri medioh.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrad-direct-erlang@REDACTED Fri Feb 20 01:22:51 2009 From: mrad-direct-erlang@REDACTED (Michael Radford) Date: Thu, 19 Feb 2009 16:22:51 -0800 Subject: [erlang-questions] Floating guard sequences In-Reply-To: <22108890.post@talk.nabble.com> References: <20090217221350.GA6592@herbie> <253769ca0264fd053564dd3660b86320.squirrel@www.geekisp.com> <22108890.post@talk.nabble.com> Message-ID: <20090220002251.GA9773@herbie> Zvi writes: > much more readable, if we can marry patterns with guards: > > { X = int(), [ "x" | Rest ] } = string:to_integer(Str), > { Y = int(), _ } = string:to_integer(Rest), > > where int() is patten matching any integer value. Yes, it would be wonderful if the pattern syntax treated all the primitive types equally. It's a bit weird that tuples and lists can be recognized by patterns, but everything else needs a guard. (For the record, my proposal was not meant to say "here's my ideal syntax," but rather to say "here's a compatible and relatively minimal change that would allow patterns to contain what we currently need separate guards to achieve.") I think you'd need some other character to distinguish these primitive type patterns from normal function calls, maybe something like: { X = :integer(), _ } = ... { Y = :integer(0, 255), _ } = ... { Z = :function(2), _ } = ... (It does seem nice to make them as close to the is_XXX guards and edoc spec notation as possible.) Mike From nym-erlang-q@REDACTED Fri Feb 20 01:44:35 2009 From: nym-erlang-q@REDACTED (Anthony Molinaro) Date: Thu, 19 Feb 2009 16:44:35 -0800 Subject: [erlang-questions] abstract patterns vs macros was:( Floating guard sequences) In-Reply-To: References: <20090217221350.GA6592@herbie> <2BE36673-CDE2-405D-8336-FE45304A16FE@cs.otago.ac.nz> <3E9FE23F-EA09-417A-8054-85135F4B6C71@fess.org> Message-ID: <20090220004435.GR26906@n54.com> On Fri, Feb 20, 2009 at 12:15:20PM +1300, Richard O'Keefe wrote: > > On 20 Feb 2009, at 7:53 am, fess wrote: > > I'm sure I can learn something by asking, why not just do this with > > macros? > > Well, you could start by reading the paper. I went looking for said paper and it's extremely hard to find. After hunting on google for 10 minutes with keywords like "abstract patterns", "abstract patterns erlang", "abstract patterns o'keefe", I eventually found 2 other papers which reference "Abstract Patterns for Erlang" by Richard O'Keefe, so that must be it, right? Well another google search returns 3 results http://www.google.com/search?q=%22Abstract+Patterns+for+Erlang%22&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a None of which are the paper. However the 3rd link eventually leads to http://www.erlang.org/ml-archive/erlang-questions/200309/msg00309.html Which includes a paper with the title "Pattern Abstraction" apparently by Richard O'Keefe. So maybe that's the so called paper, or maybe there is another one out there? -Anthony -- ------------------------------------------------------------------------ Anthony Molinaro From per@REDACTED Fri Feb 20 01:46:49 2009 From: per@REDACTED (Per Hedeland) Date: Fri, 20 Feb 2009 01:46:49 +0100 (CET) Subject: [erlang-questions] writing a delay loop without now() In-Reply-To: Message-ID: <200902200046.n1K0knHm059215@pluto.hedeland.org> James Hague wrote: > >I have a graphical application that runs at a fixed frame rate (60 >frames per second). The processing takes up part of the frame, then I >need to make sure that roughly 16,667 microseconds have passed before milliseconds, right? >displaying the next frame. os:sleep() is VERY coarse and inconsistent >across platforms. On some platforms os:sleep(1) is the same as >sleep:(32000). Using a timeout value with receive gives the same >results (that's actually how os:sleep is implemented). Yep, they depend on the OS system timer interrupt interval. >erlang:statistics(wall_clock) is just as coarse. That seems very strange though - at least I get the millisecond resolution that is the best you can possibly get given the definition. It is basically just rounded numbers from gettimeofday(). Of course there may be platforms that even to this day provide no better than multi-millisecond resolution in gettimeofday() or the equivalent - I tested on FreeBSD and Linux, as usual I have no idea about Windows. But obviously you can't get microseconds from it. >So get around this, I resorted to just spinning in a tight loop using >now/0 and timer:now_diff/2. But now/0 isn't designed to be used like >this, because it always returns increasing values. But per my previous message, that should only happen if you manage to call it more than once per microsecond - unless gettimeofday() returns bizarre numbers. With a minimal loop tc1(0) -> ok; tc1(N) -> now(), tc1(N-1). I manage to get just above 2 microseconds per call, and perfect agreement between timer:tc/3 (which uses now/0 of course) and pre/post statistics(wall_clock) calls (on FreeBSD, 3GHz Intel CPU). I.e. no opportunity for artificial microsecond-bumping, and none occurring. If you really manage more than one call per microsecond, consider yourself lucky, but don't call it so often!:-) Or there is something else wrong... >This would have been so easy on an 8-bit system from 25 years ago, so >surely there's a way to get raw microsecond time values in Erlang? Linked-in driver... --Per From vychodil.hynek@REDACTED Fri Feb 20 02:06:11 2009 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Fri, 20 Feb 2009 02:06:11 +0100 Subject: [erlang-questions] Floating guard sequences In-Reply-To: References: <20090217221350.GA6592@herbie> <253769ca0264fd053564dd3660b86320.squirrel@www.geekisp.com> <22108890.post@talk.nabble.com> Message-ID: <4d08db370902191706x427df29dx677d311793071216@mail.gmail.com> +1 Yep On Fri, Feb 20, 2009 at 12:53 AM, Richard O'Keefe wrote: > > On 20 Feb 2009, at 9:22 am, Zvi wrote: > > > > > > fess-3 wrote: > >> > >> ... > >> floating guards on the LHS of a match seem like they could make > >> code much more concise and readable, and erlang-like [ to me ] > >> > >> > >> { X when is_integer(X), [ "x" | Rest ] } = string:to_integer(Str), > >> { Y when is_integer(Y), _ } = string:to_integer(Rest), > >> > > > > much more readable, if we can marry patterns with guards: > > > > { X = int(), [ "x" | Rest ] } = string:to_integer(Str), > > { Y = int(), _ } = string:to_integer(Rest), > > > > where int() is patten matching any integer value. > > int() would be a function call, which doesn't make much sense > in a guard. > > This is a rather interesting example, because > - string:to_integer/1 and string:to_float/1 > ARE in the on-line documentation > - they ARE accepted by 'erl' > - but they are NOT in lib/stdlib/src/string.erl > They both return either {Number,Tail} or {error,Cause}. > > I have to say that this interface is brain-dead. > When a function can return one of several outcomes, > it should be possible to tell one from another by a simple > pattern match. A *good* result would be > {ok,Number,Tail} > or {error,Cause} > > The solution is not to bloat the pattern sublanguage beyond > all recognition, but to fix the broken interface. > > better_to_integer(String) -> > case string:to_integer(String) > of {error,Cause} -> {error,Cause} > ; {Number,Tail} -> {ok, Number,Tail} > end. > > better_to_float(String) -> > case string:to_float(String) > of {error,Cause} -> {error,Cause} > ; {Number,Tail} -> {ok,Number,Tail} > end. > > and then to write a plain > > {ok,X,[$x|Rest]} = better_to_integer(Str), > {ok,Y,_ } = better_to_integer(Rest) > > Testing whether X or Y is an integer ASKS THE WRONG QUESTION. > A better question is "is this not the atom 'error'"? > But the best question is the one we really want: "is this > conversion ok?" And fixing the interface lets us ask very > simply what we really mean. > > There's a common pattern I'm seeing in discussions like this. > There is some ugly code, but people accept the *cause* of the > ugliness and just want to put a glossy coat of paint over > the *symptoms*. > > It's a basic principle of good data structure design in Prolog, > which has carried over without change to Erlang, that when a > data structure could be one of several alternatives, you > should be able to recognise each of the alternatives with a > single *positive* pattern match. (That is, nothing should > be recognised by virtue of not being something else.) When I > reimplemented the internal data structures of the Quintus > Prolog compiler to follow this principle, not only was the > code easier to read, the compiler ran 20% faster. > > > Or, if X and Y unused, like in the example above: > > > > { int(), [ "x" | Rest ] } = string:to_integer(Str), > > { int(), _ } = string:to_integer(Rest), > > It's *still* better to write > > {ok,_,[$x|Rest]} = better_to_integer(Str), > {ok,_,_ } = better_to_integer(Rest) > > By the way, the pattern ["x"|Rest] should be > [$x|Rest] as I have it, or "x"++Rest. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try Good Data now for free: www.gooddata.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From fess-erlang@REDACTED Fri Feb 20 02:31:00 2009 From: fess-erlang@REDACTED (fess) Date: Thu, 19 Feb 2009 17:31:00 -0800 Subject: [erlang-questions] Floating guard sequences In-Reply-To: References: <20090217221350.GA6592@herbie> <253769ca0264fd053564dd3660b86320.squirrel@www.geekisp.com> <22108890.post@talk.nabble.com> Message-ID: On Feb 19, 2009, at 3:53 PM, Richard O'Keefe wrote: > and then to write a plain > > {ok,X,[$x|Rest]} = better_to_integer(Str), > {ok,Y,_ } = better_to_integer(Rest) > > Testing whether X or Y is an integer ASKS THE WRONG QUESTION. > A better question is "is this not the atom 'error'"? > But the best question is the one we really want: "is this > conversion ok?" And fixing the interface lets us ask very > simply what we really mean. This makes a lot of sense. and I think I should have added better_to_integer instead of using case clauses. Even with floating guards I think that the simpler match off of a better_to_integer is more clear. [ clarity always being subjective.. :) ] However this case made me realize that pattern matching in the '=' had less power than in a case clause or a function clause where the guards were possible. So that more balanced approach is what seemed interesting to me about Michael's proposal. For the function/case clauses where I've used macros for common pattern matches where i'd like guards but can't have them at the same time. I see how that is addressed better by the abstract patterns, so I'd vote for something like that too. --fess From ok@REDACTED Fri Feb 20 04:39:36 2009 From: ok@REDACTED (Richard O'Keefe) Date: Fri, 20 Feb 2009 16:39:36 +1300 Subject: [erlang-questions] Floating guard sequences In-Reply-To: References: <20090217221350.GA6592@herbie> <253769ca0264fd053564dd3660b86320.squirrel@www.geekisp.com> <22108890.post@talk.nabble.com> Message-ID: <985D6347-05D5-4EFB-8CCA-6226EA928FF9@cs.otago.ac.nz> On 20 Feb 2009, at 2:31 pm, fess wrote: > However this case made me realize that pattern matching in the '=' > had less power than in a case clause or a function clause where the > guards were possible. So that more balanced approach is what seemed > interesting to me about Michael's proposal. Trying to optimise several objectives at once is always tricky. Surely uniformity and expressiveness are virtues. But readability is also a virtue. At the moment, my perspective on this is that of someone who wants to _read_ Erlang code. From that perspective, the most important thing about an '=' binding is that it gives values to some variables. I need to *see* those variables. Anything that makes it harder for me to see those variables hurts. It's sometimes overlooked that 'if' doesn't need more than one clause. So we can always write {X,[$x|Rest]} = string:to_integer(Str), if is_integer(X) -> true end, {Y,_ } = string:to_integer(Rest) So it's not as if (Pattern when Guard) = Expression added any power to the language; it can always be rewritten as Pattern = Expression, if Guard -> true end and we can clarify that a little bit with a macro: -define(check(X), if X -> true end). then Pattern = Expression, ?check(Guard) This I can read. I see clearly in one place what variables are bound, with no distractions. I see clearly in another place what conditions they must satisfy. Separating ?check from = means that it is now very easily thinkable to use ?check in situation where there is no = . If I were opposed to changes to Erlang on principle, I would not have written as many EEPs as I have. But Erlang has notational resources already that are not getting as much use as they should. that From mrad-direct-erlang@REDACTED Fri Feb 20 07:59:20 2009 From: mrad-direct-erlang@REDACTED (Michael Radford) Date: Thu, 19 Feb 2009 22:59:20 -0800 Subject: [erlang-questions] Floating guard sequences In-Reply-To: <985D6347-05D5-4EFB-8CCA-6226EA928FF9@cs.otago.ac.nz> References: <20090217221350.GA6592@herbie> <253769ca0264fd053564dd3660b86320.squirrel@www.geekisp.com> <22108890.post@talk.nabble.com> <985D6347-05D5-4EFB-8CCA-6226EA928FF9@cs.otago.ac.nz> Message-ID: <20090220065920.GA2258@herbie> Richard O'Keefe writes: > It's sometimes overlooked that 'if' doesn't need more than one > clause. So we can always write > > {X,[$x|Rest]} = string:to_integer(Str), > if is_integer(X) -> true end, > {Y,_ } = string:to_integer(Rest) Of course this is a matter of taste, but I would tend to write the second line as true = is_integer(X), which emphasizes its nature as an assertion. (I really do write lines like that on a fairly regular basis, esp. in test code.) Unfortunately the most helpful error message, when the assertion fails, would be given by case X of _ when is_integer(X) -> ok end, but that's ugly enough that one would be tempted to hide it with a macro. Mike From r.b.lists@REDACTED Fri Feb 20 08:49:46 2009 From: r.b.lists@REDACTED (Roland Braito) Date: Fri, 20 Feb 2009 08:49:46 +0100 Subject: [erlang-questions] erlang as antlr target ? Message-ID: <20090220074946.232120@gmx.net> Hello everyone, I recently started using antlr to generate some text, and I'd love to have antlr generate lexer/parser code in erlang. Does anybody have, or is working on, an erlang target for antlr? Thanks and best regards, Roland -- Psssst! Schon vom neuen GMX MultiMessenger geh?rt? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01 From raimo+erlang-questions@REDACTED Fri Feb 20 09:32:45 2009 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Fri, 20 Feb 2009 09:32:45 +0100 Subject: [erlang-questions] : abstract patterns vs macros was:( Floating guard sequences) In-Reply-To: <20090220004435.GR26906@n54.com> References: <20090217221350.GA6592@herbie> <2BE36673-CDE2-405D-8336-FE45304A16FE@cs.otago.ac.nz> <3E9FE23F-EA09-417A-8054-85135F4B6C71@fess.org> <20090220004435.GR26906@n54.com> Message-ID: <20090220083245.GA29395@erix.ericsson.se> On Thu, Feb 19, 2009 at 04:44:35PM -0800, Anthony Molinaro wrote: > > On Fri, Feb 20, 2009 at 12:15:20PM +1300, Richard O'Keefe wrote: > > > > On 20 Feb 2009, at 7:53 am, fess wrote: > > > I'm sure I can learn something by asking, why not just do this with > > > macros? > > > > Well, you could start by reading the paper. > > I went looking for said paper and it's extremely hard to find. > After hunting on google for 10 minutes with keywords like "abstract patterns", > "abstract patterns erlang", "abstract patterns o'keefe", I eventually > found 2 other papers which reference "Abstract Patterns for Erlang" > by Richard O'Keefe, so that must be it, right? Well another google > search returns 3 results > > http://www.google.com/search?q=%22Abstract+Patterns+for+Erlang%22&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a > > None of which are the paper. However the 3rd link eventually leads to > > http://www.erlang.org/ml-archive/erlang-questions/200309/msg00309.html > > Which includes a paper with the title "Pattern Abstraction" apparently > by Richard O'Keefe. That should be it. You can find it from: http://www.erlang.org/faq/faq.html section 10.14. There you also find a link to Joe Armstrong's struct suggestion. > > So maybe that's the so called paper, or maybe there is another one out > there? I sincerely hope if this paper you found is wrong, someone will yell, because I also had a hard time finding it. > > -Anthony > > -- > ------------------------------------------------------------------------ > Anthony Molinaro > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From erlang@REDACTED Fri Feb 20 09:35:04 2009 From: erlang@REDACTED (Dominic Williams) Date: Fri, 20 Feb 2009 03:35:04 -0500 (EST) Subject: [erlang-questions] writing a delay loop without now() In-Reply-To: References: <200902192006.n1JK6GkE052555@pluto.hedeland.org> Message-ID: <0afb81a81c0946862712c2d5f49b1cb8.squirrel@www.geekisp.com> Hi James, > I have a graphical application that runs at a fixed frame > rate (60 frames per second). The processing takes up part > of the frame, then I need to make sure that roughly 16,667 > microseconds have passed before displaying the next frame. > os:sleep() is VERY coarse and inconsistent across > platforms. On some platforms os:sleep(1) is the same as > sleep:(32000). Using a timeout value with receive gives > the same results (that's actually how os:sleep is > implemented). erlang:statistics(wall_clock) is just as > coarse. I may not have had quite such stringent realtime requirements as you, but I've achieved this sort of thing by: - calculating time left to the start of next frame - using timer:send_after/2 to send myself a special message at start of next frame - going into a blocking receive of the special message Two variants of this are: - using a separate process that produces the "start of frame" messages, using the same principle - using timer:send_interval/2, which amounts to using OTP's built-in separate process that produces regular messages. Have you tried such approaches? Best regards, Dominic Williams http://dominicwilliams.net From jan@REDACTED Fri Feb 20 09:57:28 2009 From: jan@REDACTED (Jan Lehnardt) Date: Fri, 20 Feb 2009 09:57:28 +0100 Subject: [erlang-questions] License Clarification about EUnit in OTP needed In-Reply-To: <47679224-E98A-4E1A-B405-9955E2C60B35@opensynapse.net> References: <47679224-E98A-4E1A-B405-9955E2C60B35@opensynapse.net> Message-ID: <38AD0628-B3A1-4B3C-BF3C-83F74D8BCD5C@apache.org> On 19 Feb 2009, at 22:40, Abhay Kumar wrote: > i tried to bring this up a little while ago but haven't heard back > about it yet (http://erlang.org/pipermail/erlang-questions/2008-December/040313.html > ). That tweet from Micka?l is promising. I've since talked to Richard C. and he confirmed my reading of the signs that EUnit is shipped with OTP under LGPL. > In the meantime you could also consider etap (http://github.com/ngerakines/etap > ) which I believe is released under the MIT license. We are indeed looking at etap, but we'd rather go for something that we can rely on as part of the standard OTP distribution. Cheers Jan -- > > > - abhay > > On Feb 16, 2009, at 5:37 AM, Jan Lehnardt wrote: > >> Hi, >> >> if this is not the right place to ask, please let me know. >> The OTP team is reading here, so I think it's good to >> make this a public discussion :) >> >> The CouchDB team is looking at adopting EUnit for >> unit testing. Since EUnit is now shipped with OTP since >> R12B-5, we're happy to adopt it. Since we are with >> the ASF there are some licensing restrictions we need >> to take care of. The easiest for us is if we could treat EUnit >> as yet another standard OTP library released under the >> EPL license. >> >> The R12B-5 source still includes all LGPL boilerplate >> and the COPYING file. We understand that this means >> that while EUnit ships with OTP, the license remains >> LGPL. >> >> Now this discussion took place earlier today: >> >> http://twitter.com/janl/status/1214902936 >> http://twitter.com/mickael/status/1215085264 >> http://twitter.com/janl/status/1215153939 >> >> We're wondering if the LGPL mentions in the source are >> mere leftovers or if they are still valid. >> >> In any case, it would be nice to see a definite and >> public statement about this that we can link and refer >> to in the future. Both readings of the license-possibility >> came up in our thread and I am sure we're not the >> only ones. >> >> Cheers >> Jan >> -- >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > From exta7@REDACTED Fri Feb 20 12:01:02 2009 From: exta7@REDACTED (Zvi) Date: Fri, 20 Feb 2009 03:01:02 -0800 (PST) Subject: [erlang-questions] : abstract patterns vs macros was:( Floating guard sequences) In-Reply-To: <20090220083245.GA29395@erix.ericsson.se> References: <20090217221350.GA6592@herbie> <2BE36673-CDE2-405D-8336-FE45304A16FE@cs.otago.ac.nz> <3E9FE23F-EA09-417A-8054-85135F4B6C71@fess.org> <20090220004435.GR26906@n54.com> <20090220083245.GA29395@erix.ericsson.se> Message-ID: <22118636.post@talk.nabble.com> I like Abstract Patterns, I think they make patterns more like first-class citizens and make ADTs implementation easier. There several comments, which I'll write later. For now, I just trying to write simple abstract pattern for inclusive range of integers: #range(N,M) when is_integer(X) -> N= is_integer(X), N= > On Thu, Feb 19, 2009 at 04:44:35PM -0800, Anthony Molinaro wrote: >> >> On Fri, Feb 20, 2009 at 12:15:20PM +1300, Richard O'Keefe wrote: >> > >> > On 20 Feb 2009, at 7:53 am, fess wrote: >> > > I'm sure I can learn something by asking, why not just do this with >> > > macros? >> > >> > Well, you could start by reading the paper. >> >> I went looking for said paper and it's extremely hard to find. >> After hunting on google for 10 minutes with keywords like "abstract >> patterns", >> "abstract patterns erlang", "abstract patterns o'keefe", I eventually >> found 2 other papers which reference "Abstract Patterns for Erlang" >> by Richard O'Keefe, so that must be it, right? Well another google >> search returns 3 results >> >> http://www.google.com/search?q=%22Abstract+Patterns+for+Erlang%22&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a >> >> None of which are the paper. However the 3rd link eventually leads to >> >> http://www.erlang.org/ml-archive/erlang-questions/200309/msg00309.html >> >> Which includes a paper with the title "Pattern Abstraction" apparently >> by Richard O'Keefe. > > That should be it. You can find it from: > http://www.erlang.org/faq/faq.html section 10.14. > There you also find a link to Joe Armstrong's struct suggestion. > >> >> So maybe that's the so called paper, or maybe there is another one out >> there? > > I sincerely hope if this paper you found is wrong, someone will yell, > because I also had a hard time finding it. > >> >> -Anthony >> >> -- >> ------------------------------------------------------------------------ >> Anthony Molinaro >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- View this message in context: http://www.nabble.com/Floating-guard-sequences-tp22067566p22118636.html Sent from the Erlang Questions mailing list archive at Nabble.com. From richardc@REDACTED Fri Feb 20 12:36:56 2009 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 20 Feb 2009 12:36:56 +0100 Subject: [erlang-questions] License Clarification about EUnit in OTP needed In-Reply-To: <38AD0628-B3A1-4B3C-BF3C-83F74D8BCD5C@apache.org> References: <47679224-E98A-4E1A-B405-9955E2C60B35@opensynapse.net> <38AD0628-B3A1-4B3C-BF3C-83F74D8BCD5C@apache.org> Message-ID: <499E95D8.3030502@it.uu.se> Jan Lehnardt wrote: > On 19 Feb 2009, at 22:40, Abhay Kumar wrote: > >> i tried to bring this up a little while ago but haven't heard back >> about it yet (http://erlang.org/pipermail/erlang-questions/2008-December/040313.html >> ). That tweet from Micka?l is promising. > > I've since talked to Richard C. and he confirmed my reading > of the signs that EUnit is shipped with OTP under LGPL. I tend to prefer copyleft-licenses for my work, but as I see that there are some valid issues with using LGPL for things in the standard distribution, I have been discussing the matter with the OTP folks. Some kind of change may be underway. The EPL, meanwhile, is simply not usable for anyone except Ericsson (or if you wish to hand over all rights to Ericsson), at least the way I read it. Plain MPL 1.1 would work as a substitute for EPL, but I think I'd rather use the Apache License 2.0. Does anyone know about any problems with either of those? /Richard From james.hague@REDACTED Fri Feb 20 15:22:43 2009 From: james.hague@REDACTED (James Hague) Date: Fri, 20 Feb 2009 08:22:43 -0600 Subject: [erlang-questions] writing a delay loop without now() In-Reply-To: <200902200046.n1K0knHm059215@pluto.hedeland.org> References: <200902200046.n1K0knHm059215@pluto.hedeland.org> Message-ID: >>I have a graphical application that runs at a fixed frame rate (60 >>frames per second). The processing takes up part of the frame, then I >>need to make sure that roughly 16,667 microseconds have passed before > > milliseconds, right? No, microseconds. It's more or less 16 milliseconds between updates. I could live with good millisecond accuracy. I'm still investigating alternatives. My code communicates with an external graphical client, and I could roll the timing into the client easily enough (just block if updates are coming closet than 16ms apart). If that doesn't work I'll look at writing a linked-in driver (which I've done before, and sure doesn't excite me...). >But per my previous message, that should only happen if you manage to >call it more than once per microsecond - unless gettimeofday() returns >bizarre numbers. On my MacBook, using a now/0 loop for a delay runs about 25% faster than it should, so I'm clearly getting more than one call in per microsecond, at least sometimes. From jeedward@REDACTED Fri Feb 20 15:12:56 2009 From: jeedward@REDACTED (John Edward) Date: Fri, 20 Feb 2009 06:12:56 -0800 (PST) Subject: [erlang-questions] Paper submission deadline extended: MULTICONF-09 Message-ID: <501210.3187.qm@web45910.mail.sp1.yahoo.com> ? Paper submission deadline extended: MULTICONF-09 ? The deadline for draft paper submission at the 2009 Multi Conference in Computer Science, Information Technology and Control systems and Computational Science and Computer Engineering (MULTICONF-09) (website: http://www.PromoteResearch.org) is extended due to numerous requests from the authors. The conference will be held during July 13-16 2009 in Orlando, FL, USA. We invite draft paper submissions. The event consists of the following conferences: ????????? International Conference on Artificial Intelligence and Pattern Recognition (AIPR-09) ????????? International Conference on Automation, Robotics and Control Systems (ARCS-09) ????????? International Conference on Bioinformatics, Computational Biology, Genomics and Chemoinformatics (BCBGC-09) ????????? International Conference on Enterprise Information Systems and Web Technologies (EISWT-09) ????????? International Conference on High Performance Computing, Networking and Communication Systems (HPCNCS-09) ????????? International Conference on Information Security and Privacy (ISP-09) ????????? International Conference on Recent Advances in Information Technology and Applications (RAITA-09) ????????? International Conference on Software Engineering Theory and Practice (SETP-09) ????????? International Conference on Theory and Applications of Computational Science (TACS-09) ????????? International Conference on Theoretical and Mathematical Foundations of Computer Science (TMFCS-09) ? The website http://www.PromoteResearch.org? contains more details. ? Sincerely John Edward Publicity committee -------------- next part -------------- An HTML attachment was scrubbed... URL: From tsuraan@REDACTED Fri Feb 20 16:30:28 2009 From: tsuraan@REDACTED (tsuraan) Date: Fri, 20 Feb 2009 09:30:28 -0600 Subject: [erlang-questions] Tuple memory size Message-ID: <84fb38e30902200730v5d438db7y6167152f74c61dd1@mail.gmail.com> In memory, is a tuple an array of pointers, or are the tuple and its contents actually stored contiguously? In other words, if you have a tuple that contains dozens of other tuples that contain integers, will changing an element of the top-level tuple require a deep copy, or will it just make a new tuple that points at mostly the same objects as the old one? I would assume that the tuple is an array of pointers, but the efficiency guide says the size of a tuple is 2 words + the total sizes of each stored element. That would imply that they are actually stored contiguously; if it were pointers, the size should be 2 words + 1 word per element of the tuple, I would think. From cliff@REDACTED Fri Feb 20 18:23:13 2009 From: cliff@REDACTED (Cliff Moon) Date: Fri, 20 Feb 2009 09:23:13 -0800 Subject: [erlang-questions] how message size effects performance Message-ID: <499EE701.7010804@moonpolysoft.com> Does anyone have or know of a good breakdown of how message size affects performance, particularly remote messages? I've heard conflicting reports from people about how the Erlang VM deals with messages that have a high byte count (large binaries, etc). Some people say that the VM will handle large messages cleanly and in a performant manner, while others have told me that large messages tend to degrade the performance of the entire VM. I could run benchmarks, but to save me the time does anyone have any sort of data on this? From mikpe@REDACTED Fri Feb 20 20:31:55 2009 From: mikpe@REDACTED (Mikael Pettersson) Date: Fri, 20 Feb 2009 20:31:55 +0100 Subject: [erlang-questions] Tuple memory size In-Reply-To: <84fb38e30902200730v5d438db7y6167152f74c61dd1@mail.gmail.com> References: <84fb38e30902200730v5d438db7y6167152f74c61dd1@mail.gmail.com> Message-ID: <18847.1323.673784.571359@harpo.it.uu.se> tsuraan writes: > In memory, is a tuple an array of pointers, or are the tuple and its > contents actually stored contiguously? A tuple is an array of "term handles", which in turn can either contain pointers to terms allocated elsewhere in memory (boxed), or contain certain smallish terms (mainly small integers, atoms, and the empty list) directly (immediates). The low bits of the handle determine its interpretation. > In other words, if you have a > tuple that contains dozens of other tuples that contain integers, will > changing an element of the top-level tuple require a deep copy, or > will it just make a new tuple that points at mostly the same objects > as the old one? The latter. From per@REDACTED Fri Feb 20 22:10:56 2009 From: per@REDACTED (Per Hedeland) Date: Fri, 20 Feb 2009 22:10:56 +0100 (CET) Subject: [erlang-questions] writing a delay loop without now() In-Reply-To: Message-ID: <200902202110.n1KLAurZ086294@pluto.hedeland.org> James Hague wrote: > >>>I have a graphical application that runs at a fixed frame rate (60 >>>frames per second). The processing takes up part of the frame, then I >>>need to make sure that roughly 16,667 microseconds have passed before >> >> milliseconds, right? > >No, microseconds. It's more or less 16 milliseconds between updates. That's what I meant, just had a temporary misconnect between the weird custom of sprinkling commas over integers and the equally weird custom of using a comma for the decimal point. >I could live with good millisecond accuracy. That you should definitely be able to get from statistics(wall_clock) - if you don't, I'll have to say that there is something wrong with your OS/HW and not with Erlang. See snippet below from a tight-loop that gets the result of gettimeofday() via os:cmd() every 10 calls to statistics() (the actual call to statistics() amounts to some 0.2% of the execution time, the rest is os:cmd() and io:format()). >>But per my previous message, that should only happen if you manage to >>call it more than once per microsecond - unless gettimeofday() returns >>bizarre numbers. > >On my MacBook, using a now/0 loop for a delay runs about 25% faster >than it should, so I'm clearly getting more than one call in per >microsecond, at least sometimes. I can't follow that conclusion at all - if you don't know how long a call takes even on average, I can't see how you can deduce it from an assumption that the cause of the problems with your loop logic is microsecond-bumping in now/0 - sounds like circular reasoning to me. On the other hand laptops frequently do things like varying the CPU frequency that can confuse applications that try to measure time. --Per {13536,0} {13536,0} 1235162740.330364 {13549,13} {13549,0} {13549,0} {13549,0} {13550,1} {13550,0} {13550,0} {13550,0} {13550,0} {13550,0} 1235162740.344203 {13563,13} {13563,0} {13563,0} {13563,0} {13563,0} {13563,0} {13563,0} {13564,1} {13564,0} {13564,0} 1235162740.357672 {13577,13} {13577,0} From cktgatb@REDACTED Fri Feb 20 22:23:22 2009 From: cktgatb@REDACTED (deepblue) Date: Fri, 20 Feb 2009 13:23:22 -0800 (PST) Subject: [erlang-questions] erlang as antlr target ? In-Reply-To: <20090220074946.232120@gmx.net> References: <20090220074946.232120@gmx.net> Message-ID: I would love to have this as well! On Feb 20, 2:49?am, "Roland Braito" wrote: > Hello everyone, > > I recently started using antlr to generate some text, and I'd love to have antlr generate lexer/parser code in erlang. > > Does anybody have, or is working on, an erlang target for antlr? > > Thanks and best regards, > Roland > > -- > Psssst! Schon vom neuen GMX MultiMessenger geh?rt? Der kann`s mit allen:http://www.gmx.net/de/go/multimessenger01 > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions From cktgatb@REDACTED Fri Feb 20 22:25:33 2009 From: cktgatb@REDACTED (deepblue) Date: Fri, 20 Feb 2009 13:25:33 -0800 (PST) Subject: [erlang-questions] spawning processes and passing arguments Message-ID: <571202f6-0ea2-4494-9dd6-52601a932101@f4g2000vbf.googlegroups.com> I keep running into this. I want to spawn processes and pass arguments to them without using the MFA form (module/function/arguments), so basically without having to export the function I want to spawn with arguments. I've gotten around this a few times using closures(fun's) and having the arguments just be bound values outside the fun, but its limiting my code structure... I've looked at the docs and spawn only has the regular spawn/1 and the spawn/3 form, nothing else... much appreciated thanks From james.hague@REDACTED Fri Feb 20 22:30:30 2009 From: james.hague@REDACTED (James Hague) Date: Fri, 20 Feb 2009 15:30:30 -0600 Subject: [erlang-questions] writing a delay loop without now() In-Reply-To: <200902202110.n1KLAurZ086294@pluto.hedeland.org> References: <200902202110.n1KLAurZ086294@pluto.hedeland.org> Message-ID: > I can't follow that conclusion at all - if you don't know how long a > call takes even on average, I can't see how you can deduce it from an > assumption that the cause of the problems with your loop logic is > microsecond-bumping in now/0 - sounds like circular reasoning to me. I've verified on two very different machines (different CPUs, different operating systems), that my timing loop based on now() is running faster than wall clock time, even though it's reporting the correct internal elapsed time. That's all I know for sure. From richardc@REDACTED Fri Feb 20 23:07:56 2009 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 20 Feb 2009 23:07:56 +0100 Subject: [erlang-questions] spawning processes and passing arguments In-Reply-To: <571202f6-0ea2-4494-9dd6-52601a932101@f4g2000vbf.googlegroups.com> References: <571202f6-0ea2-4494-9dd6-52601a932101@f4g2000vbf.googlegroups.com> Message-ID: <499F29BC.1040802@it.uu.se> deepblue wrote: > I keep running into this. I want to spawn processes and pass arguments > to them without using the MFA form (module/function/arguments), so > basically without having to export the function I want to spawn with > arguments. I've gotten around this a few times using closures(fun's) > and having the arguments just be bound values outside the fun, but its > limiting my code structure... I've looked at the docs and spawn only > has the regular spawn/1 and the spawn/3 form, nothing else... By "using closures", I hope you mean something like this: Pid = spawn(fun () -> any_function(Any, Number, Of, Arguments) end) How would that be limiting to your code structure? /Richard From per@REDACTED Fri Feb 20 23:26:29 2009 From: per@REDACTED (Per Hedeland) Date: Fri, 20 Feb 2009 23:26:29 +0100 (CET) Subject: [erlang-questions] writing a delay loop without now() In-Reply-To: Message-ID: <200902202226.n1KMQTkH088249@pluto.hedeland.org> James Hague wrote: > >> I can't follow that conclusion at all - if you don't know how long a >> call takes even on average, I can't see how you can deduce it from an >> assumption that the cause of the problems with your loop logic is >> microsecond-bumping in now/0 - sounds like circular reasoning to me. > >I've verified on two very different machines (different CPUs, >different operating systems), that my timing loop based on now() is >running faster than wall clock time, even though it's reporting the >correct internal elapsed time. That's all I know for sure. OK - so are you at all interested in figuring out why, and if possible finding a solution within Erlang? If so, you could start by posting the code to see if others observe the same problem. Maybe also post the code that makes you conclude that statistics(wall_clock) jumps about all over the place. --Per From cktgatb@REDACTED Fri Feb 20 23:52:26 2009 From: cktgatb@REDACTED (deepblue) Date: Fri, 20 Feb 2009 14:52:26 -0800 (PST) Subject: [erlang-questions] spawning processes and passing arguments In-Reply-To: <499F29BC.1040802@it.uu.se> References: <571202f6-0ea2-4494-9dd6-52601a932101@f4g2000vbf.googlegroups.com> <499F29BC.1040802@it.uu.se> Message-ID: <9f27119f-6c89-4355-beb9-dd4139ab2041@f11g2000vbf.googlegroups.com> actually Richard your way solves my problems :) for some reason I was limiting myself to only using the closure as: spawn(any_function(Any, Number, Of, Arguments)) which ofcourse doesnt work so I then did spawn(any_function) and at the place of fun declaration I would have external bound variables that the closure would refer to like so BoundVar1 = 1, BoundVar2 = 2, Fun_toSpawn = fun()->BoundVar1+BoundVar2 end, ... ... lists:forEach( fun(X)-> %and this was limiting me since I needed to use X and couldnt pass it in %except if I declared the fun itself inside this forEach callback which is very innefficient spawn(Fun_toSpawn) end,List). it seems a lot can be done by nesting functions inside very simple fun's and referencing parameters like that thank you very much On Feb 20, 5:07?pm, Richard Carlsson wrote: > deepblue wrote: > > I keep running into this. I want to spawn processes and pass arguments > > to them without using the MFA form (module/function/arguments), so > > basically without having to export the function I want to spawn with > > arguments. I've gotten around this a few times using closures(fun's) > > and having the arguments just be bound values outside the fun, but its > > limiting my code structure... I've looked at the docs and spawn only > > has the regular spawn/1 and the spawn/3 form, nothing else... > > By "using closures", I hope you mean something like this: > > Pid = spawn(fun () -> any_function(Any, Number, Of, Arguments) end) > > How would that be limiting to your code structure? > > ? ? ?/Richard > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions From cktgatb@REDACTED Fri Feb 20 23:55:54 2009 From: cktgatb@REDACTED (deepblue) Date: Fri, 20 Feb 2009 14:55:54 -0800 (PST) Subject: [erlang-questions] spawning processes and passing arguments In-Reply-To: <499F29BC.1040802@it.uu.se> References: <571202f6-0ea2-4494-9dd6-52601a932101@f4g2000vbf.googlegroups.com> <499F29BC.1040802@it.uu.se> Message-ID: <35373f0c-c90e-476e-81ee-2fa58c1657e7@x9g2000yqk.googlegroups.com> actually Richard your way solves my problems :) for some reason I was limiting myself to only using the closure as: spawn(any_function(Any, Number, Of, Arguments)) which ofcourse doesnt work so I then did spawn(any_function) and at the place of fun declaration I would have external bound variables that the closure would refer to like so BoundVar1 = 1, BoundVar2 = 2, Fun_toSpawn = fun()->BoundVar1+BoundVar2 end, ... ... lists:forEach( fun(X)-> %and this was limiting me since I needed to use X and couldnt pass it in %except if I declared the fun itself inside this forEach callback which is very innefficient spawn(Fun_toSpawn) end,List). it seems a lot can be done by nesting functions inside very simple fun's and referencing parameters like that thank you very much On Feb 20, 5:07?pm, Richard Carlsson wrote: > deepblue wrote: > > I keep running into this. I want to spawn processes and pass arguments > > to them without using the MFA form (module/function/arguments), so > > basically without having to export the function I want to spawn with > > arguments. I've gotten around this a few times using closures(fun's) > > and having the arguments just be bound values outside the fun, but its > > limiting my code structure... I've looked at the docs and spawn only > > has the regular spawn/1 and the spawn/3 form, nothing else... > > By "using closures", I hope you mean something like this: > > Pid = spawn(fun () -> any_function(Any, Number, Of, Arguments) end) > > How would that be limiting to your code structure? > > ? ? ?/Richard > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions From james.hague@REDACTED Sat Feb 21 00:16:30 2009 From: james.hague@REDACTED (James Hague) Date: Fri, 20 Feb 2009 17:16:30 -0600 Subject: [erlang-questions] writing a delay loop without now() In-Reply-To: <200902202226.n1KMQTkH088249@pluto.hedeland.org> References: <200902202226.n1KMQTkH088249@pluto.hedeland.org> Message-ID: > OK - so are you at all interested in figuring out why, and if possible > finding a solution within Erlang? If so, you could start by posting the > code to see if others observe the same problem. Maybe also post the code > that makes you conclude that statistics(wall_clock) jumps about all over > the place. Sure, I'd love to work this out. I will put some code together when I get a chance. From james.hague@REDACTED Sat Feb 21 00:43:53 2009 From: james.hague@REDACTED (James Hague) Date: Fri, 20 Feb 2009 17:43:53 -0600 Subject: [erlang-questions] writing a delay loop without now() In-Reply-To: References: <200902202226.n1KMQTkH088249@pluto.hedeland.org> Message-ID: All right, here's a simple case. I hope I'm not doing something dumb here. This is only to illustrate one issue; it's not a full analysis of timing in Erlang. First, try this from the shell: erlang:statistics(wall_clock),timer:sleep(5000),erlang:statistics(wall_clock). I get {57018,5007} which is just about five seconds (the second number is the elapsed time between calls. The parameter to sleep is in MILLIseconds. (Note that if I change 5000 to 1, I get a result of 16 milliseconds elapsed on the machine I'm using at the moment. If I change it to 16, I get a result of 31 milliseconds.) Now here's a little function that uses now/0 and timer:now_diff/2 to wait for a specified number of MICROseconds: -module(test). -compile(export_all). time(N) -> time(N, now()). time(N, Start) -> case timer:now_diff(now(), Start) of M when M >= N -> M; _ -> time(N, Start) end. Now try it from the shell: erlang:statistics(wall_clock),test:time(5000000),erlang:statistics(wall_clock). I get {836723,1310} on the same machine. 1.3 seconds. From fredrik.svahn@REDACTED Sat Feb 21 14:12:12 2009 From: fredrik.svahn@REDACTED (Fredrik Svahn) Date: Sat, 21 Feb 2009 14:12:12 +0100 Subject: [erlang-questions] writing a delay loop without now() In-Reply-To: References: <200902202226.n1KMQTkH088249@pluto.hedeland.org> Message-ID: I do not know if it is helpful or not, but with R12B-5 on an AMD Turion running Arch Linux I consistently get around 5001 milliseconds both with and without hipe. "erl -smp disable" gives the same results. Erlang (BEAM) emulator version 5.6.5 [source] [64-bit] [smp:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.6.5 (abort with ^G) 1> erlang:statistics(wall_clock),test:time(5000000),erlang:statistics(wall_clock). {18066,5001} 2> erlang:statistics(wall_clock),test:time(1000),erlang:statistics(wall_clock). {200733,2} 3> erlang:statistics(wall_clock),test:time(1000),erlang:statistics(wall_clock). {202005,2} 4> erlang:statistics(wall_clock),test:time(1000),erlang:statistics(wall_clock). {203189,2} BR /Fredrik On Sat, Feb 21, 2009 at 12:43 AM, James Hague wrote: > All right, here's a simple case. I hope I'm not doing something dumb > here. This is only to illustrate one issue; it's not a full analysis > of timing in Erlang. > > First, try this from the shell: > > > erlang:statistics(wall_clock),timer:sleep(5000),erlang:statistics(wall_clock). > > I get {57018,5007} which is just about five seconds (the second number > is the elapsed time between calls. The parameter to sleep is in > MILLIseconds. (Note that if I change 5000 to 1, I get a result of 16 > milliseconds elapsed on the machine I'm using at the moment. If I > change it to 16, I get a result of 31 milliseconds.) > > Now here's a little function that uses now/0 and timer:now_diff/2 to > wait for a specified number of MICROseconds: > > -module(test). > -compile(export_all). > > time(N) -> time(N, now()). > time(N, Start) -> > case timer:now_diff(now(), Start) of > M when M >= N -> M; > _ -> time(N, Start) > end. > > Now try it from the shell: > > > erlang:statistics(wall_clock),test:time(5000000),erlang:statistics(wall_clock). > > I get {836723,1310} on the same machine. 1.3 seconds. > _______________________________________________ > 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 Sat Feb 21 15:10:32 2009 From: per@REDACTED (Per Hedeland) Date: Sat, 21 Feb 2009 15:10:32 +0100 (CET) Subject: [erlang-questions] writing a delay loop without now() In-Reply-To: Message-ID: <200902211410.n1LEAWvd009177@pluto.hedeland.org> James Hague wrote: > >First, try this from the shell: > > erlang:statistics(wall_clock),timer:sleep(5000),erlang:statistics(wall_clock). > >I get {57018,5007} which is just about five seconds (the second number >is the elapsed time between calls. The parameter to sleep is in >MILLIseconds. (Note that if I change 5000 to 1, I get a result of 16 >milliseconds elapsed on the machine I'm using at the moment. If I >change it to 16, I get a result of 31 milliseconds.) Right, this demonstrates the dependency of timer:sleep/1 on the OS timer interrupt frequency that we already established - it doesn't demonstrate that there is a problem with statistics(wall_clock), on the contrary it probably reports the exact numbers that demonstrate the timer:sleep/1 dependency. And as we also established, this has nothing to do with Erlang - any way you try to implement "wait for some period of time without busy-looping" will have this issue, including C library functions with fancy names and arguments such as nanosleep(2) (actually the Linux man page says that it busy-waited in certain cases in pre-2.6 kernels - not anymore though). The only way you can improve on this is to increase the OS timer interrupt frequency. FWIW, on stock FreeBSD 7.0 x86 with "Erlang (BEAM) emulator version 5.6.3 [source] [async-threads:0] [hipe] [kernel-poll:false]" I get: erlang:statistics(wall_clock),timer:sleep(1),erlang:statistics(wall_clock). {1218509,3} erlang:statistics(wall_clock),timer:sleep(16),erlang:statistics(wall_clock). {1228419,17} - and basically the same (perhaps slightly better) on stock Fedora Core 5 Linux x86 with the venerable "Erlang (BEAM) emulator version 5.4.13 [source] [hipe]". Both of these systems nominally have a 1000 Hz system clock - interestingly though, on the FreeBSD I get erlang:statistics(wall_clock),timer:sleep(5000),erlang:statistics(wall_clock). {1873951,5048} - i.e. it seems it is playing some tricks to avoid a constant 1000 Hz interrupt rate, and not doing its absolutely best of it. >Now here's a little function that uses now/0 and timer:now_diff/2 to >wait for a specified number of MICROseconds: [snip] >Now try it from the shell: > > erlang:statistics(wall_clock),test:time(5000000),erlang:statistics(wall_clock). > >I get {836723,1310} on the same machine. 1.3 seconds. OK, now it gets interesting - this works exactly as expected for me, on both the abovementioned systems: erlang:statistics(wall_clock),test:time(5000000),erlang:statistics(wall_clock). {3998801,5000} - occasionally the number is 5001, very rarely 5002. Could you try adding a counter to the loop, to see how many now/0 calls you are actually doing: time2(N) -> time2(N, now(), 0). time2(N, Start, C) -> case timer:now_diff(now(), Start) of M when M >= N -> {C, M}; _ -> time2(N, Start, C+1) end. With this I get: erlang:statistics(wall_clock),{test:time2(5000000),erlang:statistics(wall_clock)}. {{1295305,5000001},{241916,5000}} I.e. on the order of one call every 3.9 microseconds => no now/0 bumping occurs (you need to have more than one call per microsecond *on average* for that to have an effect on the total). Also, what version of the Erlang runtime are you using - there could of course be a BUG... --Per From james.hague@REDACTED Sat Feb 21 17:48:23 2009 From: james.hague@REDACTED (James Hague) Date: Sat, 21 Feb 2009 10:48:23 -0600 Subject: [erlang-questions] writing a delay loop without now() In-Reply-To: <200902211410.n1LEAWvd009177@pluto.hedeland.org> References: <200902211410.n1LEAWvd009177@pluto.hedeland.org> Message-ID: > Right, this demonstrates the dependency of timer:sleep/1... > > And as we also established, this has nothing to do with Erlang - Correct. I just provided the numbers for os:sleep(1) and os:sleep(16) for reference. > erlang:statistics(wall_clock),{test:time2(5000000),erlang:statistics(wall_clock)}. > {{1295305,5000001},{241916,5000}} > > I.e. on the order of one call every 3.9 microseconds => no now/0 bumping > occurs (you need to have more than one call per microsecond *on average* > for that to have an effect on the total). I get this: ?{{4999999,5000000},{460636,1451}} This is using a 64-bit version of Window Vista, "Erlang (BEAM) emulator version 5.6.5 [smp:4] [async-threads:0]". I originally noticed this on a MacBook running OS X 10.4 (which is Tiger, not 10.5 Leopard), but I don't have timings yet. I also tried disabling SMP on the Vista box, which gives: {{4999999,5000000},{153026,1247}} From jay@REDACTED Sat Feb 21 18:04:01 2009 From: jay@REDACTED (Jay Nelson) Date: Sat, 21 Feb 2009 09:04:01 -0800 Subject: [erlang-questions] writing a delay loop without now() Message-ID: <26806819-5587-40C0-A1E3-FCF5F9F9CF84@duomark.com> Using an iBook G4 I get: Erlang (BEAM) emulator version 5.6.4 [source] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.6.4 (abort with ^G) 29> erlang:statistics(wall_clock),timer:sleep(1),erlang:statistics (wall_clock). {987019,11} 30> erlang:statistics(wall_clock),timer:sleep(16),erlang:statistics (wall_clock). {991049,17} 33> erlang:statistics(wall_clock),{test:time2 (5000000),erlang:statistics(wall_clock)}. {{4824884,5000000},{1008213,3634}} 34> erlang:statistics(wall_clock),{test:time2 (5000000),erlang:statistics(wall_clock)}. {{4939556,5000000},{1016268,3361}} jay From per.gustafsson@REDACTED Sat Feb 21 18:26:42 2009 From: per.gustafsson@REDACTED (Per Gustafsson) Date: Sat, 21 Feb 2009 18:26:42 +0100 Subject: [erlang-questions] how message size effects performance In-Reply-To: <499EE701.7010804@moonpolysoft.com> References: <499EE701.7010804@moonpolysoft.com> Message-ID: <49A03952.3070902@it.uu.se> Cliff Moon wrote: > Does anyone have or know of a good breakdown of how message size affects > performance, particularly remote messages? I've heard conflicting > reports from people about how the Erlang VM deals with messages that > have a high byte count (large binaries, etc). Some people say that the > VM will handle large messages cleanly and in a performant manner, while > others have told me that large messages tend to degrade the performance > of the entire VM. I could run benchmarks, but to save me the time does > anyone have any sort of data on this? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > All the data in messages are copied except for large binaries (larger than 64 bytes). So sending large messages in which the bulk of the data is not large binaries will lead to poor performance and high memory consumption. Per From kenneth.lundin@REDACTED Sat Feb 21 18:57:37 2009 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Sat, 21 Feb 2009 18:57:37 +0100 Subject: [erlang-questions] Abstract patterns, structs and frames Message-ID: We , the Erlang/OTP team at Ericsson think that abstract patterns, structs and frames are very interesting suggestions which we would like to implement sooner or later. But before we will even consider this we need good quality EEP's for these. The current documentation around these concepts are not complete enough to take a decision on whether to implement them or not. Of course we don't need both structs and frames just one of them. So it is up to you to come up with the EEPs. /Kenneth Erlang/OTP team , Ericsson From vinoski@REDACTED Sat Feb 21 20:16:03 2009 From: vinoski@REDACTED (Steve Vinoski) Date: Sat, 21 Feb 2009 14:16:03 -0500 Subject: [erlang-questions] max fds for epoll incorrectly reduced to FD_SETSIZE Message-ID: <65b2728e0902211116i120c2b18oe29c5c9c9642f8e4@mail.gmail.com> Doing some load testing on Linux a couple days ago, I started getting the "Driver select called with too large ?le descriptor N" error, despite the fact that ulimit -n was 64k and I had passed the "+K true" option to an R12B-5 system built with kernel poll enabled. After staring at the code for awhile, I determined the problem to be the same issue Joel Reymont reported back in August last year: though he was on OS X and I'm on Linux (and I sure wish I would have found that link *before* digging through and independently finding it myself!). Since kernel poll is not on by default, select() is used as the fallback/default, and the following code from the erts_poll_init() function in erts/emulator/sys/common/erl_poll.c limits the max fds to FD_SETSIZE: #if ERTS_POLL_USE_SELECT && defined(FD_SETSIZE) if (max_fds > FD_SETSIZE) max_fds = FD_SETSIZE; #endif The ERTS_POLL_USE_SELECT is true because ERTS_POLL_USE_FALLBACK gets set in erts/emulator/sys/common/erl_poll.h for non-Win32 systems when ERTS_POLL_USE_EPOLL is true: #define ERTS_POLL_USE_FALLBACK (ERTS_POLL_USE_KQUEUE || ERTS_POLL_USE_EPOLL) #if !ERTS_POLL_USE_KERNEL_POLL || ERTS_POLL_USE_FALLBACK # if defined(ERTS_USE_POLL) # undef ERTS_POLL_USE_POLL # define ERTS_POLL_USE_POLL 1 # elif !defined(__WIN32__) # undef ERTS_POLL_USE_SELECT # define ERTS_POLL_USE_SELECT 1 # endif #endif We can't undef FD_SETSIZE to fix this because it's needed for cases where "+K true" isn't passed, and we can't set it to a super-high value because setting FD_SETSIZE beyond 2k doesn't work so well with select(). I believe the proper fix here is to make the erts_poll_init() function check for kernel polling enabled and not limit max_fds to FD_SETSIZE for that case, but I haven't yet come up with a good way to implement that fix -- any hints appreciated. But I agree with Joel that this a bug. --steve From fredrik.svahn@REDACTED Sat Feb 21 22:23:00 2009 From: fredrik.svahn@REDACTED (Fredrik Svahn) Date: Sat, 21 Feb 2009 22:23:00 +0100 Subject: [erlang-questions] writing a delay loop without now() In-Reply-To: References: <200902211410.n1LEAWvd009177@pluto.hedeland.org> Message-ID: I get the same results as James when running R12B-5 on Windows Vista. It seems to be related to the algorithm for adjusting to sudden time changes. When disabling it with the "+c" flag it works (almost) as expected. C:\>"C:\Program Files\erl5.6.5\bin\erl" Eshell V5.6.5 (abort with ^G) 1> erlang:statistics(wall_clock),test:time(5000000),erlang:statistics(wall_clock). {13276,3167} 2> erlang:statistics(wall_clock),test:time(1000000),erlang:statistics(wall_clock). {22184,640} C:\>"C:\Program Files\erl5.6.5\bin\erl" +c Eshell V5.6.5 (abort with ^G) 1> erlang:statistics(wall_clock),test:time(5000000),erlang:statistics(wall_clock). {19500,4992} 2> erlang:statistics(wall_clock),test:time(1000000),erlang:statistics(wall_clock). {27253,998} (With Linux on the same machine I get the expected results no matter if I run with or without the +c flag.) BR /Fredrik On Sat, Feb 21, 2009 at 5:48 PM, James Hague wrote: > > Right, this demonstrates the dependency of timer:sleep/1... > > > > And as we also established, this has nothing to do with Erlang - > > Correct. I just provided the numbers for os:sleep(1) and os:sleep(16) > for reference. > > > > erlang:statistics(wall_clock),{test:time2(5000000),erlang:statistics(wall_clock)}. > > {{1295305,5000001},{241916,5000}} > > > > I.e. on the order of one call every 3.9 microseconds => no now/0 bumping > > occurs (you need to have more than one call per microsecond *on average* > > for that to have an effect on the total). > > I get this: > {{4999999,5000000},{460636,1451}} > > This is using a 64-bit version of Window Vista, "Erlang (BEAM) > emulator version 5.6.5 [smp:4] [async-threads:0]". > > I originally noticed this on a MacBook running OS X 10.4 (which is > Tiger, not 10.5 Leopard), but I don't have timings yet. I also tried > disabling SMP on the Vista box, which gives: > {{4999999,5000000},{153026,1247}} > _______________________________________________ > 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 Sat Feb 21 23:16:44 2009 From: per@REDACTED (Per Hedeland) Date: Sat, 21 Feb 2009 23:16:44 +0100 (CET) Subject: [erlang-questions] writing a delay loop without now() In-Reply-To: Message-ID: <200902212216.n1LMGil3020156@pluto.hedeland.org> James Hague wrote: > >I get this: > {{4999999,5000000},{460636,1451}} > >This is using a 64-bit version of Window Vista, "Erlang (BEAM) >emulator version 5.6.5 [smp:4] [async-threads:0]". Eeew, Windows - according the sources, gettimeofday() is there replaced by GetSystemTime() with SystemTimeToFileTime() applied to the result. I have no idea what those functions actually do (nor what the quality of the resulting numbers is), but it would appear that they finish it in a quarter of a microsecond or so on your box, i.e. now-bumping will kick in. You could try what I suggested a few messages back, "don't call it so often" - i.e. twiddle your thumbs for a while in each loop round, to make sure the now/0 calls are separated by at least a microsecond. The below causes some 3 microseconds of twiddling in my tests on a 3GHz CPU, adjust to taste (weird argument-passing-around to prevent it from being optimized away, may not be necessary). time3(N) -> time3(N, now(), 0, [0]). time3(N, Start, C, X) -> case timer:now_diff(now(), Start) of M when M >= N -> {C, M}; _ -> time3(N, Start, C+1, twiddle(X)) end. twiddle(X) -> [hd(X)|[Y*Y || Y <- lists:duplicate(5, 12345678901234567890123456789)]]. Fredrik Svahn wrote: > >I get the same results as James when running R12B-5 on Windows Vista. It >seems to be related to the algorithm for adjusting to sudden time changes. >When disabling it with the "+c" flag it works (almost) as expected. Hm, this would imply that the numbers that the ersatz gettimeofday() on Windows returns are more or less garbage, no surprise there I guess - or possibly that the algorithm has bad assumptions on how to get "really elapsed time" on Windows [Vista] (great fun was had when it tried to use times() on FreeBSD back when times() was based on gettimeofday() - the emulator stopped dead in its tracks). FWIW, it uses GetTickCount() for that, which sounds reasonable, but who knows... In either case, the twiddling suggested above may not help then, but it's worth a try I think. Disabling the algorithm is probably undesirable. --Per From bbmaj7@REDACTED Sun Feb 22 04:43:50 2009 From: bbmaj7@REDACTED (Richard Andrews) Date: Sat, 21 Feb 2009 19:43:50 -0800 (PST) Subject: [erlang-questions] Abstract patterns, structs and frames References: Message-ID: <214412.79893.qm@web65509.mail.ac4.yahoo.com> > We , the Erlang/OTP team at Ericsson think that abstract patterns, > structs and frames are very interesting > suggestions which we would like to implement sooner or later. But > before we will even consider this we need > good quality EEP's for these. > > The current documentation around these concepts are not complete > enough to take a decision on whether to implement > them or not. > > Of course we don't need both structs and frames just one of them. > > So it is up to you to come up with the EEPs. Where can I find a definition of the two (ie. structs and frames) which matches your understanding for this context? Is there anything more formal than this http://erlang.org/pipermail/erlang-questions/2009-January/040961.html ... or is this a computational linguistics "in joke" that I just didn't get ? -- Rich Make Yahoo!7 your homepage and win a trip to the Quiksilver Pro. Find out more From kenneth.lundin@REDACTED Sun Feb 22 11:54:53 2009 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Sun, 22 Feb 2009 11:54:53 +0100 Subject: [erlang-questions] Abstract patterns, structs and frames In-Reply-To: <214412.79893.qm@web65509.mail.ac4.yahoo.com> References: <214412.79893.qm@web65509.mail.ac4.yahoo.com> Message-ID: The suggestion about structs can be found here: http://www.erlang.org/ml-archive/erlang-questions/200301/pdf00000.pdf The description about abstract patterns can be found here: http://www.erlang.org/ml-archive/erlang-questions/200309/msg00309.html I currently have no link to the frames suggestion by Richard O'Keefe but will come back with one as soon as I find it. /Kenneth, Erlang/OTP Ericsson On Sun, Feb 22, 2009 at 4:43 AM, Richard Andrews wrote: >> We , the Erlang/OTP team at Ericsson think that abstract patterns, >> structs and frames are very interesting >> suggestions which we would like to implement sooner or later. But >> before we will even consider this we need >> good quality EEP's for these. >> >> The current documentation around these concepts are not complete >> enough to take a decision on whether to implement >> them or not. >> >> Of course we don't need both structs and frames just one of them. >> >> So it is up to you to come up with the EEPs. > > Where can I find a definition of the two (ie. structs and frames) which matches your understanding for this context? > > Is there anything more formal than this > > http://erlang.org/pipermail/erlang-questions/2009-January/040961.html > > ... or is this a computational linguistics "in joke" that I just didn't get ? > > -- > ?Rich > > > ? ? ?Make Yahoo!7 your homepage and win a trip to the Quiksilver Pro. Find out more > From zambal@REDACTED Sun Feb 22 15:00:32 2009 From: zambal@REDACTED (zambal) Date: Sun, 22 Feb 2009 06:00:32 -0800 (PST) Subject: [erlang-questions] Abstract patterns, structs and frames In-Reply-To: References: <214412.79893.qm@web65509.mail.ac4.yahoo.com> Message-ID: <3c62c6bf-6909-4b42-841c-514bfce943ee@r4g2000yqa.googlegroups.com> On Feb 22, 11:54?am, Kenneth Lundin wrote: > I currently have no link to the frames suggestion by Richard O'Keefe > but will come back with one as soon as I find it. > > /Kenneth, Erlang/OTP Ericsson I have found this message in the archives: http://www.erlang.org/pipermail/erlang-questions/2008-November/039978.html The message links to this PDF: http://www.cs.otago.ac.nz/staffpriv/ok/frames.pdf Richard O'Keefe provides a detailed description about frames and the use of them in this document. --- vincent From jan@REDACTED Sun Feb 22 15:19:40 2009 From: jan@REDACTED (Jan Lehnardt) Date: Sun, 22 Feb 2009 15:19:40 +0100 Subject: [erlang-questions] License Clarification about EUnit in OTP needed In-Reply-To: <499E95D8.3030502@it.uu.se> References: <47679224-E98A-4E1A-B405-9955E2C60B35@opensynapse.net> <38AD0628-B3A1-4B3C-BF3C-83F74D8BCD5C@apache.org> <499E95D8.3030502@it.uu.se> Message-ID: <7859B567-DA68-4884-B728-716AA3D23AE3@apache.org> On 20 Feb 2009, at 12:36, Richard Carlsson wrote: > Jan Lehnardt wrote: >> On 19 Feb 2009, at 22:40, Abhay Kumar wrote: >> >>> i tried to bring this up a little while ago but haven't heard back >>> about it yet (http://erlang.org/pipermail/erlang-questions/2008-December/040313.html >>> ). That tweet from Micka?l is promising. >> >> I've since talked to Richard C. and he confirmed my reading >> of the signs that EUnit is shipped with OTP under LGPL. > > I tend to prefer copyleft-licenses for my work, but as I see that > there are some valid issues with using LGPL for things in the standard > distribution, I have been discussing the matter with the OTP folks. > Some kind of change may be underway. > > The EPL, meanwhile, is simply not usable for anyone except Ericsson > (or if you wish to hand over all rights to Ericsson), at least > the way I read it. Plain MPL 1.1 would work as a substitute for EPL, > but I think I'd rather use the Apache License 2.0. Does anyone know > about any problems with either of those? I don't know of any issues with the Apache License 2.0. My clear vote would be in its favour. Cheers Jan -- From petermichaux@REDACTED Sun Feb 22 21:25:09 2009 From: petermichaux@REDACTED (Peter Michaux) Date: Sun, 22 Feb 2009 12:25:09 -0800 Subject: [erlang-questions] arity part of function name and variadic functions Message-ID: <3cbaf1c80902221225pf14513sf93e46a90228d595@mail.gmail.com> I'm reading Joe Armstrong's "Programming Erlang: Software for a Concurrent World". Two stand out features of Erlang are 1) a function's arity is part of its name and 2) there are no variadic functions. What are the benefits of these two features from a language design perspective? Were they concisely chosen to help the programmer in some way, were they to make implementation easier or more efficient, or did they just happen somewhere along the way? Would the opposite choices have caused bad interaction with the process-based concurrency model or some other part of the language? Thanks, Peter From richardc@REDACTED Sun Feb 22 22:04:38 2009 From: richardc@REDACTED (Richard Carlsson) Date: Sun, 22 Feb 2009 22:04:38 +0100 Subject: [erlang-questions] arity part of function name and variadic functions In-Reply-To: <3cbaf1c80902221225pf14513sf93e46a90228d595@mail.gmail.com> References: <3cbaf1c80902221225pf14513sf93e46a90228d595@mail.gmail.com> Message-ID: <49A1BDE6.4050209@it.uu.se> Peter Michaux wrote: > I'm reading Joe Armstrong's "Programming Erlang: Software for a > Concurrent World". Two stand out features of Erlang are > > 1) a function's arity is part of its name and > 2) there are no variadic functions. > > What are the benefits of these two features from a language design perspective? The benefit is that you don't have to think about implementing variadic functions, and you still get most of the advantages. You also get the bonus feature of being able to do slightly (or even wildly) different things depending on arity... However, some compiler internals get more complicated since you need to represent function names as (Name,Arity) pairs; they are not just identifiers. It isn't difficult to handle, but can be somewhat annoying. > Were they concisely chosen to help the programmer in some way, were > they to make implementation easier or more efficient, or did they just > happen somewhere along the way? In all likelihood they happened because that is how predicates work in Prolog, just like most of Erlang's lexical conventions were taken from Prolog. (The first experiments with Erlang were implemented on top of Prolog.) > Would the opposite choices have caused bad interaction with the > process-based concurrency model or some other part of the language? No, but Erlang code would have looked different, with many slightly varying names for standard functions (consider e.g. spawn/3/4), and probably more functions that take an option list as a final parameter. /Richard -- "Having users is like optimization: the wise course is to delay it." -- Paul Graham From cliff@REDACTED Mon Feb 23 01:13:40 2009 From: cliff@REDACTED (Cliff Moon) Date: Sun, 22 Feb 2009 16:13:40 -0800 Subject: [erlang-questions] how message size effects performance In-Reply-To: <49A03952.3070902@it.uu.se> References: <499EE701.7010804@moonpolysoft.com> <49A03952.3070902@it.uu.se> Message-ID: <49A1EA34.6@moonpolysoft.com> What about messages to other nodes? Clearly that involves a copy since it has to go across the wire, even if there are large binaries. Some people seem to think that the VM will block while the message is getting sent. So if you have a 20meg binary you want to send to another node all in one Erlang message will that get split up? Or does it block the whole VM to send a message that large? Per Gustafsson wrote: > Cliff Moon wrote: >> Does anyone have or know of a good breakdown of how message size >> affects performance, particularly remote messages? I've heard >> conflicting reports from people about how the Erlang VM deals with >> messages that have a high byte count (large binaries, etc). Some >> people say that the VM will handle large messages cleanly and in a >> performant manner, while others have told me that large messages tend >> to degrade the performance of the entire VM. I could run benchmarks, >> but to save me the time does anyone have any sort of data on this? >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > All the data in messages are copied except for large binaries (larger > than 64 bytes). So sending large messages in which the bulk of the > data is not large binaries will lead to poor performance and high > memory consumption. > > Per > From ok@REDACTED Mon Feb 23 01:49:56 2009 From: ok@REDACTED (Richard O'Keefe) Date: Mon, 23 Feb 2009 13:49:56 +1300 Subject: [erlang-questions] : abstract patterns vs macros was:( Floating guard sequences) In-Reply-To: <22118636.post@talk.nabble.com> References: <20090217221350.GA6592@herbie> <2BE36673-CDE2-405D-8336-FE45304A16FE@cs.otago.ac.nz> <3E9FE23F-EA09-417A-8054-85135F4B6C71@fess.org> <20090220004435.GR26906@n54.com> <20090220083245.GA29395@erix.ericsson.se> <22118636.post@talk.nabble.com> Message-ID: <2033EE1C-2038-440C-86B3-BE4C8D27FBCE@cs.otago.ac.nz> On 21 Feb 2009, at 12:01 am, Zvi wrote: > > I like Abstract Patterns, I think they make patterns more like first- > class > citizens and make ADTs implementation easier. There several > comments, which > I'll write later. For now, I just trying to write simple abstract > pattern > for inclusive range of integers: > > #range(N,M) when is_integer(X) -> N= > I just introduced X. Is this right way? An abstract pattern lets you name and reuse a combination of pattern match and type test that you could have written without it. The form of a pattern definition is # when -> . In this case, N =< X, X =< M is a guard, not a pattern. I think what you want is #range(L, U, X) when is_integer(X), L =< X, X =< U -> X. Without abstract patterns, you would write f(..., X, ...) when is_integer(X), L =< X, X =< U ... -> ^rhs ^guard......................^ The bit you would have written in the head of a function clause goes on the right of the arrow, and the bit that would have been in the guard of a function clause goes in the guard of the pattern. > Do I need to specify is_integer(N), is_integer(M) for abstract pattern > arguments too ? Only if you want to. The one thing you cannot do is solve for the bounds. Any variable in the head of a pattern that does not occur in the right hand side must be bound some other way. So you can do f(N, #range(1,N, X)) -> ... or f(N, #range(1,N, 42)) -> ... but not g(#range(1,N, 42)) -> ... N ... From ok@REDACTED Mon Feb 23 02:16:07 2009 From: ok@REDACTED (Richard O'Keefe) Date: Mon, 23 Feb 2009 14:16:07 +1300 Subject: [erlang-questions] Abstract patterns, structs and frames In-Reply-To: References: Message-ID: I *tried* providing a "good quality" EEP about frames, but fell foul of an arbitrary size restriction. From bgustavsson@REDACTED Mon Feb 23 08:48:50 2009 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Mon, 23 Feb 2009 08:48:50 +0100 Subject: [erlang-questions] how message size effects performance In-Reply-To: <49A1EA34.6@moonpolysoft.com> References: <499EE701.7010804@moonpolysoft.com> <49A03952.3070902@it.uu.se> <49A1EA34.6@moonpolysoft.com> Message-ID: <6672d0160902222348r61aa2569y9b5b103d93497f6a@mail.gmail.com> On Mon, Feb 23, 2009 at 1:13 AM, Cliff Moon wrote: > What about messages to other nodes? Clearly that involves a copy since > it has to go across the wire, even if there are large binaries. Some > people seem to think that the VM will block while the message is getting > sent. So if you have a 20meg binary you want to send to another node > all in one Erlang message will that get split up? Or does it block the > whole VM to send a message that large? > Messages are not split. In the non-SMP virtual machine, the entire VM will be blocked. In the SMP VM, the scheduler doing the send will be blocked and if other schedulers threads try to send messages to the same node, they will block until the big message has been sent. We are planning to improve distributed sends in some future release. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bgustavsson@REDACTED Mon Feb 23 08:58:13 2009 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Mon, 23 Feb 2009 08:58:13 +0100 Subject: [erlang-questions] max fds for epoll incorrectly reduced to FD_SETSIZE In-Reply-To: <65b2728e0902211116i120c2b18oe29c5c9c9642f8e4@mail.gmail.com> References: <65b2728e0902211116i120c2b18oe29c5c9c9642f8e4@mail.gmail.com> Message-ID: <6672d0160902222358r32ad61dl749a64993534144@mail.gmail.com> On Sat, Feb 21, 2009 at 8:16 PM, Steve Vinoski wrote: > Since kernel poll is not on by default, select() is used as the > fallback/default, and the following code from the erts_poll_init() > function in erts/emulator/sys/common/erl_poll.c limits the max fds to > FD_SETSIZE: Are you sure that select() is used as a fallback on Linux? On systems that have a poll() that works for any type of file descriptor, poll() is supposed to be used. (On Mac OS X, poll() does not work for devices, so we are forced to use select() as a fallback.) /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From vladdu55@REDACTED Mon Feb 23 09:08:39 2009 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 23 Feb 2009 09:08:39 +0100 Subject: [erlang-questions] Abstract patterns, structs and frames In-Reply-To: References: Message-ID: <95be1d3b0902230008t19366c10saa2fa07a61ad8649@mail.gmail.com> Hi, On Sat, Feb 21, 2009 at 18:57, Kenneth Lundin wrote: > Of course we don't need both structs and frames just one of them. Just to be sure I understand: does this mean that abstract patterns might be implemented together with one of structs and frames? AP and S/F are only partially overlapping. best regards, Vlad From kenneth.lundin@REDACTED Mon Feb 23 09:26:49 2009 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Mon, 23 Feb 2009 09:26:49 +0100 Subject: [erlang-questions] Abstract patterns, structs and frames In-Reply-To: <95be1d3b0902230008t19366c10saa2fa07a61ad8649@mail.gmail.com> References: <95be1d3b0902230008t19366c10saa2fa07a61ad8649@mail.gmail.com> Message-ID: On Mon, Feb 23, 2009 at 9:08 AM, Vlad Dumitrescu wrote: ... > Just to be sure I understand: does this mean that abstract patterns > might be implemented together with one of structs and frames? AP and > S/F are only partially overlapping. Yes, it means that both Abstract Patterns and (Frames or Structs) might be implemented. /Kenneth, Erlang/OTP Ericsson From v@REDACTED Mon Feb 23 10:43:06 2009 From: v@REDACTED (Valentin Micic) Date: Mon, 23 Feb 2009 11:43:06 +0200 Subject: [erlang-questions] how message size effects performance In-Reply-To: <6672d0160902222348r61aa2569y9b5b103d93497f6a@mail.gmail.com> Message-ID: <200902230938.n1N9cbRc015684@mail.pharos-avantgard.com> Wouldn't it make sense to include socket I/O as a part of +A thread pool, which would support equally well SMP as well as non-SMP environments? V. -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Bjorn Gustavsson Sent: 23 February 2009 09:49 AM To: Cliff Moon Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] how message size effects performance On Mon, Feb 23, 2009 at 1:13 AM, Cliff Moon wrote: > What about messages to other nodes? Clearly that involves a copy since > it has to go across the wire, even if there are large binaries. Some > people seem to think that the VM will block while the message is getting > sent. So if you have a 20meg binary you want to send to another node > all in one Erlang message will that get split up? Or does it block the > whole VM to send a message that large? > Messages are not split. In the non-SMP virtual machine, the entire VM will be blocked. In the SMP VM, the scheduler doing the send will be blocked and if other schedulers threads try to send messages to the same node, they will block until the big message has been sent. We are planning to improve distributed sends in some future release. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From vychodil.hynek@REDACTED Mon Feb 23 11:07:20 2009 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Mon, 23 Feb 2009 11:07:20 +0100 Subject: [erlang-questions] : abstract patterns vs macros was:( Floating guard sequences) In-Reply-To: <2033EE1C-2038-440C-86B3-BE4C8D27FBCE@cs.otago.ac.nz> References: <20090217221350.GA6592@herbie> <2BE36673-CDE2-405D-8336-FE45304A16FE@cs.otago.ac.nz> <3E9FE23F-EA09-417A-8054-85135F4B6C71@fess.org> <20090220004435.GR26906@n54.com> <20090220083245.GA29395@erix.ericsson.se> <22118636.post@talk.nabble.com> <2033EE1C-2038-440C-86B3-BE4C8D27FBCE@cs.otago.ac.nz> Message-ID: <4d08db370902230207w3fc29c7aua259b0369b768616@mail.gmail.com> Is there way how to define combined patterns like range and odd without define extra new patter for it. On Mon, Feb 23, 2009 at 1:49 AM, Richard O'Keefe wrote: > > On 21 Feb 2009, at 12:01 am, Zvi wrote: > > > > > I like Abstract Patterns, I think they make patterns more like first- > > class > > citizens and make ADTs implementation easier. There several > > comments, which > > I'll write later. For now, I just trying to write simple abstract > > pattern > > for inclusive range of integers: > > > > #range(N,M) when is_integer(X) -> N= > > > I just introduced X. Is this right way? > > > An abstract pattern lets you name and reuse a combination of > pattern match and type test that you could have written without it. > > The form of a pattern definition is > # when -> . > > In this case, N =< X, X =< M is a guard, not a pattern. > I think what you want is > > #range(L, U, X) > when is_integer(X), L =< X, X =< U > -> X. > > Without abstract patterns, you would write > f(..., X, ...) when is_integer(X), L =< X, X =< U ... -> > ^rhs ^guard......................^ > The bit you would have written in the head of a function clause > goes on the right of the arrow, and the bit that would have > been in the guard of a function clause goes in the guard of the > pattern. > > > Do I need to specify is_integer(N), is_integer(M) for abstract pattern > > arguments too ? > > Only if you want to. The one thing you cannot do is solve for > the bounds. Any variable in the head of a pattern that does not > occur in the right hand side must be bound some other way. > So you can do > > f(N, #range(1,N, X)) -> ... > or f(N, #range(1,N, 42)) -> ... > but not > g(#range(1,N, 42)) -> ... N ... > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try Good Data now for free: www.gooddata.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From bgustavsson@REDACTED Mon Feb 23 11:55:05 2009 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Mon, 23 Feb 2009 11:55:05 +0100 Subject: [erlang-questions] how message size effects performance In-Reply-To: <200902230938.n1N9cbRc015684@mail.pharos-avantgard.com> References: <6672d0160902222348r61aa2569y9b5b103d93497f6a@mail.gmail.com> <200902230938.n1N9cbRc015684@mail.pharos-avantgard.com> Message-ID: <6672d0160902230255o7b8d736l314748cca41dc20@mail.gmail.com> On Mon, Feb 23, 2009 at 10:43 AM, Valentin Micic wrote: My previous message was not entirely correct. Sorry for that. The emulator will not be completely blocked when doing the actual socket I/O - socket I/O is already non-blocking. However, the non-SMP emulator will be blocked while converting a big term to to the external term format (and that was what I was thinking of when writing my previous incorrect answer). So using the async thread pool will not help at all. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bbmaj7@REDACTED Mon Feb 23 12:31:18 2009 From: bbmaj7@REDACTED (Richard Andrews) Date: Mon, 23 Feb 2009 03:31:18 -0800 (PST) Subject: [erlang-questions] Abstract patterns, structs and frames References: <95be1d3b0902230008t19366c10saa2fa07a61ad8649@mail.gmail.com> Message-ID: <297487.67048.qm@web65501.mail.ac4.yahoo.com> > Yes, it means that both Abstract Patterns and (Frames or Structs) > might be implemented. As best I can understand - after reading the papers by Richard O'Keef and Joe Armstrong - structs and frames are trying to solve pretty much the same problem and the main distinction appears to be that structs are named/tagged while frames are defined only by their content. I don't see a need for the tag (ie. struct) and I think it might be a problem in some cases. What situations can people see where the struct tag is better than say, tag=someTagAtom in a frame? -- Rich Make Yahoo!7 your homepage and win a trip to the Quiksilver Pro. Find out more From raimo+erlang-questions@REDACTED Mon Feb 23 13:57:11 2009 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Mon, 23 Feb 2009 13:57:11 +0100 Subject: [erlang-questions] : Abstract patterns, structs and frames In-Reply-To: References: Message-ID: <20090223125711.GB21559@erix.ericsson.se> On Mon, Feb 23, 2009 at 02:16:07PM +1300, Richard O'Keefe wrote: > I *tried* providing a "good quality" EEP about frames, > but fell foul of an arbitrary size restriction. If I recall correctly, the size restriction was the inital obstacle (still there but higher now (128KB)), but the EEP was denied because it was split into an EEP form document that pointed to the frames.pdf document. That makes updates of the suggestion hard to handle since we do not want a toolchain to create a .pdf for maintaining an EEP. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From vychodil.hynek@REDACTED Mon Feb 23 15:12:04 2009 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Mon, 23 Feb 2009 15:12:04 +0100 Subject: [erlang-questions] Abstract patterns, structs and frames In-Reply-To: <297487.67048.qm@web65501.mail.ac4.yahoo.com> References: <95be1d3b0902230008t19366c10saa2fa07a61ad8649@mail.gmail.com> <297487.67048.qm@web65501.mail.ac4.yahoo.com> Message-ID: <4d08db370902230612y64aa9cc4kb9f16ddc71e66dcd@mail.gmail.com> On Mon, Feb 23, 2009 at 12:31 PM, Richard Andrews wrote: > > Yes, it means that both Abstract Patterns and (Frames or Structs) > > might be implemented. > > As best I can understand - after reading the papers by Richard O'Keef and > Joe Armstrong - structs and frames are trying to solve pretty much the same > problem and the main distinction appears to be that structs are named/tagged > while frames are defined only by their content. > > I don't see a need for the tag (ie. struct) and I think it might be a > problem in some cases. What situations can people see where the struct tag > is better than say, tag=someTagAtom in a frame? > ... or encapsulate in tuple or whatever want. > > -- > Rich > > > Make Yahoo!7 your homepage and win a trip to the Quiksilver Pro. Find > out more > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try Good Data now for free: www.gooddata.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From vinoski@REDACTED Mon Feb 23 17:41:07 2009 From: vinoski@REDACTED (Steve Vinoski) Date: Mon, 23 Feb 2009 11:41:07 -0500 Subject: [erlang-questions] max fds for epoll incorrectly reduced to FD_SETSIZE In-Reply-To: <6672d0160902222358r32ad61dl749a64993534144@mail.gmail.com> References: <65b2728e0902211116i120c2b18oe29c5c9c9642f8e4@mail.gmail.com> <6672d0160902222358r32ad61dl749a64993534144@mail.gmail.com> Message-ID: <65b2728e0902230841k4abd0331w35f23292b76915f3@mail.gmail.com> On 2/23/09, Bjorn Gustavsson wrote: > On Sat, Feb 21, 2009 at 8:16 PM, Steve Vinoski wrote: > > Since kernel poll is not on by default, select() is used as the > > fallback/default, and the following code from the erts_poll_init() > > function in erts/emulator/sys/common/erl_poll.c limits the max fds to > > FD_SETSIZE: > > Are you sure that select() is used as a fallback on Linux? On systems that have > a poll() that works for any type of file descriptor, poll() is supposed to be > used. (On Mac OS X, poll() does not work for devices, so we are forced to use > select() as a fallback.) Hi Bjorn, thanks for your response, and yes, that's a very good question. I went back and thoroughly checked my normal Erlang builds on Linux and sure enough, poll() is in effect. The build causing the trouble I described in my original post is a slight cross-compilation (i.e., compiling on one Linux/gcc combo for a different Linux/gcc combo), so I suspect what might be happening is that the C code used to determine whether poll works or not, which I just found thanks to your question, is failing because of the cross-compile. I'll dig into this theory further and let you know. I appreciate the pointer. --steve From zambal@REDACTED Mon Feb 23 17:48:35 2009 From: zambal@REDACTED (zambal) Date: Mon, 23 Feb 2009 08:48:35 -0800 (PST) Subject: [erlang-questions] Abstract patterns, structs and frames In-Reply-To: <297487.67048.qm@web65501.mail.ac4.yahoo.com> References: <95be1d3b0902230008t19366c10saa2fa07a61ad8649@mail.gmail.com> <297487.67048.qm@web65501.mail.ac4.yahoo.com> Message-ID: <17c5a63e-f812-41df-9590-6e00cc6854af@p13g2000yqc.googlegroups.com> On 23 feb, 12:31, Richard Andrews wrote: > I don't see a need for the tag (ie. struct) and I think it might be a problem in some cases. What situations can people see where the struct tag is better than say, tag=someTagAtom in a frame? Joe Armstrong describes both named and anonymous structs, so the use of a name is optional. However, I don't see the big advantage of having named structs either. --- vincent From rvirding@REDACTED Mon Feb 23 21:38:46 2009 From: rvirding@REDACTED (Robert Virding) Date: Mon, 23 Feb 2009 21:38:46 +0100 Subject: [erlang-questions] arity part of function name and variadic functions In-Reply-To: <49A1BDE6.4050209@it.uu.se> References: <3cbaf1c80902221225pf14513sf93e46a90228d595@mail.gmail.com> <49A1BDE6.4050209@it.uu.se> Message-ID: <3dbc6d1c0902231238h2a227a8cuc14074aefaeb05f7@mail.gmail.com> 2009/2/22 Richard Carlsson > Peter Michaux wrote: > > > Were they concisely chosen to help the programmer in some way, were > > they to make implementation easier or more efficient, or did they just > > happen somewhere along the way? > > In all likelihood they happened because that is how predicates work > in Prolog, just like most of Erlang's lexical conventions were taken > from Prolog. (The first experiments with Erlang were implemented on > top of Prolog.) Yes, that is exactly what happened, it was "inherited" from Prolog. Along with a lot of things apart from the syntax. Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From paul.joseph.davis@REDACTED Mon Feb 23 21:44:41 2009 From: paul.joseph.davis@REDACTED (Paul Davis) Date: Mon, 23 Feb 2009 15:44:41 -0500 Subject: [erlang-questions] Erlang VM segfault? Message-ID: As weird as it sounds, I've come across a repeatable segfault in erlang. I haven't minimized it to a simple test case yet, but I figured I'd describe it and give some GDB output in case it triggers an idea from anyone. The context of the segfault is when working in CouchDB with documents that have a 29,107 element revision history. I'm only specific on the 29,107 because I duplicated in two databases with two different docs and both of them are exactly 29,107. No idea if that's important. My first thought was to watch the segfault with GDB to see if that illuminated anything. It didn't really. I've pasted the first 10 frames for reference. I figured I might as well scroll down to the 58,214th frame, but at about 58,203 gdb segfaulted. With some help from a couple of the guys in #erlang@REDACTED I tried bumping the atom table sizes to see if that was the issue. After changing both the ATOM_SIZE and ATOM_LIMIT define's to 1GiB I'm still getting segfaults. Next on the list is to try R12B-5. Anyone have any thoughts? Thanks, Paul Davis #0 0x000000000049d822 in enc_atom (dep=, atom=, ep=) at beam/external.c:405 #1 0x000000000049e41c in enc_term (dep=0x0, obj=75, ep=, dflags=1924) at beam/external.c:561 #2 0x000000000049e2f7 in enc_term (dep=0x0, obj=139755318628650, ep=0x4
, dflags=1924) at beam/external.c:678 #3 0x000000000049e2f7 in enc_term (dep=0x0, obj=139755318628674, ep=0x4
, dflags=1924) at beam/external.c:678 #4 0x000000000049e7fc in enc_term (dep=0x0, obj=139755318628705, ep=0x4
, dflags=1924) at beam/external.c:654 #5 0x000000000049e2f7 in enc_term (dep=0x0, obj=139755318628722, ep=0x4
, dflags=1924) at beam/external.c:678 #6 0x000000000049e7fc in enc_term (dep=0x0, obj=139755318628753, ep=0x4
, dflags=1924) at beam/external.c:654 #7 0x000000000049e2f7 in enc_term (dep=0x0, obj=139755318628770, ep=0x4
, dflags=1924) at beam/external.c:678 #8 0x000000000049e7fc in enc_term (dep=0x0, obj=139755318628801, ep=0x4
, dflags=1924) at beam/external.c:654 #9 0x000000000049e2f7 in enc_term (dep=0x0, obj=139755318628818, ep=0x4
, dflags=1924) at beam/external.c:678 #10 0x000000000049e7fc in enc_term (dep=0x0, obj=139755318628849, ep=0x4
, dflags=1924) at beam/external.c:654 From paul.joseph.davis@REDACTED Mon Feb 23 22:26:21 2009 From: paul.joseph.davis@REDACTED (Paul Davis) Date: Mon, 23 Feb 2009 16:26:21 -0500 Subject: [erlang-questions] Erlang VM segfault? In-Reply-To: References: Message-ID: Quick follow up, This has been tested on Erlang versions 5.6.[2-5] with CouchDB trunk on multiple machines. If anyone wants to duplicate and has a CouchDB install, the steps are pretty simple: $ cd /path/to/couchdb $ make dev $ cd tmp/lib $ wget http://www.davispj.com/rev_errors.couch $ cd ../.. $ ./utils/run In a different terminal $ curl -X DELETE 'http://127.0.0.1:5984/rev_errors/1?rev=4270118160' Other than that, I think I'll take a look at trying to minimize the test case later. Thanks, Paul Davis On Mon, Feb 23, 2009 at 3:44 PM, Paul Davis wrote: > As weird as it sounds, I've come across a repeatable segfault in > erlang. I haven't minimized it to a simple test case yet, but I > figured I'd describe it and give some GDB output in case it triggers > an idea from anyone. > > The context of the segfault is when working in CouchDB with documents > that have a 29,107 element revision history. I'm only specific on the > 29,107 because I duplicated in two databases with two different docs > and both of them are exactly 29,107. No idea if that's important. > > My first thought was to watch the segfault with GDB to see if that > illuminated anything. It didn't really. I've pasted the first 10 > frames for reference. I figured I might as well scroll down to the > 58,214th frame, but at about 58,203 gdb segfaulted. > > With some help from a couple of the guys in #erlang@REDACTED I > tried bumping the atom table sizes to see if that was the issue. After > changing both the ATOM_SIZE and ATOM_LIMIT define's to 1GiB I'm still > getting segfaults. > > Next on the list is to try R12B-5. > > Anyone have any thoughts? > > Thanks, > Paul Davis > > #0 0x000000000049d822 in enc_atom (dep=, > atom=, > ep=) at beam/external.c:405 > #1 0x000000000049e41c in enc_term (dep=0x0, obj=75, ep= optimized out>, dflags=1924) at beam/external.c:561 > #2 0x000000000049e2f7 in enc_term (dep=0x0, obj=139755318628650, > ep=0x4
, dflags=1924) > at beam/external.c:678 > #3 0x000000000049e2f7 in enc_term (dep=0x0, obj=139755318628674, > ep=0x4
, dflags=1924) > at beam/external.c:678 > #4 0x000000000049e7fc in enc_term (dep=0x0, obj=139755318628705, > ep=0x4
, dflags=1924) > at beam/external.c:654 > #5 0x000000000049e2f7 in enc_term (dep=0x0, obj=139755318628722, > ep=0x4
, dflags=1924) > at beam/external.c:678 > #6 0x000000000049e7fc in enc_term (dep=0x0, obj=139755318628753, > ep=0x4
, dflags=1924) > at beam/external.c:654 > #7 0x000000000049e2f7 in enc_term (dep=0x0, obj=139755318628770, > ep=0x4
, dflags=1924) > at beam/external.c:678 > #8 0x000000000049e7fc in enc_term (dep=0x0, obj=139755318628801, > ep=0x4
, dflags=1924) > at beam/external.c:654 > #9 0x000000000049e2f7 in enc_term (dep=0x0, obj=139755318628818, > ep=0x4
, dflags=1924) > at beam/external.c:678 > #10 0x000000000049e7fc in enc_term (dep=0x0, obj=139755318628849, > ep=0x4
, dflags=1924) > at beam/external.c:654 > From vinoski@REDACTED Mon Feb 23 23:41:43 2009 From: vinoski@REDACTED (Steve Vinoski) Date: Mon, 23 Feb 2009 17:41:43 -0500 Subject: [erlang-questions] max fds for epoll incorrectly reduced to FD_SETSIZE In-Reply-To: <65b2728e0902230841k4abd0331w35f23292b76915f3@mail.gmail.com> References: <65b2728e0902211116i120c2b18oe29c5c9c9642f8e4@mail.gmail.com> <6672d0160902222358r32ad61dl749a64993534144@mail.gmail.com> <65b2728e0902230841k4abd0331w35f23292b76915f3@mail.gmail.com> Message-ID: <65b2728e0902231441j740397b4h6ee845823343be8e@mail.gmail.com> On 2/23/09, Steve Vinoski wrote: > On 2/23/09, Bjorn Gustavsson wrote: > > On Sat, Feb 21, 2009 at 8:16 PM, Steve Vinoski wrote: > > > Since kernel poll is not on by default, select() is used as the > > > fallback/default, and the following code from the erts_poll_init() > > > function in erts/emulator/sys/common/erl_poll.c limits the max fds to > > > FD_SETSIZE: > > > > Are you sure that select() is used as a fallback on Linux? On systems that have > > a poll() that works for any type of file descriptor, poll() is supposed to be > > used. (On Mac OS X, poll() does not work for devices, so we are forced to use > > select() as a fallback.) > > > Hi Bjorn, thanks for your response, and yes, that's a very good > question. I went back and thoroughly checked my normal Erlang builds > on Linux and sure enough, poll() is in effect. The build causing the > trouble I described in my original post is a slight cross-compilation > (i.e., compiling on one Linux/gcc combo for a different Linux/gcc > combo), so I suspect what might be happening is that the C code used > to determine whether poll works or not, which I just found thanks to > your question, is failing because of the cross-compile. I'll dig into > this theory further and let you know. I appreciate the pointer. Yep, it's as plain as day once you know where to look. In the configure script generated from erts/configure.in, the test for working poll first checks to see if we're cross-compiling, and if so, it unconditionally sets the "poll_works" variable to false. That's the source of the problem I'm seeing. Given how critical this is to being able to cross-compile a scalable runtime, I think there has to be a way to assert to configure that it can just assume poll works. One way to do this is to allow for setting a environment variable, let's call it ASSERT_WORKING_POLL, while running configure. Here's a patch to erts/configure.in to allow that: *** erts/configure.in~ Tue Nov 4 05:51:24 2008 --- erts/configure.in Mon Feb 23 16:48:16 2009 *************** *** 2541,2547 **** exit(0); #endif } ! ], poll_works=true, poll_works=false, poll_works=false) case $poll_works in true) AC_DEFINE(ERTS_USE_POLL, 1, [Define if poll() should be used instead of select()]) --- 2541,2547 ---- exit(0); #endif } ! ], poll_works=true, poll_works=false, poll_works=${ASSERT_WORKING_POLL:-false}) case $poll_works in true) AC_DEFINE(ERTS_USE_POLL, 1, [Define if poll() should be used instead of select()]) --- This functionality is identical to the previous functionality when ASSERT_WORKING_POLL isn't set or is set to false. Setting ASSERT_WORKING_POLL=true as an environment variable for configure forces it to assume that poll works. --steve From tsuraan@REDACTED Mon Feb 23 23:42:15 2009 From: tsuraan@REDACTED (tsuraan) Date: Mon, 23 Feb 2009 16:42:15 -0600 Subject: [erlang-questions] writing a delay loop without now() In-Reply-To: References: <200902202226.n1KMQTkH088249@pluto.hedeland.org> Message-ID: <84fb38e30902231442w166941eap9e62137d92decf6b@mail.gmail.com> > -module(test). > -compile(export_all). > > time(N) -> time(N, now()). > time(N, Start) -> > case timer:now_diff(now(), Start) of > M when M >= N -> M; > _ -> time(N, Start) > end. My results, on Linux 2.6.28 (vanilla) and a core2 duo at 3GHz: Erlang (BEAM) emulator version 5.6.1 [source] [smp:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.6.1 (abort with ^G) 1> c(test). {ok,test} 2> erlang:statistics(wall_clock),test:time(5000000),erlang:statistics(wall_clock). {24784,3960} 3> erlang:statistics(wall_clock),test:time(5000000),erlang:statistics(wall_clock). {30248,3964} 4> c(test, native). {ok,test} 5> erlang:statistics(wall_clock),test:time(5000000),erlang:statistics(wall_clock). {39371,3773} 6> erlang:statistics(wall_clock),test:time(5000000),erlang:statistics(wall_clock). {44229,3797} Native does sleep for 5 seconds a bit faster than without native, but both ways sleep for 5 seconds in noticeably less than 5 seconds. From tsuraan@REDACTED Mon Feb 23 23:46:15 2009 From: tsuraan@REDACTED (tsuraan) Date: Mon, 23 Feb 2009 16:46:15 -0600 Subject: [erlang-questions] writing a delay loop without now() In-Reply-To: References: <200902211410.n1LEAWvd009177@pluto.hedeland.org> Message-ID: <84fb38e30902231446t62453e2s9a0f4a5795d52539@mail.gmail.com> On 21/02/2009, Fredrik Svahn wrote: > I get the same results as James when running R12B-5 on Windows Vista. It > seems to be related to the algorithm for adjusting to sudden time changes. > When disabling it with the "+c" flag it works (almost) as expected. Interesting: when I try this, I get the opposite effect: tsuraan@REDACTED ~/test/erlang $ erl +c Erlang (BEAM) emulator version 5.6.1 [source] [smp:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.6.1 (abort with ^G) 1> c(test). {ok,test} 2> erlang:statistics(wall_clock),test:time(5000000),erlang:statistics(wall_clock). {8852,2896} 3> erlang:statistics(wall_clock),test:time(5000000),erlang:statistics(wall_clock). {14662,2900} 4> c(test, native). {ok,test} 5> erlang:statistics(wall_clock),test:time(5000000),erlang:statistics(wall_clock). {25744,2782} 6> erlang:statistics(wall_clock),test:time(5000000),erlang:statistics(wall_clock). {30166,2802} From vik@REDACTED Tue Feb 24 00:31:21 2009 From: vik@REDACTED (Vik Olliver) Date: Tue, 24 Feb 2009 12:31:21 +1300 Subject: [erlang-questions] Regex to match an empty string Message-ID: <49A331C9.4040105@catalyst.net.nz> I'm trying to spot a parameter that is an empty string. The weapon of choice is regexp:first_match/2 which is used in the code that parses the config file. In other worlds, "^$" matches an empty string. In Erlang, not so: 5> regexp:first_match("","^$"). nomatch What do I use instead? Vik :v) From ok@REDACTED Tue Feb 24 00:31:37 2009 From: ok@REDACTED (Richard O'Keefe) Date: Tue, 24 Feb 2009 12:31:37 +1300 Subject: [erlang-questions] arity part of function name and variadic functions In-Reply-To: <3cbaf1c80902221225pf14513sf93e46a90228d595@mail.gmail.com> References: <3cbaf1c80902221225pf14513sf93e46a90228d595@mail.gmail.com> Message-ID: On 23 Feb 2009, at 9:25 am, Peter Michaux wrote: > I'm reading Joe Armstrong's "Programming Erlang: Software for a > Concurrent World". Two stand out features of Erlang are > > 1) a function's arity is part of its name and > 2) there are no variadic functions. > > What are the benefits of these two features from a language design > perspective? (1) One practical merit of this is that it gives you optional arguments in a very simple way. Another is that there isn't any need (as there is in Lisp) for run-time code to check that the number of arguments is right. If you arrived at f/N, you have N arguments. (2) What would you want variadic functions for? If you want to pass a variable number of items, pass a list or a tuple. If you want *two* groups of arguments that vary in number, such as a command to send several messages to several processes, just pass two lists. You aren't left wondering which of them gets to be the only variable group. This approach is inherited from Strand88, which inherit it from Prolog, where it is due to some definitions of logic. There have been versions of Prolog, notably M-Prolog, where the module system was based on atoms rather than atom/arity pairs. This made it impossible to export f/1 without also exporting f/2, which was remarkably unpleasant. I note that in the more conventional functional languages ML, Haskell, and Clean, every function has the same fixed arity: 1. > Would the opposite choices have caused bad interaction with the > process-based concurrency model or some other part of the language? It's hard to tell what might have been, but probably not. From erlangy@REDACTED Tue Feb 24 00:34:37 2009 From: erlangy@REDACTED (Michael McDaniel) Date: Mon, 23 Feb 2009 15:34:37 -0800 Subject: [erlang-questions] Regex to match an empty string In-Reply-To: <49A331C9.4040105@catalyst.net.nz> References: <49A331C9.4040105@catalyst.net.nz> Message-ID: <20090223233436.GQ22018@delora.autosys.us> $ erl Erlang (BEAM) emulator version 5.6.5 [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.6.5 (abort with ^G) 1> re:run("", "^$"). {match,[{0,0}]} 2> q(). $ ~M On Tue, Feb 24, 2009 at 12:31:21PM +1300, Vik Olliver wrote: > I'm trying to spot a parameter that is an empty string. The weapon of > choice is regexp:first_match/2 which is used in the code that parses the > config file. > > In other worlds, "^$" matches an empty string. In Erlang, not so: > > 5> regexp:first_match("","^$"). > nomatch > > > What do I use instead? > > Vik :v) > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Michael McDaniel Portland, Oregon, USA http://autosys.us From vik@REDACTED Tue Feb 24 00:51:00 2009 From: vik@REDACTED (Vik Olliver) Date: Tue, 24 Feb 2009 12:51:00 +1300 Subject: [erlang-questions] Regex to match an empty string In-Reply-To: <20090223233436.GQ22018@delora.autosys.us> References: <49A331C9.4040105@catalyst.net.nz> <20090223233436.GQ22018@delora.autosys.us> Message-ID: <49A33664.9070105@catalyst.net.nz> Michael McDaniel wrote: > $ erl > Erlang (BEAM) emulator version 5.6.5 [async-threads:0] [hipe] [kernel-poll:false] > > Eshell V5.6.5 (abort with ^G) > 1> re:run("", "^$"). > {match,[{0,0}]} > 2> q(). > > $ > Blast. Erlang (BEAM) emulator version 5.6.1 [source] [smp:2] [async-threads:0] [hipe] [kernel-poll:false] ... 8> re:run("", "^$"). ** exception error: undefined function re:run/2 I have to make this run on existing production code. Vik :v) From bbmaj7@REDACTED Mon Feb 23 23:58:28 2009 From: bbmaj7@REDACTED (Richard Andrews) Date: Mon, 23 Feb 2009 14:58:28 -0800 (PST) Subject: [erlang-questions] Erlang VM segfault? References: Message-ID: <422247.63079.qm@web65503.mail.ac4.yahoo.com> ----- Original Message ---- > My first thought was to watch the segfault with GDB to see if that > illuminated anything. It didn't really. I've pasted the first 10 > frames for reference. I figured I might as well scroll down to the > 58,214th frame, but at about 58,203 gdb segfaulted. My first thought looking at this is that there is an infinite recursion in the C code. How else does one arrive at 58 thousand stack frames. Your beam process probably ran out of stack. You could try something like ulimit -s to bump up the stack limit. But I think this is only pushing the problem sideways. Perhaps there is non-tail-recursive erlang code in a processing loop. *shrug* Make Yahoo!7 your homepage and win a trip to the Quiksilver Pro. Find out more From ok@REDACTED Tue Feb 24 01:14:55 2009 From: ok@REDACTED (Richard O'Keefe) Date: Tue, 24 Feb 2009 13:14:55 +1300 Subject: [erlang-questions] : abstract patterns vs macros was:( Floating guard sequences) In-Reply-To: <4d08db370902230207w3fc29c7aua259b0369b768616@mail.gmail.com> References: <20090217221350.GA6592@herbie> <2BE36673-CDE2-405D-8336-FE45304A16FE@cs.otago.ac.nz> <3E9FE23F-EA09-417A-8054-85135F4B6C71@fess.org> <20090220004435.GR26906@n54.com> <20090220083245.GA29395@erix.ericsson.se> <22118636.post@talk.nabble.com> <2033EE1C-2038-440C-86B3-BE4C8D27FBCE@cs.otago.ac.nz> <4d08db370902230207w3fc29c7aua259b0369b768616@mail.gmail.com> Message-ID: <1F1CA49B-F6E4-4804-AD49-0108CFD719E9@cs.otago.ac.nz> On 23 Feb 2009, at 11:07 pm, Hynek Vychodil wrote: > Is there way how to define combined patterns like range and odd > without define extra new patter for it. Inside a pattern, the arguments of an abstract pattern may themselves be patterns. Roughly speaking, ... #f(P1, ..., Pn) ... is like ... X0 ... when {P1,...,Pn} = '#f'(X0) This means that #range(1, 10, #odd(X)) should work. But Erlang also has P1 = P2 in patterns, so you should be able to write ... #range(1,10,X) = #odd(X) ... There is such a thing as pushing a notation too far, and this is getting close. From rvirding@REDACTED Tue Feb 24 01:18:11 2009 From: rvirding@REDACTED (Robert Virding) Date: Tue, 24 Feb 2009 01:18:11 +0100 Subject: [erlang-questions] Regex to match an empty string In-Reply-To: <49A331C9.4040105@catalyst.net.nz> References: <49A331C9.4040105@catalyst.net.nz> Message-ID: <3dbc6d1c0902231618j17575f06vc76bcd648f136527@mail.gmail.com> Can't you instead just pattern match the string against "" or [] (they are equal)? Using regular expressions for so simple patterns is really overkill. Robert P.S. Yes that is probably a bug. 2009/2/24 Vik Olliver > I'm trying to spot a parameter that is an empty string. The weapon of > choice is regexp:first_match/2 which is used in the code that parses the > config file. > > In other worlds, "^$" matches an empty string. In Erlang, not so: > > 5> regexp:first_match("","^$"). > nomatch > > > What do I use instead? > > Vik :v) > _______________________________________________ > 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 Tue Feb 24 01:22:57 2009 From: ok@REDACTED (Richard O'Keefe) Date: Tue, 24 Feb 2009 13:22:57 +1300 Subject: [erlang-questions] Abstract patterns, structs and frames In-Reply-To: <297487.67048.qm@web65501.mail.ac4.yahoo.com> References: <95be1d3b0902230008t19366c10saa2fa07a61ad8649@mail.gmail.com> <297487.67048.qm@web65501.mail.ac4.yahoo.com> Message-ID: <61BF0BC1-A661-4C2C-A5E0-CF73DE6C84C5@cs.otago.ac.nz> On 24 Feb 2009, at 12:31 am, Richard Andrews wrote: >> Yes, it means that both Abstract Patterns and (Frames or Structs) >> might be implemented. > > As best I can understand - after reading the papers by Richard > O'Keef and Joe Armstrong - structs and frames are trying to solve > pretty much the same problem and the main distinction appears to be > that structs are named/tagged while frames are defined only by their > content. Actually, tags are _optional_ in the frames proposal. is allowed, and is equivalent to <{'' = Tag, K1=E1, ..., Kn=En }> > I don't see a need for the tag (ie. struct) and I think it might be > a problem in some cases. Having tried to convert some large chunks of Erlang from records to frames, I can say that it really helps a lot having a place to put the record name. And when you have a function with two or more frame arguments, it can help you keep track of which is which. I'm not yet convinced that tags are _essential_, but they are definitely too useful to forbid. > What situations can people see where the struct tag is better than > say, tag=someTagAtom in a frame? It ensures that everyone uses the _same_ name for the tag field (namely ''), it ensures that the name is an atom ('' should be forbidden as a field name), it provides a hook for pretty-printers &c, it increases readability. The frames proposal and the struct proposal are essentially the same thing. There are minor differences of syntax, and I've listed a lot more BIFs that should be provided, but nobody should think that there are two rival proposals, just two independent drafts of the same proposal. > From vik@REDACTED Tue Feb 24 03:12:51 2009 From: vik@REDACTED (Vik Olliver) Date: Tue, 24 Feb 2009 15:12:51 +1300 Subject: [erlang-questions] Regex to match an empty string In-Reply-To: <3dbc6d1c0902231618j17575f06vc76bcd648f136527@mail.gmail.com> References: <49A331C9.4040105@catalyst.net.nz> <3dbc6d1c0902231618j17575f06vc76bcd648f136527@mail.gmail.com> Message-ID: <49A357A3.6090301@catalyst.net.nz> On 24/02/09 Robert Virding wrote: > Can't you instead just pattern match the string against "" or [] > (they are equal)? Using regular expressions for so simple patterns is > really overkill. No, as the code is already in production and will need re-testing if I change it - a tedious process. Plan B is to write a wrapper for regex that knows how to handle $^ and empty strings. The program's magic is all done by config file changes, and a regex is used to match that particular field. Regexes elsewhere can match an empty string. Can Erlang? If the answer is "no, it's broken" I need to know so I can schedule a software update etc. Vik :v) From bbmaj7@REDACTED Tue Feb 24 03:56:34 2009 From: bbmaj7@REDACTED (Richard Andrews) Date: Mon, 23 Feb 2009 18:56:34 -0800 (PST) Subject: [erlang-questions] Abstract patterns, structs and frames References: <95be1d3b0902230008t19366c10saa2fa07a61ad8649@mail.gmail.com> <297487.67048.qm@web65501.mail.ac4.yahoo.com> <61BF0BC1-A661-4C2C-A5E0-CF73DE6C84C5@cs.otago.ac.nz> Message-ID: <319169.77192.qm@web65505.mail.ac4.yahoo.com> > > I don't see a need for the tag (ie. struct) and I think it might be a problem > in some cases. > > Having tried to convert some large chunks of Erlang from records > to frames, I can say that it really helps a lot having a place to > put the record name. And when you have a function with two or > more frame arguments, it can help you keep track of which is which. > > I'm not yet convinced that tags are _essential_, but they are > definitely too useful to forbid. I agree whole-heartedly with an optional tag - but it should be a convention, in the same way that record names appear as the first element in a tuple. I woudl like to see a tagged frame syntax as a convenience; in the way records were added as a convenience for tuples. eg. ~tagName{} =:= <{''=tagName}> (or whatever the current syntax is imagined to be) The OP stated structs *or* frames would be considered in an EEP. Can't we have both? -- Rich Make Yahoo!7 your homepage and win a trip to the Quiksilver Pro. Find out more From ok@REDACTED Tue Feb 24 05:03:27 2009 From: ok@REDACTED (Richard O'Keefe) Date: Tue, 24 Feb 2009 17:03:27 +1300 Subject: [erlang-questions] Abstract patterns, structs and frames In-Reply-To: <319169.77192.qm@web65505.mail.ac4.yahoo.com> References: <95be1d3b0902230008t19366c10saa2fa07a61ad8649@mail.gmail.com> <297487.67048.qm@web65501.mail.ac4.yahoo.com> <61BF0BC1-A661-4C2C-A5E0-CF73DE6C84C5@cs.otago.ac.nz> <319169.77192.qm@web65505.mail.ac4.yahoo.com> Message-ID: On 24 Feb 2009, at 3:56 pm, Richard Andrews wrote: > I agree whole-heartedly with an optional tag - but it should be a > convention, in the same way that record names appear as the first > element in a tuple. I woudl like to see a tagged frame syntax as a > convenience; in the way records were added as a convenience for > tuples. From a .y file I've been using: pattern : WILD | ... | lf frame_pattern RC GTR ; lf : LSS LC | LSS atom_or_var LC ; frame_pattern : | field_pattern_list ; field_pattern_list : field_pattern_list COMMA ATOM TILDE pattern | ATOM TILDE pattern ; primary : atom_or_var | ... | lf frame_expression RC GTR ; frame_expression : | field_expression_list expression_tail ; field_expression_list : field_expression_list COMMA ATOM TILDE expression | ATOM TILDE expression ; So you can write things like <{ year ~ Year, month ~ Month }> = Why did I switch from = here to ~ ? Because I want to keep things simple: = means matching, so let it _always_ mean matching, never anything else. (The programming language S used to use <- for assignment, == for equality testing, and = for keyword=argument. Succumbing to pressure from C, they decided to allow = as a synonym for assignment, and R followed, not that the R team had much choice if R was to remain usefully compatible with S. The result is that when I see R code these days I have to beware of the difference between f(x = 1) # pass 1 to parameter called x and f((x = 1)) # assign 1 to x and pass at as 1st param I honestly cannot see this as an improvement. I don't want a similar confusion between X = 1 and x = 1 in Erlang.) Why ~ ? Because that's what Xerox PARC used in a series of interesting papers. There really is no substitute for trying things out. I wanted <{ ... | ... }> syntax to let me make incremental updates to a frame. By symmetry, <{ a ~..., b ~ ... }> as a pattern would have matched only frames with only those two fields; to match something with more you'd have needed <{ a ~ ..., b ~ ... | _ }>, and after a while it got quite annoying to keep on having to write |_. So I decided that frame patterns should be like record patterns in some other languages and always allow any other fields, symmetry or no symmetry. > The OP stated structs *or* frames would be considered in an EEP. > Can't we have both? Syntax aside, they are basically the same thing. From bgustavsson@REDACTED Tue Feb 24 09:04:41 2009 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Tue, 24 Feb 2009 09:04:41 +0100 Subject: [erlang-questions] Erlang VM segfault? In-Reply-To: References: Message-ID: <6672d0160902240004h60346e43r75c51627b67011cd@mail.gmail.com> On Mon, Feb 23, 2009 at 9:44 PM, Paul Davis wrote: > As weird as it sounds, I've come across a repeatable segfault in > erlang. I haven't minimized it to a simple test case yet, but I > figured I'd describe it and give some GDB output in case it triggers > an idea from anyone. > > The context of the segfault is when working in CouchDB with documents > that have a 29,107 element revision history. I'm only specific on the > 29,107 because I duplicated in two databases with two different docs > and both of them are exactly 29,107. No idea if that's important. > > My first thought was to watch the segfault with GDB to see if that > illuminated anything. It didn't really. I've pasted the first 10 > frames for reference. I figured I might as well scroll down to the > 58,214th frame, but at about 58,203 gdb segfaulted. > > With some help from a couple of the guys in #erlang@REDACTED I > tried bumping the atom table sizes to see if that was the issue. After > changing both the ATOM_SIZE and ATOM_LIMIT define's to 1GiB I'm still > getting segfaults. > > Next on the list is to try R12B-5. > > Anyone have any thoughts? > > Thanks, > Paul Davis > The conversion from an Erlang term to the external format is currently implemented as a recursive C function. It is on our TO-DO list to rewrite this function (and some other functions) to use an explicit stack instead of the C stack. As a workaround until we fix the issue, you can try increasing the C stack size. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From steven.charles.davis@REDACTED Tue Feb 24 11:25:01 2009 From: steven.charles.davis@REDACTED (Steve Davis) Date: Tue, 24 Feb 2009 02:25:01 -0800 (PST) Subject: [erlang-questions] The Beauty of Erlang Syntax Message-ID: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> Like many people from a Java/C++ background, my first reaction to Erlang was abhorrence at the syntax. After some months of real-world experience of actually using Erlang, I feel compelled to make a couple of observations. - Erlang has the greatest expressive power of any language I have used (caveat: I have not used Haskell or any other FP language). - Erlang is an intensely practical language. The platform libraries make it very easy to write useful applications. - Erlang is easy to write... once you know what you are trying to achieve. The challenge is that it asks you to think hard about what you actually want to do. Once that part is clear, everything becomes extremely simple and straightforward. This quality makes this language extremely powerful and "cruft-free". - There can be no doubt lambda calculus is "ultimate". A more trivial way of saying this is that all computer processing is simply transforming one bit pattern into another bit pattern f(X) -> X' - Elegant programming in Erlang is much more of a challenge than with OO languages where "what is right" is fairly easy to understand. Erlang feeds the creative soul in a way that's just not evident or truly possible "in the kingdom of nouns". - The medium/long term future of hardware cannot be anything but FPGAs and I cannot imagine any multithreaded dance in Java/C++ that can possibly keep up with this trend. With Erlang, I feel that I can cope with the next decade. I will never willingly program in an imperative language again. /sd From pfisher@REDACTED Tue Feb 24 13:37:20 2009 From: pfisher@REDACTED (Paul Fisher) Date: Tue, 24 Feb 2009 06:37:20 -0600 Subject: [erlang-questions] Strange bus error 7 with HiPE R12B-5 + patch In-Reply-To: <49A353C6.5060302@alertlogic.net> References: <49A353C6.5060302@alertlogic.net> Message-ID: <49A3EA00.80606@alertlogic.net> I sent this to erlang-bugs last night and it has not shown up as of yet... Trying to erlang-questions in the hopes that someone can still look and give some guidance/assistance today. thx Paul Fisher wrote: > We have been having strange core dumps happen occasionally in our > environment, most of which end up with a stack trace like the following: > > (gdb) where > #0 0x0000000045050b39 in ?? () > #1 0x00002aaaabe25922 in ?? () > #2 0x000000000000078f in ?? () > #3 0x0000000000000000 in ?? () > > This happens on thread 1... the one that ends up running > erts_sys_main_thread(). Pretty weird. > > Today, i got a core dump on the same thread, while it was running > gensweep_nstack(). What follows is my brief trolling through the dump > and just following things until it was clear how we ended up at the > problem. > > I would love if someone could help further the diagnosis beyond this > point, because I'm not sure where to look beyond this. Without HiPE > compilation (which we do on most of our modules) these problems do not > occur, so it does seem to point to a HiPE related issue. > > The environment is a 4 core, Core 2 Q6600, 4 G ECC memory with the > emulator running SMP and running 64-bit. > > cluster-14:/var/alertlogic# uname -a > Linux cluster-14 2.6.24-etchnhalf.1-amd64 #1 SMP Fri Dec 26 03:26:12 UTC > 2008 x86_64 GNU/Linux > > Anyway, here is the gdb session: > > Core was generated by `/usr/lib/erlang/erts-5.6.5/bin/beam.smp -Ktrue -W > w -A 32 -a 128 -d -- -root /u'. > Program terminated with signal 7, Bus error. > #0 gensweep_nstack (p=0x2aaaade37808, ptr_old_htop=0x44048b28, > ptr_n_htop=0x44048b20) at hipe/hipe_stack.h:70 > 70 if (likely(sdesc->bucket.hvalue == ra)) > (gdb) where > #0 gensweep_nstack (p=0x2aaaade37808, ptr_old_htop=0x44048b28, > ptr_n_htop=0x44048b20) at hipe/hipe_stack.h:70 > #1 0x00000000004bfc35 in minor_collection (p=0x2aaaade37808, need=2, > objv=0x0, nobj=0, recl=0x44048e68) at beam/erl_gc.c:893 > #2 0x00000000004c0761 in erts_garbage_collect (p=0x2aaaade37808, need=2, > objv=0x0, nobj=0) at beam/erl_gc.c:374 > #3 0x000000000050ae1f in hipe_gc (p=0x1b9b860, need=46912528116752) > at hipe/hipe_native_bif.c:69 > #4 0x000000000050be74 in nbif_gc_1 () > at x86_64-unknown-linux-gnu/opt/smp/hipe_amd64_bifs.S:540 > #5 0x00002aaaade37808 in ?? () > #6 0x00002aaaade37a80 in ?? () > #7 0x0000000000000007 in ?? () > #8 0x00002aaaaaaed9c0 in ?? () > #9 0x00002aaaabe8f0c8 in ?? () > #10 0x00002aaaabe937d8 in ?? () > #11 0x00002aaaabe937d8 in ?? () > #12 0x0000000000509ce4 in hipe_mode_switch (p=0x2aaaade37808, > cmd=2895309840, > reg=0x2aaaaaaed9c0) at hipe/hipe_x86_glue.h:196 > #13 0x00000000004dd97b in process_main () at beam/beam_emu.c:4681 > #14 0x000000000048100f in sched_thread_func (vesdp=) > at beam/erl_process.c:752 > #15 0x0000000000549f24 in thr_wrapper (vtwd=) > ---Type to continue, or q to quit--- > at common/ethread.c:474 > #16 0x00002afcecf9ef1a in start_thread () from /lib/libpthread.so.0 > #17 0x00002afced2815d2 in sysctl () from /lib/libc.so.6 > #18 0x0000000000000000 in ?? () > (gdb) p ra > $1 = 1159839139 > (gdb) p *sdesc > Cannot access memory at address 0x7d337b25097d327b > (gdb) list > 65 > 66 static __inline__ const struct sdesc *hipe_find_sdesc(unsigned long ra) > 67 { > 68 unsigned int i = (ra >> HIPE_RA_LSR_COUNT) & hipe_sdesc_table.mask; > 69 const struct sdesc *sdesc = hipe_sdesc_table.bucket[i]; > 70 if (likely(sdesc->bucket.hvalue == ra)) > 71 return sdesc; > 72 do { > 73 sdesc = sdesc->bucket.next; > 74 } while (sdesc->bucket.hvalue != ra); > (gdb) p i > $2 = 1 > (gdb) p hipe_sdesc_table > $3 = { > log2size = 16, > mask = 65535, > used = 26215, > bucket = 0x2aaaadc35010 > } > (gdb) p hipe_sdesc_table.bucket[1] > $4 = (struct sdesc *) 0x8f2c50 > (gdb) p *hipe_sdesc_table.bucket[1] > $5 = { > bucket = { > hvalue = 1159004161, > next = 0x85ab30 > }, > summary = 2048, > livebits = {14} > } > (gdb) p *hipe_sdesc_table.bucket[1]->bucket.next > $6 = { > bucket = { > hvalue = 1158348801, > next = 0x819410 > }, > summary = 1536, > livebits = {1} > } > (gdb) p *hipe_sdesc_table.bucket[1]->bucket.next->bucket.next > $7 = { > bucket = { > hvalue = 1158283265, > next = 0x0 > }, > summary = 2048, > livebits = {0} > } > (gdb) p *hipe_sdesc_table.bucket[1]->bucket.next->bucket.next->bucket.next > Cannot access memory at address 0x0 > (gdb) i threads > 40 process 24151 0x00002afced27aa96 in getdomainname () from > /lib/libc.so.6 > 39 process 24153 0x00002afcecfa41bf in __read_nocancel () > from /lib/libpthread.so.0 > 38 process 24156 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 37 process 24158 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 36 process 24159 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 35 process 24160 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 34 process 24161 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 33 process 24162 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 32 process 24163 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 31 process 24164 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 30 process 24165 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 29 process 24166 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > ---Type to continue, or q to quit--- > 28 process 24167 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 27 process 24168 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 26 process 24169 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 25 process 24170 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 24 process 24171 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 23 process 24172 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 22 process 24173 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 21 process 24174 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 20 process 24175 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 19 process 24176 0x00002afcecfa412f in __write_nocancel () > from /lib/libpthread.so.0 > 18 process 24177 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 17 process 24178 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > ---Type to continue, or q to quit--- > from /lib/libpthread.so.0 > 16 process 24179 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 15 process 24180 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 14 process 24181 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 13 process 24182 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 12 process 24183 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 11 process 24184 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 10 process 24185 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 9 process 24186 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 8 process 24187 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 7 process 24188 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 6 process 24189 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > ---Type to continue, or q to quit--- > 5 process 24190 0x00002afcecfa500f in waitpid () from > /lib/libpthread.so.0 > 4 process 24197 0x00002afcecfa1b3a in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/libpthread.so.0 > 3 process 24199 0x00002afced2819ac in capset () from /lib/libc.so.6 > 2 process 24200 0x00002afced22b90d in memmove () from /lib/libc.so.6 > * 1 process 24198 gensweep_nstack (p=0x2aaaade37808, > ptr_old_htop=0x44048b28, > ptr_n_htop=0x44048b20) at hipe/hipe_stack.h:70 > (gdb) t 19 > [Switching to thread 19 (process 24176)]#0 0x00002afcecfa412f in > __write_nocancel () from /lib/libpthread.so.0 > (gdb) where > #0 0x00002afcecfa412f in __write_nocancel () from /lib/libpthread.so.0 > #1 0x00000000004f7757 in efile_writev (errInfo=0x7d9e24, > flags=, fd=34, iov=0x7c2098, iovcnt=1, > size=229146) > at drivers/unix/unix_efile.c:1109 > #2 0x000000000051769a in invoke_writev (data=) > at drivers/common/efile_drv.c:1175 > #3 0x00000000004be255 in async_main (arg=) > at beam/erl_async.c:242 > #4 0x0000000000549f24 in thr_wrapper (vtwd=) > at common/ethread.c:474 > #5 0x00002afcecf9ef1a in start_thread () from /lib/libpthread.so.0 > #6 0x00002afced2815d2 in sysctl () from /lib/libc.so.6 > #7 0x0000000000000000 in ?? () > > > -- > paul > From mikpe@REDACTED Tue Feb 24 15:12:32 2009 From: mikpe@REDACTED (Mikael Pettersson) Date: Tue, 24 Feb 2009 15:12:32 +0100 Subject: [erlang-questions] Strange bus error 7 with HiPE R12B-5 + patch In-Reply-To: <49A3EA00.80606@alertlogic.net> References: <49A353C6.5060302@alertlogic.net> <49A3EA00.80606@alertlogic.net> Message-ID: <18852.80.136411.129209@harpo.it.uu.se> Paul Fisher writes: > I sent this to erlang-bugs last night and it has not shown up as of > yet... Trying to erlang-questions in the hopes that someone can still > look and give some guidance/assistance today. > > thx > > Paul Fisher wrote: > > We have been having strange core dumps happen occasionally in our > > environment, most of which end up with a stack trace like the following: > > > > (gdb) where > > #0 0x0000000045050b39 in ?? () > > #1 0x00002aaaabe25922 in ?? () > > #2 0x000000000000078f in ?? () > > #3 0x0000000000000000 in ?? () > > > > This happens on thread 1... the one that ends up running > > erts_sys_main_thread(). Pretty weird. > > > > Today, i got a core dump on the same thread, while it was running > > gensweep_nstack(). What follows is my brief trolling through the dump > > and just following things until it was clear how we ended up at the > > problem. > > > > I would love if someone could help further the diagnosis beyond this > > point, because I'm not sure where to look beyond this. Without HiPE > > compilation (which we do on most of our modules) these problems do not > > occur, so it does seem to point to a HiPE related issue. > > > > The environment is a 4 core, Core 2 Q6600, 4 G ECC memory with the > > emulator running SMP and running 64-bit. > > > > cluster-14:/var/alertlogic# uname -a > > Linux cluster-14 2.6.24-etchnhalf.1-amd64 #1 SMP Fri Dec 26 03:26:12 UTC > > 2008 x86_64 GNU/Linux > > > > Anyway, here is the gdb session: > > > > Core was generated by `/usr/lib/erlang/erts-5.6.5/bin/beam.smp -Ktrue -W > > w -A 32 -a 128 -d -- -root /u'. > > Program terminated with signal 7, Bus error. > > #0 gensweep_nstack (p=0x2aaaade37808, ptr_old_htop=0x44048b28, > > ptr_n_htop=0x44048b20) at hipe/hipe_stack.h:70 > > 70 if (likely(sdesc->bucket.hvalue == ra)) > > (gdb) where > > #0 gensweep_nstack (p=0x2aaaade37808, ptr_old_htop=0x44048b28, > > ptr_n_htop=0x44048b20) at hipe/hipe_stack.h:70 > > #1 0x00000000004bfc35 in minor_collection (p=0x2aaaade37808, need=2, > > objv=0x0, nobj=0, recl=0x44048e68) at beam/erl_gc.c:893 > > #2 0x00000000004c0761 in erts_garbage_collect (p=0x2aaaade37808, need=2, > > objv=0x0, nobj=0) at beam/erl_gc.c:374 > > #3 0x000000000050ae1f in hipe_gc (p=0x1b9b860, need=46912528116752) > > at hipe/hipe_native_bif.c:69 > > #4 0x000000000050be74 in nbif_gc_1 () > > at x86_64-unknown-linux-gnu/opt/smp/hipe_amd64_bifs.S:540 > > #5 0x00002aaaade37808 in ?? () > > #6 0x00002aaaade37a80 in ?? () > > #7 0x0000000000000007 in ?? () > > #8 0x00002aaaaaaed9c0 in ?? () > > #9 0x00002aaaabe8f0c8 in ?? () > > #10 0x00002aaaabe937d8 in ?? () > > #11 0x00002aaaabe937d8 in ?? () > > #12 0x0000000000509ce4 in hipe_mode_switch (p=0x2aaaade37808, > > cmd=2895309840, > > reg=0x2aaaaaaed9c0) at hipe/hipe_x86_glue.h:196 > > #13 0x00000000004dd97b in process_main () at beam/beam_emu.c:4681 > > #14 0x000000000048100f in sched_thread_func (vesdp=) > > at beam/erl_process.c:752 > > #15 0x0000000000549f24 in thr_wrapper (vtwd=) > > ---Type to continue, or q to quit--- > > at common/ethread.c:474 > > #16 0x00002afcecf9ef1a in start_thread () from /lib/libpthread.so.0 > > #17 0x00002afced2815d2 in sysctl () from /lib/libc.so.6 > > #18 0x0000000000000000 in ?? () Yes it looks like something in HiPE. However, without a test case there is essentially nothing anyone can do to debug it. From Philip.Fennell@REDACTED Tue Feb 24 15:40:57 2009 From: Philip.Fennell@REDACTED (Philip Fennell) Date: Tue, 24 Feb 2009 14:40:57 -0000 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> Message-ID: Steve, I whole heartedly agree with you. For myself I've never really enjoyed Java and for most of my programming career I've been up to my neck in XSLT so the transition into Erlang was less of a jump and more of a side-step. > Erlang is an intensely practical language Yep, you're right on the money there. IMHO, I find Java, for example, actually throws obstacles in your way all the time but Erlang, by contrast, just seems to have the tools for the job and an elegant way of expressing them. I have been pottering around with Erlang for the last six months and have been more than happy with it. Thank you for putting into good words what's been in the back of my mind for a while now. Regards Philip Fennell -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Steve Davis Sent: 24 February 2009 10:25 To: erlang-questions@REDACTED Subject: [erlang-questions] The Beauty of Erlang Syntax Like many people from a Java/C++ background, my first reaction to Erlang was abhorrence at the syntax. After some months of real-world experience of actually using Erlang, I feel compelled to make a couple of observations. - Erlang has the greatest expressive power of any language I have used (caveat: I have not used Haskell or any other FP language). - Erlang is an intensely practical language. The platform libraries make it very easy to write useful applications. - Erlang is easy to write... once you know what you are trying to achieve. The challenge is that it asks you to think hard about what you actually want to do. Once that part is clear, everything becomes extremely simple and straightforward. This quality makes this language extremely powerful and "cruft-free". - There can be no doubt lambda calculus is "ultimate". A more trivial way of saying this is that all computer processing is simply transforming one bit pattern into another bit pattern f(X) -> X' - Elegant programming in Erlang is much more of a challenge than with OO languages where "what is right" is fairly easy to understand. Erlang feeds the creative soul in a way that's just not evident or truly possible "in the kingdom of nouns". - The medium/long term future of hardware cannot be anything but FPGAs and I cannot imagine any multithreaded dance in Java/C++ that can possibly keep up with this trend. With Erlang, I feel that I can cope with the next decade. I will never willingly program in an imperative language again. /sd _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions http://www.bbc.co.uk/ This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated. If you have received it in error, please delete it from your system. Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately. Please note that the BBC monitors e-mails sent or received. Further communication will signify your consent to this. From dmercer@REDACTED Tue Feb 24 16:06:50 2009 From: dmercer@REDACTED (David Mercer) Date: Tue, 24 Feb 2009 09:06:50 -0600 Subject: [erlang-questions] Element Typing in Record Declarations? Message-ID: <70D595DB81BB4147A789A50F922A1772@SSI.CORP> I just noticed in dict.erl: -record(dict, {size=0 ::integer(), % Number of elements n=?seg_size ::integer(), % Number of active slots maxn=?seg_size ::integer(), % Maximum slots bso=?seg_size div 2 ::integer(), % Buddy slot offset exp_size=?exp_size ::integer(), % Size to expand at con_size=?con_size ::integer(), % Size to contract at empty, % Empty segment segs ::tuple() % Segments }). It appears that Erlang supports type declarations in record declarations, but I could not find this syntax in the Erlang reference documentation. Is there any documentation on this, and what effect it has on the system? -------------- next part -------------- An HTML attachment was scrubbed... URL: From chsu79@REDACTED Tue Feb 24 16:25:16 2009 From: chsu79@REDACTED (Christian) Date: Tue, 24 Feb 2009 16:25:16 +0100 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> Message-ID: On Tue, Feb 24, 2009 at 11:25, Steve Davis wrote: > - Erlang is easy to write... once you know what you are trying to > achieve. The challenge is that it asks you to think hard about what > you actually want to do. Once that part is clear, everything becomes > extremely simple and straightforward. This quality makes this language > extremely powerful and "cruft-free". > > - There can be no doubt lambda calculus is "ultimate". ?A more trivial > way of saying this is that all computer processing is simply > transforming one bit pattern into another bit pattern f(X) -> X' > > - Elegant programming in Erlang is much more of a challenge than with > OO languages where "what is right" is fairly easy to understand. > Erlang feeds the creative soul in a way that's just not evident or > truly possible "in the kingdom of nouns". While it is nice that you like Erlang, I don't think your arguments will work very well to convince somebody to try Erlang. You sound more like http://www.urbandictionary.com/define.php?term=drink+the+kool-aid. Believe me, there can be doubt about lambda calculus being "ultimate". This is the internet, and your argument is WEAK. Phrases like "elegant", "what is right", "creative soul" do simply not work. Try a Java guy sometimes, they will dislike that Erlang * is not Java * is not running on the JVM * is not equipped with classes nor the object-dot-metod-arglist syntax * is just plain different and academic for no practical advantage * is not doing anything you couldn't do with Java using NIO, blocking queues, and something called osgi they read about in a trade mag but haven't used personally yet * is unimportant now that Scala exists * is unimportant because Kilim is adding cheap actors to Java ... and then continue with weak reasons. The human being is not rational. The human being rationalizes its irrational choices though. Argumenting with emotions wont work since they have strong emotions in favour of OOP already. I used to think that I liked erlang programming just because it was quite academic, and that this was just a personal preference. But I have come to realize that side-effect free programming is easier to reason about. Not always easier to write though. Being easier to reason about means that I can imagine more execution in my head than I can in languages that rebind variables and mutate values. Because those destructive changes defines a before-change, and after-change, sequence, order, and there are only so many steps one can keep the mind without the brain starting to lie to you, filling out the blanks without telling you. I recently read an article published in idg.se where Erik Stenman of kreditor was quoted saying that (something like) java systems grow complex over time in a way that Erlang does not as much. This is something I experience with Java systems. In Java there is no cost in adding more things that keep state. It is said that you just encapsulate state it in your object, but that state is not as encapsulated as you think. Problems are fixed by adding more things with state, and more. and more. Pretty soon you have behavior that depends on several hundred mutable variables, and the code-base feels hard to grasp, difficult to reason back into previous code execution to see the "big picture". It makes architectural fixes more difficult. And the problems accelerates, since more quick fixes are added. (I really need to get better at describing this.) The funny thing is that the OOP world have found one way to manage the complexity and the code-bases that grow ugly: They are using unit tests, and practice the art of writing testable code. ("Testable code" is something that is simple to write unit tests for. ) * You make it very easy to supply the dependencies to code under test need. Avoid things that go out and grab values from global state. * You avoid side-effects, and the side-effects you need (database updates, writing files etc) you make sure that you perform with a layer of indirection so that during tests you can replace the real object with (for example) a do-nothing mock. What they are doing is that they are making as much of their code as possible to be side-effect free and placing all that code in one method so it can be called from a unit test. They are concentrating side-effects to well-defined places, carefully avoiding mixing side-effects and testable/test-worthy logic. What they are doing is that they're reinventing functional programming. PS Anyone care to make my argument better or shoot it down? From kostis@REDACTED Tue Feb 24 16:32:35 2009 From: kostis@REDACTED (Kostis Sagonas) Date: Tue, 24 Feb 2009 17:32:35 +0200 Subject: [erlang-questions] Element Typing in Record Declarations? In-Reply-To: <70D595DB81BB4147A789A50F922A1772@SSI.CORP> References: <70D595DB81BB4147A789A50F922A1772@SSI.CORP> Message-ID: <49A41313.2030003@cs.ntua.gr> David Mercer wrote: > I just noticed in dict.erl: > > ... > > It appears that Erlang supports type declarations in record > declarations, but I could not find this syntax in the Erlang reference > documentation. Is there any documentation on this, and what effect it > has on the system? The documentation on this is currently an EEP: http://www.erlang.org/eeps/eep-0008.html This type information is used by Dialyzer to detect discrepancies between the declared types of record fields and their actual uses. Kostis From drcabana@REDACTED Tue Feb 24 17:38:44 2009 From: drcabana@REDACTED (David Cabana) Date: Tue, 24 Feb 2009 11:38:44 -0500 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> Message-ID: <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> Christian wrote: > I used to think that I liked erlang programming just because it was > quite academic, and that this was just a personal preference. I'm curious what you mean by saying that Erlang is "academic". If you were talking about Haskell (for instance) I could go understand. But Erlang was built by people working in industry, with the goal of supporting the development of commercial products. It doesn't get much more pragmatic than that. In what sense is Erlang academic? drc From masse@REDACTED Tue Feb 24 17:53:12 2009 From: masse@REDACTED (mats cronqvist) Date: Tue, 24 Feb 2009 17:53:12 +0100 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> (David Cabana's message of "Tue\, 24 Feb 2009 11\:38\:44 -0500") References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> Message-ID: <87ocwrpyiv.fsf@sterlett.hq.kred> David Cabana writes: > Christian wrote: > >> I used to think that I liked erlang programming just because it was >> quite academic, and that this was just a personal preference. > > I'm curious what you mean by saying that Erlang is "academic". "functional" is a subset of "academic." mats From tsuraan@REDACTED Tue Feb 24 17:54:04 2009 From: tsuraan@REDACTED (tsuraan) Date: Tue, 24 Feb 2009 10:54:04 -0600 Subject: [erlang-questions] Tuple memory size In-Reply-To: <18847.1323.673784.571359@harpo.it.uu.se> References: <84fb38e30902200730v5d438db7y6167152f74c61dd1@mail.gmail.com> <18847.1323.673784.571359@harpo.it.uu.se> Message-ID: <84fb38e30902240854r745d81c5qe19c3cd6ad32388@mail.gmail.com> > The latter. As a follow-up, is there a function that can be called to determine the amount of memory that is copied when sending a complex non-binary structure as a message between processes? I've been using size(term_to_binary(Data)), which I think at least puts an upper bound on the size. Is there a more accurate (i.e. correct) built-in function that finds the size of a data structure? From raimo+erlang-questions@REDACTED Tue Feb 24 18:24:43 2009 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Tue, 24 Feb 2009 18:24:43 +0100 Subject: [erlang-questions] : Tuple memory size In-Reply-To: <84fb38e30902240854r745d81c5qe19c3cd6ad32388@mail.gmail.com> References: <84fb38e30902200730v5d438db7y6167152f74c61dd1@mail.gmail.com> <18847.1323.673784.571359@harpo.it.uu.se> <84fb38e30902240854r745d81c5qe19c3cd6ad32388@mail.gmail.com> Message-ID: <20090224172443.GA29761@erix.ericsson.se> On Tue, Feb 24, 2009 at 10:54:04AM -0600, tsuraan wrote: > > The latter. > > As a follow-up, is there a function that can be called to determine > the amount of memory that is copied when sending a complex non-binary > structure as a message between processes? I've been using > size(term_to_binary(Data)), which I think at least puts an upper bound > on the size. Is there a more accurate (i.e. correct) built-in > function that finds the size of a data structure? 1> A = {1,2,3}. {1,2,3} 2> erts_debug:size(A). 4 3> erts_debug:flat_size(A). 4 4> erts_debug:size({A,A}). 7 5> erts_debug:flat_size({A,A}). 11 Size is in words. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From vychodil.hynek@REDACTED Tue Feb 24 18:25:30 2009 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Tue, 24 Feb 2009 18:25:30 +0100 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <87ocwrpyiv.fsf@sterlett.hq.kred> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <87ocwrpyiv.fsf@sterlett.hq.kred> Message-ID: <4d08db370902240925u52d6f17cledb5416813c0fdc3@mail.gmail.com> On Tue, Feb 24, 2009 at 5:53 PM, mats cronqvist wrote: > David Cabana writes: > > > Christian wrote: > > > >> I used to think that I liked erlang programming just because it was > >> quite academic, and that this was just a personal preference. > > > > I'm curious what you mean by saying that Erlang is "academic". > > "functional" is a subset of "academic." Show me reliable system in Java with million SLOC. Java is "academic". Be fair, Java system should have about ten or more million SLOC to be compared to AXD 301. > > > mats > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try Good Data now for free: www.gooddata.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From tsuraan@REDACTED Tue Feb 24 18:46:22 2009 From: tsuraan@REDACTED (tsuraan) Date: Tue, 24 Feb 2009 11:46:22 -0600 Subject: [erlang-questions] : Tuple memory size In-Reply-To: <20090224172443.GA29761@erix.ericsson.se> References: <84fb38e30902200730v5d438db7y6167152f74c61dd1@mail.gmail.com> <18847.1323.673784.571359@harpo.it.uu.se> <84fb38e30902240854r745d81c5qe19c3cd6ad32388@mail.gmail.com> <20090224172443.GA29761@erix.ericsson.se> Message-ID: <84fb38e30902240946i5b6541afg7ff3cb38605eeb06@mail.gmail.com> > 1> A = {1,2,3}. > {1,2,3} > 2> erts_debug:size(A). > 4 > 3> erts_debug:flat_size(A). > 4 > 4> erts_debug:size({A,A}). > 7 > 5> erts_debug:flat_size({A,A}). > 11 > > Size is in words. Very cool, thanks. From kevin@REDACTED Tue Feb 24 18:14:47 2009 From: kevin@REDACTED (Kevin Scaldeferri) Date: Tue, 24 Feb 2009 09:14:47 -0800 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> Message-ID: <0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com> It's kinda funny how often people think of things like reliability, high-availability, etc. as "academic" concerns. An awful lot of companies care primarily about how fast low-skilled developers can crank out new features. -kevin On Feb 24, 2009, at 8:38 AM, David Cabana wrote: > Christian wrote: > >> I used to think that I liked erlang programming just because it was >> quite academic, and that this was just a personal preference. > > I'm curious what you mean by saying that Erlang is "academic". If you > were talking about Haskell (for instance) I could go understand. But > Erlang was built by people working in industry, with the goal of > supporting the development of commercial products. It doesn't get > much more pragmatic than that. In what sense is Erlang academic? > > drc > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From chsu79@REDACTED Tue Feb 24 18:50:15 2009 From: chsu79@REDACTED (Christian) Date: Tue, 24 Feb 2009 18:50:15 +0100 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <4d08db370902240925u52d6f17cledb5416813c0fdc3@mail.gmail.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <87ocwrpyiv.fsf@sterlett.hq.kred> <4d08db370902240925u52d6f17cledb5416813c0fdc3@mail.gmail.com> Message-ID: 2009/2/24 Hynek Vychodil : >> >> I used to think that I liked erlang programming just because it was >> >> quite academic, and that this was just a personal preference. >> > >> > I'm curious what you mean by saying that Erlang is "academic". >> >> ?"functional" is a subset of "academic." > > Show me reliable system in Java with million SLOC. Java is "academic". Be > fair, Java system should have about ten or more million SLOC to be compared > to AXD 301. Academic is not a curse-word (except for those that failed univ). I am not familiar with the AXD 301 code base to say anything about it, I have not worked with it. The power of Erlang is not in the trademark, it is in the practices Erlang put you in when programming, those practices when well understood can be applied on other languages. That is what interest me. From kunthar@REDACTED Tue Feb 24 19:56:32 2009 From: kunthar@REDACTED (Kunthar) Date: Tue, 24 Feb 2009 20:56:32 +0200 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <87ocwrpyiv.fsf@sterlett.hq.kred> <4d08db370902240925u52d6f17cledb5416813c0fdc3@mail.gmail.com> Message-ID: <9a09ca9a0902241056t5b5c9904s66c9e51565b15476@mail.gmail.com> On Tue, Feb 24, 2009 at 7:50 PM, Christian wrote: > 2009/2/24 Hynek Vychodil : >>> >> I used to think that I liked erlang programming just because it was >>> >> quite academic, and that this was just a personal preference. >>> > >>> > I'm curious what you mean by saying that Erlang is "academic". >>> >>> ?"functional" is a subset of "academic." >> >> Show me reliable system in Java with million SLOC. Java is "academic". Be >> fair, Java system should have about ten or more million SLOC to be compared >> to AXD 301. > > Academic is not a curse-word (except for those that failed univ). > > I am not familiar with the AXD 301 code base to say anything about it, > I have not worked with it. > > The power of Erlang is not in the trademark, it is in the practices > Erlang put you in when programming, those practices when well > understood can be applied on other languages. That is what interest > me. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From kunthar@REDACTED Tue Feb 24 19:57:15 2009 From: kunthar@REDACTED (Kunthar) Date: Tue, 24 Feb 2009 20:57:15 +0200 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <87ocwrpyiv.fsf@sterlett.hq.kred> <4d08db370902240925u52d6f17cledb5416813c0fdc3@mail.gmail.com> Message-ID: <9a09ca9a0902241057t471109efyd06a112f75a2f0cd@mail.gmail.com> I am waiting for Quantum computers that possibly maybe close to mimic human thinking. Till then, viva la Erlang :) Peace \|/ Kunthar On Tue, Feb 24, 2009 at 7:50 PM, Christian wrote: > 2009/2/24 Hynek Vychodil : >>> >> I used to think that I liked erlang programming just because it was >>> >> quite academic, and that this was just a personal preference. >>> > >>> > I'm curious what you mean by saying that Erlang is "academic". >>> >>> ?"functional" is a subset of "academic." >> >> Show me reliable system in Java with million SLOC. Java is "academic". Be >> fair, Java system should have about ten or more million SLOC to be compared >> to AXD 301. > > Academic is not a curse-word (except for those that failed univ). > > I am not familiar with the AXD 301 code base to say anything about it, > I have not worked with it. > > The power of Erlang is not in the trademark, it is in the practices > Erlang put you in when programming, those practices when well > understood can be applied on other languages. That is what interest > me. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From ulf.wiger@REDACTED Tue Feb 24 19:56:46 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Tue, 24 Feb 2009 18:56:46 +0000 (GMT) Subject: [erlang-questions] Tuple memory size In-Reply-To: <84fb38e30902240854r745d81c5qe19c3cd6ad32388@mail.gmail.com> Message-ID: <16920974.31731235501806468.JavaMail.root@zimbra> tsuraan wrote: > > The latter. > > As a follow-up, is there a function that can be called to determine > the amount of memory that is copied when sending a complex non-binary > structure as a message between processes? I've been using > size(term_to_binary(Data)), which I think at least puts an upper bound > on the size. Is there a more accurate (i.e. correct) built-in > function that finds the size of a data structure? erts_debug:flat_size(Term) gives the flattened size (in words, AFAIR) of any Erlang term. BR, Ulf W -- Ulf Wiger CTO, Erlang Training & Consulting Ltd. http://www.erlang-consulting.com From magnus@REDACTED Tue Feb 24 19:58:59 2009 From: magnus@REDACTED (Magnus Henoch) Date: Tue, 24 Feb 2009 18:58:59 +0000 Subject: [erlang-questions] Element Typing in Record Declarations? References: <70D595DB81BB4147A789A50F922A1772@SSI.CORP> Message-ID: <84eixnfyq4.fsf@linux-b2a3.site> "David Mercer" writes: > It appears that Erlang supports type declarations in record declarations, Speaking of which, I sometimes find it annoying that a field without a default value automatically has the atom 'undefined' as an allowed value. I'd like to be able to declare a record field as being required but having no default value, and have Dialyzer point out all the cases where I create such a record without specifying a value for that field. I guess I'm still too much of an $OTHER_LANGUAGE programmer; am I missing something? -- Magnus Henoch, magnus@REDACTED Erlang Training and Consulting http://www.erlang-consulting.com/ From mrad-direct-erlang@REDACTED Tue Feb 24 20:07:35 2009 From: mrad-direct-erlang@REDACTED (Michael Radford) Date: Tue, 24 Feb 2009 11:07:35 -0800 Subject: [erlang-questions] Element Typing in Record Declarations? In-Reply-To: <84eixnfyq4.fsf@linux-b2a3.site> References: <70D595DB81BB4147A789A50F922A1772@SSI.CORP> <84eixnfyq4.fsf@linux-b2a3.site> Message-ID: <20090224190735.GA5781@herbie> You can exploit the fact that record default values seem to be evaluated like macros (which I personally just discovered): -module (x). -export ([ f/0, g/0 ]). -record (r, { a = erlang:error({ undefined, a }), b = default_b }). f() -> #r{}. g() -> #r{ a = foo }. At runtime, this works just as you'd want: 1> x:f(). ** exited: {{undefined,a}, [{x,f,0}, {erl_eval,do_apply,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** =ERROR REPORT==== 24-Feb-2009::11:04:24 === Error in process <0.31.0> with exit value: {{undefined,a},[{x,f,0},{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} 2> x:g(). {r,foo,default_b} Mike Magnus Henoch writes: > "David Mercer" writes: > > > It appears that Erlang supports type declarations in record declarations, > > Speaking of which, I sometimes find it annoying that a field without a > default value automatically has the atom 'undefined' as an allowed > value. I'd like to be able to declare a record field as being required > but having no default value, and have Dialyzer point out all the cases > where I create such a record without specifying a value for that field. > > I guess I'm still too much of an $OTHER_LANGUAGE programmer; am I > missing something? > > -- > Magnus Henoch, magnus@REDACTED > Erlang Training and Consulting > http://www.erlang-consulting.com/ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From steven.charles.davis@REDACTED Tue Feb 24 20:10:37 2009 From: steven.charles.davis@REDACTED (Steve Davis) Date: Tue, 24 Feb 2009 11:10:37 -0800 (PST) Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> Message-ID: <349b4443-7a29-44d9-9d24-f92e03618abc@s24g2000vbp.googlegroups.com> On Feb 24, 9:25?am, Christian wrote: > Believe me, there can be doubt about lambda calculus being "ultimate". > This is the internet, and your argument is WEAK. > Hi Christian I'm at a loss to see how something so blatantly true as transformations being at the heart of computer processing could be considered "weak" because "this is the internet (sic). Care to explain that for me? br, /s From mrad-direct-erlang@REDACTED Tue Feb 24 20:14:07 2009 From: mrad-direct-erlang@REDACTED (Michael Radford) Date: Tue, 24 Feb 2009 11:14:07 -0800 Subject: [erlang-questions] Element Typing in Record Declarations? In-Reply-To: <20090224190735.GA5781@herbie> References: <70D595DB81BB4147A789A50F922A1772@SSI.CORP> <84eixnfyq4.fsf@linux-b2a3.site> <20090224190735.GA5781@herbie> Message-ID: <20090224191407.GB5781@herbie> Oh yeah, I forgot to note that this gives you the dialyzer output you want as well: % dialyzer -c x.beam Checking whether the initial PLT exists and is up-to-date... yes Proceeding with analysis... x.erl:4: Function f/0 has no local return done (warnings were emitted) Mike Michael Radford writes: > You can exploit the fact that record default values seem to be evaluated > like macros (which I personally just discovered): > > -module (x). > -export ([ f/0, g/0 ]). > -record (r, { a = erlang:error({ undefined, a }), b = default_b }). > f() -> #r{}. > g() -> #r{ a = foo }. > > At runtime, this works just as you'd want: > > 1> x:f(). > ** exited: {{undefined,a}, > [{x,f,0}, > {erl_eval,do_apply,5}, > {shell,exprs,6}, > {shell,eval_loop,3}]} ** > > =ERROR REPORT==== 24-Feb-2009::11:04:24 === > Error in process <0.31.0> with exit value: > {{undefined,a},[{x,f,0},{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} > > 2> x:g(). > {r,foo,default_b} > > > Mike > > Magnus Henoch writes: > > "David Mercer" writes: > > > > > It appears that Erlang supports type declarations in record declarations, > > > > Speaking of which, I sometimes find it annoying that a field without a > > default value automatically has the atom 'undefined' as an allowed > > value. I'd like to be able to declare a record field as being required > > but having no default value, and have Dialyzer point out all the cases > > where I create such a record without specifying a value for that field. > > > > I guess I'm still too much of an $OTHER_LANGUAGE programmer; am I > > missing something? > > > > -- > > Magnus Henoch, magnus@REDACTED > > Erlang Training and Consulting > > http://www.erlang-consulting.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 vss@REDACTED Tue Feb 24 21:29:56 2009 From: vss@REDACTED (Vlad Skvortsov) Date: Tue, 24 Feb 2009 12:29:56 -0800 Subject: [erlang-questions] reading RSA public key files (PEM) Message-ID: <49A458C4.9060903@73rus.com> Hi! With Erlang R12B5 I can read RSA private keys but not public: Eshell V5.6.5 (abort with ^G) 1> public_key:pem_to_der("test_rsa"). {ok,[{rsa_private_key,<<48,130,4,160,2,1,0,2,130,1,1,0, 161,19,65,96,102,199,220,63,184, 182,224,110,...>>, not_encrypted}]} 2> public_key:pem_to_der("test_rsa.pub"). {ok,[]} Googling around I couldn't find how do that. Any suggestions? Thanks! -- Vlad Skvortsov, vss@REDACTED, http://vss.73rus.com From andrew@REDACTED Tue Feb 24 21:44:11 2009 From: andrew@REDACTED (Andrew Thompson) Date: Tue, 24 Feb 2009 15:44:11 -0500 Subject: [erlang-questions] Element Typing in Record Declarations? In-Reply-To: <20090224190735.GA5781@herbie> References: <70D595DB81BB4147A789A50F922A1772@SSI.CORP> <84eixnfyq4.fsf@linux-b2a3.site> <20090224190735.GA5781@herbie> Message-ID: <20090224204410.GI13957@hijacked.us> On Tue, Feb 24, 2009 at 11:07:35AM -0800, Michael Radford wrote: > You can exploit the fact that record default values seem to be evaluated > like macros (which I personally just discovered): > I knew you could use things like now() in a record definition, but this is even cooler. I'm busy breaking all my tests by using your trick in my record defintions right now. Andrew From exta7@REDACTED Tue Feb 24 22:08:32 2009 From: exta7@REDACTED (Zvi) Date: Tue, 24 Feb 2009 13:08:32 -0800 (PST) Subject: [erlang-questions] Element Typing in Record Declarations? In-Reply-To: <20090224190735.GA5781@herbie> References: <70D595DB81BB4147A789A50F922A1772@SSI.CORP> <84eixnfyq4.fsf@linux-b2a3.site> <20090224190735.GA5781@herbie> Message-ID: <22190717.post@talk.nabble.com> even better (didn't tested it yet): -define(REQUIRED(Field), Field = erlang:error({undefined, Field})). -record (r, { ?REQUIRED(a), b = default_b }). Zvi Michael Radford-3 wrote: > > You can exploit the fact that record default values seem to be evaluated > like macros (which I personally just discovered): > > -module (x). > -export ([ f/0, g/0 ]). > -record (r, { a = erlang:error({ undefined, a }), b = default_b }). > f() -> #r{}. > g() -> #r{ a = foo }. > > At runtime, this works just as you'd want: > > 1> x:f(). > ** exited: {{undefined,a}, > [{x,f,0}, > {erl_eval,do_apply,5}, > {shell,exprs,6}, > {shell,eval_loop,3}]} ** > > =ERROR REPORT==== 24-Feb-2009::11:04:24 === > Error in process <0.31.0> with exit value: > {{undefined,a},[{x,f,0},{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} > > 2> x:g(). > {r,foo,default_b} > > > Mike > > Magnus Henoch writes: >> "David Mercer" writes: >> >> > It appears that Erlang supports type declarations in record >> declarations, >> >> Speaking of which, I sometimes find it annoying that a field without a >> default value automatically has the atom 'undefined' as an allowed >> value. I'd like to be able to declare a record field as being required >> but having no default value, and have Dialyzer point out all the cases >> where I create such a record without specifying a value for that field. >> >> I guess I'm still too much of an $OTHER_LANGUAGE programmer; am I >> missing something? >> >> -- >> Magnus Henoch, magnus@REDACTED >> Erlang Training and Consulting >> http://www.erlang-consulting.com/ >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- View this message in context: http://www.nabble.com/Element-Typing-in-Record-Declarations--tp22183665p22190717.html Sent from the Erlang Questions mailing list archive at Nabble.com. From nicolas.zea@REDACTED Tue Feb 24 22:24:14 2009 From: nicolas.zea@REDACTED (Nicolas Zea) Date: Tue, 24 Feb 2009 15:24:14 -0600 Subject: [erlang-questions] Erlang SMP scheduler details Message-ID: <04957FBD-8AB2-4F93-9D76-6AB2B6864259@gmail.com> Are there any details available on how the SMP scheduler works? I found some slides that discuss how there is a global run pool, which schedulers get work from, with one scheduler per thread. Does this mean everything follows kind of a pull model, and there is no notion of actor locality to a particular thread? (ie, if multiple actors are available in the run queue, prioritize one that was previously running in this thread in the hopes of having less of a 'cold start' in terms of cache, branch prediction, tlb misses, etc.). It was mentioned the current goal is to distribute the run pool as well, with some migration logic. I'm guessing this hasn't been implemented yet? Is there any notion of preemption? Or other fairness assurance? I've been digging through the beam source code, but in all honesty that place scares me a bit. Is there any documentation available on what all is going on, particularly in relation to the SMP aspects? For example, does anyone know where the interaction with OS threads takes place, including pulling tasks from the run pool? Is there any definition anywhere of what the "lightweight processes" entail, and how they get swapped in/out? (continuations?) Thanks, Nicolas From rob.charlton@REDACTED Tue Feb 24 21:37:39 2009 From: rob.charlton@REDACTED (Rob Charlton) Date: Tue, 24 Feb 2009 20:37:39 +0000 Subject: [erlang-questions] Abstract patterns, structs and frames In-Reply-To: <49A43C7B.8010802@gmail.com> References: <95be1d3b0902230008t19366c10saa2fa07a61ad8649@mail.gmail.com> <297487.67048.qm@web65501.mail.ac4.yahoo.com> <61BF0BC1-A661-4C2C-A5E0-CF73DE6C84C5@cs.otago.ac.nz> <49A43C7B.8010802@gmail.com> Message-ID: <49A45A93.1080609@savageminds.com> Richard O'Keefe wrote: > Actually, tags are _optional_ in the frames proposal. > > is allowed, and is equivalent to <{'' = Tag, K1=E1, ..., Kn=En }> > Do you envisage that frames could become a drop-in replacement for the use of records in mnesia? Does that impact the need (or not) for a tag? A lot of my record handling code is as a result of retrieving records from tables. And indeed I just this second had to duplicate a function that works across several tables which I could have written once if based around frames or structs. Cheers -- Rob Charlton Savage Minds Ltd From bbmaj7@REDACTED Tue Feb 24 22:41:56 2009 From: bbmaj7@REDACTED (Richard Andrews) Date: Tue, 24 Feb 2009 13:41:56 -0800 (PST) Subject: [erlang-questions] erlang flagship product (was The Beauty of Erlang Syntax) References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <87ocwrpyiv.fsf@sterlett.hq.kred> <4d08db370902240925u52d6f17cledb5416813c0fdc3@mail.gmail.com> Message-ID: <769685.50188.qm@web65512.mail.ac4.yahoo.com> > Show me reliable system in Java with million SLOC. Java is > "academic". Be fair, Java system should have about ten or > more million SLOC to be compared to AXD 301. It's a great story but why is the AXD301 (a project from the 1990s) still held up as the flagship example of the virtues of erlang? Is this still the best we have? The software development universe has evolved from where it was in 1997. Surely there are more recent examples of projects where erlang delivered functionality and reliability quickly and cheaply. Stay connected to the people that matter most with a smarter inbox. Take a look http://au.docs.yahoo.com/mail/smarterinbox From chsu79@REDACTED Tue Feb 24 22:54:59 2009 From: chsu79@REDACTED (Christian) Date: Tue, 24 Feb 2009 22:54:59 +0100 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com> Message-ID: What do you call a process that is funded by research money, that have no predefined absolute goal, repeats the same test over and over again with alternating parameters, and ends up with a result that may disagree with the known practices, and nobody know where to use the result. Does it sound like an academic exercise? Interestingly enough, Erlang happened because the http://www.cs-lab.org/ repeated building a software project in different languages to see which language did it best, ending up creating a new language that nobody had asked for. This while questioning other established software engineering practices in how they handle programming in the presence of errors. And trying to find someone willing to base a project on this new language. (This is all according to the stories I've read about Erlang's genesis.) In a way, the research that lead to Erlang was about finding a way to making it faster to have low-skilled developers cranking out new features. It certainly wouldnt be good PR if Erlang was a language for highly-skilled developers to slowly cranking out old features. On Tue, Feb 24, 2009 at 18:14, Kevin Scaldeferri wrote: > It's kinda funny how often people think of things like reliability, > high-availability, etc. as "academic" concerns. ?An awful lot of > companies care primarily about how fast low-skilled developers can > crank out new features. > > -kevin > > > On Feb 24, 2009, at 8:38 AM, David Cabana wrote: > >> Christian wrote: >> >>> I used to think that I liked erlang programming just because it was >>> quite academic, and that this was just a personal preference. >> >> I'm curious what you mean by saying that Erlang is "academic". ?If you >> were talking about Haskell (for instance) I could go understand. ?But >> Erlang was built by people working in industry, with the goal of >> supporting the development of commercial products. ?It doesn't get >> much more pragmatic than that. In what sense is Erlang academic? >> >> drc >> _______________________________________________ >> 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 kevin@REDACTED Tue Feb 24 23:10:56 2009 From: kevin@REDACTED (Kevin Scaldeferri) Date: Tue, 24 Feb 2009 14:10:56 -0800 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com> Message-ID: On Feb 24, 2009, at 1:54 PM, Christian wrote: > In a way, the research that lead to Erlang was about finding a way to > making it faster to have low-skilled developers cranking out new > features. It certainly wouldnt be good PR if Erlang was a language for > highly-skilled developers to slowly cranking out old features. > I wasn't in the industry at the time, but I'm not sure that the programming workforce of the 80's closely resembled the workforce of today (or the past decade). But, really, one should ask, if Erlang was designed / evolved / selected with this goal, why is it that 20 years later most developers have never even heard of it? I guess one possibility would be to blame Ericsson and credit MS and Sun for why C# and Java are the languages of choice for companies who care more about how easy it is to hire an army of developers than anything else. There could be other possible explanations, though. Also, you've exaggerated & distorted my point with your last sentence. Haskell unabashedly markets itself as a language for highly skilled developers to quickly and reliably implement new features. It is still unpopular. Most companies do not like the idea of using a language that requires them to find a top 10% or top 1% developer to work on their project. Of course, you might also have misinterpreted my comment entirely. I'm certainly not promoting this point of view, but just saying that to a lot of companies "practical for the real world" means "I can easily hire someone". -kevin >> On Tue, Feb 24, 2009 at 18:14, Kevin Scaldeferri > > wrote: >> It's kinda funny how often people think of things like reliability, >> high-availability, etc. as "academic" concerns. An awful lot of >> companies care primarily about how fast low-skilled developers can >> crank out new features. >> >> -kevin -------------- next part -------------- An HTML attachment was scrubbed... URL: From kunthar@REDACTED Tue Feb 24 23:54:25 2009 From: kunthar@REDACTED (Kunthar) Date: Wed, 25 Feb 2009 00:54:25 +0200 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com> Message-ID: <9a09ca9a0902241454y340a9ef2r631981a5cd849bfe@mail.gmail.com> Someone invents and works hard and some others sucks their bloods. Companies don't like a thinking guys around. They need docile robots. Business world starts with a *one* shining idea and every single idea covered with routine day jobs after the main purpose accomplished. Java mostly helps everyday jobs at this stage. Helps to corporate IT managers with automated dummy tests etc. Sure still someone can use it in Mars Mobile too :) There is nothing to invent with wiring database to model and getting some data to controller and fetching bunch of bags to view part. Erlang and some other tools OTOH, helps to inventor to explore some other ways of writing a good application. Erlang would solve the problems in your problem domain or not. A thinking human being should take a serious decisions on it. Sure its not always could fit to every single request. There will always the combination of the tools exist. But at first, the way of thinking of the most part of the world should be changed. Do we think for produce a *real* value for our lives? Whatta hell all those guys doing? Just to stay alive? Way too much stack trace to compile one target life like ants. P.S. Subject goes off topic slightly. I discontinue this thread. Peace \|/ Kunth 2009/2/25 Kevin Scaldeferri : > > On Feb 24, 2009, at 1:54 PM, Christian wrote: > > In a way, the research that lead to Erlang was about finding a way to > making it faster to have low-skilled developers cranking out new > features. It certainly wouldnt be good PR if Erlang was a language for > highly-skilled developers to slowly cranking out old features. > > > > I wasn't in the industry at the time, but I'm not sure that the programming > workforce of the 80's closely resembled the workforce of today (or the past > decade). > But, really, one should ask, if Erlang was designed / evolved / selected > with this goal, why is it that 20 years later most developers have never > even heard of it? ?I guess one possibility would be to blame Ericsson and > credit MS and Sun for why C# and Java are the languages of choice for > companies who care more about how easy it is to hire an army of developers > than anything else. ?There could be other possible explanations, though. > Also, you've exaggerated & distorted my point with your last sentence. > ?Haskell unabashedly markets itself as a language for highly skilled > developers to quickly and reliably implement new features. ?It is still > unpopular. ?Most companies do not like the idea of using a language that > requires them to find a top 10% or top 1% developer to work on their > project. > Of course, you might also have misinterpreted my comment entirely. ?I'm > certainly not promoting this point of view, but just saying that to a lot of > companies "practical for the real world" means "I can easily hire someone". > > -kevin > > On Tue, Feb 24, 2009 at 18:14, Kevin Scaldeferri > wrote: > It's kinda funny how often people think of things like reliability, > high-availability, etc. as "academic" concerns. ?An awful lot of > companies care primarily about how fast low-skilled developers can > crank out new features. > > -kevin > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From v@REDACTED Wed Feb 25 00:02:57 2009 From: v@REDACTED (Valentin Micic) Date: Wed, 25 Feb 2009 01:02:57 +0200 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: Message-ID: <200902242258.n1OMwNRc025121@mail.pharos-avantgard.com> If "I can easily hire someone" is an answer, I am not quite sure what would be the question, let alone a problem, if any. _____ From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Kevin Scaldeferri Sent: 25 February 2009 12:11 AM To: Christian Cc: erlang-questions Subject: Re: [erlang-questions] The Beauty of Erlang Syntax On Feb 24, 2009, at 1:54 PM, Christian wrote: In a way, the research that lead to Erlang was about finding a way to making it faster to have low-skilled developers cranking out new features. It certainly wouldnt be good PR if Erlang was a language for highly-skilled developers to slowly cranking out old features. I wasn't in the industry at the time, but I'm not sure that the programming workforce of the 80's closely resembled the workforce of today (or the past decade). But, really, one should ask, if Erlang was designed / evolved / selected with this goal, why is it that 20 years later most developers have never even heard of it? I guess one possibility would be to blame Ericsson and credit MS and Sun for why C# and Java are the languages of choice for companies who care more about how easy it is to hire an army of developers than anything else. There could be other possible explanations, though. Also, you've exaggerated & distorted my point with your last sentence. Haskell unabashedly markets itself as a language for highly skilled developers to quickly and reliably implement new features. It is still unpopular. Most companies do not like the idea of using a language that requires them to find a top 10% or top 1% developer to work on their project. Of course, you might also have misinterpreted my comment entirely. I'm certainly not promoting this point of view, but just saying that to a lot of companies "practical for the real world" means "I can easily hire someone". -kevin On Tue, Feb 24, 2009 at 18:14, Kevin Scaldeferri wrote: It's kinda funny how often people think of things like reliability, high-availability, etc. as "academic" concerns. An awful lot of companies care primarily about how fast low-skilled developers can crank out new features. -kevin -------------- next part -------------- An HTML attachment was scrubbed... URL: From kevin@REDACTED Wed Feb 25 00:31:23 2009 From: kevin@REDACTED (Kevin Scaldeferri) Date: Tue, 24 Feb 2009 15:31:23 -0800 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <9a09ca9a0902241454y340a9ef2r631981a5cd849bfe@mail.gmail.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com> <9a09ca9a0902241454y340a9ef2r631981a5cd849bfe@mail.gmail.com> Message-ID: <3F34D1EF-6B9D-4917-B7BB-5C03C0A5F7B1@scaldeferri.com> Whether we like it or not, it's probably worth keeping in mind that there is an enormous demand for not-particularly-high-quality software to be used in situations where IT is a cost center, not a revenue generator. A related observation is that even though good programmers are much more productive and produce much higher quality results than average, there still do not seem to be enough of them to saturate the market demand for software. -k On Feb 24, 2009, at 2:54 PM, Kunthar wrote: > Someone invents and works hard and some others sucks their bloods. > Companies don't like a thinking guys around. They need docile robots. > Business world starts with a *one* shining idea and every single idea > covered with routine day jobs after the main purpose accomplished. > Java mostly helps everyday jobs at this stage. Helps to corporate IT > managers with automated dummy tests etc. Sure still someone can use it > in Mars Mobile too :) > There is nothing to invent with wiring database to model and getting > some data to controller and fetching bunch of bags to view part. > Erlang and some other tools OTOH, helps to inventor to explore some > other ways of writing a good application. > Erlang would solve the problems in your problem domain or not. A > thinking human being should take a serious decisions on it. > Sure its not always could fit to every single request. There will > always the combination of the tools exist. > > But at first, the way of thinking of the most part of the world should > be changed. Do we think for produce a *real* > value for our lives? Whatta hell all those guys doing? Just to stay > alive? > > Way too much stack trace to compile one target life like ants. > > P.S. Subject goes off topic slightly. I discontinue this thread. > Peace > \|/ Kunth > > > > > 2009/2/25 Kevin Scaldeferri : >> >> On Feb 24, 2009, at 1:54 PM, Christian wrote: >> >> In a way, the research that lead to Erlang was about finding a way to >> making it faster to have low-skilled developers cranking out new >> features. It certainly wouldnt be good PR if Erlang was a language >> for >> highly-skilled developers to slowly cranking out old features. >> >> >> >> I wasn't in the industry at the time, but I'm not sure that the >> programming >> workforce of the 80's closely resembled the workforce of today (or >> the past >> decade). >> But, really, one should ask, if Erlang was designed / evolved / >> selected >> with this goal, why is it that 20 years later most developers have >> never >> even heard of it? I guess one possibility would be to blame >> Ericsson and >> credit MS and Sun for why C# and Java are the languages of choice for >> companies who care more about how easy it is to hire an army of >> developers >> than anything else. There could be other possible explanations, >> though. >> Also, you've exaggerated & distorted my point with your last >> sentence. >> Haskell unabashedly markets itself as a language for highly skilled >> developers to quickly and reliably implement new features. It is >> still >> unpopular. Most companies do not like the idea of using a language >> that >> requires them to find a top 10% or top 1% developer to work on their >> project. >> Of course, you might also have misinterpreted my comment entirely. >> I'm >> certainly not promoting this point of view, but just saying that to >> a lot of >> companies "practical for the real world" means "I can easily hire >> someone". >> >> -kevin >> >> On Tue, Feb 24, 2009 at 18:14, Kevin Scaldeferri > > >> wrote: >> It's kinda funny how often people think of things like reliability, >> high-availability, etc. as "academic" concerns. An awful lot of >> companies care primarily about how fast low-skilled developers can >> crank out new features. >> >> -kevin >> >> _______________________________________________ >> 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 kevin@REDACTED Wed Feb 25 00:26:16 2009 From: kevin@REDACTED (Kevin Scaldeferri) Date: Tue, 24 Feb 2009 15:26:16 -0800 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <200902242258.n1OMwNRc025121@mail.pharos-avantgard.com> References: <200902242258.n1OMwNRc025121@mail.pharos-avantgard.com> Message-ID: <4E668799-55B0-433D-A4AE-A957022912DF@scaldeferri.com> The hypothetical question was "Should I use language X to build my application?", or "Is X a practical / real-world language?". I.e., more-or-less the converse of the question we started with of "Is X an academic language?". -kevin On Feb 24, 2009, at 3:02 PM, Valentin Micic wrote: > If ?I can easily hire someone? is an answer, I am not quite sure > what would be the question, let alone a problem, if any. > > From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED > ] On Behalf Of Kevin Scaldeferri > Sent: 25 February 2009 12:11 AM > To: Christian > Cc: erlang-questions > Subject: Re: [erlang-questions] The Beauty of Erlang Syntax > > > On Feb 24, 2009, at 1:54 PM, Christian wrote: > > > In a way, the research that lead to Erlang was about finding a way to > making it faster to have low-skilled developers cranking out new > features. It certainly wouldnt be good PR if Erlang was a language for > highly-skilled developers to slowly cranking out old features. > > > > > I wasn't in the industry at the time, but I'm not sure that the > programming workforce of the 80's closely resembled the workforce of > today (or the past decade). > > But, really, one should ask, if Erlang was designed / evolved / > selected with this goal, why is it that 20 years later most > developers have never even heard of it? I guess one possibility > would be to blame Ericsson and credit MS and Sun for why C# and Java > are the languages of choice for companies who care more about how > easy it is to hire an army of developers than anything else. There > could be other possible explanations, though. > > Also, you've exaggerated & distorted my point with your last > sentence. Haskell unabashedly markets itself as a language for > highly skilled developers to quickly and reliably implement new > features. It is still unpopular. Most companies do not like the > idea of using a language that requires them to find a top 10% or top > 1% developer to work on their project. > > Of course, you might also have misinterpreted my comment entirely. > I'm certainly not promoting this point of view, but just saying that > to a lot of companies "practical for the real world" means "I can > easily hire someone". > > > -kevin > > >>> On Tue, Feb 24, 2009 at 18:14, Kevin Scaldeferri >> > wrote: >>> It's kinda funny how often people think of things like reliability, >>> high-availability, etc. as "academic" concerns. An awful lot of >>> companies care primarily about how fast low-skilled developers can >>> crank out new features. >>> >>> -kevin > -------------- next part -------------- An HTML attachment was scrubbed... URL: From anders.nygren@REDACTED Wed Feb 25 01:46:46 2009 From: anders.nygren@REDACTED (Anders Nygren) Date: Tue, 24 Feb 2009 18:46:46 -0600 Subject: [erlang-questions] Released: ABNF parser generator Message-ID: Hi Finally I have managed to release the ABNF Parser Generator for Erlang. It can be found on http://github.com/nygge/abnfc/tree/master An almost correct description can be found in the EUC presentation http://www.erlang.se/euc/08/1500Nygren2.pdf /Anders From bbmaj7@REDACTED Wed Feb 25 01:50:58 2009 From: bbmaj7@REDACTED (Richard Andrews) Date: Tue, 24 Feb 2009 16:50:58 -0800 (PST) Subject: [erlang-questions] The Beauty of Erlang Syntax References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com> <9a09ca9a0902241454y340a9ef2r631981a5cd849bfe@mail.gmail.com> <3F34D1EF-6B9D-4917-B7BB-5C03C0A5F7B1@scaldeferri.com> Message-ID: <530446.9293.qm@web65515.mail.ac4.yahoo.com> > Whether we like it or not, it's probably worth keeping in mind that > there is an enormous demand for not-particularly-high-quality software > to be used in situations where IT is a cost center, not a revenue > generator. Sounds a bit like Moen's Law of Bicycles. http://linuxmafia.com/~rick/lexicon.html#moenslaw-bicycles Stay connected to the people that matter most with a smarter inbox. Take a look http://au.docs.yahoo.com/mail/smarterinbox From bbmaj7@REDACTED Wed Feb 25 02:21:02 2009 From: bbmaj7@REDACTED (Richard Andrews) Date: Tue, 24 Feb 2009 17:21:02 -0800 (PST) Subject: [erlang-questions] The Beauty of Erlang Syntax References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com> Message-ID: <115617.75351.qm@web65508.mail.ac4.yahoo.com> > But, really, one should ask, if Erlang was designed / evolved / > selected with this goal, why is it that 20 years later most > developers have never even heard of it? I guess one possibility > would be to blame Ericsson and credit MS and Sun for why C# and > Java are the languages of choice for companies who care more > about how easy it is to hire an army of developers than anything > else. There could be other possible explanations, though. Marketing. Sun marketed Java. MS marketed C#. MS marketed C++ indirectly by chosing it as a platform for Windows development (ATL, COM). Java and C# are easy to market to the Windows mindset. In these languages simple common problems are easy to solve quickly. So lots of "little" projects begin using such tools. The problem is that projects grow and with these languages the cost of adding complexity rises much more quickly than for say erlang. Often it looks cheaper to keep incrementally building on what you've got. And the further you go down this path, the more investment is made and the harder it is to justify jettisoning the existing implementation even though each change gets harder and long and less reliable. Unfortunately making the wrong decision at the outset doesn't become apparent until it is too late to do anything about it. -- Rich Stay connected to the people that matter most with a smarter inbox. Take a look http://au.docs.yahoo.com/mail/smarterinbox From petermichaux@REDACTED Wed Feb 25 03:23:39 2009 From: petermichaux@REDACTED (Peter Michaux) Date: Tue, 24 Feb 2009 18:23:39 -0800 Subject: [erlang-questions] arity part of function name and variadic functions In-Reply-To: References: <3cbaf1c80902221225pf14513sf93e46a90228d595@mail.gmail.com> Message-ID: <3cbaf1c80902241823y56e7f674o15aa431cfa6603a3@mail.gmail.com> Thanks to everyone who replied. On Mon, Feb 23, 2009 at 3:31 PM, Richard O'Keefe wrote: > (2) What would you want variadic functions for? There are many examples in lisp. Sum is a variadic function so that summing two or more items have the same syntax. If there were no variadics and it was desirable to have the same syntax for summing two or more items, then summing two would need to be written in quite a bulky fashion (+ (list a b)) Functions like map are also variadic in lisp. The common case has simple syntax (map f a) and then extends naturally to the less common case of multiple lists (map f a b c) I'm not here to argue in favor of how lisp does it. This is simply a possible answer to your question. > ? ?If you want to pass a variable number of items, > ? ?pass a list or a tuple. ?If you want *two* groups > ? ?of arguments that vary in number, such as a command > ? ?to send several messages to several processes, just > ? ?pass two lists. ?You aren't left wondering which of > ? ?them gets to be the only variable group. Good point. Thanks again, Peter From ok@REDACTED Wed Feb 25 04:02:51 2009 From: ok@REDACTED (Richard O'Keefe) Date: Wed, 25 Feb 2009 16:02:51 +1300 Subject: [erlang-questions] Abstract patterns, structs and frames In-Reply-To: <49A43C7B.8010802@gmail.com> References: <95be1d3b0902230008t19366c10saa2fa07a61ad8649@mail.gmail.com> <297487.67048.qm@web65501.mail.ac4.yahoo.com> <61BF0BC1-A661-4C2C-A5E0-CF73DE6C84C5@cs.otago.ac.nz> <49A43C7B.8010802@gmail.com> Message-ID: <0FC441A1-EAAF-4DF5-A7C8-47761DB6E976@cs.otago.ac.nz> On 25 Feb 2009, at 7:29 am, Rob Charlton wrote: > Richard O'Keefe wrote: >> Actually, tags are _optional_ in the frames proposal. >> >> is allowed, and is equivalent to <{'' = Tag, K1=E1, ..., Kn=En }> >> > Do you envisage that frames could become a drop-in replacement for > the use of records in mnesia? I can't prove it, but I strongly suspect that (1) almost all -record declarations are NOT related to Mnesia. {This is a fact for the code I can examine; I have no evidence that it is true for any other code.} (2) almost all record *instances* in programs that use Mnesia are Mnesia records. Not exactly "drop-in". ETS and DETS need a key position, and the elements of an ETS or DETS table must be tuples with at least that many elements, but apparently need not all be the same size (not something I've ever cared to try). Recall that a frame is, at implementation level, basically {Descriptor,Field1,...,Fieldn} where Descriptor is {Tag,Name1,...,Namen} or {Name1,...,Namen} So we could envisage wrappers for ETS and DETS that took a descriptor and a key *name* when you created a table, and then mapped frames with exactly the fields of the descriptor to tuples in the table. Since Mnesia wants tagged records, it would be OK if the ETS/DETS wrappers insisted on tagged frames/structs. It's obviously possible to handle additional fields as well, with some overheads. So I think it's doable, and doable without any extra space overheads *in the tables*, but I don't see it as a 'drop-in replacement' simply because of the need to use field names rather than key positions. Close enough for it not too be too painful to convert if you really wanted to. > A lot of my record handling code is as a result of retrieving > records from tables. And indeed I just this second had to duplicate > a function that works across several tables which I could have > written once if based around frames or structs. This is obviously an important question, but I think we can proceed one step at a time. From ttmrichter@REDACTED Wed Feb 25 04:27:40 2009 From: ttmrichter@REDACTED (Michael Richter) Date: Wed, 25 Feb 2009 11:27:40 +0800 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <115617.75351.qm@web65508.mail.ac4.yahoo.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com> <115617.75351.qm@web65508.mail.ac4.yahoo.com> Message-ID: I would like to ask a multi-part, but rhetorical, question of the list: Why do you think people stay away from functional programming languages in droves? 1. Is it because they're too stupid to understand them? 2. Is it because of an evil cabal of IT Illuminati who are trying to squelch the true freedom of the programming masses? 3. Is it because the functional languages available do not seem to meet their needs, whatever those may be? 4. Is it because the fans of functional languages often come across as religious fanatics preaching the One True Way of programming? 5. Is it some combination of the above? My own answer to the question is a #5 with a strong skew toward the higher numbers. #1 (the one that's becoming uncomfortably common in this thread, albeit with muted wording) is a little too arrogant for my tastes. There are an awful lot of awfully smart people who not only use but *make* imperative languages out there. I'm not willing to casually dismiss them as too stupid to understand the One True Way of the Lambda. There is something they see in the various stateful, imperative models that seems useful to them. Are you really so smart as to be able to casually dismiss them? If so, may I please read your Ph.D. thesis for the stunning insights into computing and humanity that it undoubtedly contains? #2 I'm less willing to stray from (with less gonzo wording), although I think the threat is largely overblown. There *are* indeed vendors of IT products that make a killing from selling methods of complexity management that would not like it if functional languages came on the scene in a big way. (I mean UML--and the multi-billion dollar consulting industry that feeds off it--would be dead overnight.) I'm sure that they do apply some pressures in the form of subtle FUD that keep people hooked on their drug. I don't think, however, that they're as big a force as some people seem to be thinking here. #3 is the biggest one, I think. Others' needs are not necessarily what you think they are. Business needs, for example, are things like "this software has to hit market in X amount of time". For all the talk of how productive functional programming languages are you are forgetting one important item: the company has trained IT staff familiar with its problem domain and *not*familiar with functional programming on hand *now*. They have a choice: retrain their IT staff to do functional programming for dubious (to them) benefits while not making any progress in their products *and* facing risks of the benefits not materializing; or go with the Devil they know where the risks are (in their minds) known to them. (Another option, of course, is to just dismiss their entire IT staff and replace them with functional programmers who don't know the problem domain. Functional programmers who don't exist in any sufficiently large number to actually do this.) #4, sadly, comes a disconcertingly close second. Want to see an overblown version of how functional programmers come across at times? Read some of these gems from one of the more outspoken members of the lisp community: - http://groups.google.com/group/comp.lang.lisp/msg/e5af8ef3f88dd39c - http://groups.google.com/group/comp.lang.lisp/msg/b8aa5b537cf11bb4?pli=1 - http://groups.google.com/group/comp.lang.lisp/msg/7060ad1dc1defc9c - http://groups.google.com/group/comp.lang.lisp/msg/e65326618bbca892 Keep in mind, too, that this man is *lionized* by a lot of the people in comp.lang.lisp. Is it really Microsoft and Sun's marketing that makes C# and Java popular? Or is it the behaviour of the other communities that drives away potential converts? -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Wed Feb 25 04:34:21 2009 From: ok@REDACTED (Richard O'Keefe) Date: Wed, 25 Feb 2009 16:34:21 +1300 Subject: [erlang-questions] arity part of function name and variadic functions In-Reply-To: <3cbaf1c80902241823y56e7f674o15aa431cfa6603a3@mail.gmail.com> References: <3cbaf1c80902221225pf14513sf93e46a90228d595@mail.gmail.com> <3cbaf1c80902241823y56e7f674o15aa431cfa6603a3@mail.gmail.com> Message-ID: <355FCEC9-5FAC-47E6-A23F-E89FA586CAAA@cs.otago.ac.nz> On 25 Feb 2009, at 3:23 pm, Peter Michaux wrote: > Thanks to everyone who replied. > > On Mon, Feb 23, 2009 at 3:31 PM, Richard O'Keefe > wrote: > >> (2) What would you want variadic functions for? > > There are many examples in lisp. Which I am thoroughly familiar with. > Sum is a variadic function so that > summing two or more items have the same syntax. That's #'+, not #'sum. > If there were no > variadics and it was desirable to have the same syntax for summing two > or more items, then summing two would need to be written in quite a > bulky fashion (+ (list a b)) To call it desirable to have the same syntax for summing two and for summing more items would be to beg the question (petitio principii). Let's look at APL. (APL lives!) In APL, X + Y adds two things. +/X adds up the elements of a vector. APL2's strand notation means that we have X + Y +/ A B C ... Z But +/ is not a variadic function. It is a function of one argument, namely a vector. There is a visible relation between + and +/, in fact / is a higher-order operator applicable to any binary operator. In Erlang, we have X + Y to add two numbers and lists:sum([A,B, ..., Z]) to add many of them. It was always a surprise to me just how useful this feature of Lisp wasn't. On the occasions when I wanted to exploit it, say (apply #'+ numbers), I always ran into problems, like there being a maximum number of arguments. I always ended up defining my own #'sum. These days I'd use (loop for x in numbers sum x) When it comes to AND and OR, I concede: there I've always found it useful that they allow many arguments, and a pain that (apply #'AND booleans) doesn't work. But with an infix &&, I've never missed AND. > > Functions like map are also variadic in lisp. The common case has > simple syntax (map f a) and then extends naturally to the less common > case of multiple lists (map f a b c) Have you ever tried _implementing_ that? It's a pain. Also, when I met that "feature" of Lisp, I was coming from another dialect, where one wrote (map list f) and since the function was usually the big thing, and the list already handy, it was _much_ nicer to write (map pairs #'(lambda (pair) #|body of lambda|#)) than to write (map #'(lambda (pair) #|body of lambda|#) #|now where do I put 'pairs' so I can see it|#) ML handles this by having map (one argument functions) and map2 (two argument functions). Clean does it with list comprehensions: [f x y z \\ x <- xs & y <- ys & z <- zs] although it's long enough since I last used Clean that I've probably got the syntax wrong. If I have list comprehensions, I don't _want_ variable arity map, because I have something better. I still love Lisp (especially Scheme), but one of the things I do not miss at all in Haskell or ML or Erlang is variable arity functions. From dave.smith.to@REDACTED Wed Feb 25 05:24:11 2009 From: dave.smith.to@REDACTED (Dave Smith) Date: Tue, 24 Feb 2009 23:24:11 -0500 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> Message-ID: <5ea453f90902242024i4f7306f1k1835e3ee8b4732b7@mail.gmail.com> > - The medium/long term future of hardware cannot be anything but FPGAs > and I cannot imagine any multithreaded dance in Java/C++ that can > possibly keep up with this trend. With Erlang, I feel that I can cope > with the next decade. I agree with you here. I can't imaging any implementation of the actors model on top of Java/C++ (or Ruby/Python) that will be as elegant. Where Erlang falls apart for me is in the modelling of business concepts and processing business rules. I've done these types of applications for 15 years in C++ and Java, and they are not elegant, but they work. I've tried to model these concepts in Erlang, but they are a mess. I'm currently looking at Haskell for this purpose, and it looks very promising. The extensibility of the type system is key here. Erlang's records are just not up to the job. Perhaps frames or abstract patterns will do the job better. --DS -------------- next part -------------- An HTML attachment was scrubbed... URL: From btolputt@REDACTED Tue Feb 24 23:31:21 2009 From: btolputt@REDACTED (Benjamin Tolputt) Date: Wed, 25 Feb 2009 09:31:21 +1100 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com> Message-ID: <49A47539.6040008@bigpond.net.au> Kevin Scaldeferri wrote: > I wasn't in the industry at the time, but I'm not sure that the > programming workforce of the 80's closely resembled the workforce of > today (or the past decade). Not so much. The programming workforce of the eighties (that I know of) consisted of alot more engineering types than today's workforce does. The number of "technical college" programmers I have come across has been increasing at a steady rate. While there is nothing wrong with technical colleges; alot more people go into them to become "programmers" whereas the "engineers" are coming from universities. The way these two types of people think can be vastly different when given the same problem to solve. > But, really, one should ask, if Erlang was designed / evolved / > selected with this goal, why is it that 20 years later most developers > have never even heard of it? I guess one possibility would be to > blame Ericsson and credit MS and Sun for why C# and Java are the > languages of choice for companies who care more about how easy it is > to hire an army of developers than anything else. There could be > other possible explanations, though. Well, the popularity of Java & C# can be contributed to a combination of factors, but one of the largest reasons (if not simply the most important), would be marketing. Microsoft controls the primary development platform for their operating system (Microsoft Visual Studio). While I cannot knock their efforts there (MSVC is an incredible IDE), they utilise this control to direct the "less skilled" end of the programming workforce toward their new language of choice (C#). Combined with an intense marketing blitz in technical magazines, websites, and appearances/talks at trade shows - Microsoft was able to make C# the "must use" language it is to business managers today. With the exception of the IDE leverage they have, the rest of their c#-drive may as well have been lifted directly from Sun's Java marketing playbook. There are other reasons for these languages being where they are, but marketing & industry leverage are the most blatant. > Also, you've exaggerated & distorted my point with your last sentence. > Haskell unabashedly markets itself as a language for highly skilled > developers to quickly and reliably implement new features. It is > still unpopular. Most companies do not like the idea of using a > language that requires them to find a top 10% or top 1% developer to > work on their project. 100% agree here. Most middle-level managers I have dealt with have just enough knowledge of programming to make them dangerous. As such, they tend to go for a language with a high "visibility factor", assuming that there will be a large selection of programmers to choose from (correct) and that the language must make programmers more productive (debatable). -- Regards, Benjamin Tolputt Analyst Programmer From emmiller@REDACTED Wed Feb 25 06:04:02 2009 From: emmiller@REDACTED (Evan Miller) Date: Tue, 24 Feb 2009 23:04:02 -0600 Subject: [erlang-questions] Writing a template compiler Message-ID: I have compiled some notes on how to write a template compiler for Erlang, based on my experience implementing ErlyDTL: http://www.evanmiller.org/write-a-template-compiler-for-erlang.html Hope someone finds that helpful, and any feedback is appreciated. Evan -- Evan Miller http://www.evanmiller.org/ From ttmrichter@REDACTED Wed Feb 25 07:08:52 2009 From: ttmrichter@REDACTED (Michael T. Richter) Date: Wed, 25 Feb 2009 14:08:52 +0800 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <359869.86259.qm@web65502.mail.ac4.yahoo.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com> <115617.75351.qm@web65508.mail.ac4.yahoo.com> <359869.86259.qm@web65502.mail.ac4.yahoo.com> Message-ID: <1235542132.30881.20.camel@isolde> On Tue, 2009-02-24 at 21:39 -0800, Richard Andrews wrote: > I think it is a derivative of 1. Not that people are too stupid to > understand functional languages; rather that they don't "get" them > straight away. This is true. But people didn't "get" object-oriented programming when it first came out either. (I know. I was there when the big shift happened and was one of the OOP evangelists in my workplaces crying out in the desert.) Yet now OOP is the dominant paradigm, despite its obvious flaws (including the fact that even well-written OOP code is impossible to follow in any medium-sized and up project). People don't "get" functional when they first encounter it. But people didn't "get" that "X = X + 1" makes sense in the imperative paradigm when they first encountered it. It looked like total gibberish, in fact. (Think back to your first exposure to a statement like that. I know my reaction was certainly one of gaping at the blatantly false assertion.) Functional-capable languages have been around longer than object-oriented ones. (Lisp predates Simula, no?) Hell, functional programming was known at about the same time that the whole notion of structured programming reared its head if memory serves (and it may not). Yet imperative programming, despite its counter-intuitiveness (X=X+1? are you smoking those funny cigarettes again?) won the day. There must have been a clear advantage (or at least a clear perceived advantage) to imperative approaches that the functional didn't have. > Java, C, C++, python, etc. all have familiar syntax elements that work > pretty much the same way in all of them. People feel comfortable > moving from one to the other. This I agree with. Any programming paradigm I already know I can pick up a new language for and be relatively productive in within about six months. New paradigms take me years to suss. (I'm still not 100% comfortable--more like 80%--with the functional, for example. I've been trying off and on, more off than on, for about ten years now.) But. As I said, the shift to OOP involved syntax and conceptual elements that broke existing thought patterns. Yet OOP caught on, functional did not. > My first functional language was elisp. If it had been erlang I think > I would have started using functional languages seriously a lot > earlier in my career. Mine was Scheme which I hated. Oatmeal with fingernail cuttings littering it. Then I found Haskell and began to see the beauty, despite struggling with some of the hopelessly over-abstracted, under-explained notions within it like monads and arrows and functors (oh my!). (One of the single dumbest statements I've ever heard a really smart guy say was something along the line of "if we'd called monads 'Warm Fuzzy Things' instead people wouldn't be so afraid of them". The scary part of monads isn't the name. It's the fact that nobody has coherently and concretely explained what they are!) Now I tinker with Erlang, although I really don't like its inability to do complex data types well. Haskell wins on that front hands-down. > As for those who *make* imperative languages. They probably also use > (or even write) functional languages. Use the right tool for the job. > C is still the best tool for a lot of work I do. This. This is the thing. Yes, functional languages are a thing of beauty (some more beautiful than others). They do not, however, act as EABAs for every problem domain. I'd laugh at anybody who suggested I write device drivers or certain categories of embedded code in Erlang or Haskell over C/C++ in the same way that I'd laugh at someone who suggested I hand-roll data storage in C++ or Java instead of using SQL. There are times when the stateful approach is not only right, but necessary. Like, say, when you're dealing with a problem domain that has states. (You know, like registers in a peripheral device.) > People write languages to create a tool to solve a problem. You get > problems when you choose a tool because it's the only one you > understand. The golden hammer. Yes. I view programmers who are comfortable with one or two languages with about the same respect as I view mechanics who only know how to use a screwdriver and a hammer. (Hint: no respect whatsoever.) > I don't buy 2, 3 or 4 - but I would add > 6. FUD. It looks scary. Well, as I said, I definitely buy 3. There are no functional programmers out there in numbers worth mentioning. This means any solutions you use have to be accessible to the programmers you do have. (This is why, incidentally, I don't sneer at Scala the way some Erlang fans do. I think Scala is an interesting way to drag Java programmers into the world of functional programming and actor-based programming in baby steps.) And 4 I definitely also buy because I'm someone who was driven off by a community's attitude toward newcomers. I picked the messages I did for my examples for a reason. It was messages like that (and a thousand others in comp.lang.lisp) that made me ditch Lisp when I first started looking at alternatives to the C++ ghetto I found myself in. The whole assumption that people who don't do things the way you think they should be done are just stupid is off-putting and counterproductive if you have any intent of expanding a user base. -- Michael T. Richter (GoogleTalk: ttmrichter@REDACTED) There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies. (Charles Hoare) -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: From bbmaj7@REDACTED Wed Feb 25 06:39:33 2009 From: bbmaj7@REDACTED (Richard Andrews) Date: Tue, 24 Feb 2009 21:39:33 -0800 (PST) Subject: [erlang-questions] The Beauty of Erlang Syntax References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com> <115617.75351.qm@web65508.mail.ac4.yahoo.com> Message-ID: <359869.86259.qm@web65502.mail.ac4.yahoo.com> I think it is a derivative of 1. Not that people are too stupid to understand functional languages; rather that they don't "get" them straight away. Most programmers first learn an imperative language (even in CS at university) and functional languages look wrong after that. Java, C, C++, python, etc. all have familiar syntax elements that work pretty much the same way in all of them. People feel comfortable moving from one to the other. Functional languages have different syntax elements and as such beginners are hit with a large barrier to understanding. It looks too hard so they give up. In my experience, once someone learns one functional language they tend to learn several because there is no longer such a leap required. My first functional language was elisp. If it had been erlang I think I would have started using functional languages seriously a lot earlier in my career. As for those who *make* imperative languages. They probably also use (or even write) functional languages. Use the right tool for the job. C is still the best tool for a lot of work I do. People write languages to create a tool to solve a problem. You get problems when you choose a tool because it's the only one you understand. I don't buy 2, 3 or 4 - but I would add 6. FUD. It looks scary. -- Rich ________________________________ From: Michael Richter To: erlang-questions@REDACTED Sent: Wednesday, 25 February, 2009 2:27:40 PM Subject: Re: [erlang-questions] The Beauty of Erlang Syntax I would like to ask a multi-part, but rhetorical, question of the list: Why do you think people stay away from functional programming languages in droves? 1. Is it because they're too stupid to understand them? 2. Is it because of an evil cabal of IT Illuminati who are trying to squelch the true freedom of the programming masses? 3. Is it because the functional languages available do not seem to meet their needs, whatever those may be? 4. Is it because the fans of functional languages often come across as religious fanatics preaching the One True Way of programming? 5. Is it some combination of the above? Stay connected to the people that matter most with a smarter inbox. Take a look http://au.docs.yahoo.com/mail/smarterinbox -------------- next part -------------- An HTML attachment was scrubbed... URL: From v@REDACTED Wed Feb 25 08:19:58 2009 From: v@REDACTED (Valentin Micic) Date: Wed, 25 Feb 2009 09:19:58 +0200 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <4E668799-55B0-433D-A4AE-A957022912DF@scaldeferri.com> Message-ID: <200902250715.n1P7FQRc027056@mail.pharos-avantgard.com> It seems like a wrong answer or a wrong question, so, how can any of this be right? V. _____ From: Kevin Scaldeferri [mailto:kevin@REDACTED] Sent: 25 February 2009 01:26 AM To: Valentin Micic Cc: 'Christian'; 'erlang-questions' Subject: Re: [erlang-questions] The Beauty of Erlang Syntax The hypothetical question was "Should I use language X to build my application?", or "Is X a practical / real-world language?". I.e., more-or-less the converse of the question we started with of "Is X an academic language?". -kevin On Feb 24, 2009, at 3:02 PM, Valentin Micic wrote: If "I can easily hire someone" is an answer, I am not quite sure what would be the question, let alone a problem, if any. _____ From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Kevin Scaldeferri Sent: 25 February 2009 12:11 AM To: Christian Cc: erlang-questions Subject: Re: [erlang-questions] The Beauty of Erlang Syntax On Feb 24, 2009, at 1:54 PM, Christian wrote: In a way, the research that lead to Erlang was about finding a way to making it faster to have low-skilled developers cranking out new features. It certainly wouldnt be good PR if Erlang was a language for highly-skilled developers to slowly cranking out old features. I wasn't in the industry at the time, but I'm not sure that the programming workforce of the 80's closely resembled the workforce of today (or the past decade). But, really, one should ask, if Erlang was designed / evolved / selected with this goal, why is it that 20 years later most developers have never even heard of it? I guess one possibility would be to blame Ericsson and credit MS and Sun for why C# and Java are the languages of choice for companies who care more about how easy it is to hire an army of developers than anything else. There could be other possible explanations, though. Also, you've exaggerated & distorted my point with your last sentence. Haskell unabashedly markets itself as a language for highly skilled developers to quickly and reliably implement new features. It is still unpopular. Most companies do not like the idea of using a language that requires them to find a top 10% or top 1% developer to work on their project. Of course, you might also have misinterpreted my comment entirely. I'm certainly not promoting this point of view, but just saying that to a lot of companies "practical for the real world" means "I can easily hire someone". -kevin On Tue, Feb 24, 2009 at 18:14, Kevin Scaldeferri wrote: It's kinda funny how often people think of things like reliability, high-availability, etc. as "academic" concerns. An awful lot of companies care primarily about how fast low-skilled developers can crank out new features. -kevin -------------- next part -------------- An HTML attachment was scrubbed... URL: From john.hughes@REDACTED Wed Feb 25 08:38:04 2009 From: john.hughes@REDACTED (John Hughes) Date: Wed, 25 Feb 2009 08:38:04 +0100 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: References: Message-ID: <0B22BAEF6D984175935829DF520257D1@HallDesktop> > From: "Michael T. Richter" > I'd laugh at anybody who suggested I > write device drivers or certain categories of embedded code in Erlang or > Haskell over C/C++ in the same way that I'd laugh at someone who > suggested I hand-roll data storage in C++ or Java instead of using SQL. > There are times when the stateful approach is not only right, but > necessary. Like, say, when you're dealing with a problem domain that > has states. (You know, like registers in a peripheral device.) Funnily enough, there are people doing precisely this--Mark Jones gave a superb talk about it at ICFP last year. A Principled Approach to Operating System Construction in Haskell http://web.cecs.pdx.edu/~apt/icfp05.pdf Writing Systems Software in a Functional Language: An Experience Report http://web.cecs.pdx.edu/~mpj/pubs/plos07.html Although this is still experimental, rather than production quality code--from the latter paper: "We do not know, for example, if the House kernel can be tuned or enhanced to provide reason- able throughput with the workload of a conventional desktop or server, or if its network interface can keep pace with line speed on a standard Ethernet connection. Although it may be possible to achieve these kinds of performance goals especially, in the long term, if we can rely on aggressive, whole program optimization, it is unlikely that they will be met with current Haskell systems." Still interesting work though, and shows that, from an expressiveness point of view, writing system software in a functional language is no particular problem. John From rob.charlton@REDACTED Wed Feb 25 09:35:12 2009 From: rob.charlton@REDACTED (Rob Charlton) Date: Wed, 25 Feb 2009 08:35:12 +0000 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com> <115617.75351.qm@web65508.mail.ac4.yahoo.com> Message-ID: <49A502C0.2080208@savageminds.com> Michael Richter wrote: > Why do you think people stay away from functional programming > languages in droves? I think there is a much simpler answer to this question to do with culture in software teams / engineering firms (at least the ones I have come into contact with). I've not encountered a working environment where at the start of a new project, someone has asked the question: "What programming language should we use?" The reason nobody has asked this is that for one of several reasons the answer is fixed in advance: 1) The development team is a team of programmers who know X 2) We are writing a system for operating system Y for which the only applicable language choice is X 3) We are extending / improving product Z which is written in X and we're not about to re-write it 4) The CTO is a fan of language X and has already hired X experts to get the job done 5) The engineering manager wants to play it safe, follow the herd, and develop the system like "everyone else does", using language X 6) We are doing work for a customer, and the customer says use language X If someone in the team suggests using language P instead then there is a huge practical barrier to accepting that which means it will be dismissed almost out of hand (unless P is C or C++ or Java or C# and there is a viable route to change). There is a rock solid business case for picking Erlang in a lot of circumstances which the CEO/CTO/CFO/Engineering manager could be convinced of I'm sure, but they would have to put aside the considerations above which may not be possible. The high availability / programming productivity / SMP scalability arguments will absolutely grab the attention. I don't believe it makes any difference if the language is imperative or functional, Erlang or Logo or Lolcode. For my own company, we started using Erlang because we believed in the ideas in Joe's thesis paper and wanted to give it a try. We can't use it for all our work: the Symbian OS development that we do pretty much dictates C++ and Lua, Blackberry dictates Java, other embedded phone work dictates C. But our server products can be written in whatever we like. And we like Erlang :) -- Rob Charlton Savage Minds Ltd From mikael@REDACTED Wed Feb 25 10:01:49 2009 From: mikael@REDACTED (Mikael Lixenstrand) Date: Wed, 25 Feb 2009 10:01:49 +0100 Subject: [erlang-questions] R13A-0 Message-ID: Hi Could i find information about http://www.erlang.org/download/snapshots/otp_src_R13A-0.tar.gz some where? Thanks /Mikael -------------- next part -------------- An HTML attachment was scrubbed... URL: From bgustavsson@REDACTED Wed Feb 25 10:18:11 2009 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Wed, 25 Feb 2009 10:18:11 +0100 Subject: [erlang-questions] R13A-0 In-Reply-To: References: Message-ID: <6672d0160902250118m19069f3boc9a199167c940a6f@mail.gmail.com> 2009/2/25 Mikael Lixenstrand : > Hi > > Could i find information about > http://www.erlang.org/download/snapshots/otp_src_R13A-0.tar.gz some where? It is a source code snapshot containing the latest source code from our R13A development branch. It is updated every night. You are welcome to build it and test it. For the moment, we don't have any documentation or release notes for the snapshots publically available. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From ulf.wiger@REDACTED Wed Feb 25 10:17:14 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Wed, 25 Feb 2009 09:17:14 +0000 Subject: [erlang-questions] The Beauty of Erlang Syntax Message-ID: Michael Richter wrote: > > I would like to ask a multi-part, but rhetorical, question of the list: > >Why do you think people stay away from functional programming > languages in droves? In my experience, succeeding in commercial software development is usually more about understanding your limits and capacity, more than using the sharpest possible tool (better the devil you know...) >From that perspective, it's not so much a matter of 'staying away in droves' as sticking with what you know. This is especially true in large companies, where multiplying a technical cost assessment with a "project factor" of 5-10 seems like a perfectly sensible thing to do*. Here, 'predictable' beats 'brilliant' (almost) every time. * Indeed, as long as same company makes a healthy profit, who's to say that it /isn't/ sensible? BR, Ulf W -- CTO, Erlang Training & Consulting Ltd. http://www.erlang-consulting.com From ttmrichter@REDACTED Wed Feb 25 10:41:19 2009 From: ttmrichter@REDACTED (Michael T. Richter) Date: Wed, 25 Feb 2009 17:41:19 +0800 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: References: Message-ID: <1235554880.30881.31.camel@isolde> On Wed, 2009-02-25 at 09:17 +0000, Ulf Wiger wrote: > >Why do you think people stay away from functional programming > > languages in droves? > > In my experience, succeeding in commercial software development is > usually more about understanding your limits and capacity, more than > using the sharpest possible tool (better the devil you know...) > From that perspective, it's not so much a matter of 'staying away in > droves' as sticking with what you know. > This is especially true in large companies, where multiplying a > technical cost assessment with a "project factor" of 5-10 seems like > a perfectly sensible thing to do*. Here, 'predictable' beats > 'brilliant' (almost) every time. > * Indeed, as long as same company makes a healthy profit, who's to say > that it /isn't/ sensible? As usual, Ulf gives an answer that gives me some hope. This is the kind of thinking I like to see instead of the far more common "they just don't get it" or the far more obnoxious version of the same thinking "they're just too stupid to understand it". Even the various "Sun and Microsoft marketing killed the language landscape" answers beg the question because even if it were true, why did Sun and Microsoft use C and C++ and later "improve" upon these with Java and C# respectively? -- Michael T. Richter (GoogleTalk: ttmrichter@REDACTED) A well-designed and humane interface does not need to be split into beginner and expert subsystems. (Jef Raskin) -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: From ttmrichter@REDACTED Wed Feb 25 10:48:21 2009 From: ttmrichter@REDACTED (Michael T. Richter) Date: Wed, 25 Feb 2009 17:48:21 +0800 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <49A502C0.2080208@savageminds.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com> <115617.75351.qm@web65508.mail.ac4.yahoo.com> <49A502C0.2080208@savageminds.com> Message-ID: <1235555301.30881.40.camel@isolde> On Wed, 2009-02-25 at 08:35 +0000, Rob Charlton wrote: > Michael Richter wrote: > > Why do you think people stay away from functional programming > > languages in droves? > The reason nobody has asked this is that for one of several reasons the > answer is fixed in advance: > 1) The development team is a team of programmers who know X > 2) We are writing a system for operating system Y for which the only > applicable language choice is X > 3) We are extending / improving product Z which is written in X and > we're not about to re-write it > 4) The CTO is a fan of language X and has already hired X experts to get > the job done > 5) The engineering manager wants to play it safe, follow the herd, and > develop the system like "everyone else does", using language X > 6) We are doing work for a customer, and the customer says use language X To me this is answer #3 from my original post: the needs of the user. 1. If the development team is most familiar with/capable of X, then X is the only rational choice in a competitive (read: non-academic) environment. Time to market kills quality dead in almost, but not quite, all business situations. 2. Again this is a user need. The choice was made because their (presumably rational) choice of platform dictated their choice of language. 3. No expansion needed. 4. This is a variant of your 1, albeit a variant that is unfortunate. 5. This is similarly a variant of your 1, one that is less unfortunate. It is a relatively sound engineering principle to go with proven technology unless the proven technology proves incapable of the task. 6. Again this is a user need. Presumably the customer in question is using one of your six explanations in their own decision. > There is a rock solid business case for picking Erlang in a lot of > circumstances which the CEO/CTO/CFO/Engineering manager could be > convinced of I'm sure, but they would have to put aside the > considerations above which may not be possible. You get no disagreement from me on this. I would never choose Erlang for any of my embedded work nor my device drivers back when I did those two. But for a lot of my software I'd have murdered my own grandmother in a slow and gruesome fashion to have access to something like Erlang. (The closest I got was using QNX for a while whose message-passing style made me understand and appreciate Erlang instantly on contact.) > For my own company, we started using Erlang because we believed in > the > ideas in Joe's thesis paper and wanted to give it a try. We can't use > it > for all our work: the Symbian OS development that we do pretty much > dictates C++ and Lua, Blackberry dictates Java, other embedded phone > work dictates C. But our server products can be written in whatever > we > like. And we like Erlang :) And I am insanely jealous. Trust me. :D -- Michael T. Richter (GoogleTalk: ttmrichter@REDACTED) When debugging, novices insert corrective code; experts remove defective code. (Richard Pattis) -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: stock_smiley-6.png Type: image/png Size: 850 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: From erlang@REDACTED Wed Feb 25 10:56:24 2009 From: erlang@REDACTED (Joe Armstrong) Date: Wed, 25 Feb 2009 10:56:24 +0100 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <1235542132.30881.20.camel@isolde> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com> <115617.75351.qm@web65508.mail.ac4.yahoo.com> <359869.86259.qm@web65502.mail.ac4.yahoo.com> <1235542132.30881.20.camel@isolde> Message-ID: <9b08084c0902250156o615015bfwfa29c4c3f81f20e9@mail.gmail.com> 2009/2/25 Michael T. Richter : > On Tue, 2009-02-24 at 21:39 -0800, Richard Andrews wrote: > > I think it is a derivative of 1. Not that people are too stupid to > understand functional languages; rather that they don't "get" them straight > away. > I disagree (a bit) - I've taught Erlang a few times to classes of very mixed ability. The bit they found easy was the non-mutable state bit. I explained that A = 1, B = A + 6, B = 7 works, but A = 1, B = A + 6, B = 8 fails (obviously) The beginners have no problems with this idea - nor with pattern matching in lists and tuples. What they *do* have problems with is SYNTAX. They forget a comma, or a semicolon, they write abc for a variable instead of Abc - then they spend a *long* time staring at there program wondering what went wrong. I come over an see the error "instantly" correct the error - and they are happy as new born lambs. The *ideas* in FP are easy - the syntax is not. I have *exactly the same problem* learning a new programming language - *any* programming language - I make small syntactic errors and stare at the program for hours wondering what went wrong. << a few days ago I was writing some javascript and called function "new" (by mistake) it took a long time before I twigged >> So the ideas in FP are easy but the syntax is a bit of a bother to learn. Then there's the difficult bit (it occurs a bit later, when you getb over the syntax problem phase) You have to get the data you need, to the place in the program where you need it - so somehow it has to go through the argument lists of the functions that get called to get to the place where it is needed. This involves a bit of planning - but becomes second nature after a while (If you had global variables this would be easy BUT this destroys all the nice properties that non-mutable data has). In OOPs life is easy - you have mutable state all nicely hidden in the object, so you can pile effect upon effect and mess around with state in any way you feel like - this adds power, efficiency and incomprehensibility. If FLPs you can't do this - you have to plan your data structures in advance and figure out exactly what you want to do with them - the mental process of doing so is identical in all FLPs I've seen. I've been learning Haskell from the new (excellent) Haskell book - under the surface it's extremely similar - (or the syntax is different, the type systems are different, the evaluation strategies are different) - but the problem of getting the data to the place in the program where you need it is the same. Thinks like Monads in Haskell hide this for you, just as processes which store data in tail-recursive loop in erlang. Same problem - different solution. FP is no difficult - it is *different* If you learn Erlang and change you mind and want to learn Haskell or O'Caml half the work is done (just like switching from Java to C# or python to ruby) - learn the general properties of the language *family* and you're laughing. > This is true.? But people didn't "get" object-oriented programming when it > first came out either.? (I know.? I was there when the big shift happened > and was one of the OOP evangelists in my workplaces crying out in the > desert.)? Yet now OOP is the dominant paradigm, despite its obvious flaws > (including the fact that even well-written OOP code is impossible to follow > in any medium-sized and up project). > > People don't "get" functional when they first encounter it. No - they do - at least my pupils did. My generation learnt recursion at school I learnt in school that sin(2A) = 2 sin(A) cos(A) This stuff sits deep (I loved maths) What they didn't tell me was that this was an Erlang program - rearrange a bit sin(X) = 2 sin(X/2) cos(X/2) add an arrow stars and a dot sin(X) -> 2*sin(X/2)*cos(C/2). And we have a program So they taught me functional programming in school way before microprocessors were even dreamt of. > ? But people > didn't "get" that "X = X + 1" makes sense in the imperative paradigm when > they first encountered it.? It looked like total gibberish, in fact. It *is* gibberish - my math teacher told me when I was 10 years old. (Think > back to your first exposure to a statement like that.? I know my reaction > was certainly one of gaping at the blatantly false assertion.) > > Functional-capable languages have been around longer than object-oriented > ones.? (Lisp predates Simula, no?)? Hell, functional programming was known > at about the same time that the whole notion of structured programming > reared its head if memory serves (and it may not).? Yet imperative > programming, despite its counter-intuitiveness (X=X+1?? are you smoking > those funny cigarettes again?) won the day. It gained a temporary victory > There must have been a clear > advantage (or at least a clear perceived advantage) to imperative approaches > that the functional didn't have. > > Java, C, C++, python, etc. all have familiar syntax elements that work > pretty much the same way in all of them. People feel comfortable moving from > one to the other. Just like people will feel comfortable moving between Haskell, Erlang, F# O'caml > This I agree with.? Any programming paradigm I already know I can pick up a > new language for and be relatively productive in within about six months. Same for FP - > New paradigms take me years to suss.? (I'm still not 100% comfortable--more > like 80%--with the functional, for example.? I've been trying off and on, > more off than on, for about ten years now.) Yes - this OOP stuff is *really* difficult - I just don't grok it > But. > > As I said, the shift to OOP involved syntax and conceptual elements that > broke existing thought patterns.? Yet OOP caught on, functional did not. Not *then* > My first functional language was elisp. If it had been erlang I think I > would have started using functional languages seriously a lot earlier in my > career. > Mine was Scheme which I hated. I think scheme is *beautiful* - *too* beautiful (like prolog) so beautiful that when you see it you think - I can't improve this - so there is nothing for you to do - (but I found that scheme had zero libraries, like prolog :-) >? Oatmeal with fingernail cuttings littering > it.? Then I found Haskell and began to see the beauty, despite struggling > with some of the hopelessly over-abstracted, under-explained notions within > it like monads and arrows and functors (oh my!).? (One of the single dumbest > statements I've ever heard a really smart guy say was something along the > line of "if we'd called monads 'Warm Fuzzy Things' instead people wouldn't > be so afraid of them".? The scary part of monads isn't the name.? It's the > fact that nobody has coherently and concretely explained what they are!) Yes - agree - we need *lots of good books* and we need to loose the "academic" stamp. Trouble is most of the really-good erlang/Haskell programmers are too busy working in companies that are totally smashing all competition to be bothered to explain what they're doing. Changing to FP is a big paradigm shift so takes more time to achieve than an incremental improvement to an OO-language > Now I tinker with Erlang, although I really don't like its inability to do > complex data types well.? Haskell wins on that front hands-down. > > As for those who *make* imperative languages. They probably also use (or > even write) functional languages. Use the right tool for the job. C is still > the best tool for a lot of work I do. I get Erlang to write the C for me :-) > > This.? This is the thing.? Yes, functional languages are a thing of beauty > (some more beautiful than others).? They do not, however, act as EABAs for > every problem domain.? I'd laugh at anybody who suggested I write device > drivers or certain categories of embedded code in Erlang or Haskell over > C/C++ in the same way that I'd laugh at someone who suggested I hand-roll > data storage in C++ or Java instead of using SQL.? There are times when the > stateful approach is not only right, but necessary.? Like, say, when you're > dealing with a problem domain that has states.? (You know, like registers in > a peripheral device.) But I might get Erlang/Haskell to generate the C/whatever code for the driver - > > People write languages to create a tool to solve a problem. You get problems > when you choose a tool because it's the only one you understand. > > The golden hammer.? Yes.? I view programmers who are comfortable with one or > two languages with about the same respect as I view mechanics who only know > how to use a screwdriver and a hammer.? (Hint: no respect whatsoever.) > > I don't buy 2, 3 or 4 - but I would add > ??? 6. FUD. It looks scary. > > Well, as I said, I definitely buy 3.? There are no functional programmers > out there in numbers worth mentioning.? This means any solutions you use > have to be accessible to the programmers you do have.? (This is why, > incidentally, I don't sneer at Scala the way some Erlang fans do.? I think > Scala is an interesting way to drag Java programmers into the world of > functional programming and actor-based programming in baby steps.)? And 4 I > definitely also buy because I'm someone who was driven off by a community's > attitude toward newcomers.? I picked the messages I did for my examples for > a reason.? It was messages like that (and a thousand others in > comp.lang.lisp) that made me ditch Lisp when I first started looking at > alternatives to the C++ ghetto I found myself in.? The whole assumption that > people who don't do things the way you think they should be done are just > stupid is off-putting and counterproductive if you have any intent of > expanding a user base. > -- > Michael T. Richter (GoogleTalk: ttmrichter@REDACTED) > There are two ways of constructing a software design. One way is to make it > so simple that there are obviously no deficiencies. And the other way is to > make it so complicated that there are no obvious deficiencies. (Charles > Hoare) > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > /Joe Armstrong From ttmrichter@REDACTED Wed Feb 25 11:22:02 2009 From: ttmrichter@REDACTED (Michael T. Richter) Date: Wed, 25 Feb 2009 18:22:02 +0800 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <9b08084c0902250156o615015bfwfa29c4c3f81f20e9@mail.gmail.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com> <115617.75351.qm@web65508.mail.ac4.yahoo.com> <359869.86259.qm@web65502.mail.ac4.yahoo.com> <1235542132.30881.20.camel@isolde> <9b08084c0902250156o615015bfwfa29c4c3f81f20e9@mail.gmail.com> Message-ID: <1235557322.30881.53.camel@isolde> On Wed, 2009-02-25 at 10:56 +0100, Joe Armstrong wrote: > > Functional-capable languages have been around longer than object-oriented > > ones. (Lisp predates Simula, no?) Hell, functional programming was known > > at about the same time that the whole notion of structured programming > > reared its head if memory serves (and it may not). Yet imperative > > programming, despite its counter-intuitiveness (X=X+1? are you smoking > > those funny cigarettes again?) won the day. > It gained a temporary victory You're begging the question, Joe. WHY did it gain this temporary victory? You said that people have no problems when first encountering functional programming. (This runs counter to my experience, but I'll assume we just ran in different circles and move on from here.) If functional programming makes more sense to beginners, if imperative programming is so counter-intuitive, so difficult and so prone to failure (and I will agree 100% with that last point), how did it become the dominant paradigm for pretty much all of computing's existence? Again I have to say, there must be something that gave it a (perceived) edge over functional programming. THAT is what fans of functional programming (and I include myself in this number, I hasten to add!) have to address. Not making excuses like "they're too stupid to understand" or "Microsoft/Sun's evil cabal forced it". > > New paradigms take me years to suss. (I'm still not 100% comfortable--more > > like 80%--with the functional, for example. I've been trying off and on, > > more off than on, for about ten years now.) > Yes - this OOP stuff is *really* difficult - I just don't grok it Took me about five years of concerted effort before I could comfortably call myself an OO developer. > > As I said, the shift to OOP involved syntax and conceptual elements that > > broke existing thought patterns. Yet OOP caught on, functional did not. > Not *then* But this is my point exactly. Why didn't functional programming kick ass then? What was it about functional programming that relegated it (hopefully temporarily) to the dusty halls of academia? > (One of the single dumbest > > statements I've ever heard a really smart guy say was something along the > > line of "if we'd called monads 'Warm Fuzzy Things' instead people wouldn't > > be so afraid of them". The scary part of monads isn't the name. It's the > > fact that nobody has coherently and concretely explained what they are!) > Yes - agree - we need *lots of good books* and we need to loose the > "academic" stamp. Your book on Erlang was a great beginning. The new book on Haskell is a fine addition to the arsenal. About fifty more of these and we're on our way! > Trouble is most of the really-good erlang/Haskell programmers are too > busy working > in companies that are totally smashing all competition to be bothered to explain > what they're doing. I've heard this asserted many times. I have seen literally zero evidence of it. Where is this list of companies going out and kicking ass on the competition with their 133t coding skillz and Haskell/Erlang/*ML/whatever? This isn't a flippant question. It would be really nice to show large, successful companies using Haskell and/or Erlang in real-world situations that aren't niches. (Erlang is pretty much pegged as a niche telecom language, for example, while Haskell is pegged as a language only eggheads like.) Business cases would be far simpler to make if this could be shown. > I get Erlang to write the C for me :-) This is an intriguing idea. Care to blog on it? -- Michael T. Richter (GoogleTalk: ttmrichter@REDACTED) I can see computers everywhere - except in the productivity statistics! (Robert Solow) -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: From thomasl_erlang@REDACTED Wed Feb 25 11:09:22 2009 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 25 Feb 2009 02:09:22 -0800 (PST) Subject: [erlang-questions] erlang flagship product (was The Beauty of Erlang Syntax) References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <87ocwrpyiv.fsf@sterlett.hq.kred> <4d08db370902240925u52d6f17cledb5416813c0fdc3@mail.gmail.com> <769685.50188.qm@web65512.mail.ac4.yahoo.com> Message-ID: <291863.53837.qm@web111416.mail.gq1.yahoo.com> ----- Original Message ---- > From: Richard Andrews > To: erlang-questions > Sent: Tuesday, February 24, 2009 10:41:56 PM > Subject: [erlang-questions] erlang flagship product (was The Beauty of Erlang Syntax) > > > > Show me reliable system in Java with million SLOC. Java is > > "academic". Be fair, Java system should have about ten or > > more million SLOC to be compared to AXD 301. > > It's a great story but why is the AXD301 (a project from the 1990s) still held > up as the flagship example of the virtues of erlang? Is this still the best we > have? > The software development universe has evolved from where it was in 1997. Surely > there are more recent examples of projects where erlang delivered functionality > and reliability quickly and cheaply. Pragmatically speaking, Ericsson has spent a lot of money and man-years on developing AXD301, with excellent results and even some public documentation of it all; if someone wants a good example of actual industrial development in Erlang over many years with dozens of programmers, AXD301 can usually beat down any objections. That said, I wouldn't mind other solid examples either. There are, of course, successful projects and companies, but not as easy to reference. If you just want a well-known, respected product/project to point at, how about ejabberd? Best, Thomas From thomasl_erlang@REDACTED Wed Feb 25 11:19:43 2009 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 25 Feb 2009 02:19:43 -0800 (PST) Subject: [erlang-questions] The Beauty of Erlang Syntax References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com> Message-ID: <124310.26590.qm@web111413.mail.gq1.yahoo.com> (Don't know why Yahoo insists on mangling replies, but here we go.) Basically, at the end of the 90s, Ericsson chose to go with Java+UML and banned(!) new project starts in Erlang. Politically speaking, the mobile systems part of the company got to decide. On the bright side, prior to this, Erlang was closed-source. Best, Thomas ________________________________ But, really, one should ask, if Erlang was designed / evolved / selected with this goal, why is it that 20 years later most developers have never even heard of it? I guess one possibility would be to blame Ericsson and credit MS and Sun for why C# and Java are the languages of choice for companies who care more about how easy it is to hire an army of developers than anything else. There could be other possible explanations, though. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rapsey@REDACTED Wed Feb 25 12:50:33 2009 From: rapsey@REDACTED (Rapsey) Date: Wed, 25 Feb 2009 12:50:33 +0100 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <1235557322.30881.53.camel@isolde> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com> <115617.75351.qm@web65508.mail.ac4.yahoo.com> <359869.86259.qm@web65502.mail.ac4.yahoo.com> <1235542132.30881.20.camel@isolde> <9b08084c0902250156o615015bfwfa29c4c3f81f20e9@mail.gmail.com> <1235557322.30881.53.camel@isolde> Message-ID: <97619b170902250350n5fd38670lbff6c67e3aec0438@mail.gmail.com> 2009/2/25 Michael T. Richter > Trouble is most of the really-good erlang/Haskell programmers are too > busy working > in companies that are totally smashing all competition to be bothered to explain > what they're doing. > > > I've heard this asserted many times. I have seen literally *zero*evidence of it. Where is this list of companies going out and kicking ass > on the competition with their 133t coding skillz and > Haskell/Erlang/*ML/whatever? This isn't a flippant question. It would be > *really* nice to show large, successful companies using Haskell and/or > Erlang in real-world situations that aren't niches. (Erlang is pretty much > pegged as a niche telecom language, for example, while Haskell is pegged as > a language only eggheads like.) Business cases would be far simpler to make > if this could be shown. > For my company, I can say we use a custom built streaming server written in Erlang. If Erlang did not exist, we would not have the slightest chance in hell of succeeding. Because we would be just another company offering solutions built on top of technology everyone else is using and is limited by, in a very crowded market. I see no other technology in existance that comes close to offering the speed of development and flexibility of Erlang. It fits our problem domain like a glove. Sergej -------------- next part -------------- An HTML attachment was scrubbed... URL: From francesco@REDACTED Wed Feb 25 12:53:11 2009 From: francesco@REDACTED (Francesco Cesarini (Erlang Training and Consulting)) Date: Wed, 25 Feb 2009 11:53:11 +0000 Subject: [erlang-questions] CUFP Call for Presentations (September 4th, Edinburgh Scotland) Message-ID: <49A53127.5030307@erlang-consulting.com> Commercial Users of Functional Programming Workshop (CUFP) 2009 Functional Programming As a Means, Not an End Call for Presentations Sponsored by SIGPLAN Co-located with ICFP 2008 Edinburgh,Scotland, 4 September 2009 _________________________________________________________________ Presentation proposals due 15 May 2009 http://cufp.galois.com/2009/call.html _________________________________________________________________ Functional languages have been under academic development for over 25 years, and remain fertile ground for programming language research. Recently, however, developers in industrial, governmental, and open source projects have begun to use functional programming successfully in practical applications. In these settings, functional programming has often provided dramatic leverage, including whole new ways of thinking about the original problem. The goal of the CUFP workshop is to act as a voice for these users of functional programming. The workshop supports the increasing viability of functional programming in the commercial, governmental, and open-source space by providing a forum for professionals to share their experiences and ideas, whether those ideas are related to business, management, or engineering. The workshop is also designed to enable the formation and reinforcement of relationships that further the commercial use of functional programming. Providing user feedback to language designers and implementors is not a primary goal of the workshop, though it will be welcome if it occurs. Speaking at CUFP If you use functional programming as a means, rather than as an end, we invite you to offer to give a talk at the workshop. Alternatively, if you know someone who would give a good talk, please nominate them! Talks are typically 30-45 minutes long, but can be shorter. They aim to inform participants about how functional programming played out in real-world applications, focusing especially on the re-usable lessons learned, or insights gained. Your talk does not need to be highly technical; for this audience, reflections on the commercial, management, or software engineering aspects are, if anything, more important. You do not need to submit a paper! If you are interested in offering a talk, or nominating someone to do so, send an e-mail to jim (dot) d (dot) grundy (at) intel (dot) com or francesco(at) erlang-consulting (dot) com by 2 June 2008 with a short description of what you'd like to talk about or what you think your nominee should give a talk about. Such descriptions should be about one page long. Program Plans CUFP 2008 will last a full day and feature an invited presentation from Bryan O'Sullivan, co-author of Real World Haskell. The program will also include a mix of presentations and discussion sessions. Topics will range over a wide area, including: * Case studies of successful and unsuccessful uses of functional programming; * Business opportunities and risks from using functional languages; * Enablers for functional language use in a commercial setting; * Barriers to the adoption of functional languages, and * Mitigation strategies for overcoming limitations of functional programming. There will be no published proceedings, as the meeting is intended to be more a discussion forum than a technical interchange. This will be the sixth CUFP, for more information - including reports from attendees of previous events - see the workshop web site: http://cufp.galois.com/ If you have any questions, let me know. Best regards, Francesco & Jim -- http://www.erlang-consulting.com From erlang@REDACTED Wed Feb 25 13:39:22 2009 From: erlang@REDACTED (Joe Armstrong) Date: Wed, 25 Feb 2009 13:39:22 +0100 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <1235557322.30881.53.camel@isolde> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com> <115617.75351.qm@web65508.mail.ac4.yahoo.com> <359869.86259.qm@web65502.mail.ac4.yahoo.com> <1235542132.30881.20.camel@isolde> <9b08084c0902250156o615015bfwfa29c4c3f81f20e9@mail.gmail.com> <1235557322.30881.53.camel@isolde> Message-ID: <9b08084c0902250439o7e00d9d1g8ac6362b18a75577@mail.gmail.com> On Wed, Feb 25, 2009 at 11:22 AM, Michael T. Richter wrote: > On Wed, 2009-02-25 at 10:56 +0100, Joe Armstrong wrote: > >> Functional-capable languages have been around longer than object-oriented >> ones.? (Lisp predates Simula, no?)? Hell, functional programming was known >> at about the same time that the whole notion of structured programming >> reared its head if memory serves (and it may not).? Yet imperative >> programming, despite its counter-intuitiveness (X=X+1?? are you smoking >> those funny cigarettes again?) won the day. > > It gained a temporary victory > > You're begging the question, Joe.? WHY did it gain this temporary victory? Because at the time FPLs were not ready for wide-scale industrial deployment. (Ready here means has achieved critical mass in industrial projects, has earned a few hundred million dollars, means "bet your business stuff") C++ came of age in October 1985 (first book and commercial release) Erlang started in 86 and was not ready for prime-time until a decade later Haskell started in 1987 ... C++ has a 10 year start ... When C++ came is was heavily marketed as the successor to C ("an improved C") since C was very popular it took off like a rocket. C++ spread as if in a vacuum - there were no competing FPLs at the time (Lisp possibly - but this needed an expensive lisp machine). Java came later and was perceived as OO done properly (in the sence that C++ was not really OO) The step from C to C++ was perceived as easy, the step from C++ to java was perceived as easy. The marketing guys and hipe machines were in full swing. I remember being told by a salesman with a PhD in CS that C++ class libraries would solve all problems forever - write once - inheret the code in the future - the end of SW development. This was the best form of snake oil and management bought in to it by the barrel load. At the time, the big class libraries did not exist, big projects had not yet failed, and FPLs were not ready for prime time. CS departments taught programming (C, C++, Ada) and Math departments taught ML or Prolog (if you're lucky) By 98 when Erlang was ready for prime time - java etc have captured all market share At this stage being better isn't an option - we have to be > 10 times better AND the existing technology has to have problems. Well this condition has been satisfied in many areas, we have achieved critical mass and are growing. Eventually we will have to fight out market share between Erlang/Haskell/O'caml/F# but today we stand to loose by this. We are gaining market share, we are market leading in the niche markets that we have chosen to attack (for example messaging, XMPP etc - ejabberd) As time goes on more niche areas get added to the areas where we have market dominance. > You said that people have no problems when first encountering functional > programming.? (This runs counter to my experience, but I'll assume we just > ran in different circles and move on from here.)? If functional programming > makes more sense to beginners, if imperative programming is so > counter-intuitive, so difficult and so prone to failure (and I will agree > 100% with that last point), how did it become the dominant paradigm for > pretty much all of computing's existence?? Again I have to say, there must > be something that gave it a (perceived) edge over functional programming. History - it was ready for prime time *before* FPLs - FPLs were a nice theory in the 1930's and onwards but not something to bet your $$$ on, That was changed. > THAT is what fans of functional programming (and I include myself in this > number, I hasten to add!) have to address.? Not making excuses like "they're > too stupid to understand" or "Microsoft/Sun's evil cabal forced it". > >> New paradigms take me years to suss.? (I'm still not 100% >> comfortable--more >> like 80%--with the functional, for example.? I've been trying off and on, >> more off than on, for about ten years now.) > > Yes - this OOP stuff is *really* difficult - I just don't grok it > > Took me about five years of concerted effort before I could comfortably call > myself an OO developer. > >> As I said, the shift to OOP involved syntax and conceptual elements that >> broke existing thought patterns.? Yet OOP caught on, functional did not. > > Not *then* > > But this is my point exactly.? Why didn't functional programming kick ass > then?? What was it about functional programming that relegated it (hopefully > temporarily) to the dusty halls of academia? Because it wasn't ready - in 1987 when people were *shipping* products in C++ FP academics were arguing over the advantages of lazy/eager evaluation and couldn't agree > (One of the single dumbest >> statements I've ever heard a really smart guy say was something along the >> line of "if we'd called monads 'Warm Fuzzy Things' instead people wouldn't >> be so afraid of them".? The scary part of monads isn't the name.? It's the >> fact that nobody has coherently and concretely explained what they are!) A lot of people have explained - a lot - the fact the question comes up time and time again is that the idea is difficult to grock. But perl is difficult to grok, C++ templates are difficult to grock. As my friend Robert says "Don't think just do it" - these are patterns you need to learn - deep understanding comes later. << When I majored in physics I did not understand Fourier transforms on first contact - nobody did - how can you represent since waves by superimposing square waves? I didn't grock it. I understood the math, but not the idea - two years later it seemed like I'd always understood it. new ideas take time, and you may not understand them the first time round - some things are difficult >> > Yes - agree - we need *lots of good books* and we need to loose the > "academic" stamp. > > Your book on Erlang was a great beginning.? The new book on Haskell is a > fine addition to the arsenal.? About fifty more of these and we're on our > way! So get writing ! Now is the time for the non-experts to wade in with the applications - write a book on ejabberd, mnesia, yaws, ... *pleeeeeeeeeease* > > Trouble is most of the really-good erlang/Haskell programmers are too > busy working > in companies that are totally smashing all competition to be bothered to > explain > what they're doing. > > I've heard this asserted many times.? I have seen literally zero evidence of > it.? Where is this list of companies going out and kicking ass on the > competition with their 133t coding skillz and Haskell/Erlang/*ML/whatever? > This isn't a flippant question.? It would be really nice to show large, > successful companies using Haskell and/or Erlang in real-world situations > that aren't niches. But the niches are where FPLs are first adopted - non niche only comes with wide scale adoption. http://kreditor.se/index.php is a nice example of an erlang company, other folks can contribute mroe info here... ? (Erlang is pretty much pegged as a niche telecom > language, for example, while Haskell is pegged as a language only eggheads > like.)? Business cases would be far simpler to make if this could be shown. > I get Erlang to write the C for me :-) > > This is an intriguing idea.? Care to blog on it? Not really - just make a HOF that returns C, then make HOFS that combine HOFS and then combined HOFS can make C - pretty easy - I've used this to build interpretors. IMHO Erlang should be implemented this way - writing C by hand is tricky - the BEAM for example was just this - each beam instruction could be either interpreted (as in the current Erlang VM) or cross compiled to C (since it was a C macro) > > -- > Michael T. Richter (GoogleTalk: ttmrichter@REDACTED) > I can see computers everywhere - except in the productivity statistics! > (Robert Solow) From thomasl_erlang@REDACTED Wed Feb 25 12:57:38 2009 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 25 Feb 2009 03:57:38 -0800 (PST) Subject: [erlang-questions] The Beauty of Erlang Syntax References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com> <115617.75351.qm@web65508.mail.ac4.yahoo.com> <359869.86259.qm@web65502.mail.ac4.yahoo.com> <1235542132.30881.20.camel@isolde> <9b08084c0902250156o615015bfwfa29c4c3f81f20e9@mail.gmail.com> <1235557322.30881.53.camel@isolde> Message-ID: <669504.48804.qm@web111403.mail.gq1.yahoo.com> Hi Michael, what would you consider "non-niche situations"? Outside of telecoms, I think Erlang is currently making a strong showing in instant messaging: ejabberd, first of all, but also Facebook's own IM. And there seems to be lots of grass roots action in the web business. The Mochi* guys are doing fine stuff for instance. Apart from Ericsson, Erlang is also being used internally by a number of telco carriers; for example, T-Mobile UK posts here from time to time. There are a handful of small companies (10-30 employees?) with respectable turnover and profitability here in Stockholm; there are also some companies in the UK, France, Spain, ... (Process One in France develops ejabberd.) Regarding using Erlang to write the C, one approach is to compile Erlang to C. The original beam compiler did that -- search for "Turbo Erlang" -- as have a couple of others. Results are mixed and so far not worth the trouble over regular beam, IMO. (Alternatively, Joe could be using erlang as a DSL with a code generator, in which case I have no opinion :-) Best, Thomas ________________________________ I've heard this asserted many times. I have seen literally zero evidence of it. Where is this list of companies going out and kicking ass on the competition with their 133t coding skillz and Haskell/Erlang/*ML/whatever? This isn't a flippant question. It would be really nice to show large, successful companies using Haskell and/or Erlang in real-world situations that aren't niches. (Erlang is pretty much pegged as a niche telecom language, for example, while Haskell is pegged as a language only eggheads like.) Business cases would be far simpler to make if this could be shown. I get Erlang to write the C for me :-) This is an intriguing idea. Care to blog on it? -------------- next part -------------- An HTML attachment was scrubbed... URL: From bbmaj7@REDACTED Wed Feb 25 13:24:31 2009 From: bbmaj7@REDACTED (Richard Andrews) Date: Wed, 25 Feb 2009 04:24:31 -0800 (PST) Subject: [erlang-questions] erlang flagship product References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <87ocwrpyiv.fsf@sterlett.hq.kred> <4d08db370902240925u52d6f17cledb5416813c0fdc3@mail.gmail.com> <769685.50188.qm@web65512.mail.ac4.yahoo.com> <291863.53837.qm@web111416.mail.gq1.yahoo.com> Message-ID: <672672.39511.qm@web65516.mail.ac4.yahoo.com> > That said, I wouldn't mind other solid examples either. There are, of course, > successful projects and companies, but not as easy to reference. If you just > want a well-known, respected product/project to point at, how about ejabberd? Good example. It's medium size. Solid. Reasonably well known in software circles. IMO to get more people into FP we need to show its applicability to small to medium sized projects (like ejabberd). Most projects start off with modest ambitions. More examples? Stay connected to the people that matter most with a smarter inbox. Take a look http://au.docs.yahoo.com/mail/smarterinbox From masse@REDACTED Wed Feb 25 15:06:59 2009 From: masse@REDACTED (mats cronqvist) Date: Wed, 25 Feb 2009 15:06:59 +0100 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <1235557322.30881.53.camel@isolde> (Michael T. Richter's message of "Wed\, 25 Feb 2009 18\:22\:02 +0800") References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com> <115617.75351.qm@web65508.mail.ac4.yahoo.com> <359869.86259.qm@web65502.mail.ac4.yahoo.com> <1235542132.30881.20.camel@isolde> <9b08084c0902250156o615015bfwfa29c4c3f81f20e9@mail.gmail.com> <1235557322.30881.53.camel@isolde> Message-ID: <87ab8aobjw.fsf@sterlett.hq.kred> "Michael T. Richter" writes: > If functional programming makes > more sense to beginners, if imperative programming is so counter-intuitive, so > difficult and so prone to failure (and I will agree 100% with that last > point), how did it become the dominant paradigm for pretty much all of > computing's existence? If you start with bare metal, and require that each langue generation adds a minimum of abstraction, you'll get somthing like this: Machine Code -> Assembly -> FORTRAN -> C -> C++ -> Java If your new language is too different from the current king of the hill, it will not be adapted. Extrapolating on this, I hereby predict the NextNextBigLanguage(*) will be something like clojure. mats (*) The NextBigLanguage is of course Javascript. From masse@REDACTED Wed Feb 25 15:10:59 2009 From: masse@REDACTED (mats cronqvist) Date: Wed, 25 Feb 2009 15:10:59 +0100 Subject: [erlang-questions] erlang flagship product In-Reply-To: <291863.53837.qm@web111416.mail.gq1.yahoo.com> (Thomas Lindgren's message of "Wed\, 25 Feb 2009 02\:09\:22 -0800 \(PST\)") References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <87ocwrpyiv.fsf@sterlett.hq.kred> <4d08db370902240925u52d6f17cledb5416813c0fdc3@mail.gmail.com> <769685.50188.qm@web65512.mail.ac4.yahoo.com> <291863.53837.qm@web111416.mail.gq1.yahoo.com> Message-ID: <8763iyobd8.fsf@sterlett.hq.kred> Thomas Lindgren writes: > ----- Original Message ---- >> From: Richard Andrews >> To: erlang-questions >> Sent: Tuesday, February 24, 2009 10:41:56 PM >> Subject: [erlang-questions] erlang flagship product (was The Beauty of Erlang Syntax) >> >> >> > Show me reliable system in Java with million SLOC. Java is >> > "academic". Be fair, Java system should have about ten or >> > more million SLOC to be compared to AXD 301. >> >> It's a great story but why is the AXD301 (a project from the 1990s) >> still held up as the flagship example of the virtues of erlang? Is >> this still the best we have? The software development universe has >> evolved from where it was in 1997. Surely there are more recent >> examples of projects where erlang delivered functionality and >> reliability quickly and cheaply. > > Pragmatically speaking, Ericsson has spent a lot of money and > man-years on developing AXD301, with excellent results and even some > public documentation of it all; if someone wants a good example of > actual industrial development in Erlang over many years with dozens > of programmers, AXD301 can usually beat down any objections. I once made a list of committers in the AXD repos; it was well over 300. mats From pcc482719@REDACTED Wed Feb 25 15:30:59 2009 From: pcc482719@REDACTED (Peter C. Chapin) Date: Wed, 25 Feb 2009 09:30:59 -0500 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <97619b170902250350n5fd38670lbff6c67e3aec0438@mail.gmail.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com> <115617.75351.qm@web65508.mail.ac4.yahoo.com> <359869.86259.qm@web65502.mail.ac4.yahoo.com> <1235542132.30881.20.camel@isolde> <9b08084c0902250156o615015bfwfa29c4c3f81f20e9@mail.gmail.com> <1235557322.30881.53.camel@isolde> <97619b170902250350n5fd38670lbff6c67e3aec0438@mail.gmail.com> Message-ID: <49A55623.1000004@gmail.com> Rapsey wrote: > For my company, I can say we use a custom built streaming server > written in Erlang... I'll throw my $0.02 here. I teach at Vermont Technical College. We teach the students the usual assortment of languages... meaning C, C++, Java, Python, some C#. The software engineering students start with Java, the computer engineering students start with C. We teach these languages, in part, because our industry advisory board (and other sources) tells us that these are the languages they are using and, furthermore, they would like to hire graduates that are already familiar with them. Also there is a massive amount of support for such languages in terms of educational materials, libraries, and tools. Students know this too. They resist learning languages they perceive as useless on their resume. I'm a bit of an oddball, personally (as you might guess by the fact that I'm here). I teach a programming languages course, and I'm planning next year to use Erlang as the "centerpiece" language for the course. Naturally one can't cover all the necessary concepts in such a course using a single language, but I would like the students to leave my course feeling like they understand at least the basics of functional programming in general and Erlang specifically. Note that I seriously considered using F# instead since Microsoft supports F# in Visual Studio... giving the language a certain legitimacy in the eyes of my already jaded students. Anyway, enough rambling for now... I just wanted to put in a word from the world of academia. Peter From srivatsan@REDACTED Wed Feb 25 15:31:14 2009 From: srivatsan@REDACTED (Srivatsan ravi) Date: Wed, 25 Feb 2009 20:01:14 +0530 Subject: [erlang-questions] startups using Erlang In-Reply-To: References: <8D7FE22F-5637-433D-8C9D-93C127F6E8B3@gmail.com> Message-ID: <59ccdb110902250631y10890ea1u6a5f08bc6a6b4f69@mail.gmail.com> I wish i had seen this thread earlier http://hover.in is a startup based in India which uses the LYME Stack fully Srivatsan On Thu, Feb 19, 2009 at 11:21 PM, Hasan Veldstra wrote: > > thank you, everyone, for your replies. > > if anyone thinks of any more startups/companies, please post a note > to this thread or email me directly. > > /Hasan > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From erlang@REDACTED Wed Feb 25 16:17:36 2009 From: erlang@REDACTED (Joe Armstrong) Date: Wed, 25 Feb 2009 16:17:36 +0100 Subject: [erlang-questions] erlang flagship product In-Reply-To: <672672.39511.qm@web65516.mail.ac4.yahoo.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <87ocwrpyiv.fsf@sterlett.hq.kred> <4d08db370902240925u52d6f17cledb5416813c0fdc3@mail.gmail.com> <769685.50188.qm@web65512.mail.ac4.yahoo.com> <291863.53837.qm@web111416.mail.gq1.yahoo.com> <672672.39511.qm@web65516.mail.ac4.yahoo.com> Message-ID: <9b08084c0902250717i7212f33fj73c7a0cb8bad2e32@mail.gmail.com> On Wed, Feb 25, 2009 at 1:24 PM, Richard Andrews wrote: > >> That said, I wouldn't mind other solid examples either. There are, of course, >> successful projects and companies, So what do you mean by successful ?? Does successful "made $$$" using Erlang? Does it mean "delivered on time" using Erlang? Does it mean they have a big 100 man project using Erlang Does it mean the project had thousands of lines of code and no errors? etc. If you mean $'s then at what value do you call something a success? We have loads of "successes" measured on these different scales - brilliant work done by small groups (ejabberd was a one-man project) - if you're looking for the BIG projects you won't find many because you don't need many Erlang programmers to do a lot of stuff. So a measure of success might even be "required very few programmers" - but if this were the case the success would not get much publicity. We have all these couchDB's and ejabberds and scalaris and yaws and rabbit MQ all done by small groups. Most successful projects are "do something" ... "get lucky" - we can control the "do something" bit but the rest is out of our control - if we get lots of people doing Erlang then the probabily than we can demonstrat esuccessful projects should increase >> but not as easy to reference. If you just >> want a well-known, respected product/project to point at, how about ejabberd? > > Good example. > It's medium size. Solid. Reasonably well known in software circles. > > IMO to get more people into FP we need to show its applicability to small to medium sized projects (like ejabberd). Most projects start off with modest ambitions. > > More examples? http://www.onscale.eu/scalaris.html Little know - prizewinning - brilliant - widely applicable - if every erlang user put a scalaris node on their machine we could build amazing systems! /Joe Armstrong > > > ? ? ?Stay connected to the people that matter most with a smarter inbox. Take a look http://au.docs.yahoo.com/mail/smarterinbox > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From thomasl_erlang@REDACTED Wed Feb 25 16:29:02 2009 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 25 Feb 2009 07:29:02 -0800 (PST) Subject: [erlang-questions] erlang flagship product References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <87ocwrpyiv.fsf@sterlett.hq.kred> <4d08db370902240925u52d6f17cledb5416813c0fdc3@mail.gmail.com> <769685.50188.qm@web65512.mail.ac4.yahoo.com> <291863.53837.qm@web111416.mail.gq1.yahoo.com> <672672.39511.qm@web65516.mail.ac4.yahoo.com> Message-ID: <677050.89583.qm@web111407.mail.gq1.yahoo.com> ----- Original Message ---- > From: Richard Andrews > > > That said, I wouldn't mind other solid examples either. There are, of course, > > successful projects and companies, but not as easy to reference. If you just > > want a well-known, respected product/project to point at, how about ejabberd? > > Good example. > It's medium size. Solid. Reasonably well known in software circles. > > IMO to get more people into FP we need to show its applicability to small to > medium sized projects (like ejabberd). Most projects start off with modest > ambitions. > > More examples? Well, CouchDB has good buzz and reasonable size. Rusty Klophaus's Nitrogen is really cool, and self-demoing too. I like Mochiweb because it's so easy to tinker with (and Sean Hinde's old iserve-prototype, which I think can be found on TrapExit somewhere). Yaws is pretty easy to get into. (I'm not sure whether each of these demo the headline features of erlang as such, but it's a way for someone interested to get started with something reasonably familiar.) Best, Thomas From thanos.vassilakis@REDACTED Wed Feb 25 16:43:16 2009 From: thanos.vassilakis@REDACTED (Vassilakis, Thanos) Date: Wed, 25 Feb 2009 10:43:16 -0500 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <124310.26590.qm@web111413.mail.gq1.yahoo.com> References: <124310.26590.qm@web111413.mail.gq1.yahoo.com> Message-ID: <05F3D38D836B6248BF7452CA10036F500412EB34@EPRI17P32003B.csfb.cs-group.com> I was on one of the first java based projects for switches at Ericsson (1996-97), and it was painful. The choice to move to Java were political. Managers and BAs wanting to be in the main stream and mediocre "programmers" wanting to enhance the skill sets. Although 1.1 was available we were using Oak, 1.0.3. AWt was awful and there were no inner classes. Our Erlang prototypes were embarrassingly better than the production code, but management liked the Java label and the slightly cooler, if not fully functional, GUIs. Of course most of the projects failed. Development was on sun, but the production hardware was HP AUX and the JVM ports were terrible. Thanos ________________________________ From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Thomas Lindgren Sent: Wednesday, February 25, 2009 5:20 AM To: erlang-questions Subject: Re: [erlang-questions] The Beauty of Erlang Syntax (Don't know why Yahoo insists on mangling replies, but here we go.) Basically, at the end of the 90s, Ericsson chose to go with Java+UML and banned(!) new project starts in Erlang. Politically speaking, the mobile systems part of the company got to decide. On the bright side, prior to this, Erlang was closed-source. Best, Thomas ________________________________ But, really, one should ask, if Erlang was designed / evolved / selected with this goal, why is it that 20 years later most developers have never even heard of it? I guess one possibility would be to blame Ericsson and credit MS and Sun for why C# and Java are the languages of choice for companies who care more about how easy it is to hire an army of developers than anything else. There could be other possible explanations, though. ============================================================================== Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html ============================================================================== -------------- next part -------------- An HTML attachment was scrubbed... URL: From cguimaraes.br@REDACTED Wed Feb 25 17:16:14 2009 From: cguimaraes.br@REDACTED (Christian Guimaraes) Date: Wed, 25 Feb 2009 16:16:14 +0000 Subject: [erlang-questions] CUFP Call for Presentations (September 4th, Edinburgh Scotland) In-Reply-To: <49A53127.5030307@erlang-consulting.com> References: <49A53127.5030307@erlang-consulting.com> Message-ID: Hi, and about the registrations for this workshop? When starts? Cheers. Christian. On Wed, Feb 25, 2009 at 11:53 AM, Francesco Cesarini (Erlang Training and Consulting) wrote: > Commercial Users of Functional Programming Workshop (CUFP) 2009 > > Functional Programming As a Means, Not an End > > Call for Presentations > > Sponsored by SIGPLAN > Co-located with ICFP 2008 > Edinburgh,Scotland, 4 September 2009 > _________________________________________________________________ > > Presentation proposals due 15 May 2009 > > http://cufp.galois.com/2009/call.html < > http://cufp.functionalprogramming.com> > _________________________________________________________________ > > Functional languages have been under academic development for over 25 > years, and remain fertile ground for programming language research. > Recently, however, developers in industrial, governmental, and open > source projects have begun to use functional programming successfully > in practical applications. In these settings, functional programming > has often provided dramatic leverage, including whole new ways of > thinking about the original problem. > > The goal of the CUFP workshop is to act as a voice for these users of > functional programming. The workshop supports the increasing viability > of functional programming in the commercial, governmental, and > open-source space by providing a forum for professionals to share > their experiences and ideas, whether those ideas are related to > business, management, or engineering. The workshop is also designed to > enable the formation and reinforcement of relationships that further > the commercial use of functional programming. Providing user feedback > to language designers and implementors is not a primary goal of the > workshop, though it will be welcome if it occurs. > > Speaking at CUFP > > If you use functional programming as a means, rather than as an end, > we invite you to offer to give a talk at the workshop. Alternatively, > if you know someone who would give a good talk, please nominate them! > > Talks are typically 30-45 minutes long, but can be shorter. They aim > to inform participants about how functional programming played out in > real-world applications, focusing especially on the re-usable lessons > learned, or insights gained. Your talk does not need to be highly > technical; for this audience, reflections on the commercial, > management, or software engineering aspects are, if anything, more > important. You do not need to submit a paper! > > If you are interested in offering a talk, or nominating someone to do > so, send an e-mail to jim (dot) d (dot) grundy (at) intel (dot) com or > francesco(at) erlang-consulting (dot) com by 2 June 2008 with a short > description of what you'd like to talk about or what you think your > nominee should give a talk about. Such descriptions should be about > one page long. > > Program Plans > > CUFP 2008 will last a full day and feature an invited presentation > from Bryan O'Sullivan, co-author of Real World Haskell. The program will > also include a mix of presentations and discussion sessions. Topics > will range over a wide area, including: > * Case studies of successful and unsuccessful uses of functional > programming; > * Business opportunities and risks from using functional languages; > * Enablers for functional language use in a commercial setting; > * Barriers to the adoption of functional languages, and > * Mitigation strategies for overcoming limitations of functional > programming. > > There will be no published proceedings, as the meeting is intended to > be more a discussion forum than a technical interchange. > > This will be the sixth CUFP, for more information - including reports > from attendees of previous events - see the workshop web site: > http://cufp.galois.com/ > > > If you have any questions, let me know. > > Best regards, > Francesco & Jim > -- > http://www.erlang-consulting.com > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bekesa@REDACTED Wed Feb 25 18:35:14 2009 From: bekesa@REDACTED (Andras Georgy Bekes) Date: Wed, 25 Feb 2009 18:35:14 +0100 Subject: [erlang-questions] arity part of function name and variadic functions In-Reply-To: <3dbc6d1c0902231238h2a227a8cuc14074aefaeb05f7@mail.gmail.com> References: <3cbaf1c80902221225pf14513sf93e46a90228d595@mail.gmail.com> <49A1BDE6.4050209@it.uu.se> <3dbc6d1c0902231238h2a227a8cuc14074aefaeb05f7@mail.gmail.com> Message-ID: <200902251835.15083.bekesa@sch.bme.hu> Robert Virding wrote: > Yes, that is exactly what happened, it was "inherited" from Prolog. > Along with a lot of things apart from the syntax. If Erlang inherited the syntax of prolog, you would not need to develop LFE! Off: The operator-notation and the functor-concept of Prolog has all the advantages of LISP's syntax (i.e. code=data), but makes the code look nice. IMHO a language with all the power of LISP, plus Prolog's operator syntax plus Erlang-style concurrency would be great alloy. Georgy From carsten@REDACTED Wed Feb 25 19:45:47 2009 From: carsten@REDACTED (Carsten Schultz) Date: Wed, 25 Feb 2009 19:45:47 +0100 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com> <115617.75351.qm@web65508.mail.ac4.yahoo.com> Message-ID: <49A591DB.3070304@codimi.de> Michael Richter schrieb: > I would like to ask a multi-part, but rhetorical, question of the list: > > Why do you think people stay away from functional programming languages > in droves? > > 1. Is it because they're too stupid to understand them? > 2. Is it because of an evil cabal of IT Illuminati who are trying to > squelch the true freedom of the programming masses? > 3. Is it because the functional languages available do not seem to > meet their needs, whatever those may be? > 4. Is it because the fans of functional languages often come across > as religious fanatics preaching the One True Way of programming? > 5. Is it some combination of the above? > I am not sure if that makes me an example for 4, but as a Haskell programmer I am wondering why this question would be relevant to a discussion of Erlang. -- Carsten Schultz (2:38, 33:47) http://carsten.codimi.de/ PGP/GPG key on the pgp.net key servers, fingerprint on my home page. From gordon@REDACTED Wed Feb 25 20:07:53 2009 From: gordon@REDACTED (Gordon Guthrie) Date: Wed, 25 Feb 2009 19:07:53 +0000 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com> <115617.75351.qm@web65508.mail.ac4.yahoo.com> Message-ID: Michael Richter wrote: > Why do you think people stay away from functional programming languages in > droves? The most popular programming language in the world is the spreadsheet - and it is a Functional Programming Language... The correct way to frame that question is: "given that non-functional programmers are such a tiny minority of the worlds' programmers, how come they dominate the professional and vocational sector of programmers so heavily?" Gordon 2009/2/25 Michael Richter : > I would like to ask a multi-part, but rhetorical, question of the list: > > Why do you think people stay away from functional programming languages in > droves? > > Is it because they're too stupid to understand them? > Is it because of an evil cabal of IT Illuminati who are trying to squelch > the true freedom of the programming masses? > Is it because the functional languages available do not seem to meet their > needs, whatever those may be? > Is it because the fans of functional languages often come across as > religious fanatics preaching the One True Way of programming? > Is it some combination of the above? > > My own answer to the question is a #5 with a strong skew toward the higher > numbers. > > #1 (the one that's becoming uncomfortably common in this thread, albeit with > muted wording) is a little too arrogant for my tastes.? There are an awful > lot of awfully smart people who not only use but make imperative languages > out there.? I'm not willing to casually dismiss them as too stupid to > understand the One True Way of the Lambda.? There is something they see in > the various stateful, imperative models that seems useful to them.? Are you > really so smart as to be able to casually dismiss them?? If so, may I please > read your Ph.D. thesis for the stunning insights into computing and humanity > that it undoubtedly contains? > > #2 I'm less willing to stray from (with less gonzo wording), although I > think the threat is largely overblown.? There are indeed vendors of IT > products that make a killing from selling methods of complexity management > that would not like it if functional languages came on the scene in a big > way.? (I mean UML--and the multi-billion dollar consulting industry that > feeds off it--would be dead overnight.)? I'm sure that they do apply some > pressures in the form of subtle FUD that keep people hooked on their drug. > I don't think, however, that they're as big a force as some people seem to > be thinking here. > > #3 is the biggest one, I think.? Others' needs are not necessarily what you > think they are.? Business needs, for example, are things like "this software > has to hit market in X amount of time".? For all the talk of how productive > functional programming languages are you are forgetting one important item: > the company has trained IT staff familiar with its problem domain and not > familiar with functional programming on hand now.? They have a choice: > retrain their IT staff to do functional programming for dubious (to them) > benefits while not making any progress in their products and facing risks of > the benefits not materializing; or go with the Devil they know where the > risks are (in their minds) known to them.? (Another option, of course, is to > just dismiss their entire IT staff and replace them with functional > programmers who don't know the problem domain.? Functional programmers who > don't exist in any sufficiently large number to actually do this.) > > #4, sadly, comes a disconcertingly close second.? Want to see an overblown > version of how functional programmers come across at times?? Read some of > these gems from one of the more outspoken members of the lisp community: > > http://groups.google.com/group/comp.lang.lisp/msg/e5af8ef3f88dd39c > http://groups.google.com/group/comp.lang.lisp/msg/b8aa5b537cf11bb4?pli=1 > http://groups.google.com/group/comp.lang.lisp/msg/7060ad1dc1defc9c > http://groups.google.com/group/comp.lang.lisp/msg/e65326618bbca892 > > Keep in mind, too, that this man is lionized by a lot of the people in > comp.lang.lisp.? Is it really Microsoft and Sun's marketing that makes C# > and Java popular?? Or is it the behaviour of the other communities that > drives away potential converts? > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From kevin@REDACTED Wed Feb 25 20:35:38 2009 From: kevin@REDACTED (Kevin Scaldeferri) Date: Wed, 25 Feb 2009 11:35:38 -0800 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com> <115617.75351.qm@web65508.mail.ac4.yahoo.com> Message-ID: <660A3558-C7D5-426F-BEF6-2E8CD8CAC93E@scaldeferri.com> On Feb 25, 2009, at 11:07 AM, Gordon Guthrie wrote: > Michael Richter wrote: > >> Why do you think people stay away from functional programming >> languages in >> droves? > > The most popular programming language in the world is the spreadsheet > - and it is a Functional Programming Language... > > The correct way to frame that question is: > "given that non-functional programmers are such a tiny minority of the > worlds' programmers, how come they dominate the professional and > vocational sector of programmers so heavily?" Spreadsheets are a domain-specific, visual, declarative language. Excel macros are implemented in a procedural / imperative language. Neither is comparable to general-purpose functional programming languages. -k From dmercer@REDACTED Wed Feb 25 20:47:35 2009 From: dmercer@REDACTED (David Mercer) Date: Wed, 25 Feb 2009 13:47:35 -0600 Subject: [erlang-questions] Element Typing in Record Declarations? In-Reply-To: <49A41313.2030003@cs.ntua.gr> References: <70D595DB81BB4147A789A50F922A1772@SSI.CORP> <49A41313.2030003@cs.ntua.gr> Message-ID: Are there any plans to add bitstrings as a type? Currently, these have to be defined as any(), since binary() implies that bit_size is a multiple of 8. > -----Original Message----- > From: erlang-questions-bounces@REDACTED [mailto:erlang-questions- > bounces@REDACTED] On Behalf Of Kostis Sagonas > Sent: Tuesday, February 24, 2009 9:33 AM > To: erlang-questions@REDACTED > Subject: Re: [erlang-questions] Element Typing in Record Declarations? > > David Mercer wrote: > > I just noticed in dict.erl: > > > > ... > > > > It appears that Erlang supports type declarations in record > > declarations, but I could not find this syntax in the Erlang reference > > documentation. Is there any documentation on this, and what effect it > > has on the system? > > The documentation on this is currently an EEP: > > http://www.erlang.org/eeps/eep-0008.html > > This type information is used by Dialyzer to detect discrepancies > between the declared types of record fields and their actual uses. > > Kostis > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From per.gustafsson@REDACTED Wed Feb 25 21:14:37 2009 From: per.gustafsson@REDACTED (Per Gustafsson) Date: Wed, 25 Feb 2009 21:14:37 +0100 Subject: [erlang-questions] Element Typing in Record Declarations? In-Reply-To: References: <70D595DB81BB4147A789A50F922A1772@SSI.CORP> <49A41313.2030003@cs.ntua.gr> Message-ID: <49A5A6AD.2000505@it.uu.se> David Mercer wrote: > Are there any plans to add bitstrings as a type? Currently, these have to > be defined as any(), since binary() implies that bit_size is a multiple of > 8. > > You should be able to write: <<_:_*1>> for a bitstring or more generally: <<_:M, _:_*N>> for a bitsring consisting of M+X*N bits where M, X and N are non-negative integers. Per >> -----Original Message----- >> From: erlang-questions-bounces@REDACTED [mailto:erlang-questions- >> bounces@REDACTED] On Behalf Of Kostis Sagonas >> Sent: Tuesday, February 24, 2009 9:33 AM >> To: erlang-questions@REDACTED >> Subject: Re: [erlang-questions] Element Typing in Record Declarations? >> >> David Mercer wrote: >> >>> I just noticed in dict.erl: >>> >>> ... >>> >>> It appears that Erlang supports type declarations in record >>> declarations, but I could not find this syntax in the Erlang reference >>> documentation. Is there any documentation on this, and what effect it >>> has on the system? >>> >> The documentation on this is currently an EEP: >> >> http://www.erlang.org/eeps/eep-0008.html >> >> This type information is used by Dialyzer to detect discrepancies >> between the declared types of record fields and their actual uses. >> >> Kostis >> _______________________________________________ >> 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 twoggle@REDACTED Wed Feb 25 21:37:29 2009 From: twoggle@REDACTED (Tim Fletcher) Date: Wed, 25 Feb 2009 12:37:29 -0800 (PST) Subject: [erlang-questions] reading RSA public key files (PEM) In-Reply-To: <49A458C4.9060903@73rus.com> References: <49A458C4.9060903@73rus.com> Message-ID: <5ca2657f-11a5-42b9-a3a0-12b1041cecc8@r27g2000vbp.googlegroups.com> > Googling around I couldn't find how do that. Any suggestions? As far as i can tell, you can't. To quote the edoc for public_key:pem_to_der: Currently supported entry types are certificates, certificate requests, rsa private keys and dsa private keys. From dmercer@REDACTED Wed Feb 25 21:47:07 2009 From: dmercer@REDACTED (David Mercer) Date: Wed, 25 Feb 2009 14:47:07 -0600 Subject: [erlang-questions] Element Typing in Record Declarations? In-Reply-To: <49A5A6AD.2000505@it.uu.se> References: <70D595DB81BB4147A789A50F922A1772@SSI.CORP> <49A41313.2030003@cs.ntua.gr> <49A5A6AD.2000505@it.uu.se> Message-ID: <3AEEDA2BFD4A4AD9BD6BF429F686338B@SSI.CORP> Hadn't noticed that syntax. Thank-you. Am replacing: -type bitstring() :: any(). with: -type bitstring() :: <<_:_*1>>. > -----Original Message----- > From: Per Gustafsson [mailto:per.gustafsson@REDACTED] > Sent: Wednesday, February 25, 2009 2:15 PM > To: David Mercer > Cc: 'Kostis Sagonas'; erlang-questions@REDACTED > Subject: Re: [erlang-questions] Element Typing in Record Declarations? > > David Mercer wrote: > > Are there any plans to add bitstrings as a type? Currently, these have > to > > be defined as any(), since binary() implies that bit_size is a multiple > of > > 8. > > > > > > You should be able to write: > > <<_:_*1>> for a bitstring or more generally: > <<_:M, _:_*N>> for a bitsring consisting of M+X*N bits where M, X and N > are non-negative integers. > > Per > > >> -----Original Message----- > >> From: erlang-questions-bounces@REDACTED [mailto:erlang-questions- > >> bounces@REDACTED] On Behalf Of Kostis Sagonas > >> Sent: Tuesday, February 24, 2009 9:33 AM > >> To: erlang-questions@REDACTED > >> Subject: Re: [erlang-questions] Element Typing in Record Declarations? > >> > >> David Mercer wrote: > >> > >>> I just noticed in dict.erl: > >>> > >>> ... > >>> > >>> It appears that Erlang supports type declarations in record > >>> declarations, but I could not find this syntax in the Erlang reference > >>> documentation. Is there any documentation on this, and what effect it > >>> has on the system? > >>> > >> The documentation on this is currently an EEP: > >> > >> http://www.erlang.org/eeps/eep-0008.html > >> > >> This type information is used by Dialyzer to detect discrepancies > >> between the declared types of record fields and their actual uses. > >> > >> Kostis > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://www.erlang.org/mailman/listinfo/erlang-questions > >> > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > From kostis@REDACTED Wed Feb 25 22:53:06 2009 From: kostis@REDACTED (Kostis Sagonas) Date: Wed, 25 Feb 2009 23:53:06 +0200 Subject: [erlang-questions] Element Typing in Record Declarations? In-Reply-To: <3AEEDA2BFD4A4AD9BD6BF429F686338B@SSI.CORP> References: <70D595DB81BB4147A789A50F922A1772@SSI.CORP> <49A41313.2030003@cs.ntua.gr> <49A5A6AD.2000505@it.uu.se> <3AEEDA2BFD4A4AD9BD6BF429F686338B@SSI.CORP> Message-ID: <49A5BDC2.4000008@cs.ntua.gr> David Mercer wrote: > Hadn't noticed that syntax. Thank-you. Am replacing: > > -type bitstring() :: any(). > > with: > > -type bitstring() :: <<_:_*1>>. Apparently, this is an oversight from our/my part. In R13, bitstring() will be added as a built-in type so that the user does not have to add this/such declaration. Thanks to David for noticing this! Kostis From rvirding@REDACTED Wed Feb 25 22:54:35 2009 From: rvirding@REDACTED (Robert Virding) Date: Wed, 25 Feb 2009 22:54:35 +0100 Subject: [erlang-questions] arity part of function name and variadic functions In-Reply-To: <200902251835.15083.bekesa@sch.bme.hu> References: <3cbaf1c80902221225pf14513sf93e46a90228d595@mail.gmail.com> <49A1BDE6.4050209@it.uu.se> <3dbc6d1c0902231238h2a227a8cuc14074aefaeb05f7@mail.gmail.com> <200902251835.15083.bekesa@sch.bme.hu> Message-ID: <3dbc6d1c0902251354n66681ccfod8da97582977b246@mail.gmail.com> 2009/2/25 Andras Georgy Bekes > Robert Virding wrote: > > Yes, that is exactly what happened, it was "inherited" from Prolog. > > Along with a lot of things apart from the syntax. > If Erlang inherited the syntax of prolog, you would not need to develop > LFE! > > Off: The operator-notation and the functor-concept of Prolog has all the > advantages of LISP's syntax (i.e. code=data), but makes the code look > nice. IMHO a language with all the power of LISP, plus Prolog's > operator syntax plus Erlang-style concurrency would be great alloy. Unfortunately, we only finally only inherited bits of the prolog syntax likes atoms, variables, lists, etc. The code == data bit finally disappeared when users wanted better error information with line numbers. If I had thought a bit more we possibly could have done what LFE does now, remembered the line number of the start of the form, but separately not in the form iteself, and used that for error info. But the final syntax change went beyond using just operators like Prolog, so now it is impossible. Pity, Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From Mathias.Picker@REDACTED Thu Feb 26 00:41:54 2009 From: Mathias.Picker@REDACTED (Mathias Picker) Date: Thu, 26 Feb 2009 00:41:54 +0100 Subject: [erlang-questions] Is there a way to serialise a running process & resume it later (i.e. continuations) Message-ID: <1235605314.1994.8.camel@mp.virtual-earth.de> I've worked with seaside and really love this way of writing web apps. Sadly, you need continuations, a way to store a running process and continue it afterwards. And using live erlang processes for this does not work (afaik) because of the back-button: go back in your browser, and with continuations you go back in the computation; that's just not possible with processes. Thanks for any pointers. I've searched through all the docs and googled for it, but didn't find nothing about erlang and continuations... Thanks, Mathias From ok@REDACTED Thu Feb 26 01:10:14 2009 From: ok@REDACTED (Richard O'Keefe) Date: Thu, 26 Feb 2009 13:10:14 +1300 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <0B22BAEF6D984175935829DF520257D1@HallDesktop> References: <0B22BAEF6D984175935829DF520257D1@HallDesktop> Message-ID: On 25 Feb 2009, at 8:38 pm, John Hughes wrote: [about the House operating system] The BitC language borrows a heck of a lot from the functional world. The purpose of BitC is to support writing operating systems that are both demonstrably secure *and* efficient. From victor.sovetov@REDACTED Thu Feb 26 01:50:04 2009 From: victor.sovetov@REDACTED (Viktor Sovietov) Date: Wed, 25 Feb 2009 16:50:04 -0800 (PST) Subject: [erlang-questions] startups using Erlang In-Reply-To: <8D7FE22F-5637-433D-8C9D-93C127F6E8B3@gmail.com> References: <8D7FE22F-5637-433D-8C9D-93C127F6E8B3@gmail.com> Message-ID: <71925bac-282e-4550-b643-4e246ecaff33@z1g2000yqn.googlegroups.com> My own, written on pure Erlang (excrpt J2ME client, of course): http://life4fun.mobi On Feb 12, 8:37?pm, Hasan Veldstra wrote: > i'm putting together a small promotional website for Erlang (think ? > whygitisbetterthanx.com) and i'm compiling a list of startups that ? > are using Erlang. > > so far i've got: Hypernumbers, MochiMedia, Github, Powerset, Engine ? > Yard, Heysan, N54, and Streamfile. > > anyone know of or working for any other such startups? > > /Hasan From ok@REDACTED Thu Feb 26 01:59:46 2009 From: ok@REDACTED (Richard O'Keefe) Date: Thu, 26 Feb 2009 13:59:46 +1300 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <1235557322.30881.53.camel@isolde> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com> <115617.75351.qm@web65508.mail.ac4.yahoo.com> <359869.86259.qm@web65502.mail.ac4.yahoo.com> <1235542132.30881.20.camel@isolde> <9b08084c0902250156o615015bfwfa29c4c3f81f20e9@mail.gmail.com> <1235557322.30881.53.camel@isolde> Message-ID: <1F178CF0-E640-4A7F-B48D-4C17027818FD@cs.otago.ac.nz> On 25 Feb 2009, at 11:22 pm, Michael T. Richter wrote: > You're begging the question, Joe. WHY did it gain this temporary > victory? Surely it's incredibly simple? Do you remember when "Eight Megabytes And Continually Swapping" was a sneer at Emacs? Heck, I remember when "Lisp programs take a minimum of 1MB of memory" was considered as a complete and final answer against ever using Lisp for anything anywhere. The machine I happily used as an undergraduate was a *mainframe* with a cycle time of 2.4 microseconds and a theoretical maximum of 6MB of ferrite core memory. The laptop the department lets me use has 2 processors running at 2.53 GHz, so I have >12,000 times as many cycles per second available. It has 4GB of memory, or roughly 3,000 times as much memory. It has, in a 2..5 inch form factor, about a thousand times as much disc as used to fill half a large room. And that old machine was a GIANT compared with the machines that languages like Fortran and COBOL were devised for. The great old machine, the IBM 650, had room for 4000 words of memory on its drum. (I think some models had 2000 words.) People didn't just write compilers for it, but on it. The computing club at my old university had a business computer that had 15 kwords of memory, and that ran a COBOL compiler. The old imperative languages like Fortran and COBOL and PL/I and Bliss were devised for machines that were unbelievably tiny and excruciatingly slow by today's standards. If you didn't keep reasonably tight control on memory, you'd get nothing done. It wasn't just functional languages that were affected. C++ was devised by Bjarne Stroustrup because he had used Simula 67 and liked it. Simula was *wonderful* for its day. *BUT* Simula depended completely on garbage collection. It didn't even use a stack for procedure calls, because it supported quasi-parallel programming (the same thing you get using Java on a uniprocessor). It was type safe, it was THE object-oriented language, it had a large library (or at least DEC-10 Simula, the version I used, did). BUT it used garbage collection. And for that reason, practically everyone turned away. "If I don't know what's happening to memory, I can't trust the program." "Simula programs run 20% slower than Algol programs, and I just can't afford that." It's that simple. Nobody objected to automatic memory management in the shell, or in AWK, or in REXX. They were "scripting" languages, not real programming languages. Nobody expected them to be efficient. But for *real* programming, oh no, garbage collection was too slow, too space hungry, too hard, don't want to go there. What were the two major changes that Stroustrup made to Simula to create the success of C++? (1) His users were familiar with C, not with Algol. So he gave his OO language C syntax. (2) He removed garbage collection, giving programmers the control over memory they thought they needed. Everything else about C++ came later. It was the belief that they could have the *efficiency* of C with the expressiveness of Simula that made C++ popular initially. Largely an unexamined belief: if there were ever any real performance comparisons between equivalent Simula and C++ programs I've not seen them. What made Java so successful? Timing. By the time Java came along, computers were fast enough and had enough memory that the cost of garbage collection didn't bother a new generation of programmers. And there had been a lot more work on garbage collection algorithms. By the time C# came along, Java had not so much convinced a generation of programmers that garbage collection could be afforded after all, but had caused them to forget that there *was* such a thing as garbage collection most of the time. Let's be honest about this: functional programming languages really genuinely *do* touch memory a lot more than imperative ones. As Joe pointed out, imperative programmers can stuff information into global variables and pick it up, while functional programmers have to move it around to get from one place to another. (For a long time now I've thought of this as the "speed of light" limitation, with imperative languages imagining that FTL is not only possible but free. With distrubted programming, the absence of real FTL becomes painfully obvious.) Let's also recognise that for a long time now memory has been getting slower and slower compared with the speed of the CPU. Alan Mycroft had a paper studying GHC performance on a 2003-modern machine where an L2 cache miss cost 206 cycles. DDR memory helps a lot, IF you are marching along arrays, NOT if you are skipping around trees and lists. So the best performance you can get out of a functional language really *is* less than the best performance you can get out of an imperative language. Some compilers, like the GHC and YHC compilers, can do *awesome* optimisations, but they are always starting from a much bigger handicap. Of course, "we are writing in a language that permits extremely efficient computation" and "we are writing extremely efficient code" are different propositions. The efficiency of most code is an unexamined belief rather than an established fact. And a lot of code doesn't have to be all that fast. I've been shown an impressive speedup in a Haskell program by having it use gzlib: what the program was *really* doing most of the time was waiting for the disc. To this day, functional programmers are willingly trading increased memory size and increased execution time for decreased development time and increased reliability. This makes a lot of sense when you have memory and time to spare. It makes a lot of sense when development is expected to be very hard. On yesteryear's machines, for yesteryear's problems, it made rather less sense. From mog-lists@REDACTED Thu Feb 26 03:47:22 2009 From: mog-lists@REDACTED (Matthew O'Gorman) Date: Wed, 25 Feb 2009 20:47:22 -0600 Subject: [erlang-questions] Is there a way to serialise a running process & resume it later (i.e. continuations) In-Reply-To: <1235605314.1994.8.camel@mp.virtual-earth.de> References: <1235605314.1994.8.camel@mp.virtual-earth.de> Message-ID: <550d55060902251847m76729201hdbba3e7d4cfc3b71@mail.gmail.com> On Wed, Feb 25, 2009 at 5:41 PM, Mathias Picker wrote: > I've worked with seaside and really love this way of writing web apps. > Sadly, you need continuations, a way to store a running process and > continue it afterwards. > > start a state machine for each session you want and bring the http requests to that state machine. look at gen_fsm its probably what you want, or implementing a simple process loop mog -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Thu Feb 26 04:23:30 2009 From: ok@REDACTED (Richard O'Keefe) Date: Thu, 26 Feb 2009 16:23:30 +1300 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <9b08084c0902250439o7e00d9d1g8ac6362b18a75577@mail.gmail.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com> <115617.75351.qm@web65508.mail.ac4.yahoo.com> <359869.86259.qm@web65502.mail.ac4.yahoo.com> <1235542132.30881.20.camel@isolde> <9b08084c0902250156o615015bfwfa29c4c3f81f20e9@mail.gmail.com> <1235557322.30881.53.camel@isolde> <9b08084c0902250439o7e00d9d1g8ac6362b18a75577@mail.gmail.com> Message-ID: <1DC030F6-F9A0-4974-A000-D7EDFBF73089@cs.otago.ac.nz> On 26 Feb 2009, at 1:39 am, Joe Armstrong wrote: > C++ spread as if in a vacuum - there were no competing FPLs at the > time (Lisp possibly - but > this needed an expensive lisp machine). Lisp worked fine on VAXes and IBM mainframes. ML worked fine on VAXes too. Pop-11 was pretty good and ran on several machines including VAXes. One problem they had was dialects. Common Lisp was still firming up and many other Lisp dialects were still in use. Several other dialects of Pop were also in use; I must admit that I never really took to Pop-11 because it was different enough from WPop to make porting unpalatable. Simula, however had been around for nearly 20 years when C++ came along. When C++ was invented, Simula was *already* a better C++. But Simula had a garbage collector, and C++ didn't. It would be interesting to know why Objective C wasn't taken up. (Except by NeXT and now Apple.) > > Eventually we will have to fight out market share between > Erlang/Haskell/O'caml/F# > but today we stand to loose by this. I hear that Java is going to get closures. _Eventually_ Java will *be* a functional programming language with a lot of histerical raisons baggage, and someone will introduce a better simpler Java... From ttmrichter@REDACTED Thu Feb 26 05:49:21 2009 From: ttmrichter@REDACTED (Michael T. Richter) Date: Thu, 26 Feb 2009 12:49:21 +0800 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <1F178CF0-E640-4A7F-B48D-4C17027818FD@cs.otago.ac.nz> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com> <115617.75351.qm@web65508.mail.ac4.yahoo.com> <359869.86259.qm@web65502.mail.ac4.yahoo.com> <1235542132.30881.20.camel@isolde> <9b08084c0902250156o615015bfwfa29c4c3f81f20e9@mail.gmail.com> <1235557322.30881.53.camel@isolde> <1F178CF0-E640-4A7F-B48D-4C17027818FD@cs.otago.ac.nz> Message-ID: <1235623761.6805.15.camel@isolde> On Thu, 2009-02-26 at 13:59 +1300, Richard O'Keefe wrote: > On 25 Feb 2009, at 11:22 pm, Michael T. Richter wrote: > > You're begging the question, Joe. WHY did it gain this temporary > > victory? > Surely it's incredibly simple? Yes, actually, it is. It is also incredible that people are weighing in with opinions that boil down to "they're too stupid to get it" or "marketing won the day" when the real answer is staring us in the face. The reason imperative languages won the day (temporarily) in computing is that they had decided advantages over the functional (which you enumerate so nicely in the portion I snipped). In many cases they still do, not least of which is the case that there is a huge number of imperative programmers available as a resource and a not-so-huge number of functional programmers. If functional programming is to take root in any serious way, its advocates have to face up to those advantages and show either that they no longer exist (memory and CPU requirements, say) or that the other advantages of functional languages outweigh the disadvantages (productivity and correctness, say). Consoling ourselves (and I again stress that I am in favour of the functional, not opposed!) with platitudes concerning superiority or victim mentality won't win us the day. > The machine I happily used as an undergraduate was a *mainframe* > with a cycle time of 2.4 microseconds and a theoretical maximum > of 6MB of ferrite core memory. You had it good. When I was ... ;) > It's that simple. Nobody objected to automatic memory management > in the shell, or in AWK, or in REXX. They were "scripting" > languages, not real programming languages. Nobody expected them > to be efficient. But for *real* programming, oh no, garbage > collection was too slow, too space hungry, too hard, don't want > to go there. The irony of this is that automated memory management is frequently faster as well as more correct than manual. A lot of the opposition to garbage collection comes from people whose information comes from, like, the '50s or '60s. There were advances in the ensuing decades.... > By the time Java came along, computers were fast enough and had > enough memory that the cost of garbage collection didn't bother > a new generation of programmers. And there had been a lot more > work on garbage collection algorithms. I submit that even at the time of C++ garbage collection algorithms were more than suited to the task. It was the old guard of programmers switching over to C++ from C that were the hurdle, not the technology. -- Michael T. Richter (GoogleTalk: ttmrichter@REDACTED) The most exciting phrase to hear in science - the one that heralds new discoveries - is not "Eureka!" but "That's funny..." (Isaac Asimov) -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: stock_smiley-3.png Type: image/png Size: 876 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: From rec@REDACTED Thu Feb 26 07:01:23 2009 From: rec@REDACTED (Roger Critchlow) Date: Wed, 25 Feb 2009 23:01:23 -0700 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <1235623761.6805.15.camel@isolde> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <115617.75351.qm@web65508.mail.ac4.yahoo.com> <359869.86259.qm@web65502.mail.ac4.yahoo.com> <1235542132.30881.20.camel@isolde> <9b08084c0902250156o615015bfwfa29c4c3f81f20e9@mail.gmail.com> <1235557322.30881.53.camel@isolde> <1F178CF0-E640-4A7F-B48D-4C17027818FD@cs.otago.ac.nz> <1235623761.6805.15.camel@isolde> Message-ID: <66d1c98f0902252201n600ea3d2q1904a316ab010907@mail.gmail.com> Why does one programming language succeed where others fail? A similar question arises in ecology: why are some species abundant and others rare? Ecologists have framed many theories around all sorts of plausible explanations, advantageous and disadvantageous characteristics of species, competitive exclusion, effective marketing, and so on. Then Stephen Hubbell proposed a neutral theory in which none of the species characteristics make any difference whatsoever. http://en.wikipedia.org/wiki/Unified_neutral_theory_of_biodiversity The rule is that when a growth opportunity for an individual comes into existence, a job opening if you like, the opening is filled by a candidate chosen randomly from those available. A miserable theory, no fun at all, but it works, for some values of "works". > Why do you think people stay away from functional programming languages in droves? 7) No reason at all. Don't beat yourself up, just keep working. 8) Parenthephobia. -- rec -- -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan@REDACTED Thu Feb 26 12:09:30 2009 From: jan@REDACTED (Jan Lehnardt) Date: Thu, 26 Feb 2009 12:09:30 +0100 Subject: [erlang-questions] erlang flagship product In-Reply-To: <9b08084c0902250717i7212f33fj73c7a0cb8bad2e32@mail.gmail.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <87ocwrpyiv.fsf@sterlett.hq.kred> <4d08db370902240925u52d6f17cledb5416813c0fdc3@mail.gmail.com> <769685.50188.qm@web65512.mail.ac4.yahoo.com> <291863.53837.qm@web111416.mail.gq1.yahoo.com> <672672.39511.qm@web65516.mail.ac4.yahoo.com> <9b08084c0902250717i7212f33fj73c7a0cb8bad2e32@mail.gmail.com> Message-ID: <43AA6295-0688-4B72-98DB-281125446339@apache.org> On 25 Feb 2009, at 16:17, Joe Armstrong wrote: >> IMO to get more people into FP we need to show its applicability to >> small to medium sized projects (like ejabberd). Most projects start >> off with modest ambitions. >> >> More examples? > > http://www.onscale.eu/scalaris.html > > Little know - prizewinning - brilliant - widely applicable - if every > erlang user put a scalaris node > on their machine we could build amazing systems! Not to spoil the party, but quoting Werner Vogels, CTO at Amazon*: Scalaris: under realistic failures scenarios, even with 3 phase paxos commit consitency can only be guarateed by not taking writes: unusable -- http://twitter.com/Werner/statuses/1008722501 * Of course Amazon is not the only valid use-case for a distributed data storage system. He doesn't explain "realistic" any further, and that's where crux lies with his statement. It is nevertheless interesting. Personally, the number one feature I'd like to see in Scalaris would be persistent storage**. Cheers Jan -- **PS: Please do not take this as flame-bait because I happen to work on a distributed database in Erlang that does have persistent storage and chose to support a different set of CAP. Scalaris, or a Scalaris-like layer on top of other Erlang storage systems would be something I'd call a tool to build amazing systems. From erlang@REDACTED Thu Feb 26 13:14:00 2009 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 26 Feb 2009 13:14:00 +0100 Subject: [erlang-questions] Drupal cloan anybody? Message-ID: <9b08084c0902260414r5140fba3ne142a68e87a1068c@mail.gmail.com> The other day my son wanted to build a web site .... He's no programmer - but he can point a mouse and click. He showed me the kind of stuff he wanted. His university has a web site and he can administer bits of it by pointing and clicking ... To cut a long story short ..... drupal The idea is nice - Jim User knows nothing about web sites, but can fill in a menu and click a button and you get a website. I thought I'd play with drupal ... bought a book .... read it ... (well skimmed through it) Play time - http://bitnami.org/ - fantastic ( a single click downloads Apache+PHP+MySQL+Drupal) Execute one shell script and fill in one form and we're up and running. If you don't know what bitnami is stop reading this message and go take a look (bitnami is apt-get install XYZ on steroids - it gets all the bits you need *and configures everything* in a couple of mouse clicks) WHY DONT WE PACKAGE YAWS+MNESIA+COUTCHDB etc in a similar manner to the bitnami packages? - make it *really* easy to get started. (I see a lot of mail from people who have tried to gets started with yaws/mochi/couchDB etc and fail or who have to search for info and fail, or who write tutorials on how to install stuff 'cos it difficult - this is *just like me* - I have big problems installing stuff (like mysql) that I don't know well - it takes a long time to make stuff work if you do not understand it) What is drupal? templates + forms + database + plugin architecture + way of working + report generator Well we can do most of these things - I've just made a javascript thingy to make forms - we could use mnesia/couchDB/dets/filesystem as a database - we need some kind of templating (I've done this as well) need a web server (mochi/yaws/...) We could cloan the drupal architecture - in essence the appendices to the book I bought contain the database schemas that power Drupal so most of the hard work is done - in a sence a data base schema is a form (almost). I think it might be fun to try and make a bitnami type distibution that packages a LYME stack (Linux Yaws Mnesia Erlang) - (or Mac Mochi CouchDn Erlang) then build a menu/table viewer layer on top - then build some apps on top of that. If the basic infrastructure was Webserver+database+erlang+menus+table viewer then building an application on top of this might be a simple job. (The bit I'm missing is a table viewer in a browser, something like the module tv that runs with AJAX calls in a browser - and that has a few nice js effects) Another problem that needs to be addressed is multi-platform packaging - how can we package this for linux, windows, os-x and "the cloud". This might make a nice community project - we need some specialist knowledge here in the following areas: - web servers (think yaws, mochiweb) - ccs + html templates (think pretty designs) - data bases (think mnesia, couchdb) (or even backends to mysql) - javascript (think, fancy forms, AJAX, jquery, pretty effects, JSON) - packaging (like bitnami) - Instant messaging (xmpp, ejabberd) etc. Then we need people who want to build domain specific apps - bulletin boards - blog engines - mashups - cms - bug trackers The latter group should be presented with a uniform API towards the platform To the question is anybody interested? - I expect the answer to be yes - but how can we organize this? Can we have volunteers? - who does what on which machine? All comments are welcome /Joe Armstrong From yvan.godin@REDACTED Thu Feb 26 14:07:27 2009 From: yvan.godin@REDACTED (Yvan Godin) Date: Thu, 26 Feb 2009 14:07:27 +0100 Subject: [erlang-questions] Drupal cloan anybody? In-Reply-To: <9b08084c0902260414r5140fba3ne142a68e87a1068c@mail.gmail.com> References: <9b08084c0902260414r5140fba3ne142a68e87a1068c@mail.gmail.com> Message-ID: <117a596e0902260507p7ce08488neb898dac45495829@mail.gmail.com> For a such job, may be, you should consider Nitrogen from Rusty Klophaus (http://nitrogenproject.com/) Yvan 2009/2/26 Joe Armstrong > The other day my son wanted to build a web site .... > > He's no programmer - but he can point a mouse and click. > > He showed me the kind of stuff he wanted. His university has a web > site and he can administer bits > of it by pointing and clicking ... > > To cut a long story short ..... drupal > > The idea is nice - Jim User knows nothing about web sites, but can > fill in a menu and click a button > and you get a website. > > I thought I'd play with drupal ... bought a book .... read it ... > (well skimmed through it) > > Play time - http://bitnami.org/ - fantastic ( a single click downloads > Apache+PHP+MySQL+Drupal) > Execute one shell script and fill in one form and we're up and running. > > If you don't know what bitnami is stop reading this message and go take a > look > > (bitnami is apt-get install XYZ on steroids - it gets all the bits you > need *and configures everything* > in a couple of mouse clicks) > > WHY DONT WE PACKAGE YAWS+MNESIA+COUTCHDB etc in a similar manner to the > bitnami > packages? - make it *really* easy to get started. > > (I see a lot of mail from people who have tried to gets started with > yaws/mochi/couchDB etc and fail > or who have to search for info and fail, or who write tutorials on > how to install stuff 'cos it difficult - > this is *just like me* - I have big problems installing stuff (like > mysql) that I don't know well - it takes > a long time to make stuff work if you do not understand it) > > What is drupal? > > templates + forms + database + plugin architecture + way of > working + report generator > > Well we can do most of these things - I've just made a javascript > thingy to make forms - we could use > mnesia/couchDB/dets/filesystem as a database - we need some kind of > templating (I've done this as well) > need a web server (mochi/yaws/...) > > We could cloan the drupal architecture - in essence the appendices to > the book I bought contain the database schemas that power Drupal so > most of the hard work is done - in a sence a data base schema > is a form (almost). > > I think it might be fun to try and make a bitnami type distibution > that packages a LYME stack > (Linux Yaws Mnesia Erlang) - (or Mac Mochi CouchDn Erlang) then build > a menu/table viewer layer on top - then build some apps on top of > that. > > If the basic infrastructure was Webserver+database+erlang+menus+table > viewer then building > an application on top of this might be a simple job. > > (The bit I'm missing is a table viewer in a browser, something like > the module tv that runs with > AJAX calls in a browser - and that has a few nice js effects) > > Another problem that needs to be addressed is multi-platform packaging > - how can we package > this for linux, windows, os-x and "the cloud". > > This might make a nice community project - we need some specialist > knowledge here in the following areas: > > - web servers (think yaws, mochiweb) > - ccs + html templates (think pretty designs) > - data bases (think mnesia, couchdb) (or even backends to mysql) > - javascript (think, fancy forms, AJAX, jquery, pretty > effects, JSON) > - packaging (like bitnami) > - Instant messaging (xmpp, ejabberd) etc. > > Then we need people who want to build domain specific apps > > - bulletin boards > - blog engines > - mashups > - cms > - bug trackers > > The latter group should be presented with a uniform API towards the > platform > > To the question is anybody interested? - I expect the answer to be yes > - but how can we organize this? > Can we have volunteers? - who does what on which machine? > > All comments are welcome > > /Joe Armstrong > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Thu Feb 26 14:17:44 2009 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 26 Feb 2009 14:17:44 +0100 Subject: [erlang-questions] Drupal cloan anybody? In-Reply-To: <117a596e0902260507p7ce08488neb898dac45495829@mail.gmail.com> References: <9b08084c0902260414r5140fba3ne142a68e87a1068c@mail.gmail.com> <117a596e0902260507p7ce08488neb898dac45495829@mail.gmail.com> Message-ID: <9b08084c0902260517l21f2d6fcsa2d9f341a2ee47a5@mail.gmail.com> On Thu, Feb 26, 2009 at 2:07 PM, Yvan Godin wrote: > For a such job, may be, you should consider? Nitrogen? from Rusty > Klophaus?? (http://nitrogenproject.com/) Thanks - I just took a quick look - I'm impressed by how much progress has been made since I first saw this - this is looking really good. @rusty - this is looking really nice - the interaction between JS and erlang is neat It would be great to start with this an package it a la bitnami /Joe > > Yvan > > > 2009/2/26 Joe Armstrong >> >> The other day my son wanted to build a web site .... >> >> He's no programmer - but he can point a mouse and click. >> >> He showed me the kind of stuff he wanted. His university has a web >> site and he can administer bits >> of it by pointing and clicking ... >> >> To cut a long story short ..... drupal >> >> The idea is nice - Jim User knows nothing about web sites, but can >> fill in a menu and click a button >> and you get a website. >> >> I thought I'd play with drupal ... bought a book .... read it ... >> (well skimmed through it) >> >> Play time - http://bitnami.org/ - fantastic ( a single click downloads >> Apache+PHP+MySQL+Drupal) >> Execute one shell script and fill in one form and we're up and running. >> >> If you don't know what bitnami is stop reading this message and go take a >> look >> >> (bitnami is apt-get install XYZ on steroids - it gets all the bits you >> need *and configures everything* >> in a couple of mouse clicks) >> >> WHY DONT WE PACKAGE YAWS+MNESIA+COUTCHDB etc in a similar manner to the >> bitnami >> packages? - make it *really* easy to get started. >> >> (I see a lot of mail from people who have tried to gets started with >> yaws/mochi/couchDB etc and fail >> ?or who have to search for info and fail, or who write tutorials on >> how to install stuff 'cos it difficult - >> this is *just like me* - I have big problems installing stuff (like >> mysql) that I don't know well - it takes >> a long time to make stuff work if you do not understand it) >> >> What is drupal? >> >> ? ? templates + forms + database + plugin architecture + way of >> working + report generator >> >> Well we can do most of these things - I've just made a javascript >> thingy to make forms - we could use >> mnesia/couchDB/dets/filesystem as a database - we need some kind of >> templating (I've done this as well) >> need a web server (mochi/yaws/...) >> >> We could cloan the drupal architecture - in essence the appendices to >> the book I bought contain the database schemas that power Drupal so >> most of the hard work is done - in a sence a data base schema >> is a form (almost). >> >> I think it might be fun to try and make a bitnami type distibution >> that packages a LYME stack >> (Linux Yaws Mnesia Erlang) - (or Mac Mochi CouchDn Erlang) then build >> a menu/table viewer layer on top - then build some apps on top of >> that. >> >> If the basic infrastructure was Webserver+database+erlang+menus+table >> viewer then building >> an application on top of this might be a simple job. >> >> (The bit I'm missing is a table viewer in a browser, something like >> the module tv that runs with >> AJAX calls in a browser - and that has a few nice js effects) >> >> Another problem that needs to be addressed is multi-platform packaging >> - how can we package >> this for linux, windows, os-x and "the cloud". >> >> This might make a nice community project - we need some specialist >> knowledge here in the following areas: >> >> ? ? ? ? ? ?- web servers (think yaws, mochiweb) >> ? ? ? ? ? ?- ccs + html templates (think pretty designs) >> ? ? ? ? ? ?- data bases (think mnesia, couchdb) (or even backends to >> mysql) >> ? ? ? ? ? ?- javascript (think, fancy forms, AJAX, jquery, pretty >> effects, JSON) >> ? ? ? ? ? ?- packaging (like bitnami) >> ? ? ? ? ? ?- Instant messaging (xmpp, ejabberd) etc. >> >> Then we need people who want to build domain specific apps >> >> ? ? ? ? ?- bulletin boards >> ? ? ? ? ?- blog engines >> ? ? ? ? ?- mashups >> ? ? ? ? ?- cms >> ? ? ? ? ?- bug trackers >> >> The latter group should be presented with a uniform API towards the >> platform >> >> To the question is anybody interested? - I expect the answer to be yes >> - but how can we organize this? >> Can we have volunteers? - who does what on which machine? >> >> All comments are welcome >> >> /Joe Armstrong >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > From dmercer@REDACTED Thu Feb 26 15:17:57 2009 From: dmercer@REDACTED (David Mercer) Date: Thu, 26 Feb 2009 08:17:57 -0600 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <1235623761.6805.15.camel@isolde> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com><44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com><0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com><115617.75351.qm@web65508.mail.ac4.yahoo.com><359869.86259.qm@web65502.mail.ac4.yahoo.com><1235542132.30881.20.camel@isolde><9b08084c0902250156o615015bfwfa29c4c3f81f20e9@mail.gmail.com><1235557322.30881.53.camel@isolde><1F178CF0-E640-4A7F-B48D-4C17027818FD@cs.otago.ac.nz> <1235623761.6805.15.camel@isolde> Message-ID: <4A5A2D1D9C204DD78982FC14DFDBAF53@SSI.CORP> On Wednesday, February 25, 2009 10:49 PM, Michael T. Richter wrote: I submit that even at the time of C++ garbage collection algorithms were more than suited to the task. It was the old guard of programmers switching over to C++ from C that were the hurdle, not the technology. I admit to being part of that old guard. My view in the early '90's was that Lisp was the best language for development, so prototype in Lisp, and then convert to C for production. (My sister had an alternative view which I accepted, which was to only convert the parts that were slow, and keep most of it in Lisp. She had the luxury of working for an employer that permitted that approach.) But anyway, I never really understood people's problems with memory management; if you malloc memory, you need to be sure you understand the lifecycle of that memory and identify where it was to be freed. I just didn't understand how people could mess that up. It made debugging code easier, too, since half the time I could find the problem by finding the malloc and figuring out where it went from there and where it wasn't getting freed (or prematurely freed). Then when Java came along, it really proved my point about garbage collecting being slow, because Java was much slower than C or C++. I steadfastly refused to learn Java, and luckily I was in a role where I could do that. The irony here, though, is, as Richard alluded to, I was a big fan of Awk and (later) Perl, because I didn't expect them to be efficient. I wanted them to be easy to whip something up, and if performance were necessary, I'd write it in C. My thought here was that if I wanted slow garbage collection, I'd use a language easy to program in (e.g., Awk or Perl); if I needed speed, I'd use C. Java seemed neither easy to program in nor fast (slower than Perl in some cases), so it just didn't seem to have a place. That being said, I did have people on my staff who would write Java programs where a couple of lines of Perl would have worked, but I guess you use the tools you know. I didn't know Java, so I used other tools. To this day, I still don't know Java and don't understand why I would learn it. I still don't see its place in my programming world, and every Java program I have ever seen has not only been slow, but ugly to boot. My language of choice now, however, is Javascript. Pull it out of the browser (there are several nonbrowser environments for Javascript; if you have Windows, one of them comes with your operating system) and it's really quite a fun language. I know it is not as fast as C or C++, and I can always recode the parts that need tuning in a faster language, but I have not, as yet, had to do that. It's fast enough, and I distribute my system over multiple machines if I need more speed. That's how I discovered Erlang. Cheers, David -------------- next part -------------- An HTML attachment was scrubbed... URL: From rklophaus@REDACTED Thu Feb 26 15:56:32 2009 From: rklophaus@REDACTED (Rusty Klophaus) Date: Thu, 26 Feb 2009 09:56:32 -0500 Subject: [erlang-questions] Drupal clone anybody? In-Reply-To: <9b08084c0902260517l21f2d6fcsa2d9f341a2ee47a5@mail.gmail.com> References: <9b08084c0902260414r5140fba3ne142a68e87a1068c@mail.gmail.com> <117a596e0902260507p7ce08488neb898dac45495829@mail.gmail.com> <9b08084c0902260517l21f2d6fcsa2d9f341a2ee47a5@mail.gmail.com> Message-ID: <9F65E65D-69B7-4875-9854-13960CBE8086@gmail.com> Hi Joe, Thanks for the compliments! I've done a lot of work and have also had a lot of help and support from the community. I really like the idea of packaging up an Erlang-based web stack. Regardless of what stack is decided, I'd like to see it include Faxien (from http://erlware.org) or some other Erlang package manager. Best, Rusty On Feb 26, 2009, at 8:17 AM, Joe Armstrong wrote: > On Thu, Feb 26, 2009 at 2:07 PM, Yvan Godin > wrote: >> For a such job, may be, you should consider Nitrogen from Rusty >> Klophaus (http://nitrogenproject.com/) > > Thanks - I just took a quick look - I'm impressed by how much progress > has been made since I > first saw this - this is looking really good. > > @rusty - this is looking really nice - the interaction between JS and > erlang is neat > > It would be great to start with this an package it a la bitnami > > /Joe > > >> >> Yvan >> >> >> 2009/2/26 Joe Armstrong >>> >>> The other day my son wanted to build a web site .... >>> >>> He's no programmer - but he can point a mouse and click. >>> >>> He showed me the kind of stuff he wanted. His university has a web >>> site and he can administer bits >>> of it by pointing and clicking ... >>> >>> To cut a long story short ..... drupal >>> >>> The idea is nice - Jim User knows nothing about web sites, but can >>> fill in a menu and click a button >>> and you get a website. >>> >>> I thought I'd play with drupal ... bought a book .... read it ... >>> (well skimmed through it) >>> >>> Play time - http://bitnami.org/ - fantastic ( a single click >>> downloads >>> Apache+PHP+MySQL+Drupal) >>> Execute one shell script and fill in one form and we're up and >>> running. >>> >>> If you don't know what bitnami is stop reading this message and go >>> take a >>> look >>> >>> (bitnami is apt-get install XYZ on steroids - it gets all the bits >>> you >>> need *and configures everything* >>> in a couple of mouse clicks) >>> >>> WHY DONT WE PACKAGE YAWS+MNESIA+COUTCHDB etc in a similar manner >>> to the >>> bitnami >>> packages? - make it *really* easy to get started. >>> >>> (I see a lot of mail from people who have tried to gets started with >>> yaws/mochi/couchDB etc and fail >>> or who have to search for info and fail, or who write tutorials on >>> how to install stuff 'cos it difficult - >>> this is *just like me* - I have big problems installing stuff (like >>> mysql) that I don't know well - it takes >>> a long time to make stuff work if you do not understand it) >>> >>> What is drupal? >>> >>> templates + forms + database + plugin architecture + way of >>> working + report generator >>> >>> Well we can do most of these things - I've just made a javascript >>> thingy to make forms - we could use >>> mnesia/couchDB/dets/filesystem as a database - we need some kind of >>> templating (I've done this as well) >>> need a web server (mochi/yaws/...) >>> >>> We could cloan the drupal architecture - in essence the appendices >>> to >>> the book I bought contain the database schemas that power Drupal so >>> most of the hard work is done - in a sence a data base schema >>> is a form (almost). >>> >>> I think it might be fun to try and make a bitnami type distibution >>> that packages a LYME stack >>> (Linux Yaws Mnesia Erlang) - (or Mac Mochi CouchDn Erlang) then >>> build >>> a menu/table viewer layer on top - then build some apps on top of >>> that. >>> >>> If the basic infrastructure was Webserver+database+erlang+menus >>> +table >>> viewer then building >>> an application on top of this might be a simple job. >>> >>> (The bit I'm missing is a table viewer in a browser, something like >>> the module tv that runs with >>> AJAX calls in a browser - and that has a few nice js effects) >>> >>> Another problem that needs to be addressed is multi-platform >>> packaging >>> - how can we package >>> this for linux, windows, os-x and "the cloud". >>> >>> This might make a nice community project - we need some specialist >>> knowledge here in the following areas: >>> >>> - web servers (think yaws, mochiweb) >>> - ccs + html templates (think pretty designs) >>> - data bases (think mnesia, couchdb) (or even backends to >>> mysql) >>> - javascript (think, fancy forms, AJAX, jquery, pretty >>> effects, JSON) >>> - packaging (like bitnami) >>> - Instant messaging (xmpp, ejabberd) etc. >>> >>> Then we need people who want to build domain specific apps >>> >>> - bulletin boards >>> - blog engines >>> - mashups >>> - cms >>> - bug trackers >>> >>> The latter group should be presented with a uniform API towards the >>> platform >>> >>> To the question is anybody interested? - I expect the answer to be >>> yes >>> - but how can we organize this? >>> Can we have volunteers? - who does what on which machine? >>> >>> All comments are welcome >>> >>> /Joe Armstrong >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> >> >> >> >> From exta7@REDACTED Thu Feb 26 16:25:09 2009 From: exta7@REDACTED (Zvi) Date: Thu, 26 Feb 2009 07:25:09 -0800 (PST) Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> Message-ID: <22226430.post@talk.nabble.com> Steve, you definitely at drinking kool aid stage. I love Erlang, it's practical language, but it's syntax and semantics can't be called beautiful. The biggest problem is overlap and impedance mismatch between various levels of the language/platform: 1. i.e. sequential/functional Erlang: MFA 2. processes and message passing 3. OTP gen_server i.e. I can write: Res = my_mod:my_fun(Args) or Pid = spawn(my_mod, start), Pid ! {my_fun,Args}, Res = receive Res -> Res end. or {ok,Pid} = gen_server:start(my_mod,[],[]). Res = gen_server:call(Pid, {my_fun, Args}). compare this with Reia: Res = MyClass.MyMethod(Args) Another big problem with Erlang, that, while it makes implementation of hard things easy, the easy things are sometimes hard to implement in Erlang. Zvi -- View this message in context: http://www.nabble.com/The-Beauty-of-Erlang-Syntax-tp22179816p22226430.html Sent from the Erlang Questions mailing list archive at Nabble.com. From ingela@REDACTED Thu Feb 26 16:28:13 2009 From: ingela@REDACTED (Ingela Anderton Andin) Date: Thu, 26 Feb 2009 16:28:13 +0100 Subject: [erlang-questions] reading RSA public key files (PEM) In-Reply-To: References: Message-ID: <49A6B50D.3000308@erix.ericsson.se> Hi! Files named _rsa.pub are usually generated by openssh ( usally called only ssh) and are not PEM-files. If you have access to the private key in a a PEM-file the public key is part of the private key and can be extracted from it. public_key:decode_private_key/[1, 2] will return the record #'RSAPrivateKey'{ version, % two-prime | multi modulus, % integer() publicExponent, % integer() privateExponent, % integer() prime1, % integer() prime2, % integer() exponent1, % integer() exponent2, % integer() coefficient, % integer() otherPrimeInfos % [#OtherPrimeInfo{}] | asn1_NOVALUE }. if called with the output from public_key:pem_to_der used to read a private rsa private key. If the public_key API should provide a function to read ssh-files is not something that we have decided or even considered yet. public_key is a pretty new application that we created in the process of creating the new ssl-implementation. And it also will be used by our ssh-application to handle PEM-files in the future, but as you may have noticed it is not officially documented yet. Ssh does not have any API functions for reading the ssh public-key files as this is normally done by the ssh-application itself. But as it is opensource you can always peek on how it is done. I do however strongly recommend that you do not use undocumented functions. When it comes to the module public_key it is a little safer as we intend to make it a documented API in the future but you should be aware that we do not promise it will not change before we document it. Regards Ingela Erlang/OTP - Ericsson > Hi! > > With Erlang R12B5 I can read RSA private keys but not public: > > Eshell V5.6.5 (abort with ^G) >1> public_key:pem_to_der("test_rsa"). >{ok,[{rsa_private_key,<<48,130,4,160,2,1,0,2,130,1,1,0, > 161,19,65,96,102,199,220,63,184, > 182,224,110,...>>, > not_encrypted}]} >2> public_key:pem_to_der("test_rsa.pub"). >{ok,[]} > > Googling around I couldn't find how do that. Any suggestions? > >Thanks! > >-- >Vlad Skvortsov, vss@REDACTED, http://vss.73rus.com From vychodil.hynek@REDACTED Thu Feb 26 16:41:28 2009 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Thu, 26 Feb 2009 16:41:28 +0100 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <22226430.post@talk.nabble.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <22226430.post@talk.nabble.com> Message-ID: <4d08db370902260741u32439d3qe58d8c03e1ba10a6@mail.gmail.com> On Thu, Feb 26, 2009 at 4:25 PM, Zvi wrote: > > Steve, > you definitely at drinking kool aid stage. > > I love Erlang, it's practical language, but it's syntax and semantics can't > be called beautiful. > The biggest problem is overlap and impedance mismatch between various > levels > of the language/platform: > > 1. i.e. sequential/functional Erlang: MFA > 2. processes and message passing > 3. OTP gen_server > > i.e. I can write: > > Res = my_mod:my_fun(Args) > > or > > Pid = spawn(my_mod, start), > Pid ! {my_fun,Args}, > Res = receive Res -> Res end. > > or > > {ok,Pid} = gen_server:start(my_mod,[],[]). > Res = gen_server:call(Pid, {my_fun, Args}). > I there any obstacle to make in module 'my_mod' function 'my_fun' to deal with your requirements in all cases? > > > compare this with Reia: > > Res = MyClass.MyMethod(Args) > > > Another big problem with Erlang, that, while it makes implementation of > hard > things easy, the easy things are sometimes hard to implement in Erlang. > > Zvi > > > > > -- > View this message in context: > http://www.nabble.com/The-Beauty-of-Erlang-Syntax-tp22179816p22226430.html > Sent from the Erlang Questions mailing list archive at Nabble.com. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try Good Data now for free: www.gooddata.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Thu Feb 26 17:08:56 2009 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 26 Feb 2009 17:08:56 +0100 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <22226430.post@talk.nabble.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <22226430.post@talk.nabble.com> Message-ID: <9b08084c0902260808hf9903b1yb0aa072e7e503160@mail.gmail.com> On Thu, Feb 26, 2009 at 4:25 PM, Zvi wrote: > > Steve, > you definitely at drinking kool aid stage. > > I love Erlang, it's practical language, but it's syntax and semantics can't > be called beautiful. yes they can :-) > The biggest problem is overlap and impedance mismatch between various levels > of the language/platform: > > 1. i.e. sequential/functional Erlang: ?MFA > 2. processes and message passing > 3. OTP gen_server It's nit an impedence mismatch - it was designed to be like this > i.e. I can write: > > Res = my_mod:my_fun(Args) > > or > > Pid = spawn(my_mod, start), > Pid ! {my_fun,Args}, > Res = receive Res -> Res end. > > or > > {ok,Pid} = gen_server:start(my_mod,[],[]). > Res = gen_server:call(Pid, {my_fun, Args}). > > > compare this with Reia: > > Res = MyClass.MyMethod(Args) > The multitude of ways of doing things in different ways is a good thing - imagine you want to write a function call that dispatches seven messages and waits for at least four replies and then returns (this might for example, be a fault-tolerent store, you keep an odd number of copies and when more than half have replied you continue) If you only had a synchronous RPC the code to do this would be a mess. The problem with RPCs is that the reply gets back to the sender - not somebody else. How do you do "compute this, but don't tell me the answer, send the result to somebody else" with synchronous RPCs - you can't. How do you handle failures in the middle of an RPC? - the erlang answer is easy How would you do this in Reia? At the bottom layer you have ! (send) and recieve The next layer provided library functions for RPCs rpc(Pid, Request) -> Pid ! {self(), Request}, receive {Pid, Response} -> Response end. (this is all gen_server:call does - ( actually it does a bit more ...)) If you don't like it, you can roll your own mechanisms. 95% of the time standard synchronous RPCs will work - but not all the time, that's why it's nice to be able to open up things and muck around at the message passing level. "normal RPCs where nothing goes wrong are easy to deal with" add time and failures then life gets difficult - Erlang was designed to be *possible* (not easy) to handle time and failure in a not too painful manner. In the real world there are only messages - photons etc. that's the way the world works that's the way Erlang works, that's the way .. boom boom .. we like it clap clap (Can somebody set this to music) /Joe Armstrong > Another big problem with Erlang, that, while it makes implementation of hard > things easy, Great > the easy things are sometimes hard to implement in Erlang. Like what? > > Zvi > /Joe Armstrong > > > -- > View this message in context: http://www.nabble.com/The-Beauty-of-Erlang-Syntax-tp22179816p22226430.html > Sent from the Erlang Questions mailing list archive at Nabble.com. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From marc@REDACTED Thu Feb 26 17:20:36 2009 From: marc@REDACTED (Marc Worrell) Date: Thu, 26 Feb 2009 17:20:36 +0100 Subject: [erlang-questions] Drupal cloan anybody? In-Reply-To: References: Message-ID: <3D6A90E9-3F3A-4F0F-80EB-09DF9E8C78B7@worrell.nl> Hi Joe, Right now we are building a quite complete content management system in Erlang. We took Nitrogen, ErlyDTL, Webmachine, Mochiweb, epgsql and some other components and threw it into our kitchen machine. To this we added a healthy dose of experience with building web based information management systems. Some background: we are (and were) the designers and maintainers of the information management system anyMeta. We ran into some problems between php and what we like to do, so after a study of django, rails, nitrogen and others we decided to create an erlang based system. One of the maintainers of Drupal told me that anyMeta is what Drupal wanted to be... Our framework is still rough and unfinished, and we are a bit stressed as our first customer site should go live within two weeks. (yes, we are building for a commercial project, not because we just like to spend time programming) We will post more information when we have something that is stable enough to be called a 0.1 :-) That will be a bit after our deadline because we need to do some refactoring after that release. When we have some basis we would like to release it as open source and see if there are other people who would like to join in. Enough to do to make it completer, and we will surely welcome some help. And now, back to work... - Marc > Date: Thu, 26 Feb 2009 13:14:00 +0100 > From: Joe Armstrong > Subject: [erlang-questions] Drupal cloan anybody? > To: erlang-questions > > The other day my son wanted to build a web site .... > > He's no programmer - but he can point a mouse and click. > > He showed me the kind of stuff he wanted. His university has a web > site and he can administer bits > of it by pointing and clicking ... > > To cut a long story short ..... drupal > > The idea is nice - Jim User knows nothing about web sites, but can > fill in a menu and click a button > and you get a website. > > I thought I'd play with drupal ... bought a book .... read it ... > (well skimmed through it) -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2413 bytes Desc: not available URL: From tony@REDACTED Thu Feb 26 18:25:19 2009 From: tony@REDACTED (Tony Arcieri) Date: Thu, 26 Feb 2009 10:25:19 -0700 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <9b08084c0902260808hf9903b1yb0aa072e7e503160@mail.gmail.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <22226430.post@talk.nabble.com> <9b08084c0902260808hf9903b1yb0aa072e7e503160@mail.gmail.com> Message-ID: On Thu, Feb 26, 2009 at 9:08 AM, Joe Armstrong wrote: > If you only had a synchronous RPC the code to do this would be a mess. > > The problem with RPCs is that the reply gets back to the sender - not > somebody else. > How do you do "compute this, but don't tell me the answer, send the > result to somebody else" > with synchronous RPCs - you can't. > > How do you handle failures in the middle of an RPC? - the erlang answer is > easy > > How would you do this in Reia? > > At the bottom layer you have ! (send) and recieve > Reia also has ! (send) and receive which operate identically to Erlang, but in addition to that supports the obj.method syntax as syntactic sugar for RPCs. At the very least it's less ugly than Scala's !? operator for RPCs. -- Tony Arcieri -------------- next part -------------- An HTML attachment was scrubbed... URL: From exta7@REDACTED Thu Feb 26 19:48:11 2009 From: exta7@REDACTED (Zvi) Date: Thu, 26 Feb 2009 10:48:11 -0800 (PST) Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <22226430.post@talk.nabble.com> <9b08084c0902260808hf9903b1yb0aa072e7e503160@mail.gmail.com> Message-ID: <22230905.post@talk.nabble.com> Tony Arcieri wrote: > > Reia also has ! (send) and receive which operate identically to Erlang, > but > in addition to that supports the obj.method syntax as syntactic sugar for > RPCs. At the very least it's less ugly than Scala's !? operator for RPCs. > Tony, I disappointed, that you support regular Erlang processes in Reia. Functionality-wide you don't need it, since every Reia object is already process (off-course it's heavyweight gen_server process). Whoever want to write efficient code (may use assembler - i.e. Erlang :) All I say, that in high-level language you need gen_server like functionality on the language layer. In Erlang you end up writing boilerplate code for gen_servers. The current Erlang provide you with FS (Flexibility Syndrom). Even such a basic thing like a string: you can use list, you can use binary and some library functions even accept atoms instead of strings. Look for example at Ulf Wiger's plainfsm vs. gen_fsm . There is overlapping between plain Erlang and OTP. The good thing, that there is only one OTP (i.e. no competing high-level frameworks for Erlang). I want to concentrate on my problem domain and think in single paradigm. Instead erlang forces you to think in MFAs, funs, messages and gen_server primitives. Having both regular functions and funs is also FS (I understand that historically funs were introduced later, but still). I see regular function as constant fun. Regaring simple things in other languages - hard in Erlang. This was discussed many times and I'll not repeat it: interop, strings, collections, defining functions from shell, libraries with principle of maximum surprise, etc. I'll just give simple example like loop: Ruby: 10.times { puts "hi" } Basic: for i=1 to 10 print "hi" next Erlang: print_hi(10). print_hi(0) -> ok; print_hi(N) -> io:format("hi~n"), print_hi(N-1). or use LC, which is a little shorter, but build 2 unnecessary lists in memory: [ io:format("hi~n") || _<-lists:seq(1,10) ]. or try to define factorial fun from shell: Fact = fun(0,_) -> 1; (N,F) -> (N-1)*F(N,F) end. Fact2 = fun(N) -> Fact(N, Fact) end. Uggggggly! Zvi -- View this message in context: http://www.nabble.com/The-Beauty-of-Erlang-Syntax-tp22179816p22230905.html Sent from the Erlang Questions mailing list archive at Nabble.com. From vychodil.hynek@REDACTED Thu Feb 26 20:11:28 2009 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Thu, 26 Feb 2009 20:11:28 +0100 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <22230905.post@talk.nabble.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <22226430.post@talk.nabble.com> <9b08084c0902260808hf9903b1yb0aa072e7e503160@mail.gmail.com> <22230905.post@talk.nabble.com> Message-ID: <4d08db370902261111q30419862kfad8970fade35853@mail.gmail.com> Why not tailor your own function times(F, N) when is_function(F,0), is_integer(N), N>=0 -> _times(F, N). _times(_, 0) -> ok; _times(F, N) -> F(), _times(F, N-1). and than you can easily do times(fun()->io:format("hi~n"), 10). But anyway, how often you need do something N times without take care for result for *practical* purpose? I think you choose wrong example ;-) On Thu, Feb 26, 2009 at 7:48 PM, Zvi wrote: > > > > Tony Arcieri wrote: > > > > Reia also has ! (send) and receive which operate identically to Erlang, > > but > > in addition to that supports the obj.method syntax as syntactic sugar for > > RPCs. At the very least it's less ugly than Scala's !? operator for > RPCs. > > > > Tony, > I disappointed, that you support regular Erlang processes in Reia. > Functionality-wide you don't need it, since every Reia object is already > process (off-course it's heavyweight gen_server process). Whoever want to > write efficient code (may use assembler - i.e. Erlang :) > > All I say, that in high-level language you need gen_server like > functionality on the language layer. In Erlang you end up writing > boilerplate code for gen_servers. The current Erlang provide you with FS > (Flexibility Syndrom). Even such a basic thing like a string: you can use > list, you can use binary and some library functions even accept atoms > instead of strings. > Look for example at Ulf Wiger's plainfsm vs. gen_fsm . There is overlapping > between plain Erlang and OTP. The good thing, that there is only one OTP > (i.e. no competing high-level frameworks for Erlang). > > I want to concentrate on my problem domain and think in single paradigm. > Instead erlang forces you to think in MFAs, funs, messages and gen_server > primitives. > > Having both regular functions and funs is also FS (I understand that > historically funs were introduced later, but still). I see regular function > as constant fun. > > Regaring simple things in other languages - hard in Erlang. This was > discussed many times and I'll not repeat it: interop, strings, collections, > defining functions from shell, libraries with principle of maximum > surprise, > etc. I'll just give simple example like loop: > > Ruby: > 10.times { puts "hi" } > > Basic: > for i=1 to 10 > print "hi" > next > > Erlang: > print_hi(10). > > print_hi(0) -> ok; > print_hi(N) -> > io:format("hi~n"), > print_hi(N-1). > > or use LC, which is a little shorter, but build 2 unnecessary lists in > memory: > > [ io:format("hi~n") || _<-lists:seq(1,10) ]. > > or try to define factorial fun from shell: > > Fact = fun(0,_) -> 1; > (N,F) -> (N-1)*F(N,F) > end. > Fact2 = fun(N) -> Fact(N, Fact) end. > > Uggggggly! > > Zvi > > -- > View this message in context: > http://www.nabble.com/The-Beauty-of-Erlang-Syntax-tp22179816p22230905.html > Sent from the Erlang Questions mailing list archive at Nabble.com. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try Good Data now for free: www.gooddata.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrad-direct-erlang@REDACTED Thu Feb 26 20:27:38 2009 From: mrad-direct-erlang@REDACTED (Michael Radford) Date: Thu, 26 Feb 2009 11:27:38 -0800 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <4d08db370902261111q30419862kfad8970fade35853@mail.gmail.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <22226430.post@talk.nabble.com> <9b08084c0902260808hf9903b1yb0aa072e7e503160@mail.gmail.com> <22230905.post@talk.nabble.com> <4d08db370902261111q30419862kfad8970fade35853@mail.gmail.com> Message-ID: <20090226192738.GA27974@herbie> Hynek Vychodil writes: > But anyway, how often you need do something N times without take care for > result for *practical* purpose? I think you choose wrong example ;-) Off-topic, but it's funny there are no standard library functions (AFAIK) that simply iterate over a range of integers. The common idiom seems to be to use lists:seq and a list iterator function like lists:foreach or lists:foldl. Which, I will preemptively agree, is clear and efficient enough for most purposes. (Is the compiler smart enough to optimize away the construction of the list of integers in cases like that?) But still, if there were standard functions like these I would use them all the time: foreach_range (fun (I) -> ... end, 1, 10) foldl_range (fun (I, Acc) -> ... end, Acc0, 1, 10) Mike From exta7@REDACTED Thu Feb 26 20:36:28 2009 From: exta7@REDACTED (Zvi) Date: Thu, 26 Feb 2009 11:36:28 -0800 (PST) Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <4d08db370902261111q30419862kfad8970fade35853@mail.gmail.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <22226430.post@talk.nabble.com> <9b08084c0902260808hf9903b1yb0aa072e7e503160@mail.gmail.com> <22230905.post@talk.nabble.com> <4d08db370902261111q30419862kfad8970fade35853@mail.gmail.com> Message-ID: <22231875.post@talk.nabble.com> This is very real *practical* example of repeating multiple times measurement from the shell. You can't define your _times function from the shell and it's not in standard library, the closest is lists:foreach/2 . So one need to define Times fun from the shell using Y-combinator, before doing time measurement? The second also, very practical. It's hard to work from shell in recursive language, when you can't define recursive fun from the shell. You can't use macros from the shell either. I'd like to define loop funs and spawn processes from the shell, but the only way is to use uggly Y-combinator trick. The practical solution for this is to add times/1 and loop/1 to the user_defaults.erl or something like this (and make sure that every Erlang VM installation have this file ...). Zvi Why not tailor your own function times(F, N) when is_function(F,0), is_integer(N), N>=0 -> _times(F, N). _times(_, 0) -> ok; _times(F, N) -> F(), _times(F, N-1). and than you can easily do times(fun()->io:format("hi~n"), 10). But anyway, how often you need do something N times without take care for result for *practical* purpose? I think you choose wrong example ;-) -- View this message in context: http://www.nabble.com/The-Beauty-of-Erlang-Syntax-tp22179816p22231875.html Sent from the Erlang Questions mailing list archive at Nabble.com. From rvirding@REDACTED Thu Feb 26 20:41:44 2009 From: rvirding@REDACTED (Robert Virding) Date: Thu, 26 Feb 2009 20:41:44 +0100 Subject: [erlang-questions] Is there a way to serialise a running process & resume it later (i.e. continuations) In-Reply-To: <1235605314.1994.8.camel@mp.virtual-earth.de> References: <1235605314.1994.8.camel@mp.virtual-earth.de> Message-ID: <3dbc6d1c0902261141u63ae45a0i405274789fdd12a5@mail.gmail.com> 2009/2/26 Mathias Picker > I've worked with seaside and really love this way of writing web apps. > Sadly, you need continuations, a way to store a running process and > continue it afterwards. Sorry, I don't understand why you want to store a running process. Why not just leave the process and use it when needed? Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From kevin@REDACTED Thu Feb 26 20:56:31 2009 From: kevin@REDACTED (Kevin Scaldeferri) Date: Thu, 26 Feb 2009 11:56:31 -0800 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <22230905.post@talk.nabble.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <22226430.post@talk.nabble.com> <9b08084c0902260808hf9903b1yb0aa072e7e503160@mail.gmail.com> <22230905.post@talk.nabble.com> Message-ID: <57400D87-A249-43E9-A640-66C87A255EFB@scaldeferri.com> On Feb 26, 2009, at 10:48 AM, Zvi wrote: > I want to concentrate on my problem domain and think in single > paradigm. > Instead erlang forces you to think in MFAs, funs, messages and > gen_server > primitives. If you want to have only one way of doing anything, perhaps you should try Python. I hear that's one of their design principles. > Regaring simple things in other languages - hard in Erlang. This was > discussed many times and I'll not repeat it: interop, strings, > collections, > defining functions from shell, libraries with principle of maximum > surprise, > etc. I'll just give simple example like loop: > > Ruby: > 10.times { puts "hi" } > ... > or use LC, which is a little shorter, but build 2 unnecessary lists in > memory: > > [ io:format("hi~n") || _<-lists:seq(1,10) ]. You can also use lists:foreach, which will only require the one additional list, but really, as someone else pointed out, this is horribly contrived. How often do you really use Integer#times in Ruby, compared to other looping / iteration constructs? At $WORK I just checked our codebase: each: 1234 map/collect: 35 times: 24 select: 19 reject: 18 inject: 9 Almost ever instance of times() is for the same basic purpose: generating a random sequence of length N. There's probably also a lot of uses of each() which should be one of the others, but I work mostly with folks with an imperative, not functional mindset. Anyway, the point is, if times() is something you do a lot, just write it and get on with your life. If it matters to you a lot, make an argument for why it's generally important and submit a patch to the standard libraries. -kevin -------------- next part -------------- An HTML attachment was scrubbed... URL: From exta7@REDACTED Thu Feb 26 21:04:49 2009 From: exta7@REDACTED (Zvi) Date: Thu, 26 Feb 2009 12:04:49 -0800 (PST) Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <20090226192738.GA27974@herbie> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <22226430.post@talk.nabble.com> <9b08084c0902260808hf9903b1yb0aa072e7e503160@mail.gmail.com> <22230905.post@talk.nabble.com> <4d08db370902261111q30419862kfad8970fade35853@mail.gmail.com> <20090226192738.GA27974@herbie> Message-ID: <22232485.post@talk.nabble.com> to be future-proof and GPU-compatible, you need to define foreach/fold_NDrange, where NDrange is N-dimensional space :) Michael Radford-3 wrote: > > Hynek Vychodil writes: >> But anyway, how often you need do something N times without take care for >> result for *practical* purpose? I think you choose wrong example ;-) > > Off-topic, but it's funny there are no standard library functions > (AFAIK) that simply iterate over a range of integers. > > The common idiom seems to be to use lists:seq and a list iterator > function like lists:foreach or lists:foldl. Which, I will preemptively > agree, is clear and efficient enough for most purposes. (Is the > compiler smart enough to optimize away the construction of the list of > integers in cases like that?) > > But still, if there were standard functions like these I would use them > all the time: > foreach_range (fun (I) -> ... end, 1, 10) > foldl_range (fun (I, Acc) -> ... end, Acc0, 1, 10) > > Mike > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- View this message in context: http://www.nabble.com/The-Beauty-of-Erlang-Syntax-tp22179816p22232485.html Sent from the Erlang Questions mailing list archive at Nabble.com. From rvirding@REDACTED Thu Feb 26 21:21:39 2009 From: rvirding@REDACTED (Robert Virding) Date: Thu, 26 Feb 2009 21:21:39 +0100 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <22231875.post@talk.nabble.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <22226430.post@talk.nabble.com> <9b08084c0902260808hf9903b1yb0aa072e7e503160@mail.gmail.com> <22230905.post@talk.nabble.com> <4d08db370902261111q30419862kfad8970fade35853@mail.gmail.com> <22231875.post@talk.nabble.com> Message-ID: <3dbc6d1c0902261221p7175dd3dsab1d4b0861f04bcc@mail.gmail.com> What I find I do if I want to use more complicated expressions in the shell is to define a small module containing the functions I need at the moment and then throw it away when done. Sometimes I even bung them somewhere in the modules I am testing and delete them when done. One thing to remember is that there is no support in the erlang VM for interpreted code. All functions exist in compiled modules. So it is impossible to mix interpreted and compiled functions and in many lisp systems, there are no interpreted functions. There is an interpreter written in Erlang, erl_eval, which is used by the shell but it has no special status in the system. Robert 2009/2/26 Zvi > > This is very real *practical* example of repeating multiple times > measurement > from the shell. > You can't define your _times function from the shell and it's not in > standard library, the closest is lists:foreach/2 . > > So one need to define Times fun from the shell using Y-combinator, before > doing time measurement? > > The second also, very practical. It's hard to work from shell in recursive > language, when you can't define recursive fun from the shell. > You can't use macros from the shell either. > I'd like to define loop funs and spawn processes from the shell, but the > only way is to use uggly Y-combinator trick. > > The practical solution for this is to add times/1 and loop/1 to the > user_defaults.erl or something like this (and make sure that every Erlang > VM > installation have this file ...). > > Zvi > > > Why not tailor your own function > > times(F, N) when is_function(F,0), is_integer(N), N>=0 -> _times(F, N). > > _times(_, 0) -> ok; > _times(F, N) -> F(), _times(F, N-1). > > and than you can easily do times(fun()->io:format("hi~n"), 10). > > But anyway, how often you need do something N times without take care for > result for *practical* purpose? I think you choose wrong example ;-) > > > > -- > View this message in context: > http://www.nabble.com/The-Beauty-of-Erlang-Syntax-tp22179816p22231875.html > Sent from the Erlang Questions mailing list archive at Nabble.com. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From exta7@REDACTED Thu Feb 26 22:12:49 2009 From: exta7@REDACTED (Zvi) Date: Thu, 26 Feb 2009 13:12:49 -0800 (PST) Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <57400D87-A249-43E9-A640-66C87A255EFB@scaldeferri.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <22226430.post@talk.nabble.com> <9b08084c0902260808hf9903b1yb0aa072e7e503160@mail.gmail.com> <22230905.post@talk.nabble.com> <57400D87-A249-43E9-A640-66C87A255EFB@scaldeferri.com> Message-ID: <22233815.post@talk.nabble.com> Kevin Scaldeferri wrote: > > If you want to have only one way of doing anything, perhaps you should > try Python. I hear that's one of their design principles. > Kevin, I playing a devil advocate here (actualy some company paid me to be a devil's advocate :) I can adopt to any syntax and semantics. I already use Erlang and love it. I just think of it as a low-level language, kinda parallel and distributed COBOL :) There are some simple things that hard to do in Erlang. That's the reason, why project like Disco uses combination of Erlang+Python and Fuzed - Erlang+Ruby. Kevin Scaldeferri wrote: > > Anyway, the point is, if times() is something you do a lot, just write > it and get on with your life. If it matters to you a lot, make an > argument for why it's generally important and submit a patch to the > standard libraries. > Obviously you didn't read the list of things hard in Erlang, simple in other langs. Repeat N times, is just a simplest example. In Jim Larson's Times, just a case of "for" loop. I working on generic collections library for Erlang, where will be ranges. Someting like: R = gc_range:new(1,10). gc:foreach(fun(_)->io:format("hi~n") end, R). Zvi -- View this message in context: http://www.nabble.com/The-Beauty-of-Erlang-Syntax-tp22179816p22233815.html Sent from the Erlang Questions mailing list archive at Nabble.com. From exta7@REDACTED Thu Feb 26 22:40:55 2009 From: exta7@REDACTED (Zvi) Date: Thu, 26 Feb 2009 13:40:55 -0800 (PST) Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <22233815.post@talk.nabble.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <22226430.post@talk.nabble.com> <9b08084c0902260808hf9903b1yb0aa072e7e503160@mail.gmail.com> <22230905.post@talk.nabble.com> <57400D87-A249-43E9-A640-66C87A255EFB@scaldeferri.com> <22233815.post@talk.nabble.com> Message-ID: <22234312.post@talk.nabble.com> oops, presses "Post Msg" to soon: Zvi wrote: > > > Kevin Scaldeferri wrote: >> >> Anyway, the point is, if times() is something you do a lot, just write >> it and get on with your life. If it matters to you a lot, make an >> argument for why it's generally important and submit a patch to the >> standard libraries. >> > ... In Jim Larson's > article "Erlang for Concurrent Programming" [1] there is a list of things for which Erlang tends to be not good. [1] http://mags.acm.org/queue/200809/ -- View this message in context: http://www.nabble.com/The-Beauty-of-Erlang-Syntax-tp22179816p22234312.html Sent from the Erlang Questions mailing list archive at Nabble.com. From erlang@REDACTED Thu Feb 26 22:43:57 2009 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 26 Feb 2009 22:43:57 +0100 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <22233815.post@talk.nabble.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <22226430.post@talk.nabble.com> <9b08084c0902260808hf9903b1yb0aa072e7e503160@mail.gmail.com> <22230905.post@talk.nabble.com> <57400D87-A249-43E9-A640-66C87A255EFB@scaldeferri.com> <22233815.post@talk.nabble.com> Message-ID: <9b08084c0902261343r58d501ebycc3a9b702977c198@mail.gmail.com> for(Max,Max,F) -> F(Max); for(I,N,F) -> F(I),for(I+1,Max,F). for(1,10, fun(I) -> io:format("...." end) The code is *shorter than the documentation" writing the code is quicker than finding the documentation and reading it - this is true in most programming languages which is why programmers write code. This happens all the time I wanted hex2int after 20 seconds in google I gave up and wrote it myself - this is also true for javascript C, ... as Wirth once said It is better to know one langauge very well that to know many languages incompletely.. Hint: read books and type in the examples. for/3 is in my book :-) don't rely on the web for information - (example Douglas Crockford's Good Parts of JavaScript - I learnt more in half an hour reading this than dozens of hours reading appallingly bad articles on the web) /Joe Armstrong On Thu, Feb 26, 2009 at 10:12 PM, Zvi wrote: > > > > Kevin Scaldeferri wrote: >> >> If you want to have only one way of doing anything, perhaps you should >> try Python. ?I hear that's one of their design principles. >> > > Kevin, > I playing a devil advocate here (actualy some company paid me to be a > devil's advocate :) > I can adopt to any syntax and semantics. I already use Erlang and love it. I > just think of it as a low-level language, kinda parallel and distributed > COBOL :) There are some simple things that hard to do in Erlang. That's the > reason, why project like Disco uses combination of Erlang+Python and Fuzed - > Erlang+Ruby. > > > Kevin Scaldeferri wrote: >> >> Anyway, the point is, if times() is something you do a lot, just write >> it and get on with your life. ?If it matters to you a lot, make an >> argument for why it's generally important and submit a patch to the >> standard libraries. >> > Obviously you didn't read the list of things hard in Erlang, simple in other > langs. Repeat N times, is just a simplest example. In Jim Larson's > > Times, just a case of "for" loop. > I working on generic collections library for Erlang, where will be ranges. > Someting like: > > R = gc_range:new(1,10). > gc:foreach(fun(_)->io:format("hi~n") end, R). > > Zvi > > > > -- > View this message in context: http://www.nabble.com/The-Beauty-of-Erlang-Syntax-tp22179816p22233815.html > Sent from the Erlang Questions mailing list archive at Nabble.com. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From pablo.polvorin@REDACTED Thu Feb 26 22:52:24 2009 From: pablo.polvorin@REDACTED (Pablo Polvorin) Date: Thu, 26 Feb 2009 19:52:24 -0200 Subject: [erlang-questions] Is there a way to serialise a running process & resume it later (i.e. continuations) In-Reply-To: <1ffe809c0902261351m15dc3f15pe79c76a7da713b6a@mail.gmail.com> References: <1235605314.1994.8.camel@mp.virtual-earth.de> <3dbc6d1c0902261141u63ae45a0i405274789fdd12a5@mail.gmail.com> <1ffe809c0902261351m15dc3f15pe79c76a7da713b6a@mail.gmail.com> Message-ID: <1ffe809c0902261352u52beb241tb73862c95f118ea1@mail.gmail.com> > Sorry, I don't understand why you want to store a running process. Why not > just leave the process and use it when needed? > > Robert > I think he refers to the ability to return to a previous state of the computation. Using a gen_fsm isn't enough by itself: ?you can easily instruct the fsm to return from the fsm_state_3 back to fsm_state_2, but you will also need to discard any changes you did in the process state during the original transition from fsm_state_2 to fsm_state_3. I think, however, that shouldn't be too difficult to come with a custom solution, or even a custom behaviour for that, by keeping track of the previous process data, ?or implementing "undo"s for each possible type of action (something like the common undo-redo pattern for editors) From Mathias.Picker@REDACTED Thu Feb 26 23:07:02 2009 From: Mathias.Picker@REDACTED (Mathias Picker) Date: Thu, 26 Feb 2009 23:07:02 +0100 Subject: [erlang-questions] Is there a way to serialise a running process & resume it later (i.e. continuations) In-Reply-To: <3dbc6d1c0902261141u63ae45a0i405274789fdd12a5@mail.gmail.com> References: <1235605314.1994.8.camel@mp.virtual-earth.de> <3dbc6d1c0902261141u63ae45a0i405274789fdd12a5@mail.gmail.com> Message-ID: <1235686022.66228.22.camel@mp.virtual-earth.de> Am Donnerstag, den 26.02.2009, 20:41 +0100 schrieb Robert Virding: > 2009/2/26 Mathias Picker > I've worked with seaside and really love this way of writing > web apps. > Sadly, you need continuations, a way to store a running > process and > continue it afterwards. > > Sorry, I don't understand why you want to store a running process. Why > not just leave the process and use it when needed? > > Robert To support e.g. the back-button behaviour in browsers elegantly. See the diverse seaside docs for an example how such a web framework can be used, and for a good explanation of why and what read "Inverting back the inversion of control or, continuations versus page-centric programming (2001)" http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.29.3112 Mathias From exta7@REDACTED Thu Feb 26 23:16:35 2009 From: exta7@REDACTED (Zvi) Date: Thu, 26 Feb 2009 14:16:35 -0800 (PST) Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <9b08084c0902261343r58d501ebycc3a9b702977c198@mail.gmail.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <22226430.post@talk.nabble.com> <9b08084c0902260808hf9903b1yb0aa072e7e503160@mail.gmail.com> <22230905.post@talk.nabble.com> <57400D87-A249-43E9-A640-66C87A255EFB@scaldeferri.com> <22233815.post@talk.nabble.com> <9b08084c0902261343r58d501ebycc3a9b702977c198@mail.gmail.com> Message-ID: <22234998.post@talk.nabble.com> Joe, I've read your book. You didn't get my point. I can enter into irb shell (out of the box) and enter this one liner: irb(main):002:0> (1..10).each { |i| puts "i=#{i}" } i=1 i=2 i=3 i=4 i=5 i=6 i=7 i=8 i=9 i=10 => 1..10 To do the same in Erlang shell (out of the box) with your for/3 : 1> For0 = fun(Max,Max,F,_) -> F(Max); 1> (I,Max,F,Self) -> F(I), Self(I+1,Max,F,Self) 1> end. #Fun 2> For = fun(Min,Max,F) -> For0(Min,Max,F,For0) end. #Fun 3> For(1,10,fun(I)-> io:format("i=~b~n",[I]) end). i=1 i=2 i=3 i=4 i=5 i=6 i=7 i=8 i=9 i=10 ok 4> Joe Armstrong-2 wrote: > > for(Max,Max,F) -> F(Max); > for(I,N,F) -> F(I),for(I+1,Max,F). > > for(1,10, fun(I) -> io:format("...." end) > > The code is *shorter than the documentation" > > writing the code is quicker than finding the documentation and reading it > - this > is true in most programming languages which is why programmers write > code. > > This happens all the time I wanted hex2int after 20 seconds in google I > gave up > and wrote it myself - this is also true for javascript C, ... as Wirth > once said > It is better to know one langauge very well that to know many languages > incompletely.. > > Hint: read books and type in the examples. for/3 is in my book :-) > don't rely on the web for information - (example Douglas Crockford's > Good Parts of JavaScript - I learnt more in half an hour reading this > than dozens of > hours reading appallingly bad articles on the web) > > > /Joe Armstrong > > > On Thu, Feb 26, 2009 at 10:12 PM, Zvi wrote: >> >> >> >> Kevin Scaldeferri wrote: >>> >>> If you want to have only one way of doing anything, perhaps you should >>> try Python. ?I hear that's one of their design principles. >>> >> >> Kevin, >> I playing a devil advocate here (actualy some company paid me to be a >> devil's advocate :) >> I can adopt to any syntax and semantics. I already use Erlang and love >> it. I >> just think of it as a low-level language, kinda parallel and distributed >> COBOL :) There are some simple things that hard to do in Erlang. That's >> the >> reason, why project like Disco uses combination of Erlang+Python and >> Fuzed - >> Erlang+Ruby. >> >> >> Kevin Scaldeferri wrote: >>> >>> Anyway, the point is, if times() is something you do a lot, just write >>> it and get on with your life. ?If it matters to you a lot, make an >>> argument for why it's generally important and submit a patch to the >>> standard libraries. >>> >> Obviously you didn't read the list of things hard in Erlang, simple in >> other >> langs. Repeat N times, is just a simplest example. In Jim Larson's >> >> Times, just a case of "for" loop. >> I working on generic collections library for Erlang, where will be >> ranges. >> Someting like: >> >> R = gc_range:new(1,10). >> gc:foreach(fun(_)->io:format("hi~n") end, R). >> >> Zvi >> >> >> >> -- >> View this message in context: >> http://www.nabble.com/The-Beauty-of-Erlang-Syntax-tp22179816p22233815.html >> Sent from the Erlang Questions mailing list archive at Nabble.com. >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- View this message in context: http://www.nabble.com/The-Beauty-of-Erlang-Syntax-tp22179816p22234998.html Sent from the Erlang Questions mailing list archive at Nabble.com. From erlangy@REDACTED Thu Feb 26 23:26:56 2009 From: erlangy@REDACTED (Michael McDaniel) Date: Thu, 26 Feb 2009 14:26:56 -0800 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <9b08084c0902261343r58d501ebycc3a9b702977c198@mail.gmail.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <22226430.post@talk.nabble.com> <9b08084c0902260808hf9903b1yb0aa072e7e503160@mail.gmail.com> <22230905.post@talk.nabble.com> <57400D87-A249-43E9-A640-66C87A255EFB@scaldeferri.com> <22233815.post@talk.nabble.com> <9b08084c0902261343r58d501ebycc3a9b702977c198@mail.gmail.com> Message-ID: <20090226222656.GA22018@delora.autosys.us> On Thu, Feb 26, 2009 at 10:43:57PM +0100, Joe Armstrong wrote: > for(Max,Max,F) -> F(Max); > for(I,N,F) -> F(I),for(I+1,Max,F). > > for(1,10, fun(I) -> io:format("...." end) > > The code is *shorter than the documentation" > > writing the code is quicker than finding the documentation and reading it - this > is true in most programming languages which is why programmers write > code. > > This happens all the time I wanted hex2int after 20 seconds in google I gave up > and wrote it myself - this is also true for javascript C, ... as Wirth once said > It is better to know one langauge very well that to know many languages > incompletely.. > > Hint: read books and type in the examples. for/3 is in my book :-) > don't rely on the web for information - (example Douglas Crockford's > Good Parts of JavaScript - I learnt more in half an hour reading this ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... and which new *Haskell* book captured you ? I enjoyed and learned from your http://pragprog.com/titles/jaerlang/programming-erlang and recently (pre) purchased http://www.manning.com/logan/ ~Michael > than dozens of > hours reading appallingly bad articles on the web) > > > /Joe Armstrong > > > On Thu, Feb 26, 2009 at 10:12 PM, Zvi wrote: > > > > > > > > Kevin Scaldeferri wrote: > >> > >> If you want to have only one way of doing anything, perhaps you should > >> try Python. ?I hear that's one of their design principles. > >> > > > > Kevin, > > I playing a devil advocate here (actualy some company paid me to be a > > devil's advocate :) > > I can adopt to any syntax and semantics. I already use Erlang and love it. I > > just think of it as a low-level language, kinda parallel and distributed > > COBOL :) There are some simple things that hard to do in Erlang. That's the > > reason, why project like Disco uses combination of Erlang+Python and Fuzed - > > Erlang+Ruby. > > > > > > Kevin Scaldeferri wrote: > >> > >> Anyway, the point is, if times() is something you do a lot, just write > >> it and get on with your life. ?If it matters to you a lot, make an > >> argument for why it's generally important and submit a patch to the > >> standard libraries. > >> > > Obviously you didn't read the list of things hard in Erlang, simple in other > > langs. Repeat N times, is just a simplest example. In Jim Larson's > > > > Times, just a case of "for" loop. > > I working on generic collections library for Erlang, where will be ranges. > > Someting like: > > > > R = gc_range:new(1,10). > > gc:foreach(fun(_)->io:format("hi~n") end, R). > > > > Zvi > > > > > > > > -- > > View this message in context: http://www.nabble.com/The-Beauty-of-Erlang-Syntax-tp22179816p22233815.html > > Sent from the Erlang Questions mailing list archive at Nabble.com. > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Michael McDaniel Portland, Oregon, USA http://trip.autosys.us http://mmcdaniel.com/erlview From kostis@REDACTED Thu Feb 26 23:27:55 2009 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 27 Feb 2009 00:27:55 +0200 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <22234998.post@talk.nabble.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <22226430.post@talk.nabble.com> <9b08084c0902260808hf9903b1yb0aa072e7e503160@mail.gmail.com> <22230905.post@talk.nabble.com> <57400D87-A249-43E9-A640-66C87A255EFB@scaldeferri.com> <22233815.post@talk.nabble.com> <9b08084c0902261343r58d501ebycc3a9b702977c198@mail.gmail.com> <22234998.post@talk.nabble.com> Message-ID: <49A7176B.2050805@cs.ntua.gr> Zvi wrote: > Joe, > I've read your book. You didn't get my point. > I can enter into irb shell (out of the box) and enter this one liner: > > irb(main):002:0> (1..10).each { |i| puts "i=#{i}" } > i=1 > i=2 > i=3 > i=4 > i=5 > i=6 > i=7 > i=8 > i=9 > i=10 > => 1..10 > > To do the same in Erlang shell (out of the box) with your for/3 : > > 1> For0 = fun(Max,Max,F,_) -> F(Max); > 1> (I,Max,F,Self) -> F(I), Self(I+1,Max,F,Self) > 1> end. > #Fun > 2> For = fun(Min,Max,F) -> For0(Min,Max,F,For0) end. > #Fun > 3> For(1,10,fun(I)-> io:format("i=~b~n",[I]) end). What prevents you from writing the following one liners? 1> [io:format("i=~b~n",[I]) || I <- lists:seq(1,10)]. or 2> lists:foreach(fun (I) -> io:format("i=~b~n",[I]) end, lists:seq(1,10)). Kostis From kunthar@REDACTED Thu Feb 26 23:35:40 2009 From: kunthar@REDACTED (Kunthar) Date: Fri, 27 Feb 2009 00:35:40 +0200 Subject: [erlang-questions] Is there a way to serialise a running process & resume it later (i.e. continuations) In-Reply-To: <1235686022.66228.22.camel@mp.virtual-earth.de> References: <1235605314.1994.8.camel@mp.virtual-earth.de> <3dbc6d1c0902261141u63ae45a0i405274789fdd12a5@mail.gmail.com> <1235686022.66228.22.camel@mp.virtual-earth.de> Message-ID: <9a09ca9a0902261435n46c453dfuee1d427dbbd55781@mail.gmail.com> I didnt look closer but Nitrogen[1] has continuations thingy. [1]http://nitrogenproject.com/ \|/ Kunth On Fri, Feb 27, 2009 at 12:07 AM, Mathias Picker wrote: > Am Donnerstag, den 26.02.2009, 20:41 +0100 schrieb Robert Virding: >> 2009/2/26 Mathias Picker >> ? ? ? ? I've worked with seaside and really love this way of writing >> ? ? ? ? web apps. >> ? ? ? ? Sadly, you need continuations, a way to store a running >> ? ? ? ? process and >> ? ? ? ? continue it afterwards. >> >> Sorry, I don't understand why you want to store a running process. Why >> not just leave the process and use it when needed? >> >> Robert > > To support e.g. the back-button behaviour in browsers elegantly. See the > diverse seaside docs for an example how such a web framework can be > used, and for a good explanation of why and what read "Inverting back > the inversion of control or, continuations versus page-centric > programming (2001)" > http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.29.3112 > > > Mathias > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From ulf.wiger@REDACTED Fri Feb 27 00:00:38 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Thu, 26 Feb 2009 23:00:38 +0000 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <22230905.post@talk.nabble.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <22226430.post@talk.nabble.com> <9b08084c0902260808hf9903b1yb0aa072e7e503160@mail.gmail.com> <22230905.post@talk.nabble.com> Message-ID: <49A71F16.3080205@erlang-consulting.com> Zvi wrote: > > Look for example at Ulf Wiger's plainfsm vs. gen_fsm . > There is overlapping between plain Erlang and OTP. > The good thing, that there is only one OTP > (i.e. no competing high-level frameworks for Erlang). I'm reasonably familiar with Ulf Wiger's plain_fsm, but I daresay I don't really get your point. I gather you think reia is great, but for the rest of us, please expand on how reia solves the plain_fsm problem better (not having studied reia, I really have no idea.) Yes, there is an overlap between Erlang and OTP. OTP is Erlang-based middleware - how could there not be? The point, if there was one, of plain_fsm, was rather that the Erlang language has expressive power that you partially have to give up in order to reap the benefits of behaviours. I would guess that most middleware forces similar tradeoffs. And this: > {ok,Pid} = gen_server:start(my_mod,[],[]). > Res = gen_server:call(Pid, {my_fun, Args}). > > > compare this with Reia: > > Res = MyClass.MyMethod(Args) is simply an apples and oranges comparison. You know very well (since you love Erlang) that the convention is to hide gen_server specifics behind a module API, so the honest comparison would be MyMod:MyFun(Args) vs MyClass.MyMethod(Args) I fail to see how one is very low level, and the other is not. Congratulations on getting paid to do this, but apart from that, what do you hope to accomplish? BR, Ulf W -- Ulf Wiger CTO, Erlang Training & Consulting Ltd http://www.erlang-consulting.com From tony@REDACTED Fri Feb 27 00:10:45 2009 From: tony@REDACTED (Tony Arcieri) Date: Thu, 26 Feb 2009 16:10:45 -0700 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <49A71F16.3080205@erlang-consulting.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <22226430.post@talk.nabble.com> <9b08084c0902260808hf9903b1yb0aa072e7e503160@mail.gmail.com> <22230905.post@talk.nabble.com> <49A71F16.3080205@erlang-consulting.com> Message-ID: On Thu, Feb 26, 2009 at 4:00 PM, Ulf Wiger wrote: > And this: > > > {ok,Pid} = gen_server:start(my_mod,[],[]). > > Res = gen_server:call(Pid, {my_fun, Args}). > > > > > > compare this with Reia: > > > > Res = MyClass.MyMethod(Args) > > is simply an apples and oranges comparison. You know > very well (since you love Erlang) that the convention > is to hide gen_server specifics behind a module API, > so the honest comparison would be > > MyMod:MyFun(Args) > > vs > > MyClass.MyMethod(Args) > > I fail to see how one is very low level, and the > other is not. > Really what Reia offers here is a formalization of this convention into first-class syntax, so you needn't wrap gen_server in every module you use it with. Reia's compiler does that for you. -- Tony Arcieri -------------- next part -------------- An HTML attachment was scrubbed... URL: From rvirding@REDACTED Fri Feb 27 00:31:32 2009 From: rvirding@REDACTED (Robert Virding) Date: Fri, 27 Feb 2009 00:31:32 +0100 Subject: [erlang-questions] Is there a way to serialise a running process & resume it later (i.e. continuations) In-Reply-To: <1235686022.66228.22.camel@mp.virtual-earth.de> References: <1235605314.1994.8.camel@mp.virtual-earth.de> <3dbc6d1c0902261141u63ae45a0i405274789fdd12a5@mail.gmail.com> <1235686022.66228.22.camel@mp.virtual-earth.de> Message-ID: <3dbc6d1c0902261531m15d614c7s35ed44994f28ffef@mail.gmail.com> 2009/2/26 Mathias Picker > Am Donnerstag, den 26.02.2009, 20:41 +0100 schrieb Robert Virding: > > 2009/2/26 Mathias Picker > > I've worked with seaside and really love this way of writing > > web apps. > > Sadly, you need continuations, a way to store a running > > process and > > continue it afterwards. > > > > Sorry, I don't understand why you want to store a running process. Why > > not just leave the process and use it when needed? > > > > Robert > > To support e.g. the back-button behaviour in browsers elegantly. See the > diverse seaside docs for an example how such a web framework can be > used, and for a good explanation of why and what read "Inverting back > the inversion of control or, continuations versus page-centric > programming (2001)" > http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.29.3112 > Seeing the state of a process is kept explicitly in the arguments of the functions implementing it it is easy to save the state of a process and so step "backwards" when you want to. If you wish you can keep a stack of process states and step backwards and forwards as you wish. If the problem is just this then I still don't see the problem. Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeffm@REDACTED Fri Feb 27 00:51:57 2009 From: jeffm@REDACTED (jm) Date: Fri, 27 Feb 2009 10:51:57 +1100 Subject: [erlang-questions] Is there a way to serialise a running process & resume it later (i.e. continuations) In-Reply-To: <3dbc6d1c0902261531m15d614c7s35ed44994f28ffef@mail.gmail.com> References: <1235605314.1994.8.camel@mp.virtual-earth.de> <3dbc6d1c0902261141u63ae45a0i405274789fdd12a5@mail.gmail.com> <1235686022.66228.22.camel@mp.virtual-earth.de> <3dbc6d1c0902261531m15d614c7s35ed44994f28ffef@mail.gmail.com> Message-ID: <49A72B1D.7050302@ghostgun.com> Robert Virding wrote: > > To support e.g. the back-button behaviour in browsers elegantly. > See the > diverse seaside docs for an example how such a web framework can be > used, and for a good explanation of why and what read "Inverting back > the inversion of control or, continuations versus page-centric > programming (2001)" > http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.29.3112 > > > Seeing the state of a process is kept explicitly in the arguments of > the functions implementing it it is easy to save the state of a > process and so step "backwards" when you want to. If you wish you can > keep a stack of process states and step backwards and forwards as you > wish. If the problem is just this then I still don't see the problem. > More explicitly, * stored an id as part of the URL call it UrlId * store contexts, {UrlId, Cxt}, as part of a list for an acceptable history range, say 10 histories per browser. ie, [{UrlId, Cxt}, ....] for an incoming request: extract the id, UrlId case proplist:lookup(UrlId, Contexts) of none -> %% return on error page error_page(no_context, ....); {UrlId, Cxt} -> %% Found state do work make_page(Cxt, ....) end. Something like that should do what you wish. I've glossed over the finer points. Jeff. From adrianob@REDACTED Fri Feb 27 01:06:17 2009 From: adrianob@REDACTED (Adriano Bonat) Date: Thu, 26 Feb 2009 21:06:17 -0300 Subject: [erlang-questions] Is there a way to serialise a running process & resume it later (i.e. continuations) In-Reply-To: <49A72B1D.7050302@ghostgun.com> References: <1235605314.1994.8.camel@mp.virtual-earth.de> <3dbc6d1c0902261141u63ae45a0i405274789fdd12a5@mail.gmail.com> <1235686022.66228.22.camel@mp.virtual-earth.de> <3dbc6d1c0902261531m15d614c7s35ed44994f28ffef@mail.gmail.com> <49A72B1D.7050302@ghostgun.com> Message-ID: <6bb4c8cb0902261606v2d521cabj724da3a2460a3313@mail.gmail.com> http://yarivsblog.com/articles/2008/02/17/seaside-style-programming-in-erlyweb/ My "two cents" :) On Thu, Feb 26, 2009 at 8:51 PM, jm wrote: > > > Robert Virding wrote: >> >> ? ? To support e.g. the back-button behaviour in browsers elegantly. >> ? ? See the >> ? ? diverse seaside docs for an example how such a web framework can be >> ? ? used, and for a good explanation of why and what read "Inverting back >> ? ? the inversion of control or, continuations versus page-centric >> ? ? programming (2001)" >> ? ? http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.29.3112 >> >> >> Seeing the state of a process is kept explicitly in the arguments of >> the functions implementing it it is easy to save the state of a >> process and so step "backwards" when you want to. If you wish you can >> keep a stack of process states and step backwards and forwards as you >> wish. If the problem is just this then I still don't see the problem. >> > > More explicitly, > > ?* stored an id as part of the URL call it UrlId > ?* store contexts, {UrlId, Cxt}, as part of a list for an acceptable > history range, say 10 histories per browser. > ? ? ie, [{UrlId, Cxt}, ....] > > ?for an incoming request: > ? ? extract the id, UrlId > ? ? case proplist:lookup(UrlId, Contexts) of > ? ? ? ? ?none -> > ? ? ? ? ? ? ?%% return on error page > ? ? ? ? ? ? ?error_page(no_context, ....); > ? ? ? ? {UrlId, Cxt} -> > ? ? ? ? ? ? ?%% Found state do work > ? ? ? ? ? ? ? make_page(Cxt, ....) > ? ? end. > > > Something like that should do what you wish. I've glossed over the finer > points. > > Jeff. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From raould@REDACTED Fri Feb 27 01:18:41 2009 From: raould@REDACTED (Raoul Duke) Date: Thu, 26 Feb 2009 16:18:41 -0800 Subject: [erlang-questions] Is there a way to serialise a running process & resume it later (i.e. continuations) In-Reply-To: <6bb4c8cb0902261606v2d521cabj724da3a2460a3313@mail.gmail.com> References: <1235605314.1994.8.camel@mp.virtual-earth.de> <3dbc6d1c0902261141u63ae45a0i405274789fdd12a5@mail.gmail.com> <1235686022.66228.22.camel@mp.virtual-earth.de> <3dbc6d1c0902261531m15d614c7s35ed44994f28ffef@mail.gmail.com> <49A72B1D.7050302@ghostgun.com> <6bb4c8cb0902261606v2d521cabj724da3a2460a3313@mail.gmail.com> Message-ID: <91a2ba3e0902261618r23cbef57pe339290be710cc2f@mail.gmail.com> > http://yarivsblog.com/articles/2008/02/17/seaside-style-programming-in-erlyweb/ hmmm. i don't think the word continuation means what that page seems to think it means? in that case one 'just' uses a hidden form field hack. if there were something about "close the browser and come back in 24 hrs and go directly to the last page" then maybe it would be more about continuations? sincerely. From jeffm@REDACTED Fri Feb 27 01:54:23 2009 From: jeffm@REDACTED (jm) Date: Fri, 27 Feb 2009 11:54:23 +1100 Subject: [erlang-questions] Is there a way to serialise a running process & resume it later (i.e. continuations) In-Reply-To: <91a2ba3e0902261618r23cbef57pe339290be710cc2f@mail.gmail.com> References: <1235605314.1994.8.camel@mp.virtual-earth.de> <3dbc6d1c0902261141u63ae45a0i405274789fdd12a5@mail.gmail.com> <1235686022.66228.22.camel@mp.virtual-earth.de> <3dbc6d1c0902261531m15d614c7s35ed44994f28ffef@mail.gmail.com> <49A72B1D.7050302@ghostgun.com> <6bb4c8cb0902261606v2d521cabj724da3a2460a3313@mail.gmail.com> <91a2ba3e0902261618r23cbef57pe339290be710cc2f@mail.gmail.com> Message-ID: <49A739BF.5050507@ghostgun.com> Alright. It seems that we (or at least I am) missing some of the requirements. Do you mind explicitly stating what continuations accomplish for you so we're all trying do the samething? This is directed at the original poster of the thread, but anyone should feel free to wade in. My thoughts were more implementation based, * identify browser by cookie * identify state by random identifier added to URL * post/get redirect trick to change url * for each cookie store about a dozen states * store this information in mnesia or another database * garbage collect unused states daily Now yariv did use a form hack, but so does seaside from memory so it can do the increment counters demo correctly, ie multiple counter in the same page added as modules. The trouble is Yariv was doing a quick hack do demo what was possible with his framework (erlyweb). rushed post as I rush out the door, Jeff. Raoul Duke wrote: >> http://yarivsblog.com/articles/2008/02/17/seaside-style-programming-in-erlyweb/ >> > > hmmm. i don't think the word continuation means what that page seems > to think it means? in that case one 'just' uses a hidden form field > hack. if there were something about "close the browser and come back > in 24 hrs and go directly to the last page" then maybe it would be > more about continuations? > > sincerely. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From raould@REDACTED Fri Feb 27 02:02:50 2009 From: raould@REDACTED (Raoul Duke) Date: Thu, 26 Feb 2009 17:02:50 -0800 Subject: [erlang-questions] Is there a way to serialise a running process & resume it later (i.e. continuations) In-Reply-To: <49A739BF.5050507@ghostgun.com> References: <1235605314.1994.8.camel@mp.virtual-earth.de> <3dbc6d1c0902261141u63ae45a0i405274789fdd12a5@mail.gmail.com> <1235686022.66228.22.camel@mp.virtual-earth.de> <3dbc6d1c0902261531m15d614c7s35ed44994f28ffef@mail.gmail.com> <49A72B1D.7050302@ghostgun.com> <6bb4c8cb0902261606v2d521cabj724da3a2460a3313@mail.gmail.com> <91a2ba3e0902261618r23cbef57pe339290be710cc2f@mail.gmail.com> <49A739BF.5050507@ghostgun.com> Message-ID: <91a2ba3e0902261702s7e776266ha8aa2a8607b5c63b@mail.gmail.com> > Now yariv did use a form hack, but so does seaside from memory so it can > do the increment counters demo correctly, ie multiple counter in the > same page added as modules. The trouble is Yariv was doing a quick hack > do demo what was possible with his framework (erlyweb). web continuations are stored server-side vs. a form hack with a hidden field most likely does not incur anything stored server-side. continuations let you come back later even though the client browser has forgotten everything, because the continuation is in the server. of course then you need some gcing of old continuations. (it is all pretty much diametrically opposite to the REST approach to things.) sincerely. From steven.charles.davis@REDACTED Fri Feb 27 03:50:43 2009 From: steven.charles.davis@REDACTED (Steve Davis) Date: Thu, 26 Feb 2009 18:50:43 -0800 (PST) Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <22234312.post@talk.nabble.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <22226430.post@talk.nabble.com> <9b08084c0902260808hf9903b1yb0aa072e7e503160@mail.gmail.com> <22230905.post@talk.nabble.com> <57400D87-A249-43E9-A640-66C87A255EFB@scaldeferri.com> <22233815.post@talk.nabble.com> <22234312.post@talk.nabble.com> Message-ID: On Feb 26, 3:40?pm, Zvi wrote: > > ...article "Erlang for Concurrent Programming" [1] there is a list of things > for which Erlang tends to be not good. > > [1]http://mags.acm.org/queue/200809/ Took a quick look at that link to "queue magazine", and they seemed to be scratching around a bit to find reasons to pad out their list... First was... " Concurrency more appropriate to synchronized parallel execution" I guess that sounds good. But I'd need to see an example of what the author actually means to understand and make any judgment as to whether it's actually true. "? Code requiring an aggressive compiler (Erlang entries in language benchmark shoot-outs are unimpressive ? except for process spawning and message passing) " Does he mean "serial performance" here. If so see below, as this is at the heart of most of the list items. "? Floating-point-intensive code" Most code (in any language) isn't particularly "performance sensitive" you gotta measure measure measure. Also, I think the author specifically means "serial/linear code performance"... ok, but in those rare bottlenecks (and they are rare) where beam/hipe are not enough, there's always (easy to make) C ports for your escape hatches. "? Code requiring nonportable instructions " Why would you want this? *REQUIRING* when does code (rather than managers/architects) *require* non-portability. Isn't non-portability just a inconvenient compiler design fact for certain platforms? The exception here could be embedded processors, so I guess that's where this came from. However, I don't often code for embedded processors (in fact, I never have and I'm unlikely to do so in the future). "? Projects to implement libraries that must run under other execution environments, such as JVM (Java Vir- tual Machine) or CLR (Common Language Runtime) " I've noticed that Java isn't too good on CLR/Mono or on BEAM, and that C# isn't so good on the JVM or BEAM. "? Projects that require the use of extensive libraries written in other languages " This isn't necessarily true. jinterface and ports are more than adequate for 90% of purposes. All in all, I find this list pretty unconvincing. /sd From ok@REDACTED Fri Feb 27 04:25:52 2009 From: ok@REDACTED (Richard O'Keefe) Date: Fri, 27 Feb 2009 16:25:52 +1300 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <22230905.post@talk.nabble.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <22226430.post@talk.nabble.com> <9b08084c0902260808hf9903b1yb0aa072e7e503160@mail.gmail.com> <22230905.post@talk.nabble.com> Message-ID: <97AEA3BB-BB0D-4B8F-9CF6-1B1EDD7BBA9A@cs.otago.ac.nz> On 27 Feb 2009, at 7:48 am, Zvi wrote: > Erlang: > print_hi(10). > > print_hi(0) -> ok; > print_hi(N) -> > io:format("hi~n"), > print_hi(N-1). Stick for(L, U, F) when L =< U -> F(L), for(L+1, U, F); for(_, _, _) -> ok. in your library. (If it's OK for Ruby to have times in a library, it's OK for Erlang.) Now do ... print_hi(1, 10, fun (I) -> io:format("hi~n") end) ... and it's a one-liner. Now that I have a for: module with an integer range for/3 and a list element for/2, it really is a one-liner for me. Erlang makes it easy to hide the hard parts! From sand@REDACTED Fri Feb 27 08:21:33 2009 From: sand@REDACTED (sand@REDACTED) Date: Thu, 26 Feb 2009 23:21:33 -0800 Subject: [erlang-questions] License Clarification about Dialyzer in OTP needed Message-ID: <18855.38013.735266.546961@priss.frightenedpiglet.com> Back when Dialyzer was being shipped as a separate application, it had the following in its README file: > ====================================================================== > | NOTE: The Dialyzer is distributed with its complete source and its | > | USE IS FREE FOR OPEN-SOURCE PROJECTS OR NON-COMMERCIAL USES. | > | | > | For use in commercial projects, AN EXPLICIT PERMISSION FROM | > | ITS AUTHORS AND COPYRIGHT OWNERS IS REQUIRED. | > ====================================================================== and its source files had no particular license. Now that Dialyzer is shipping with OTP, each of the source files has the Erlang Public License notice at the top, but the README still has the "explicit permission" requirement. Is the "explicit permission" requirement still in effect? If so, how does it relate to the EPL license notice on each source file? (The sources don't mention any exception to the EPL.) If the requirement isn't in effect any more, can it be removed from the README, to remove the ambiguity? Thanks, Derek -- Derek Upham sand@REDACTED From kenneth.lundin@REDACTED Fri Feb 27 09:27:27 2009 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Fri, 27 Feb 2009 09:27:27 +0100 Subject: [erlang-questions] License Clarification about Dialyzer in OTP needed In-Reply-To: <18855.38013.735266.546961@priss.frightenedpiglet.com> References: <18855.38013.735266.546961@priss.frightenedpiglet.com> Message-ID: This is an oversight The text in this readme file should be changed to the EPL text or maybe the whole file will be removed. Will be addressed in the next release. /Kenneth, Erlang/OTP Ericsson On Fri, Feb 27, 2009 at 8:21 AM, wrote: > Back when Dialyzer was being shipped as a separate application, it had > the following in its README file: > >> ====================================================================== >> | NOTE: The Dialyzer is distributed with its complete source and its | >> | ? ? ? USE IS FREE FOR OPEN-SOURCE PROJECTS OR NON-COMMERCIAL USES. | >> | ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| >> | ? ? ? For use in commercial projects, AN EXPLICIT PERMISSION FROM ?| >> | ? ? ? ITS AUTHORS AND COPYRIGHT OWNERS IS REQUIRED. ? ? ? ? ? ? ? ?| >> ====================================================================== > > and its source files had no particular license. ?Now that Dialyzer is > shipping with OTP, each of the source files has the Erlang Public > License notice at the top, but the README still has the "explicit > permission" requirement. > > Is the "explicit permission" requirement still in effect? ?If so, how > does it relate to the EPL license notice on each source file? ?(The > sources don't mention any exception to the EPL.) ?If the requirement > isn't in effect any more, can it be removed from the README, to remove > the ambiguity? > > Thanks, > > Derek > > -- > Derek Upham > sand@REDACTED > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From vychodil.hynek@REDACTED Fri Feb 27 09:27:45 2009 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Fri, 27 Feb 2009 09:27:45 +0100 Subject: [erlang-questions] Is there a way to serialise a running process & resume it later (i.e. continuations) In-Reply-To: <91a2ba3e0902261702s7e776266ha8aa2a8607b5c63b@mail.gmail.com> References: <1235605314.1994.8.camel@mp.virtual-earth.de> <3dbc6d1c0902261141u63ae45a0i405274789fdd12a5@mail.gmail.com> <1235686022.66228.22.camel@mp.virtual-earth.de> <3dbc6d1c0902261531m15d614c7s35ed44994f28ffef@mail.gmail.com> <49A72B1D.7050302@ghostgun.com> <6bb4c8cb0902261606v2d521cabj724da3a2460a3313@mail.gmail.com> <91a2ba3e0902261618r23cbef57pe339290be710cc2f@mail.gmail.com> <49A739BF.5050507@ghostgun.com> <91a2ba3e0902261702s7e776266ha8aa2a8607b5c63b@mail.gmail.com> Message-ID: <4d08db370902270027o62c84a11i7ce1e71f0e7f48fe@mail.gmail.com> On Fri, Feb 27, 2009 at 2:02 AM, Raoul Duke wrote: > > Now yariv did use a form hack, but so does seaside from memory so it can > > do the increment counters demo correctly, ie multiple counter in the > > same page added as modules. The trouble is Yariv was doing a quick hack > > do demo what was possible with his framework (erlyweb). > > > web continuations are stored server-side vs. a form hack with a hidden > field most likely does not incur anything stored server-side. > > continuations let you come back later even though the client browser > has forgotten everything, because the continuation is in the server. > of course then you need some gcing of old continuations. (it is all > pretty much diametrically opposite to the REST approach to things.) > > +1 > > sincerely. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try Good Data now for free: www.gooddata.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From Mathias.Picker@REDACTED Fri Feb 27 12:26:35 2009 From: Mathias.Picker@REDACTED (Mathias Picker) Date: Fri, 27 Feb 2009 12:26:35 +0100 Subject: [erlang-questions] Is there a way to serialise a running process & resume it later (i.e. continuations) In-Reply-To: <6bb4c8cb0902261606v2d521cabj724da3a2460a3313@mail.gmail.com> References: <1235605314.1994.8.camel@mp.virtual-earth.de> <3dbc6d1c0902261141u63ae45a0i405274789fdd12a5@mail.gmail.com> <1235686022.66228.22.camel@mp.virtual-earth.de> <3dbc6d1c0902261531m15d614c7s35ed44994f28ffef@mail.gmail.com> <49A72B1D.7050302@ghostgun.com> <6bb4c8cb0902261606v2d521cabj724da3a2460a3313@mail.gmail.com> Message-ID: <1235733995.2263.51.camel@mp.virtual-earth.de> Am Donnerstag, den 26.02.2009, 21:06 -0300 schrieb Adriano Bonat: > http://yarivsblog.com/articles/2008/02/17/seaside-style-programming-in-erlyweb/ Would be nice if it were that easy. Going back a few pages breaks yaris solution. > > My "two cents" :) > > On Thu, Feb 26, 2009 at 8:51 PM, jm wrote: > > > > > > Robert Virding wrote: > >> > >> To support e.g. the back-button behaviour in browsers elegantly. > >> See the > >> diverse seaside docs for an example how such a web framework can be > >> used, and for a good explanation of why and what read "Inverting back > >> the inversion of control or, continuations versus page-centric > >> programming (2001)" > >> http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.29.3112 > >> > >> > >> Seeing the state of a process is kept explicitly in the arguments of > >> the functions implementing it it is easy to save the state of a > >> process and so step "backwards" when you want to. If you wish you can > >> keep a stack of process states and step backwards and forwards as you > >> wish. If the problem is just this then I still don't see the problem. > >> > > > > More explicitly, > > > > * stored an id as part of the URL call it UrlId > > * store contexts, {UrlId, Cxt}, as part of a list for an acceptable > > history range, say 10 histories per browser. > > ie, [{UrlId, Cxt}, ....] > > > > for an incoming request: > > extract the id, UrlId > > case proplist:lookup(UrlId, Contexts) of > > none -> > > %% return on error page > > error_page(no_context, ....); > > {UrlId, Cxt} -> > > %% Found state do work > > make_page(Cxt, ....) > > end. > > > > > > Something like that should do what you wish. I've glossed over the finer > > points. > > > > Jeff. > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From exta7@REDACTED Fri Feb 27 12:44:09 2009 From: exta7@REDACTED (Zvi) Date: Fri, 27 Feb 2009 03:44:09 -0800 (PST) Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <49A71F16.3080205@erlang-consulting.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <22226430.post@talk.nabble.com> <9b08084c0902260808hf9903b1yb0aa072e7e503160@mail.gmail.com> <22230905.post@talk.nabble.com> <49A71F16.3080205@erlang-consulting.com> Message-ID: <22244249.post@talk.nabble.com> Ulf Wiger-3 wrote: > > The point, if there was one, of plain_fsm, was rather > that the Erlang language has expressive power that you > partially have to give up in order to reap the benefits > of behaviours. > exactly my point. If there is single OTP-like programming model as a first-class citizen - you don't need to give up anything. Simple is better. Shorter is better. Ulf Wiger-3 wrote: > > OTP is Erlang-based middleware - how could there not be? > I would not call OTP middleware, even if according to Wikipedia [1], you can call it that way. Erlang/OTP is "marketed" as a single platform, the same way as Java or .NET platform. It's not like, for example, CORBA which is not part of any particular language or platform. If somebody can call RMI in Java or Remoting in .NET - middleware, then I'll call OTP too. Ulf Wiger-3 wrote: > > I gather you think reia is great, but for the rest of us, please > expand on how reia solves the plain_fsm problem better > (not having studied reia, I really have no idea.) > I do not think, that Reia is better than Erlang or vice versa. Some design decisions in Reia are better, some worse. For example, no single assignment is bad. I would rather have ADTs as first-class citizens, instead of classes. Anyway Reia *is* based on Erlang. Ulf Wiger-3 wrote: > > please expand on how reia solves the plain_fsm problem better > (not having studied reia, I really have no idea.) > Reia do not solve FSM per-say. But it provides more consistent programming model. Each Reia object is gen_server, adding FSM state should be trivial. Not directly related: why Erlang processes have no builtin FSM. It would be logical, since original problem domain was Complex Soft Realtime Control Systems. And process anyway have system state (i.e. created, suspended, died, etc.) Ulf Wiger-3 wrote: > > is simply an apples and oranges comparison. You know > very well (since you love Erlang) that the convention > is to hide gen_server specifics behind a module API, > so the honest comparison would be > > MyMod:MyFun(Args) > > vs > > MyClass.MyMethod(Args) > > > I fail to see how one is very low level, and the > other is not. > First, I see open source code, that do not hide gen_server specifics behind a module API. Look at disco project, for example. This is bad software engineering , but I think the reason behind this is: unneccesary boilerplate needed for gen_server API definitions. To be fair in your comparison, you need to write: -module(my_mod). ... -export([my_fun/2]). ... my_fun(Pid, Args) -> gen_server:call(Pid, {my_fun, Args}). ... % user code my_mod:my_fun(Pid, Args) vs MyObj.MyMethod(Args) my mistake, maybe it's not low level, but too much clutter/boilerplate for sure. Ulf Wiger-3 wrote: > > Congratulations on getting paid to do this, > Just to clarify: I'm not getting paid to bash Erlang. Sorry if somewhat misunderstood it that way. I was getting paid to be a devil's advocate in the design and implementation stage of other products (not related to Erlang whatsoever) - think brainstrorming (as someone told me - "so what I say stupid things - it's allowed in brainstroming" :) Actually I think it will be a great accomplishment for Erlang, if there will be paid Erlang bashers, funded by Microsoft or Sun :) Ulf Wiger-3 wrote: > > but apart, from that, what do you hope to accomplish? > I was just responding to the Steve's original message, who unconditionaly loves Erlang, that's all. I'm a little bit critical on everything :) For my little problem of doing everything from the shell. I guess maybe, it's possible to write some generic Y-combinator. There was some suggestion on the list before - need to find it. To summarize: since I'm nowhere as smart or capable as Erlang/OTP creators, and I'm unable to create something better. I have no other choice, than contunue to use it. I'll monitor Reia progress and maybe will use it for prototyping and embedded scripting for Erlang. [1] http://en.wikipedia.org/wiki/Middleware -- View this message in context: http://www.nabble.com/The-Beauty-of-Erlang-Syntax-tp22179816p22244249.html Sent from the Erlang Questions mailing list archive at Nabble.com. From erlang@REDACTED Fri Feb 27 12:55:01 2009 From: erlang@REDACTED (Joe Armstrong) Date: Fri, 27 Feb 2009 12:55:01 +0100 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <20090226222656.GA22018@delora.autosys.us> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <22226430.post@talk.nabble.com> <9b08084c0902260808hf9903b1yb0aa072e7e503160@mail.gmail.com> <22230905.post@talk.nabble.com> <57400D87-A249-43E9-A640-66C87A255EFB@scaldeferri.com> <22233815.post@talk.nabble.com> <9b08084c0902261343r58d501ebycc3a9b702977c198@mail.gmail.com> <20090226222656.GA22018@delora.autosys.us> Message-ID: <9b08084c0902270355h592351ev30eed27c84dcb564@mail.gmail.com> On Thu, Feb 26, 2009 at 11:26 PM, Michael McDaniel wrote: > On Thu, Feb 26, 2009 at 10:43:57PM +0100, Joe Armstrong wrote: >> for(Max,Max,F) -> ?F(Max); >> for(I,N,F) -> F(I),for(I+1,Max,F). >> >> for(1,10, fun(I) -> io:format("...." end) >> >> The code is *shorter than the documentation" >> >> writing the code is quicker than finding the documentation and reading it - this >> is true in most programming languages which is why programmers write >> code. >> >> This happens all the time I wanted hex2int after 20 seconds in google I gave up >> and wrote it myself - this is also true for javascript C, ... as Wirth once said >> It is better to know one langauge very well that to know many languages >> incompletely.. >> >> Hint: read books and type in the examples. for/3 is in my book :-) >> don't rely on the web for information - (example Douglas Crockford's >> Good Parts of JavaScript - I learnt more in half an hour reading this > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > > ?... and which new *Haskell* book captured you ? > > Real world Haskell - or course - " a cracking good read" I highly recommend it. Reading it made me realise how similar Haskell and Erlang are under the surface, once we absract away from minor details like type systems, evaluation strategies and concurrency. The basic problem of writing Haskell is the same as writing Erlang - ie getting the data to the right part of the program, which means a deal of hokie pokie in both languages. /Joe Armstrong > > ?I enjoyed and learned from your > ? ?http://pragprog.com/titles/jaerlang/programming-erlang > ?and recently (pre) purchased > ? ?http://www.manning.com/logan/ > > ~Michael > > > > >> than dozens of >> hours reading appallingly bad articles on the web) >> >> >> /Joe Armstrong >> >> >> On Thu, Feb 26, 2009 at 10:12 PM, Zvi wrote: >> > >> > >> > >> > Kevin Scaldeferri wrote: >> >> >> >> If you want to have only one way of doing anything, perhaps you should >> >> try Python. ?I hear that's one of their design principles. >> >> >> > >> > Kevin, >> > I playing a devil advocate here (actualy some company paid me to be a >> > devil's advocate :) >> > I can adopt to any syntax and semantics. I already use Erlang and love it. I >> > just think of it as a low-level language, kinda parallel and distributed >> > COBOL :) There are some simple things that hard to do in Erlang. That's the >> > reason, why project like Disco uses combination of Erlang+Python and Fuzed - >> > Erlang+Ruby. >> > >> > >> > Kevin Scaldeferri wrote: >> >> >> >> Anyway, the point is, if times() is something you do a lot, just write >> >> it and get on with your life. ?If it matters to you a lot, make an >> >> argument for why it's generally important and submit a patch to the >> >> standard libraries. >> >> >> > Obviously you didn't read the list of things hard in Erlang, simple in other >> > langs. Repeat N times, is just a simplest example. In Jim Larson's >> > >> > Times, just a case of "for" loop. >> > I working on generic collections library for Erlang, where will be ranges. >> > Someting like: >> > >> > R = gc_range:new(1,10). >> > gc:foreach(fun(_)->io:format("hi~n") end, R). >> > >> > Zvi >> > >> > >> > >> > -- >> > View this message in context: http://www.nabble.com/The-Beauty-of-Erlang-Syntax-tp22179816p22233815.html >> > Sent from the Erlang Questions mailing list archive at Nabble.com. >> > >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://www.erlang.org/mailman/listinfo/erlang-questions >> > >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > -- > Michael McDaniel > Portland, Oregon, USA > http://trip.autosys.us > http://mmcdaniel.com/erlview > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From nm@REDACTED Thu Feb 26 21:53:09 2009 From: nm@REDACTED (Gaspar Chilingarov) Date: Fri, 27 Feb 2009 00:53:09 +0400 Subject: [erlang-questions] [SEEKING JOB] in Canada or EU :) Message-ID: <49A70135.5080700@web.am> Dear friends! I'm looking now erlang programming/consulting job in Canada or EU. My resume can be found at http://gasparchilingarov.com/wp-content/uploads/2007/11/gasparchilingarov_cv.pdf The key-points are * erlang programming :) * agile practices * have some banking software experience, but prefer networking programming * DB experience - (Mnesia and RDBMS - MySQL/MS SQL) * extensive unix experience - FreeBSD/Linux, some Solaris * willing to relocate So, I'm looking forward to join some interesting programmers group :) With best regards, Gaspar PS. Well, I know it's a little bit off topic for this list, but it's meaningless to seek erlang jobs on the Internet in other places ;) -- Gaspar Chilingarov tel +37493 419763 (mobile - leave voice mail message) icq 63174784 skype://gasparch e mailto:nm@REDACTED mailto:gasparch@REDACTED w http://gasparchilingarov.com/ From ulf.wiger@REDACTED Fri Feb 27 15:33:55 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Fri, 27 Feb 2009 14:33:55 +0000 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <22244249.post@talk.nabble.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <22226430.post@talk.nabble.com> <9b08084c0902260808hf9903b1yb0aa072e7e503160@mail.gmail.com> <22230905.post@talk.nabble.com> <49A71F16.3080205@erlang-consulting.com> <22244249.post@talk.nabble.com> Message-ID: <49A7F9D3.8020706@erlang-consulting.com> Zvi wrote: > > Ulf Wiger-3 wrote: >> The point, if there was one, of plain_fsm, was rather that the >> Erlang language has expressive power that you partially have to >> give up in order to reap the benefits of behaviours. >> > exactly my point. If there is single OTP-like programming model as a > first-class citizen - you don't need to give up anything. So as I understand it, reia makes a similar simplification to gen_server (sans some of the boilerplate, perhaps), but semantically, it will be limited in for complex fsm programming the same way gen_server and gen_fsm are limited, which was exactly the reason plain_fsm. Erlang gives you some goodness while forcing you to add other things yourself. OTP automates some of that, but also limits your freedom (which can sometimes be just the right thing, and sometimes disastrous). > Simple is better. Shorter is better. For multiway FSMs, it's not the boilerplate that's the issue, it's the semantics. Gen_fsm and gen_server (and by extension, I would then assume, also reia) offer the wrong semantics. Gen_server is a great abstraction, but for some things, it's the *wrong* abstraction. Plain_fsm gives you a different kind of abstraction, and different tradeoffs. > > Ulf Wiger-3 wrote: >> please expand on how reia solves the plain_fsm problem better (not >> having studied reia, I really have no idea.) >> > Reia do not solve FSM per-say. But it provides more consistent > programming model. Each Reia object is gen_server, adding FSM state > should be trivial. ...in the same way as gen_fsm is a trivial extension of gen_server. The core semantics (since you brought up plain_fsm) is still FIFO run-to-completion message processing, which works well for many problems, but hurts like a SOB for others, as I illustrated in http://www.erlang.se/euc/05/1500Wiger.ppt > Not directly related: why Erlang processes have no > builtin FSM. They do. The textbook way of writing state machines is to let the function name signify the state: idle(S) -> receive off_hook -> lim:start_tone(dial_tone), get_first_digit(S); ... end. This was the original intent. The problem with building libraries on top was that selective receive is not easily parameterized. > Actually I think it will be a great accomplishment > for Erlang, if there will be paid Erlang bashers, funded by > Microsoft or Sun :) In the sense of "there are only two kinds of programming languages: the ones that everyone bitches about, and the ones that noone uses"? (Stoustrup, from memory) BR, Ulf W -- Ulf Wiger CTO, Erlang Training & Consulting Ltd http://www.erlang-consulting.com From ulf.wiger@REDACTED Fri Feb 27 16:31:23 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Fri, 27 Feb 2009 15:31:23 +0000 (GMT) Subject: [erlang-questions] list_to_pid() surprise In-Reply-To: <4815380.37741235748632141.JavaMail.root@zimbra> Message-ID: <10560629.37791235748683015.JavaMail.root@zimbra> I'm not sure whether to report this as a bug (perhaps there's a good reason for it...?) Erlang (BEAM) emulator version 5.6.5 [source] [async-threads:0] [hipe] [kernel-poll:false] ... 11> pid_to_list(hd(v(6))). "<8288.15785.86>" 12> list_to_pid(pid_to_list(hd(v(6)))). ** exception error: bad argument in function list_to_pid/1 called as list_to_pid("<8288.15785.86>") If this is intentional, can someone explain why? BR, Ulf W -- Ulf Wiger CTO, Erlang Training & Consulting Ltd. http://www.erlang-consulting.com From masse@REDACTED Fri Feb 27 17:56:34 2009 From: masse@REDACTED (mats cronqvist) Date: Fri, 27 Feb 2009 17:56:34 +0100 Subject: [erlang-questions] list_to_pid() surprise In-Reply-To: <10560629.37791235748683015.JavaMail.root@zimbra> (Ulf Wiger's message of "Fri\, 27 Feb 2009 15\:31\:23 +0000 \(GMT\)") References: <4815380.37741235748632141.JavaMail.root@zimbra> <10560629.37791235748683015.JavaMail.root@zimbra> Message-ID: <87fxhzizst.fsf@sterlett.hq.kred> Ulf Wiger writes: > I'm not sure whether to report this as a bug (perhaps there's > a good reason for it...?) > > Erlang (BEAM) emulator version 5.6.5 [source] [async-threads:0] [hipe] [kernel-poll:false] > ... > 11> pid_to_list(hd(v(6))). > "<8288.15785.86>" > 12> list_to_pid(pid_to_list(hd(v(6)))). > ** exception error: bad argument > in function list_to_pid/1 > called as list_to_pid("<8288.15785.86>") > > If this is intentional, can someone explain why? you can't do list_to_pid on an external pid (i.e. one that does not start with a 0.) I don't know why; perhaps the mapping from (node name) -> (first element of pid) is tricky to do backwards? mats From daveb@REDACTED Fri Feb 27 18:08:13 2009 From: daveb@REDACTED (Dave Bryson) Date: Fri, 27 Feb 2009 11:08:13 -0600 Subject: [erlang-questions] Supervisor and port applications Message-ID: <989C89AC-97B9-4195-98A6-1EF61D7882E8@miceda.org> I have some "agents" that are written in Ruby and I'd like to take advantage of an Erlang Supervisor to manage them. Is it feasible/ recommended to use a Supervisor to manage a Port based application? Thanks, Dave From anders@REDACTED Fri Feb 27 16:58:32 2009 From: anders@REDACTED (Anders Dahlin) Date: Fri, 27 Feb 2009 16:58:32 +0100 Subject: [erlang-questions] list_to_pid() surprise In-Reply-To: <10560629.37791235748683015.JavaMail.root@zimbra> References: <10560629.37791235748683015.JavaMail.root@zimbra> Message-ID: <49A80DA8.1020801@dahlinenergy.se> You are running a non-distributed node. The pid looks like it belongs to a distributed node. Seems like only known/real "pid prefixes" are allowed. (test@REDACTED)23> rpc:call(P, erlang, whereis, [global_name_server]). <6440.11.0> (test@REDACTED)24> list_to_pid(pid_to_list(v(-1))). <6440.11.0> (test@REDACTED)25> list_to_pid("<42.11.0>"). ** exception error: bad argument in function list_to_pid/1 called as list_to_pid("<42.11.0>") (test@REDACTED)26> list_to_pid("<6440.42.0>"). <6440.42.0> /A Ulf Wiger wrote: > I'm not sure whether to report this as a bug (perhaps there's > a good reason for it...?) > > Erlang (BEAM) emulator version 5.6.5 [source] [async-threads:0] [hipe] [kernel-poll:false] > ... > 11> pid_to_list(hd(v(6))). > "<8288.15785.86>" > 12> list_to_pid(pid_to_list(hd(v(6)))). > ** exception error: bad argument > in function list_to_pid/1 > called as list_to_pid("<8288.15785.86>") > > If this is intentional, can someone explain why? > > BR, > Ulf W From stondage123@REDACTED Fri Feb 27 18:26:17 2009 From: stondage123@REDACTED (Andrew Stone) Date: Fri, 27 Feb 2009 09:26:17 -0800 (PST) Subject: [erlang-questions] Supervisor and port applications References: <989C89AC-97B9-4195-98A6-1EF61D7882E8@miceda.org> Message-ID: <431519.99305.qm@web35906.mail.mud.yahoo.com> Yes. I do it all the time. Just make sure you trap the exit from the port. The port is not linked to its controlling process so you need to trap the exit and restart the port itself or just make your supervised controlling process exit when it receives the port 'EXIT' signal. -Andrew ----- Original Message ---- From: Dave Bryson To: erlang-questions@REDACTED Sent: Friday, February 27, 2009 12:08:13 PM Subject: [erlang-questions] Supervisor and port applications I have some "agents" that are written in Ruby and I'd like to take advantage of an Erlang Supervisor to manage them. Is it feasible/ recommended to use a Supervisor to manage a Port based application? Thanks, Dave _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From refsdal.ivar@REDACTED Fri Feb 27 23:28:54 2009 From: refsdal.ivar@REDACTED (Ivar Refsdal) Date: Fri, 27 Feb 2009 23:28:54 +0100 Subject: [erlang-questions] Is there a way to serialise a running process & resume it later (i.e. continuations) In-Reply-To: <1235733995.2263.51.camel@mp.virtual-earth.de> References: <1235605314.1994.8.camel@mp.virtual-earth.de> <3dbc6d1c0902261141u63ae45a0i405274789fdd12a5@mail.gmail.com> <1235686022.66228.22.camel@mp.virtual-earth.de> <3dbc6d1c0902261531m15d614c7s35ed44994f28ffef@mail.gmail.com> <49A72B1D.7050302@ghostgun.com> <6bb4c8cb0902261606v2d521cabj724da3a2460a3313@mail.gmail.com> <1235733995.2263.51.camel@mp.virtual-earth.de> Message-ID: <49A86926.9020905@gmail.com> Correct me if I'm wrong, but take a look at this simple example: dbl_outer(X) -> Y = 1234, %% impossible(?) to save variables from other outer scope, etc outer(X), io:format("dbl_outer exit...~n"). outer(X) -> spawn( fun() -> receive after 1000 -> io:format("inner timeout.. X=~p~n", [X]) end end), io:format("outer exit...~n"). My 'assumption' is that you can use funs to save local/nearest scope state for continuation usage, but not outer, stack and so on. Is this a reasonable assumption or totally wrong? Weblocks is another web framework written in Lisp using continuations for those interested. Best Ivar Mathias Picker wrote: > Am Donnerstag, den 26.02.2009, 21:06 -0300 schrieb Adriano Bonat: > >> http://yarivsblog.com/articles/2008/02/17/seaside-style-programming-in-erlyweb/ >> > > Would be nice if it were that easy. Going back a few pages breaks yaris > solution. > > >> My "two cents" :) >> >> On Thu, Feb 26, 2009 at 8:51 PM, jm wrote: >> >>> Robert Virding wrote: >>> >>>> To support e.g. the back-button behaviour in browsers elegantly. >>>> See the >>>> diverse seaside docs for an example how such a web framework can be >>>> used, and for a good explanation of why and what read "Inverting back >>>> the inversion of control or, continuations versus page-centric >>>> programming (2001)" >>>> http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.29.3112 >>>> >>>> >>>> Seeing the state of a process is kept explicitly in the arguments of >>>> the functions implementing it it is easy to save the state of a >>>> process and so step "backwards" when you want to. If you wish you can >>>> keep a stack of process states and step backwards and forwards as you >>>> wish. If the problem is just this then I still don't see the problem. >>>> >>>> >>> More explicitly, >>> >>> * stored an id as part of the URL call it UrlId >>> * store contexts, {UrlId, Cxt}, as part of a list for an acceptable >>> history range, say 10 histories per browser. >>> ie, [{UrlId, Cxt}, ....] >>> >>> for an incoming request: >>> extract the id, UrlId >>> case proplist:lookup(UrlId, Contexts) of >>> none -> >>> %% return on error page >>> error_page(no_context, ....); >>> {UrlId, Cxt} -> >>> %% Found state do work >>> make_page(Cxt, ....) >>> end. >>> >>> >>> Something like that should do what you wish. I've glossed over the finer >>> points. >>> >>> Jeff. >>> _______________________________________________ >>> 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 rvirding@REDACTED Fri Feb 27 23:29:52 2009 From: rvirding@REDACTED (Robert Virding) Date: Fri, 27 Feb 2009 23:29:52 +0100 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <22244249.post@talk.nabble.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <22226430.post@talk.nabble.com> <9b08084c0902260808hf9903b1yb0aa072e7e503160@mail.gmail.com> <22230905.post@talk.nabble.com> <49A71F16.3080205@erlang-consulting.com> <22244249.post@talk.nabble.com> Message-ID: <3dbc6d1c0902271429ycdb2592j61080396060eb49c@mail.gmail.com> 2009/2/27 Zvi > > > Reia do not solve FSM per-say. But it provides more consistent programming > model. Each Reia object is gen_server, adding FSM state should be trivial. > Not directly related: why Erlang processes have no builtin FSM. It would be > logical, since original problem domain was Complex Soft Realtime Control > Systems. And process anyway have system state (i.e. created, suspended, > died, etc.) Originally Erlang was more of a DSL (though we didn't know the term then) and tuned to doing the FSM parts of the problem. We soon found, however, that to be able to build these systems Erlang had to be a general purpose programming language. We then decided that generally we would try to provide the the basic tools for building an app and not packaged solutions. Hence FSM's are not built in but it is generally easy to build them. Same for process communication and error handling. Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlangy@REDACTED Sat Feb 28 00:45:52 2009 From: erlangy@REDACTED (Michael McDaniel) Date: Fri, 27 Feb 2009 15:45:52 -0800 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <9b08084c0902270355h592351ev30eed27c84dcb564@mail.gmail.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <22226430.post@talk.nabble.com> <9b08084c0902260808hf9903b1yb0aa072e7e503160@mail.gmail.com> <22230905.post@talk.nabble.com> <57400D87-A249-43E9-A640-66C87A255EFB@scaldeferri.com> <22233815.post@talk.nabble.com> <9b08084c0902261343r58d501ebycc3a9b702977c198@mail.gmail.com> <20090226222656.GA22018@delora.autosys.us> <9b08084c0902270355h592351ev30eed27c84dcb564@mail.gmail.com> Message-ID: <20090227234552.GY22018@delora.autosys.us> On Fri, Feb 27, 2009 at 12:55:01PM +0100, Joe Armstrong wrote: > On Thu, Feb 26, 2009 at 11:26 PM, Michael McDaniel wrote: > > On Thu, Feb 26, 2009 at 10:43:57PM +0100, Joe Armstrong wrote: > >> for(Max,Max,F) -> ?F(Max); > >> for(I,N,F) -> F(I),for(I+1,Max,F). > >> > >> for(1,10, fun(I) -> io:format("...." end) > >> > >> The code is *shorter than the documentation" > >> > >> writing the code is quicker than finding the documentation and reading it - this > >> is true in most programming languages which is why programmers write > >> code. > >> > >> This happens all the time I wanted hex2int after 20 seconds in google I gave up > >> and wrote it myself - this is also true for javascript C, ... as Wirth once said > >> It is better to know one langauge very well that to know many languages > >> incompletely.. > >> > >> Hint: read books and type in the examples. for/3 is in my book :-) > >> don't rely on the web for information - (example Douglas Crockford's > >> Good Parts of JavaScript - I learnt more in half an hour reading this > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > > > > > ?... and which new *Haskell* book captured you ? > > > > > > Real world Haskell - or course - " a cracking good read" I highly recommend it. > > Reading it made me realise how similar Haskell and Erlang are under > the surface, once we absract away from minor details like type > systems, evaluation strategies and concurrency. > > The basic problem of writing Haskell is the same as writing Erlang - ie > getting the data to the right part of the program, which means a deal of > hokie pokie in both languages. > > /Joe Armstrong ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ thank you ~M > > > > > > > ?I enjoyed and learned from your > > ? ?http://pragprog.com/titles/jaerlang/programming-erlang > > ?and recently (pre) purchased > > ? ?http://www.manning.com/logan/ > > > > ~Michael > > > > > > > > > >> than dozens of > >> hours reading appallingly bad articles on the web) > >> > >> > >> /Joe Armstrong > >> > >> > >> On Thu, Feb 26, 2009 at 10:12 PM, Zvi wrote: > >> > > >> > > >> > > >> > Kevin Scaldeferri wrote: > >> >> > >> >> If you want to have only one way of doing anything, perhaps you should > >> >> try Python. ?I hear that's one of their design principles. > >> >> > >> > > >> > Kevin, > >> > I playing a devil advocate here (actualy some company paid me to be a > >> > devil's advocate :) > >> > I can adopt to any syntax and semantics. I already use Erlang and love it. I > >> > just think of it as a low-level language, kinda parallel and distributed > >> > COBOL :) There are some simple things that hard to do in Erlang. That's the > >> > reason, why project like Disco uses combination of Erlang+Python and Fuzed - > >> > Erlang+Ruby. > >> > > >> > > >> > Kevin Scaldeferri wrote: > >> >> > >> >> Anyway, the point is, if times() is something you do a lot, just write > >> >> it and get on with your life. ?If it matters to you a lot, make an > >> >> argument for why it's generally important and submit a patch to the > >> >> standard libraries. > >> >> > >> > Obviously you didn't read the list of things hard in Erlang, simple in other > >> > langs. Repeat N times, is just a simplest example. In Jim Larson's > >> > > >> > Times, just a case of "for" loop. > >> > I working on generic collections library for Erlang, where will be ranges. > >> > Someting like: > >> > > >> > R = gc_range:new(1,10). > >> > gc:foreach(fun(_)->io:format("hi~n") end, R). > >> > > >> > Zvi > >> > > >> > > >> > > >> > -- > >> > View this message in context: http://www.nabble.com/The-Beauty-of-Erlang-Syntax-tp22179816p22233815.html > >> > Sent from the Erlang Questions mailing list archive at Nabble.com. > >> > > >> > _______________________________________________ > >> > erlang-questions mailing list > >> > erlang-questions@REDACTED > >> > http://www.erlang.org/mailman/listinfo/erlang-questions > >> > > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://www.erlang.org/mailman/listinfo/erlang-questions > > > > -- > > Michael McDaniel > > Portland, Oregon, USA > > http://trip.autosys.us > > http://mmcdaniel.com/erlview > > _______________________________________________ > > 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 toby@REDACTED Sat Feb 28 01:00:01 2009 From: toby@REDACTED (Toby Thain) Date: Fri, 27 Feb 2009 19:00:01 -0500 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com> <115617.75351.qm@web65508.mail.ac4.yahoo.com> Message-ID: On 24-Feb-09, at 10:27 PM, Michael Richter wrote: > I would like to ask a multi-part, but rhetorical, question of the > list: > > Why do you think people stay away from functional programming > languages in droves? > Is it because they're too stupid to understand them? > Is it because of an evil cabal of IT Illuminati who are trying to > squelch the true freedom of the programming masses? > Is it because the functional languages available do not seem to > meet their needs, whatever those may be? > Is it because the fans of functional languages often come across as > religious fanatics preaching the One True Way of programming? > Is it some combination of the above? > > My own answer to the question is a #5 with a strong skew toward the > higher numbers. > > #1 (the one that's becoming uncomfortably common in this thread, > albeit with muted wording) is a little too arrogant for my tastes. It's also a straw man of sorts. There are less arrogant yet plausible variations on this, such as ? many people are too busy, unmotivated, or not interested in exploring outside the mainstream or a comfort zone. Reaching for the lazy default is what made {Microsoft, } rich. You can also call it a failure of education. > There are an awful lot of awfully smart people who not only use but > make imperative languages out there. I'm not willing to casually > dismiss them as too stupid to understand the One True Way of the > Lambda. Again, you're putting the "too stupid" words into others' mouths. Perhaps "not exposed to" is more accurate. The imperative model is seductive enough, and entrenched enough, that you can go through education and a long career never needing or noticing anything else. In the end you can lead a horse to water, but some horses just prefer Coke, even if fruit juice is ultimately healthier. > There is something they see in the various stateful, imperative > models that seems useful to them. Sure it's useful. In a perfect world people would compare and contrast all relevant paradigms. They don't. Not necessarily because they're "stupid", or because some advocate of language X was too "arrogant". > Are you really so smart as to be able to casually dismiss them? If > so, may I please read your Ph.D. thesis for the stunning insights > into computing and humanity that it undoubtedly contains? > ... > Keep in mind, too, that this man is lionized by a lot of the people > in comp.lang.lisp. Is it really Microsoft and Sun's marketing that > makes C# and Java popular? Or is it the behaviour of the other > communities that drives away potential converts? Non-mainstream communities are often accused of toxicity or arrogance. (Having participated in dozens) I don't buy it. The Erlang community, as evidenced on this list, is smart, helpful and welcoming. There is very little funny business here. Which communities did you specifically have in mind?? --Toby > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From toby@REDACTED Sat Feb 28 01:28:00 2009 From: toby@REDACTED (Toby Thain) Date: Fri, 27 Feb 2009 19:28:00 -0500 Subject: [erlang-questions] erlang flagship product In-Reply-To: <672672.39511.qm@web65516.mail.ac4.yahoo.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com> <87ocwrpyiv.fsf@sterlett.hq.kred> <4d08db370902240925u52d6f17cledb5416813c0fdc3@mail.gmail.com> <769685.50188.qm@web65512.mail.ac4.yahoo.com> <291863.53837.qm@web111416.mail.gq1.yahoo.com> <672672.39511.qm@web65516.mail.ac4.yahoo.com> Message-ID: On 25-Feb-09, at 7:24 AM, Richard Andrews wrote: > >> That said, I wouldn't mind other solid examples either. There are, >> of course, >> successful projects and companies, but not as easy to reference. >> If you just >> want a well-known, respected product/project to point at, how >> about ejabberd? > > Good example. > It's medium size. Solid. Reasonably well known in software circles. > One sign of Erlang's maturity and success is that a lot (most?) people deploy ejabberd without even knowing Erlang or its runtime is under the hood. "It just works." --Toby > IMO to get more people into FP we need to show its applicability to > small to medium sized projects (like ejabberd). Most projects start > off with modest ambitions. > > More examples? > > > Stay connected to the people that matter most with a smarter > inbox. Take a look http://au.docs.yahoo.com/mail/smarterinbox > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From toby@REDACTED Sat Feb 28 01:40:04 2009 From: toby@REDACTED (Toby Thain) Date: Fri, 27 Feb 2009 19:40:04 -0500 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <4A5A2D1D9C204DD78982FC14DFDBAF53@SSI.CORP> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com><44ed5e0f0902240838h4707e91cnee4dce59485cbafe@mail.gmail.com><0DC92C8F-53EF-4452-AAC6-C9C5D8C023E4@scaldeferri.com><115617.75351.qm@web65508.mail.ac4.yahoo.com><359869.86259.qm@web65502.mail.ac4.yahoo.com><1235542132.30881.20.camel@isolde><9b08084c0902250156o615015bfwfa29c4c3f81f20e9@mail.gmail.com><1235557322.30881.53.camel@isolde><1F178CF0-E640-4A7F-B48D-4C17027818FD@cs.otago.ac.nz> <1235623761.6805.15.camel@isolde> <4A5A2D1D9C204DD78982FC14DFDBAF53@SSI.CORP> Message-ID: <20AB9CE9-3BB0-44F2-9F89-A42BF0F9ABD1@telegraphics.com.au> On 26-Feb-09, at 9:17 AM, David Mercer wrote: > On Wednesday, February 25, 2009 10:49 PM, Michael T. Richter wrote: > > > > I submit that even at the time of C++ garbage collection algorithms > were more than suited to the task. It was the old guard of > programmers switching over to C++ from C that were the hurdle, not > the technology. > > I admit to being part of that old guard. My view in the early > ?90?s was that Lisp was the best language for development, so > prototype in Lisp, and then convert to C for production. (My > sister had an alternative view which I accepted, which was to only > convert the parts that were slow, and keep most of it in Lisp. She > had the luxury of working for an employer that permitted that > approach.) > > > > But anyway, I never really understood people?s problems with memory > management; if you malloc memory, you need to be sure you > understand the lifecycle of that memory and identify where it was > to be freed. I just didn?t understand how people could mess that > up. It made debugging code easier, too, since half the time I > could find the problem by finding the malloc and figuring out where > it went from there and where it wasn?t getting freed (or > prematurely freed). > You answered your own question. Eliminating explicit malloc/free eliminates that class of error. Just as Erlang/FP paradigmatically eliminates whole other classes of error (such as mistakes in using explicit locks). > > > Then when Java came along, it really proved my point about garbage > collecting being slow, because Java was much slower than C or C++. > Why blame gc alone? Java was interpreted (then)... It may be that the overhead of VM and gc was also a factor in the failure of Smalltalk-80 to conquer the world. Of course, 95 times out of 100 performance just doesn't matter as much as the programmer thinks ? that's one thing that has not changed ? while maintainability almost always matters. --Toby > I steadfastly refused to learn Java, and luckily I was in a role > where I could do that. The irony here, though, is, as Richard > alluded to, I was a big fan of Awk and (later) Perl, because I > didn?t expect them to be efficient. I wanted them to be easy to > whip something up,... > > David > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From toby@REDACTED Sat Feb 28 01:41:46 2009 From: toby@REDACTED (Toby Thain) Date: Fri, 27 Feb 2009 19:41:46 -0500 Subject: [erlang-questions] The Beauty of Erlang Syntax In-Reply-To: <22226430.post@talk.nabble.com> References: <3e6f9520-f8cd-48f2-8ebf-1729538d1842@e24g2000vbe.googlegroups.com> <22226430.post@talk.nabble.com> Message-ID: <345F9B6C-D540-4488-B575-3B2E2F06EFE5@telegraphics.com.au> On 26-Feb-09, at 10:25 AM, Zvi wrote: > > Steve, > you definitely at drinking kool aid stage. > ... > Another big problem with Erlang, that, while it makes > implementation of hard > things easy, the easy things are sometimes hard to implement in > Erlang. The same is true of SQL. But maybe those of us who grew up coding imperative just have different preconceptions of 'easy' and 'hard' tasks :) --Toby > > Zvi > > > > > -- > View this message in context: http://www.nabble.com/The-Beauty-of- > Erlang-Syntax-tp22179816p22226430.html > Sent from the Erlang Questions mailing list archive at Nabble.com. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From chsu79@REDACTED Sat Feb 28 01:50:29 2009 From: chsu79@REDACTED (Christian) Date: Sat, 28 Feb 2009 01:50:29 +0100 Subject: [erlang-questions] emock: create mock gen_servers and gen_fsms Message-ID: I started a little project tonight to create a quick mock of gen behaviors (yeah, code is 4 hours old now). http://github.com/noss/emock %% Simple stateless mock echo_server(call, X) -> {reply, X}. %% Using the mock to create a gen_server example() -> Server = emock:gen_server(fun echo_server/2), foo =:= gen_server:call(Server, foo). As you see it is much shorter to create a mock like this than to create a full-blown gen_server module for a test. I have code to support mocks with state as well. Ironically, being a testing tool, I have not tested it properly yet. It can be used in eunit like this: echo_server_test_() -> {setup, fun () -> emock:gen_server(fun echo_server/2) end, fun(Server) -> exit(Server, normal) end, fun(Server) -> [ ?_assertEqual(42, gen_server:call(Server, 42)), ?_assertEqual(foo, gen_server:call(Server, foo)) ] end}. I think emock can be a useful tool to let tests depend on instead of the actual undocumented gen protocols. It is just 100 lines of code, but it is nice to not have to redo this for each project. Maybe it could become a part of eunit if it proves itself useful. http://noss.github.com/2009/02/27/quick-and-useful-mocking-of-otp-gen-behaviors.html From pfisher@REDACTED Sat Feb 28 04:00:23 2009 From: pfisher@REDACTED (Paul Fisher) Date: Fri, 27 Feb 2009 21:00:23 -0600 Subject: [erlang-questions] [erlang-patches] [PATCH] 64-bit solaris builds Message-ID: <49A8A8C7.9090103@alertlogic.net> Bjorn Gustavsson wrote: > On Fri, Aug 29, 2008 at 12:59 AM, Paul Fisher > wrote: > > This patch allows 64-bit builds when the target system supports both > 32-bit and 64-bit in the same system environment. Specifically, this > works on Solaris 10/Opensolaris, and adjusts the --enable-darwin-64-bit > configure flag to be simply --enable-64bit so that it can be used for > the same purpose on both darwin and solaris (building 64-bit target > environment) without having to introduce another system specific > configure flag. > > > We will address this issue in a future release (not R12B-5) by making > sure that CFLAGS will be properly propagated > by all Makefiles. I was just checking out the 13A-0 snapshot, and this failure is still present. Will this (please) make it into the first drop of R13? $ CC='gcc' LD='gcc' CFLAGS='-m64 -O2' LDFLAGS='-m64' LIBS='-lmtmalloc' ./configure --enable-threads --enable-smp-support --enable-kernel-poll --enable-hipe --disable-megaco-flex-scanner-drvlineno --without-unixodbc ... $ make ... make[4]: Entering directory `/export/home/pfisher/bld/otp_src_R13A-0/lib/asn1/c_src' ld -G -L/export/home/pfisher/bld/otp_src_R13A-0/lib/erl_interface/obj/i386-pc-solaris2.11 -o /export/home/pfisher/bld/otp_src_R13A-0/lib/asn1/priv/lib/i386-pc-solaris2.11/asn1_erl_drv.so /export/home/pfisher/bld/otp_src_R13A-0/lib/asn1/priv/obj/i386-pc-solaris2.11/asn1_erl_drv.o -lei -lc -ldl -lm -lmtmalloc -lsocket -lnsl ld: skipping incompatible /export/home/pfisher/bld/otp_src_R13A-0/lib/erl_interface/obj/i386-pc-solaris2.11/libei.a when searching for -lei ld: cannot find -lei -- paul From romain.lenglet@REDACTED Sat Feb 28 08:06:25 2009 From: romain.lenglet@REDACTED (Romain Lenglet) Date: Sat, 28 Feb 2009 16:06:25 +0900 Subject: [erlang-questions] Erlunch in Stockholm on March 16th? Message-ID: <200902281606.25764.romain.lenglet@berabera.info> Hej! I will be on a trip to Stockholm, from Tokyo, from March 16th to March 19th. I am free for lunch on Monday, March 16th. So if you too are free for lunch in Stockholm, drop me a mail, and I will be happy to meet you! Alternatively, I am also free for dinner on evenings during that week. I'm eager to use my recent Swedish speaking powers, like "Jag har inte p? n?gra rockar!" (yeah, I still can't discuss many topics... ;)) -- Romain Lenglet From ulf.wiger@REDACTED Sat Feb 28 09:22:02 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Sat, 28 Feb 2009 08:22:02 +0000 Subject: [erlang-questions] list_to_pid() surprise Message-ID: I'd be more inclined to believe that it was tricky if it weren't for the fact that the pid object obviously already exists in this case. (: Well, it was only a minor inconvenience. BR, Ulf W -- originalmedd. -- ?mne: Re: list_to_pid() surprise Fr?n: mats cronqvist Datum: 2009.02.27 16.55 Ulf Wiger writes: > I'm not sure whether to report this as a bug (perhaps there's > a good reason for it...?) > > Erlang (BEAM) emulator version 5.6.5 [source] [async-threads:0] [hipe] [kernel-poll:false] > ... > 11> pid_to_list(hd(v(6))). > "<8288.15785.86>" > 12> list_to_pid(pid_to_list(hd(v(6)))). > ** exception error: bad argument > in function list_to_pid/1 > called as list_to_pid("<8288.15785.86>") > > If this is intentional, can someone explain why? you can't do list_to_pid on an external pid (i.e. one that does not start with a 0.) I don't know why; perhaps the mapping from (node name) -> (first element of pid) is tricky to do backwards? mats From ulf.wiger@REDACTED Sat Feb 28 09:57:31 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Sat, 28 Feb 2009 08:57:31 +0000 Subject: [erlang-questions] The Beauty of Erlang Syntax Message-ID: Joe Armstrong wrote: > This happens all the time I wanted hex2int > after 20 seconds in google I gave up > and wrote it myself FFR, erlang:list_to_integer(HexStr, 16). ;-) BR, Ulf W From per@REDACTED Sat Feb 28 12:58:25 2009 From: per@REDACTED (Per Hedeland) Date: Sat, 28 Feb 2009 12:58:25 +0100 (CET) Subject: [erlang-questions] writing a delay loop without now() In-Reply-To: <84fb38e30902231442w166941eap9e62137d92decf6b@mail.gmail.com> Message-ID: <200902281158.n1SBwPLc067580@pluto.hedeland.org> tsuraan wrote: > >My results, on Linux 2.6.28 (vanilla) and a core2 duo at 3GHz: > >Erlang (BEAM) emulator version 5.6.1 [source] [smp:2] >[async-threads:0] [hipe] [kernel-poll:false] > >Eshell V5.6.1 (abort with ^G) >1> c(test). >{ok,test} >2> erlang:statistics(wall_clock),test:time(5000000),erlang:statistics(wall_clock). >{24784,3960} Mighty strange - with Linux, the exact same Erlang runtime, and actually exact same HW too, I still get perfect results: 2> erlang:statistics(wall_clock),test:time(5000000),erlang:statistics(wall_clock). {93876,5000} The kernel is different though ("2.6.20-1.2320.fc5smp"), probably glibc too, but I have a hard time believing that either of those is the cause. I don't suppose that you run some primitive time-keeping app that keeps whacking the system time around? (The above system runs NTP.) What number do you get with the loop-counting version I posted earlier (time2/1 reposted below)? I get numbers like 4559687, which is uncomfortably close to 1 call per microsecond but still just below - I think it would have to be some 25% faster on your system to produce the above result. I guess it's possible even if unlikely... If you do get just about 5000000 (it can never be more), maybe you could try the "twiddle" version (time3/1 below) too? --Per 4> erlang:statistics(wall_clock),{test:time2(5000000),erlang:statistics(wall_clock)}. {{4559687,5000000},{204001,5001}} time2(N) -> time2(N, now(), 0). time2(N, Start, C) -> case timer:now_diff(now(), Start) of M when M >= N -> {C, M}; _ -> time2(N, Start, C+1) end. time3(N) -> time3(N, now(), 0, [0]). time3(N, Start, C, X) -> case timer:now_diff(now(), Start) of M when M >= N -> {C, M}; _ -> time3(N, Start, C+1, twiddle(X)) end. twiddle(X) -> [hd(X)|[Y*Y || Y <- lists:duplicate(5, 12345678901234567890123456789)]]. From masse@REDACTED Sat Feb 28 12:30:06 2009 From: masse@REDACTED (mats cronqvist) Date: Sat, 28 Feb 2009 12:30:06 +0100 Subject: [erlang-questions] list_to_pid() surprise In-Reply-To: (Ulf Wiger's message of "Sat\, 28 Feb 2009 08\:22\:02 +0000") References: Message-ID: <87vdqu3ikh.fsf@dixie.cronqvi.st> "Ulf Wiger" writes: > I'd be more inclined to believe that it was tricky if it weren't for > the fact that the pid object obviously already exists in this > case. (: judging from the eshell prompt, your node was started without distribution, in which case the pid object couldn't possibly refer to a real node. you must've gotten it from a file or the clipboard. or am i missing something? mats From ulf.wiger@REDACTED Sat Feb 28 14:26:41 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Sat, 28 Feb 2009 13:26:41 +0000 Subject: [erlang-questions] list_to_pid() surprise In-Reply-To: <87vdqu3ikh.fsf@dixie.cronqvi.st> References: <87vdqu3ikh.fsf@dixie.cronqvi.st> Message-ID: <49A93B91.6010103@erlang-consulting.com> mats cronqvist wrote: > "Ulf Wiger" writes: > >> I'd be more inclined to believe that it was tricky if it weren't for >> the fact that the pid object obviously already exists in this >> case. (: > > judging from the eshell prompt, your node was started without > distribution, in which case the pid object couldn't possibly refer > to a real node. you must've gotten it from a file or the clipboard. > > or am i missing something? That's true, I got it from a file. The part your (perhaps) missing is that I had already "allocated" the pid. If creating the pid in the first place were the problem, I'd have expected the initial binary_to_term() on the data read from the file to fail, but it didn't. So binary_to_term(term_to_binary(Pid)) works, but not list_to_pid(pid_to_list(Pid)). The main difference that I can imagine matters here is that list_to_pid/1 is not meant to be used much. BR, Ulf W -- Ulf Wiger CTO, Erlang Training & Consulting Ltd http://www.erlang-consulting.com From ulf.wiger@REDACTED Sat Feb 28 17:20:40 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Sat, 28 Feb 2009 16:20:40 +0000 Subject: [erlang-questions] list_to_pid() surprise Message-ID: <0rVcgbKBKSMr.ZTgJWGNn@zimbra.erlangsystems.com> Per Hedeland wrote: > The main difference is that the binary has the > node name instead of the number. > I guess it isn't possible to fake up even a semi-valid pid > without the node name I'd agree, if the node index part of the pid hadn't already been mapped to a node name. But that's not the case here, unless pids created from binary_to_term() are represented in a different way from other pids. I might check the sources myself, by I don't have them on my mobile... Anyway, like I said before, this wasn't a major problem. Perhaps we've spent enough energy on it now. (: BR, Ulf W From per@REDACTED Sat Feb 28 16:55:41 2009 From: per@REDACTED (Per Hedeland) Date: Sat, 28 Feb 2009 16:55:41 +0100 (CET) Subject: [erlang-questions] list_to_pid() surprise In-Reply-To: <49A93B91.6010103@erlang-consulting.com> Message-ID: <200902281555.n1SFtfur072761@pluto.hedeland.org> Ulf Wiger wrote: > >If creating the pid in the first place were the problem, >I'd have expected the initial binary_to_term() on the >data read from the file to fail, but it didn't. > >So binary_to_term(term_to_binary(Pid)) works, but not >list_to_pid(pid_to_list(Pid)). > >The main difference that I can imagine matters here is >that list_to_pid/1 is not meant to be used much. The main difference is that the binary has the node name instead of the number. I guess it isn't possible to fake up even a semi-valid pid without the node name - for one thing, you wouldn't be able to do term_to_binary() on it... --Per Hedeland