From joe@REDACTED Mon Mar 1 00:58:29 2010 From: joe@REDACTED (Joe Williams) Date: Sun, 28 Feb 2010 15:58:29 -0800 Subject: [erlang-questions] dns server In-Reply-To: <4B88DF87.5000208@joetify.com> References: <4B88DF87.5000208@joetify.com> Message-ID: <4B8B0325.7070101@joetify.com> Anyone have any suggestions? Bueller? -Joe On 2/27/10 1:01 AM, Joe Williams wrote: > > Anyone know of a decent OSS DNS server implementation in Erlang? I > found http://code.google.com/p/erldir/ and > http://eddie.sourceforge.net/ but they are both out of date and no > longer maintained it seems. > > Thanks for any suggestions. > > -Joe > -- Name: Joseph A. Williams Email: joe@REDACTED Blog: http://www.joeandmotorboat.com/ From cyberlync@REDACTED Mon Mar 1 01:11:44 2010 From: cyberlync@REDACTED (Eric Merritt) Date: Sun, 28 Feb 2010 18:11:44 -0600 Subject: Dialyzers dependency on wx seems to be broken Message-ID: Hello All, The version of dialyzer released with R13B04 has a direct application dependency on wx. This seems to broken as wx is not a startable application. I suspect that this should be specified as a library application so that it is not required to be started for dialyzer to start. Eric From kostis@REDACTED Mon Mar 1 08:18:59 2010 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 01 Mar 2010 09:18:59 +0200 Subject: [erlang-questions] Dialyzers dependency on wx seems to be broken In-Reply-To: References: Message-ID: <4B8B6A63.3010600@cs.ntua.gr> Eric Merritt wrote: > Hello All, > > The version of dialyzer released with R13B04 has a direct application > dependency on wx. This seems to broken as wx is not a startable > application. I suspect that this should be specified as a library > application so that it is not required to be started for dialyzer to > start. Hi Eric, I admit I have trouble understanding your message. In its default mode, dialyzer does not require the presence of 'wx'. It only requires it if you start dialyzer using: dialyzer --gui --wx Can it be that you are you referring to the following line in file dialyzer.app? {applications, [compiler, gs, hipe, kernel, stdlib, wx]}, I am not an expert on .app files and how they should be structured, but I see the dependency to 'wx' there analogous to that of 'hipe', 'kernel', 'stdlib' etc. which also do not have a start() function. Anyway, feel free to suggest a concrete change and we'll adopt it. Kostis From kostis@REDACTED Mon Mar 1 08:19:39 2010 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 01 Mar 2010 09:19:39 +0200 Subject: [erlang-questions] Dialyzers dependency on wx seems to be broken In-Reply-To: References: Message-ID: <4B8B6A8B.5010509@cs.ntua.gr> Eric Merritt wrote: > Hello All, > > The version of dialyzer released with R13B04 has a direct application > dependency on wx. This seems to broken as wx is not a startable > application. I suspect that this should be specified as a library > application so that it is not required to be started for dialyzer to > start. Hi Eric, I admit I have trouble understanding your message. In its default mode, dialyzer does not require the presence of 'wx'. It only requires it if you start dialyzer using: dialyzer --gui --wx Can it be that you are you referring to the following line in file dialyzer.app? {applications, [compiler, gs, hipe, kernel, stdlib, wx]}, I am not an expert on .app files and how they should be structured, but I see the dependency to 'wx' there analogous to that of 'hipe', 'kernel', 'stdlib' etc. which also do not have a start() function. Anyway, feel free to suggest a concrete change and we'll adopt it. Kostis From jacob.vorreuter@REDACTED Mon Mar 1 10:09:17 2010 From: jacob.vorreuter@REDACTED (Jacob Vorreuter) Date: Mon, 1 Mar 2010 01:09:17 -0800 Subject: EPM - an Erlang package manager Message-ID: I've recently been working on a RubyGems-style package manager for Erlang and would like to hear people's thoughts/criticisms. There's nothing to install. You simply download the EPM escript. It uses GitHub as its package repository. This is meant mainly for development purposes and does not deal with packaging or deploying OTP releases. You can read my post about it here: http://jkvor.com/erlang-package-manager The executable is available here: http://github.com/JacobVorreuter/epm I'd be interested to hear suggestions of how to make this a more useful tool. Thanks, Jake From johanmon@REDACTED Mon Mar 1 10:14:33 2010 From: johanmon@REDACTED (Johan Montelius) Date: Mon, 01 Mar 2010 10:14:33 +0100 Subject: Why should sending somtimes fail Message-ID: One thing that I do like in the operational semantics of Erlang is that sending a message will not raise an exception even if the receiver is no longer alive. It is also very convenient to send directly to a registered process by using the atom. However, sending to an atom will now raise an exception if there is no process registered under that name. Sending to an remote registered process does however not raise an exception. Could it not be a good idea to skip the exception even if there is no process currently registered under the name. In doing so one would have the same operational semantics for all four cases: local pid, remote pid, local registered, remote registered. Johan -- Dr Johan Montelius Royal Institute of Technology - KTH School of Information and Communication Technology - ICT From max.lapshin@REDACTED Mon Mar 1 10:30:32 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Mon, 1 Mar 2010 12:30:32 +0300 Subject: [erlang-questions] EPM - an Erlang package manager In-Reply-To: References: Message-ID: Have you looked at homebrew? I like this idea very much: github repo is a storage of all possible custom scripts. You shouldn't ask anybody to adopt your packaging system, just write proper scripts for several packages you need and than just approve patches from github forks. From mail@REDACTED Mon Mar 1 11:18:39 2010 From: mail@REDACTED (Tim Fletcher) Date: Mon, 1 Mar 2010 02:18:39 -0800 (PST) Subject: What atom name to represent a null value In-Reply-To: <9b08084c1002280443k7bffebn6047ee735b66e0e7@mail.gmail.com> References: <6a9ba5691002251613m23fc1060t201aa59634e980f8@mail.gmail.com> <1267143285.3672.18.camel@isengaard> <6a9ba5691002251620u560186b7xaad1447356daa1a9@mail.gmail.com> <8C7ED794-A531-4D4D-BC73-9E61F6E963D4@souja.net> <6a9ba5691002251633p6a12de87uf8a973d87afa7590@mail.gmail.com> <6096767b-4085-4214-85e9-e47226452766@19g2000yqu.googlegroups.com> <9b08084c1002271148l401dc999n1ad8a26cc0942154@mail.gmail.com> <770E7304-16C6-4978-9CC3-9E0210C0A761@masklinn.net> <9b08084c1002280443k7bffebn6047ee735b66e0e7@mail.gmail.com> Message-ID: Joe Armstrong wrote: > The best way to express this in Erlang is as follows: > > foo(1) -> 2; > foo(2) -> 3; > foo(3) -> 1; > foo(X) -> exit({ebadArgToFoo, X}). Surely "best" or "correct" depends on the context? On reflection it isn't a very good example, because as you point out you'd usually want a function that returns integers to only return integers. I don't think that invalidates the idea though. Joe Armstrong wrote: > Error handling in Erlang is supposed to be "not defensive" > you should only write code for the expected cases. Sure, so if being undefined is an expected case then it isn't being defensive to return the atom 'undefined', regardless of the type of the function? Robert Virding wrote: > If, on the other hand, this is not an error but just the default case > where you can return something sensible then adding the extra clause > makes sense. > > As an example of the difference: dict:find/2 returns (the atom) > 'error' if a key is found, while dict:fetch/2 throws an error if the > key is not found as it is defined to assume the key does exist. Yep, this is a better example. I don't think 'error' is the best atom to use as it might not necessarily be an error for the key not to exist. Again, it depends on the context. Tim From rtrlists@REDACTED Mon Mar 1 11:19:04 2010 From: rtrlists@REDACTED (Robert Raschke) Date: Mon, 1 Mar 2010 10:19:04 +0000 Subject: [erlang-questions] long sender side delays when sending to an external node In-Reply-To: <29630.1267222829@snookles.snookles.com> References: <6a3ae47e1002260354x20558e9ds4cc5ba98aa129711@mail.gmail.com> <29630.1267222829@snookles.snookles.com> Message-ID: <6a3ae47e1003010219t660d758ax6f17dc6fb19386c@mail.gmail.com> Hi Scott, On Fri, Feb 26, 2010 at 10:20 PM, Scott Lystig Fritchie < fritchie@REDACTED> wrote: > Robert Raschke wrote: > > rr> I have a situation where {mbox, other_node} ! {self(), ok} is taking > rr> a very long time (8-12 seconds!). That is, the sender is actually > rr> blocked in the ! for that time. > > Robby, have you seen my post to the list earlier this month about > 'busy_dist_port' system events? If the Erlang port representing the TCP > port used for inter-node communication becomes "busy", then a process > (any process) attempting to send a message through that port will be > unscheduled by the scheduler and won't be rescheduled until the busy > port is itself unblocked. > > That's one way it could happen, at least. There may be others. > > Yup, I printed it off immediately. Thing is, in the case I'm seeing, there's really just the pids and ok getting sent per message (with one second sleeps in between). And unless the VM underneath my feet is sending/receiving lots of stuff I don't know about, then I can't really see how the busy_dist_port behaviour can kick in. But I'll try and have a deeper look, you never know. I am currently trying to set myself up with an epmd using restricted ports, so I can use wireshark to see where the traffic is actually going. Since this is in the field, don't hold your breath. My hunch is that a low-level socket send is blocking due to OS or security interference. I also had a bunch of "patches" take out my app in a different location, with a similar issue, but unfortunately not exactly the same (a second machine was implicated as well). Removing the patches solved the problem. Figuring out what and why is really rather hard. Robby From ulf.wiger@REDACTED Mon Mar 1 11:33:07 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Mon, 01 Mar 2010 11:33:07 +0100 Subject: [erlang-questions] Why should sending somtimes fail In-Reply-To: References: Message-ID: <4B8B97E3.2050504@erlang-solutions.com> Back in the late Cretaceous Period, when dinosaurs like the mighty AXD 301 roamed the earth, this change was actually attempted, for the very reason you suggest. It was rolled back, in part because it hadn't been property communicated (even within the OTP team), but also because changing this could cause code to hang indefinitely rather than crashing in certain circumstances. I recall the discussion well. While it was argued that it was fundamentally a race condition anyway, and the badarg if the process wasn't registered was just one of many possibilities - the receiving process could be alive when the message arrived but die before handling it, etc., the counter-argument was that the change made things much worse for some pretty common error cases. The clincher was that supervisor:which_children/1 was implemented using gen_server:call(..., infinity), and it could hang forever with the new semantics. Given that this behaviour was manifest even in core OTP code, it was agreed that something else was needed before this sort of change could possibly be attempted. That something else was monitors. Back then, Erlang had only 2-way links, which also had the unfortunate characteristic that calling link/1 several times would still result in only one link, but calling unlink/1 even once would remove it. This made it very difficult to use for temporary monitoring of an inter-process dialogue, as you had to introduce some reference-counting wrapper around link/unlink to be safe. One of the touted advantages of letting send crash on unregistered name was that it provided a fast error detection for at least the most common cases, rather than having to always fall back on a long timeout*. Monitors offer the same advantage, while being stackable and one- way, which is exactly what you want in this case. It would seem as if it might be possible to have another stab at this change, but this time, it would need to be done with an EEP and a very careful study of the worst- case consequences and perhaps some tutorial that describes how to find code that needs to be rewritten, and how to fix it. * The unfortunate consequence would then be that the timeout would have to be long enough not to give false positives, and short enough not to give ridiculously long error detection time if the server side had crashed. BR, Ulf W Johan Montelius wrote: > > One thing that I do like in the operational semantics of Erlang is that > sending a message will not raise an exception even if the receiver is no > longer alive. It is also very convenient to send directly to a > registered process by using the atom. However, sending to an atom will > now raise an exception if there is no process registered under that > name. Sending to an remote registered process does however not raise an > exception. > > Could it not be a good idea to skip the exception even if there is no > process currently registered under the name. In doing so one would have > the same operational semantics for all four cases: local pid, remote > pid, local registered, remote registered. > > Johan > -- Ulf Wiger CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd http://www.erlang-solutions.com --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From ulf.wiger@REDACTED Mon Mar 1 11:40:24 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Mon, 01 Mar 2010 11:40:24 +0100 Subject: [erlang-questions] long sender side delays when sending to an external node In-Reply-To: <29630.1267222829@snookles.snookles.com> References: <29630.1267222829@snookles.snookles.com> Message-ID: <4B8B9998.2010903@erlang-solutions.com> Scott Lystig Fritchie wrote: > > Robby, have you seen my post to the list earlier this month about > 'busy_dist_port' system events? If the Erlang port representing the TCP > port used for inter-node communication becomes "busy", then a process > (any process) attempting to send a message through that port will be > unscheduled by the scheduler and won't be rescheduled until the busy > port is itself unblocked. > > That's one way it could happen, at least. There may be others. One thing that stuck in my mind from reading the "high-performance tcp/ip stack"[1] paper from 2005, was that while the Linux TCP stack was considerably more performant, it did a lousy job of servicing the different connections fairly: "A similar test was done with Linux, but opening only 500 connections. Linux showed no reduction in throughput with those connections, but a few connections used all the available bandwidth while the others did nothing. The Erlang stack loses throughput but each of the connections gets the same share of the bandwidth. The different schedulers used probably explain this behaviour:" (pg 59) [1] http://portal.acm.org/citation.cfm?id=1088372 I wonder if it is still true, and if it might have something to do with this? BR, Ulf W -- Ulf Wiger CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd http://www.erlang-solutions.com --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From johanmon@REDACTED Mon Mar 1 12:26:07 2010 From: johanmon@REDACTED (Johan Montelius) Date: Mon, 01 Mar 2010 12:26:07 +0100 Subject: [erlang-questions] Why should sending sometimes fail In-Reply-To: <4B8B97E3.2050504@erlang-solutions.com> References: <4B8B97E3.2050504@erlang-solutions.com> Message-ID: I guessed that the question had been raised before. I understand that changing things now would make many programs suspend waiting for a reply that will never come. We can have it in mind for Erlang2 though. The monitors I do like (as opposed to link/1 that also has this "optimization" of throwing exceptions). One thing I would like to see however is that a monitor could produce two different messages depending on if the death is certain or not. A {'DOWN', Ref, process, Pid, noconnection} is not really the same as the other messages. The process could be alive and you could even receive messages from it if there was a temporary network problem. To make this more visible one could (I know not now but in Erlang2) be given a message of its own: {'SUSPECTED', Ref, process, Pid, noconnection} When building replicated servers there is a big difference between knowing and suspecting. Johan -- Dr Johan Montelius Royal Institute of Technology - KTH School of Information and Communication Technology - ICT From kostis@REDACTED Mon Mar 1 13:34:14 2010 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 01 Mar 2010 14:34:14 +0200 Subject: [erlang-questions] Dialyzers dependency on wx seems to be broken In-Reply-To: References: <4B8B6A8B.5010509@cs.ntua.gr> Message-ID: <4B8BB446.3090208@cs.ntua.gr> Samuel Rivas wrote: >> Can it be that you are you referring to the following line in file >> dialyzer.app? >> >> {applications, [compiler, gs, hipe, kernel, stdlib, wx]}, > > I think the problem is that stating wx as dependency forces the > release tools to add wx to any release that contain dialyzer. wx > application doesn't have an ebin/wx.app file, so it is not a proper > application to the eyes of systools and cannot be packaged. > > If that's the case, the solution may be as simple as writing the > wx/ebin/wx.app file so that wx can be packaged in releases. From a quick inspection, I see that wx is the only library in Erlang/OTP containing Erlang code that does not have a correspondng .app file. Since this application as analogous to gs and there is a gs.app file, I think wx should also have one. Kostis From dmercer@REDACTED Mon Mar 1 16:08:19 2010 From: dmercer@REDACTED (David Mercer) Date: Mon, 1 Mar 2010 09:08:19 -0600 Subject: [erlang-questions] Re: What atom name to represent a null value In-Reply-To: <770E7304-16C6-4978-9CC3-9E0210C0A761@masklinn.net> References: <6a9ba5691002251613m23fc1060t201aa59634e980f8@mail.gmail.com> <1267143285.3672.18.camel@isengaard> <6a9ba5691002251620u560186b7xaad1447356daa1a9@mail.gmail.com> <8C7ED794-A531-4D4D-BC73-9E61F6E963D4@souja.net> <6a9ba5691002251633p6a12de87uf8a973d87afa7590@mail.gmail.com> <6096767b-4085-4214-85e9-e47226452766@19g2000yqu.googlegroups.com> <9b08084c1002271148l401dc999n1ad8a26cc0942154@mail.gmail.com> <770E7304-16C6-4978-9CC3-9E0210C0A761@masklinn.net> Message-ID: On Saturday, February 27, 2010, Masklinn wrote: > Actually, it corresponds to the very simple Haskell type > (Integer -> Maybe Integer). There's nothing crazy about it if it's what > is needed by the application I have translated the Haskell "Maybe" to Erlang as: -type maybe(T) :: {just, T} | nothing. Just FYI. I'm not disagreeing with anyone here. Just providing color. Monads and the monadic "do" were also implemented, with the help of a well-placed parse transform. I posted my code to this list, I think. If I didn't and in case someone wants it, I'll dig it up if you like. Not sure how useful it would be though, unless you're doing direct translation of Haskell to Erlang... Didn't get much use after I wrote it. Cheers, David From bile@REDACTED Mon Mar 1 16:54:20 2010 From: bile@REDACTED (bile@REDACTED) Date: Mon, 1 Mar 2010 09:54:20 -0600 Subject: [erlang-patches] spawn to rpc, filter, etc. In-Reply-To: <6672d0161003010620q1fa4c80awc08dc2ce3e0e6824@mail.gmail.com> References: <20100221051303.66bb8b72@landofbile.com> <6672d0161002250002x292abe4doe202fba914f412ce@mail.gmail.com> <20100228011626.347d0a85@otis> <6672d0161002280644m19387427ud50db6820fc036f1@mail.gmail.com> <20100228102118.033a597a@otis> <6672d0161003010620q1fa4c80awc08dc2ce3e0e6824@mail.gmail.com> Message-ID: Bj?rn Gustavsson wrote: > I consider this feature "nice to have". It does not provide enough > additional security so that you would dare to connect to untrusted > nodes, so the ability to filter messages can only be a convenience > feature, not a game changing feature. (As far as I can understand. > You have not mentioned any specific applications that would have > a need for the feature.) Currently there is nearly zero security outside of the cookie. There are cases where native connected nodes are desired without opening up the entire system. Trust is not binary. Just because I can ssh to a box doesn't mean I can execute anything on the machine. My team is currently rewriting an application in Erlang and we must have certain levels of lock down. There are always tradeoffs for security but Erlang in its current form forces tradeoffs that aren't necessary. I see several easy and minor changes to the Erlang system that would go a long way to providing a more secure environment and I'm trying to get them out there so others can take advantage of them. > > Therefore, being only a "nice to have" feature that changes > sensitive code paths, the following are the minimum requirements: > > * It should be 100% backwards compatible. I was under the understanding that different releases shouldn't necessarily be used together. It's a rather large jump in security between nodes relative to what exists and I'd think it's a reasonable tradeoff. As I mentioned in the previous email it could be made fully compatible but I don't find it a very appealing solution. > * It should not reduce the performance for applications > that don't use (and have no use for) the new feature. Within reason, agreed. In this case if the filter isn't set 'apply' is called directly. There is only wrapper function with a guard as overhead. > * It should be obviously correct and harmless. (It is > embarrassing for the Erlang/OTP team if a new killer feature > breaks something that has always worked. It is *very* > embarrassing if a not specially important features breaks > something.) Obviously. That's why pu and unit exists is it not? I'll be happy to write some additional unit tests I've just not had the time. However, there is a difference between purposeful breakage in the name of advancement and breakage due to bad code. Security in Erlang has been talked about a lot but little is done. This patch provides a certain amount of security without any major impact. I wouldn't consider it unreasonable if R14 remote spawns didn't work on R13 and prior. Just as I consider it reasonable that by catching throws now in rpc there is a possibility of breakage. > > Unless you can convince us that the feature is more > important than just "nice to have", it is unlikely that we > will approve it. I'm hoping more people comment on the feature. In my short time in the Erlang community I've seen a few individuals ask about sandboxing beam and/or networked nodes. The former would require a lot of work but the latter is straight forward if an ability to plugin to remote 'apply'ing is provided. I've CCed erlang-questions to bring a larger audience. -Antonio From matthias@REDACTED Mon Mar 1 15:49:19 2010 From: matthias@REDACTED (Matthias Lang) Date: Mon, 1 Mar 2010 15:49:19 +0100 Subject: Cross compiling R13B04 for MIPS CPU running linux works Message-ID: <20100301144919.GA31133@corelatus.se> Hi, R13B04 has brand-new support for cross-compiling. Big thanks to Rickard Green for tackling that ugly job. Compiling R13B for a MIPS-32 big endian CPU running linux worked first try (!), all I did was make an erl-xcomp file with three lines changed from the template: erl_xcomp_build=guess erl_xcomp_host=mips-linux CFLAGS=-Os Questions: 1. Do you want the erl-xcomp file I made? On one hand: I don't know of anyone else running Erlang on that CPU (an Au1000, which runs the control system on Corelatus' GTH hardware). On the other hand: the next person with a weird target would probably be happy to see that they're not setting off into "only OTP have done this" territory. 2. On targets where disk space is precious, it's nice if the .beams are compressed. On earlier releases, I did that that by including +compressed in ERL_COMPILE_FLAGS (by patching the makefile). Is there a better way to do that now? I had a quick look, couldn't find one, thought I'd ask before I invent my own method, possibly putting the .beams in an archive while I'm at it. Matt From g@REDACTED Mon Mar 1 18:21:20 2010 From: g@REDACTED (Garrett Smith) Date: Mon, 1 Mar 2010 11:21:20 -0600 Subject: [erlang-questions] Re: [erlang-patches] spawn to rpc, filter, etc. In-Reply-To: References: <20100221051303.66bb8b72@landofbile.com> <6672d0161002250002x292abe4doe202fba914f412ce@mail.gmail.com> <20100228011626.347d0a85@otis> <6672d0161002280644m19387427ud50db6820fc036f1@mail.gmail.com> <20100228102118.033a597a@otis> <6672d0161003010620q1fa4c80awc08dc2ce3e0e6824@mail.gmail.com> Message-ID: On Mon, Mar 1, 2010 at 9:54 AM, wrote: > Bj?rn Gustavsson wrote: >> I consider this feature "nice to have". It does not provide enough >> additional security so that you would dare to connect to untrusted >> nodes, so the ability to filter messages can only be a convenience >> feature, not a game changing feature. (As far as I can understand. >> You have not mentioned any specific applications that would have >> a need for the feature.) > > Currently there is nearly zero security outside of the cookie. There are > cases where native connected nodes are desired without opening up the > entire system. Trust is not binary. Just because I can ssh to a box > doesn't mean I can execute anything on the machine. My team is currently > rewriting an application in Erlang and we must have certain levels of lock > down. There are always tradeoffs for security but Erlang in its current > form forces tradeoffs that aren't necessary. I see several easy and minor > changes to the Erlang system that would go a long way to providing a more > secure environment and I'm trying to get them out there so others can take > advantage of them. > >> >> Therefore, being only a "nice to have" feature that changes >> sensitive code paths, the following are the minimum requirements: >> >> * It should be 100% backwards compatible. > > I was under the understanding that different releases shouldn't > necessarily be used together. It's a rather large jump in security between > nodes relative to what exists and I'd think it's a reasonable tradeoff. As > I mentioned in the previous email it could be made fully compatible but I > don't find it a very appealing solution. > >> * It should not reduce the performance for applications >> that don't use (and have no use for) the new feature. > > Within reason, agreed. In this case if the filter isn't set 'apply' is > called directly. There is only wrapper function with a guard as overhead. > >> * It should be obviously correct and harmless. (It is >> embarrassing for the Erlang/OTP team if a new killer feature >> breaks something that has always worked. It is *very* >> embarrassing if a not specially important features breaks >> something.) > > Obviously. That's why pu and unit exists is it not? I'll be happy to write > some additional unit tests I've just not had the time. However, there is a > difference between purposeful breakage in the name of advancement and > breakage due to bad code. Security in Erlang has been talked about a lot > but little is done. This patch provides a certain amount of security > without any major impact. I wouldn't consider it unreasonable if R14 > remote spawns didn't work on R13 and prior. Just as I consider it > reasonable that by catching throws now in rpc there is a possibility of > breakage. > >> >> Unless you can convince us that the feature is more >> important than just "nice to have", it is unlikely that we >> will approve it. > > I'm hoping more people comment on the feature. In my short time in the > Erlang community I've seen a few individuals ask about sandboxing beam > and/or networked nodes. The former would require a lot of work but the > latter is straight forward if an ability to plugin to remote 'apply'ing is > provided. I've CCed erlang-questions to bring a larger audience. I can only speak of my experiences and inclination, but baking security into a language environment is not really a bolt-on feature. A 99% "security measure" is a total disaster -- much worse than no security. I'm not weighing in on "how good" the patch/proposal is, only that this type of change should be taken very seriously. I think it's fair that Bj?rn wants to understand more about why this is more than "nice to have". Again, strictly my opinion, but having worked quite a bit with Java's security model, I believe it's a total PITA -- both to use and work around. There are undoubtedly lots of people who love it and use it effectively, but I strictly avoid it. I'm more comfortable working within the security model of the OS. E.g. running as non-privileged, file permissions, iptables, etc. There's a lot you can do to lock down a program or network -- and that with very mature, proven technology. As far as node-to-node connectivity, I'm leaning away from Erlang's native "mesh" features and more toward messaging using brokers (e.g. rabbitmq, qpid, etc.) I know Erlang's "distributed story" is predicated on these features, but there some good reasons to turn those off and use brokers, security/access control being one of them. I realize, however, this is a non starter for typical distributed Erlang apps -- just too much work. Garrett From ulf.wiger@REDACTED Mon Mar 1 18:44:12 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Mon, 01 Mar 2010 18:44:12 +0100 Subject: [erlang-patches] spawn to rpc, filter, etc. In-Reply-To: References: <20100221051303.66bb8b72@landofbile.com> <6672d0161002250002x292abe4doe202fba914f412ce@mail.gmail.com> <20100228011626.347d0a85@otis> <6672d0161002280644m19387427ud50db6820fc036f1@mail.gmail.com> <20100228102118.033a597a@otis> <6672d0161003010620q1fa4c80awc08dc2ce3e0e6824@mail.gmail.com> Message-ID: <4B8BFCEC.20108@erlang-solutions.com> bile@REDACTED wrote: > Bj?rn Gustavsson wrote: >> ... > > I see several easy and minor > changes to the Erlang system that would go a long way to providing a more > secure environment and I'm trying to get them out there so others can take > advantage of them. I'd say that the inability to filter incoming rpc calls is one of the things that push people towards implementing their own communication channels and "user-level rpc". Improving security would definitely be welcome... One problem is of course that if you're connected to a node, you can send any message on any process on that node, which is a whopping big security hole. As an example, the application controller is always pid <0.6.0> (used to be <0.5.0> for many years. If you can only figure out the node index of a remote node, you can do evil stuff like: NIndex = 6341, % (or whatever) P = c:pid(NIndex,6,0), P ! {'$gen_call', {P,ref}, {stop_application,kernel}} and render it pretty much useless. I'm all for incrementally improving the situation, but am hesitant if we don't believe that good-enough security is within reach. Moving from "obviously unsecure" to "not obviously unsecure" is not necessarily an improvement. >> Therefore, being only a "nice to have" feature that changes >> sensitive code paths, the following are the minimum requirements: >> >> * It should be 100% backwards compatible. > > I was under the understanding that different releases shouldn't > necessarily be used together. It's a rather large jump in security between > nodes relative to what exists and I'd think it's a reasonable tradeoff. As > I mentioned in the previous email it could be made fully compatible but I > don't find it a very appealing solution. I think it should be 100% bw compatible with old nodes, but old nodes should not need to offer any better security than before. The problem is that there doesn't seem to be a way to tell whether a connected node is old or new. Users who don't need the added security must still be able to rely on core functionality to be b/w compatible. > I wouldn't consider it unreasonable if R14 > remote spawns didn't work on R13 and prior. Just as I consider it > reasonable that by catching throws now in rpc there is a possibility of > breakage. I think there is a difference between these two, and do think that remote spawns cannot be seen to suddenly break. -- Ulf Wiger CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd http://www.erlang-solutions.com --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From Antonio.Musumeci@REDACTED Mon Mar 1 19:04:36 2010 From: Antonio.Musumeci@REDACTED (Musumeci, Antonio S) Date: Mon, 1 Mar 2010 13:04:36 -0500 Subject: [erlang-patches] spawn to rpc, filter, etc. In-Reply-To: <4B8BFCEC.20108@erlang-solutions.com> References: <20100221051303.66bb8b72@landofbile.com> <6672d0161002250002x292abe4doe202fba914f412ce@mail.gmail.com> <20100228011626.347d0a85@otis> <6672d0161002280644m19387427ud50db6820fc036f1@mail.gmail.com> <20100228102118.033a597a@otis> <6672d0161003010620q1fa4c80awc08dc2ce3e0e6824@mail.gmail.com> <4B8BFCEC.20108@erlang-solutions.com> Message-ID: <01489E237C2C8F45AF7898E135F48E80021EE05D00@NYWEXMBX2129.msad.ms.com> Working within the existing modules only allows us so much flexibility. The RPC protocol doesn't provide any way to provide a security context AFAICT. This patch I've proposed *at least* provides the ability to filter on MFA/From. The only thing you can do currently is to tell kernel_sup to shutdown rex but leaves open spawn and spawn is held inside net_kernel which would cause major breakage if shut down. Leaving rpc/spawn wide open without reasonable ability to tighten up security seems rather strict and unnecessary. It's not unlike the connected port exclusivity patch I'm working on. A few dozen lines of code can restrict communication with ports to only its connected process. Obviously unsecure just doesn't fly in many places and these little changes can go a long way I think in helping Erlang get adopted. RPC 2.0 can always be designed without existing constraints but providing some amount of security within the existing framework is a necessary step to that. I'll look into making it fully backward compatible. As before suggestions are welcome. -----Original Message----- From: erlang-patches@REDACTED [mailto:erlang-patches@REDACTED] On Behalf Of Ulf Wiger Sent: Monday, March 01, 2010 12:44 PM To: bile@REDACTED Cc: erlang-patches@REDACTED; erlang-questions@REDACTED Subject: Re: [erlang-patches] spawn to rpc, filter, etc. bile@REDACTED wrote: > Bj?rn Gustavsson wrote: >> ... > > I see several easy and minor > changes to the Erlang system that would go a long way to providing a > more secure environment and I'm trying to get them out there so others > can take advantage of them. I'd say that the inability to filter incoming rpc calls is one of the things that push people towards implementing their own communication channels and "user-level rpc". Improving security would definitely be welcome... One problem is of course that if you're connected to a node, you can send any message on any process on that node, which is a whopping big security hole. As an example, the application controller is always pid <0.6.0> (used to be <0.5.0> for many years. If you can only figure out the node index of a remote node, you can do evil stuff like: NIndex = 6341, % (or whatever) P = c:pid(NIndex,6,0), P ! {'$gen_call', {P,ref}, {stop_application,kernel}} and render it pretty much useless. I'm all for incrementally improving the situation, but am hesitant if we don't believe that good-enough security is within reach. Moving from "obviously unsecure" to "not obviously unsecure" is not necessarily an improvement. >> Therefore, being only a "nice to have" feature that changes sensitive >> code paths, the following are the minimum requirements: >> >> * It should be 100% backwards compatible. > > I was under the understanding that different releases shouldn't > necessarily be used together. It's a rather large jump in security > between nodes relative to what exists and I'd think it's a reasonable > tradeoff. As I mentioned in the previous email it could be made fully > compatible but I don't find it a very appealing solution. I think it should be 100% bw compatible with old nodes, but old nodes should not need to offer any better security than before. The problem is that there doesn't seem to be a way to tell whether a connected node is old or new. Users who don't need the added security must still be able to rely on core functionality to be b/w compatible. > I wouldn't consider it unreasonable if R14 remote spawns didn't work > on R13 and prior. Just as I consider it reasonable that by catching > throws now in rpc there is a possibility of breakage. I think there is a difference between these two, and do think that remote spawns cannot be seen to suddenly break. -- Ulf Wiger CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd http://www.erlang-solutions.com --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com ________________________________________________________________ erlang-patches (at) erlang.org mailing list. See http://www.erlang.org/faq.html To unsubscribe; mailto:erlang-patches-unsubscribe@REDACTED -------------------------------------------------------------------------- NOTICE: If received in error, please destroy, and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error. We may monitor and store emails to the extent permitted by applicable law. From senthilkumar.peelikkampatti@REDACTED Mon Mar 1 19:34:34 2010 From: senthilkumar.peelikkampatti@REDACTED (Senthilkumar Peelikkampatti) Date: Mon, 1 Mar 2010 12:34:34 -0600 Subject: Erlang web app needs your support Message-ID: <45d8e23d1003011034n110da3c5u38dd101a86dac78e@mail.gmail.com> Hi, Tiptex.com is pure erlang based web application and it was one of the idea submitted to "Paypal developer challenge" and it made into one of the 55 ideas selected out of 700+. It is into pre final round and this round is about community vote. Tiptex needs your vote to get into final round. Please vote for tiptex. Steps to Vote: 1) Click the link http://na5.brightidea.com/ct/v.bix?c=BE0F57AE-9204-40EA-B175-8550913EF381 2) Login using paypal userid/password 2) After the logged in, you will be able to see the page contains search field. Please enter "D912" in the search field and click the link/Vote icon which is located left side of the page to cast the vote. 3) If you don't have paypal account please register it, it is free... Please reply me back after casting the vote, so that I will update you later about the progress. Sorry to intrude into your mailbox. Thanks in advance, Senthilkumar. From kvs@REDACTED Mon Mar 1 20:43:15 2010 From: kvs@REDACTED (Konstantin Sorokin) Date: Mon, 1 Mar 2010 22:43:15 +0300 Subject: Number of dns resolvers Message-ID: <9dfb3ec1003011143y1b07c524u6ca89e0d774cbbec@mail.gmail.com> Hello! How do I control number of dns resolvers in Erlang VM ? As far as I can see by default there are only 4 DNS resolvers (inet_gethost port processes) and if my app performs massive DNS lookups in many parallel processes then I probably should increase that number, right ? Are there any other parameters that I can tweak to increase DNS lookup speed ? -- Konstantin Sorokin From g@REDACTED Mon Mar 1 21:00:26 2010 From: g@REDACTED (Garrett Smith) Date: Mon, 1 Mar 2010 14:00:26 -0600 Subject: Guards on assignment (i.e. assertions) Message-ID: In most cases, assertions come "free" in Erlang in guards and pattern matching. There are cases though where I'd like to apply a guard a statement like this: A = B when B > C I currently do this: A = case B of ValidB when ValidB > C -> ValidB end or, a simpler form (but the error message on failure isn't as clear): A = if B > C -> B end There are other ways as well, e.g. using functions, etc. but I like the first form. I'm wondering how others implement basic assertions on assignments. I think if the first form were supported by the language, I'd use the "assert" pattern and my code would be better for it. Garrett From vladdu55@REDACTED Mon Mar 1 21:05:22 2010 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 1 Mar 2010 21:05:22 +0100 Subject: [erlang-questions] Guards on assignment (i.e. assertions) In-Reply-To: References: Message-ID: <95be1d3b1003011205h3e176f06kf76cbdeb1f1465c9@mail.gmail.com> On Mon, Mar 1, 2010 at 21:00, Garrett Smith wrote: > ?A = B when B > C Hi! What value should A be matched to if B =< C? regards, Vlad From g@REDACTED Mon Mar 1 21:13:27 2010 From: g@REDACTED (Garrett Smith) Date: Mon, 1 Mar 2010 14:13:27 -0600 Subject: [erlang-questions] Guards on assignment (i.e. assertions) In-Reply-To: <95be1d3b1003011205h3e176f06kf76cbdeb1f1465c9@mail.gmail.com> References: <95be1d3b1003011205h3e176f06kf76cbdeb1f1465c9@mail.gmail.com> Message-ID: There's no value -- the assignment fails. It's syntactic sugar for a case statement with the same guard. On Mon, Mar 1, 2010 at 2:05 PM, Vlad Dumitrescu wrote: > On Mon, Mar 1, 2010 at 21:00, Garrett Smith wrote: >> ?A = B when B > C > > Hi! > > What value should A be matched to if B =< C? > > regards, > Vlad > From ok@REDACTED Mon Mar 1 21:27:21 2010 From: ok@REDACTED (Richard O'Keefe) Date: Tue, 2 Mar 2010 09:27:21 +1300 Subject: [erlang-questions] Guards on assignment (i.e. assertions) In-Reply-To: References: Message-ID: On Mar 2, 2010, at 9:00 AM, Garrett Smith wrote: > In most cases, assertions come "free" in Erlang in guards and pattern > matching. There are cases though where I'd like to apply a guard a > statement like this: > > A = B when B > C What's wrong with if B > C -> A = B end? I have a faint memory of someone, possibly me, suggesting something like (A when B > C) = B last year. If it was me, I was probably explaining how you could do this with abstract patterns. From vladdu55@REDACTED Mon Mar 1 21:34:09 2010 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 1 Mar 2010 21:34:09 +0100 Subject: [erlang-questions] Guards on assignment (i.e. assertions) In-Reply-To: References: <95be1d3b1003011205h3e176f06kf76cbdeb1f1465c9@mail.gmail.com> Message-ID: <95be1d3b1003011234h1fc8054fo15224e521ec71685@mail.gmail.com> On Mon, Mar 1, 2010 at 21:13, Garrett Smith wrote: >> What value should A be matched to if B =< C? > There's no value -- the assignment fails. Ah, okay. I thought you meant something else, should have read more carefully. I think it would help reading some code, but it might be tricky to get the the grammar right. Could we have even A = {B when B>C, D when is_list(D)} or only A = {B, D} when B>C, is_list(D) ? regards, Vlad From dmercer@REDACTED Mon Mar 1 21:34:54 2010 From: dmercer@REDACTED (David Mercer) Date: Mon, 1 Mar 2010 14:34:54 -0600 Subject: [erlang-questions] Guards on assignment (i.e. assertions) In-Reply-To: References: Message-ID: <950C99B74C704442BA616FF023D9013D@SSI.CORP> That seems like a legitimate use of the "if" keyword. A = if B > C -> B end Or if B > C -> A = B end > -----Original Message----- > From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] On > Behalf Of Garrett Smith > Sent: Monday, March 01, 2010 2:00 PM > To: Erlang Questions > Subject: [erlang-questions] Guards on assignment (i.e. assertions) > > In most cases, assertions come "free" in Erlang in guards and pattern > matching. There are cases though where I'd like to apply a guard a > statement like this: > > A = B when B > C > > I currently do this: > > A = case B of ValidB when ValidB > C -> ValidB end > > or, a simpler form (but the error message on failure isn't as clear): > > A = if B > C -> B end > > There are other ways as well, e.g. using functions, etc. but I like > the first form. > > I'm wondering how others implement basic assertions on assignments. I > think if the first form were supported by the language, I'd use the > "assert" pattern and my code would be better for it. > > Garrett > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED From g@REDACTED Mon Mar 1 21:44:34 2010 From: g@REDACTED (Garrett Smith) Date: Mon, 1 Mar 2010 14:44:34 -0600 Subject: [erlang-questions] Guards on assignment (i.e. assertions) In-Reply-To: <950C99B74C704442BA616FF023D9013D@SSI.CORP> References: <950C99B74C704442BA616FF023D9013D@SSI.CORP> Message-ID: Right, that's fine. It's even pretty readable. Though when it fails, you just get an ambiguous "exception error: no true branch found when evaluating an if expression", which is why I prefer the case statement. Both case and if are a bit verbose. A simpler syntax would, I think, encourage this practice. On Mon, Mar 1, 2010 at 2:34 PM, David Mercer wrote: > That seems like a legitimate use of the "if" keyword. > > ? ? ? ?A = if B > C -> B end > > Or > > ? ? ? ?if B > C -> A = B end > >> -----Original Message----- >> From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] On >> Behalf Of Garrett Smith >> Sent: Monday, March 01, 2010 2:00 PM >> To: Erlang Questions >> Subject: [erlang-questions] Guards on assignment (i.e. assertions) >> >> In most cases, assertions come "free" in Erlang in guards and pattern >> matching. There are cases though where I'd like to apply a guard a >> statement like this: >> >> ? A = B when B > C >> >> I currently do this: >> >> ? A = case B of ValidB when ValidB > C -> ValidB end >> >> or, a simpler form (but the error message on failure isn't as clear): >> >> ? A = if B > C -> B end >> >> There are other ways as well, e.g. using functions, etc. but I like >> the first form. >> >> I'm wondering how others implement basic assertions on assignments. I >> think if the first form were supported by the language, I'd use the >> "assert" pattern and my code would be better for it. >> >> Garrett >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From g@REDACTED Mon Mar 1 21:49:22 2010 From: g@REDACTED (Garrett Smith) Date: Mon, 1 Mar 2010 14:49:22 -0600 Subject: [erlang-questions] Guards on assignment (i.e. assertions) In-Reply-To: <95be1d3b1003011234h1fc8054fo15224e521ec71685@mail.gmail.com> References: <95be1d3b1003011205h3e176f06kf76cbdeb1f1465c9@mail.gmail.com> <95be1d3b1003011234h1fc8054fo15224e521ec71685@mail.gmail.com> Message-ID: On Mon, Mar 1, 2010 at 2:34 PM, Vlad Dumitrescu wrote: > On Mon, Mar 1, 2010 at 21:13, Garrett Smith wrote: >>> What value should A be matched to if B =< C? >> There's no value -- the assignment fails. > > Ah, okay. I thought you meant something else, should have read more carefully. > > I think it would help reading some code, but it might be tricky to get > the the grammar right. Could we have even > ? ?A = {B when B>C, D when is_list(D)} > or only > ? ?A = {B, D} when B>C, is_list(D) > ? The guard would be applied with the assignment operator as a check before the pattern matching was applied. So, only the second form. From zeno490@REDACTED Mon Mar 1 21:50:25 2010 From: zeno490@REDACTED (Nicholas Frechette) Date: Mon, 1 Mar 2010 15:50:25 -0500 Subject: [erlang-questions] Guards on assignment (i.e. assertions) In-Reply-To: References: <950C99B74C704442BA616FF023D9013D@SSI.CORP> Message-ID: You could easily make a user space assert macro. One that can optionally take a message to print out as well on failure, and you could compile it out in opt (non-debug) builds (courtesy or the erlang preprocessor) Something like: ?ASSERT(B > C when is_integer(B), "Bad value for B"), ASSERT would then be trivial to write using preprocessor stringifier. -define(ASSERT(Guarg, Str), case true of Guard -> ok; _ -> io:format(Str) end). Not tested obviously but you get the idea. On Mon, Mar 1, 2010 at 3:44 PM, Garrett Smith wrote: > Right, that's fine. It's even pretty readable. Though when it fails, > you just get an ambiguous "exception error: no true branch found when > evaluating an if expression", which is why I prefer the case > statement. > > Both case and if are a bit verbose. A simpler syntax would, I think, > encourage this practice. > > On Mon, Mar 1, 2010 at 2:34 PM, David Mercer wrote: > > That seems like a legitimate use of the "if" keyword. > > > > A = if B > C -> B end > > > > Or > > > > if B > C -> A = B end > > > >> -----Original Message----- > >> From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] > On > >> Behalf Of Garrett Smith > >> Sent: Monday, March 01, 2010 2:00 PM > >> To: Erlang Questions > >> Subject: [erlang-questions] Guards on assignment (i.e. assertions) > >> > >> In most cases, assertions come "free" in Erlang in guards and pattern > >> matching. There are cases though where I'd like to apply a guard a > >> statement like this: > >> > >> A = B when B > C > >> > >> I currently do this: > >> > >> A = case B of ValidB when ValidB > C -> ValidB end > >> > >> or, a simpler form (but the error message on failure isn't as clear): > >> > >> A = if B > C -> B end > >> > >> There are other ways as well, e.g. using functions, etc. but I like > >> the first form. > >> > >> I'm wondering how others implement basic assertions on assignments. I > >> think if the first form were supported by the language, I'd use the > >> "assert" pattern and my code would be better for it. > >> > >> Garrett > >> > >> ________________________________________________________________ > >> erlang-questions (at) erlang.org mailing list. > >> See http://www.erlang.org/faq.html > >> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From vik@REDACTED Mon Mar 1 22:01:26 2010 From: vik@REDACTED (Vik Olliver) Date: Tue, 02 Mar 2010 10:01:26 +1300 Subject: [erlang-questions] Guards on assignment (i.e. assertions) In-Reply-To: References: <950C99B74C704442BA616FF023D9013D@SSI.CORP> Message-ID: <4B8C2B26.9000603@catalyst.net.nz> Nicholas Frechette wrote: > You could easily make a user space assert macro. One that can optionally > take a message to print out as well on failure, and you could compile it out > in opt (non-debug) builds (courtesy or the erlang preprocessor) > > Something like: > ?ASSERT(B > C when is_integer(B), "Bad value for B"), Doesn't eunit do this? Vik :v) From nem@REDACTED Mon Mar 1 22:24:13 2010 From: nem@REDACTED (Geoff Cant) Date: Mon, 01 Mar 2010 13:24:13 -0800 Subject: [erlang-questions] Number of dns resolvers In-Reply-To: <9dfb3ec1003011143y1b07c524u6ca89e0d774cbbec@mail.gmail.com> (Konstantin Sorokin's message of "Mon, 1 Mar 2010 22:43:15 +0300") References: <9dfb3ec1003011143y1b07c524u6ca89e0d774cbbec@mail.gmail.com> Message-ID: Konstantin Sorokin writes: > Hello! > > How do I control number of dns resolvers in Erlang VM ? As far as I > can see by default there are only 4 DNS resolvers (inet_gethost port > processes) and if my app performs massive DNS lookups in many parallel > processes then I probably should increase that number, right ? Are > there any other parameters that I can tweak to increase DNS lookup > speed ? There seems to be an undocumented? kernel configuration parameter 'gethost_poolsize'::non_neg_integer() that specifies this. As an alternative to using the c resolver (the 'native' resolver) you could use OTP's erlang DNS client - the 'dns' resolver. Specifying "{lookup, [dns]}." in your inetrc should do that (and erl -kernel inetrc '"/some/path/inetrc"'). I don't think there's any concurrency limit on it except the number of udp sockets you can open. Cheers, -- Geoff Cant From ok@REDACTED Tue Mar 2 01:28:02 2010 From: ok@REDACTED (Richard O'Keefe) Date: Tue, 2 Mar 2010 13:28:02 +1300 Subject: [erlang-questions] Guards on assignment (i.e. assertions) In-Reply-To: References: <950C99B74C704442BA616FF023D9013D@SSI.CORP> Message-ID: On Mar 2, 2010, at 9:44 AM, Garrett Smith wrote: > Right, that's fine. It's even pretty readable. Though when it fails, > you just get an ambiguous "exception error: no true branch found when > evaluating an if expression", which is why I prefer the case > statement. > > Both case and if are a bit verbose. A simpler syntax would, I think, > encourage this practice. Is it a practice we _want_ to encourage? In the absence of a realistic concrete example, it seems to me as though the check may be in the wrong place. Suppose for example I found that I often wanted if A =< B, B =< C -> X = B end What I'd do would be to write a *function* ranged(X, L, U) when L =< X, X =< U -> X. and then call it X = ranged_(B, A, C) This gives a much more informative error message than 'case'. Such checking functions can be inlined, so there's no need to worry about performance issues. I use assertions a lot in imperative code, but in functional code, it doesn't seem to fit very well. If I'm binding a value to some new variable, there ought to be a reason *in the computation of the value* why it is a good value. From ok@REDACTED Tue Mar 2 01:42:39 2010 From: ok@REDACTED (Richard O'Keefe) Date: Tue, 2 Mar 2010 13:42:39 +1300 Subject: [erlang-questions] Guards on assignment (i.e. assertions) In-Reply-To: References: <95be1d3b1003011205h3e176f06kf76cbdeb1f1465c9@mail.gmail.com> <95be1d3b1003011234h1fc8054fo15224e521ec71685@mail.gmail.com> Message-ID: <02726AD7-7889-4811-ABE5-28EE76724F7C@cs.otago.ac.nz> On Mar 2, 2010, at 9:49 AM, Garrett Smith wrote: > ]The guard would be applied with the assignment operator as a check > before the pattern matching was applied. So, only the second form. Erlang doesn't _have_ an assignment operator. (Unless you want to count put(Key, Value) as an 'operator'.) Erlang has a _binding_ construct. There is no difference between Lhs = Rhs and case Rhs of Lhs -> Lhs end This may sound like nit-picking, but I think something important is lurking in the shadows, and it does hinge on the difference between imperative and functional languages. In an imperative language, you might do Lhs := Rhs; assert Condition; and what you are doing is demanding that the program be in a "good" partition of its STATE SPACE. The program moves around in its state space whenever assignments happen, so it makes sense to link assertions with assignments. Of course, while it may "make sense to link assertions with assignments", imperative languages like C and Java do not in fact to do. Instead of if B > C -> A = B end they'd do assert(B > C); A = B; and nothing stops us doing -define(assert(G), if G -> ok end). ... (?assert(B > C), A = B) in Erlang. In a functional language, you might do let Lhs = Rhs in Expr but there isn't any state space and there aren't any assignments to move around in it (unless you're using ML or CAML). In this context, most of the work done by assertions in an imperative language should be done by PRECONDITIONS or POSTCONDITIONS on functions. You shouldn't _need_ to check Lhs because the check should be built into the computation of Rhs. The assertions are still _there_, it's just a matter of what they are asserting _about_. From bile@REDACTED Tue Mar 2 04:11:22 2010 From: bile@REDACTED (bile@REDACTED) Date: Mon, 1 Mar 2010 22:11:22 -0500 Subject: [erlang-patches] spawn to rpc, filter, etc. In-Reply-To: References: <20100221051303.66bb8b72@landofbile.com> <6672d0161002250002x292abe4doe202fba914f412ce@mail.gmail.com> <20100228011626.347d0a85@otis> <6672d0161002280644m19387427ud50db6820fc036f1@mail.gmail.com> <20100228102118.033a597a@otis> <6672d0161003010620q1fa4c80awc08dc2ce3e0e6824@mail.gmail.com> Message-ID: <20100301221122.58d098ea@otis> Could I get some feedback on the possibility of getting one of these versions of the filtered rpc / spawn into the main tree before I go and rework the existing one? 1) Current version: remote spawn moved to rex. erlang:spawn sends messages to rex rather than net_kernel. Issue: Old nodes could spawn on new nodes but not new on old. 2) Keep spawn in rex. erlang:spawn sends messages to net_kernel which forwards on to rex. Issues: looses {From,Tag} unless gen:call is more or less duplicated within net_kernel:spawn or gen module gets the ability to forward messages. Extra hop. 3) Leave rex and spawn separate, place the filter logic in one of the modules and have the other communicate with it to filter. Issues: creates dependency on the module, adds extra hop for module not containing filter. 4) Leave rex and spawn separate, place filters in both independent of one another. Issues: duplicated logic, separate filters. I'm leaning toward 4. -Antonio From acton@REDACTED Tue Mar 2 04:33:42 2010 From: acton@REDACTED (Brian Acton) Date: Mon, 1 Mar 2010 19:33:42 -0800 Subject: How to deal with Mnesia core files Message-ID: <7a9fe0201003011933j3bbc046eu79a50042f12e7a42@mail.gmail.com> Hi guys, I'm running R13B04 on FreeBSD 7.3-Current and I've been doing some load and performance testing. During times of heavy load, Mnesia starts getting stressed and I start seeing messages in the logs like this: ** WARNING ** Mnesia is overloaded: {dump_log, write_threshold} After a while, Mnesia starts getting more stressed and I see this error message: ** Too many db tables ** And then mnesia basically barfs and leaves a file like: MnesiaCore.node@REDACTED I completely understand that software under heavy load may decide to exit but I am a little surprised that the process dumps core. Is this by design or this unintentional? More importantly, is there any means of interpreting the core files using some debug tool? If so, any tips on the magic commands to make that happen? Any assistance greatly appreciated, --b From cyberlync@REDACTED Tue Mar 2 04:53:09 2010 From: cyberlync@REDACTED (Eric Merritt) Date: Mon, 1 Mar 2010 21:53:09 -0600 Subject: [erlang-questions] Dialyzers dependency on wx seems to be broken In-Reply-To: <4B8B6A63.3010600@cs.ntua.gr> References: <4B8B6A63.3010600@cs.ntua.gr> Message-ID: Kostis, I use dialyzer programmatically in sinan. It gets included into the sinan release as an application. So the release handler tries to start it. It fails because of the broken wx app. Eric On Mon, Mar 1, 2010 at 1:18 AM, Kostis Sagonas wrote: > Eric Merritt wrote: >> >> Hello All, >> >> ?The version of dialyzer released with R13B04 has a direct application >> dependency on wx. This seems to broken as wx is not a startable >> application. I suspect that this should be specified as a library >> application so that it is not required to be started for dialyzer to >> start. > > Hi Eric, > > I admit I have trouble understanding your message. ?In its default mode, > dialyzer does not require the presence of 'wx'. ?It only requires it if you > start dialyzer using: > > ? ? ? ?dialyzer --gui --wx > > Can it be that you are you referring to the following line in file > dialyzer.app? > > ?{applications, [compiler, gs, hipe, kernel, stdlib, wx]}, > > I am not an expert on .app files and how they should be structured, but I > see the dependency to 'wx' there analogous to that of 'hipe', 'kernel', > 'stdlib' etc. which also do not have a start() function. > > Anyway, feel free to suggest a concrete change and we'll adopt it. > > Kostis > From chandrashekhar.mullaparthi@REDACTED Tue Mar 2 06:33:45 2010 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Tue, 2 Mar 2010 05:33:45 +0000 Subject: [erlang-questions] How to deal with Mnesia core files In-Reply-To: <7a9fe0201003011933j3bbc046eu79a50042f12e7a42@mail.gmail.com> References: <7a9fe0201003011933j3bbc046eu79a50042f12e7a42@mail.gmail.com> Message-ID: Hi Brian, On 2 March 2010 03:33, Brian Acton wrote: > Hi guys, > > I'm running R13B04 on FreeBSD 7.3-Current and I've been doing some load and > performance testing. During times of heavy load, Mnesia starts getting > stressed and I start seeing messages in the logs like this: > > ?** WARNING ** Mnesia is overloaded: {dump_log, ? write_threshold} Mnesia uses a few log files to record changes to the tables as it goes along, and periodically dumps the entire table to disk. You can tweak this behaviour using the two mnesia parameters: dump_log_write_threshold dump_log_time_threshold > > After a while, Mnesia starts getting more stressed and I see this error > message: > > ** Too many db tables ** Mnesia uses temporary ets tables for transactions. A new ets table is created during the execution and deleted when the transaction finishes. If you have too many transactions starting, it will hit the default ETS table limit of 1400. See http://erlang.org/doc/efficiency_guide/advanced.html#id2266338 > > And then mnesia basically barfs and leaves a file like: > > MnesiaCore.node@REDACTED > > I completely understand that software under heavy load may decide to exit > but I am a little surprised that the process dumps core. Is this by design > or this unintentional? More importantly, is there any means of interpreting > the core files using some debug tool? If so, any tips on the magic commands > to make that happen? You can use mnesia_lib:vcore/1 to view the mnesia core file. cheers Chandru From acton@REDACTED Tue Mar 2 07:07:20 2010 From: acton@REDACTED (Brian Acton) Date: Mon, 1 Mar 2010 22:07:20 -0800 Subject: [erlang-questions] How to deal with Mnesia core files In-Reply-To: References: <7a9fe0201003011933j3bbc046eu79a50042f12e7a42@mail.gmail.com> Message-ID: <7a9fe0201003012207l4c291262o251d3578d3457c2b@mail.gmail.com> Thanks guys. The mention of mnesia_lib:vcore/1 was a good one that I had not yet found. Overall, my expectation would be that I would not have to govern mnesia for load (as Paul M recommends in his prior post to this thread). The reason is that the range of activity in some applications can be quite dynamic and it would be hard to identify one key characteristic that would cause mnesia to tip over. Instead, my expectation would be that mnesia would return service failures akin to the EBUSY / EAGAIN errno of unix kernels, thus allowing applications to decide on what to do. For completeness sake, I've included the top part of the output from mnesia_lib:vcore/1 in case anyone is curious. --b ***** Mnesia core: "MnesiaCore.node@REDACTED" ***** ***** crashinfo ***** mnesia_recover crashed: {system_limit, [{ets,new, [mnesia_transient_decision, [{keypos,2},set,public]]}, {mnesia_recover,create_transient_decision,0}, {mnesia_recover,do_allow_garb,0}, {mnesia_recover,handle_cast,2}, {gen_server,handle_msg,5}, {proc_lib,init_p_do_apply,3}]} state: {state, <6403.61.0>, undefined, undefined, undefined, 7262,true, []} ***** time ***** {{2010,3,1},{0,54,54}} ***** self ***** [{registered_name,mnesia_recover}, {current_function,{mnesia_lib,mkcore,1}}, {initial_call,{proc_lib,init_p,5}}, {status,running}, {message_queue_len,0}, {messages,[]}, {links,[<6403.95.0>,<6403.61.0>]}, {dictionary,[{'$ancestors',[mnesia_kernel_sup,mnesia_sup,<6403.58.0>]}, {'$initial_call',{mnesia_recover,init,1}}]}, {trap_exit,true}, {error_handler,error_handler}, {priority,normal}, {group_leader,<6403.57.0>}, {total_heap_size,2675793}, {heap_size,2629425}, {stack_size,39}, {reductions,247240}, {garbage_collection,[{min_bin_vheap_size,46368}, {min_heap_size,233}, {fullsweep_after,65535}, {minor_gcs,4}]}, {suspending,[]}] On Mon, Mar 1, 2010 at 9:33 PM, Chandru < chandrashekhar.mullaparthi@REDACTED> wrote: > Hi Brian, > > On 2 March 2010 03:33, Brian Acton wrote: > > Hi guys, > > > > I'm running R13B04 on FreeBSD 7.3-Current and I've been doing some load > and > > performance testing. During times of heavy load, Mnesia starts getting > > stressed and I start seeing messages in the logs like this: > > > > ** WARNING ** Mnesia is overloaded: {dump_log, write_threshold} > > Mnesia uses a few log files to record changes to the tables as it goes > along, and periodically dumps the entire table to disk. You can tweak > this behaviour using the two mnesia parameters: > dump_log_write_threshold > dump_log_time_threshold > > > > > After a while, Mnesia starts getting more stressed and I see this error > > message: > > > > ** Too many db tables ** > > Mnesia uses temporary ets tables for transactions. A new ets table is > created during the execution and deleted when the transaction > finishes. If you have too many transactions starting, it will hit the > default ETS table limit of 1400. See > http://erlang.org/doc/efficiency_guide/advanced.html#id2266338 > > > > > And then mnesia basically barfs and leaves a file like: > > > > MnesiaCore.node@REDACTED > > > > I completely understand that software under heavy load may decide to exit > > but I am a little surprised that the process dumps core. Is this by > design > > or this unintentional? More importantly, is there any means of > interpreting > > the core files using some debug tool? If so, any tips on the magic > commands > > to make that happen? > > You can use mnesia_lib:vcore/1 to view the mnesia core file. > > cheers > Chandru > From mapandfold@REDACTED Tue Mar 2 08:05:54 2010 From: mapandfold@REDACTED (MapAndFold) Date: Tue, 2 Mar 2010 15:05:54 +0800 Subject: On Windows XP (SP2): wx broken Message-ID: >From R13B03 and on, wx can't run on my Windows XP (SP2) box. While on the same machine, elder versions are OK. I have checked wxe_driver.dll with MS Depends, and installed VC2005 runtime DLL of different built numbers (8.0.50727.762, 8.0.50727.1433, 8.0.50727.4053, etc), but it's still broken. From ulf.wiger@REDACTED Tue Mar 2 08:38:10 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Tue, 02 Mar 2010 08:38:10 +0100 Subject: [erlang-questions] How to deal with Mnesia core files In-Reply-To: <7a9fe0201003012207l4c291262o251d3578d3457c2b@mail.gmail.com> References: <7a9fe0201003011933j3bbc046eu79a50042f12e7a42@mail.gmail.com> <7a9fe0201003012207l4c291262o251d3578d3457c2b@mail.gmail.com> Message-ID: <4B8CC062.2000002@erlang-solutions.com> This view has certainly been put forth by others in the past, and I recall having argued for this myself. The problem is that mnesia amortizes the housekeeping cost over time, in the form of log dumps. This makes transactions on disk-based copies return faster than they otherwise should be, but that a high transaction load may accumulate a processing debt. The thing that makes mnesia dump core is that it hits a system limit (max number of ets tables). This limit is configurable, but the better solution would be to regulate the system load so that the mnesia log dumps don't stack up. How to do this may well be system dependent. You need to locate the points of entry into your system that eventually trigger work against mnesia disk tables, and also identify ways to detect overload conditions. The 'mnesia overloaded' event is one such indicator that might be of use. BR, Ulf W Brian Acton wrote: > > Overall, my expectation would be that I would not have to govern mnesia for > load (as Paul M recommends in his prior post to this thread). The reason is > that the range of activity in some applications can be quite dynamic and it > would be hard to identify one key characteristic that would cause mnesia to > tip over. Instead, my expectation would be that mnesia would return service > failures akin to the EBUSY / EAGAIN errno of unix kernels, thus allowing > applications to decide on what to do. > > For completeness sake, I've included the top part of the output from > mnesia_lib:vcore/1 in case anyone is curious. > > --b > > ***** Mnesia core: "MnesiaCore.node@REDACTED" > > ***** > ***** crashinfo ***** > mnesia_recover crashed: {system_limit, > [{ets,new, > [mnesia_transient_decision, > [{keypos,2},set,public]]}, > [...] -- Ulf Wiger CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd http://www.erlang-solutions.com --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From bgustavsson@REDACTED Tue Mar 2 09:24:54 2010 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Tue, 2 Mar 2010 09:24:54 +0100 Subject: [erlang-questions] Re: [erlang-patches] spawn to rpc, filter, etc. In-Reply-To: <20100301221122.58d098ea@otis> References: <20100221051303.66bb8b72@landofbile.com> <6672d0161002250002x292abe4doe202fba914f412ce@mail.gmail.com> <20100228011626.347d0a85@otis> <6672d0161002280644m19387427ud50db6820fc036f1@mail.gmail.com> <20100228102118.033a597a@otis> <6672d0161003010620q1fa4c80awc08dc2ce3e0e6824@mail.gmail.com> <20100301221122.58d098ea@otis> Message-ID: <6672d0161003020024m5a03a073wbee1f0449fc632fa@mail.gmail.com> On Tue, Mar 2, 2010 at 4:11 AM, wrote: > 4) Leave rex and spawn separate, place filters in both independent of > one another. Issues: duplicated logic, separate filters. I recommend alternative 4. But please note that there is no guarantee that we will approve the patch. We will have to discuss it in the OTP Technical Board. (Also see the latest What's cooking email.) -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From gleber.p@REDACTED Tue Mar 2 14:19:21 2010 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 2 Mar 2010 14:19:21 +0100 Subject: [erlang-questions] EPM - an Erlang package manager In-Reply-To: References: Message-ID: <14f0e3621003020519n6c8790camd3c9d80565bebbc9@mail.gmail.com> I've got two questions: 1) Are packages in EPM repo (github.com/epm/) automatically updated somehow? 2) What kind of alternative repositories (i.e. not github) are you considering to support? Best, Gleb On Mon, Mar 1, 2010 at 10:09, Jacob Vorreuter wrote: > I've recently been working on a RubyGems-style package manager for Erlang and would like to hear people's thoughts/criticisms. > > There's nothing to install. You simply download the EPM escript. It uses GitHub as its package repository. > > This is meant mainly for development purposes and does not deal with packaging or deploying OTP releases. > > You can read my post about it here: http://jkvor.com/erlang-package-manager > The executable is available here: http://github.com/JacobVorreuter/epm > > I'd be interested to hear suggestions of how to make this a more useful tool. > > Thanks, > > Jake > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From ulf.wiger@REDACTED Tue Mar 2 18:17:45 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Tue, 02 Mar 2010 18:17:45 +0100 Subject: why is 'registered' a mandatory .app file attribute? Message-ID: <4B8D4839.8040406@erlang-solutions.com> Am I the only one who is annoyed* by the fact that systools requires the 'registered' attribute to be present in the .app files in order to build a boot script? While the attribute may have some value for documentation (if properly maintained), it isn't, and never has been, enforced in any way. Why, then, does it need to be mandatory? BR, Ulf W * Since this has been the case ever since the first release of OTP, imagine my accumulated annoyance by now. -- Ulf Wiger CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd http://www.erlang-solutions.com --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From kvs@REDACTED Tue Mar 2 21:44:42 2010 From: kvs@REDACTED (Konstantin Sorokin) Date: Tue, 2 Mar 2010 23:44:42 +0300 Subject: [erlang-questions] Number of dns resolvers In-Reply-To: References: <9dfb3ec1003011143y1b07c524u6ca89e0d774cbbec@mail.gmail.com> Message-ID: <9dfb3ec1003021244i2f5bfd25v44e0e63ed9063de0@mail.gmail.com> On Tue, Mar 2, 2010 at 12:24 AM, Geoff Cant wrote: > Konstantin Sorokin writes: > >> Hello! >> >> How do I control number of dns resolvers in Erlang VM ? As far as I >> can see by default there are only 4 DNS resolvers (inet_gethost port >> processes) and if my app performs massive DNS lookups in many parallel >> processes then I probably should increase that number, right ? Are >> there any other parameters that I can tweak to increase DNS lookup >> speed ? > > There seems to be an undocumented? kernel configuration parameter > 'gethost_poolsize'::non_neg_integer() that specifies this. > > As an alternative to using the c resolver (the 'native' resolver) you > could use OTP's erlang DNS client - the 'dns' resolver. > > Specifying "{lookup, [dns]}." in your inetrc should do that (and erl > -kernel inetrc '"/some/path/inetrc"'). I don't think there's any > concurrency limit on it except the number of udp sockets you can open. > I tried to use your tip, but without success. Config file I wrote looks like this: {resolv_conf, "/etc/resolv.conf"}. {file, hosts, "/etc/hosts"}. {edns, 0}. {cache_size, 0}. {lookup, [dns]}. and was almost copy-pasted from this page: http://ftp.sunet.se/pub/lang/erlang/doc/apps/erts/inet_cfg.html (7.3 User Configuration Example). Nevertheless, when I tried to use it with an Erlang shell, I've got following weird error message: $ erl -kernel inetrc "'/home/kvs/.erl_inetrc'" {error_logger,{{2010,3,2},{23,40,21}},"inet_config: syntax error in ~s~n",['/home/kvs/.erl_inetrc']} Erlang (BEAM) emulator version 5.6.5 [source] [64-bit] [smp:2] [async-threads:0] [hipe] [kernel-poll:false] =ERROR REPORT==== 2-Mar-2010::23:40:21 === inet_config: syntax error in /home/kvs/.erl_inetrc Eshell V5.6.5 (abort with ^G) 1> -- Konstantin Sorokin From nem@REDACTED Tue Mar 2 22:18:35 2010 From: nem@REDACTED (Geoff Cant) Date: Tue, 02 Mar 2010 13:18:35 -0800 Subject: [erlang-questions] Number of dns resolvers In-Reply-To: <9dfb3ec1003021244i2f5bfd25v44e0e63ed9063de0@mail.gmail.com> (Konstantin Sorokin's message of "Tue, 2 Mar 2010 23:44:42 +0300") References: <9dfb3ec1003011143y1b07c524u6ca89e0d774cbbec@mail.gmail.com> <9dfb3ec1003021244i2f5bfd25v44e0e63ed9063de0@mail.gmail.com> Message-ID: Konstantin Sorokin writes: > On Tue, Mar 2, 2010 at 12:24 AM, Geoff Cant wrote: >> Konstantin Sorokin writes: >> >>> Hello! >>> >>> How do I control number of dns resolvers in Erlang VM ? As far as I >>> can see by default there are only 4 DNS resolvers (inet_gethost port >>> processes) and if my app performs massive DNS lookups in many parallel >>> processes then I probably should increase that number, right ? Are >>> there any other parameters that I can tweak to increase DNS lookup >>> speed ? >> >> There seems to be an undocumented? kernel configuration parameter >> 'gethost_poolsize'::non_neg_integer() that specifies this. >> >> As an alternative to using the c resolver (the 'native' resolver) you >> could use OTP's erlang DNS client - the 'dns' resolver. >> >> Specifying "{lookup, [dns]}." in your inetrc should do that (and erl >> -kernel inetrc '"/some/path/inetrc"'). I don't think there's any >> concurrency limit on it except the number of udp sockets you can open. >> > > I tried to use your tip, but without success. Config file I wrote > looks like this: > > {resolv_conf, "/etc/resolv.conf"}. > {file, hosts, "/etc/hosts"}. > {edns, 0}. > {cache_size, 0}. > {lookup, [dns]}. > > and was almost copy-pasted from this page: > http://ftp.sunet.se/pub/lang/erlang/doc/apps/erts/inet_cfg.html (7.3 > User Configuration Example). Nevertheless, > when I tried to use it with an Erlang shell, I've got following weird > error message: > > $ erl -kernel inetrc "'/home/kvs/.erl_inetrc'" > {error_logger,{{2010,3,2},{23,40,21}},"inet_config: syntax error in > ~s~n",['/home/kvs/.erl_inetrc']} > Erlang (BEAM) emulator version 5.6.5 [source] [64-bit] [smp:2] > [async-threads:0] [hipe] [kernel-poll:false] You're using Erlang/OTP R12B5, the edns option was only introduced in R13 I think. If you drop the 'edns' option it should work in R12. Cheers, -- Geoff Cant From kvs@REDACTED Tue Mar 2 22:20:59 2010 From: kvs@REDACTED (Konstantin Sorokin) Date: Wed, 3 Mar 2010 00:20:59 +0300 Subject: [erlang-questions] Number of dns resolvers In-Reply-To: References: <9dfb3ec1003011143y1b07c524u6ca89e0d774cbbec@mail.gmail.com> <9dfb3ec1003021244i2f5bfd25v44e0e63ed9063de0@mail.gmail.com> Message-ID: <9dfb3ec1003021320y9245dcej5d53dddd89cd4932@mail.gmail.com> On Wed, Mar 3, 2010 at 12:18 AM, Geoff Cant wrote: > Konstantin Sorokin writes: > >> On Tue, Mar 2, 2010 at 12:24 AM, Geoff Cant wrote: >>> Konstantin Sorokin writes: >>> >>>> Hello! >>>> >>>> How do I control number of dns resolvers in Erlang VM ? As far as I >>>> can see by default there are only 4 DNS resolvers (inet_gethost port >>>> processes) and if my app performs massive DNS lookups in many parallel >>>> processes then I probably should increase that number, right ? Are >>>> there any other parameters that I can tweak to increase DNS lookup >>>> speed ? >>> >>> There seems to be an undocumented? kernel configuration parameter >>> 'gethost_poolsize'::non_neg_integer() that specifies this. >>> >>> As an alternative to using the c resolver (the 'native' resolver) you >>> could use OTP's erlang DNS client - the 'dns' resolver. >>> >>> Specifying "{lookup, [dns]}." in your inetrc should do that (and erl >>> -kernel inetrc '"/some/path/inetrc"'). I don't think there's any >>> concurrency limit on it except the number of udp sockets you can open. >>> >> >> I tried to use your tip, but without success. Config file I wrote >> looks like this: >> >> {resolv_conf, "/etc/resolv.conf"}. >> {file, hosts, "/etc/hosts"}. >> {edns, 0}. >> {cache_size, 0}. >> {lookup, [dns]}. >> >> and was almost copy-pasted from this page: >> http://ftp.sunet.se/pub/lang/erlang/doc/apps/erts/inet_cfg.html (7.3 >> User Configuration Example). Nevertheless, >> when I tried to use it with an Erlang shell, I've got following weird >> error message: >> >> $ erl ?-kernel inetrc "'/home/kvs/.erl_inetrc'" >> {error_logger,{{2010,3,2},{23,40,21}},"inet_config: syntax error in >> ~s~n",['/home/kvs/.erl_inetrc']} >> Erlang (BEAM) emulator version 5.6.5 [source] [64-bit] [smp:2] >> [async-threads:0] [hipe] [kernel-poll:false] > > You're using Erlang/OTP R12B5, the edns option was only introduced in > R13 I think. If you drop the 'edns' option it should work in R12. > No, it doesn't :( -- Konstantin Sorokin From vladdu55@REDACTED Tue Mar 2 22:46:16 2010 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 2 Mar 2010 22:46:16 +0100 Subject: Doc update regarding source files not being UTF-8 Message-ID: <95be1d3b1003021346j240f8532ib11d7606dda6bf6b@mail.gmail.com> Hi! I think it would be a good idea if the introduction chapter in the reference manual, in the "Character set" section, would note specifically that even the comments in the source code can't contain UTF-8 characters because the lexical scanner doesn't understand them. Well, they might contain them but will be garbled if processed by any source tool (like for example syntax_tools) because Latin-1 and UTF-8 aren't compatible. The Eclipse editor will even refuse to save files with UTF-8 (so that they don't get garbled). If you think that it's a good idea to mention that too, please do so. I couldn't come up with a nice way to express this clearly, so there is no patch. best regards, Vlad From rickard@REDACTED Tue Mar 2 22:54:44 2010 From: rickard@REDACTED (Rickard Green) Date: Tue, 2 Mar 2010 22:54:44 +0100 Subject: [erlang-questions] Cross compiling R13B04 for MIPS CPU running linux works In-Reply-To: <20100301144919.GA31133@corelatus.se> References: <20100301144919.GA31133@corelatus.se> Message-ID: <10d7e35f1003021354y3d914719x8e9534feff4f0076@mail.gmail.com> 2010/3/1 Matthias Lang : > Hi, > > R13B04 has brand-new support for cross-compiling. Big thanks to > Rickard Green for tackling that ugly job. > > Compiling R13B for a MIPS-32 big endian CPU running linux worked first > try (!), all I did was make an erl-xcomp file with three lines changed > from the template: > > ?erl_xcomp_build=guess > ?erl_xcomp_host=mips-linux > ?CFLAGS=-Os > Always nice to hear that it works. > Questions: > > ?1. Do you want the erl-xcomp file I made? > > ? ? On one hand: I don't know of anyone else running Erlang on that > ? ? CPU (an Au1000, which runs the control system on Corelatus' GTH > ? ? hardware). > > ? ? On the other hand: the next person with a weird target would probably > ? ? be happy to see that they're not setting off into "only OTP have > ? ? done this" territory. > Yes, please. I think it's good with example configurations that people can have a look at when creating their own configurations. > ?2. On targets where disk space is precious, it's nice if the .beams > ? ? are compressed. On earlier releases, I did that that by including > ? ? +compressed in ERL_COMPILE_FLAGS (by patching the makefile). > > ? ? Is there a better way to do that now? > > ? ? I had a quick look, couldn't find one, thought I'd ask before > ? ? I invent my own method, possibly putting the .beams in an archive > ? ? while I'm at it. > I haven't looked at this, but this is of course interesting for small embedded systems. I had a look in beam_lib and it seems that the strip_release/1 function also compresses the result, so invoking the following after building the system should get you a slim system: $ERL_TOP/bootstrap/bin/erl -noshell -noinput -eval "beam_lib:strip_release(\"$ERL_TOP\"),init:stop()" This will however remove the debug info too, which perhaps isn't what you wanted. I think it would be nice to be able to add the +compressed flag without having to patch the makefiles, so I'll try to have a look at it before R14. Regards, Rickard > Matt > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From watson.timothy@REDACTED Tue Mar 2 22:55:28 2010 From: watson.timothy@REDACTED (Tim Watson) Date: Tue, 2 Mar 2010 21:55:28 +0000 Subject: EPM - an Erlang package manager In-Reply-To: <9B0ED8AE-B94E-4FFF-81CD-591BC26F042F@gmail.com> References: <1267489689.12071.ezmlm@erlang.org> <9B0ED8AE-B94E-4FFF-81CD-591BC26F042F@gmail.com> Message-ID: <70834010-014D-4A41-8953-E6C43365FFC1@gmail.com> > Love it. Generating at least skeletons for release scripts and other otp packaging noise would be nice, but I get why that's not a high priority. Obviously using other repositories besides github would be nice - perhaps an abstracted API so people can easily write plugins to get distributions from other scm/repository sources? It would be extremely cool if it would by default, instead of running Make, glob together all the .erl (and similar) files and generate an Emakefile pointing to the (configurable) ebin directory, then run make:all() on it and (optionally) remove the file after. That way I don't have to write a Makefile unless I actually need one - just an app file will do. An perhaps defaulting `epm test' to fire up ct_run or eunit would be nice too? This gives you the whole feeling you get with maven of "the tool understands my project structure" - except that epm is infinitely nicer than maven because it's not over complicated. > > On 2 Mar 2010, at 00:28, erlang-questions-digest-help@REDACTED wrote: > >> EPM - an Erlang package manager > From yg@REDACTED Tue Mar 2 23:30:29 2010 From: yg@REDACTED (Yuri Ginsburg) Date: Tue, 2 Mar 2010 14:30:29 -0800 Subject: [erlang-questions] Number of dns resolvers In-Reply-To: <9dfb3ec1003021320y9245dcej5d53dddd89cd4932@mail.gmail.com> References: <9dfb3ec1003011143y1b07c524u6ca89e0d774cbbec@mail.gmail.com> <9dfb3ec1003021244i2f5bfd25v44e0e63ed9063de0@mail.gmail.com> <9dfb3ec1003021320y9245dcej5d53dddd89cd4932@mail.gmail.com> Message-ID: <7add27fb1003021430k39f97d53saf1e0b418dd1afd1@mail.gmail.com> That's the line: {resolv_conf, "/etc/resolv.conf"} that causes syntax error on R12... but is OK in R13.. -- YG10 Yuri Ginsburg On Tue, Mar 2, 2010 at 1:20 PM, Konstantin Sorokin wrote: > On Wed, Mar 3, 2010 at 12:18 AM, Geoff Cant wrote: > > Konstantin Sorokin writes: > > > >> On Tue, Mar 2, 2010 at 12:24 AM, Geoff Cant wrote: > >>> Konstantin Sorokin writes: > >>> > >>>> Hello! > >>>> > >>>> How do I control number of dns resolvers in Erlang VM ? As far as I > >>>> can see by default there are only 4 DNS resolvers (inet_gethost port > >>>> processes) and if my app performs massive DNS lookups in many parallel > >>>> processes then I probably should increase that number, right ? Are > >>>> there any other parameters that I can tweak to increase DNS lookup > >>>> speed ? > >>> > >>> There seems to be an undocumented? kernel configuration parameter > >>> 'gethost_poolsize'::non_neg_integer() that specifies this. > >>> > >>> As an alternative to using the c resolver (the 'native' resolver) you > >>> could use OTP's erlang DNS client - the 'dns' resolver. > >>> > >>> Specifying "{lookup, [dns]}." in your inetrc should do that (and erl > >>> -kernel inetrc '"/some/path/inetrc"'). I don't think there's any > >>> concurrency limit on it except the number of udp sockets you can open. > >>> > >> > >> I tried to use your tip, but without success. Config file I wrote > >> looks like this: > >> > >> {resolv_conf, "/etc/resolv.conf"}. > >> {file, hosts, "/etc/hosts"}. > >> {edns, 0}. > >> {cache_size, 0}. > >> {lookup, [dns]}. > >> > >> and was almost copy-pasted from this page: > >> http://ftp.sunet.se/pub/lang/erlang/doc/apps/erts/inet_cfg.html (7.3 > >> User Configuration Example). Nevertheless, > >> when I tried to use it with an Erlang shell, I've got following weird > >> error message: > >> > >> $ erl -kernel inetrc "'/home/kvs/.erl_inetrc'" > >> {error_logger,{{2010,3,2},{23,40,21}},"inet_config: syntax error in > >> ~s~n",['/home/kvs/.erl_inetrc']} > >> Erlang (BEAM) emulator version 5.6.5 [source] [64-bit] [smp:2] > >> [async-threads:0] [hipe] [kernel-poll:false] > > > > You're using Erlang/OTP R12B5, the edns option was only introduced in > > R13 I think. If you drop the 'edns' option it should work in R12. > > > > No, it doesn't :( > > -- > Konstantin Sorokin > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From kvs@REDACTED Tue Mar 2 23:41:55 2010 From: kvs@REDACTED (Konstantin Sorokin) Date: Wed, 3 Mar 2010 01:41:55 +0300 Subject: [erlang-questions] Number of dns resolvers In-Reply-To: <7add27fb1003021430k39f97d53saf1e0b418dd1afd1@mail.gmail.com> References: <9dfb3ec1003011143y1b07c524u6ca89e0d774cbbec@mail.gmail.com> <9dfb3ec1003021244i2f5bfd25v44e0e63ed9063de0@mail.gmail.com> <9dfb3ec1003021320y9245dcej5d53dddd89cd4932@mail.gmail.com> <7add27fb1003021430k39f97d53saf1e0b418dd1afd1@mail.gmail.com> Message-ID: <9dfb3ec1003021441n7922f5afpafb0a187344dc0f9@mail.gmail.com> On Wed, Mar 3, 2010 at 1:30 AM, Yuri Ginsburg wrote: > That's the line: > {resolv_conf, "/etc/resolv.conf"} > that causes syntax error on R12... but is OK in R13.. No. At least it is not true for Erlang R13B0, which is shipped with fedora 12 [kvs@REDACTED ~]$ cat /home/kvs/.erl_inetrc %{file, resolv, "/etc/resolv.conf"}. {resolv_conf, "/etc/resolv.conf"}. {file, hosts, "/etc/hosts"}. {cache_size, 0}. {lookup, [dns]}. [kvs@REDACTED ~]$ erl -kernel inetrc "'/home/kvs/.erl_inetrc'" {error_logger,{{2010,3,3},{1,39,57}},"inet_config: syntax error in ~s~n",['/home/kvs/.erl_inetrc']} Erlang R13B01 (erts-5.7.2) [source] [rq:1] [async-threads:0] [hipe] [kernel-poll:false] =ERROR REPORT==== 3-Mar-2010::01:39:57 === inet_config: syntax error in /home/kvs/.erl_inetrc Eshell V5.7.2 (abort with ^G) 1> [kvs@REDACTED ~]$ rpm -qa | grep erlang erlang-R13B-01.3.fc12.i686 -- Konstantin Sorokin From jacob.vorreuter@REDACTED Wed Mar 3 00:10:55 2010 From: jacob.vorreuter@REDACTED (Jacob Vorreuter) Date: Tue, 2 Mar 2010 15:10:55 -0800 Subject: [erlang-questions] EPM - an Erlang package manager In-Reply-To: References: Message-ID: Homebrew is cool, but it's exclusive to OS X. Also, rather than creating a homebrew script for each project, many projects work out of the box with EPM. There are features of Homebrew that I like (for instance symlinking versions of projects) that may be beneficial if added to EPM. On Mon, Mar 1, 2010 at 1:30 AM, Max Lapshin wrote: > Have you looked at homebrew? I like this idea very much: github repo > is a storage of all possible custom scripts. You shouldn't ask anybody > to adopt your packaging system, just write proper scripts for several > packages you need and than just approve patches from github forks. > From jacob.vorreuter@REDACTED Wed Mar 3 00:20:40 2010 From: jacob.vorreuter@REDACTED (Jacob Vorreuter) Date: Tue, 2 Mar 2010 15:20:40 -0800 Subject: [erlang-questions] EPM - an Erlang package manager In-Reply-To: <14f0e3621003020519n6c8790camd3c9d80565bebbc9@mail.gmail.com> References: <14f0e3621003020519n6c8790camd3c9d80565bebbc9@mail.gmail.com> Message-ID: 1) Packages in the epm repo must be updated manually. 2) I'm going to add support for BitBucket shortly. On Tue, Mar 2, 2010 at 5:19 AM, Gleb Peregud wrote: > I've got two questions: > > 1) Are packages in EPM repo (github.com/epm/) automatically updated > somehow? > 2) What kind of alternative repositories (i.e. not github) are you > considering to support? > > Best, > Gleb > > On Mon, Mar 1, 2010 at 10:09, Jacob Vorreuter > wrote: > > I've recently been working on a RubyGems-style package manager for Erlang > and would like to hear people's thoughts/criticisms. > > > > There's nothing to install. You simply download the EPM escript. It uses > GitHub as its package repository. > > > > This is meant mainly for development purposes and does not deal with > packaging or deploying OTP releases. > > > > You can read my post about it here: > http://jkvor.com/erlang-package-manager > > The executable is available here: http://github.com/JacobVorreuter/epm > > > > I'd be interested to hear suggestions of how to make this a more useful > tool. > > > > Thanks, > > > > Jake > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > See http://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > > > > From watson.timothy@REDACTED Wed Mar 3 01:41:45 2010 From: watson.timothy@REDACTED (Tim Watson) Date: Wed, 3 Mar 2010 00:41:45 +0000 Subject: EPM - an Erlang package manager In-Reply-To: <1688417E-82D1-450F-A10C-BADFF60D5625@gmail.com> References: <1267489689.12071.ezmlm@erlang.org> <9B0ED8AE-B94E-4FFF-81CD-591BC26F042F@gmail.com> <1688417E-82D1-450F-A10C-BADFF60D5625@gmail.com> Message-ID: On 3 Mar 2010, at 00:38, Tim Watson wrote: > Didn't know about that one, thanks Jacob. Presumably one could pull sources from github and automatically compile them (assuming a standard Erlang/OTP project structure is in place) by running ` install --build-command "rebar compile"' then. > > On 3 Mar 2010, at 00:13, Jacob Vorreuter wrote: > >> Tim, >> >> You should look at rebar (http://bitbucket.org/dizzyd/rebar) if you haven't already. It does basically what you are describing. You run `rebar compile` in the root directory of an OTP app and it compiles everything for you. At some point I'd like to add support into EPM for building projects with rebar. >> >> On Tue, Mar 2, 2010 at 1:42 PM, Tim Watson wrote: >> Love it. Generating at least skeletons for release scripts and other otp packaging noise would be nice, but I get why that's not a high priority. Obviously using other repositories besides github would be nice - perhaps an abstracted API so people can easily write plugins to get distributions from other scm/repository sources? It would be extremely cool if it would by default, instead of running Make, glob together all the .erl (and similar) files and generate an Emakefile pointing to the (configurable) ebin directory, then run make:all() on it and (optionally) remove the file after. That way I don't have to write a Makefile unless I actually need one - just an app file will do. An perhaps defaulting `epm test' to fire up ct_run or eunit would be nice too? This gives you the whole feeling you get with maven of "the tool understands my project structure" - except that epm is infinitely nicer than maven because it's not over complicated. >> >> On 2 Mar 2010, at 00:28, erlang-questions-digest-help@REDACTED wrote: >> >> > EPM - an Erlang package manager >> >> > From navaneethanit@REDACTED Wed Mar 3 06:12:58 2010 From: navaneethanit@REDACTED (NavTux) Date: Tue, 2 Mar 2010 21:12:58 -0800 (PST) Subject: 4 questions for my app Message-ID: <981a1cbd-5dbf-453f-b684-2effb626ff1f@z10g2000prh.googlegroups.com> I need to do a erlang chat application to show the performance Basically I should know the basic things to do 1.What are the tools to use? 2.What are the modules i need to have? 3.How many days i have to take? 4.Finally How should it contailn? I am having these questions in my mind steadily,but as well as i should know the answers soon to start my contribution can you help me?? From navaneethanit@REDACTED Wed Mar 3 06:15:50 2010 From: navaneethanit@REDACTED (NavTux) Date: Tue, 2 Mar 2010 21:15:50 -0800 (PST) Subject: install mochiweb Message-ID: <0be86d11-6f0c-4e21-b952-81be4c532fb9@f17g2000prh.googlegroups.com> I wanna the detail information about installing mochiweb in ubuntu and fedora for contributing a web application,I took some information but i was not understand of it...please can you give me the steps to install mochiweb and how to start a to develop my application using it? From kostis@REDACTED Wed Mar 3 07:41:49 2010 From: kostis@REDACTED (Kostis Sagonas) Date: Wed, 03 Mar 2010 08:41:49 +0200 Subject: [erlang-questions] Dialyzer bug with 'not (boolexpr)' guard In-Reply-To: <201002111005.o1BA51Cf049896@pluto.hedeland.org> References: <201002111005.o1BA51Cf049896@pluto.hedeland.org> Message-ID: <4B8E04AD.4020606@cs.ntua.gr> Per Hedeland wrote: > Hi, > > I believe the code below demonstrates a bug in dialyzer (2.1.0) - it > produces the warning: > > diabug.erl:19: Clause guard cannot succeed. The variable Cs was matched against the type any() > > for the first test/1 clause, ... For the record, let me mention that this particular bug (also present in dialyzer 2.2.0) has been fixed. The fix will appear in R14 and in its dev branch in the git repository. Thanks for the report, Kostis From lloy0076@REDACTED Wed Mar 3 06:33:38 2010 From: lloy0076@REDACTED (David Lloyd) Date: Wed, 03 Mar 2010 16:03:38 +1030 Subject: [erlang-questions] 4 questions for my app In-Reply-To: <981a1cbd-5dbf-453f-b684-2effb626ff1f@z10g2000prh.googlegroups.com> References: <981a1cbd-5dbf-453f-b684-2effb626ff1f@z10g2000prh.googlegroups.com> Message-ID: <1267594418.27494.4.camel@isengaard> Can you lean upon the work of giants, for exampe, Facebook? Search for "Erlang Facebook" for a presentation by Eugene Letuchy. DSL -----Original Message----- From: NavTux To: erlang-questions@REDACTED Subject: [erlang-questions] 4 questions for my app Date: Tue, 2 Mar 2010 21:12:58 -0800 (PST) I need to do a erlang chat application to show the performance Basically I should know the basic things to do 1.What are the tools to use? 2.What are the modules i need to have? 3.How many days i have to take? 4.Finally How should it contailn? I am having these questions in my mind steadily,but as well as i should know the answers soon to start my contribution can you help me?? ________________________________________________________________ erlang-questions (at) erlang.org mailing list. See http://www.erlang.org/faq.html To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED From vinoski@REDACTED Wed Mar 3 19:39:44 2010 From: vinoski@REDACTED (Steve Vinoski) Date: Wed, 3 Mar 2010 13:39:44 -0500 Subject: [erlang-questions] Cross compiling R13B04 for MIPS CPU running linux works In-Reply-To: <10d7e35f1003021354y3d914719x8e9534feff4f0076@mail.gmail.com> References: <20100301144919.GA31133@corelatus.se> <10d7e35f1003021354y3d914719x8e9534feff4f0076@mail.gmail.com> Message-ID: <65b2728e1003031039w3e6e026cx734244c1640416b2@mail.gmail.com> On Tue, Mar 2, 2010 at 4:54 PM, Rickard Green wrote: > > I had a look in beam_lib and it seems that the strip_release/1 > function also compresses the result, so invoking the following after > building the system should get you a slim system: > $ERL_TOP/bootstrap/bin/erl -noshell -noinput -eval > "beam_lib:strip_release(\"$ERL_TOP\"),init:stop()" > This is exactly what I do for my embedded cross-builds and it works great. --steve From clist@REDACTED Wed Mar 3 19:53:31 2010 From: clist@REDACTED (Angel) Date: Wed, 3 Mar 2010 19:53:31 +0100 Subject: [erlang-questions] install mochiweb In-Reply-To: <0be86d11-6f0c-4e21-b952-81be4c532fb9@f17g2000prh.googlegroups.com> References: <0be86d11-6f0c-4e21-b952-81be4c532fb9@f17g2000prh.googlegroups.com> Message-ID: <201003031953.31391.clist@uah.es> On Mi?rcoles, 3 de Marzo de 2010 06:15:50 NavTux escribi?: > I wanna the detail information about installing mochiweb in > ubuntu and fedora for contributing a web application,I took some > information but i was not understand of it...please can you give me > the steps to install mochiweb and how to start a to develop my > application using it? > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > Did you look at the mail archives? A few days ago was posted a interesting video about making a mochiweb app with erlware tools. You can follow the video at: http://www.youtube.com/watch?v=XI7S2NwFPOE /Angel Most people know C is not so high level.... ...Everybody else just got assembler overdose From clist@REDACTED Wed Mar 3 19:55:33 2010 From: clist@REDACTED (Angel) Date: Wed, 3 Mar 2010 19:55:33 +0100 Subject: [erlang-questions] 4 questions for my app In-Reply-To: <981a1cbd-5dbf-453f-b684-2effb626ff1f@z10g2000prh.googlegroups.com> References: <981a1cbd-5dbf-453f-b684-2effb626ff1f@z10g2000prh.googlegroups.com> Message-ID: <201003031955.33990.clist@uah.es> On Mi?rcoles, 3 de Marzo de 2010 06:12:58 NavTux escribi?: > I need to do a erlang chat application to show the performance > > Basically I should know the basic things to do > > 1.What are the tools to use? > > 2.What are the modules i need to have? > > 3.How many days i have to take? > > 4.Finally How should it contailn? > > > I am having these questions in my mind steadily,but as well as i > should know the answers soon to start my contribution can you help me?? > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > Just search the pargmatic programmers web site, there are a serie of webcasts on making a chat applicantion, i cant remeber the link but googlw is your friend ;-) /Angel Most people know C is not so high level.... ...Everybody else just got assembler overdose From clist@REDACTED Wed Mar 3 20:27:41 2010 From: clist@REDACTED (Angel) Date: Wed, 3 Mar 2010 20:27:41 +0100 Subject: advices for itanium compilation Message-ID: <201003032027.41670.clist@uah.es> Hi, Some mates allowed me to play with erlang on a 16 CPU SGI itanium with Red Hat Advanced server (SGI propack something). ?where can i pick a suitable rpm for this beast? Can i rebuild a normal source rpm for Redhat AS on itanium or i have to make some croscompile...? Thanks in advance Angel Most people know C is not so high level.... ...Everybody else just got assembler overdose From mikpe@REDACTED Wed Mar 3 21:21:52 2010 From: mikpe@REDACTED (Mikael Pettersson) Date: Wed, 3 Mar 2010 21:21:52 +0100 Subject: [erlang-questions] advices for itanium compilation In-Reply-To: <201003032027.41670.clist@uah.es> References: <201003032027.41670.clist@uah.es> Message-ID: <19342.50400.390695.315472@pilspetsen.it.uu.se> Angel wrote: > Some mates allowed me to play with erlang on a 16 CPU SGI > itanium with Red Hat Advanced server (SGI propack something). > > where can i pick a suitable rpm for this beast? > > Can i rebuild a normal source rpm for Redhat AS on itanium or i have to > make some croscompile...? That box should be plenty powerful enough to build Erlang natively without any cross-compilation. As for src rpms, RH AS is AFAIK fairly old so I wouldn't expect a src rpm tuned for e.g. Fedora to work as-is. Why not just download the otp_src tarball, unpack it, and build it normally? (./configure; make) From chris.duesing@REDACTED Wed Mar 3 21:37:06 2010 From: chris.duesing@REDACTED (Chris Duesing) Date: Wed, 3 Mar 2010 14:37:06 -0600 Subject: Is gen_server handle_info synchronous? Message-ID: I am working on some code that connects to a streaming data service via gen_tcp:connect(). I am doing this from inside a gen_server to benefit from OTP goodness. But, since it didn't seem to fit the paradigm to have an infinite loop of reading from the socket with recv, I left it as {active, once} and use handle_info to receive blocks of data. Whenever I receive an incomplete message in handle_info I just add it to the state, and then prepend it to the data I receive the next time handle_info is called. Once I started testing this code I am seeing that the data saved in the state is not available the next time handle_info is called. I guess I assumed that the gen_server would complete requests serially, is this not the case or am I missing something? Thanks, Chris From koops.j@REDACTED Wed Mar 3 21:57:01 2010 From: koops.j@REDACTED (Jeroen Koops) Date: Wed, 3 Mar 2010 21:57:01 +0100 Subject: [erlang-questions] Is gen_server handle_info synchronous? In-Reply-To: References: Message-ID: <331a9abb1003031257m6dec7fc4g94de798b735a9cbf@mail.gmail.com> Hi Chris, As far as I can tell, you're doing it right - handle_info is invoked synchronously (as are all gen_server's callbacks) and data saved in the state on one invocation to handle_info is available on a subsequent invocation. So the problem must be elsewhere - if you can share some of your source-code, maybe we can help. On Wed, Mar 3, 2010 at 9:37 PM, Chris Duesing wrote: > I am working on some code that connects to a streaming data service > via gen_tcp:connect(). I am doing this from inside a gen_server to > benefit from OTP goodness. But, since it didn't seem to fit the > paradigm to have an infinite loop of reading from the socket with > recv, I left it as {active, once} and use handle_info to receive > blocks of data. Whenever I receive an incomplete message in > handle_info I just add it to the state, and then prepend it to the > data I receive the next time handle_info is called. Once I started > testing this code I am seeing that the data saved in the state is not > available the next time handle_info is called. I guess I assumed that > the gen_server would complete requests serially, is this not the case > or am I missing something? > > Thanks, > > Chris > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From chris.duesing@REDACTED Wed Mar 3 22:03:48 2010 From: chris.duesing@REDACTED (Chris Duesing) Date: Wed, 3 Mar 2010 15:03:48 -0600 Subject: [erlang-questions] Is gen_server handle_info synchronous? In-Reply-To: <331a9abb1003031257m6dec7fc4g94de798b735a9cbf@mail.gmail.com> References: <331a9abb1003031257m6dec7fc4g94de798b735a9cbf@mail.gmail.com> Message-ID: Ok, thanks, that makes sense. It is obviously just an error in my code then. I am sure I will be able to figure it out, but if you are curious here is the link. I wasn't able to find any examples of how to process streaming messages over tcp, so hopefully my approach isn't too naive. http://github.com/chrisduesing/iRLpact/blob/master/src/irlpact_connector.erl On Wed, Mar 3, 2010 at 2:57 PM, Jeroen Koops wrote: > Hi Chris, > As far as I can tell, you're doing it right - handle_info is invoked > synchronously (as are all gen_server's callbacks) and data saved in the > state on one invocation to handle_info is available on a subsequent > invocation. So the problem must be elsewhere - if you can share some of your > source-code, maybe we can help. > > > On Wed, Mar 3, 2010 at 9:37 PM, Chris Duesing > wrote: >> >> I am working on some code that connects to a streaming data service >> via gen_tcp:connect(). I am doing this from inside a gen_server to >> benefit from OTP goodness. But, since it didn't seem to fit the >> paradigm to have an infinite loop of reading from the socket with >> recv, I left it as {active, once} and use handle_info to receive >> blocks of data. Whenever I receive an incomplete message in >> handle_info I just add it to the state, and then prepend it to the >> data I receive the next time handle_info is called. Once I started >> testing this code I am seeing that the data saved in the state is not >> available the next time handle_info is called. I guess I assumed that >> the gen_server would complete requests serially, is this not the case >> or am I missing something? >> >> Thanks, >> >> Chris >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED >> > > From chris.duesing@REDACTED Wed Mar 3 22:30:57 2010 From: chris.duesing@REDACTED (Chris Duesing) Date: Wed, 3 Mar 2010 15:30:57 -0600 Subject: [erlang-questions] Is gen_server handle_info synchronous? In-Reply-To: <948873.95180.qm@web35906.mail.mud.yahoo.com> References: <948873.95180.qm@web35906.mail.mud.yahoo.com> Message-ID: Yep, it was a bad code path. If a single hunk of data had more than one message, the last one was incomplete, and there was no listeners then the state wasn't getting updated. -notify(Listener, [{message, Message} | Messages]) when is_pid(Listener) -> - Listener ! Message, +notify(Listener, [{message, Message} | Messages]) -> + if is_pid(Listener) -> + Listener ! Message; + true -> + ok + end, notify(Listener, Messages); oops. Thanks for the help everyone! Chris On Wed, Mar 3, 2010 at 3:05 PM, Andrew Stone wrote: > What you describe is exactly how a gen_server should work. It retrieves requests off the queue serially. > > My only guess is that you aren't returning the *new* state in the second parameter of the return value from handle_info/2. Remember data is immutable in erlang and that state parameter is not global. > > You need to do something like this: > > handle_info(Info, State) -> > ? ? ? ?NewState = [State | Info], > ? ?{noreply, NewState}. > > -Andrew > > > > > ----- Original Message ---- > From: Chris Duesing > To: erlang-questions@REDACTED > Sent: Wed, March 3, 2010 3:37:06 PM > Subject: [erlang-questions] Is gen_server handle_info synchronous? > > I am working on some code that connects to a streaming data service > via gen_tcp:connect(). I am doing this from inside a gen_server to > benefit from OTP goodness. But, since it didn't seem to fit the > paradigm to have an infinite loop of reading from the socket with > recv, I left it as {active, once} and use handle_info to receive > blocks of data. Whenever I receive an incomplete message in > handle_info I just add it to the state, and then prepend it to the > data I receive the next time handle_info is called. Once I started > testing this code I am seeing that the data saved in the state is not > available the next time handle_info is called. I guess I assumed that > the gen_server would complete requests serially, is this not the case > or am I missing something? > > Thanks, > > Chris > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > From antoine.koener@REDACTED Thu Mar 4 02:35:12 2010 From: antoine.koener@REDACTED (Koener Antoine) Date: Thu, 4 Mar 2010 02:35:12 +0100 Subject: [erlang-questions] On Windows XP (SP2): wx broken In-Reply-To: References: Message-ID: <9C6B96B5-37FA-4CF6-A7D3-663736CEE916@gmail.com> I have exactly the same problem. But for WinXP SP3 I can't make wx work with newer version than R13B02. But, while debugging the werl.exe with Windbg sometimes the wx:new(), works ... And when it fails it's in a call of RtlEnterCriticalSection or something like this... Last, if you want to know the real VC++ needed you can open the wxe_driver.dll and search for its "manifest" (it's at the end of the file) you'll find the real version that is needed... On Mar 2, 2010, at 08:05 , MapAndFold wrote: > From R13B03 and on, wx can't run on my Windows XP (SP2) box. While on > the same machine, elder versions are OK. > > I have checked wxe_driver.dll with MS Depends, and installed VC2005 > runtime DLL of different built numbers (8.0.50727.762, 8.0.50727.1433, > 8.0.50727.4053, etc), but it's still broken. > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > From kenji.rikitake@REDACTED Thu Mar 4 03:25:53 2010 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Thu, 4 Mar 2010 11:25:53 +0900 Subject: [erlang-questions] dns server In-Reply-To: <4B8B0325.7070101@joetify.com> References: <4B88DF87.5000208@joetify.com> <4B8B0325.7070101@joetify.com> Message-ID: <20100304022553.GA48853@k2r.org> Kota Uenishi releases a DNS cache called bine: http://bitbucket.org/kuenishi/bine/src/ I wonder, however, what means the *decent server*, for now, at the coming age of DNSSEC. Implementing DNSSEC validation is a huge task and the situation is unstable. And DNS software has three roles: * authoritative server * cache * stub resolver What does the server do? Kenji Rikitake (who's got his nervous wreck many times dealing with the cloud monster called DNS) In the message <4B8B0325.7070101@REDACTED> dated Sun, Feb 28, 2010 at 03:58:05PM -0800, Joe Williams writes: > Anyone have any suggestions? Bueller? > > -Joe > > > On 2/27/10 1:01 AM, Joe Williams wrote: > > > >Anyone know of a decent OSS DNS server implementation in Erlang? I > >found http://code.google.com/p/erldir/ and > >http://eddie.sourceforge.net/ but they are both out of date and no > >longer maintained it seems. > > > >Thanks for any suggestions. > > > >-Joe > > From kenji.rikitake@REDACTED Thu Mar 4 03:45:22 2010 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Thu, 4 Mar 2010 11:45:22 +0900 Subject: [erlang-questions] Tokyo Erlang Workshop #4, 7pm tonight, at Oracle Japan meeting room (Gaienmae, Tokyo, Japan) In-Reply-To: <20100226041114.GA34463@k2r.org> References: <20100226041114.GA34463@k2r.org> Message-ID: <20100304024522.GA49398@k2r.org> I had a question about Tokyo Erlang Workshop #4 + Erlounge. Here's the summary. (26-FEB-2010 7pm-9pm at Gaienmae, Tokyo, Japan) The meeting was very good. 5 notable talks other than mine. Attendance: 60 to 70 people. Erlounge attendance: 20 to 30 people. Meeting venue: Oracle Japan Center. Erlounge venue: local cafe very close to the meeting venue. Notable speakers (except me, talked about sshrpc): @higepon in Twitter, aka Taro Minowa, of Cybozu Labs (one of very few eccentric but very interesting corporate labs in Japan), presented his Erlang implementation of skip lists, called mio (at GitHub). He has already written the English slides for mio, so I strongly suggested him to submit a talk to Erlang Factory London or Erlang User Conference in Stockholm this year. @cooldaemon in Twitter, aka Masahito Ikuta, who presented RabbitMQ tips and hacks, made the local arrangement work. He also runs a workshop for Erlang beginners and very enthusiastic. @takemaru_jp in Twitter, aka Takeru Inoue, a PhD researcher in NTT, presented the basics on distributed file system algorithms. He is a principal developer of Kai (at GitHub). He is now focusing on Web authentication, similar to OAuth or OpenID. @voluntas in Twitter, aka Ryosuke Nakai, who is building network authentication software at Accense Technology, presented a talk about OMake (Ocaml's kitbuilding software). He actually uses Erlang for his business. He has been enthusiastically supporting Erlang activities in Japan. @kuenishi in Twitter, aka Kota Uenishi, is also a researcher in NTT. This time he presented how to provide a fast I/O in Erlang with NIF, linked-in driver, or port driver. All of the above five developers/activists will respond well in English if you send them questions. Regards, Kenji Rikitake From steven.charles.davis@REDACTED Thu Mar 4 07:01:29 2010 From: steven.charles.davis@REDACTED (Steve Davis) Date: Wed, 3 Mar 2010 22:01:29 -0800 (PST) Subject: On Windows XP (SP2): wx broken In-Reply-To: <9C6B96B5-37FA-4CF6-A7D3-663736CEE916@gmail.com> References: <9C6B96B5-37FA-4CF6-A7D3-663736CEE916@gmail.com> Message-ID: <69869ad8-a27a-48e6-8835-8303a87ed40d@g11g2000yqe.googlegroups.com> FWIW, I have not had any issues with wx on Win XP/SP3 since the very early days. When you start your instance of (w)erl, are you certain that you are using the -smp enable flag? You very probably are, but it's possible you have overlooked it and wx will certainly fail without it. Best regards, Steve On Mar 3, 7:35?pm, Koener Antoine wrote: > I have exactly the same problem. > But for WinXP SP3 > > I can't make wx work with newer version than R13B02. From dangud@REDACTED Thu Mar 4 07:20:33 2010 From: dangud@REDACTED (Dan Gudmundsson) Date: Thu, 4 Mar 2010 07:20:33 +0100 Subject: [erlang-questions] Re: On Windows XP (SP2): wx broken In-Reply-To: <69869ad8-a27a-48e6-8835-8303a87ed40d@g11g2000yqe.googlegroups.com> References: <9C6B96B5-37FA-4CF6-A7D3-663736CEE916@gmail.com> <69869ad8-a27a-48e6-8835-8303a87ed40d@g11g2000yqe.googlegroups.com> Message-ID: <93df43b61003032220m5b4d396dn4aca92270134d795@mail.gmail.com> Are you running it from werl? erl and wxwidgets seems to be fighting for stdio, so it needs to be run from werl or erl -detached -s wx demo /Dan On Thu, Mar 4, 2010 at 7:01 AM, Steve Davis wrote: > > FWIW, I have not had any issues with wx on Win XP/SP3 since the very > early days. > > When you start your instance of (w)erl, are you certain that you are > using the -smp enable flag? > > You very probably are, but it's possible you have overlooked it and wx > will certainly fail without it. > > Best regards, > Steve > > On Mar 3, 7:35?pm, Koener Antoine wrote: >> I have exactly the same problem. >> But for WinXP SP3 >> >> I can't make wx work with newer version than R13B02. > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From dujinfang@REDACTED Thu Mar 4 08:36:47 2010 From: dujinfang@REDACTED (Seven Du) Date: Thu, 4 Mar 2010 15:36:47 +0800 Subject: How to tell epmd to release a name rigsitered but not valid any more? Message-ID: <23f91031003032336v4d9bea58vc506210697af61ff@mail.gmail.com> Hi, It is noticed that sometime when an erlang app crashes the empd daemon still hold the node name, then the crashed app cannot restart with the same name. Though kill epmd solves this problem, it is not a good practice when many erlang apps runs on the same server. epmd seems only has epmd -names to list all registered nodes, is there a way to unregister a name from epmd? Thanks. From sysop@REDACTED Thu Mar 4 09:17:03 2010 From: sysop@REDACTED (Matt Stancliff) Date: Thu, 4 Mar 2010 00:17:03 -0800 Subject: Announcing ErlCamp SF 2010 Message-ID: Fellow List Readers, I'm excited to announce ErlCamp SF 2010! ErlCamp is a free Erlang Unconference following Erlang Factory SF. When: Saturday, March 27, 2010. 9am to 6pm. Where: Hacker Dojo, Mountain View, CA, USA, North America Who: You and 199 of your closest Erlang friends Come join us in Mountain View for a day of participant-organized Erlang talks, discussions, and incredibly fun hackery. For details, signup, or sponsorship info: http://erlcamp.eventbrite.com/ For updates: http://twitter.com/erlcamp We look forward to seeing you in Mountain View at the end of the month! -Matt -- Matt Stancliff San Jose, CA AIM: seijimr iPhone: 678-591-9337 "The best way to predict the future is to invent it." --Alan Kay From navaneethanit@REDACTED Thu Mar 4 10:54:14 2010 From: navaneethanit@REDACTED (NavaTux) Date: Thu, 4 Mar 2010 01:54:14 -0800 (PST) Subject: 4 questions for my app In-Reply-To: <201003031955.33990.clist@uah.es> References: <981a1cbd-5dbf-453f-b684-2effb626ff1f@z10g2000prh.googlegroups.com> <201003031955.33990.clist@uah.es> Message-ID: <41292e59-6b98-40e4-ba58-a9e0f56564d1@a10g2000pri.googlegroups.com> ya fine,Is any frame work available to create a chat application, you had a way to do in your experience,I am expecting the way or the guidelines from you to start the application. From g9414002.pccu.edu.tw@REDACTED Thu Mar 4 12:22:17 2010 From: g9414002.pccu.edu.tw@REDACTED (=?UTF-8?B?6buD6ICA6LOiIChZYXUtSHNpZW4gSHVhbmcp?=) Date: Thu, 4 Mar 2010 19:22:17 +0800 Subject: [erlang-questions] Re: 4 questions for my app In-Reply-To: <41292e59-6b98-40e4-ba58-a9e0f56564d1@a10g2000pri.googlegroups.com> References: <981a1cbd-5dbf-453f-b684-2effb626ff1f@z10g2000prh.googlegroups.com> <201003031955.33990.clist@uah.es> <41292e59-6b98-40e4-ba58-a9e0f56564d1@a10g2000pri.googlegroups.com> Message-ID: A chat application made by Erlang programs, huh? I know EJabber that is an Erlang implementation of Jabber protocol. Reading its code may be as a start. On Thu, Mar 4, 2010 at 5:54 PM, NavaTux wrote: > ya fine,Is any frame work available to create a chat application, you > had a way to do in your experience,I am expecting the way or the > guidelines from you to start the application. > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From clist@REDACTED Thu Mar 4 13:15:20 2010 From: clist@REDACTED (Angel Alvarez) Date: Thu, 4 Mar 2010 13:15:20 +0100 Subject: [erlang-questions] advices for itanium compilation In-Reply-To: <19342.50400.390695.315472@pilspetsen.it.uu.se> References: <201003032027.41670.clist@uah.es> <19342.50400.390695.315472@pilspetsen.it.uu.se> Message-ID: <201003041315.20568.clist@uah.es> El Mi?rcoles, 3 de Marzo de 2010 21:21:52 Mikael Pettersson escribi?: > Angel wrote: > > Some mates allowed me to play with erlang on a 16 CPU SGI > > itanium with Red Hat Advanced server (SGI propack something). > > > > where can i pick a suitable rpm for this beast? > > > > Can i rebuild a normal source rpm for Redhat AS on itanium or i have to > > make some croscompile...? > > That box should be plenty powerful enough to build Erlang natively > without any cross-compilation. As for src rpms, RH AS is AFAIK fairly > old so I wouldn't expect a src rpm tuned for e.g. Fedora to work as-is. > > Why not just download the otp_src tarball, unpack it, and build it > normally? (./configure; make) > I managed to compile the tarball... but now it cant detect the cpu topology. erl Erlang R13B04 (erts-5.7.5) [source] [64-bit] [smp:12:12] [rq:12] [async-threads:0] [kernel-poll:false] Eshell V5.7.5 (abort with ^G) 1> erlang:system_info(cpu_topology). undefined 2> this machine has 6 bricks with two itanium 2 cpus per brick, but i cant figure how to spec the layout... L0c0p0,L1c0p1N0:L2c0p0,L3c0p1N1:L4c0p0,L5c0p1N2:L6c0p0,L7c0p1N3:L8c0p0,L9c0p1N4:L19c0p0,L11c0p1N5 this gets nothing... Anyone can help me Thanks!! -- No imprima este correo si no es necesario. El medio ambiente est? en nuestras manos. __________________________________________ Clist UAH a.k.a Angel __________________________________________ Primero vino el Navegador, luego fu? el explorador, ahora llega el Konquistador. From mikpe@REDACTED Thu Mar 4 13:59:18 2010 From: mikpe@REDACTED (Mikael Pettersson) Date: Thu, 4 Mar 2010 13:59:18 +0100 Subject: [erlang-questions] advices for itanium compilation In-Reply-To: <201003041315.20568.clist@uah.es> References: <201003032027.41670.clist@uah.es> <19342.50400.390695.315472@pilspetsen.it.uu.se> <201003041315.20568.clist@uah.es> Message-ID: <19343.44710.422511.157605@pilspetsen.it.uu.se> Angel Alvarez writes: > El Mi?rcoles, 3 de Marzo de 2010 21:21:52 Mikael Pettersson escribi?: > > Angel wrote: > > > Some mates allowed me to play with erlang on a 16 CPU SGI > > > itanium with Red Hat Advanced server (SGI propack something). > > > > > > where can i pick a suitable rpm for this beast? > > > > > > Can i rebuild a normal source rpm for Redhat AS on itanium or i have to > > > make some croscompile...? > > > > That box should be plenty powerful enough to build Erlang natively > > without any cross-compilation. As for src rpms, RH AS is AFAIK fairly > > old so I wouldn't expect a src rpm tuned for e.g. Fedora to work as-is. > > > > Why not just download the otp_src tarball, unpack it, and build it > > normally? (./configure; make) > > > > I managed to compile the tarball... but now it cant detect the cpu topology. > > erl > Erlang R13B04 (erts-5.7.5) [source] [64-bit] [smp:12:12] [rq:12] [async-threads:0] [kernel-poll:false] > > Eshell V5.7.5 (abort with ^G) > 1> erlang:system_info(cpu_topology). > undefined I'm assuming this runs RHEL 4 AS, in which case it's a 2.6.9-based kernel. Most likely that kernel doesn't present any cpu topology, or does it in a way incompatible with the /sys parsing code in erts/lib_src/common/erl_misc_utils.c. (Welcome to the /sys unstable ABI.) If it was me I'd upgrade the kernel ASAP to something less ancient, but I'm assuming you don't have the option to do that. > 2> > > this machine has 6 bricks with two itanium 2 cpus per brick, but i cant figure how to spec the layout... > > L0c0p0,L1c0p1N0:L2c0p0,L3c0p1N1:L4c0p0,L5c0p1N2:L6c0p0,L7c0p1N3:L8c0p0,L9c0p1N4:L19c0p0,L11c0p1N5 > > this gets nothing... I can't help you with that one. From martindemello@REDACTED Thu Mar 4 15:14:05 2010 From: martindemello@REDACTED (Martin DeMello) Date: Thu, 4 Mar 2010 19:44:05 +0530 Subject: file:read_file won't read from /proc Message-ID: Eshell V5.7.2 (abort with ^G) 1> {ok, F} = file:open("/proc/cpuinfo", [read]). {ok,<0.37.0>} 2> file:read(F, 100). {ok,"processor\t: 0\nvendor_id\t: GenuineIntel\ncpu family\t: 6\nmodel\t\t: 15\nmodel name\t: Intel(R) Core(TM)2 Du"} 3> file:close(F). ok 4> {ok, B} = file:read_file("/proc/cpuinfo"). {ok,<<>>} Why is B empty? martin From a.zhuravlev@REDACTED Thu Mar 4 15:44:22 2010 From: a.zhuravlev@REDACTED (Alexander Zhuravlev) Date: Thu, 4 Mar 2010 17:44:22 +0300 Subject: run reports incorrect match position Message-ID: <20100304144422.GA69196@zaa.local> Hello, I am not sure if this is a bug in R13B04 or not, but I am experiencing the following issue: 1> re:run([1058,1077,1089,1090] ++ "http://example.com/index.php?a=b", "http", [unicode]). {match,[{8,4}]} I am trying to find position of a match in a string (list, not a binary) with unicode characters. Since the string has 4 unicode symbols and then the matching part I suppose that re:run should return {match, [{4,4}]} when I pass a list, and {match, [{8, 4}]} when I pass a binary. Right now it returns {match, [{8, 4}]} in both cases. Is this a bug? If not, how can I get position of a match in unicode string? Thank you. -- Alexander Zhuravlev From rickard@REDACTED Thu Mar 4 15:53:34 2010 From: rickard@REDACTED (Rickard Green) Date: Thu, 4 Mar 2010 15:53:34 +0100 Subject: [erlang-questions] advices for itanium compilation In-Reply-To: <201003041315.20568.clist@uah.es> References: <201003032027.41670.clist@uah.es> <19342.50400.390695.315472@pilspetsen.it.uu.se> <201003041315.20568.clist@uah.es> Message-ID: <10d7e35f1003040653k73d6a8dkd05a8dbfa057bff2@mail.gmail.com> 2010/3/4 Angel Alvarez : > El Mi?rcoles, 3 de Marzo de 2010 21:21:52 Mikael Pettersson escribi?: >> Angel wrote: >> > Some mates allowed me to play with erlang on a 16 CPU SGI >> > itanium with Red Hat Advanced server (SGI propack something). >> > >> > where can i pick a suitable rpm for this beast? >> > >> > Can i rebuild a normal source rpm for Redhat AS on itanium or i have to >> > make some croscompile...? >> >> That box should be plenty powerful enough to build Erlang natively >> without any cross-compilation. As for src rpms, RH AS is AFAIK fairly >> old so I wouldn't expect a src rpm tuned for e.g. Fedora to work as-is. >> >> Why not just download the otp_src tarball, unpack it, and build it >> normally? (./configure; make) >> > > I managed to compile the tarball... but now it cant detect the cpu topology. > > erl > Erlang R13B04 (erts-5.7.5) [source] [64-bit] [smp:12:12] [rq:12] [async-threads:0] [kernel-poll:false] > > Eshell V5.7.5 ?(abort with ^G) > 1> erlang:system_info(cpu_topology). > undefined > 2> > > this machine has 6 bricks with two itanium 2 cpus per brick, but i cant figure how to spec the layout... > > L0c0p0,L1c0p1N0:L2c0p0,L3c0p1N1:L4c0p0,L5c0p1N2:L6c0p0,L7c0p1N3:L8c0p0,L9c0p1N4:L19c0p0,L11c0p1N5 > > this gets nothing... > > > Anyone can help me > > Thanks!! > erl +sct L0-1p0-1N0:L2-3p2-3N1:L4-5p4-5N2:L6-7p6-7N3:L8-9p8-9N4:L19,11p19,11N5 1> erlang:system_info(cpu_topology). [{node,[{processor,{logical,0}},{processor,{logical,1}}]}, {node,[{processor,{logical,2}},{processor,{logical,3}}]}, {node,[{processor,{logical,4}},{processor,{logical,5}}]}, {node,[{processor,{logical,6}},{processor,{logical,7}}]}, {node,[{processor,{logical,8}},{processor,{logical,9}}]}, {node,[{processor,{logical,11}},{processor,{logical,19}}]}] 2> Processor identifiers are system wide and `,' separates identifiers. Regards, Rickard Green, Erlang/OTP, Ericsson AB. > -- > No imprima este correo si no es necesario. El medio ambiente est? en nuestras manos. > __________________________________________ > > Clist UAH a.k.a Angel > __________________________________________ > Primero vino el Navegador, luego fu? el explorador, ahora llega el Konquistador. > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From clist@REDACTED Thu Mar 4 15:57:53 2010 From: clist@REDACTED (Angel) Date: Thu, 4 Mar 2010 15:57:53 +0100 Subject: [erlang-questions] advices for itanium compilation In-Reply-To: <10d7e35f1003040653k73d6a8dkd05a8dbfa057bff2@mail.gmail.com> References: <201003032027.41670.clist@uah.es> <201003041315.20568.clist@uah.es> <10d7e35f1003040653k73d6a8dkd05a8dbfa057bff2@mail.gmail.com> Message-ID: <201003041557.53349.clist@uah.es> On Jueves, 4 de Marzo de 2010 15:53:34 Rickard Green escribi?: > 2010/3/4 Angel Alvarez : > > El Mi?rcoles, 3 de Marzo de 2010 21:21:52 Mikael Pettersson escribi?: > >> Angel wrote: > >> > Some mates allowed me to play with erlang on a 16 CPU SGI > >> > itanium with Red Hat Advanced server (SGI propack something). > >> > > >> > where can i pick a suitable rpm for this beast? > >> > > >> > Can i rebuild a normal source rpm for Redhat AS on itanium or i have > >> > to make some croscompile...? > >> > >> That box should be plenty powerful enough to build Erlang natively > >> without any cross-compilation. As for src rpms, RH AS is AFAIK fairly > >> old so I wouldn't expect a src rpm tuned for e.g. Fedora to work as-is. > >> > >> Why not just download the otp_src tarball, unpack it, and build it > >> normally? (./configure; make) > > > > I managed to compile the tarball... but now it cant detect the cpu > > topology. > > > > erl > > Erlang R13B04 (erts-5.7.5) [source] [64-bit] [smp:12:12] [rq:12] > > [async-threads:0] [kernel-poll:false] > > > > Eshell V5.7.5 (abort with ^G) > > 1> erlang:system_info(cpu_topology). > > undefined > > 2> > > > > this machine has 6 bricks with two itanium 2 cpus per brick, but i cant > > figure how to spec the layout... > > > > L0c0p0,L1c0p1N0:L2c0p0,L3c0p1N1:L4c0p0,L5c0p1N2:L6c0p0,L7c0p1N3:L8c0p0,L9 > >c0p1N4:L19c0p0,L11c0p1N5 > > > > this gets nothing... > > > > > > Anyone can help me > > > > Thanks!! > > erl +sct > L0-1p0-1N0:L2-3p2-3N1:L4-5p4-5N2:L6-7p6-7N3:L8-9p8-9N4:L19,11p19,11N5 > > 1> erlang:system_info(cpu_topology). > [{node,[{processor,{logical,0}},{processor,{logical,1}}]}, > {node,[{processor,{logical,2}},{processor,{logical,3}}]}, > {node,[{processor,{logical,4}},{processor,{logical,5}}]}, > {node,[{processor,{logical,6}},{processor,{logical,7}}]}, > {node,[{processor,{logical,8}},{processor,{logical,9}}]}, > {node,[{processor,{logical,11}},{processor,{logical,19}}]}] > 2> thanks for the feedback, eventually palying with options ive reached a conf like yours... Now ill check if procs get spread evenly... across nodes. /Angel > > Processor identifiers are system wide and `,' separates identifiers. > > Regards, > Rickard Green, Erlang/OTP, Ericsson AB. > > > -- > > No imprima este correo si no es necesario. El medio ambiente est? en > > nuestras manos. __________________________________________ > > > > Clist UAH a.k.a Angel > > __________________________________________ > > Primero vino el Navegador, luego fu? el explorador, ahora llega el > > Konquistador. > > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > See http://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > Most people know C is not so high level.... ...Everybody else just got assembler overdose From freza@REDACTED Thu Mar 4 17:07:33 2010 From: freza@REDACTED (Jachym Holecek) Date: Thu, 4 Mar 2010 17:07:33 +0100 Subject: [erlang-questions] file:read_file won't read from /proc In-Reply-To: References: Message-ID: <20100304160733.GA1556@hanele> Hello, # Martin DeMello 2010-03-04: > 4> {ok, B} = file:read_file("/proc/cpuinfo"). > {ok,<<>>} > > Why is B empty? The read_file/1 thing check file size and then attempts to read exactly that many bytes. The size of /proc/cpuinfo is zero[*], thus read_file/1 correctly reads zero bytes and represents the result with empty binary. Gotta love UN*X for its sense of consistency, right? ;-) Regards, -- Jachym [*] Checked on NetBSD and Linux. From attila.r.nohl@REDACTED Thu Mar 4 17:17:41 2010 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Thu, 4 Mar 2010 17:17:41 +0100 Subject: [erlang-questions] file:read_file won't read from /proc In-Reply-To: <20100304160733.GA1556@hanele> References: <20100304160733.GA1556@hanele> Message-ID: <401d3ba31003040817v593721dfja873dbb478eeb8af@mail.gmail.com> 2010/3/4, Jachym Holecek : [...] > The read_file/1 thing check file size and then attempts to read exactly > that many bytes. The size of /proc/cpuinfo is zero[*], thus read_file/1 > correctly reads zero bytes and represents the result with empty binary. > > Gotta love UN*X for its sense of consistency, right? ;-) Even the classic UNIX utilities can't get it right occasionally: ethanl@REDACTED: ~>wc /proc/sys/kernel/panic 1 1 2 /proc/sys/kernel/panic ethanl@REDACTED: ~>wc -c /proc/sys/kernel/panic 0 /proc/sys/kernel/panic ethanl@REDACTED: ~>cat /proc/sys/kernel/panic | wc -c 2 From steven.charles.davis@REDACTED Thu Mar 4 17:32:07 2010 From: steven.charles.davis@REDACTED (Steve Davis) Date: Thu, 4 Mar 2010 08:32:07 -0800 (PST) Subject: 4 questions for my app In-Reply-To: <981a1cbd-5dbf-453f-b684-2effb626ff1f@z10g2000prh.googlegroups.com> References: <981a1cbd-5dbf-453f-b684-2effb626ff1f@z10g2000prh.googlegroups.com> Message-ID: Perhaps your best bet would be to start with the "walk-through" example implementation of IRC in Joe's book, (it's in chapter 11). http://www.pragprog.com/titles/jaerlang/programming-erlang Regards, Steve On Mar 2, 11:12?pm, NavTux wrote: > I need to do a erlang chat application to show the performance > > Basically I should know the basic things to do > > 1.What are the tools to use? > > 2.What are the modules i need to have? > > 3.How many days i have to take? > > 4.Finally How should it contailn? > > I am having these questions in my mind steadily,but as well as i > should know the answers soon to start my contribution can you help me?? > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > Seehttp://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED From mikpe@REDACTED Thu Mar 4 18:52:23 2010 From: mikpe@REDACTED (Mikael Pettersson) Date: Thu, 4 Mar 2010 18:52:23 +0100 Subject: [erlang-questions] file:read_file won't read from /proc In-Reply-To: <20100304160733.GA1556@hanele> References: <20100304160733.GA1556@hanele> Message-ID: <19343.62295.819192.725683@pilspetsen.it.uu.se> Jachym Holecek writes: > Hello, > > # Martin DeMello 2010-03-04: > > 4> {ok, B} = file:read_file("/proc/cpuinfo"). > > {ok,<<>>} > > > > Why is B empty? > > The read_file/1 thing check file size and then attempts to read exactly > that many bytes. The size of /proc/cpuinfo is zero[*], thus read_file/1 > correctly reads zero bytes and represents the result with empty binary. > > Gotta love UN*X for its sense of consistency, right? ;-) /proc files behave more like pipes than regular files, because their contents are not stored but generated on the fly. You really have to 'cat' them and not rely on stat to tell you their sizes in advance. From andrew@REDACTED Thu Mar 4 19:44:12 2010 From: andrew@REDACTED (Andrew Thompson) Date: Thu, 4 Mar 2010 13:44:12 -0500 Subject: Erlang dropping packets sent from ei Message-ID: <20100304184412.GJ1751@hijacked.us> I've been noticing an odd issue when I send a burst of erlang messages to erlang via ei from a C node. It *looks* like if 2 messages get put in the same packet (and maybe that the tail of the second message extends to a second packet) erlang will not process the message. I tried enabling TCP_NODELAY on the socket on the C node and it seemed to help the issue somewhat, although not enough to eliminate it completely. Attached is a pcap file with some packets showing the issue. The packets in question are 21786-7 and 21794-5 and in each case the second message seems to be dropped by erlang. The erlang messages are of the form {fetch, Section :: atom(), Tag :: string(), Key :: string(), Value :: string(), ID :: string(), Params :: proplist()} and as can be seen, those packets contain 2 messages of that form, the second one continued in the subsequent packet. When I use TCP_NODELAY the messages are sent one per packet so its not so clear why some packets are getting lost. Anyone have any ideas why this is happening or how to fix it? Andrew -------------- next part -------------- A non-text attachment was scrubbed... Name: ei.pcap Type: application/octet-stream Size: 8538 bytes Desc: not available URL: From hakan@REDACTED Thu Mar 4 22:42:45 2010 From: hakan@REDACTED (=?ISO-8859-1?Q?H=E5kan_Mattsson?=) Date: Thu, 4 Mar 2010 22:42:45 +0100 Subject: [erlang-questions] Cross compiling R13B04 for MIPS CPU running linux works In-Reply-To: <20100301144919.GA31133@corelatus.se> References: <20100301144919.GA31133@corelatus.se> Message-ID: <922d05851003041342h2363e9ddwfdc5aff1fffa5f09@mail.gmail.com> On Mon, Mar 1, 2010 at 3:49 PM, Matthias Lang wrote: > ?2. On targets where disk space is precious, it's nice if the .beams > ? ? are compressed. On earlier releases, I did that that by including > ? ? +compressed in ERL_COMPILE_FLAGS (by patching the makefile). > > ? ? Is there a better way to do that now? > > ? ? I had a quick look, couldn't find one, thought I'd ask before > ? ? I invent my own method, possibly putting the .beams in an archive > ? ? while I'm at it. If you are using reltool to create your target system, you can configure it to create the archive files for you. It can also compress (any type of) files put in archives as well as strip debug info from beam files. /H?kan From hakan@REDACTED Thu Mar 4 23:00:35 2010 From: hakan@REDACTED (=?ISO-8859-1?Q?H=E5kan_Mattsson?=) Date: Thu, 4 Mar 2010 23:00:35 +0100 Subject: [erlang-questions] why is 'registered' a mandatory .app file attribute? In-Reply-To: <4B8D4839.8040406@erlang-solutions.com> References: <4B8D4839.8040406@erlang-solutions.com> Message-ID: <922d05851003041400i2cefb9afpaf81482ce4afd7a4@mail.gmail.com> On Tue, Mar 2, 2010 at 6:17 PM, Ulf Wiger wrote: > Am I the only one who is annoyed* by the fact that systools > requires the 'registered' attribute to be present in the .app > files in order to build a boot script? Yes. ;-) > While the attribute may have some value for documentation > (if properly maintained), it isn't, and never has been, enforced > in any way. > > Why, then, does it need to be mandatory? It doesn't. Submit a patch. If you use reltool to build your boot script, you can omit the 'registered' attribute in the .app file. /H?kan From hakan@REDACTED Thu Mar 4 23:29:01 2010 From: hakan@REDACTED (=?ISO-8859-1?Q?H=E5kan_Mattsson?=) Date: Thu, 4 Mar 2010 23:29:01 +0100 Subject: [erlang-questions] debugging remote node In-Reply-To: <95be1d3b1002250558s48096ed0n45209d609f2ba469@mail.gmail.com> References: <95be1d3b1002250558s48096ed0n45209d609f2ba469@mail.gmail.com> Message-ID: <922d05851003041429s50dc4e3ena3739ea74b91f94d@mail.gmail.com> On Thu, Feb 25, 2010 at 2:58 PM, Vlad Dumitrescu wrote: > Hi! > > When debugging remote nodes, do they need to share filesystem (or have > the files in the same place) with the "current" machine? Looking in > the code I see that read_file is used, which would make me say that > this is a requirement, but there is enough magic going ?on that there > might be some other path that doesn't use that. > > Yes, I tried it in practice and it didn't work (while it worked with a > system with shared filesystem), but I'd like to get it confirmed (or > to get pointed to the relevant part of the docs). When the debugger got adopted to read files from archives, it was rewritten to use erl_prim_loader to read the files. I have not tried this myself, but as the erl_prim_loader is able to fetch files from remote nodes (using the erl_boot_server) it ought to be possible to get the debugger to read its files from a remote node. See erl_prim_loader and erl_boot_server about how such a system is configured. /H?kan From ok@REDACTED Fri Mar 5 03:00:47 2010 From: ok@REDACTED (Richard O'Keefe) Date: Fri, 5 Mar 2010 15:00:47 +1300 Subject: [erlang-questions] file:read_file won't read from /proc In-Reply-To: <401d3ba31003040817v593721dfja873dbb478eeb8af@mail.gmail.com> References: <20100304160733.GA1556@hanele> <401d3ba31003040817v593721dfja873dbb478eeb8af@mail.gmail.com> Message-ID: On Mar 5, 2010, at 5:17 AM, Attila Rajmund Nohl wrote: > 2010/3/4, Jachym Holecek : > [...] >> The read_file/1 thing check file size and then attempts to read >> exactly >> that many bytes. The size of /proc/cpuinfo is zero[*], thus >> read_file/1 >> correctly reads zero bytes and represents the result with empty >> binary. >> >> Gotta love UN*X for its sense of consistency, right? ;-) > > Even the classic UNIX utilities can't get it right occasionally: > > ethanl@REDACTED: ~>wc /proc/sys/kernel/panic > 1 1 2 /proc/sys/kernel/panic > ethanl@REDACTED: ~>wc -c /proc/sys/kernel/panic > 0 /proc/sys/kernel/panic > ethanl@REDACTED: ~>cat /proc/sys/kernel/panic | wc -c Here's what the Single Unix Specification, 4th edition says: [st_size is set for "shared memory object"s and "typed memory object"s] For symbolic links, the ... value of the st_size member shall be set to the length of the pathname contained in the symbolic link not including any terminating null byte. For all other file types defined in this volume of POSIX.1-2008, the structure members st_mode, st_ino, st_dev, st_uid, st_gid, st_atim, st_ctim, and st_mtim shall have meaningful values and the value of the member st_nlink shall be set to the number of links to the file. What's missing is *any* statement at all about what st_size should be for anything other than a symbolic link, a shared memory object, or a typed memory object. If instead of looking at 'stat' you look at '', you find off_t st_size For regular files, the file size in bytes. For symbolic links, the length in bytes of the pathname contained in the symbolic link. [SHM] -------------- next part -------------- For a shared memory object, the length in bytes. -------------- next part -------------- [TYM] -------------- next part -------------- For a typed memory object, the length in bytes. -------------- next part -------------- For other file types, the use of this field is unspecified. Now that tells us what st_size means *if* it is set, but the specification of stat() doesn't that it it *is* set. And this has not changed since SUSv3. I don't know what kind of file /proc/cpuinfo is, since neither Solaris nor Mac OS X has it, but if it's _not_ a regular file, symbolic link, shared memory object, or typed memory object, its st_size doesn't have to mean anything. If it _is_ reported as a regular file, and its st_size does not match its contents, that's nothing but a bug. From mapandfold@REDACTED Fri Mar 5 03:48:40 2010 From: mapandfold@REDACTED (MapAndFold) Date: Fri, 5 Mar 2010 10:48:40 +0800 Subject: [erlang-questions] Re: On Windows XP (SP2): wx broken In-Reply-To: <93df43b61003032220m5b4d396dn4aca92270134d795@mail.gmail.com> References: <9C6B96B5-37FA-4CF6-A7D3-663736CEE916@gmail.com> <69869ad8-a27a-48e6-8835-8303a87ed40d@g11g2000yqe.googlegroups.com> <93df43b61003032220m5b4d396dn4aca92270134d795@mail.gmail.com> Message-ID: I have a Intel Core 2, SMP is enabled, and I am using werl. Erlang R13B04 (erts-5.7.5) [smp:2:2] [rq:2] [async-threads:0] Eshell V5.7.5 (abort with ^G) 1> wx:demo(). Then, a memory access error occurred, and werl aborted. --------------------------- werl.exe - Application Error --------------------------- The instruction at "0x7c911948" referenced memory at "0x00000000". The memory could not be "read". On Thu, Mar 4, 2010 at 2:20 PM, Dan Gudmundsson wrote: > Are you running it from werl? > > erl and wxwidgets seems to be fighting for stdio, so it needs to be run from > werl or erl -detached -s wx demo > > /Dan > > On Thu, Mar 4, 2010 at 7:01 AM, Steve Davis > wrote: > From joe@REDACTED Fri Mar 5 04:39:37 2010 From: joe@REDACTED (Joe Williams) Date: Thu, 04 Mar 2010 19:39:37 -0800 Subject: [erlang-questions] dns server In-Reply-To: <20100304022553.GA48853@k2r.org> References: <4B88DF87.5000208@joetify.com> <4B8B0325.7070101@joetify.com> <20100304022553.GA48853@k2r.org> Message-ID: <4B907CF9.6090305@joetify.com> Thanks Kenji, I'll take a look. Noticed it uses Merle (my little memcached client) so that's cool. :) Mostly I am looking for a correct/simple/clean/usable DNS protocol implementation that I can play with. -Joe On 3/3/10 6:25 PM, Kenji Rikitake wrote: > Kota Uenishi releases a DNS cache called bine: > http://bitbucket.org/kuenishi/bine/src/ > > I wonder, however, what means the *decent server*, > for now, at the coming age of DNSSEC. > Implementing DNSSEC validation is a huge task > and the situation is unstable. > > And DNS software has three roles: > * authoritative server > * cache > * stub resolver > What does the server do? > > Kenji Rikitake > (who's got his nervous wreck many times dealing with > the cloud monster called DNS) > > In the message<4B8B0325.7070101@REDACTED> > dated Sun, Feb 28, 2010 at 03:58:05PM -0800, > Joe Williams writes: > >> Anyone have any suggestions? Bueller? >> >> -Joe >> >> >> On 2/27/10 1:01 AM, Joe Williams wrote: >> >>> Anyone know of a decent OSS DNS server implementation in Erlang? I >>> found http://code.google.com/p/erldir/ and >>> http://eddie.sourceforge.net/ but they are both out of date and no >>> longer maintained it seems. >>> >>> Thanks for any suggestions. >>> >>> -Joe >>> >>> > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > -- Name: Joseph A. Williams Email: joe@REDACTED Blog: http://www.joeandmotorboat.com/ From vladdu55@REDACTED Fri Mar 5 08:07:05 2010 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 5 Mar 2010 08:07:05 +0100 Subject: [erlang-questions] debugging remote node In-Reply-To: <922d05851003041429s50dc4e3ena3739ea74b91f94d@mail.gmail.com> References: <95be1d3b1002250558s48096ed0n45209d609f2ba469@mail.gmail.com> <922d05851003041429s50dc4e3ena3739ea74b91f94d@mail.gmail.com> Message-ID: <95be1d3b1003042307j79e86c7ds74bcc5b3391d722b@mail.gmail.com> 2010/3/4 H?kan Mattsson : > When the debugger got adopted to read files from archives, > it was rewritten to use erl_prim_loader to read the files. I have > not tried this myself, but as the erl_prim_loader is able to fetch > files from remote nodes (using the erl_boot_server) it ought to > be possible to get the debugger to read its files from a remote > node. See erl_prim_loader and erl_boot_server about how such > a system is configured. Ok, thanks, I will look at that. regards, Vlad From martindemello@REDACTED Fri Mar 5 10:57:41 2010 From: martindemello@REDACTED (Martin DeMello) Date: Fri, 5 Mar 2010 15:27:41 +0530 Subject: [erlang-questions] file:read_file won't read from /proc In-Reply-To: <20100304160733.GA1556@hanele> References: <20100304160733.GA1556@hanele> Message-ID: On Thu, Mar 4, 2010 at 9:37 PM, Jachym Holecek wrote: > The read_file/1 thing check file size and then attempts to read exactly > that many bytes. The size of /proc/cpuinfo is zero[*], thus read_file/1 > correctly reads zero bytes and represents the result with empty binary. Okay, that makes sense. So what would the best way to read "files" in /proc be? Is there any standard erlang way to read a stream till you get an EOF? martin From kenji.rikitake@REDACTED Fri Mar 5 11:26:50 2010 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Fri, 5 Mar 2010 19:26:50 +0900 Subject: [erlang-questions] Re: [erlang-patches] spawn to rpc, filter, etc. In-Reply-To: <4B8BFCEC.20108@erlang-solutions.com> References: <20100221051303.66bb8b72@landofbile.com> <6672d0161002250002x292abe4doe202fba914f412ce@mail.gmail.com> <20100228011626.347d0a85@otis> <6672d0161002280644m19387427ud50db6820fc036f1@mail.gmail.com> <20100228102118.033a597a@otis> <6672d0161003010620q1fa4c80awc08dc2ce3e0e6824@mail.gmail.com> <4B8BFCEC.20108@erlang-solutions.com> Message-ID: <20100305102650.GA23214@k2r.org> I only can suggest that single "security" function will not cover all the cases. I think integrating restriction into the existing open environment is the hardest part. Implementing communication/execution restriction inside the rpc module should be carefully done, because many modules and applications depend on it. Kenji Rikitake From jay@REDACTED Fri Mar 5 12:47:22 2010 From: jay@REDACTED (Jay Nelson) Date: Fri, 5 Mar 2010 03:47:22 -0800 Subject: Tilera processors Message-ID: <291BA9EE-6661-4DA7-ABDD-279A280EAB5A@duomark.com> Here are the promised results of my questionnaire: 8 responses (I guess that says a lot by itself) - I would only use a free service: 3 - I can test remotely for a day or more: 1 - I need it onsite for a week or more: 2 - I have >$10K and want it in my hands: 2 6 want to test an erlang app or idea, 1 wants to test something else. I was looking for a way to amortize the cost across several participants to see if we could share a single board or service for testing. Can the two respondents with >$10K contact me (see http:// www.duomark.com/) One of the hurdles is the high cost of their software which is required on the first unit, and is likely unnecessary for erlang testing if the released erlang/OTP runs on it directly. jay From freza@REDACTED Fri Mar 5 15:51:42 2010 From: freza@REDACTED (Jachym Holecek) Date: Fri, 5 Mar 2010 15:51:42 +0100 Subject: [erlang-questions] file:read_file won't read from /proc In-Reply-To: References: <20100304160733.GA1556@hanele> Message-ID: <20100305145142.GA2272@hanele> # Martin DeMello 2010-03-05: > On Thu, Mar 4, 2010 at 9:37 PM, Jachym Holecek wrote: > > > The read_file/1 thing check file size and then attempts to read exactly > > that many bytes. The size of /proc/cpuinfo is zero[*], thus read_file/1 > > correctly reads zero bytes and represents the result with empty binary. > > Okay, that makes sense. So what would the best way to read "files" in > /proc be? Is there any standard erlang way to read a stream till you > get an EOF? Not sure if there's such function in standard libraries, you can always go with a utility function much in the spirit of your original example: raw_read_file(Path) -> {ok, File} = file:open(Path, [read, binary]), raw_read_loop(File, []). raw_read_loop(File, Acc) -> case file:read(File, 1024) of {ok, Bytes} -> raw_read_loop(File, [Acc | Bytes]); eof -> file:close(File), iolist_to_binary(Acc); {error, Reason} -> file:close(File), erlang:error(Reason) end. Regards, -- Jachym From rumata-estor@REDACTED Fri Mar 5 15:57:02 2010 From: rumata-estor@REDACTED (Dmitry Belayev) Date: Fri, 05 Mar 2010 17:57:02 +0300 Subject: [erlang-questions] file:read_file won't read from /proc In-Reply-To: <20100305145142.GA2272@hanele> References: <20100304160733.GA1556@hanele> <20100305145142.GA2272@hanele> Message-ID: <4B911BBE.5050009@nm.ru> of course iolist_to_binary(lists:reverse(Acc)); Jachym Holecek wrote: > # Martin DeMello 2010-03-05: > >> On Thu, Mar 4, 2010 at 9:37 PM, Jachym Holecek wrote: >> >> >>> The read_file/1 thing check file size and then attempts to read exactly >>> that many bytes. The size of /proc/cpuinfo is zero[*], thus read_file/1 >>> correctly reads zero bytes and represents the result with empty binary. >>> >> Okay, that makes sense. So what would the best way to read "files" in >> /proc be? Is there any standard erlang way to read a stream till you >> get an EOF? >> > > Not sure if there's such function in standard libraries, you can always > go with a utility function much in the spirit of your original example: > > raw_read_file(Path) -> > {ok, File} = file:open(Path, [read, binary]), > raw_read_loop(File, []). > > raw_read_loop(File, Acc) -> > case file:read(File, 1024) of > {ok, Bytes} -> > raw_read_loop(File, [Acc | Bytes]); > eof -> > file:close(File), > iolist_to_binary(Acc); > {error, Reason} -> > file:close(File), > erlang:error(Reason) > end. > > Regards, > -- Jachym > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > > From rumata-estor@REDACTED Fri Mar 5 15:58:55 2010 From: rumata-estor@REDACTED (Dmitry Belayev) Date: Fri, 05 Mar 2010 17:58:55 +0300 Subject: [erlang-questions] file:read_file won't read from /proc In-Reply-To: <20100305145142.GA2272@hanele> References: <20100304160733.GA1556@hanele> <20100305145142.GA2272@hanele> Message-ID: <4B911C2F.5010500@nm.ru> Sorry, I was wrong. It isn't general practice to [Acc | Bytes] but surely it works. Jachym Holecek wrote: > # Martin DeMello 2010-03-05: > >> On Thu, Mar 4, 2010 at 9:37 PM, Jachym Holecek wrote: >> >> >>> The read_file/1 thing check file size and then attempts to read exactly >>> that many bytes. The size of /proc/cpuinfo is zero[*], thus read_file/1 >>> correctly reads zero bytes and represents the result with empty binary. >>> >> Okay, that makes sense. So what would the best way to read "files" in >> /proc be? Is there any standard erlang way to read a stream till you >> get an EOF? >> > > Not sure if there's such function in standard libraries, you can always > go with a utility function much in the spirit of your original example: > > raw_read_file(Path) -> > {ok, File} = file:open(Path, [read, binary]), > raw_read_loop(File, []). > > raw_read_loop(File, Acc) -> > case file:read(File, 1024) of > {ok, Bytes} -> > raw_read_loop(File, [Acc | Bytes]); > eof -> > file:close(File), > iolist_to_binary(Acc); > {error, Reason} -> > file:close(File), > erlang:error(Reason) > end. > > Regards, > -- Jachym > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > > From vladdu55@REDACTED Fri Mar 5 16:00:22 2010 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 5 Mar 2010 16:00:22 +0100 Subject: [erlang-questions] file:read_file won't read from /proc In-Reply-To: <20100305145142.GA2272@hanele> References: <20100304160733.GA1556@hanele> <20100305145142.GA2272@hanele> Message-ID: <95be1d3b1003050700j55837792kd3080e341a48d31b@mail.gmail.com> >> Okay, that makes sense. So what would the best way to read "files" in >> /proc be? Is there any standard erlang way to read a stream till you >> get an EOF? Maybe os:cmd("cat /proc/cpuinfo") could work? regards, Vlad From rvirding@REDACTED Fri Mar 5 16:26:36 2010 From: rvirding@REDACTED (Robert Virding) Date: Fri, 5 Mar 2010 16:26:36 +0100 Subject: [erlang-questions] file:read_file won't read from /proc In-Reply-To: References: <20100304160733.GA1556@hanele> Message-ID: <3dbc6d1c1003050726k70ff6163t70e86b6c5e61a84b@mail.gmail.com> In your original question you showed a way of doing this using file:open, file:read and file:close. By doing file:read until it returns eof you should be able to read the whole file. It won't be very efficient for large files but for small files there should be no problems. Robert On 5 March 2010 10:57, Martin DeMello wrote: > On Thu, Mar 4, 2010 at 9:37 PM, Jachym Holecek wrote: > >> The read_file/1 thing check file size and then attempts to read exactly >> that many bytes. The size of /proc/cpuinfo is zero[*], thus read_file/1 >> correctly reads zero bytes and represents the result with empty binary. > > Okay, that makes sense. So what would the best way to read "files" in > /proc be? Is there any standard erlang way to read a stream till you > get an EOF? > > martin > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From jeedward@REDACTED Fri Mar 5 16:40:43 2010 From: jeedward@REDACTED (John Edward) Date: Fri, 5 Mar 2010 07:40:43 -0800 (PST) Subject: Call for papers: MULTICONF-10, USA, July 2010 Message-ID: <474530.55188.qm@web45910.mail.sp1.yahoo.com> It would be highly appreciated if you could share this announcement with your colleagues, students and individuals whose research is in computer science, computer engineering, information science and related areas. Call for papers: MULTICONF-10, USA, July 2010 The 2010 multi-conference (MULTICONF-10) (website: http://www.PromoteResearch.org ) will be held during July 12-14, 2010 in Orlando, Florida, USA. The primary goal of MULTICONF is to promote research and developmental activities in computer science, information technology, control engineering, and related fields. Another goal is to promote the dissemination of research to a multidisciplinary audience and to facilitate communication among researchers, developers, practitioners in different fields. The following conferences are planned to be organized as part of MULTICONF-10. ? International Conference on Artificial Intelligence and Pattern Recognition (AIPR-10) ? International Conference on Automation, Robotics and Control Systems (ARCS-10) ? International Conference on Bioinformatics, Computational Biology, Genomics and Chemoinformatics (BCBGC-10) ? International Conference on Computer Communications and Networks (CCN-10) ? International Conference on Enterprise Information Systems and Web Technologies (EISWT-10) ? International Conference on High Performance Computing Systems (HPCS-10) ? International Conference on Information Security and Privacy (ISP-10) ? International Conference on Image and Video Processing and Computer Vision (IVPCV-10) ? International Conference on Software Engineering Theory and Practice (SETP-10) ? International Conference on Theoretical and Mathematical Foundations of Computer Science (TMFCS-10) MULTICONF-10 will be held at Imperial Swan Hotel and Suites. It is a full-service resort that puts you in the middle of the fun! Located 1/2 block south of the famed International Drive, the hotel is just minutes from great entertainment like Walt Disney World? Resort, Universal Studios and Sea World Orlando. Guests can enjoy free scheduled transportation to these theme parks, as well as spacious accommodations, outdoor pools and on-site dining ? all situated on 10 tropically landscaped acres. Here, guests can experience a full-service resort with discount hotel pricing in Orlando. Please see the website http://www.PromoteResearch.org for more details. Sincerely John Edward From clist@REDACTED Fri Mar 5 18:40:33 2010 From: clist@REDACTED (Angel) Date: Fri, 5 Mar 2010 18:40:33 +0100 Subject: schedulers binding error Message-ID: <201003051840.33656.clist@uah.es> Hello! after compiling erlang on a itanium numa machine i cant use +sbt flag No cpu topology is detected, after asking here and playing a bit I got: erl +sct L0c0p0N0:L1c1p1N0:L2c2p2N1:L3c3p3N1:L4c4p4N2:L5c5p5N2:L6c6p6N3:L7c7p7N3:L8c8p8N4:L9c9p9N4:L10c10p10N5:L11c11p11N5 that get me 12 procs over 6 numa nodes, good!! but playing a bit with a lot of processes showed me that erlang was not fully use all proccesors So i relayed to use +sbt to see how binding changes cpu stats.... but erlang refuses to use any bindings: angel@REDACTED otp_src_R13B04]$ erl +scyt ... +sbt u +A6 setting scheduler bind type 'u' failed: not supported .... angel@REDACTED otp_src_R13B04]$ erl +scyt ... +sbt nnps +A6 setting scheduler bind type 'nnps' failed: not supported .... My kernel is 2.4.21-sgi306rp12 Its too old for this!!! isn't it? A/ngel Most people know C is not so high level.... ...Everybody else just got assembler overdose From mikpe@REDACTED Fri Mar 5 20:13:26 2010 From: mikpe@REDACTED (Mikael Pettersson) Date: Fri, 5 Mar 2010 20:13:26 +0100 Subject: [erlang-questions] schedulers binding error In-Reply-To: <201003051840.33656.clist@uah.es> References: <201003051840.33656.clist@uah.es> Message-ID: <19345.22486.661687.160188@pilspetsen.it.uu.se> Angel writes: > Hello! > > after compiling erlang on a itanium numa machine i cant use +sbt flag > > No cpu topology is detected, after asking here and playing a bit I got: > > erl +sct L0c0p0N0:L1c1p1N0:L2c2p2N1:L3c3p3N1:L4c4p4N2:L5c5p5N2:L6c6p6N3:L7c7p7N3:L8c8p8N4:L9c9p9N4:L10c10p10N5:L11c11p11N5 > > that get me 12 procs over 6 numa nodes, good!! > > but playing a bit with a lot of processes showed me that erlang was not fully use all proccesors > > So i relayed to use +sbt to see how binding changes cpu stats.... > > but erlang refuses to use any bindings: > > > angel@REDACTED otp_src_R13B04]$ erl +scyt ... +sbt u +A6 > setting scheduler bind type 'u' failed: not supported > .... > > > angel@REDACTED otp_src_R13B04]$ erl +scyt ... +sbt nnps +A6 > setting scheduler bind type 'nnps' failed: not supported > .... > > My kernel is 2.4.21-sgi306rp12 Its too old for this!!! isn't it? 2.4.21, even if maintained by some enterprise distro, is prehistoric. You should upgrade. From g@REDACTED Fri Mar 5 23:04:50 2010 From: g@REDACTED (Garrett Smith) Date: Fri, 5 Mar 2010 16:04:50 -0600 Subject: Sharing child processes across supervisors Message-ID: I have a gen_server that maintains a connection to something. I'd like to have a single such gen_server per release (VM instance). I generally run this server under a one_for_all supervisor -- anyone who depends on that connection is also under this supervisor. When the connection fails, the dependencies are all restarted. If I have multiple OTP applications that share this connection, each application will want to supervise the gen_server. I could merge the supervisory trees of the multiple applications into one, but this doesn't feel right at all - I want to keep the applications as separate as possible. I'm tempted to modify the start_link of the connection to look like this: start_link() -> case gen_server:start_link({local, ?SERVER}, ?MODULE, [], []) of {ok, Pid} -> {ok, Pid}; {already_started, Pid} -> {ok, Pid}; Other -> Other end. My thinking is that this would fake out supervisors that subsequently tried to start the connection, causing them to link and supervisor as if they actually started it. Naively, it would seem that a connection failure would be detected by all of the linked supervisors, triggering the expected cascades. One of the applications would end up restarting the connection and the rest would link per the "fake out" above. Would this approach be bad for any reason? Is there a better or standard way of getting supervision across applications? Garrett From kagato@REDACTED Fri Mar 5 23:16:09 2010 From: kagato@REDACTED (Jayson Vantuyl) Date: Fri, 5 Mar 2010 14:16:09 -0800 Subject: [erlang-questions] Sharing child processes across supervisors In-Reply-To: References: Message-ID: <806F6589-D9A3-4885-A693-0F361DBAA826@souja.net> Have the gen_server link to the other gen_servers (or vice-versa). Then when one fails, the other dies, and the supervisors in the remote apps take care of it. It might require some synchronization around the restarting (or maybe a delay in somebody's init), but I've done this sort of thing a lot. On Mar 5, 2010, at 2:04 PM, Garrett Smith wrote: > I have a gen_server that maintains a connection to something. I'd like > to have a single such gen_server per release (VM instance). > > I generally run this server under a one_for_all supervisor -- anyone > who depends on that connection is also under this supervisor. When the > connection fails, the dependencies are all restarted. > > If I have multiple OTP applications that share this connection, each > application will want to supervise the gen_server. I could merge the > supervisory trees of the multiple applications into one, but this > doesn't feel right at all - I want to keep the applications as > separate as possible. > > I'm tempted to modify the start_link of the connection to look like this: > > start_link() -> > case gen_server:start_link({local, ?SERVER}, ?MODULE, [], []) of > {ok, Pid} -> {ok, Pid}; > {already_started, Pid} -> {ok, Pid}; > Other -> Other > end. > > My thinking is that this would fake out supervisors that subsequently > tried to start the connection, causing them to link and supervisor as > if they actually started it. Naively, it would seem that a connection > failure would be detected by all of the linked supervisors, triggering > the expected cascades. One of the applications would end up restarting > the connection and the rest would link per the "fake out" above. > > Would this approach be bad for any reason? Is there a better or > standard way of getting supervision across applications? > > Garrett > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > -- Jayson Vantuyl kagato@REDACTED From g@REDACTED Sat Mar 6 01:20:08 2010 From: g@REDACTED (Garrett Smith) Date: Fri, 5 Mar 2010 18:20:08 -0600 Subject: [erlang-questions] Sharing child processes across supervisors In-Reply-To: <806F6589-D9A3-4885-A693-0F361DBAA826@souja.net> References: <806F6589-D9A3-4885-A693-0F361DBAA826@souja.net> Message-ID: Thanks! This is straight forward and cleans up the supervisory hierarchy that I was using. On Fri, Mar 5, 2010 at 4:16 PM, Jayson Vantuyl wrote: > Have the gen_server link to the other gen_servers (or vice-versa). ?Then when one fails, the other dies, and the supervisors in the remote apps take care of it. ?It might require some synchronization around the restarting (or maybe a delay in somebody's init), but I've done this sort of thing a lot. > > On Mar 5, 2010, at 2:04 PM, Garrett Smith wrote: > >> I have a gen_server that maintains a connection to something. I'd like >> to have a single such gen_server per release (VM instance). >> >> I generally run this server under a one_for_all supervisor -- anyone >> who depends on that connection is also under this supervisor. When the >> connection fails, the dependencies are all restarted. >> >> If I have multiple OTP applications that share this connection, each >> application will want to supervise the gen_server. I could merge the >> supervisory trees of the multiple applications into one, but this >> doesn't feel right at all - I want to keep the applications as >> separate as possible. >> >> I'm tempted to modify the start_link of the connection to look like this: >> >> ?start_link() -> >> ? ?case gen_server:start_link({local, ?SERVER}, ?MODULE, [], []) of >> ? ? ?{ok, Pid} -> {ok, Pid}; >> ? ? ?{already_started, Pid} -> {ok, Pid}; >> ? ? ?Other -> Other >> ? ?end. >> >> My thinking is that this would fake out supervisors that subsequently >> tried to start the connection, causing them to link and supervisor as >> if they actually started it. Naively, it would seem that a connection >> failure would be detected by all of the linked supervisors, triggering >> the expected cascades. One of the applications would end up restarting >> the connection and the rest would link per the "fake out" above. >> >> Would this approach be bad for any reason? Is there a better or >> standard way of getting supervision across applications? >> >> Garrett >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED >> > > -- > Jayson Vantuyl > kagato@REDACTED > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From g@REDACTED Sat Mar 6 01:24:26 2010 From: g@REDACTED (Garrett Smith) Date: Fri, 5 Mar 2010 18:24:26 -0600 Subject: [Chi Erlang Users] Sharing child processes across supervisors In-Reply-To: <7fa241f31003051442l47dcad1ft649bf65b05b9ea66@mail.gmail.com> References: <7fa241f31003051413g773efe28gd4842def901a8419@mail.gmail.com> <7fa241f31003051442l47dcad1ft649bf65b05b9ea66@mail.gmail.com> Message-ID: I ended up just linking across the servers. Using GAS would change the way I'm configuring the apps, which is a bit more than I want to tackle at this point. Thanks for the pointer though - the dynamic assembly of apps using file based configs is pretty dang interesting! On Fri, Mar 5, 2010 at 4:42 PM, Martin Logan wrote: > Ahh, BTW I forgot that you would want to register this gen server and > link to it from the other processes that care. ?I would put the > linking API into the API of the gen server in question. > > On Fri, Mar 5, 2010 at 4:13 PM, Martin Logan wrote: >> I have used a number of things for this. ?The thing I use the most is >> the GAS (General Application Servies) applications ability to >> configure in such dependencies via the .config file. This gets around >> the "singleton problem". Basically you would add the gas application >> as a dependency and then add into your config something like this: >> >> {gas, >> ?[ >> ? {mod_specs, [{my_service_key, {my_service, start_link, [false]}}]} >> ?] >> ?}, >> >> This type of dynamic supervision and its configuration can get much >> more complex than the most basic example I just provided. ?Docs can be >> found here on the Erlware site: >> http://erlware.org/lib/5.7.1/gas-8.0.2/index.html >> >> Cheers, >> Martin >> >> On Fri, Mar 5, 2010 at 4:04 PM, Garrett Smith wrote: >>> I have a gen_server that maintains a connection to something. I'd like >>> to have a single such gen_server per release (VM instance). >>> >>> I generally run this server under a one_for_all supervisor -- anyone >>> who depends on that connection is also under this supervisor. When the >>> connection fails, the dependencies are all restarted. >>> >>> If I have multiple OTP applications that share this connection, each >>> application will want to supervise the gen_server. I could merge the >>> supervisory trees of the multiple applications into one, but this >>> doesn't feel right at all - I want to keep the applications as >>> separate as possible. >>> >>> I'm tempted to modify the start_link of the connection to look like this: >>> >>> ?start_link() -> >>> ? ?case gen_server:start_link({local, ?SERVER}, ?MODULE, [], []) of >>> ? ? ?{ok, Pid} -> {ok, Pid}; >>> ? ? ?{already_started, Pid} -> {ok, Pid}; >>> ? ? ?Other -> Other >>> ? ?end. >>> >>> My thinking is that this would fake out supervisors that subsequently >>> tried to start the connection, causing them to link and supervisor as >>> if they actually started it. Naively, it would seem that a connection >>> failure would be detected by all of the linked supervisors, triggering >>> the expected cascades. One of the applications would end up restarting >>> the connection and the rest would link per the "fake out" above. >>> >>> Would this approach be bad for any reason? Is there a better or >>> standard way of getting supervision across applications? >>> >>> Garrett >>> >>> -- >>> You received this message because you are subscribed to the Google Groups "Chicago Erlang User Group" group. >>> To post to this group, send email to ceug@REDACTED >>> To unsubscribe from this group, send email to ceug+unsubscribe@REDACTED >>> For more options, visit this group at http://groups.google.com/group/ceug?hl=en. >>> >>> >> > > -- > You received this message because you are subscribed to the Google Groups "Chicago Erlang User Group" group. > To post to this group, send email to ceug@REDACTED > To unsubscribe from this group, send email to ceug+unsubscribe@REDACTED > For more options, visit this group at http://groups.google.com/group/ceug?hl=en. > > From kagato@REDACTED Sat Mar 6 01:56:59 2010 From: kagato@REDACTED (Jayson Vantuyl) Date: Fri, 5 Mar 2010 16:56:59 -0800 Subject: [erlang-questions] Sharing child processes across supervisors In-Reply-To: References: <806F6589-D9A3-4885-A693-0F361DBAA826@souja.net> Message-ID: It's funny. A lot of people seem to read Joe's book and assume that you learn about the primitives (spawn, link, !, receive, etc.) but you then don't use them (using gen_* instead). Ironically, I've found that is completely not the case. While you can't really use receive, handle_info/2 provides almost the same functionality. Otherwise, I routinely have gen_servers spawn large numbers of linked processes for various purposes. Using links for this not only ensures that cross-connected processes die when the process exits, it also can create sane reset behavior in the face of other nodes failing (for distributed applications). Cross-server links can be touchy, so do watch for bugs. Specifically, since you can't really spawn_link the other servers, you have to rely on linking to a nonexistent process causing a failure. Specifically, assume that you have three servers, M, A, and B. M is the "master" server, and A / B link to it. In a stable state, assume that A and B both link to M on startup. This is fairly sane, as M doesn't have to have knowledge about all of its "consumers". In this case, assume that everything starts fine. This is common, as your applications tend to start in a certain order. Now assume that B dies. In this case, it will kill M, which will subsequently kill A. Now, these processes will be restarted in whichever order their supervisors happen to get scheduled. This can create chaos that causes, for example, A or B to respawn a few times before M starts. While this is often fine, watch out because it (harmlessly) clutters logs and (quite harmfully) can cause the supervisor to exit due to too many restarts. The easy way to fix this is to put some delay in A and B's init function. Unfortunately, this sometimes fails spectacularly on really loaded systems. The "better" way, in my opinion, is to have A & B loop over whereis until M is registered. I use the following function, in the init of the linking processes: > -define(DEFAULT_TRIES,5). > -define(WAIT_TIME,100). > > wait_on(Who) -> > wait_on(Who,?DEFAULT_TRIES). > > wait_on(_Who,0) -> > erlang:error(noproc); > wait_on(Who,Tries) when Tries > 0 -> > case whereis(Who) of > undefined -> > timer:sleep(?WAIT_TIME), > wait_on(Who,Tries - 1); > Pid when is_pid(Pid) -> > {started,Pid} > end. Alternatively, you could use a simpler version that wait forever, and use the {timeout,T} option to gen_server:start_link/3,4. Either way, this is usually much more "supervisor-friendly". Have fun! On Mar 5, 2010, at 4:20 PM, Garrett Smith wrote: > Thanks! This is straight forward and cleans up the supervisory > hierarchy that I was using. > > On Fri, Mar 5, 2010 at 4:16 PM, Jayson Vantuyl wrote: >> Have the gen_server link to the other gen_servers (or vice-versa). Then when one fails, the other dies, and the supervisors in the remote apps take care of it. It might require some synchronization around the restarting (or maybe a delay in somebody's init), but I've done this sort of thing a lot. >> >> On Mar 5, 2010, at 2:04 PM, Garrett Smith wrote: >> >>> I have a gen_server that maintains a connection to something. I'd like >>> to have a single such gen_server per release (VM instance). >>> >>> I generally run this server under a one_for_all supervisor -- anyone >>> who depends on that connection is also under this supervisor. When the >>> connection fails, the dependencies are all restarted. >>> >>> If I have multiple OTP applications that share this connection, each >>> application will want to supervise the gen_server. I could merge the >>> supervisory trees of the multiple applications into one, but this >>> doesn't feel right at all - I want to keep the applications as >>> separate as possible. >>> >>> I'm tempted to modify the start_link of the connection to look like this: >>> >>> start_link() -> >>> case gen_server:start_link({local, ?SERVER}, ?MODULE, [], []) of >>> {ok, Pid} -> {ok, Pid}; >>> {already_started, Pid} -> {ok, Pid}; >>> Other -> Other >>> end. >>> >>> My thinking is that this would fake out supervisors that subsequently >>> tried to start the connection, causing them to link and supervisor as >>> if they actually started it. Naively, it would seem that a connection >>> failure would be detected by all of the linked supervisors, triggering >>> the expected cascades. One of the applications would end up restarting >>> the connection and the rest would link per the "fake out" above. >>> >>> Would this approach be bad for any reason? Is there a better or >>> standard way of getting supervision across applications? >>> >>> Garrett >>> >>> ________________________________________________________________ >>> erlang-questions (at) erlang.org mailing list. >>> See http://www.erlang.org/faq.html >>> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED >>> >> >> -- >> Jayson Vantuyl >> kagato@REDACTED >> >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED >> >> > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > -- Jayson Vantuyl kagato@REDACTED From rickard@REDACTED Sat Mar 6 02:11:27 2010 From: rickard@REDACTED (Rickard Green) Date: Sat, 6 Mar 2010 02:11:27 +0100 Subject: [erlang-questions] schedulers binding error In-Reply-To: <201003051840.33656.clist@uah.es> References: <201003051840.33656.clist@uah.es> Message-ID: <10d7e35f1003051711y789b9518t8eb2dfb4f742f013@mail.gmail.com> 2010/3/5 Angel : > Hello! > > after compiling erlang on a itanium numa machine i cant use +sbt flag > > No cpu topology is detected, after asking here and playing a bit I got: > > erl +sct L0c0p0N0:L1c1p1N0:L2c2p2N1:L3c3p3N1:L4c4p4N2:L5c5p5N2:L6c6p6N3:L7c7p7N3:L8c8p8N4:L9c9p9N4:L10c10p10N5:L11c11p11N5 > > that get me 12 procs over 6 numa nodes, good!! > > but playing a bit with a lot of processes showed me that erlang was not fully use all proccesors > > So i relayed to use +sbt to see how binding changes cpu stats.... > > but erlang refuses to use any bindings: > > > angel@REDACTED otp_src_R13B04]$ erl +scyt ... +sbt u ?+A6 > setting scheduler bind type 'u' failed: not supported > .... > > > angel@REDACTED otp_src_R13B04]$ erl +scyt ... +sbt nnps ?+A6 > setting scheduler bind type 'nnps' failed: not supported > .... > > My kernel is 2.4.21-sgi306rp12 ?Its too old for this!!! isn't it? > > Yes. Schedulers are bound using sched_setaffinity() which appeared in kernel 2.5.8 according to the man page. Regards, Rickard Green, Erlang/OTP, Ericsson AB. > A/ngel > > > Most people know C is not so high level.... > ? ? ? ? ? ? ? ?...Everybody else just got assembler overdose > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From ulf.wiger@REDACTED Sat Mar 6 19:18:55 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Sat, 06 Mar 2010 19:18:55 +0100 Subject: [erlang-questions] Sharing child processes across supervisors In-Reply-To: References: <806F6589-D9A3-4885-A693-0F361DBAA826@souja.net> Message-ID: <4B929C8F.4050500@erlang-solutions.com> Jayson Vantuyl wrote: > > The "better" way, in my opinion, is to have A & B loop over whereis > until M is registered. I use the following function, in the init of > the linking processes: ...or if you use the latest version of gproc: gproc:await(RegName) -> {Pid, Value} http://github.com/uwiger/gproc No need to poll. BR, Ulf W -- Ulf Wiger CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd http://www.erlang-solutions.com --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From fjl@REDACTED Sun Mar 7 10:59:16 2010 From: fjl@REDACTED (Felix Lange) Date: Sun, 07 Mar 2010 10:59:16 +0100 (CET) Subject: Inets httpd hangs when there is only one HeaderOption Message-ID: <20100307.105916.165160948.fjl@twurst.com> Hello list, the inets reference manual states that the return value of Module:do/1 should match (snipped): NewData = [{response,{StatusCode,Body}}] | [{response,{response,Head,Body}}] | [{response,{already_sent,Statuscode,Size}}] Head = [HeaderOption] HeaderOption = {Option, Value} | {code, StatusCode} I generate the return value using a function such as this: response(Code, Headers, Content) -> {proceed, [{response, {response, [{code, Code} | Headers], format_xhtml(Content)}}]}. When Headers is the empty list, the server fails to send the body in full, only the half of it mysteriously gets through. Btw, this doesn't happen if i use: {proceed, [{response, {Code, format_xhtml(Content)}}]} It's also worth noting that this section of the manual is flawed in other respects, i.e. the mod record is missing the init_data field. $ curl -v http://localhost:50601 * About to connect() to localhost port 50601 (#0) * Trying 127.0.0.1... connected * Connected to localhost (127.0.0.1) port 50601 (#0) > GET / HTTP/1.1 > User-Agent: curl/7.19.6 (i686-pc-linux-gnu) libcurl/7.19.6 OpenSSL/0.9.8l zlib/1.2.3 > Host: localhost:50601 > Accept: */* > < HTTP/1.1 200 OK < Server: inets/5.3 < Content-Type: text/html < Date: Sun, 07 Mar 2010 09:38:58 GMT * no chunk, no close, no size. Assume close to signal end < foo From jvliwanag@REDACTED Sun Mar 7 13:01:00 2010 From: jvliwanag@REDACTED (Jan Vincent) Date: Sun, 7 Mar 2010 20:01:00 +0800 Subject: How often should a process be spawned? Message-ID: How often should a process be spawned? Take for instance, a gen_server. After having eliminated that the invocation to the handle_call wouldn't change the current server's state, is it logical to spawn the rest of the operations on another process and to a gen_server:reply later on? Jan Vincent Liwanag jvliwanag@REDACTED From fjl@REDACTED Sun Mar 7 13:54:34 2010 From: fjl@REDACTED (Felix Lange) Date: Sun, 07 Mar 2010 13:54:34 +0100 (CET) Subject: [erlang-questions] Inets httpd hangs when there is only one HeaderOption In-Reply-To: <20100307.105916.165160948.fjl@twurst.com> References: <20100307.105916.165160948.fjl@twurst.com> Message-ID: <20100307.135434.104368607.fjl@twurst.com> Ok, false alarm. I forgot to set the Content-Length header myself. Please excuse my dumb question. From mabrek@REDACTED Sun Mar 7 14:40:44 2010 From: mabrek@REDACTED (mabrek) Date: Sun, 07 Mar 2010 16:40:44 +0300 Subject: mime message composition library Message-ID: <4B93ACDC.9000208@gmail.com> Hello. Is there an erlang library to create MIME conformant mail messages (multipart/alternative, attachments, encoded headers)? http://code.google.com/p/erlmail/ is incomplete and it's development is stopped. http://github.com/archaelus/esmtp seems to be the best, but I need more features to create complex messages than it provides. Regards, Anton Lebedevich. From rvirding@REDACTED Sun Mar 7 16:14:35 2010 From: rvirding@REDACTED (Robert Virding) Date: Sun, 7 Mar 2010 16:14:35 +0100 Subject: [erlang-questions] How often should a process be spawned? In-Reply-To: References: Message-ID: <3dbc6d1c1003070714g66124cebme9beed7ba60e145d@mail.gmail.com> On 7 March 2010 13:01, Jan Vincent wrote: > How often should a process be spawned? Only once! :-) Robert From gliptak@REDACTED Sun Mar 7 19:26:02 2010 From: gliptak@REDACTED (=?ISO-8859-1?B?R+Fib3IgTGlwdOFr?=) Date: Sun, 7 Mar 2010 13:26:02 -0500 Subject: [erlang-questions] Erlang/OTP R13B04 has been released In-Reply-To: References: Message-ID: <3c64b6c31003071026n2eb58f5bxdf869ff6d0e5af26@mail.gmail.com> jinterface 1.5.3 is available in the Maven2 repo: http://repo2.maven.org/maven2/org/erlang/otp/jinterface/1.5.3/ Thanks On Wed, Feb 24, 2010 at 06:00, Kenneth Lundin wrote: > Bug fix release : otp_src_R13B04 > Build date ? ? ?: 2010-02-23 > > This is R13B04, the fourth maintenance release for the R13B major release. > > You can find the README file for the release at > > http://www.erlang.org/download/otp_src_R13B04.readme > > The source distribution and binary distribution for Windows can be > downloaded from > > http://www.erlang.org/download/otp_src_R13B04.tar.gz > http://www.erlang.org/download/otp_win32_R13B04.exe > > The distribution can also be downloaded using the BitTorrent > protocol. Use the following torrent files to download the source > distribution and binary distribution for Windows: > > http://www.erlang.org/download/otp_src_R13B04.tar.gz.torrent > http://www.erlang.org/download/otp_win32_R13B04.exe.torrent > > Note: To unpack the TAR archive you need a GNU TAR compatible program. > > For installation instructions please read the README file that is part > of the distribution. > > The on-line documentation can be found at: http://www.erlang.org/doc/ > You can also download the complete HTML documentation or the Unix manual files > > http://www.erlang.org/download/otp_doc_html_R13B04.tar.gz > http://www.erlang.org/download/otp_doc_man_R13B04.tar.gz > > We also want to thank those that sent us patches, suggestions and bug > reports, > > The OTP Team > Kenneth Lundin, Erlang/OTP, Ericsson AB > > ?________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From elinsn@REDACTED Sun Mar 7 21:30:55 2010 From: elinsn@REDACTED (Sergey Yelin) Date: Sun, 7 Mar 2010 23:30:55 +0300 Subject: Strange behavior for os:cmd() Message-ID: <2faaa0981003071230x235d27b3u4f3f3345d75c4887@mail.gmail.com> Hi there, Just found os:cmd() gives differend results when I try to execute external program by name and by full path. For example, 1>os:cmd("hg"). "Mercurial Distributed SCM\n\nbasic commands:\n\n add ... [SKIP OTHER MERCURIAL HELP OUTPUT] " 2> os:find_executable("hg"). "c:/Program Files (x86)/TortoiseHg/hg.exe" 3> os:cmd(os:find_executable("hg")). [] 4> os:cmd("c:/Program Files (x86)/TortoiseHg/hg.exe"). [] Is this correct behavior or am I missing something? From erlang@REDACTED Sun Mar 7 20:46:22 2010 From: erlang@REDACTED (Dominic Williams) Date: Sun, 07 Mar 2010 20:46:22 +0100 Subject: Paris Erlounge Message-ID: <4B94028E.90002@dominicwilliams.net> Hello, The Paris Erlang user group will be meeting on Monday 15th March. Everyone is welcome to join us. At 7pm, we will hold a coding dojo in the premises of Orange Business Services, 106 rue du Temple, 75003 Paris. The principle of a coding dojo is for a volunteer participant to code something live while others watch, question and comment. At 9pm we will go somewhere in the neighbourhood for an Erlounge (beer, food and talk). Please register for the dojo by dropping me an email (as we must provide a list of attendees for security reasons). Cheers, Dominic Williams http://dominicwilliams.net ---- From freza@REDACTED Sun Mar 7 22:07:05 2010 From: freza@REDACTED (Jachym Holecek) Date: Sun, 7 Mar 2010 22:07:05 +0100 Subject: [erlang-questions] Strange behavior for os:cmd() In-Reply-To: <2faaa0981003071230x235d27b3u4f3f3345d75c4887@mail.gmail.com> References: <2faaa0981003071230x235d27b3u4f3f3345d75c4887@mail.gmail.com> Message-ID: <20100307210705.GA3914@hanele> # Sergey Yelin 2010-03-07: > 4> os:cmd("c:/Program Files (x86)/TortoiseHg/hg.exe"). Careful about quoting here: I guess win32 shell tries to execute file "c:/Program" with two arguments and fails silently (this is a matter of shell programming, not really related to Erlang). Regards, -- Jachym From golubovsky@REDACTED Mon Mar 8 05:14:14 2010 From: golubovsky@REDACTED (Dimitry Golubovsky) Date: Sun, 7 Mar 2010 23:14:14 -0500 Subject: OTP R13B04: cannot build wx (is wxGtk required?) Message-ID: Hi, I am trying to build the most recent OTP form sources with the wx library. I compiled wx 2.8.10 --with-x11 (did not really want to use GTK version), Everything compiled fine. I use a Slax-based installation of Linux. While configuring OTP I see the following output: ...... checking for wx/stc/stc.h... no configure: WARNING: Can not find wx/stc/stc.h checking if we can link wxwidgets programs... no configure: WARNING: Can not link wx program are all developer packages installed? ........ Finally I see: wx : Can not link the wx driver, wx will NOT be useable I found the following thread: http://groups.google.com/group/erlang-programming/browse_thread/thread/2d044dac45a36bae wx in OTP13B03 failed to build on Ubuntu 8.10 where the last message in thread suggests to install libwxgtk2.8-dev. to resolve the missing header issue. Does this mean that Erlang wx library specifically requires wxGtk? Thanks. -- Dimitry Golubovsky Anywhere on the Web From dgud@REDACTED Mon Mar 8 10:46:43 2010 From: dgud@REDACTED (Dan Gudmundsson) Date: Mon, 8 Mar 2010 10:46:43 +0100 Subject: [erlang-questions] OTP R13B04: cannot build wx (is wxGtk required?) In-Reply-To: References: Message-ID: <93df43b61003080146v27fa84cag509c17101a6fa0f9@mail.gmail.com> Installation requirements for ubuntu 9-10, can be found here: http://wiki.github.com/erlang/otp/installation If you build wxWidgets on your own, read the readme in otp/lib/wx directory. You will, for example, need to build stc located in the contrib directory. But I havn't tested without gtk, so you are on your own and I don't know how good the X11 port is so I don't know how well the erlang applications will work with that port. Anyway config.log in the wx sub-directory contains the actual configure errors, so that is where you can start digging. /Dan On Mon, Mar 8, 2010 at 5:14 AM, Dimitry Golubovsky wrote: > Hi, > > I am trying to build the most recent OTP form sources with the wx > library. I compiled wx 2.8.10 --with-x11 (did not really want to use > GTK version), Everything compiled fine. I use a Slax-based > installation of Linux. > > While configuring OTP I see the following output: > > ...... > checking for wx/stc/stc.h... no > configure: WARNING: Can not find wx/stc/stc.h > checking if we can link wxwidgets programs... no > configure: WARNING: Can not link wx program are all developer packages > installed? > ........ > > Finally I see: > > wx ? ? ? ? ? ? : Can not link the wx driver, wx will NOT be useable > > I found the following thread: > > http://groups.google.com/group/erlang-programming/browse_thread/thread/2d044dac45a36bae > > wx in OTP13B03 failed to build on Ubuntu 8.10 > > where the last message in thread suggests to install libwxgtk2.8-dev. > to resolve the missing header issue. > > Does this mean that Erlang wx library specifically requires wxGtk? > > Thanks. > > -- > Dimitry Golubovsky > > Anywhere on the Web > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From golubovsky@REDACTED Mon Mar 8 11:26:26 2010 From: golubovsky@REDACTED (Dimitry Golubovsky) Date: Mon, 8 Mar 2010 05:26:26 -0500 Subject: [erlang-questions] OTP R13B04: cannot build wx (is wxGtk required?) In-Reply-To: <93df43b61003080146v27fa84cag509c17101a6fa0f9@mail.gmail.com> References: <93df43b61003080146v27fa84cag509c17101a6fa0f9@mail.gmail.com> Message-ID: Dan, Thanks for the explanation. On Mon, Mar 8, 2010 at 4:46 AM, Dan Gudmundsson wrote: [skip] > If you build wxWidgets on your own, read the readme in otp/lib/wx directory. > You will, for example, need to build stc located in the contrib directory. > > On Mon, Mar 8, 2010 at 5:14 AM, Dimitry Golubovsky wrote: >> Hi, >> >> I am trying to build the most recent OTP form sources with the wx >> library. I compiled wx 2.8.10 --with-x11 (did not really want to use >> GTK version), Everything compiled fine. I use a Slax-based >> installation of Linux. >> >> While configuring OTP I see the following output: >> >> ...... >> checking for wx/stc/stc.h... no >> configure: WARNING: Can not find wx/stc/stc.h >> checking if we can link wxwidgets programs... no >> configure: WARNING: Can not link wx program are all developer packages >> installed? >> ........ >> >> Finally I see: >> >> wx ? ? ? ? ? ? : Can not link the wx driver, wx will NOT be useable >> >> I found the following thread: >> >> http://groups.google.com/group/erlang-programming/browse_thread/thread/2d044dac45a36bae >> >> wx in OTP13B03 failed to build on Ubuntu 8.10 >> >> where the last message in thread suggests to install libwxgtk2.8-dev. >> to resolve the missing header issue. >> >> Does this mean that Erlang wx library specifically requires wxGtk? >> >> Thanks. >> >> -- >> Dimitry Golubovsky >> >> Anywhere on the Web >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED >> >> > -- Dimitry Golubovsky Anywhere on the Web From rtrlists@REDACTED Mon Mar 8 12:01:07 2010 From: rtrlists@REDACTED (Robert Raschke) Date: Mon, 8 Mar 2010 11:01:07 +0000 Subject: [erlang-questions] Strange behavior for os:cmd() In-Reply-To: <2faaa0981003071230x235d27b3u4f3f3345d75c4887@mail.gmail.com> References: <2faaa0981003071230x235d27b3u4f3f3345d75c4887@mail.gmail.com> Message-ID: <6a3ae47e1003080301w236daf67rf8989aed53f3454f@mail.gmail.com> On Sun, Mar 7, 2010 at 8:30 PM, Sergey Yelin wrote: > Hi there, > > Just found os:cmd() gives differend results when I try to execute > external program by name and by full path. For example, > > 1>os:cmd("hg"). > "Mercurial Distributed SCM\n\nbasic commands:\n\n add > ... > [SKIP OTHER MERCURIAL HELP OUTPUT] > " > 2> os:find_executable("hg"). > "c:/Program Files (x86)/TortoiseHg/hg.exe" > 3> os:cmd(os:find_executable("hg")). > [] > 4> os:cmd("c:/Program Files (x86)/TortoiseHg/hg.exe"). > [] > > Is this correct behavior or am I missing something? > > Windows quoting is a right pain. Try: os:cmd("\""++os:find_executable("hg")++"\""). >From http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/Cmd.mspx(thee last paragraph applies): Processing quotation marks If you specify /c or /k, cmd processes the remainder of string and quotation marks are preserved only if all of the following conditions are met: You do not use /s. You use exactly one set of quotation marks. You do not use any special characters within the quotation marks (for example: &<>( ) @ ^ |). You use one or more white-space characters within the quotation marks. The string within quotation marks is the name of an executable file. If the previous conditions are not met, string is processed by examining the first character to verify whether or not it is an opening quotation mark. If the first character is an opening quotation mark, it is stripped along with the closing quotation mark. Any text following the closing quotation marks is preserved. Robby From luismarianoguerra@REDACTED Mon Mar 8 12:47:30 2010 From: luismarianoguerra@REDACTED (Mariano Guerra) Date: Mon, 8 Mar 2010 12:47:30 +0100 Subject: [ANN] efene programming language 0.2 released Message-ID: second release of efene. efene is a programming language that runs on the erlang virtual machine. the idea is to provide an alternative syntax to erlang that is most suitable for people coming from languages like Java, C, C++, C#, Javascript. the language is almost 100% compatible with erlang (and will be), the compiler allows to translate an efene source file into a readable erlang one or compile it directly to bytecode. It also adds some syntactic sugar in some places to make some tasks easier. Changes * commas and parenthesis made optional on almost all places. * the parser is now less generic, avoid expressions that are syntactically correct but that won?t compile or will be a runtime error. * guards added to case and receive expressions. * support for the $ operator added, returns the integer value of a char. * for and in are now keywords. * now atoms can be written with ? (like ?Atom? ?@tom?). * support to assign an argument that is pattern matched to a variable. * support to pass a function expressing its [module,] name and arity * parameters of record objects simplified, added constructor from record . * non short circuit versions of ?and? and ?or? added. * added the arrow operator (see examples/arrow.fn). * module and function can be a variable in calls and arrow expressions. * fixed operator precedence on binary operations for a reference see the language reference: http://wiki.github.com/marianoguerra/efene/languagereference Participate a mailing list is available at librelist just send a mail to efene@REDACTED to subscribe. From navaneethanit@REDACTED Mon Mar 8 14:10:38 2010 From: navaneethanit@REDACTED (NavaTux) Date: Mon, 8 Mar 2010 05:10:38 -0800 (PST) Subject: some doubts in my starting place Message-ID: <999dcba1-872b-4127-af01-6044f0e7d7a8@k18g2000prf.googlegroups.com> 1.How to generate multiple clients in erlang? for communication , I need to prove the Erlang performance to others around me...Is it possible to prove the performance of Erlang with java in windows platform?because some problem occurred in ubuntu to install erlang..it has to take some time to rectify..so Is any article available to creating a client-server effective communication using erlang and mochiweb?? I installed mochiweb,In the installation directory what is start.sh and start-dev.sh??what is the use of it? From mevans@REDACTED Mon Mar 8 15:40:09 2010 From: mevans@REDACTED (Evans, Matthew) Date: Mon, 8 Mar 2010 09:40:09 -0500 Subject: [erlang-questions] How often should a process be spawned? In-Reply-To: References: Message-ID: I guess it depends on your service. Spawning a process to handle a request in a gen_server is very cheap (using gen_server:reply for the response). In many of my applications if I have anything that will cause the gen_server to block for any amount of time I'll do just that. I'll probably let a gen_server block for the time an mnesia or ETS lookup will take, but that's about it. -----Original Message----- From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] On Behalf Of Jan Vincent Sent: Sunday, March 07, 2010 7:01 AM To: erlang-questions@REDACTED Subject: [erlang-questions] How often should a process be spawned? How often should a process be spawned? Take for instance, a gen_server. After having eliminated that the invocation to the handle_call wouldn't change the current server's state, is it logical to spawn the rest of the operations on another process and to a gen_server:reply later on? Jan Vincent Liwanag jvliwanag@REDACTED ________________________________________________________________ erlang-questions (at) erlang.org mailing list. See http://www.erlang.org/faq.html To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED From mjtruog@REDACTED Mon Mar 8 16:51:19 2010 From: mjtruog@REDACTED (Michael Truog) Date: Mon, 08 Mar 2010 07:51:19 -0800 Subject: [ANN] CloudI 0.0.9 Released, A Cloud as an Interface Message-ID: <4B951CF7.9060209@gmail.com> CloudI 0.0.9 (alpha) Homepage: http://cloudi.org Download: http://sourceforge.net/projects/cloudi/files/0.0.9a/cloudi-0.0.9.tar.gz/download Source: http://github.com/okeuday/CloudI/tree/master#readme ABOUT CloudI is an open-source private cloud computing framework for secure, internal data processing. CloudI facilitates a cloud of processes for solving embarrassingly parallel and divide and conquer problems with dynamic load balancing work pools while maintaining fault-tolerant workers. CloudI requires pool data from databases or from an Erlang work module that will automatically generate the work. CloudI was designed to be a multi-purpose cloud for internal distributed processing and could facilitate work supplied by an external server. CloudI is currently focused on being an abstract type of cloud and interfacing to work. External applications could manage security and a user interface for CloudI's functionality. CloudI is meant to be the bare essentials for efficient fault-tolerant processing on a cloud. CloudI uses Erlang/OTP to provide fault-tolerance. CloudI work consists of an Erlang module to handle allocating the work as tasks and a dynamic library created with C/C++ to execute the work. An example of using CloudI can be found in "src/lib/cloud_job_tests/src/", which defines the work title "cloud_job_tests" referenced in src/cloud.conf. "cloud_job_tests" finds hexadecimal digits of the constant PI using the Bailey-Borwein-Plouffe formula and verifies that they are correct. "cloud_job_tests" requires that PostgreSQL is configured and setup because it stores the results. Memcached is also used by "cloud_job_tests", but any results that would go to memcached are discarded if memcached isn't configured. CouchDB, MySQL and Tokyo Tyrant are used by "cloud_job_tests" in the same way as memcached (i.e., just to test basic data storage functionality). CloudI currently supports the following databases: * CouchDB (>= 0.9.0) * memcached (>= 1.3) * MySQL (>= 4.0) * PostgreSQL (>= 7.4) * Tokyo Tyrant (>= 1.1.23) CloudI ensures that the C/C++ work code is executed in a fault-tolerant way. Failover is handled with multiple CloudI instances using separate epmd daemons. However, the coordination of the failover of running work is not yet implemented, since that will occur in a separate external application that is not yet written. Current failover requires knowledge of the cloud_api module and commands fed to the Erlang VM shell, so it is a manual process. CloudI fault-tolerance test cases include: * a local death of a CloudI instance coordinating Erlang VM * a local death of C/C++ work code (within a cloud_worker_port OS process) due to a signal * a local stop of C/C++ work code (within a cloud_worker_port OS process) due to a signal * a remote death of a CloudI instance Erlang VM * a remote death of C/C++ work code (within a cloud_worker_port OS process) due to a signal * a remote stop of C/C++ work code (within a cloud_worker_port OS process) due to a signal From joe@REDACTED Mon Mar 8 17:23:39 2010 From: joe@REDACTED (Joe Williams) Date: Mon, 08 Mar 2010 08:23:39 -0800 Subject: [erlang-questions] dns server In-Reply-To: <4B907CF9.6090305@joetify.com> References: <4B88DF87.5000208@joetify.com> <4B8B0325.7070101@joetify.com> <20100304022553.GA48853@k2r.org> <4B907CF9.6090305@joetify.com> Message-ID: <4B95248B.6020201@joetify.com> For anyone interested, inet_dns (undocumented afaict) does all the heavy lifting for encoding/decoding DNS requests. http://github.com/erlang/otp/blob/dev/lib/kernel/src/inet_dns.erl http://github.com/erlang/otp/blob/dev/lib/kernel/src/inet_dns.hrl -Joe On 3/4/10 7:39 PM, Joe Williams wrote: > Thanks Kenji, I'll take a look. Noticed it uses Merle (my little > memcached client) so that's cool. :) > > Mostly I am looking for a correct/simple/clean/usable DNS protocol > implementation that I can play with. > > -Joe > > > On 3/3/10 6:25 PM, Kenji Rikitake wrote: >> Kota Uenishi releases a DNS cache called bine: >> http://bitbucket.org/kuenishi/bine/src/ >> >> I wonder, however, what means the *decent server*, >> for now, at the coming age of DNSSEC. >> Implementing DNSSEC validation is a huge task >> and the situation is unstable. >> >> And DNS software has three roles: >> * authoritative server >> * cache >> * stub resolver >> What does the server do? >> >> Kenji Rikitake >> (who's got his nervous wreck many times dealing with >> the cloud monster called DNS) >> >> In the message<4B8B0325.7070101@REDACTED> >> dated Sun, Feb 28, 2010 at 03:58:05PM -0800, >> Joe Williams writes: >>> Anyone have any suggestions? Bueller? >>> >>> -Joe >>> >>> >>> On 2/27/10 1:01 AM, Joe Williams wrote: >>>> Anyone know of a decent OSS DNS server implementation in Erlang? I >>>> found http://code.google.com/p/erldir/ and >>>> http://eddie.sourceforge.net/ but they are both out of date and no >>>> longer maintained it seems. >>>> >>>> Thanks for any suggestions. >>>> >>>> -Joe >>>> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED >> > -- Name: Joseph A. Williams Email: joe@REDACTED Blog: http://www.joeandmotorboat.com/ From jarrod@REDACTED Mon Mar 8 19:19:40 2010 From: jarrod@REDACTED (Jarrod Roberson) Date: Mon, 8 Mar 2010 13:19:40 -0500 Subject: [erlang-questions] dns server In-Reply-To: References: <4B88DF87.5000208@joetify.com> <4B8B0325.7070101@joetify.com> <20100304022553.GA48853@k2r.org> <4B907CF9.6090305@joetify.com> <4B95248B.6020201@joetify.com> Message-ID: On Mon, Mar 8, 2010 at 1:19 PM, Jarrod Roberson wrote: > > > On Mon, Mar 8, 2010 at 11:23 AM, Joe Williams wrote: > >> For anyone interested, inet_dns (undocumented afaict) does all the heavy >> lifting for encoding/decoding DNS requests. >> >> http://github.com/erlang/otp/blob/dev/lib/kernel/src/inet_dns.erl >> http://github.com/erlang/otp/blob/dev/lib/kernel/src/inet_dns.hrl >> >> >> -Joe >> >> i have successfully used inet_dns in my inet_mdns project works great > -- Jarrod Roberson 678.551.2852 From joe@REDACTED Mon Mar 8 19:48:30 2010 From: joe@REDACTED (Joe Williams) Date: Mon, 08 Mar 2010 10:48:30 -0800 Subject: [erlang-questions] dns server In-Reply-To: References: <4B88DF87.5000208@joetify.com> <4B8B0325.7070101@joetify.com> <20100304022553.GA48853@k2r.org> <4B907CF9.6090305@joetify.com> <4B95248B.6020201@joetify.com> Message-ID: <4B95467E.6010002@joetify.com> >>> For anyone interested, inet_dns (undocumented afaict) does all the heavy >>> lifting for encoding/decoding DNS requests. >>> >>> http://github.com/erlang/otp/blob/dev/lib/kernel/src/inet_dns.erl >>> http://github.com/erlang/otp/blob/dev/lib/kernel/src/inet_dns.hrl >>> >>> >>> -Joe >>> >>> >>> i have successfully used inet_dns in my inet_mdns project works great >>> Yeah, seems to work well for me as well. Way better than implementing the encoding/decoding myself. :) -Joe -- Name: Joseph A. Williams Email: joe@REDACTED Blog: http://www.joeandmotorboat.com/ From francesco@REDACTED Mon Mar 8 19:48:54 2010 From: francesco@REDACTED (Francesco Cesarini (Erlang Solutions)) Date: Mon, 08 Mar 2010 18:48:54 +0000 Subject: Erlang User Group Meetup in London; Justin Sheehy, Ulf Wiger & Joe Armstrong Message-ID: <4B954696.2070903@erlang-solutions.com> For all you Londoners out there, there will be an amazing Erlang User Group meeting in London this Thursday, March 11th. Speakers include * Ulf Wiger talking about "Erlang in the Clouds" * Justin Sheehy presenting an "Introduction to RIAK" * Joe Armstrong talking about "Erlang Libraries" The meetup will take place in the Queen Elizabeth Center (Not our offices) between 18.30 and 20.30; their closest tube is Westminster. This is a free event, but to attend you need to register. Follow the link at http://www.erlang-solutions.com/events/2/entry/1133 If you are based in London and want to receive more updates on similar events, join the Erlang London User Group mailing list, top right corner of http://www.erlang-solutions.com/etc/usergroup/london as we only occasionally advertise these talks on the Erlang Questions mailing list. Hope to see you there. So far, over 30 people have registered. Francesco --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From kenneth.lundin@REDACTED Mon Mar 8 22:47:40 2010 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Mon, 8 Mar 2010 22:47:40 +0100 Subject: How to get better ranking for erlang.org when googling for erlang Message-ID: Hi, erlang.org is the official web site for Open Source Erlang and is maintained by us the Erlang/OTP team at Ericsson. When I search for Erlang at Google I notice that the highest ranked hit is the same content as we have on erlang.org but from one of the mirror sites (which also have problems with some llinks). The URL is http://ftp.sunet.se/pub/lang/erlang/. Can anyone give me an explanation for why the mirror site get a higher rank and what I can do to change this and get the highest rank for http://erlang.org or http://www.erlang.org instead? I also notice that a search at Yahoo give me the result I want i.e http://www.erlang.org as the highest ranked hit. /Kenneth, Erlang/OTP , Ericsson From chris.duesing@REDACTED Mon Mar 8 23:07:15 2010 From: chris.duesing@REDACTED (Chris Duesing) Date: Mon, 8 Mar 2010 16:07:15 -0600 Subject: [erlang-questions] How to get better ranking for erlang.org when googling for erlang In-Reply-To: References: Message-ID: Google's currency is links, so we should probably all make sure our blogs, tutorials etc all have a link to erlang.org. As far as ftp.sunet.se goes, if it is just a mirror and someone here controls it they should probably 301 redirect to erlang.org. We don't need 2 version of the same site do we? On Mon, Mar 8, 2010 at 3:47 PM, Kenneth Lundin wrote: > Hi, > > erlang.org is the official web site for Open Source Erlang and is > maintained by us the > Erlang/OTP team at Ericsson. > > When I search for Erlang at Google I notice that the highest ranked hit is > the same content as we have on erlang.org but from one of the mirror > sites (which also have > problems with some llinks). The URL is http://ftp.sunet.se/pub/lang/erlang/. > > Can anyone give me an explanation for why the mirror site get a higher > rank and what I can do to change > this and get the highest rank for http://erlang.org or > http://www.erlang.org instead? > > I also notice that a search at Yahoo give me the result I want i.e > http://www.erlang.org as the highest ranked hit. > > /Kenneth, Erlang/OTP , Ericsson > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From hd2010@REDACTED Mon Mar 8 23:32:43 2010 From: hd2010@REDACTED (Henning Diedrich) Date: Mon, 08 Mar 2010 23:32:43 +0100 Subject: [erlang-questions] How to get better ranking for erlang.org when googling for erlang In-Reply-To: References: Message-ID: <4B957B0B.7040503@eonblast.com> I found searching Erlang docs generally more tedious than for other languages. adding site:erlang.org to the search term turns out to be the fastest way to get an answer from erlang.org via web search. Even then searches can be convoluted. E.g. try "time site:erlang.org". The top result page does not even consider itself to be urgently relevant, as can be seen from its title: http://www.erlang.org/faq/academic.html I think using some keywords in the doc sources might go a long way. Not sure if this could be automated. Otherwise, obviously, that would be quite some task. It could make the web feel a lot friendlier for Erlang newbies though and I volunteer to help if somebody takes it upon himself to lead the way there. Thanks, Henning Chris Duesing wrote: > Google's currency is links, so we should probably all make sure our > blogs, tutorials etc all have a link to erlang.org. > > As far as ftp.sunet.se goes, if it is just a mirror and someone here > controls it they should probably 301 redirect to erlang.org. We don't > need 2 version of the same site do we? > > On Mon, Mar 8, 2010 at 3:47 PM, Kenneth Lundin wrote: > >> Hi, >> >> erlang.org is the official web site for Open Source Erlang and is >> maintained by us the >> Erlang/OTP team at Ericsson. >> >> When I search for Erlang at Google I notice that the highest ranked hit is >> the same content as we have on erlang.org but from one of the mirror >> sites (which also have >> problems with some llinks). The URL is http://ftp.sunet.se/pub/lang/erlang/. >> >> Can anyone give me an explanation for why the mirror site get a higher >> rank and what I can do to change >> this and get the highest rank for http://erlang.org or >> http://www.erlang.org instead? >> >> I also notice that a search at Yahoo give me the result I want i.e >> http://www.erlang.org as the highest ranked hit. >> >> /Kenneth, Erlang/OTP , Ericsson >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED >> >> >> > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > > From erlang@REDACTED Mon Mar 8 23:52:54 2010 From: erlang@REDACTED (Stefan Marr) Date: Mon, 8 Mar 2010 23:52:54 +0100 Subject: [erlang-questions] How to get better ranking for erlang.org when googling for erlang In-Reply-To: <4B957B0B.7040503@eonblast.com> References: <4B957B0B.7040503@eonblast.com> Message-ID: On 08 Mar 2010, at 23:32, Henning Diedrich wrote: > I found searching Erlang docs generally more tedious than for other languages. I would google for: erlang man time which usually turns up the interesting result at the first position. Best regards Stefan http://www.google.com/search?q=erlang+man+time -- Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 2974 Fax: +32 2 629 3525 From dale@REDACTED Tue Mar 9 00:02:53 2010 From: dale@REDACTED (Dale Harvey) Date: Mon, 8 Mar 2010 23:02:53 +0000 Subject: [erlang-questions] How to get better ranking for erlang.org when googling for erlang In-Reply-To: References: <4B957B0B.7040503@eonblast.com> Message-ID: the google web master tools are the best place to start http://www.google.com/webmasters/tools/ im guessing since there is a verify meta tag, you have already started on there as Chris said the big issue is that the mirror is crawled at all, duplicate content is a huge no no in google, and sunet.se already has a pagerank of 8. a robots.txt, noindex in the html, but even so google usually figures out what the canonical domain is from mirrors, you can use google to search for incoming links, link:http://ftp.sunet.se/pub/lang/erlang/ gives the same as link:http://erlang.org which is probably where the problem lies, how is the mirror implemented, is there any way the dns for erlang.org could resolve to the mirror when serving the robot? the webmaster tools should help you debug but as far as I can see google thinks links to erlang.org are actually to ftp.sunet there are a few issues on erlang.org, the html wont be doing you any favours but theres enough content coming from and links going to erlang.org that it should be #1. On 8 March 2010 22:52, Stefan Marr wrote: > > On 08 Mar 2010, at 23:32, Henning Diedrich wrote: > > > I found searching Erlang docs generally more tedious than for other > languages. > > I would google for: erlang man time > which usually turns up the interesting result at the first position. > > Best regards > Stefan > > http://www.google.com/search?q=erlang+man+time > > -- > Stefan Marr > Software Languages Lab > Vrije Universiteit Brussel > Pleinlaan 2 / B-1050 Brussels / Belgium > http://soft.vub.ac.be/~smarr > Phone: +32 2 629 2974 > Fax: +32 2 629 3525 > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From kyleqian@REDACTED Tue Mar 9 00:31:18 2010 From: kyleqian@REDACTED (=?GB2312?B?x67P/sP3?=) Date: Tue, 9 Mar 2010 07:31:18 +0800 Subject: How to send a message to all nodes without UDP broadcast? Message-ID: Hi, this may be a simple question, but I am newer and did not find the answer in book. I want to send a message to all nodes(using same cookie) in one call, but not using the UDP broadcast. How can I do this ? Can someone take one minute to answer me ? thanks! From mevans@REDACTED Tue Mar 9 00:47:31 2010 From: mevans@REDACTED (Evans, Matthew) Date: Mon, 8 Mar 2010 18:47:31 -0500 Subject: [erlang-questions] How to send a message to all nodes without UDP broadcast? In-Reply-To: References: Message-ID: Would pg help? http://www.erlang.org/doc/man/pg.html You would need to have your processes subscribe to the group, but it should work for you. -----Original Message----- From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] On Behalf Of ??? Sent: Monday, March 08, 2010 6:31 PM To: erlang-questions@REDACTED Subject: [erlang-questions] How to send a message to all nodes without UDP broadcast? Hi, this may be a simple question, but I am newer and did not find the answer in book. I want to send a message to all nodes(using same cookie) in one call, but not using the UDP broadcast. How can I do this ? Can someone take one minute to answer me ? thanks! From vinayakapawar@REDACTED Tue Mar 9 02:44:35 2010 From: vinayakapawar@REDACTED (Vinayak Pawar) Date: Tue, 9 Mar 2010 07:14:35 +0530 Subject: [erlang-questions] How to send a message to all nodes without UDP broadcast? In-Reply-To: References: Message-ID: <23237d041003081744n3b038a14xf96b8c81870afdf8@mail.gmail.com> rpc:abcast/3 or rpc:sbcast/3 might help you? On Tue, Mar 9, 2010 at 5:01 AM, ??? wrote: > Hi, this may be a simple question, but I am newer and did not find the > answer in book. I want to send a message to all nodes(using same cookie) in > one call, but not using the UDP broadcast. How can I do this ? Can someone > take one minute to answer me ? thanks! > From raimo+erlang-questions@REDACTED Tue Mar 9 12:40:13 2010 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Tue, 9 Mar 2010 12:40:13 +0100 Subject: [erlang-questions] Number of dns resolvers In-Reply-To: <9dfb3ec1003021441n7922f5afpafb0a187344dc0f9@mail.gmail.com> References: <9dfb3ec1003011143y1b07c524u6ca89e0d774cbbec@mail.gmail.com> <9dfb3ec1003021244i2f5bfd25v44e0e63ed9063de0@mail.gmail.com> <9dfb3ec1003021320y9245dcej5d53dddd89cd4932@mail.gmail.com> <7add27fb1003021430k39f97d53saf1e0b418dd1afd1@mail.gmail.com> <9dfb3ec1003021441n7922f5afpafb0a187344dc0f9@mail.gmail.com> Message-ID: <20100309114013.GA23647@erix.ericsson.se> Step up to at least R13B02 or try the undocumented kernel option: $ erl -kernel gethost_poolsize 17 On Wed, Mar 03, 2010 at 01:41:55AM +0300, Konstantin Sorokin wrote: > On Wed, Mar 3, 2010 at 1:30 AM, Yuri Ginsburg wrote: > > That's the line: > > {resolv_conf, "/etc/resolv.conf"} > > that causes syntax error on R12... but is OK in R13.. > > No. At least it is not true for Erlang R13B0, which is shipped with fedora 12 I have tested and it works in R13B02 but not in R13B plain. Unfortunately I have no R13B01 for quick testing but the features were introduced in R13B02; part of release notes for R13B02-1 : --- kernel-2.13.3 ------------------------------------------------------- OTP-7955 The DNS resolver client inet_res has been rewritten, documented and released. See inet_res(3) and Erts User's Guide: Inet configuration. It can formally not be incompatible with respect to earlier versions since there was no earlier official version. However it was used before and some details have changed. Configuration now initializes from /etc/resolv.conf and /etc/hosts on all unix platforms regardless of which distribution mode the node is started in. The directory (/etc) these files are supposed to reside in can be changed via an environment variable. These configuration file locations can also be changed in the inet configuration. The files are monitored for change and re-read, which makes a few resolver configuration variables out of application control. The /etc/hosts entries have now their own cache table that is shadowed (with lookup method 'file' is used) by the application configured host entries. This problem (that inet_res configuration only worked for distribution mode long names) was among other reported by Matthew O'Gorman many moons ago. The lookup methods are still 'native' only per default. Resolver configuration is done on all Unix platforms just to get a usable configuration for direct calls to inet_res. The functions inet_res:nslookup/3..5 and inet_res:nnslookup/4..4 are no longer recommended to use, instead use inet_res:lookup/3..5 and inet_res:resolve/3..5 which provide clearer argument types and the possibility to override options in the call. Users of previous unsupported versions of inet_res have included internal header files to get to the internal record definitions in order to examine DNS replies. This is still unsupported and there are access functions in inet_dns to use instead. These are documented in inet_res(3). Bug fix: a compression reference loop would make DNS message decoding loop forever. Problem reported by Florian Weimer. Bug fix and patch suggestion by Sergei Golovan: configuring IPv6 nameservers did not work. His patch (as he warned) created many UDP sockets; one per nameserver. This has been fixed in the released version. Improvement: inet_res is now EDNS0 capable. The current implementation is simple and does not probe and cache EDNS info for nameservers, which a fully capable implementation probably should do. EDNS has to be enabled via resolver configuration, and if a nameserver replies that it does not support EDNS, inet_res falls back to a regular DNS query. Improvement: now inet_res automatically falls back to TCP if it gets a truncated answer from a nameserver. Warning: some of the ancient and exotic record types handled by inet_res and inet_dns are not supported by current versions of BIND, so they could not be tested after the rewrite, with reasonable effort, e.g MD, MF, NULL, and SPF. The risk for bugs in these particular records is still low since their code is mostly shared with other tested record types. > > [kvs@REDACTED ~]$ cat /home/kvs/.erl_inetrc > %{file, resolv, "/etc/resolv.conf"}. > {resolv_conf, "/etc/resolv.conf"}. > {file, hosts, "/etc/hosts"}. > {cache_size, 0}. > {lookup, [dns]}. > [kvs@REDACTED ~]$ erl -kernel inetrc "'/home/kvs/.erl_inetrc'" > {error_logger,{{2010,3,3},{1,39,57}},"inet_config: syntax error in > ~s~n",['/home/kvs/.erl_inetrc']} > Erlang R13B01 (erts-5.7.2) [source] [rq:1] [async-threads:0] [hipe] > [kernel-poll:false] > > > =ERROR REPORT==== 3-Mar-2010::01:39:57 === > inet_config: syntax error in /home/kvs/.erl_inetrc > Eshell V5.7.2 (abort with ^G) > 1> > [kvs@REDACTED ~]$ rpm -qa | grep erlang > erlang-R13B-01.3.fc12.i686 > > -- > Konstantin Sorokin > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From mazen.harake@REDACTED Tue Mar 9 13:25:17 2010 From: mazen.harake@REDACTED (Mazen Harake) Date: Tue, 9 Mar 2010 12:25:17 +0000 (GMT) Subject: Where is Erlang making use of ncurses? Message-ID: <1380959549.115291268137517715.JavaMail.root@zimbra> Hi all, Recently I created an ncurses wrapper in Erlang to be able to write text based GUIs called cecho (I have released it under the BSD license here: http://github.com/mazenharake/cecho) Anyway there is a bug I have come across which is extremely annoying and I'm beginning to think that perhaps Erlang is interfering with the commands I'm using because it itself uses ncurses. The problem is that when ever I use the move function to the max y,x of the terminal (getmaxyx/2 and - 1 on the values) and add a character the beam crash with the error: /home/mazen//lib/erlang/erts-5.7.4/bin/beam.smp: : Unknown error 4294967295 All other positions work fine. I believe it has something to do with wrapping the last line or something. Is it possible that Erlang is interfering and if so where do I find where Erlang is using the ncurses library? I tried grep-ing and searching for any reference in the C code but I can't find anything. I'm starting the shell like this: erl -pa ../cecho/ebin/ -noshell -setcookie cookie -sname cecho Erlang version and various: Erlang R13B03 (erts-5.7.4) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false] Suse 11.2 Linux moltov 2.6.31.5-0.1-desktop #1 SMP PREEMPT 2009-10-26 15:49:03 +0100 i686 i686 i386 GNU/Linux /Mazen --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From raimo+erlang-questions@REDACTED Tue Mar 9 13:26:20 2010 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Tue, 9 Mar 2010 13:26:20 +0100 Subject: [erlang-questions] dns server In-Reply-To: <4B95467E.6010002@joetify.com> References: <4B88DF87.5000208@joetify.com> <4B8B0325.7070101@joetify.com> <20100304022553.GA48853@k2r.org> <4B907CF9.6090305@joetify.com> <4B95248B.6020201@joetify.com> <4B95467E.6010002@joetify.com> Message-ID: <20100309122620.GB23647@erix.ericsson.se> On Mon, Mar 08, 2010 at 10:48:30AM -0800, Joe Williams wrote: > > >>>For anyone interested, inet_dns (undocumented afaict) does all the heavy > >>>lifting for encoding/decoding DNS requests. > >>> > >>>http://github.com/erlang/otp/blob/dev/lib/kernel/src/inet_dns.erl > >>>http://github.com/erlang/otp/blob/dev/lib/kernel/src/inet_dns.hrl > >>> > >>> > >>>-Joe > >>> > >>> > > >>>i have successfully used inet_dns in my inet_mdns project works great > >>> > > Yeah, seems to work well for me as well. Way better than implementing > the encoding/decoding myself. :) Unfortunately it does not compress (reuse) labels any good when encoding. It is on my ToDo list but not prioritized... > > -Joe > > > -- > Name: Joseph A. Williams > Email: joe@REDACTED > Blog: http://www.joeandmotorboat.com/ > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From leap@REDACTED Tue Mar 9 14:53:23 2010 From: leap@REDACTED (Michael Turner) Date: Tue, 09 Mar 2010 13:53:23 +0000 Subject: Cesarini/Thompson wxErlang chapter - how to write lastLineRange? Message-ID: I'm trying to work through the wx example in Cesarini & Thompson (chapter "GUI programming with wxErlang". On p.319 there are two calls to a function lastLineRange on a wx TextCtrl. The authors don't supply this function, and I can't see any corresponding C++ member function in the wxTextCtrl API here http://docs.wxwidgets.org/trunk/classwx_text_ctrl.html It's looking like I have to write lastLineRange myself, to finish working through this chapter. Unless ... someone else has already run into this roadblock, got around it, and can map out the detour for me? I'm sure I'll kludge something up, but it would be nice to do this one more or less by the book, if possible. -michael turner From navaneethanit@REDACTED Tue Mar 9 17:15:31 2010 From: navaneethanit@REDACTED (NavaTux) Date: Tue, 9 Mar 2010 08:15:31 -0800 (PST) Subject: Problem on starting mochiweb Message-ID: Hi friends, In my Ubntu hardy i installed erlang/otp,mochiweb using subversion,then i just wanna to start mochiweb,by following these // after installed mochiweb gone to the /skel dir navtux@REDACTED:~/mochiweb$ cd /home/navtux/mochiweb/priv/skel // In the /skel dir i found /.start.sh so i run navtux@REDACTED:~/mochiweb/priv/skel$ ./start.sh //then it displayed the below Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [kernel-poll:false] =PROGRESS REPORT==== 9-Mar-2010::17:28:06 === supervisor: {local,sasl_safe_sup} started: [{pid,<0.34.0>}, {name,alarm_handler}, {mfa,{alarm_handler,start_link,[]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,worker}] =PROGRESS REPORT==== 9-Mar-2010::17:28:06 === supervisor: {local,sasl_safe_sup} started: [{pid,<0.35.0>}, {name,overload}, {mfa,{overload,start_link,[]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,worker}] =PROGRESS REPORT==== 9-Mar-2010::17:28:06 === supervisor: {local,sasl_sup} started: [{pid,<0.33.0>}, {name,sasl_safe_sup}, {mfa, {supervisor, start_link, [{local,sasl_safe_sup},sasl,safe]}}, {restart_type,permanent}, {shutdown,infinity}, {child_type,supervisor}] =PROGRESS REPORT==== 9-Mar-2010::17:28:06 === supervisor: {local,sasl_sup} started: [{pid,<0.36.0>}, {name,release_handler}, {mfa,{release_handler,start_link,[]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,worker}] =PROGRESS REPORT==== 9-Mar-2010::17:28:06 === application: sasl started_at: nonode@REDACTED {"init terminating in do_boot",{undef,[{skel,start,[]},{init,start_it, 1},{init,start_em,1}]}} init terminating in do_boot () navtux@REDACTED:~/mochiweb/priv/skel$ after that what i need to do? after doing the above i entered localhost:8000 in my browser but nothing happened,just error shown i don't know what happened the above? please explain? then how to start mochiweb?what is the problem actually? where i have to install mochiweb? whether i can install any directory in ubuntu?or not?i installed in my home directory"navtux" From kenneth.lundin@REDACTED Tue Mar 9 18:23:28 2010 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Tue, 9 Mar 2010 18:23:28 +0100 Subject: [erlang-questions] Where is Erlang making use of ncurses? In-Reply-To: <1380959549.115291268137517715.JavaMail.root@zimbra> References: <1380959549.115291268137517715.JavaMail.root@zimbra> Message-ID: Hi, Erlang uses ncurses in the terminal driver for the so called new shell. http://github.com/erlang/otp/blob/pu/erts/emulator/drivers/unix/ttsl_drv.c It is also possible to build an Erlang ersion which does not use term_cap with the configure option Some of the available configure options are: ... --{with,without}-termcap: termcap (without implies that only the old Erlang shell can be used) ... /Kenneth Erlang/OTP Ericsson On Tue, Mar 9, 2010 at 1:25 PM, Mazen Harake wrote: > Hi all, > > Recently I created an ncurses wrapper in Erlang to be able to write text based GUIs called cecho (I have released it under the BSD license here: http://github.com/mazenharake/cecho) > > Anyway there is a bug I have come across which is extremely annoying and I'm beginning to think that perhaps Erlang is interfering with the commands I'm using because it itself uses ncurses. The problem is that when ever I use the move function to the max y,x of the terminal (getmaxyx/2 and - 1 on the values) and add a character the beam crash with the error: > > /home/mazen//lib/erlang/erts-5.7.4/bin/beam.smp: : Unknown error 4294967295 > > All other positions work fine. I believe it has something to do with wrapping the last line or something. Is it possible that Erlang is interfering and if so where do I find where Erlang is using the ncurses library? I tried grep-ing and searching for any reference in the C code but I can't find anything. > > I'm starting the shell like this: > erl -pa ../cecho/ebin/ -noshell -setcookie cookie -sname cecho > > Erlang version and various: > Erlang R13B03 (erts-5.7.4) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false] > Suse 11.2 > Linux moltov 2.6.31.5-0.1-desktop #1 SMP PREEMPT 2009-10-26 15:49:03 +0100 i686 i686 i386 GNU/Linux > > /Mazen > --------------------------------------------------- > > --------------------------------------------------- > > WE'VE CHANGED NAMES! > > Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. > > www.erlang-solutions.com > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From zeno490@REDACTED Tue Mar 9 20:46:13 2010 From: zeno490@REDACTED (Nicholas Frechette) Date: Tue, 9 Mar 2010 14:46:13 -0500 Subject: Erlang deamon question Message-ID: Hi, Supposed I had a single erlang application running as a deamon/service in a VM. What would be the best way to communicate with it with a command line application, keeping in mind I could have any number of them running at the same time. I am under the impression that I cannot reuse the built in erlang node communication protocol (erl -name foobar) and rpc:call mainly because I would have to generate random names for my client applications every time it is ran, and that could pollute the atom pool of the service. Note also that I can trust the clients and am not concerned about security here. I presume I am stuck implementing a socket based rpc module? Is there something already done for this in erlang? I really would love to just reuse erlang terms in my arguments/return values. I am unlikely to have clients in other languages but cross language usage could be a plus. Thoughts? Nicholas From vinoski@REDACTED Tue Mar 9 20:54:39 2010 From: vinoski@REDACTED (Steve Vinoski) Date: Tue, 9 Mar 2010 14:54:39 -0500 Subject: [erlang-questions] Erlang deamon question In-Reply-To: References: Message-ID: <65b2728e1003091154m33f3dfddm8013d8020a1d2fd1@mail.gmail.com> On Tue, Mar 9, 2010 at 2:46 PM, Nicholas Frechette wrote: > Hi, > Supposed I had a single erlang application running as a deamon/service in a > VM. > What would be the best way to communicate with it with a command line > application, keeping in mind I could have any number of them running at the > same time. > I am under the impression that I cannot reuse the built in erlang node > communication protocol (erl -name foobar) and rpc:call mainly because I > would have to generate random names for my client applications every time it > is ran, and that could pollute the atom pool of the service. Note also that > I can trust the clients and am not concerned about security here. > > I presume I am stuck implementing a socket based rpc module? Is there > something already done for this in erlang? I really would love to just reuse > erlang terms in my arguments/return values. I am unlikely to have clients in > other languages but cross language usage could be a plus. Maybe http://erlang.org/doc/man/erl_call.html could help? --steve From dale@REDACTED Tue Mar 9 21:01:08 2010 From: dale@REDACTED (Dale Harvey) Date: Tue, 9 Mar 2010 20:01:08 +0000 Subject: [erlang-questions] Erlang deamon question In-Reply-To: References: Message-ID: how many shell clients do you expect to be making? we use dynamic client names but itll be a few years till we take up the atom pool, if that became a problem I would probably just make the list of names that could be generated a fixed size. On 9 March 2010 19:46, Nicholas Frechette wrote: > Hi, > Supposed I had a single erlang application running as a deamon/service in a > VM. > What would be the best way to communicate with it with a command line > application, keeping in mind I could have any number of them running at the > same time. > I am under the impression that I cannot reuse the built in erlang node > communication protocol (erl -name foobar) and rpc:call mainly because I > would have to generate random names for my client applications every time > it > is ran, and that could pollute the atom pool of the service. Note also that > I can trust the clients and am not concerned about security here. > > I presume I am stuck implementing a socket based rpc module? Is there > something already done for this in erlang? I really would love to just > reuse > erlang terms in my arguments/return values. I am unlikely to have clients > in > other languages but cross language usage could be a plus. > > Thoughts? > Nicholas > From zeno490@REDACTED Tue Mar 9 22:01:37 2010 From: zeno490@REDACTED (Nicholas Frechette) Date: Tue, 9 Mar 2010 16:01:37 -0500 Subject: [erlang-questions] Erlang deamon question In-Reply-To: References: Message-ID: In a production box, I'd estimate >5000 a year, maybe more. erl_call seems like the right thing except it would require me to call os:cmd :S and then parse the result from string -> terms Is there no way to use rpc:call and the likes from an offline node? On Tue, Mar 9, 2010 at 3:01 PM, Dale Harvey wrote: > how many shell clients do you expect to be making? we use dynamic client > names but itll be a few years till we take up the atom pool, if that became > a problem I would probably just make the list of names that could be > generated a fixed size. > > > On 9 March 2010 19:46, Nicholas Frechette wrote: > >> Hi, >> Supposed I had a single erlang application running as a deamon/service in >> a >> VM. >> What would be the best way to communicate with it with a command line >> application, keeping in mind I could have any number of them running at >> the >> same time. >> I am under the impression that I cannot reuse the built in erlang node >> communication protocol (erl -name foobar) and rpc:call mainly because I >> would have to generate random names for my client applications every time >> it >> is ran, and that could pollute the atom pool of the service. Note also >> that >> I can trust the clients and am not concerned about security here. >> >> I presume I am stuck implementing a socket based rpc module? Is there >> something already done for this in erlang? I really would love to just >> reuse >> erlang terms in my arguments/return values. I am unlikely to have clients >> in >> other languages but cross language usage could be a plus. >> >> Thoughts? >> Nicholas >> > > From anthonym@REDACTED Tue Mar 9 23:02:50 2010 From: anthonym@REDACTED (Anthony Molinaro) Date: Tue, 9 Mar 2010 14:02:50 -0800 Subject: [erlang-questions] Erlang deamon question In-Reply-To: References: Message-ID: <20100309220250.GA37561@alumni.caltech.edu> Hi Nicholas, I used Paul's instructions here http://dukesoferl.blogspot.com/2010/01/minor-erlang-interface-tricks.html along with erlstart http://code.google.com/p/erlrc/source/browse/trunk/erlstart/ to have a single beam running on a box. Then if I need to run a remote command I can run "erlstart-eval ''" to eval some erlang in the running beam, or "erlstart-remsh" to get a remote shell on the running vm. I also use erlrc and framewerk to create rpms for all my erlang applications, which makes deployment of applications and sub-applications easy, at it usually just involves 'yum install ' and erlrc does the upgrade via the release_handler. Anyway, you can use erlstart standalone if you just want an easy remote shell, shell evaluator, and etop for a locally running beam. -Anthony On Tue, Mar 09, 2010 at 02:46:13PM -0500, Nicholas Frechette wrote: > Hi, > Supposed I had a single erlang application running as a deamon/service in a > VM. > What would be the best way to communicate with it with a command line > application, keeping in mind I could have any number of them running at the > same time. > I am under the impression that I cannot reuse the built in erlang node > communication protocol (erl -name foobar) and rpc:call mainly because I > would have to generate random names for my client applications every time it > is ran, and that could pollute the atom pool of the service. Note also that > I can trust the clients and am not concerned about security here. > > I presume I am stuck implementing a socket based rpc module? Is there > something already done for this in erlang? I really would love to just reuse > erlang terms in my arguments/return values. I am unlikely to have clients in > other languages but cross language usage could be a plus. > > Thoughts? > Nicholas -- ------------------------------------------------------------------------ Anthony Molinaro From fritchie@REDACTED Tue Mar 9 23:18:35 2010 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Tue, 09 Mar 2010 16:18:35 -0600 Subject: [erlang-questions] Erlang deamon question In-Reply-To: Message of "Tue, 09 Mar 2010 16:01:37 EST." Message-ID: <60076.1268173115@snookles.snookles.com> Nicholas Frechette wrote: nf> Is there no way to use rpc:call and the likes from an offline node? Yes, I suppose so, but then it wouldn't be offline, either. An escript is welcome to call net_adm:ping/1 (the lazy way, and assumes that you have "-name foo" or "-sname foo" embedded in the "%%!" line at the top of the escript) or call net_kernel:start/1 and net_kernel:connect_node/1 and then use rpc:call(), !, or whatever you want to communicate with whatever you want. In some shell scripts, we use "erl -sname tmp$$ -remsh foo@REDACTED ..." to do our bidding. If you were really, ultra-super worried about exhausing the atom table after creating 'tmp72' and 'tmp66523', then you can use net_kernel:start/1 in an iterative loop to try 'tmp0', 'tmp1', and so on until you managed to get an {ok, Pid} return value. Or use the undocumented (?) kernel module 'erl_epmd' to help find an unused name, though you'd still have to be prepared to try again in the case of 2 VMs racing to register the same name. -Scott From clist@REDACTED Wed Mar 10 02:20:33 2010 From: clist@REDACTED (Angel) Date: Wed, 10 Mar 2010 02:20:33 +0100 Subject: [erlang-questions] Cesarini/Thompson wxErlang chapter - how to write lastLineRange? In-Reply-To: References: Message-ID: <201003100220.33468.clist@uah.es> On Martes, 9 de Marzo de 2010 14:53:23 Michael Turner escribi?: > I'm trying to work through the wx example in Cesarini & Thompson > (chapter "GUI programming with wxErlang". On p.319 there are two > calls to a function lastLineRange on a wx TextCtrl. The authors don't > supply this function, and I can't see any corresponding C++ member > function in the wxTextCtrl API here > > http://docs.wxwidgets.org/trunk/classwx_text_ctrl.html > > It's looking like I have to write lastLineRange myself, to finish > working through this chapter. Unless ... someone else has already run > into this roadblock, got around it, and can map out the detour for me? > I'm sure I'll kludge something up, but it would be nice to do this one > more or less by the book, if possible. > > -michael turner > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > lastLineRange seems to be a local function, not a wxwidgets one, maybe they didnt want to use undo facilities for the text control... (too complicated for a example) a quick fix (not tested) for this can be: LastLineRange(Text) -> ListOfLines=string:tokens(Text,[[10]]), %% Tokenize buffer on newlines LastLine=lists:last(ListOfLines), %% find the last line StarPos= wxTextCtrl:getlastposition() - length(LastLine), EndPos = wxTextCtrl:getlastposition, {StarPos,EndPos} Maybe it just works, YMMV /angel Most people know C is not so high level.... ...Everybody else just got assembler overdose From leap@REDACTED Wed Mar 10 14:52:44 2010 From: leap@REDACTED (Michael Turner) Date: Wed, 10 Mar 2010 13:52:44 +0000 Subject: C&T p.319 lastLineRange/1, if anybody wants it ..... In-Reply-To: <201003100220.33468.clist@uah.es> Message-ID: Thanks, Angel, but Text is, in this case a wxTextCtrl, not a string. I went with the following, which seems to be doing the trick so far: lastLineRange(T) -> { wxTextCtrl:xYToPosition(T,0,wxTextCtrl:getNumberOfLines(T)-1), wxTextCtrl:getLastPosition (T) } -michael turner On 3/10/2010, "Angel" wrote: >On Martes, 9 de Marzo de 2010 14:53:23 Michael Turner escribi?: >> I'm trying to work through the wx example in Cesarini & Thompson >> (chapter "GUI programming with wxErlang". On p.319 there are two >> calls to a function lastLineRange on a wx TextCtrl. The authors don't >> supply this function, and I can't see any corresponding C++ member >> function in the wxTextCtrl API here >> >> http://docs.wxwidgets.org/trunk/classwx_text_ctrl.html >> >> It's looking like I have to write lastLineRange myself, to finish >> working through this chapter. Unless ... someone else has already run >> into this roadblock, got around it, and can map out the detour for me? >> I'm sure I'll kludge something up, but it would be nice to do this one >> more or less by the book, if possible. >> >> -michael turner >> >> >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED >> >lastLineRange seems to be a local function, not a wxwidgets one, maybe they >didnt want to use undo facilities for the text control... (too complicated for >a example) > >a quick fix (not tested) for this can be: > >LastLineRange(Text) -> > ListOfLines=string:tokens(Text,[[10]]), %% Tokenize buffer on newlines > LastLine=lists:last(ListOfLines), %% find the last line > StarPos= wxTextCtrl:getlastposition() - length(LastLine), > EndPos = wxTextCtrl:getlastposition, > {StarPos,EndPos} > > >Maybe it just works, YMMV > >/angel > > >Most people know C is not so high level.... > ...Everybody else just got assembler overdose > > >________________________________________________________________ >erlang-questions (at) erlang.org mailing list. >See http://www.erlang.org/faq.html >To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From rwillmer@REDACTED Thu Mar 11 00:40:11 2010 From: rwillmer@REDACTED (Rachel Willmer) Date: Wed, 10 Mar 2010 23:40:11 +0000 Subject: 8k limit on gen_tcp:recv? Message-ID: <5cd112871003101540t4386d69anb5fc23e3d4ac93d3@mail.gmail.com> I've been debugging a problem whereby couchdb rejects a URL longer than 8k. At first, I thought it was an already known limitation in mochiweb (the stack is couchdb/mochiweb/erlang). But with large amounts of ioformat debugging, I've pinned it down to a call from mochiweb to gen_tcp:recv which fails on this long URL. Is this a known limitation in erlang's gen_tcp:recv? Rachel From bob@REDACTED Thu Mar 11 00:48:17 2010 From: bob@REDACTED (Bob Ippolito) Date: Wed, 10 Mar 2010 15:48:17 -0800 Subject: [erlang-questions] 8k limit on gen_tcp:recv? In-Reply-To: <5cd112871003101540t4386d69anb5fc23e3d4ac93d3@mail.gmail.com> References: <5cd112871003101540t4386d69anb5fc23e3d4ac93d3@mail.gmail.com> Message-ID: <6a36e7291003101548h137c040dve690e8cdcd378a82@mail.gmail.com> Since this is definitely not clear in the question, the code would look something like this: inet:setopts(Socket, [{packet, http}]), case gen_tcp:recv(Socket, 0, ?IDLE_TIMEOUT) of {ok, {http_request, Method, Path, Version}} -> headers(Socket, {Method, Path, Version}, [], Body, 0) end. Rachel - how about providing a reproducible test case and making it an issue in the mochiweb project? There might be some continuation response from recv that mochiweb doesn't currently expect to receive. http://code.google.com/p/mochiweb/issues/entry On Wed, Mar 10, 2010 at 3:40 PM, Rachel Willmer wrote: > I've been debugging a problem whereby couchdb rejects a URL longer than 8k. > > At first, I thought it was an already known limitation in mochiweb > (the stack is couchdb/mochiweb/erlang). > > But with large amounts of ioformat debugging, I've pinned it down to a > call from mochiweb to gen_tcp:recv which fails on this long URL. > > Is this a known limitation in erlang's gen_tcp:recv? > > Rachel > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From rwillmer@REDACTED Thu Mar 11 00:57:07 2010 From: rwillmer@REDACTED (Rachel Willmer) Date: Wed, 10 Mar 2010 23:57:07 +0000 Subject: [erlang-questions] 8k limit on gen_tcp:recv? In-Reply-To: <6a36e7291003101548h137c040dve690e8cdcd378a82@mail.gmail.com> References: <5cd112871003101540t4386d69anb5fc23e3d4ac93d3@mail.gmail.com> <6a36e7291003101548h137c040dve690e8cdcd378a82@mail.gmail.com> Message-ID: <5cd112871003101557q1b56251aq42110e460642fb@mail.gmail.com> I'll add the test case tomorrow morning, it is 100% repeatable. >From what I could see from the response from gen_tcp:recv, it's just returning an error, not a continuation response, so I don't think there's anything for mochiweb to handle. But yes, I will add the test case and the diagnostic tomorrow. Just wanted to check now that this wasn't already a known issue/limitation. Rachel From bob@REDACTED Thu Mar 11 01:14:40 2010 From: bob@REDACTED (Bob Ippolito) Date: Wed, 10 Mar 2010 16:14:40 -0800 Subject: [erlang-questions] 8k limit on gen_tcp:recv? In-Reply-To: <5cd112871003101557q1b56251aq42110e460642fb@mail.gmail.com> References: <5cd112871003101540t4386d69anb5fc23e3d4ac93d3@mail.gmail.com> <6a36e7291003101548h137c040dve690e8cdcd378a82@mail.gmail.com> <5cd112871003101557q1b56251aq42110e460642fb@mail.gmail.com> Message-ID: <6a36e7291003101614x1c4c8ed1s629cb72483686c1@mail.gmail.com> At some point you have to give up on parsing a long URL to prevent a denial of service attack. I don't know if that limit is documented or configurable, I haven't recently looked at the code that handles parsing HTTP requests. I'm sure someone knows about it, but it's definitely not something everyone knows. Is there a use case for such a long URL? Most browsers and servers have some kind of limit (2038 for IE, 8190 for apache 2.2 by default, 16k for IIS, ...). 8k might be a little conservative, but how far do you really want to go? On Wed, Mar 10, 2010 at 3:57 PM, Rachel Willmer wrote: > I'll add the test case tomorrow morning, it is 100% repeatable. > > From what I could see from the response from gen_tcp:recv, it's just > returning an error, not a continuation response, so I don't think > there's anything for mochiweb to handle. > > But yes, I will add the test case and the diagnostic tomorrow. Just > wanted to check now that this wasn't already a known issue/limitation. > > Rachel > From kyleqian@REDACTED Thu Mar 11 03:34:38 2010 From: kyleqian@REDACTED (=?GB2312?B?x67P/sP3?=) Date: Thu, 11 Mar 2010 10:34:38 +0800 Subject: Does Erlang have global register process name? Message-ID: Hi, I want to send text messages between two computers, and I use 'register' BIF to register atom name for one computer. But I find that I can not send message by this: pong ! hello. I must use this : { pong, kyle@REDACTED } ! hello. So the registered name is only used in one node ? Not in all nodes using same cookies? The first method got 'bad argument' exception. If I want to register a name for all nodes using same cookies, how can I do it? Thanks! I will appreciate if anyone can give some relative resource url to me! From jeffm@REDACTED Thu Mar 11 03:49:11 2010 From: jeffm@REDACTED (Jeffm) Date: Thu, 11 Mar 2010 13:49:11 +1100 Subject: [erlang-questions] Does Erlang have global register process name? In-Reply-To: References: Message-ID: <4B985A27.60807@ghostgun.com> Take a look at register_name/2 and whereis_name/1 both part of the global module. Does that do what your after? Jeff. On 11/03/10 1:34 PM, ??? wrote: > Hi, I want to send text messages between two computers, and I use 'register' > BIF to register atom name for one computer. But I find that I can not send > message by this: > pong ! hello. > I must use this : > { pong, kyle@REDACTED } ! hello. > So the registered name is only used in one node ? Not in all nodes using > same cookies? The first method got 'bad argument' exception. > If I want to register a name for all nodes using same cookies, how can I do > it? > > Thanks! I will appreciate if anyone can give some relative resource url to > me! > > From bob@REDACTED Thu Mar 11 03:49:21 2010 From: bob@REDACTED (Bob Ippolito) Date: Wed, 10 Mar 2010 18:49:21 -0800 Subject: [erlang-questions] Does Erlang have global register process name? In-Reply-To: References: Message-ID: <6a36e7291003101849n77deb830jd9a1fc3098d1d19c@mail.gmail.com> http://www.erlang.org/doc/man/global.html On Wed, Mar 10, 2010 at 6:34 PM, ??? wrote: > Hi, I want to send text messages between two computers, and I use 'register' > BIF to register atom name for one computer. But I find that I can not send > message by this: > ?pong ! hello. > I must use this : > ?{ pong, kyle@REDACTED } ! hello. > So the registered name is only used in one node ? Not in all nodes using > same cookies? The first method got 'bad argument' exception. > If I want to register a name for all nodes using same cookies, how can I do > it? > > Thanks! I will appreciate if anyone can give some relative resource url to > me! > From vinoski@REDACTED Thu Mar 11 04:43:04 2010 From: vinoski@REDACTED (Steve Vinoski) Date: Wed, 10 Mar 2010 22:43:04 -0500 Subject: [erlang-questions] 8k limit on gen_tcp:recv? In-Reply-To: <6a36e7291003101548h137c040dve690e8cdcd378a82@mail.gmail.com> References: <5cd112871003101540t4386d69anb5fc23e3d4ac93d3@mail.gmail.com> <6a36e7291003101548h137c040dve690e8cdcd378a82@mail.gmail.com> Message-ID: <65b2728e1003101943j3bbe04fjc29f3bc09f536b07@mail.gmail.com> Try setting your socket's receive buffer to something larger than 8k before you do the recv: inet:setopts(Socket, [{recbuf,16384}]). By passing a 0 for the length to recv, you're telling it to receive all available bytes. I assume it can't receive more bytes than its buffer can store. --steve On Wed, Mar 10, 2010 at 6:48 PM, Bob Ippolito wrote: > Since this is definitely not clear in the question, the code would > look something like this: > > ? ?inet:setopts(Socket, [{packet, http}]), > ? ?case gen_tcp:recv(Socket, 0, ?IDLE_TIMEOUT) of > ? ? ? ?{ok, {http_request, Method, Path, Version}} -> > ? ? ? ? ? ?headers(Socket, {Method, Path, Version}, [], Body, 0) > ? ?end. > > Rachel - how about providing a reproducible test case and making it an > issue in the mochiweb project? There might be some continuation > response from recv that mochiweb doesn't currently expect to receive. > > http://code.google.com/p/mochiweb/issues/entry > > On Wed, Mar 10, 2010 at 3:40 PM, Rachel Willmer wrote: >> I've been debugging a problem whereby couchdb rejects a URL longer than 8k. >> >> At first, I thought it was an already known limitation in mochiweb >> (the stack is couchdb/mochiweb/erlang). >> >> But with large amounts of ioformat debugging, I've pinned it down to a >> call from mochiweb to gen_tcp:recv which fails on this long URL. >> >> Is this a known limitation in erlang's gen_tcp:recv? >> >> Rachel >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED >> >> > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From tony@REDACTED Thu Mar 11 11:31:11 2010 From: tony@REDACTED (Tony Rogvall) Date: Thu, 11 Mar 2010 11:31:11 +0100 Subject: [erlang-questions] 8k limit on gen_tcp:recv? In-Reply-To: <65b2728e1003101943j3bbe04fjc29f3bc09f536b07@mail.gmail.com> References: <5cd112871003101540t4386d69anb5fc23e3d4ac93d3@mail.gmail.com> <6a36e7291003101548h137c040dve690e8cdcd378a82@mail.gmail.com> <65b2728e1003101943j3bbe04fjc29f3bc09f536b07@mail.gmail.com> Message-ID: <781EE251-9CFB-429B-9D49-123229AD591A@rogvall.se> Note that setting the recbuf not only updates the inet driver read buffer but also the sets the SO_RCVBUF socket option. This is not always what you want!!! First consult the networking documentation on TCP and buffer management to see if this will result in unwanted behavior. If you do not know exactly what recbuf does you may instead use the option {buffer, Size} which only affects the inet driver read buffer /Tony On 11 mar 2010, at 04.43, Steve Vinoski wrote: > Try setting your socket's receive buffer to something larger than 8k > before you do the recv: > > inet:setopts(Socket, [{recbuf,16384}]). > > By passing a 0 for the length to recv, you're telling it to receive > all available bytes. I assume it can't receive more bytes than its > buffer can store. > > --steve > > On Wed, Mar 10, 2010 at 6:48 PM, Bob Ippolito wrote: >> Since this is definitely not clear in the question, the code would >> look something like this: >> >> inet:setopts(Socket, [{packet, http}]), >> case gen_tcp:recv(Socket, 0, ?IDLE_TIMEOUT) of >> {ok, {http_request, Method, Path, Version}} -> >> headers(Socket, {Method, Path, Version}, [], Body, 0) >> end. >> >> Rachel - how about providing a reproducible test case and making it an >> issue in the mochiweb project? There might be some continuation >> response from recv that mochiweb doesn't currently expect to receive. >> >> http://code.google.com/p/mochiweb/issues/entry >> >> On Wed, Mar 10, 2010 at 3:40 PM, Rachel Willmer wrote: >>> I've been debugging a problem whereby couchdb rejects a URL longer than 8k. >>> >>> At first, I thought it was an already known limitation in mochiweb >>> (the stack is couchdb/mochiweb/erlang). >>> >>> But with large amounts of ioformat debugging, I've pinned it down to a >>> call from mochiweb to gen_tcp:recv which fails on this long URL. >>> >>> Is this a known limitation in erlang's gen_tcp:recv? >>> >>> Rachel >>> >>> ________________________________________________________________ >>> erlang-questions (at) erlang.org mailing list. >>> See http://www.erlang.org/faq.html >>> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED >>> >>> >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED >> >> > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > From hynek@REDACTED Thu Mar 11 13:13:33 2010 From: hynek@REDACTED (Hynek Vychodil) Date: Thu, 11 Mar 2010 13:13:33 +0100 Subject: [erlang-questions] Guards on assignment (i.e. assertions) In-Reply-To: References: Message-ID: <4d08db371003110413l64546d61q775e5e0059c14a31@mail.gmail.com> What about true = B > C, A = B On Mon, Mar 1, 2010 at 9:00 PM, Garrett Smith wrote: > In most cases, assertions come "free" in Erlang in guards and pattern > matching. There are cases though where I'd like to apply a guard a > statement like this: > > ?A = B when B > C > > I currently do this: > > ?A = case B of ValidB when ValidB > C -> ValidB end > > or, a simpler form (but the error message on failure isn't as clear): > > ?A = if B > C -> B end > > There are other ways as well, e.g. using functions, etc. but I like > the first form. > > I'm wondering how others implement basic assertions on assignments. I > think if the first form were supported by the language, I'd use the > "assert" pattern and my code would be better for it. > > Garrett > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try GoodData now for free: www.gooddata.com From zabrane3@REDACTED Thu Mar 11 15:45:52 2010 From: zabrane3@REDACTED (zabrane Mikael) Date: Thu, 11 Mar 2010 15:45:52 +0100 Subject: Good leex and yeec tutorials Message-ID: <18a1db031003110645g751e578bj7587064705dcbfb7@mail.gmail.com> Hi list, Is there a good tutos/examples on Leex and Yecc? Regards Zabrane From attila.r.nohl@REDACTED Thu Mar 11 16:07:41 2010 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Thu, 11 Mar 2010 16:07:41 +0100 Subject: [erlang-questions] Good leex and yeec tutorials In-Reply-To: <18a1db031003110645g751e578bj7587064705dcbfb7@mail.gmail.com> References: <18a1db031003110645g751e578bj7587064705dcbfb7@mail.gmail.com> Message-ID: <401d3ba31003110707h12cea372rd2c65358965fb179@mail.gmail.com> 2010/3/11, zabrane Mikael : > Hi list, > > Is there a good tutos/examples on Leex and Yecc? Try this: http://hopper.squarespace.com/blog/2008/5/29/leex-and-yecc.html From zabrane3@REDACTED Thu Mar 11 21:01:48 2010 From: zabrane3@REDACTED (zabrane Mikael) Date: Thu, 11 Mar 2010 21:01:48 +0100 Subject: [erlang-questions] Good leex and yeec tutorials In-Reply-To: <401d3ba31003110707h12cea372rd2c65358965fb179@mail.gmail.com> References: <18a1db031003110645g751e578bj7587064705dcbfb7@mail.gmail.com> <401d3ba31003110707h12cea372rd2c65358965fb179@mail.gmail.com> Message-ID: <18a1db031003111201l167cb98cha1e14ca9fb25a44f@mail.gmail.com> Thanks Attila ! Any other pointer will be very welcome /Zabrane 2010/3/11 Attila Rajmund Nohl > 2010/3/11, zabrane Mikael : > > Hi list, > > > > Is there a good tutos/examples on Leex and Yecc? > > Try this: > > http://hopper.squarespace.com/blog/2008/5/29/leex-and-yecc.html > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From Loren.Schlomer@REDACTED Thu Mar 11 21:53:59 2010 From: Loren.Schlomer@REDACTED (Schlomer, Loren) Date: Thu, 11 Mar 2010 13:53:59 -0700 Subject: odbc:param_query with null? Message-ID: <6294CCE6B4CE7D4D81822D7408E0D6570AEF7B09AA@ECHOEXCC1.SATS.CORP> This question was asked a while ago in another thread, http://www.erlang.org/cgi-bin/ezmlm-cgi?4:mss:46559:200909:lcobkadmljdengloaain But I cannot find an answer for it. I have a use case where I have a real-time stream of data coming in that needs to be dumped to a relational database. A number of the fields are nullable, and there is no guarantee that there will be data there, but I need to treat the update as if it were there. For example, "insert into TableX values (?, ?, ?)" where the third parameter should be of type float, so the parameters would be [..., {sql_float, [Value]}], however, Value may contain a real value, or it may be undefined.. Of course, odbc:param_query/3 will complain if this value does not match the parameter type. Does anyone know of an elegant work around? Some of the tables I am updating may have a dozen or so nullable fields, so having a custom SQL statement for each permutation to catch null fields is certainly not ideal. Thanks for your help! -ls From clist@REDACTED Thu Mar 11 23:22:08 2010 From: clist@REDACTED (Angel) Date: Thu, 11 Mar 2010 23:22:08 +0100 Subject: [erlang-questions] Re: C&T p.319 lastLineRange/1, if anybody wants it ..... In-Reply-To: References: Message-ID: <201003112322.08663.clist@uah.es> My fault!! Yeahh i didnt bother to read p 318 where is clear that Text is a control.. :-( I tried to understand the undo mechanism so i forgot completly about the subject... Thanks! On Mi?rcoles, 10 de Marzo de 2010 14:52:44 Michael Turner escribi?: > Thanks, Angel, but Text is, in this case a wxTextCtrl, not a string. > > I went with the following, which seems to be doing the trick so far: > > lastLineRange(T) -> > { wxTextCtrl:xYToPosition(T,0,wxTextCtrl:getNumberOfLines(T)-1), > wxTextCtrl:getLastPosition (T) } > > -michael turner > > On 3/10/2010, "Angel" wrote: > >On Martes, 9 de Marzo de 2010 14:53:23 Michael Turner escribi?: > >> I'm trying to work through the wx example in Cesarini & Thompson > >> (chapter "GUI programming with wxErlang". On p.319 there are two > >> calls to a function lastLineRange on a wx TextCtrl. The authors don't > >> supply this function, and I can't see any corresponding C++ member > >> function in the wxTextCtrl API here > >> > >> http://docs.wxwidgets.org/trunk/classwx_text_ctrl.html > >> > >> It's looking like I have to write lastLineRange myself, to finish > >> working through this chapter. Unless ... someone else has already run > >> into this roadblock, got around it, and can map out the detour for me? > >> I'm sure I'll kludge something up, but it would be nice to do this one > >> more or less by the book, if possible. > >> > >> -michael turner > >> > >> > >> > >> ________________________________________________________________ > >> erlang-questions (at) erlang.org mailing list. > >> See http://www.erlang.org/faq.html > >> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > > >lastLineRange seems to be a local function, not a wxwidgets one, maybe > > they didnt want to use undo facilities for the text control... (too > > complicated for a example) > > > >a quick fix (not tested) for this can be: > > > >LastLineRange(Text) -> > > ListOfLines=string:tokens(Text,[[10]]), %% Tokenize buffer on newlines > > LastLine=lists:last(ListOfLines), %% find the last line > > StarPos= wxTextCtrl:getlastposition() - length(LastLine), > > EndPos = wxTextCtrl:getlastposition, > > {StarPos,EndPos} > > > > > >Maybe it just works, YMMV > > > >/angel > > > > > >Most people know C is not so high level.... > > ...Everybody else just got assembler overdose > > > > > >________________________________________________________________ > >erlang-questions (at) erlang.org mailing list. > >See http://www.erlang.org/faq.html > >To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > Most people know C is not so high level.... ...Everybody else just got assembler overdose From kyleqian@REDACTED Fri Mar 12 04:27:36 2010 From: kyleqian@REDACTED (=?GB2312?B?x67P/sP3?=) Date: Fri, 12 Mar 2010 11:27:36 +0800 Subject: Test code for global module does not work... Message-ID: Hi, I use global module to test global name, but it does not work. This is the simple test code: -module(testglobal). -export([start_server/0, start_client/0, server/0]). server()-> receive stop -> io:format("Stop server.~n", []); hello -> io:format("Receive hello~n", []), server() end. start_client()-> global:send(gn_server, hello), global:send(gn_server, stop). start_server()-> global:register_name(gn_server, spawn(testglobal, server, [])). Call start_server in one computer(winxp) first, then call start_client in another computer(win2003) with same cookies. But start_client() failed with error {badarg, {gn_server, hello}}. It looks like that the name is invalid. So what is wrong in the code above? By the way, the references say: *If Name is not a globally registered name, the calling function will exit with reason {badarg, {Name, Msg}}. *So If I want to process the failure rather than just exit with reason badarg, what should I do ? Use try ... catch? I want to register new process with that name when the send failed. From bernie@REDACTED Fri Mar 12 04:39:07 2010 From: bernie@REDACTED (Bernard Duggan) Date: Fri, 12 Mar 2010 14:39:07 +1100 Subject: [erlang-questions] Test code for global module does not work... In-Reply-To: References: Message-ID: <4B99B75B.5050401@m5net.com> ??? wrote: > Hi, I use global module to test global name, but it does not work. This is > the simple test code: > By default a node won't just automatically know about every other node on your network. You need to suggest to one that it go looking for the other with something like: pong = net_adm:ping('remote_node@REDACTED'). (obviously substituting in your actual node name). > [snip] > By the way, the references say: *If Name is not a globally registered name, > the calling function will exit with reason {badarg, {Name, Msg}}. *So If I > want to process the failure rather than just exit with reason badarg, what > should I do ? Use try ... catch? I want to register new process with that > name when the send failed. > Yep, try-catch is probably the way I would do it. The other option is to check for the registered name with global:whereis_name/1 first (but depending on your setup that could allow for a race condition where a name becomes unregistered between that call and the attempt to send to it). Cheers, Bernard From stondage123@REDACTED Fri Mar 12 04:49:14 2010 From: stondage123@REDACTED (Andrew Stone) Date: Thu, 11 Mar 2010 19:49:14 -0800 (PST) Subject: [erlang-questions] Test code for global module does not work... In-Reply-To: References: Message-ID: <471488.74883.qm@web35902.mail.mud.yahoo.com> You need to connect the nodes on the two computers. You can due this in multiple ways, one of them being net_kernel:connect_node/1. See http://erlang.org/doc/man/net_kernel.html for more info. Also, You may want to read more about distributed erlang here: http://www.erlang.org/doc/reference_manual/distributed.html -Andrew ----- Original Message ---- From: ??? To: erlang-questions@REDACTED Sent: Thu, March 11, 2010 10:27:36 PM Subject: [erlang-questions] Test code for global module does not work... Hi, I use global module to test global name, but it does not work. This is the simple test code: -module(testglobal). -export([start_server/0, start_client/0, server/0]). server()-> receive stop -> io:format("Stop server.~n", []); hello -> io:format("Receive hello~n", []), server() end. start_client()-> global:send(gn_server, hello), global:send(gn_server, stop). start_server()-> global:register_name(gn_server, spawn(testglobal, server, [])). Call start_server in one computer(winxp) first, then call start_client in another computer(win2003) with same cookies. But start_client() failed with error {badarg, {gn_server, hello}}. It looks like that the name is invalid. So what is wrong in the code above? By the way, the references say: *If Name is not a globally registered name, the calling function will exit with reason {badarg, {Name, Msg}}. *So If I want to process the failure rather than just exit with reason badarg, what should I do ? Use try ... catch? I want to register new process with that name when the send failed. From navaneethanit@REDACTED Fri Mar 12 10:26:29 2010 From: navaneethanit@REDACTED (NavaTux) Date: Fri, 12 Mar 2010 01:26:29 -0800 (PST) Subject: mochiweb vs Nitrogen Message-ID: <0d3b75f4-6219-49d7-a650-0c9155c2136c@t17g2000prg.googlegroups.com> which is good for you??why??? In my system nitrogen was good to install,because i failed to install mochiweb??? I wanna develop a web application in erlang,so i am calling you for the suggestion to use the above one :-) you can give here in your way!!! From dawid.figiel@REDACTED Fri Mar 12 12:12:36 2010 From: dawid.figiel@REDACTED (Dawid Figiel) Date: Fri, 12 Mar 2010 11:12:36 +0000 (GMT) Subject: [erlang-questions] mochiweb vs Nitrogen In-Reply-To: <588504809.128061268391842803.JavaMail.root@zimbra> Message-ID: <719763447.128101268392356782.JavaMail.root@zimbra> Try Erlang-Web. http://www.erlang-web.org/ This framework is easy to learn, scalable and extensible. We have done several projects in this like: http://www.erlang-solutions.com http://www.erlang-factory.com http://www.erlang-web.org http://www.umbria-rentals.com http://www.erlangprogramming.org http://www.streamfile.com http://www.protest-project.eu If you need any help you may ask here:) The code which you write will be well structured (wparts, wtypes, drivers, templates, htmls). Framework is well documented and supported. Have fun :) -- best, Dawid Figiel www.erlang-solutions.com ----- Original Message ----- From: "NavaTux" To: erlang-questions@REDACTED Sent: Friday, March 12, 2010 9:26:29 AM GMT +00:00 GMT Britain, Ireland, Portugal Subject: [erlang-questions] mochiweb vs Nitrogen which is good for you??why??? In my system nitrogen was good to install,because i failed to install mochiweb??? I wanna develop a web application in erlang,so i am calling you for the suggestion to use the above one :-) you can give here in your way!!! ________________________________________________________________ erlang-questions (at) erlang.org mailing list. See http://www.erlang.org/faq.html To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED From karlsson.rm@REDACTED Fri Mar 12 12:52:34 2010 From: karlsson.rm@REDACTED (Mikael Karlsson) Date: Fri, 12 Mar 2010 03:52:34 -0800 (PST) Subject: new new in parameterized modules causes beam_dead Message-ID: <0e04c9dd-1764-4bf1-8c2a-6e5453021c33@g19g2000yqe.googlegroups.com> Hi, I am trying to redefine the "new" function in a parameterized module (ref. http://ftp.sunet.se/pub/lang/erlang/euc/07/papers/1700Carlsson.pdf) , but the compiler crashes with: 11> c(ewgi_req.erl). Function new/1 refers to undefined label 15 ./ewgi_req.erl:none: internal error in beam_dead; crash reason: {{case_clause,{'EXIT',{undefined_label,15}}}, [{compile,'-select_passes/2-anonymous-2-',2}, {compile,'-internal_comp/4-anonymous-1-',2}, {compile,fold_comp,3}, {compile,internal_comp,4}, {compile,internal,3}]} error Any ideas? Workaround for now is to name the my "new" fun to "new1" and call the default "new" from this one. Cheers Mikael From aquino.gustavo@REDACTED Fri Mar 12 15:47:55 2010 From: aquino.gustavo@REDACTED (Gustavo Aquino) Date: Fri, 12 Mar 2010 11:47:55 -0300 Subject: Compiling Erlang on Power6 processors Message-ID: <5ef296b31003120647j7fbaeeccu5bc53cc5be6192e4@mail.gmail.com> Hi, I'm trying to compile Erlang R13B04 on IBM P550 with 6 processors p6, with RHE for ppc and getting this error when running ./configure. checking whether the child waiter thread should be enabled... no checking for kstat_open in -lkstat... no checking for tgetent in -lncurses... no checking for tgetent in -lcurses... no checking for tgetent in -ltermcap... no checking for tgetent in -ltermlib... no *configure: error: No curses library functions found* *configure: error: /bin/sh '/root/downloads/otp_src_R13B04/erts/configure' failed for erts* But Ncourses are installed. [otp_src_R13B04]# yum install ncurses Loaded plugins: rhnplugin, security Setting up Install Process *Package ncurses-5.5-24.20060715.ppc64 already installed and latest version* *Package ncurses-5.5-24.20060715.ppc already installed and latest version* Nothing to do Anybody can help me ? To compile Erlang I need other version of ncourses, which ? Regards. From lemenkov@REDACTED Fri Mar 12 15:51:18 2010 From: lemenkov@REDACTED (Peter Lemenkov) Date: Fri, 12 Mar 2010 17:51:18 +0300 Subject: [erlang-questions] Compiling Erlang on Power6 processors In-Reply-To: <5ef296b31003120647j7fbaeeccu5bc53cc5be6192e4@mail.gmail.com> References: <5ef296b31003120647j7fbaeeccu5bc53cc5be6192e4@mail.gmail.com> Message-ID: Hello All! 2010/3/12 Gustavo Aquino : > Hi, > > I'm trying to compile Erlang R13B04 on IBM P550 with 6 processors p6, with > RHE for ppc and getting this error when running ./configure. > > > checking whether the child waiter thread should be enabled... no > checking for kstat_open in -lkstat... no > checking for tgetent in -lncurses... no > checking for tgetent in -lcurses... no > checking for tgetent in -ltermcap... no > checking for tgetent in -ltermlib... no > *configure: error: No curses library functions found* > *configure: error: /bin/sh '/root/downloads/otp_src_R13B04/erts/configure' > failed for erts* ncurses-devel is missing. -- With best regards, Peter Lemenkov. From karlsson.rm@REDACTED Fri Mar 12 16:17:48 2010 From: karlsson.rm@REDACTED (Mikael Karlsson) Date: Fri, 12 Mar 2010 16:17:48 +0100 Subject: [erlang-questions] new new in parameterized modules causes beam_dead In-Reply-To: <4B9A579E.4060807@gmail.com> References: <0e04c9dd-1764-4bf1-8c2a-6e5453021c33@g19g2000yqe.googlegroups.com> <4B9A579E.4060807@gmail.com> Message-ID: <872e77ab1003120717o10bdd18ev60629dde0fbfc83e@mail.gmail.com> Yes, I just figured out what the problem is. In my new "new" function I call another function which I defined in my module: helper_fun(X) -> xxx. new(Z) -> A = helper_fun(Z), ... intance(X,Y,Z1). This does not work. It seems that other funs can only be called from an instanciated module, like: .. M1 = mod1:new(Z), M1:helper_fun(X), .. Works OK after removing internal calls. /Mikael 2010/3/12 Richard Carlsson > Mikael Karlsson wrote: > > Hi, > > I am trying to redefine the "new" function in a parameterized module > > (ref. http://ftp.sunet.se/pub/lang/erlang/euc/07/papers/1700Carlsson.pdf > ) > > , > > but the compiler crashes with: > > > > 11> c(ewgi_req.erl). > > Function new/1 refers to undefined label 15 > > ./ewgi_req.erl:none: internal error in beam_dead; > > crash reason: {{case_clause,{'EXIT',{undefined_label,15}}}, > > [{compile,'-select_passes/2-anonymous-2-',2}, > > {compile,'-internal_comp/4-anonymous-1-',2}, > > {compile,fold_comp,3}, > > {compile,internal_comp,4}, > > {compile,internal,3}]} > > error > > > > Any ideas? > > > > Workaround for now is to name the my "new" fun to "new1" and call the > > default "new" from this one. > > Can you post a minimal example that triggers this? > > /Richard > From francesco@REDACTED Fri Mar 12 17:24:22 2010 From: francesco@REDACTED (Francesco Cesarini (Erlang Solutions)) Date: Fri, 12 Mar 2010 16:24:22 +0000 Subject: TFP 2010 - 3rd CFP: Submit papers by April 9, REGISTRATION IS OPEN Message-ID: <4B9A6AB6.7070906@erlang-solutions.com> TFP 2010: 11th SYMPOSIUM ON TRENDS IN FUNCTIONAL PROGRAMMING May 17-19, 2010 University of Oklahoma http://www.cs.ou.edu/tfp2010/ TFP 2010 is an international forum for researchers with interests in any aspect of functional programming. SUBMISSION and REGISTRATION DEADLINES April 9: Submission deadline (extended from April 2) April 16: Early registration deadline ($350, $200 for students) May 7: Late registration deadline ($425) May 17-19: TFP Symposium POST-SYMPOSIUM PROCEEDINGS Springer series: Lecture Notes in Computer Science Details about the event schedule, symposium scope, submissions, and registration may be found on the symposium website. http://www.cs.ou.edu/tfp2010/ (Web browser key "tfp 2010") In addition to the symposium's stimulating presentations and discussions, highlights include an invited talk by J Strother Moore, an outing to view the superb collection of art of the American West at the Cowboy Hall of Fame, and a festive banquet. Submitted papers and extended abstracts are reviewed for presentation at the symposium, and a formal refereeing process after the symposium selects the best presentations for publication in the Springer series, Lecture Notes in Computer Science. We invite you to participate in TFP 2010. REGISTRATION IS OPEN! - Rex Page, University of Oklahoma, Program Chair - Vikt?ria Zs?k and Zolt?n Horvath, E?tv?s Lor?nd University, Symposium Co-Chairs Sponsors: Erlang Solutions Ltd and The University of Oklahoma --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From aquino.gustavo@REDACTED Fri Mar 12 17:44:42 2010 From: aquino.gustavo@REDACTED (Gustavo Aquino) Date: Fri, 12 Mar 2010 13:44:42 -0300 Subject: [erlang-questions] Compiling Erlang on Power6 processors In-Reply-To: References: <5ef296b31003120647j7fbaeeccu5bc53cc5be6192e4@mail.gmail.com> Message-ID: <5ef296b31003120844s4c8b315q4f2e7c664e0352d@mail.gmail.com> Thanks Peter, this was the problem. On Fri, Mar 12, 2010 at 11:51 AM, Peter Lemenkov wrote: > Hello All! > > 2010/3/12 Gustavo Aquino : > > Hi, > > > > I'm trying to compile Erlang R13B04 on IBM P550 with 6 processors p6, > with > > RHE for ppc and getting this error when running ./configure. > > > > > > checking whether the child waiter thread should be enabled... no > > checking for kstat_open in -lkstat... no > > checking for tgetent in -lncurses... no > > checking for tgetent in -lcurses... no > > checking for tgetent in -ltermcap... no > > checking for tgetent in -ltermlib... no > > *configure: error: No curses library functions found* > > *configure: error: /bin/sh > '/root/downloads/otp_src_R13B04/erts/configure' > > failed for erts* > > ncurses-devel is missing. > > > -- > With best regards, Peter Lemenkov. > From camilo.cerchiari@REDACTED Fri Mar 12 20:03:03 2010 From: camilo.cerchiari@REDACTED (Camilo Cerchiari) Date: Fri, 12 Mar 2010 17:03:03 -0200 Subject: what about little-endians? Message-ID: <588b5a841003121103l7ff25466vf47f506f890a2d15@mail.gmail.com> hello all, i'm working on a system that receives socket messages with a 4 bytes header containing an unsigned integer representing the size in bytes of the rest of the message. everything would be just fine if the header was in big-endian byte order, as i could set inet:setopts(Socket, [{active,true},{packet,4}]) and receive the socket packets as erlang messages. unfortunately the header is in little-endian byte order. so... why only big-endian is available for inet:setops? are there any plans for including support for little-endians like my clients? if no plans... i would like to add that -1, -2, -4 packet options in the code myself. could you give me some tips to get started with that? in a first quick search i didn't get to the part of the code that controls that. thanks in advance, salutes, Camilo From max.lapshin@REDACTED Fri Mar 12 20:20:20 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 12 Mar 2010 22:20:20 +0300 Subject: [erlang-questions] what about little-endians? In-Reply-To: <588b5a841003121103l7ff25466vf47f506f890a2d15@mail.gmail.com> References: <588b5a841003121103l7ff25466vf47f506f890a2d15@mail.gmail.com> Message-ID: I think, you will be refused for this feature, because big-endian is standard for network transmission. In this case you will have to write your own buffered demuxer. From camilo.cerchiari@REDACTED Fri Mar 12 20:45:02 2010 From: camilo.cerchiari@REDACTED (Camilo Cerchiari) Date: Fri, 12 Mar 2010 17:45:02 -0200 Subject: [erlang-questions] what about little-endians? In-Reply-To: References: <588b5a841003121103l7ff25466vf47f506f890a2d15@mail.gmail.com> Message-ID: <588b5a841003121145m4cc38971lc767fa9028ddc998@mail.gmail.com> i'm ok with writing it just for myself, if it would be so. some advice to get started with the code is then what i'm looking for. where should i start? On Fri, Mar 12, 2010 at 17:20, Max Lapshin wrote: > I think, you will be refused for this feature, because big-endian is > standard for network transmission. > In this case you will have to write your own buffered demuxer. > From luismarianoguerra@REDACTED Fri Mar 12 21:39:03 2010 From: luismarianoguerra@REDACTED (Mariano Guerra) Date: Fri, 12 Mar 2010 21:39:03 +0100 Subject: [erlang-questions] Good leex and yeec tutorials In-Reply-To: <18a1db031003111201l167cb98cha1e14ca9fb25a44f@mail.gmail.com> References: <18a1db031003110645g751e578bj7587064705dcbfb7@mail.gmail.com> <401d3ba31003110707h12cea372rd2c65358965fb179@mail.gmail.com> <18a1db031003111201l167cb98cha1e14ca9fb25a44f@mail.gmail.com> Message-ID: On Thu, Mar 11, 2010 at 9:01 PM, zabrane Mikael wrote: > Thanks Attila ! > Any other pointer will be very welcome before starting to work on efene[1] I did a step by step calculator that ended up in something more complex than a calculator[2] the code is separated by steps, I didn't documented it but it can be useful to see the code grow adding new features. disclaimer, I learned using leex and yecc with that code some in the first steps they may be some bad usage that is fixed in later steps. for a complex usage of leex and yecc you can see efene's code [1] http://github.com/marianoguerra/efene [2] http://github.com/marianoguerra/match From wolfmanjm@REDACTED Fri Mar 12 23:14:06 2010 From: wolfmanjm@REDACTED (Jim Morris) Date: Fri, 12 Mar 2010 14:14:06 -0800 (PST) Subject: what about little-endians? In-Reply-To: <588b5a841003121145m4cc38971lc767fa9028ddc998@mail.gmail.com> References: <588b5a841003121103l7ff25466vf47f506f890a2d15@mail.gmail.com> <588b5a841003121145m4cc38971lc767fa9028ddc998@mail.gmail.com> Message-ID: <7fc9aded-800d-41fe-967a-e0af7fb47259@c37g2000prb.googlegroups.com> I wrote a blog post on solving this exact same problem. http://blog.wolfman.com/articles/2009/4/13/dealing-with-an-tcp-packet-with-a-little-endian-header-in-erlang-gen-tcp I looked at changing get_tcp to fix it, but big-endian packet counts is very ingrained, and would be a hard fix. On Mar 12, 11:45?am, Camilo Cerchiari wrote: > i'm ok with writing it just for myself, if it would be so. > some advice to get started with the code is then what i'm looking for. > where should i start? > > On Fri, Mar 12, 2010 at 17:20, Max Lapshin wrote: > > I think, you will be refused for this feature, because big-endian is > > standard for network transmission. > > In this case you will have to write your own buffered demuxer. From zabrane3@REDACTED Fri Mar 12 23:16:56 2010 From: zabrane3@REDACTED (zabrane Mikael) Date: Fri, 12 Mar 2010 23:16:56 +0100 Subject: [erlang-questions] Good leex and yeec tutorials In-Reply-To: References: <18a1db031003110645g751e578bj7587064705dcbfb7@mail.gmail.com> <401d3ba31003110707h12cea372rd2c65358965fb179@mail.gmail.com> <18a1db031003111201l167cb98cha1e14ca9fb25a44f@mail.gmail.com> Message-ID: <18a1db031003121416h1be2a757uc9838305c37e0f31@mail.gmail.com> Thanks guys ! Efene seems the right place to look into ;-) 2010/3/12 Mariano Guerra > On Thu, Mar 11, 2010 at 9:01 PM, zabrane Mikael > wrote: > > Thanks Attila ! > > Any other pointer will be very welcome > > before starting to work on efene[1] I did a step by step calculator > that ended up in something more complex than a calculator[2] > the code is separated by steps, I didn't documented it but it can be > useful to see the code grow adding new features. > > disclaimer, I learned using leex and yecc with that code some in the > first steps they may be some bad usage that is fixed in later steps. > > for a complex usage of leex and yecc you can see efene's code > > [1] http://github.com/marianoguerra/efene > [2] http://github.com/marianoguerra/match > From wolfmanjm@REDACTED Fri Mar 12 23:29:43 2010 From: wolfmanjm@REDACTED (Jim Morris) Date: Fri, 12 Mar 2010 14:29:43 -0800 (PST) Subject: what about little-endians? In-Reply-To: <588b5a841003121145m4cc38971lc767fa9028ddc998@mail.gmail.com> References: <588b5a841003121103l7ff25466vf47f506f890a2d15@mail.gmail.com> <588b5a841003121145m4cc38971lc767fa9028ddc998@mail.gmail.com> Message-ID: <4cdd56a7-cbfc-47fc-92ca-fc924b4675c0@u15g2000prd.googlegroups.com> I wrote a blog entry with potential solutions for exactly this problem... http://blog.wolfman.com/articles/2009/4/13/dealing-with-an-tcp-packet-with-a-little-endian-header-in-erlang-gen-tcp I did look in detail at modifying the Erlang code to accept little endian packet counts, but it is pretty ingrained in several places, and would not be easy to do. On Mar 12, 11:45?am, Camilo Cerchiari wrote: > i'm ok with writing it just for myself, if it would be so. > some advice to get started with the code is then what i'm looking for. > where should i start? > > On Fri, Mar 12, 2010 at 17:20, Max Lapshin wrote: > > I think, you will be refused for this feature, because big-endian is > > standard for network transmission. > > In this case you will have to write your own buffered demuxer. From tony@REDACTED Sat Mar 13 00:26:45 2010 From: tony@REDACTED (Tony Rogvall) Date: Sat, 13 Mar 2010 00:26:45 +0100 Subject: [erlang-questions] what about little-endians? In-Reply-To: <588b5a841003121103l7ff25466vf47f506f890a2d15@mail.gmail.com> References: <588b5a841003121103l7ff25466vf47f506f890a2d15@mail.gmail.com> Message-ID: erts/emulator/beam/packet_parser.c update the packet_get_length function with the new packet types. suggestion TCP_PB_LE2, TCP_PB_LE4 (-1 is obviously not needed unless you mean to reverse the bits ;-) You should then be able to use the bif erlang:decode_packet/3 to test your extension like: erlang:decode_packet(2, <<0,2, 1, 2, 3>>, []). {ok,<<1,2>>,<<3>>} /Tony On 12 mar 2010, at 20.03, Camilo Cerchiari wrote: > hello all, > > i'm working on a system that receives socket messages with a 4 bytes header > containing an unsigned integer representing the size in bytes of the rest of > the message. > > everything would be just fine if the header was in big-endian byte order, as > i could set inet:setopts(Socket, [{active,true},{packet,4}]) and receive the > socket packets as erlang messages. > > unfortunately the header is in little-endian byte order. so... why only > big-endian is available for inet:setops? are there any plans for including > support for little-endians like my clients? if no plans... i would like to > add that -1, -2, -4 packet options in the code myself. could you give me > some tips to get started with that? in a first quick search i didn't get to > the part of the code that controls that. > > thanks in advance, > salutes, > Camilo From adam.kocoloski@REDACTED Sat Mar 13 01:38:21 2010 From: adam.kocoloski@REDACTED (Adam Kocoloski) Date: Fri, 12 Mar 2010 19:38:21 -0500 Subject: debugging VM segfaults Message-ID: Hi all, I can pretty reliably trigger a segfault in a distributed Erlang system I'm running. I've seen it happen in both 13B01 and 13B04. The backtrace generally looks like #0 do_minor (p=0x7f2bbbc63560, new_sz=, objv=0x1, nobj=1) at beam/erl_gc.c:909 #1 0x00000000004f7eb8 in erts_garbage_collect (p=0x7f2bbbc63560, need=0, objv=0x1, nobj=1) at beam/erl_gc.c:764 #2 0x00000000004f8b79 in erts_gc_after_bif_call (p=0x9, result=0, regs=0x215f330, arity=139824735676640) at beam/erl_gc.c:322 #3 0x0000000000551efd in .gc_after_bif () at hipe/hipe_amd64_glue.S:349 #4 0x00007f2b7bb3ba38 in ?? () #5 0x0000000000555e99 in nbif_unlink_1 () at x86_64-unknown-linux-gnu/opt/smp/hipe_amd64_bifs.S:6821 ... Happy to upload a full core dump somewhere if it would be helpful. I'm not getting an erl_crash.dump. Any thoughts on what the next step might be? Best, Adam From emofine@REDACTED Sat Mar 13 01:56:23 2010 From: emofine@REDACTED (Edwin) Date: Fri, 12 Mar 2010 16:56:23 -0800 (PST) Subject: what about little-endians? In-Reply-To: <588b5a841003121145m4cc38971lc767fa9028ddc998@mail.gmail.com> References: <588b5a841003121103l7ff25466vf47f506f890a2d15@mail.gmail.com> <588b5a841003121145m4cc38971lc767fa9028ddc998@mail.gmail.com> Message-ID: <429c9c48-4849-43f3-b300-f0e09df819c0@f8g2000yqn.googlegroups.com> It's not actually that difficult to decode it yourself. Switch to {active, false} and spawn a process to extract messages from the TCP stream using gen_tcp:read/2,3 and send them to your gen_fsm/ gen_server. Here's something to start you off. It does work, but I'm sure there may be bugs so no guarantees and I am certain someone else could write it better than this. -module(demux). -behaviour(gen_server). %% API -export([start/2, start_link/1, start_link/2, stop/1]). %% gen_server callbacks -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). -export([wait_recv/3, recv_loop/3]). -define(SERVER, ?MODULE). -record(state, { host, port, recv_pid, socket }). %%==================================================================== %% API %%==================================================================== start(Host, Port) when is_integer(Port) -> gen_server:start(?MODULE, [Host, Port], []). start_link(Host, Port) when is_integer(Port) -> gen_server:start_link(?MODULE, [Host, Port], []). start_link([Host, Port]) when is_list(Port) -> NPort = list_to_integer(Port), gen_server:start_link(?MODULE, [Host, NPort], []). stop(ServerRef) -> gen_server:cast(ServerRef, stop). %%==================================================================== %% gen_server callbacks %%==================================================================== % Connect to host:port and wait for it to send stuff init([Host, Port]) -> {ok, Sock} = gen_tcp:connect(Host, Port, [binary, {packet, 0}, {active, false}]), Self = self(), Pid = spawn_link(fun() -> wait_recv(Self, Sock, <<>>) end), {ok, #state{host = Host, port = Port, recv_pid = Pid, socket = Sock}}. handle_call(_Request, _From, State) -> {reply, {error, invalid_request}, State}. handle_cast(stop, State) -> (catch gen_tcp:close(State#state.socket)), {stop, normal, State}; handle_cast(_Msg, State) -> {noreply, State}. handle_info({tcp_packet, Packet}, State) -> io:format("Got a packet: ~p~n", [Packet]), % Do something with packet {noreply, State}; handle_info({recv_error, {_Error, _Socket} = Err}, State) -> io:format("Got a receive error: ~p~n", [Err]), {stop, Err, State}; handle_info(_Info, State) -> {noreply, State}. terminate(_Reason, State) -> io:format("Closing socket~n"), (catch gen_tcp:close(State#state.socket)), ok. code_change(_OldVsn, State, _Extra) -> {ok, State}. %%-------------------------------------------------------------------- %% Internal %%-------------------------------------------------------------------- wait_recv(SvrRef, Socket, Buffer) -> case gen_tcp:recv(Socket, 0) of {ok, Input} -> io:format("wait_recv: got ~p~n", [Input]), B = handle_input(SvrRef, <>), ?MODULE:recv_loop(SvrRef, Socket, B); Error -> SvrRef ! {recv_error, {Error, Socket}} end. recv_loop(SvrRef, Socket, Buffer) -> case gen_tcp:recv(Socket, 0, 0) of {ok, Input} -> % Some input waiting already io:format("recv_loop: got ~p~n", [Input]), B = handle_input(SvrRef, <>), ?MODULE:recv_loop(SvrRef, Socket, B); {error, timeout} -> % No more socket data immediately available B = handle_input(SvrRef, Buffer), ?MODULE:wait_recv(SvrRef, Socket, B); Error -> SvrRef ! {recv_error, {Error, Socket}} end. handle_input(SvrRef, <>) -> case Data of <> -> io:format("Sending tcp_packet to ~p: ~p~n", [SvrRef, Packet]), SvrRef ! {tcp_packet, Packet}, handle_input(SvrRef, Rest); TooShort -> TooShort end; handle_input(_SvrRef, <<_Data/bytes>> = B) -> B. To test it, run it in one Erlang node, and run this small test program in another: -module(demux_test). -compile([export_all]). go(Port) when is_integer(Port) -> Opts = [binary, {packet, 0}], {ok, LSock} = gen_tcp:listen(Port, Opts), {ok, Sock} = gen_tcp:accept(LSock), Msg = <<"Hello, sock.\n">>, send_msg(Sock, Msg, 100). send_msg(Sock, Msg, Count) when Count > 0 -> lists:foreach( fun(X) -> N = integer_to_list(X), NumberedMsg = list_to_binary([N, $:, Msg]), Len = byte_size(NumberedMsg), gen_tcp:send(Sock, <>) end, lists:seq(1, Count) ). Hope this helps. On Mar 12, 2:45?pm, Camilo Cerchiari wrote: > i'm ok with writing it just for myself, if it would be so. > some advice to get started with the code is then what i'm looking for. > where should i start? > > > > On Fri, Mar 12, 2010 at 17:20, Max Lapshin wrote: > > I think, you will be refused for this feature, because big-endian is > > standard for network transmission. > > In this case you will have to write your own buffered demuxer. From acton@REDACTED Sat Mar 13 04:07:03 2010 From: acton@REDACTED (Brian Acton) Date: Fri, 12 Mar 2010 19:07:03 -0800 Subject: Unicode question Message-ID: <7a9fe0201003121907y4a49d2fdma679ea2bae40b1f2@mail.gmail.com> Hi guys, I've tried to shorten my problem into a simple sub problem that hopefully, someone can provide some insight. Suppose, I am given the following utf-8 encoded input string: [ 16#e4, 16#bd, 16#a0, 16#e5, 16#a5, 16#bd, 16#e2, 16#98, 16#ba ] Which translates into three unicode code points: [20320,22909,9786] Now, I would like to shorten the string intelligently by choosing a substring that retains character boundaries but also fits within a limited number of bytes. For example. Let's say my byte limit is 5 bytes. In my example above, I can only take the first 3 bytes yielding the first character. If I try to take the next character, I will have used 6 bytes (each character in my example uses 3 bytes utf-8) and gone over my budgeted byte allocation. So, in order to solve this, I figured that I would need to be able to convert utf-8 to code point and from code point to utf-8 The problem is that I can't figure out how to convert utf-8 to code point. Everything that I have looked at yields code point to utf-8 conversion but I have not found the inverse function which converts utf-8 to code point. Am I going about this all wrong ? I've read the unicode page pretty extensively and I couldn't find anything. I also came across EEP10 but it does not look like it has been completely implemented (notably unicode:utf8_to_list is missing). I am using R13B03 Thanks in advance, --b From kyleqian@REDACTED Sat Mar 13 04:48:41 2010 From: kyleqian@REDACTED (=?GB2312?B?x67P/sP3?=) Date: Sat, 13 Mar 2010 11:48:41 +0800 Subject: About the pattern of services implemented by Erlang Message-ID: Hi, I want to implement a service by Erlang communicating with other language, such as c/c++, java, c#. Is there any common pattern I can use ? This erlang service receives requests and parameters from other softwares implemented by other language. I though TCP socket(gen_tcp) may be works. And I also want this service is high available, so if it crashed, a new service process will be started in same server computer( or another computer if that one is shutdown). For this, should I must use another computer to monitor the service process? Can supervisor module fit me? If the service is implemented using TCP socket, and if it is restarted in another computer, the client must to find the new node to submit request. This is also a question. So, Is there any common pattern I can use? From ulf.wiger@REDACTED Sat Mar 13 11:31:28 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Sat, 13 Mar 2010 11:31:28 +0100 Subject: W3C validator unhappy about the Erlang docs Message-ID: I encountered problems trying to open http://www.erlang.org/doc/man/erlang.html in Opera (it was truncated) and IE8 ("error on page"). Chrome seemed fairly content. Has anything happened to the docs recently? I ran the W3C validator on the URL just out of curiosity: http://validator.w3.org/check?uri=http://www.erlang.org/doc/man/erlang.html&charset=(detect+automatically)&doctype=Inline&group=0 It was not at all happy, FWIW. BR, Ulf W -- Ulf Wiger CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd http://www.erlang-solutions.com --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From mikpe@REDACTED Sat Mar 13 11:36:51 2010 From: mikpe@REDACTED (Mikael Pettersson) Date: Sat, 13 Mar 2010 11:36:51 +0100 Subject: [erlang-questions] debugging VM segfaults In-Reply-To: References: Message-ID: <19355.27331.418528.765627@pilspetsen.it.uu.se> Adam Kocoloski writes: > Hi all, I can pretty reliably trigger a segfault in a distributed Erlang system I'm running. I've seen it happen in both 13B01 and 13B04. The backtrace generally looks like > > #0 do_minor (p=0x7f2bbbc63560, new_sz=, objv=0x1, nobj=1) at beam/erl_gc.c:909 > #1 0x00000000004f7eb8 in erts_garbage_collect (p=0x7f2bbbc63560, need=0, objv=0x1, nobj=1) at beam/erl_gc.c:764 > #2 0x00000000004f8b79 in erts_gc_after_bif_call (p=0x9, result=0, regs=0x215f330, arity=139824735676640) at beam/erl_gc.c:322 > #3 0x0000000000551efd in .gc_after_bif () at hipe/hipe_amd64_glue.S:349 > #4 0x00007f2b7bb3ba38 in ?? () > #5 0x0000000000555e99 in nbif_unlink_1 () at x86_64-unknown-linux-gnu/opt/smp/hipe_amd64_bifs.S:6821 > ... > > Happy to upload a full core dump somewhere if it would be helpful. I'm not getting an erl_crash.dump. Any thoughts on what the next step might be? Best, Provide a minimized test case allowing the issue to be reproduced. In this case it does appear that HiPE on AMD64 is involved, so that would fall into my domain. You can also check if not using native compilation changes anything. /Mikael From g9414002.pccu.edu.tw@REDACTED Sat Mar 13 12:19:34 2010 From: g9414002.pccu.edu.tw@REDACTED (=?UTF-8?B?6buD6ICA6LOiIChZYXUtSHNpZW4gSHVhbmcp?=) Date: Sat, 13 Mar 2010 19:19:34 +0800 Subject: [SWIPL] How to accept a series of Yes & No responses without exiting the loop In-Reply-To: <27885793.post@talk.nabble.com> References: <27885793.post@talk.nabble.com> Message-ID: It's hard to locate your problem and give an answer because you described a general case. I guess you used a if-then structure that will go to end when it doesn't come up to the condition. And you ought to make two way for two conditions, Yes or No, using if-then structure, while accepting another atom cause the real ending condition. f('Yes') -> !, do_yes_part(). f('No') -> !, do_no_part(). f(_). % ending condition Or f(Input) -> 'Yes' = Input -> do_yes_part(); ( 'No' = Input -> do_no_part(); true ). On Sat, Mar 13, 2010 at 1:43 PM, PrologStudent wrote: > > I am building a small expert system in Prolog and I am having one issue and > that is when i am running the program and once i type a NO response the > program automatically ignores the rest of questions within that category > and > jumps to the other. > > What i want it to do is continue asking all the questions in that category > and then display the response instead of jumping to the second set of > questions. > > Please assist. > > -- > View this message in context: > http://old.nabble.com/How-to-accept-a-series-of-Yes---No-responses-without-exiting-the-loop-tp27885793p27885793.html > Sent from the SWI Prolog mailing list archive at Nabble.com. > > _______________________________________________ > SWI-Prolog mailing list > SWI-Prolog@REDACTED > https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog > From karlsson.rm@REDACTED Sat Mar 13 13:04:07 2010 From: karlsson.rm@REDACTED (Mikael Karlsson) Date: Sat, 13 Mar 2010 13:04:07 +0100 Subject: [erlang-questions] new new in parameterized modules causes beam_dead In-Reply-To: <4B9ABABD.2060506@gmail.com> References: <0e04c9dd-1764-4bf1-8c2a-6e5453021c33@g19g2000yqe.googlegroups.com> <4B9A579E.4060807@gmail.com> <872e77ab1003120717o10bdd18ev60629dde0fbfc83e@mail.gmail.com> <4B9ABABD.2060506@gmail.com> Message-ID: <872e77ab1003130404m6eb8732fw932a89900ea4bd65@mail.gmail.com> Thank you for the info Richard, while having the attention of the originator: 1. Are there any documentation on parameterized modules more than http://www.erlang.se/euc/07/papers/1700Carlsson.pdf and http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.58.79&rep=rep1&type=pdf More like a spec or so and (maybe) updated for any changes? 2. I like that the new function return the module like a tuple, it makes it almost lika a dual nature of records and it makes it very easy to write setter functions in the module: -module(test,[A,B,C,D,E,F,G,H,I,J]). -record(test,{a,b,c,d,e,f,g,h,i,j}). %% record specification local in module (no includes) -export([set/2]). set(a,V) -> setelement(2,THIS,V); %% or set(b,V) -> THIS#test{b=V}; etc... Is this tuple format something that can be considered future proof in the implementation of parameterized modules? Cheers Mikael 2010/3/12 Richard Carlsson > Mikael Karlsson wrote: > >> Yes, >> I just figured out what the problem is. >> >> In my new "new" function I call another function which I defined in my >> module: >> >> helper_fun(X) -> xxx. >> >> new(Z) -> >> A = helper_fun(Z), >> ... >> intance(X,Y,Z1). >> >> This does not work. >> It seems that other funs can only be called from an instanciated module, >> like: >> .. >> M1 = mod1:new(Z), >> M1:helper_fun(X), >> .. >> >> Works OK after removing internal calls. >> >> /Mikael >> > > Yes, those extra functions will not be "static" like new/1. However, > the compiler shouldn't crash like that. Thanks for reporting it. > > /Richard > From mikpe@REDACTED Sat Mar 13 14:04:27 2010 From: mikpe@REDACTED (Mikael Pettersson) Date: Sat, 13 Mar 2010 14:04:27 +0100 Subject: [erlang-questions] new new in parameterized modules causes beam_dead In-Reply-To: <872e77ab1003130404m6eb8732fw932a89900ea4bd65@mail.gmail.com> References: <0e04c9dd-1764-4bf1-8c2a-6e5453021c33@g19g2000yqe.googlegroups.com> <4B9A579E.4060807@gmail.com> <872e77ab1003120717o10bdd18ev60629dde0fbfc83e@mail.gmail.com> <4B9ABABD.2060506@gmail.com> <872e77ab1003130404m6eb8732fw932a89900ea4bd65@mail.gmail.com> Message-ID: <19355.36187.362598.740224@pilspetsen.it.uu.se> Mikael Karlsson writes: > Thank you for the info Richard, > while having the attention of the originator: ... > 2. > I like that the new function return the module like a tuple, it makes it > almost lika a dual nature of records and it makes it very easy to write > setter functions in the module: > -module(test,[A,B,C,D,E,F,G,H,I,J]). > -record(test,{a,b,c,d,e,f,g,h,i,j}). %% record specification local in > module (no includes) > -export([set/2]). > > set(a,V) -> setelement(2,THIS,V); > %% or > set(b,V) -> THIS#test{b=V}; > etc... > > Is this tuple format something that can be considered future proof in the > implementation of parameterized modules? No, the fact that instances of parameterized modules currently are implemented as tuples is purely an implementation artifact and not something you should rely on. If poking the representation like that solves a real problem or makes some code much easier to write, then perhaps you should raise a feature request for that? /Mikael (And please don't top-post.) From enewhuis@REDACTED Sat Mar 13 14:27:00 2010 From: enewhuis@REDACTED (Eric Newhuis) Date: Sat, 13 Mar 2010 07:27:00 -0600 Subject: [erlang-questions] About the pattern of services implemented by Erlang In-Reply-To: References: Message-ID: <3C72E9D7-F553-464D-B4EB-310E4F63A0B4@gmail.com> I have had success using a load-balancer like Lighttpd or Nginx that connects to N Erlang services. The Erlang services worry about restarting themselves and the load-balancer handles the outside illusion. There are the excellent webmachine for JSON et al and NoSQL databases like Riak--all of which can be load-balanced from the outside and can be used in a highly-available context. On Mar 12, 2010, at 9:48 PM, ??? wrote: > Hi, I want to implement a service by Erlang communicating with other > language, such as c/c++, java, c#. Is there any common pattern I can use ? > This erlang service receives requests and parameters from other softwares > implemented by other language. I though TCP socket(gen_tcp) may be works. > > And I also want this service is high available, so if it crashed, a new > service process will be started in same server computer( or another computer > if that one is shutdown). For this, should I must use another computer to > monitor the service process? Can supervisor module fit me? If the service is > implemented using TCP socket, and if it is restarted in another computer, > the client must to find the new node to submit request. This is also a > question. So, Is there any common pattern I can use? From erlang@REDACTED Sat Mar 13 17:33:42 2010 From: erlang@REDACTED (Dominic Williams) Date: Sat, 13 Mar 2010 17:33:42 +0100 Subject: [erlang-questions] Unicode question In-Reply-To: <7a9fe0201003121907y4a49d2fdma679ea2bae40b1f2@mail.gmail.com> References: <7a9fe0201003121907y4a49d2fdma679ea2bae40b1f2@mail.gmail.com> Message-ID: Hi Brian, Below is the usage of the unicode module to convert to and from unicode points: 1> L = [ 16#e4, 16#bd, 16#a0, 16#e5, 16#a5, 16#bd, 16#e2, 16#98, 16#ba ]. [228,189,160,229,165,189,226,152,186] 2> unicode:characters_to_list(list_to_binary(L)). [20320,22909,9786] 3> unicode:characters_to_binary([20320,22909,9786]). <<228,189,160,229,165,189,226,152,186>> 4> binary_to_list(unicode:characters_to_binary([20320,22909,9786])). [228,189,160,229,165,189,226,152,186] Regards, Dominic Williams http://dominicwilliams.net Le 13 mars 2010 ? 04:07, Brian Acton a ?crit : > Hi guys, > > I've tried to shorten my problem into a simple sub problem that hopefully, > someone can provide some insight. > > Suppose, I am given the following utf-8 encoded input string: > [ 16#e4, 16#bd, 16#a0, 16#e5, 16#a5, 16#bd, 16#e2, 16#98, 16#ba ] > > Which translates into three unicode code points: > [20320,22909,9786] > > Now, I would like to shorten the string intelligently by choosing a > substring that retains character boundaries but also fits within a limited > number of bytes. > > For example. Let's say my byte limit is 5 bytes. > > In my example above, I can only take the first 3 bytes yielding the first > character. If I try to take the next character, I will have used 6 bytes > (each character in my example uses 3 bytes utf-8) and gone over my budgeted > byte allocation. > > So, in order to solve this, I figured that I would need to be able to > convert utf-8 to code point and from code point to utf-8 > > The problem is that I can't figure out how to convert utf-8 to code point. > Everything that I have looked at yields code point to utf-8 conversion but I > have not found the inverse function which converts utf-8 to code point. > > Am I going about this all wrong ? I've read the unicode page pretty > extensively and I couldn't find anything. I also came across EEP10 but it > does not look like it has been completely implemented (notably > unicode:utf8_to_list is missing). I am using R13B03 > > Thanks in advance, > > --b From tony@REDACTED Sat Mar 13 17:28:09 2010 From: tony@REDACTED (Tony Rogvall) Date: Sat, 13 Mar 2010 17:28:09 +0100 Subject: [erlang-questions] Unicode question In-Reply-To: <7a9fe0201003121907y4a49d2fdma679ea2bae40b1f2@mail.gmail.com> References: <7a9fe0201003121907y4a49d2fdma679ea2bae40b1f2@mail.gmail.com> Message-ID: << <> || C <- [20320,22909,9786] >>. <<228,189,160,229,165,189,226,152,186>> unicode:characters_to_list(<<228,189,160,229,165,189,226,152,186>>, utf8). [20320,22909,9786] The naming of the function is a bit strange ... /Tony On 13 mar 2010, at 04.07, Brian Acton wrote: > Hi guys, > > I've tried to shorten my problem into a simple sub problem that hopefully, > someone can provide some insight. > > Suppose, I am given the following utf-8 encoded input string: > [ 16#e4, 16#bd, 16#a0, 16#e5, 16#a5, 16#bd, 16#e2, 16#98, 16#ba ] > > Which translates into three unicode code points: > [20320,22909,9786] > > Now, I would like to shorten the string intelligently by choosing a > substring that retains character boundaries but also fits within a limited > number of bytes. > > For example. Let's say my byte limit is 5 bytes. > > In my example above, I can only take the first 3 bytes yielding the first > character. If I try to take the next character, I will have used 6 bytes > (each character in my example uses 3 bytes utf-8) and gone over my budgeted > byte allocation. > > So, in order to solve this, I figured that I would need to be able to > convert utf-8 to code point and from code point to utf-8 > > The problem is that I can't figure out how to convert utf-8 to code point. > Everything that I have looked at yields code point to utf-8 conversion but I > have not found the inverse function which converts utf-8 to code point. > > Am I going about this all wrong ? I've read the unicode page pretty > extensively and I couldn't find anything. I also came across EEP10 but it > does not look like it has been completely implemented (notably > unicode:utf8_to_list is missing). I am using R13B03 > > Thanks in advance, > > --b From karlsson.rm@REDACTED Sat Mar 13 18:47:17 2010 From: karlsson.rm@REDACTED (Mikael Karlsson) Date: Sat, 13 Mar 2010 18:47:17 +0100 Subject: [erlang-questions] new new in parameterized modules causes beam_dead In-Reply-To: <4B9B834A.8010206@gmail.com> References: <0e04c9dd-1764-4bf1-8c2a-6e5453021c33@g19g2000yqe.googlegroups.com> <4B9A579E.4060807@gmail.com> <872e77ab1003120717o10bdd18ev60629dde0fbfc83e@mail.gmail.com> <4B9ABABD.2060506@gmail.com> <872e77ab1003130404m6eb8732fw932a89900ea4bd65@mail.gmail.com> <4B9B834A.8010206@gmail.com> Message-ID: <872e77ab1003130947u30234b80qf4b5be01a16631bc@mail.gmail.com> 2010/3/13 Richard Carlsson wrote: > Mikael Karlsson wrote: > ... > >> I like that the new function return the module like a tuple, it makes it >> almost lika a dual nature of records and it makes it very easy to write >> setter functions in the module: >> -module(test,[A,B,C,D,E,F,G,H,I,J]). >> -record(test,{a,b,c,d,e,f,g,h,i,j}). %% record specification local in >> module (no includes) >> -export([set/2]). >> >> set(a,V) -> setelement(2,THIS,V); >> %% or >> set(b,V) -> THIS#test{b=V}; >> etc... >> >> Is this tuple format something that can be considered future proof in the >> implementation of parameterized modules? >> > > Definitely not. If/when these are made an official feature, they will > be made a first-class opaque data type; this is exactly analogous to > how funs were introduced in Erlang. > > /Richard > > OK, thanks, should have known better... Anyway if becoming official I think it would be good to be able to set separate attributes in a simple way (like you can with records), especially if you have many of them. Until then: I noticed that you can use both new or instance when setting attributes set(a,X) -> new(X,B); set(b,X) -> instance(A,X). Is there a preferred way? /Mikael Karlsson (now down-posting) From acton@REDACTED Sat Mar 13 19:46:13 2010 From: acton@REDACTED (Brian Acton) Date: Sat, 13 Mar 2010 10:46:13 -0800 Subject: [erlang-questions] Unicode question In-Reply-To: References: <7a9fe0201003121907y4a49d2fdma679ea2bae40b1f2@mail.gmail.com> Message-ID: <7a9fe0201003131046n5cce7376wc950f2db2b2a14c3@mail.gmail.com> Thanks everyone, I was getting fundamentally confused about binary vs list in the input variables. I was doing the following: 1> L = [ 16#e4, 16#bd, 16#a0, 16#e5, 16#a5, 16#bd, 16#e2, 16#98, 16#ba ]. [228,189,160,229,165,189,226,152,186 2> unicode:characters_to_list(L). [228,189,160,229,165,189,226,152,186 instead of the correct version: 1> L = [ 16#e4, 16#bd, 16#a0, 16#e5, 16#a5, 16#bd, 16#e2, 16#98, 16#ba ]. [228,189,160,229,165,189,226,152,186 2> unicode:characters_to_list(list_to_binary(L)). [20320,22909,9786] I think the fundamental takeaway is that binaries are encodings (i.e. UTF8, 16, 32) and that lists are code points (i.e. U+4F60, U+597D) Thanks for everyone's help on this. --b On Sat, Mar 13, 2010 at 8:33 AM, Dominic Williams < erlang-dated-1268930029.1d9556@REDACTED> wrote: > Hi Brian, > > Below is the usage of the unicode module to convert to and from unicode > points: > > 1> L = [ 16#e4, 16#bd, 16#a0, 16#e5, 16#a5, 16#bd, 16#e2, 16#98, 16#ba ]. > [228,189,160,229,165,189,226,152,186] > 2> unicode:characters_to_list(list_to_binary(L)). > [20320,22909,9786] > 3> unicode:characters_to_binary([20320,22909,9786]). > <<228,189,160,229,165,189,226,152,186>> > 4> binary_to_list(unicode:characters_to_binary([20320,22909,9786])). > [228,189,160,229,165,189,226,152,186] > > Regards, > > Dominic Williams > http://dominicwilliams.net > > Le 13 mars 2010 ? 04:07, Brian Acton a ?crit : > > > Hi guys, > > > > I've tried to shorten my problem into a simple sub problem that > hopefully, > > someone can provide some insight. > > > > Suppose, I am given the following utf-8 encoded input string: > > [ 16#e4, 16#bd, 16#a0, 16#e5, 16#a5, 16#bd, 16#e2, 16#98, 16#ba ] > > > > Which translates into three unicode code points: > > [20320,22909,9786] > > > > Now, I would like to shorten the string intelligently by choosing a > > substring that retains character boundaries but also fits within a > limited > > number of bytes. > > > > For example. Let's say my byte limit is 5 bytes. > > > > In my example above, I can only take the first 3 bytes yielding the first > > character. If I try to take the next character, I will have used 6 bytes > > (each character in my example uses 3 bytes utf-8) and gone over my > budgeted > > byte allocation. > > > > So, in order to solve this, I figured that I would need to be able to > > convert utf-8 to code point and from code point to utf-8 > > > > The problem is that I can't figure out how to convert utf-8 to code > point. > > Everything that I have looked at yields code point to utf-8 conversion > but I > > have not found the inverse function which converts utf-8 to code point. > > > > Am I going about this all wrong ? I've read the unicode page pretty > > extensively and I couldn't find anything. I also came across EEP10 but it > > does not look like it has been completely implemented (notably > > unicode:utf8_to_list is missing). I am using R13B03 > > > > Thanks in advance, > > > > --b > From karlsson.rm@REDACTED Sat Mar 13 19:49:44 2010 From: karlsson.rm@REDACTED (Mikael Karlsson) Date: Sat, 13 Mar 2010 19:49:44 +0100 Subject: [erlang-questions] new new in parameterized modules causes beam_dead In-Reply-To: <4B9BD315.3040702@gmail.com> References: <0e04c9dd-1764-4bf1-8c2a-6e5453021c33@g19g2000yqe.googlegroups.com> <4B9A579E.4060807@gmail.com> <872e77ab1003120717o10bdd18ev60629dde0fbfc83e@mail.gmail.com> <4B9ABABD.2060506@gmail.com> <872e77ab1003130404m6eb8732fw932a89900ea4bd65@mail.gmail.com> <4B9B834A.8010206@gmail.com> <872e77ab1003130947u30234b80qf4b5be01a16631bc@mail.gmail.com> <4B9BD315.3040702@gmail.com> Message-ID: <872e77ab1003131049u78533876t8194148465aacefd@mail.gmail.com> 2010/3/13 Richard Carlsson wrote; > Mikael Karlsson wrote: > >> Anyway if becoming official I think it would be good to be able to set >> separate attributes in a simple way (like you can with records), especially >> if you have many of them. >> > > Well, if you want to use an abstract module as a thing with setters > and getters (with each "set" operation creating a new instance), you > can get a long way by making better interface functions. For example, > you could have a single "set" function that takes a proplist. > > Yes, maybe I can also internally have a record definition with an instance bound to one attribute, making it reasonable easy (and efficient?) to update single values. -module(test,[A]). -record(test_internal,{a,b,c,d}). -export(...). new() -> instance(#test_internal{}). get(a) -> A#test_internal.a; .. set(a,V) -> new(A#test_internal{a=V}); .. > Until then: >> I noticed that you can use both new or instance when setting attributes >> set(a,X) -> new(X,B); >> set(b,X) -> instance(A,X). >> >> Is there a preferred way? >> > > The "instance" function is more primitive, and is called by the > autogenerated "new" function. See slide 6 of > > http://www.erlang.se/euc/07/papers/1700Carlsson.pdf > > If you write your own "new", you should call "instance" from it. > It interacts with the inheritance mechanism, so there is more to > think about if you do this (passing on Base correctly). > > In general, you should probably not call "instance" directly from > any other function except "new". > > /Richard > /Mikael From bob@REDACTED Sat Mar 13 20:41:23 2010 From: bob@REDACTED (Bob Ippolito) Date: Sat, 13 Mar 2010 11:41:23 -0800 Subject: [erlang-questions] Unicode question In-Reply-To: <7a9fe0201003121907y4a49d2fdma679ea2bae40b1f2@mail.gmail.com> References: <7a9fe0201003121907y4a49d2fdma679ea2bae40b1f2@mail.gmail.com> Message-ID: <6a36e7291003131141u4cb4d5frddcd96c686a8117d@mail.gmail.com> On Fri, Mar 12, 2010 at 7:07 PM, Brian Acton wrote: > I've tried to shorten my problem into a simple sub problem that hopefully, > someone can provide some insight. > > Suppose, I am given the following utf-8 encoded input string: > [ 16#e4, 16#bd, 16#a0, 16#e5, 16#a5, 16#bd, 16#e2, 16#98, 16#ba ] > > Which translates into three unicode code points: > [20320,22909,9786] > > Now, I would like to shorten the string intelligently by choosing a > substring that retains character boundaries but also fits within a limited > number of bytes. I have a partial solution to your problem that I just now committed to the mochiweb repository. http://mochiweb.googlecode.com/svn/trunk/src/mochiutf8.erl Essentially what it does is given a binary it returns only the bytes that represent a valid UTF-8 sequence. Using this code, you could take an arbitrary (presumed UTF-8) binary, chop it at any point, and after going through mochiutf8:valid_utf8_bytes/1 you'll have a valid UTF-8 binary of zero or more characters. The reason why this doesn't use any standard library functions is because I couldn't find any exported functionality that lets you do anything about invalid data, so I had to write my own. -bob From steven.charles.davis@REDACTED Sat Mar 13 23:35:09 2010 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sat, 13 Mar 2010 14:35:09 -0800 (PST) Subject: pain (and stripping whitespace from text) Message-ID: <65c3bfa7-ca63-4707-9472-2a53712095e0@i25g2000yqm.googlegroups.com> I've been confounded again by re, trying to strip whitespace from binary text, as the obvious "[ \t\r\n]+", as in... list_to_binary(re:replace(<<"a, \tb, \"quoted string\", \n c, d">>, <<"[ \t\r\n]+">>, <<>>, [global])) ...results in... <<"a,b,\"quotedstring\",c,d">>. ..I know there must be a regex that would avoid the stripping inside the quotes, but no amount of experiment (or google) has yielded a suitable result for me. Can anybody immediately see a solution (and put me out of my pain)? Thanks in advance, /s From kagato@REDACTED Sun Mar 14 03:45:17 2010 From: kagato@REDACTED (Jayson Vantuyl) Date: Sat, 13 Mar 2010 18:45:17 -0800 Subject: [erlang-questions] re: re:pain (and stripping whitespace from text) In-Reply-To: <65c3bfa7-ca63-4707-9472-2a53712095e0@i25g2000yqm.googlegroups.com> References: <65c3bfa7-ca63-4707-9472-2a53712095e0@i25g2000yqm.googlegroups.com> Message-ID: <5490C43B-26FB-4B02-8546-788870F7489D@souja.net> Actually, using pure regular expressions, this is not really easy (or exactly possible for certain uses, i.e. nesting). > "some quotes", with, "some more quotes", and, yet, "even more quotes" That said, many regex libraries have extensions that make this possible, but painful. See here: Perl: http://perldoc.perl.org/perlfaq6.html#Can-I-use-Perl-regular-expressions-to-match-balanced-text%3f (also "recursive patterns") PCRE: http://en.wikipedia.org/wiki/Perl_Compatible_Regular_Expressions (look for "recursive patterns") .NET: http://blogs.msdn.com/bclteam/archive/2005/03/15/396452.aspx Also, note that backtracking and recursion can create very undesirable behavior in terms of stack usage and execution time. This is so problematic that Google has written a special regex library that uses research in automata theory to make it behave better. See here: RE2: http://code.google.com/p/re2/ I think that the moral of this story is that every way to do this with regexps is a hack, and you probably shouldn't. It looks like you're parsing CSV data. You might try this relatively simple recursive-decent parser: http://ppolv.wordpress.com/2008/02/25/parsing-csv-in-erlang/ I'm willing to bet that it's not particularly fast, but probably works well enough. If you need more speed, you might try implementing a parser with yecc/leex, or even do something really exciting like writing a erl_nif interface to libcsv. Good luck! On Mar 13, 2010, at 2:35 PM, Steve Davis wrote: > I've been confounded again by re, trying to strip whitespace from > binary text, as the obvious "[ \t\r\n]+", as in... > > list_to_binary(re:replace(<<"a, \tb, \"quoted string\", \n c, d">>, > <<"[ \t\r\n]+">>, <<>>, [global])) > > ...results in... > > <<"a,b,\"quotedstring\",c,d">>. > > ..I know there must be a regex that would avoid the stripping inside > the quotes, but no amount of experiment (or google) has yielded a > suitable result for me. > > Can anybody immediately see a solution (and put me out of my pain)? > > Thanks in advance, > /s > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > -- Jayson Vantuyl kagato@REDACTED From steven.charles.davis@REDACTED Sun Mar 14 05:42:10 2010 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sat, 13 Mar 2010 20:42:10 -0800 (PST) Subject: pain (and stripping whitespace from text) In-Reply-To: <5490C43B-26FB-4B02-8546-788870F7489D@souja.net> References: <65c3bfa7-ca63-4707-9472-2a53712095e0@i25g2000yqm.googlegroups.com> <5490C43B-26FB-4B02-8546-788870F7489D@souja.net> Message-ID: <3d870ba8-c0fb-4e99-8773-3a9a1c283e3b@g26g2000yqn.googlegroups.com> Thanks, Jayson, for some excellent links and the full response! I found the google re2 project particularly interesting. On Mar 13, 8:45?pm, Jayson Vantuyl wrote: > Good luck! From rvirding@REDACTED Sun Mar 14 07:35:05 2010 From: rvirding@REDACTED (Robert Virding) Date: Sun, 14 Mar 2010 07:35:05 +0100 Subject: [erlang-questions] re: re:pain (and stripping whitespace from text) In-Reply-To: <5490C43B-26FB-4B02-8546-788870F7489D@souja.net> References: <65c3bfa7-ca63-4707-9472-2a53712095e0@i25g2000yqm.googlegroups.com> <5490C43B-26FB-4B02-8546-788870F7489D@souja.net> Message-ID: <3dbc6d1c1003132235uf966501p74e8fc5d3f51180f@mail.gmail.com> On 14 March 2010 03:45, Jayson Vantuyl wrote: > Also, note that backtracking and recursion can create very undesirable behavior in terms of stack usage and execution time. ?This is so problematic that Google has written a special regex library that uses research in automata theory to make it behave better. ?See here: > > RE2: ?http://code.google.com/p/re2/ I did a regexp version in Erlang based on these principles and it is actually time linear in the size of the input. It is fun to see it zip through what would be for Perl/PCRE a super backtracking pathological case in a flash. One day when I get the time to cleanup the code I will release it. Robert From steven.charles.davis@REDACTED Sun Mar 14 08:45:29 2010 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sat, 13 Mar 2010 23:45:29 -0800 (PST) Subject: pain (and stripping whitespace from text) In-Reply-To: <3dbc6d1c1003132235uf966501p74e8fc5d3f51180f@mail.gmail.com> References: <65c3bfa7-ca63-4707-9472-2a53712095e0@i25g2000yqm.googlegroups.com> <5490C43B-26FB-4B02-8546-788870F7489D@souja.net> <3dbc6d1c1003132235uf966501p74e8fc5d3f51180f@mail.gmail.com> Message-ID: <5ef2c1dd-18d0-45e4-a7af-ca550b3a2de7@g28g2000yqh.googlegroups.com> On Mar 14, 12:35?am, Robert Virding wrote: > I did a regexp version in Erlang based on these principles and it is > actually time linear in the size of the input. It is fun to see it zip > through what would be for Perl/PCRE a super backtracking pathological > case in a flash. One day when I get the time to cleanup the code I > will release it. For sure, I'll keep an eye out for this :) Meantime, I conceded defeat to the regex gods and solved my immediate issue with... %% strip(Bin) -> strip(Bin, [], false). % strip(<<$", Rest/binary>>, Acc, false) -> strip(Rest, [$"|Acc], true); strip(<<$", Rest/binary>>, Acc, true) -> strip(Rest, [$"|Acc], false); strip(<<$ , Rest/binary>>, Acc, false) -> strip(Rest, Acc, false); strip(<<$\t, Rest/binary>>, Acc, false) -> strip(Rest, Acc, false); strip(<<$\r, Rest/binary>>, Acc, false) -> strip(Rest, Acc, false); strip(<<$\n, Rest/binary>>, Acc, false) -> strip(Rest, Acc, false); strip(<>, Acc, State) -> strip(Rest, [X|Acc], State); strip(<<>>, Acc, false) -> list_to_binary(lists:reverse(Acc)). ...while not supremely elegant, it seems perfectly adequate and fast enough for my current need. /s From steven.charles.davis@REDACTED Sun Mar 14 08:53:54 2010 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sat, 13 Mar 2010 23:53:54 -0800 (PST) Subject: pain (and stripping whitespace from text) In-Reply-To: <5ef2c1dd-18d0-45e4-a7af-ca550b3a2de7@g28g2000yqh.googlegroups.com> References: <65c3bfa7-ca63-4707-9472-2a53712095e0@i25g2000yqm.googlegroups.com> <5490C43B-26FB-4B02-8546-788870F7489D@souja.net> <3dbc6d1c1003132235uf966501p74e8fc5d3f51180f@mail.gmail.com> <5ef2c1dd-18d0-45e4-a7af-ca550b3a2de7@g28g2000yqh.googlegroups.com> Message-ID: <3b56bd4e-3ad3-4a1a-969f-0b754f6011f0@t41g2000yqt.googlegroups.com> ...and worked rather better when I added... %% skip escaped quotes inside strings... strip(<<$\\, $", Rest/binary>>, Acc, true) -> strip(Rest, [$", $\\|Acc], true); ...oops! From golubovsky@REDACTED Mon Mar 15 04:11:55 2010 From: golubovsky@REDACTED (Dimitry Golubovsky) Date: Sun, 14 Mar 2010 23:11:55 -0400 Subject: Partial funciton applications and parentheses? Message-ID: Hi, Given the following short program: %%%%%%%%%%%%%%%%%%%%%%%%% -module(clos). -export([start/0]). clos1(X) -> fun(Y) -> U = Y(X), io:format("Result: ~B~n", [U]), ok end. clos2(X) -> fun(Y) -> U = X + Y, io:format("Result: ~B~n", [U]), ok end. z() -> fun(X) -> X * X end. start() -> (clos1(2)) (z()), (clos2(2)) (3). %%%%%%%%%%%%%%%%%%%%%%%%% where clos1 and clos2 form sort of partial function application with their first argument, and then resulting fun is applied to the second argument. Why are parens necessary around calls to clos1 and clos2? Without these parens, I get "syntax error before: '('" messages. Having them without parens that is, clos2 (2) (3) would IMHO look much better. Thanks. -- Dimitry Golubovsky Anywhere on the Web From fritchie@REDACTED Mon Mar 15 06:43:26 2010 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Mon, 15 Mar 2010 00:43:26 -0500 Subject: [erlang-questions] About the pattern of services implemented by Erlang In-Reply-To: Message of "Sat, 13 Mar 2010 07:27:00 CST." <3C72E9D7-F553-464D-B4EB-310E4F63A0B4@gmail.com> Message-ID: <43297.1268631806@snookles.snookles.com> Eric Newhuis wrote: en> There are the excellent webmachine for JSON et al and NoSQL en> databases like Riak--all of which can be load-balanced from the en> outside and can be used in a highly-available context. That strategy works well. Our company uses TCP-layer load balancing for multiple protocols: SMTP, HTTP, JSON-RPC, and UBF. All servers for those protocols are implemented in Erlang. -Scott From boris.okner@REDACTED Mon Mar 15 07:33:08 2010 From: boris.okner@REDACTED (Boris Okner) Date: Mon, 15 Mar 2010 02:33:08 -0400 Subject: adding Erlang library locations programmatically Message-ID: <263b77311003142333o5b00be6ev12fb4bc5fae7bef2@mail.gmail.com> Hello, Is it possible to add library locations (shown by code:lib_dir()) programmatically, i.e. in the same fashion as code:add_path/1? I'd like to upload apps and add them up during run-time. thanks, Boris From eodbat@REDACTED Mon Mar 15 14:57:24 2010 From: eodbat@REDACTED (Edoardo Batini) Date: Mon, 15 Mar 2010 14:57:24 +0100 Subject: Italian User Group Message-ID: <20100315135724.GA6985@jetzback> Hi, i'm trying to see if there is enough interest for an Italian Erlang User Group. I published on line a 2-pages site to collect emails from erlangers living in Italy: http://pimpo.org:8000/ Please, spread the news. Depending on the feedback i'll go ahead... greets eolo999 From g@REDACTED Mon Mar 15 15:08:25 2010 From: g@REDACTED (Garrett Smith) Date: Mon, 15 Mar 2010 09:08:25 -0500 Subject: [erlang-questions] About the pattern of services implemented by Erlang In-Reply-To: References: Message-ID: Hi ???, On Fri, Mar 12, 2010 at 10:48 PM, ??? wrote: > Hi, I want to implement a service by Erlang communicating with other > language, such as c/c++, java, c#. Is there any common pattern I can use ? > This erlang service receives requests and parameters from other softwares > implemented by other language. I though TCP socket(gen_tcp) may be works. I have used ports with success: http://www.erlang.org/doc/tutorial/c_port.html The rest of the docs may be of interest to you as they cover other options: http://www.erlang.org/doc/tutorial/users_guide.html With either ports or a socket interface, you'll need to keep an eye on managing the external process (startup/shutdown), obviously. But the advantage is that your external program isn't going to crash Erlang. Ports present challenges for implementing concurrent requests/responses. > And I also want this service is high available, so if it crashed, a new > service process will be started in same server computer( or another computer > if that one is shutdown). For this, should I must use another computer to > monitor the service process? Can supervisor module fit me? If the service is > implemented using TCP socket, and if it is restarted in another computer, > the client must to find the new node to submit request. This is also a > question. So, Is there any common pattern I can use? > Using ports, I "wrap" an external program and put that under supervision in Erlang. That's nice because the external process can be treated like any other supervised worker. For standalone apps, runit is helpful: http://smarden.org/runit/ And, if you're system architecture is as complex as it sounds it might be, consider using a message broker (e.g. rabbitmq), which will give you several things: - message passing abstraction over all your programs - wire protocol for sending and receiving messages - decoupling of "clients" and "servers", which makes the system less brittle (among other advantages) Garrett From camilo.cerchiari@REDACTED Mon Mar 15 16:21:03 2010 From: camilo.cerchiari@REDACTED (Camilo Cerchiari) Date: Mon, 15 Mar 2010 13:21:03 -0200 Subject: [erlang-questions] Re: what about little-endians? In-Reply-To: <429c9c48-4849-43f3-b300-f0e09df819c0@f8g2000yqn.googlegroups.com> References: <588b5a841003121103l7ff25466vf47f506f890a2d15@mail.gmail.com> <588b5a841003121145m4cc38971lc767fa9028ddc998@mail.gmail.com> <429c9c48-4849-43f3-b300-f0e09df819c0@f8g2000yqn.googlegroups.com> Message-ID: <588b5a841003150821p818436ey560afdd9de189ee9@mail.gmail.com> thank you all for your comments. On Fri, Mar 12, 2010 at 22:56, Edwin wrote: > It's not actually that difficult to decode it yourself. Switch to > {active, false} and spawn a process to extract messages from the TCP > stream using gen_tcp:read/2,3 and send them to your gen_fsm/ > gen_server. > > Here's something to start you off. It does work, but I'm sure there > may be bugs so no guarantees and I am certain someone else could write > it better than this. > > -module(demux). > -behaviour(gen_server). > > %% API > -export([start/2, start_link/1, start_link/2, stop/1]). > > %% gen_server callbacks > -export([init/1, handle_call/3, handle_cast/2, handle_info/2, > terminate/2, code_change/3]). > > -export([wait_recv/3, recv_loop/3]). > > -define(SERVER, ?MODULE). > > -record(state, { > host, > port, > recv_pid, > socket > }). > > %%==================================================================== > %% API > %%==================================================================== > start(Host, Port) when is_integer(Port) -> > gen_server:start(?MODULE, [Host, Port], []). > > start_link(Host, Port) when is_integer(Port) -> > gen_server:start_link(?MODULE, [Host, Port], []). > > start_link([Host, Port]) when is_list(Port) -> > NPort = list_to_integer(Port), > gen_server:start_link(?MODULE, [Host, NPort], []). > > stop(ServerRef) -> > gen_server:cast(ServerRef, stop). > > %%==================================================================== > %% gen_server callbacks > %%==================================================================== > > % Connect to host:port and wait for it to send stuff > init([Host, Port]) -> > {ok, Sock} = gen_tcp:connect(Host, Port, [binary, {packet, 0}, > {active, false}]), > Self = self(), > Pid = spawn_link(fun() -> wait_recv(Self, Sock, <<>>) end), > {ok, #state{host = Host, port = Port, recv_pid = Pid, socket = > Sock}}. > > handle_call(_Request, _From, State) -> > {reply, {error, invalid_request}, State}. > > handle_cast(stop, State) -> > (catch gen_tcp:close(State#state.socket)), > {stop, normal, State}; > handle_cast(_Msg, State) -> > {noreply, State}. > > handle_info({tcp_packet, Packet}, State) -> > io:format("Got a packet: ~p~n", [Packet]), > % Do something with packet > {noreply, State}; > handle_info({recv_error, {_Error, _Socket} = Err}, State) -> > io:format("Got a receive error: ~p~n", [Err]), > {stop, Err, State}; > handle_info(_Info, State) -> > {noreply, State}. > > terminate(_Reason, State) -> > io:format("Closing socket~n"), > (catch gen_tcp:close(State#state.socket)), > ok. > > code_change(_OldVsn, State, _Extra) -> > {ok, State}. > > %%-------------------------------------------------------------------- > %% Internal > %%-------------------------------------------------------------------- > wait_recv(SvrRef, Socket, Buffer) -> > case gen_tcp:recv(Socket, 0) of > {ok, Input} -> > io:format("wait_recv: got ~p~n", [Input]), > B = handle_input(SvrRef, <>), > ?MODULE:recv_loop(SvrRef, Socket, B); > Error -> > SvrRef ! {recv_error, {Error, Socket}} > end. > > recv_loop(SvrRef, Socket, Buffer) -> > case gen_tcp:recv(Socket, 0, 0) of > {ok, Input} -> % Some input waiting > already > io:format("recv_loop: got ~p~n", [Input]), > B = handle_input(SvrRef, <>), > ?MODULE:recv_loop(SvrRef, Socket, B); > {error, timeout} -> % No more socket data > immediately available > B = handle_input(SvrRef, Buffer), > ?MODULE:wait_recv(SvrRef, Socket, B); > Error -> > SvrRef ! {recv_error, {Error, Socket}} > end. > > handle_input(SvrRef, <>) -> > case Data of > <> -> > io:format("Sending tcp_packet to ~p: ~p~n", [SvrRef, > Packet]), > SvrRef ! {tcp_packet, Packet}, > handle_input(SvrRef, Rest); > TooShort -> > TooShort > end; > > handle_input(_SvrRef, <<_Data/bytes>> = B) -> > B. > > To test it, run it in one Erlang node, and run this small test program > in another: > > -module(demux_test). > -compile([export_all]). > > go(Port) when is_integer(Port) -> > Opts = [binary, {packet, 0}], > {ok, LSock} = gen_tcp:listen(Port, Opts), > {ok, Sock} = gen_tcp:accept(LSock), > Msg = <<"Hello, sock.\n">>, > send_msg(Sock, Msg, 100). > > send_msg(Sock, Msg, Count) when Count > 0 -> > lists:foreach( > fun(X) -> > N = integer_to_list(X), > NumberedMsg = list_to_binary([N, $:, Msg]), > Len = byte_size(NumberedMsg), > gen_tcp:send(Sock, < NumberedMsg/bytes>>) > end, > lists:seq(1, Count) > ). > > Hope this helps. > > On Mar 12, 2:45 pm, Camilo Cerchiari > wrote: > > i'm ok with writing it just for myself, if it would be so. > > some advice to get started with the code is then what i'm looking for. > > where should i start? > > > > > > > > On Fri, Mar 12, 2010 at 17:20, Max Lapshin > wrote: > > > I think, you will be refused for this feature, because big-endian is > > > standard for network transmission. > > > In this case you will have to write your own buffered demuxer. > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From francesca.gangemi@REDACTED Mon Mar 15 18:22:03 2010 From: francesca.gangemi@REDACTED (Francesca Gangemi) Date: Mon, 15 Mar 2010 18:22:03 +0100 Subject: [erlang-questions] Italian User Group In-Reply-To: <20100315135724.GA6985@jetzback> References: <20100315135724.GA6985@jetzback> Message-ID: <4B9E6CBB.4080108@erlang-solutions.com> Hi, there's an Erlang Etna User group even though it has not been so active recently. I think we should try to congregate all in one place thus there can be more interaction between users... If you speak Italian (no matter where you live) join the Erlang Etna User group at http://groups.google.com/group/erlang-etna?pli=1 :) Francesca Edoardo Batini wrote: > Hi, > i'm trying to see if there is enough interest for an Italian Erlang User > Group. I published on line a 2-pages site to collect emails from > erlangers living in Italy: > http://pimpo.org:8000/ > > Please, spread the news. > Depending on the feedback i'll go ahead... > > greets > eolo999 > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From roberto.aloi@REDACTED Mon Mar 15 18:19:50 2010 From: roberto.aloi@REDACTED (Roberto Aloi) Date: Mon, 15 Mar 2010 17:19:50 +0000 Subject: [erlang-questions] Italian User Group In-Reply-To: <20100315135724.GA6985@jetzback> References: <20100315135724.GA6985@jetzback> Message-ID: <4B9E6C36.9010105@erlang-solutions.com> Hi Edoardo, as far as I know the only active Erlang User Group in Italy is the "Erlang Etna User Group": http://groups.google.com/group/erlang-etna Right now, it counts 37 members. Some time ago I registered a sub-domain to start a more "national" user group... http://eug-italia.netsons.org/ ...but I've never had the time to bring on the project (I'm the only member, right now :)). I think I should chasing *someone* at Erlang Solutions Ltd. a bit more [wink wink...] to organize some of the Erlang events in Italy, to boost a potential new Italian Erlang user group down there. Regards, Roberto Aloi -- University of Kent - Erlang Solutions Ltd. Twitter: @prof3ta Blog: http://aloiroberto.wordpress.com On 03/15/2010 01:57 PM, Edoardo Batini wrote: > Hi, > i'm trying to see if there is enough interest for an Italian Erlang User > Group. I published on line a 2-pages site to collect emails from > erlangers living in Italy: > http://pimpo.org:8000/ > > Please, spread the news. > Depending on the feedback i'll go ahead... > > greets > eolo999 > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From zeno490@REDACTED Mon Mar 15 19:53:20 2010 From: zeno490@REDACTED (Nicholas Frechette) Date: Mon, 15 Mar 2010 13:53:20 -0500 Subject: [erlang-questions] epmd leaving ports in TIME_WAIT? Message-ID: Hi, I recently started running 2 erlang applications in distributed mode (with -sname) on the same box. I am noticing now (doing netstat -t) that a _LOT_ of ports are left open at 4369 (the port used by epmd) on my ubuntu 9.10 box. In fact, of all active connections, 90%+ of my open ports will be localhost:4369 -> culpritbox:randomport. All are stuck in TIME_WAIT Any idea what could be causing this? I use a different computer to do my development and I see a similar pattern emerging (again ubuntu 9.10). My erlang version is R13B01. Here is an example output of `netstat -t` (note that even with -p, netstat doesn't display a program name for those ports). Any ideas? Active Internet connections (w/o servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 mercury:4369 mercury:49448 TIME_WAIT tcp 0 0 mercury:4369 mercury:45420 TIME_WAIT tcp 0 0 mercury:4369 mercury:41234 TIME_WAIT tcp 0 0 mercury:4369 mercury:35179 TIME_WAIT * something else tcp 0 0 mercury:4369 mercury:44567 TIME_WAIT tcp 0 0 mercury:4369 mercury:45846 TIME_WAIT tcp 0 0 localhost:4369 localhost:33424 ESTABLISHED tcp 0 0 mercury:4369 mercury:38486 TIME_WAIT tcp 0 0 mercury:4369 mercury:38624 TIME_WAIT tcp 0 0 mercury:4369 mercury:44724 TIME_WAIT tcp 0 0 mercury:4369 mercury:44398 TIME_WAIT tcp 0 0 mercury:4369 mercury:47189 TIME_WAIT tcp 0 0 mercury:4369 mercury:45306 TIME_WAIT tcp 0 0 mercury:4369 mercury:36997 TIME_WAIT tcp 0 0 localhost:48762 localhost:4369 ESTABLISHED tcp 0 0 mercury:4369 mercury:38627 TIME_WAIT tcp 0 0 mercury:4369 mercury:37665 TIME_WAIT tcp 0 0 mercury:4369 mercury:48427 TIME_WAIT tcp 0 0 mercury:4369 mercury:57916 TIME_WAIT tcp 0 0 mercury:4369 mercury:51098 TIME_WAIT * something else tcp 0 0 mercury:4369 mercury:55867 TIME_WAIT * something else * something else tcp 0 0 mercury:4369 mercury:36005 TIME_WAIT tcp 0 0 mercury:4369 mercury:46053 TIME_WAIT tcp 0 0 mercury:4369 mercury:35974 TIME_WAIT * something else tcp 0 0 mercury:4369 mercury:42211 TIME_WAIT tcp 0 0 mercury:4369 mercury:33363 TIME_WAIT tcp 0 0 mercury:4369 mercury:53662 TIME_WAIT * something else tcp 0 0 mercury:4369 mercury:37094 TIME_WAIT * something else tcp 0 0 mercury:4369 mercury:43824 TIME_WAIT tcp 0 0 mercury:4369 mercury:51092 TIME_WAIT tcp 0 0 mercury:4369 mercury:43258 TIME_WAIT tcp 0 0 mercury:4369 mercury:43064 TIME_WAIT tcp 0 0 mercury:4369 mercury:37111 TIME_WAIT tcp 0 0 mercury:4369 mercury:54677 TIME_WAIT tcp 0 0 mercury:4369 mercury:44286 TIME_WAIT tcp 0 0 mercury:4369 mercury:49718 TIME_WAIT tcp 0 0 mercury:4369 mercury:46809 TIME_WAIT tcp 0 0 mercury:4369 mercury:46112 TIME_WAIT tcp 0 0 mercury:4369 mercury:48825 TIME_WAIT tcp 0 0 mercury:4369 mercury:44124 TIME_WAIT tcp 0 0 mercury:4369 mercury:45203 TIME_WAIT tcp 0 0 mercury:4369 mercury:51149 TIME_WAIT * something else tcp 0 0 mercury:4369 mercury:46636 TIME_WAIT * something else tcp 0 0 mercury:4369 mercury:48254 TIME_WAIT tcp 0 0 mercury:4369 mercury:49424 TIME_WAIT tcp 0 0 mercury:4369 mercury:59976 TIME_WAIT tcp 0 0 mercury:4369 mercury:46730 TIME_WAIT tcp 0 0 mercury:4369 mercury:44890 TIME_WAIT * something else tcp 0 0 mercury:4369 mercury:39385 TIME_WAIT tcp 0 0 mercury:4369 mercury:57297 TIME_WAIT tcp 0 0 mercury:4369 mercury:37066 TIME_WAIT tcp 0 0 mercury:4369 mercury:50186 TIME_WAIT tcp 0 0 mercury:4369 mercury:45703 TIME_WAIT tcp 0 0 mercury:4369 mercury:42943 TIME_WAIT tcp 0 0 mercury:4369 mercury:55328 TIME_WAIT tcp 0 0 mercury:4369 mercury:44401 TIME_WAIT tcp 0 0 mercury:4369 mercury:45791 TIME_WAIT tcp 0 0 mercury:4369 mercury:56537 TIME_WAIT tcp 0 0 mercury:4369 mercury:42194 TIME_WAIT tcp 0 0 mercury:4369 mercury:33216 TIME_WAIT tcp 0 0 mercury:4369 mercury:46544 TIME_WAIT tcp 0 0 mercury:4369 mercury:47610 TIME_WAIT tcp 0 0 mercury:4369 mercury:52892 TIME_WAIT tcp 0 0 mercury:4369 mercury:38877 TIME_WAIT tcp 0 0 mercury:4369 mercury:50983 TIME_WAIT tcp 0 0 mercury:4369 mercury:45376 TIME_WAIT tcp 0 0 mercury:4369 mercury:54394 TIME_WAIT tcp 0 0 mercury:4369 mercury:45412 TIME_WAIT tcp 0 0 mercury:4369 mercury:36546 TIME_WAIT tcp 0 0 mercury:4369 mercury:32776 TIME_WAIT tcp 0 0 mercury:4369 mercury:38289 TIME_WAIT tcp 0 0 mercury:4369 mercury:35126 TIME_WAIT tcp 0 0 mercury:4369 mercury:50964 TIME_WAIT tcp 0 0 mercury:4369 mercury:47857 TIME_WAIT tcp 0 0 mercury:4369 mercury:55772 TIME_WAIT tcp 0 0 mercury:4369 mercury:41209 TIME_WAIT * something else tcp 0 0 mercury:4369 mercury:41426 TIME_WAIT tcp 0 0 mercury:4369 mercury:52887 TIME_WAIT tcp 0 0 mercury:4369 mercury:33961 TIME_WAIT * something else tcp 0 0 mercury:4369 mercury:58946 TIME_WAIT tcp 0 0 localhost:33424 localhost:4369 ESTABLISHED tcp 0 0 mercury:4369 mercury:46272 TIME_WAIT tcp 0 0 mercury:4369 mercury:58219 TIME_WAIT tcp 0 0 mercury:4369 mercury:60676 TIME_WAIT tcp 0 0 mercury:4369 mercury:37091 TIME_WAIT tcp 0 0 mercury:4369 mercury:34972 TIME_WAIT tcp 0 0 mercury:4369 mercury:53706 TIME_WAIT tcp 0 0 mercury:4369 mercury:52788 TIME_WAIT tcp 0 0 mercury:4369 mercury:53221 TIME_WAIT tcp 0 0 mercury:4369 mercury:57241 TIME_WAIT tcp 0 0 mercury:4369 mercury:56398 TIME_WAIT tcp 0 0 mercury:4369 mercury:40434 TIME_WAIT tcp 0 0 mercury:4369 mercury:43636 TIME_WAIT tcp 0 0 mercury:4369 mercury:41792 TIME_WAIT tcp 0 0 mercury:4369 mercury:53162 TIME_WAIT tcp 0 0 mercury:4369 mercury:41266 TIME_WAIT tcp 0 0 mercury:4369 mercury:36990 TIME_WAIT tcp 0 0 mercury:4369 mercury:37871 TIME_WAIT tcp 0 0 mercury:4369 mercury:40089 TIME_WAIT tcp 0 0 mercury:4369 mercury:58028 TIME_WAIT tcp 0 0 mercury:4369 mercury:40347 TIME_WAIT tcp 0 0 mercury:4369 mercury:55445 TIME_WAIT tcp 0 0 mercury:4369 mercury:56130 TIME_WAIT tcp 0 0 mercury:4369 mercury:37858 TIME_WAIT tcp 0 0 mercury:4369 mercury:53709 TIME_WAIT tcp 0 0 mercury:4369 mercury:45924 TIME_WAIT tcp 0 0 mercury:4369 mercury:56969 TIME_WAIT tcp 0 0 mercury:4369 mercury:33933 TIME_WAIT tcp 0 0 mercury:4369 mercury:51305 TIME_WAIT tcp 0 0 mercury:4369 mercury:53452 TIME_WAIT tcp 0 0 mercury:4369 mercury:35840 TIME_WAIT tcp 0 0 mercury:4369 mercury:49678 TIME_WAIT * something else tcp 0 0 mercury:4369 mercury:57573 TIME_WAIT tcp 0 0 localhost:4369 localhost:48762 ESTABLISHED tcp 0 0 mercury:4369 mercury:46680 TIME_WAIT tcp 0 0 mercury:4369 mercury:41095 TIME_WAIT tcp 0 0 mercury:4369 mercury:44073 TIME_WAIT tcp 0 0 mercury:4369 mercury:43461 TIME_WAIT tcp 0 0 mercury:4369 mercury:39410 TIME_WAIT tcp 0 0 mercury:4369 mercury:38881 TIME_WAIT From luismarianoguerra@REDACTED Mon Mar 15 19:57:33 2010 From: luismarianoguerra@REDACTED (Mariano Guerra) Date: Mon, 15 Mar 2010 19:57:33 +0100 Subject: [erlang-questions] Good leex and yeec tutorials In-Reply-To: <18a1db031003121416h1be2a757uc9838305c37e0f31@mail.gmail.com> References: <18a1db031003110645g751e578bj7587064705dcbfb7@mail.gmail.com> <401d3ba31003110707h12cea372rd2c65358965fb179@mail.gmail.com> <18a1db031003111201l167cb98cha1e14ca9fb25a44f@mail.gmail.com> <18a1db031003121416h1be2a757uc9838305c37e0f31@mail.gmail.com> Message-ID: On Fri, Mar 12, 2010 at 11:16 PM, zabrane Mikael wrote: > Thanks guys ! Efene seems the right place to look into ;-) for another yecc example you can look at: http://github.com/erlang/otp/blob/dev/lib/parsetools/src/esyntax.yrl I dont know if it is up to date but it is useful From ovidiudeac@REDACTED Tue Mar 16 10:40:17 2010 From: ovidiudeac@REDACTED (Ovidiu Deac) Date: Tue, 16 Mar 2010 11:40:17 +0200 Subject: [erlang-questions] Italian User Group In-Reply-To: <4B9E6CBB.4080108@erlang-solutions.com> References: <20100315135724.GA6985@jetzback> <4B9E6CBB.4080108@erlang-solutions.com> Message-ID: <804cd4021003160240v5385d457uac86b6c3cbbcbfed@mail.gmail.com> On Mon, Mar 15, 2010 at 7:22 PM, Francesca Gangemi wrote: > If you speak Italian (no matter where you live) join the Erlang Etna > User group at http://groups.google.com/group/erlang-etna?pli=1 :) Just for my curiosity, what's the point of having an erlang group based on the language you speak? Why would it be important that I speak Italian but I live in Indochina and you speak Italian but you live in Rome? Isn't it better to have a big group since more people share the same information? I totally understand the need to have a group for a certain geographic area. This makes sense for example for finding/posting erlang jobs in the area. From chandrashekhar.mullaparthi@REDACTED Tue Mar 16 10:48:06 2010 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Tue, 16 Mar 2010 09:48:06 +0000 Subject: [erlang-questions] Italian User Group In-Reply-To: <804cd4021003160240v5385d457uac86b6c3cbbcbfed@mail.gmail.com> References: <20100315135724.GA6985@jetzback> <4B9E6CBB.4080108@erlang-solutions.com> <804cd4021003160240v5385d457uac86b6c3cbbcbfed@mail.gmail.com> Message-ID: On 16 March 2010 09:40, Ovidiu Deac wrote: > On Mon, Mar 15, 2010 at 7:22 PM, Francesca Gangemi > wrote: > > If you speak Italian (no matter where you live) join the Erlang Etna > > User group at http://groups.google.com/group/erlang-etna?pli=1 :) > > Just for my curiosity, what's the point of having an erlang group > based on the language you speak? > Probably because not everyone speaks fluent english? And sometimes such people find it easier to express their thoughts in their native language? cheers, Chandru From eodbat@REDACTED Tue Mar 16 10:57:50 2010 From: eodbat@REDACTED (Edoardo Batini) Date: Tue, 16 Mar 2010 10:57:50 +0100 Subject: [erlang-questions] Italian User Group In-Reply-To: <804cd4021003160240v5385d457uac86b6c3cbbcbfed@mail.gmail.com> References: <20100315135724.GA6985@jetzback> <4B9E6CBB.4080108@erlang-solutions.com> <804cd4021003160240v5385d457uac86b6c3cbbcbfed@mail.gmail.com> Message-ID: <20100316095749.GA5208@jetzback> On Tue, Mar 16, 2010 at 11:40:17AM +0200, Ovidiu Deac wrote: > On Mon, Mar 15, 2010 at 7:22 PM, Francesca Gangemi > wrote: > > If you speak Italian (no matter where you live) join the Erlang Etna > > User group at http://groups.google.com/group/erlang-etna?pli=1 :) > > Just for my curiosity, what's the point of having an erlang group > based on the language you speak? Why would it be important that I > speak Italian but I live in Indochina and you speak Italian but you > live in Rome? Hi, i'm edoardo batini and I launched yesterday the proposal of an italian user group (http://pimpo.org:8000). I completely agree with you. What I mean with 'italian' it's just a matter of location; in fact I really would be glad to have an international english speaking group. I recieived quite a good feedback to my announcement and I hope to organize soon a meeting joining forces with the etna group (which I'll contact soon). I think there's enough people to organize an informal meeting to plan things ahead. greets edoardo batini > > Isn't it better to have a big group since more people share the same > information? > > I totally understand the need to have a group for a certain geographic > area. This makes sense for example for finding/posting erlang jobs in > the area. > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > From als@REDACTED Tue Mar 16 10:23:13 2010 From: als@REDACTED (Anthony Shipman) Date: Tue, 16 Mar 2010 20:23:13 +1100 Subject: two epmds running Message-ID: <201003162023.13790.als@iinet.net.au> Sometimes it happens that I discover two epmd processes running. One of them is in a tight loop consuming 100% of CPU time. My guess is that the second one is started automatically because the first one is no longer responding. Is this a known bug in epmd? -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From kvs@REDACTED Tue Mar 16 11:05:39 2010 From: kvs@REDACTED (Konstantin Sorokin) Date: Tue, 16 Mar 2010 13:05:39 +0300 Subject: [erlang-questions] Italian User Group In-Reply-To: References: <20100315135724.GA6985@jetzback> <4B9E6CBB.4080108@erlang-solutions.com> <804cd4021003160240v5385d457uac86b6c3cbbcbfed@mail.gmail.com> Message-ID: <9dfb3ec1003160305m1d4d02feuf5ffc85daca5d5e3@mail.gmail.com> On Tue, Mar 16, 2010 at 12:48 PM, Chandru wrote: > On 16 March 2010 09:40, Ovidiu Deac wrote: > >> On Mon, Mar 15, 2010 at 7:22 PM, Francesca Gangemi >> wrote: >> > If you speak Italian (no matter where you live) join the Erlang Etna >> > User group at http://groups.google.com/group/erlang-etna?pli=1 :) >> >> Just for my curiosity, what's the point of having an erlang group >> based on the language you speak? >> > > Probably because not everyone speaks fluent english? And sometimes such > people find it easier to express their thoughts in their native language? > My point is that it is not necessary to speak fluent English to communicate, right ? I've found from my experience that generally people are very tolerant to the grammar mistakes if they still can understand you. Erlang community is too small to be stratified by native languages. -- Konstantin Sorokin From mazen.harake@REDACTED Tue Mar 16 13:52:27 2010 From: mazen.harake@REDACTED (Mazen Harake) Date: Tue, 16 Mar 2010 14:52:27 +0200 Subject: Node uptime Message-ID: <4B9F7F0B.6080907@erlang-solutions.com> Hi, I have a quick question. What is the easiest way to get the uptime of a Node (basically the "runtime" of the VM") *without* having to start something myself on startup I.e. it should be a generic solution which can run when I simply start a shell in Windows. Processing logs etc is not a very good idea since they wrap and as mentioned, the need to start something myself is a bad idea. I noticed while poking around in the C code that the ERTS does keep time of when processes start (p->started.tv_sec). Would it be possible to add the functionality of getting this value through e.g. erlang:system_info(runtime) or similar in a future version of Erlang? Meanwhile... is there another way of doing it? Cheers. /Mazen --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From huss01@REDACTED Tue Mar 16 14:09:51 2010 From: huss01@REDACTED (=?ISO-8859-1?Q?H=E5kan_Huss?=) Date: Tue, 16 Mar 2010 14:09:51 +0100 Subject: [erlang-questions] Node uptime In-Reply-To: <4B9F7F0B.6080907@erlang-solutions.com> References: <4B9F7F0B.6080907@erlang-solutions.com> Message-ID: Check out erlang:statistics(wall_clock). /H?kan On Tue, Mar 16, 2010 at 13:52, Mazen Harake wrote: > Hi, > > I have a quick question. What is the easiest way to get the uptime of a Node > (basically the "runtime" of the VM") *without* having to start something > myself on startup I.e. it should be a generic solution which can run when I > simply start a shell in Windows. > > Processing logs etc is not a very good idea since they wrap and as > mentioned, the need to start something myself is a bad idea. > > I noticed while poking around in the C code that the ERTS does keep time of > when processes start (p->started.tv_sec). Would it be possible to add the > functionality of getting this value through e.g. erlang:system_info(runtime) > or similar in a future version of Erlang? > > Meanwhile... is there another way of doing it? > > Cheers. > > /Mazen > --------------------------------------------------- > > --------------------------------------------------- > > WE'VE CHANGED NAMES! > > Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG > SOLUTIONS LTD. > > www.erlang-solutions.com > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From ulf.wiger@REDACTED Tue Mar 16 14:25:43 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Tue, 16 Mar 2010 14:25:43 +0100 Subject: [erlang-questions] Node uptime In-Reply-To: References: <4B9F7F0B.6080907@erlang-solutions.com> Message-ID: On Tue, 16 Mar 2010 14:09:51 +0100, H?kan Huss wrote: > Check out erlang:statistics(wall_clock). > > /H?kan statistics(wall_clock) wraps after ca 37 hours. From overload.erl: %% Mask equal to 2^27 - 1, used below. -define(mask27, 16#7ffffff). %% Returns number of milliseconds in the range [0, 2^27 - 1]. Must have %% this since statistics(wall_clock) wraps. Having 2^27 -1 as the max %% assures that we always get non-negative integers. 2^27 milliseconds %% are approx. 37.28 hours. get_now() -> element(1, statistics(wall_clock)) band ?mask27. This means that unless you get in from the start and continuously sample statistics(wall_clock), it can't be relied upon. BR, Ulf W -- Ulf Wiger CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd http://www.erlang-solutions.com --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From chandrashekhar.mullaparthi@REDACTED Tue Mar 16 14:47:13 2010 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Tue, 16 Mar 2010 13:47:13 +0000 Subject: [erlang-questions] Node uptime In-Reply-To: References: <4B9F7F0B.6080907@erlang-solutions.com> Message-ID: On 16 March 2010 13:25, Ulf Wiger wrote: > On Tue, 16 Mar 2010 14:09:51 +0100, H?kan Huss wrote: > > Check out erlang:statistics(wall_clock). >> >> /H?kan >> > > statistics(wall_clock) wraps after ca 37 hours. > > From overload.erl: > > %% Mask equal to 2^27 - 1, used below. > -define(mask27, 16#7ffffff). > > %% Returns number of milliseconds in the range [0, 2^27 - 1]. Must have > %% this since statistics(wall_clock) wraps. Having 2^27 -1 as the max > %% assures that we always get non-negative integers. 2^27 milliseconds > %% are approx. 37.28 hours. > get_now() -> > element(1, statistics(wall_clock)) band ?mask27. > > This means that unless you get in from the start and continuously > sample statistics(wall_clock), it can't be relied upon. > > Is that correct? Here is the output from one of our nodes. 34> util:uptime(). "55 days, 11 hours, 58 minutes and 3 seconds" 35> erlang:statistics(wall_clock). {4795096445,13307} uptime/0 is implemented as: uptime() -> {UpTime, _} = erlang:statistics(wall_clock), {D, {H, M, S}} = calendar:seconds_to_daystime(UpTime div 1000), lists:flatten(io_lib:format("~p days, ~p hours, ~p minutes and ~p seconds", [D,H,M,S])). cheers Chandru From mazen.harake@REDACTED Tue Mar 16 15:00:34 2010 From: mazen.harake@REDACTED (Mazen Harake) Date: Tue, 16 Mar 2010 16:00:34 +0200 Subject: [erlang-questions] Node uptime In-Reply-To: References: <4B9F7F0B.6080907@erlang-solutions.com> Message-ID: <4B9F8F02.1030408@erlang-solutions.com> Then I guess that the comment in overload.erl is wrong. I was actually checking this when I realized that any part of the c code could have made the wrap so I didn't bother checking... But it still feels like the "wrong" place to find it... perhaps erlang:uptime() would be a good alternative or whatever else then this (make it more "user friendly" *shrug* :P) Anyway, Thanks! In the end I don't care how to get the information as long as I can get it fairly simple :) /Mazen On 16/03/2010 15:47, Chandru wrote: > On 16 March 2010 13:25, Ulf Wiger wrote: > > >> On Tue, 16 Mar 2010 14:09:51 +0100, H?kan Huss wrote: >> >> Check out erlang:statistics(wall_clock). >> >>> /H?kan >>> >>> >> statistics(wall_clock) wraps after ca 37 hours. >> >> From overload.erl: >> >> %% Mask equal to 2^27 - 1, used below. >> -define(mask27, 16#7ffffff). >> >> %% Returns number of milliseconds in the range [0, 2^27 - 1]. Must have >> %% this since statistics(wall_clock) wraps. Having 2^27 -1 as the max >> %% assures that we always get non-negative integers. 2^27 milliseconds >> %% are approx. 37.28 hours. >> get_now() -> >> element(1, statistics(wall_clock)) band ?mask27. >> >> This means that unless you get in from the start and continuously >> sample statistics(wall_clock), it can't be relied upon. >> >> >> > Is that correct? Here is the output from one of our nodes. > > 34> util:uptime(). > "55 days, 11 hours, 58 minutes and 3 seconds" > > 35> erlang:statistics(wall_clock). > {4795096445,13307} > > uptime/0 is implemented as: > uptime() -> > {UpTime, _} = erlang:statistics(wall_clock), > {D, {H, M, S}} = calendar:seconds_to_daystime(UpTime div 1000), > lists:flatten(io_lib:format("~p days, ~p hours, ~p minutes and ~p > seconds", [D,H,M,S])). > > cheers > Chandru > > --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From ulf.wiger@REDACTED Tue Mar 16 15:04:16 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Tue, 16 Mar 2010 15:04:16 +0100 Subject: [erlang-questions] Node uptime In-Reply-To: References: <4B9F7F0B.6080907@erlang-solutions.com> Message-ID: On Tue, 16 Mar 2010 14:47:13 +0100, Chandru wrote: > 4795096445 That's definitely a bignum. Just goes to show that you should never trust comments in source code. :) BR, Ulf W -- Ulf Wiger CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd http://www.erlang-solutions.com --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From roberto.aloi@REDACTED Tue Mar 16 15:09:08 2010 From: roberto.aloi@REDACTED (Roberto Aloi) Date: Tue, 16 Mar 2010 14:09:08 +0000 Subject: [erlang-questions] Italian User Group In-Reply-To: <9dfb3ec1003160305m1d4d02feuf5ffc85daca5d5e3@mail.gmail.com> References: <20100315135724.GA6985@jetzback> <4B9E6CBB.4080108@erlang-solutions.com> <804cd4021003160240v5385d457uac86b6c3cbbcbfed@mail.gmail.com> <9dfb3ec1003160305m1d4d02feuf5ffc85daca5d5e3@mail.gmail.com> Message-ID: <4B9F9104.6090903@erlang-solutions.com> Hi all, +1 for English language for a potential Italian User Group. I'd like to avoid precluding International visibility to a potential Italian User Group, at least at this very early stage. You can still have an "Italian" section of it, for people not confident enough in expressing their thoughts in English. The main reason of an Italian EUG, according to me, wouldn't be to offer Erlang support to people speaking Italian. Honestly, I cannot see myself (or any of the other Italian Erlangers I know) asking or answering an Erlang question in Italian AND in English. That would be pointless and time consuming. And I wouldn't leave the International mailing lists and groups, because they are just TOO important. Binding the group to the local language would just isolate it. Lot of support could actually come from foreign sources (UK, Sweden, USA) and I would really like this to happen. The main reason of having an Italian EUG would be - ON THE CONTRARY - to spread knowledge of Erlang in a Country where PEOPLE SIMPLY DON'T KNOW ABOUT ERLANG. So, here's my idea. Let's try to organize an International Erlang event in Italy, in a city that is well connected to International destinations (Rome sounds the perfect candidate so far). For the interested ones (I'm in) we could use it as an excuse to have a very first physical meeting to discuss details regarding a user group (stuff like the statute, legal representatives, etc) and, most important, to meet each others. What do you think? Roberto Aloi -- University of Kent - Erlang Solutions Ltd. Twitter: @prof3ta Blog: http://aloiroberto.wordpress.com --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From chandrashekhar.mullaparthi@REDACTED Tue Mar 16 15:10:31 2010 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Tue, 16 Mar 2010 14:10:31 +0000 Subject: [erlang-questions] Node uptime In-Reply-To: References: <4B9F7F0B.6080907@erlang-solutions.com> Message-ID: On 16 March 2010 14:04, Ulf Wiger wrote: > On Tue, 16 Mar 2010 14:47:13 +0100, Chandru < > chandrashekhar.mullaparthi@REDACTED> wrote: > > 4795096445 >> > > That's definitely a bignum. > > Just goes to show that you should never trust comments in source > code. :) > > Which proves the point that putting comments in source code is a complete waste of time :-) Chandru From roberto@REDACTED Tue Mar 16 15:13:21 2010 From: roberto@REDACTED (Roberto Ostinelli) Date: Tue, 16 Mar 2010 15:13:21 +0100 Subject: [erlang-questions] Italian User Group In-Reply-To: <4B9F9104.6090903@erlang-solutions.com> References: <20100315135724.GA6985@jetzback> <4B9E6CBB.4080108@erlang-solutions.com> <804cd4021003160240v5385d457uac86b6c3cbbcbfed@mail.gmail.com> <9dfb3ec1003160305m1d4d02feuf5ffc85daca5d5e3@mail.gmail.com> <4B9F9104.6090903@erlang-solutions.com> Message-ID: couldn't agree more, i've sent a request out in the air on twitter < http://twitter.com/ostinelli/status/10517688201> and have had some responses back. not sure about rome, but please get in touch if you need any help. r. 2010/3/16 Roberto Aloi > Hi all, > > +1 for English language for a potential Italian User Group. > > I'd like to avoid precluding International visibility to a potential > Italian User Group, at least at this very early stage. > You can still have an "Italian" section of it, for people not confident > enough in expressing their thoughts in English. > > The main reason of an Italian EUG, according to me, wouldn't be to offer > Erlang support to people speaking Italian. Honestly, I cannot see myself > (or any of the other Italian Erlangers I know) asking or answering an > Erlang question in Italian AND in English. That would be pointless and > time consuming. And I wouldn't leave the International mailing lists and > groups, because they are just TOO important. > Binding the group to the local language would just isolate it. > Lot of support could actually come from foreign sources (UK, Sweden, > USA) and I would really like this to happen. > > The main reason of having an Italian EUG would be - ON THE CONTRARY - to > spread knowledge of Erlang in a Country where PEOPLE SIMPLY DON'T KNOW > ABOUT ERLANG. > > > So, here's my idea. > > > > Let's try to organize an International Erlang event in Italy, in a city > that is well connected to International destinations (Rome sounds the > perfect candidate so far). > > For the interested ones (I'm in) we could use it as an excuse to have a > very first physical meeting to discuss details regarding a user group > (stuff like the statute, legal representatives, etc) and, most > important, to meet each others. > > What do you think? > > Roberto Aloi > -- > University of Kent - Erlang Solutions Ltd. > Twitter: @prof3ta > Blog: http://aloiroberto.wordpress.com > From eodbat@REDACTED Tue Mar 16 15:33:22 2010 From: eodbat@REDACTED (Edoardo Batini) Date: Tue, 16 Mar 2010 15:33:22 +0100 Subject: [erlang-questions] Italian User Group In-Reply-To: References: <20100315135724.GA6985@jetzback> <4B9E6CBB.4080108@erlang-solutions.com> <804cd4021003160240v5385d457uac86b6c3cbbcbfed@mail.gmail.com> <9dfb3ec1003160305m1d4d02feuf5ffc85daca5d5e3@mail.gmail.com> <4B9F9104.6090903@erlang-solutions.com> Message-ID: <20100316143322.GA8314@jetzback> I opened a channel on freenode: /join #erlang-it (again: 'it' stands for 'based in italy') eolo999 From bob@REDACTED Tue Mar 16 15:36:20 2010 From: bob@REDACTED (Bob Ippolito) Date: Tue, 16 Mar 2010 07:36:20 -0700 Subject: [erlang-questions] two epmds running In-Reply-To: <201003162023.13790.als@iinet.net.au> References: <201003162023.13790.als@iinet.net.au> Message-ID: <6a36e7291003160736j60736011sede34e1ba0bf20d2@mail.gmail.com> On Tue, Mar 16, 2010 at 2:23 AM, Anthony Shipman wrote: > Sometimes it happens that I discover two epmd processes running. One of > them is in a tight loop consuming 100% of CPU time. My guess is that the > second one is started automatically because the first one is no longer > responding. Is this a known bug in epmd? I think we have seen this before, one of them is probably violently logging "epmd: epmd: error in accept" as well. We have only seen this on boot-up of a machine, probably due to several Erlang VMs trying to start up at the same time. We don't currently have a solution for this issue (mostly because we don't know the root cause yet). I am not sure we get two of them, it might be just one in our case. -bob From francesca.gangemi@REDACTED Tue Mar 16 15:44:05 2010 From: francesca.gangemi@REDACTED (Francesca Gangemi) Date: Tue, 16 Mar 2010 15:44:05 +0100 Subject: [erlang-questions] Italian User Group In-Reply-To: <804cd4021003160240v5385d457uac86b6c3cbbcbfed@mail.gmail.com> References: <20100315135724.GA6985@jetzback> <4B9E6CBB.4080108@erlang-solutions.com> <804cd4021003160240v5385d457uac86b6c3cbbcbfed@mail.gmail.com> Message-ID: <4B9F9935.7070807@erlang-solutions.com> Ovidiu Deac wrote: > On Mon, Mar 15, 2010 at 7:22 PM, Francesca Gangemi > wrote: > >> If you speak Italian (no matter where you live) join the Erlang Etna >> User group at http://groups.google.com/group/erlang-etna?pli=1 :) >> > > Just for my curiosity, what's the point of having an erlang group > based on the language you speak? Why would it be important that I > speak Italian but I live in Indochina and you speak Italian but you > live in Rome? > > Isn't it better to have a big group since more people share the same > information? > We already have this ML for sharing information and there's no intention to replicate this big group! :) > I totally understand the need to have a group for a certain geographic > area. This makes sense for example for finding/posting erlang jobs in > the area. > I think User Groups are not for just locating erlang jobs in a specific area. I see an User Group as a group of people that are interested in Erlang, try to learn more about it, help other people solving problems and spread Erlang knowledge. A good way to achieve this is organizing events and meetings in order to share experiences. Hence the local user groups acting and organizing events in a certain geographic area. It's hard to meet every day so most of the time user groups just discuss things on a ML. To send an email you can be anywhere in the world and the more we are the more knowledge and ideas we share. That's why I invited people to join the Erlang Etna User Group even if they don't live on top of the volcano :) Regarding the language, I think it's natural to start with the native one since in the group there are just Italians so far. This doesn't mean English speakers can't subscribe to the group if they are interested. There's no filter so you're all welcome. I think English should be used in meetings/documents/mails if it helps to reach more people but native languages should not be disregarded a priori. Kind regards Francesca --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From graeme.defty@REDACTED Tue Mar 16 16:33:52 2010 From: graeme.defty@REDACTED (Graeme Defty) Date: Tue, 16 Mar 2010 22:33:52 +0700 Subject: eunit failure - "*** test module not found ***" Message-ID: <8606aef41003160833r7d9d0159ra34983a4ae459e77@mail.gmail.com> Hi, I have a problem executing eunit tests in my current environment (which i am sure used to work fine - I think - curse this failing memory :-( ) Anyway, I have included eunit in my source: -include_lib("eunit/include/eunit.hrl"). and it compiles without complaint, but when i try to run the tests it fails: 4> eunit:test(csv). undefined *** test module not found *** ::true ======================================================= Failed: 0. Skipped: 0. Passed: 0. One or more tests were canceled. error I can see the auto-generated test functions using module_info/0 and can even execute them manually. I am clearly not accessing a library, and I am sure I have missed some simple step ( a parameter to the erl command perhaps?) or something equally dumb, but i have scoured the docs and cant find it. Any ideas, anyone? Thanks graeme From max.lapshin@REDACTED Tue Mar 16 16:50:46 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 16 Mar 2010 18:50:46 +0300 Subject: RTSP library extracted Message-ID: Hi everyone. I've extracted RTSP library from erlyvideo: http://github.com/erlyvideo/ertsp RTSP/RTP/SDP/RTCP is a family of protocols, required to stream video from ip cameras or use software like Quicktime Broadcaster. Documentation will be added soon. Glad if it will help anyone. From dawid.figiel@REDACTED Tue Mar 16 16:54:17 2010 From: dawid.figiel@REDACTED (Dawid Figiel) Date: Tue, 16 Mar 2010 15:54:17 +0000 (GMT) Subject: [erlang-questions] Node uptime In-Reply-To: <1468589083.140061268754711797.JavaMail.root@zimbra> Message-ID: <1284010497.140081268754857575.JavaMail.root@zimbra> ----- Original Message ----- From: "Chandru" To: "Ulf Wiger" Cc: "Erlang Questions" Sent: Tuesday, March 16, 2010 2:10:31 PM GMT +00:00 GMT Britain, Ireland, Portugal Subject: Re: [erlang-questions] Node uptime On 16 March 2010 14:04, Ulf Wiger wrote: > On Tue, 16 Mar 2010 14:47:13 +0100, Chandru < > chandrashekhar.mullaparthi@REDACTED> wrote: > > 4795096445 >> > > That's definitely a bignum. > > Just goes to show that you should never trust comments in source > code. :) > > Which proves the point that putting comments in source code is a complete waste of time :-) Chandru Cool, here is a small help for you... ]:-> sed -i 's/%.*//' *.{erl,hrl} -- cheers, Dawid From jeanphilippe1.caruana@REDACTED Tue Mar 16 17:05:51 2010 From: jeanphilippe1.caruana@REDACTED (Jean-Philippe Caruana) Date: Tue, 16 Mar 2010 17:05:51 +0100 Subject: [erlang-questions] RTSP library extracted In-Reply-To: References: Message-ID: <4B9FAC5F.3000905@orange-ftgroup.com> Le 16/03/2010 16:50, Max Lapshin a ?crit : > Hi everyone. I've extracted RTSP library from erlyvideo: > http://github.com/erlyvideo/ertsp > RTSP/RTP/SDP/RTCP is a family of protocols, required to stream video > from ip cameras or use software like > Quicktime Broadcaster. Hi ! Nice job, but it doesn't compile on my workstation : (can't find include lib "erlmedia/include/video_frame.hrl") make all erl -make Recompile: src/sdp src/sdp.erl:78: Warning: NOT OPTIMIZED: sub binary used by erlang:binary_to_list/1 src/sdp.erl:82: Warning: NOT OPTIMIZED: sub binary used by re:run/3 src/sdp.erl:96: Warning: NOT OPTIMIZED: sub binary used by erlang:binary_to_list/1 src/sdp.erl:99: Warning: NOT OPTIMIZED: sub binary used by erlang:binary_to_list/1 Recompile: src/rtsp_sup Recompile: src/rtsp_socket src/rtsp_socket.erl:137: Warning: variable 'Socket' is unused Recompile: src/rtsp_listener Recompile: src/rtsp_example_callback Recompile: src/rtsp_connection src/rtsp_connection.erl:6: can't find include lib "erlmedia/include/video_frame.hrl" src/rtsp_connection.erl:71: record video_frame undefined -- JPC ******************************** Ce message et toutes les pieces jointes (ci-apres le "message") sont confidentiels et etablis a l'attention exclusive de ses destinataires. Toute utilisation ou diffusion non autorisee est interdite. Tout message electronique est susceptible d'alteration. CVF decline toute responsabilite au titre de ce message s'il a ete altere, deforme ou falsifie. Si vous n'etes pas destinataire de ce message, merci de le detruire immediatement et d'avertir l'expediteur. ********************************* This message and any attachments (the "message") are confidential and intended solely for the addressees. Any unauthorised use or dissemination is prohibited. Messages are susceptible to alteration. CVF shall not be liable for the message if altered, changed or falsified. If you are not the intended addressee of this message, please cancel it immediately and inform the sender.. ******************************** From max.lapshin@REDACTED Tue Mar 16 17:07:44 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 16 Mar 2010 19:07:44 +0300 Subject: [erlang-questions] RTSP library extracted In-Reply-To: <4B9FAC5F.3000905@orange-ftgroup.com> References: <4B9FAC5F.3000905@orange-ftgroup.com> Message-ID: Yes, it is dependent on http://github.com/erlyvideo/erlmedia, because it needs to unpack some h264 and aac details. I will add later debian build instructions and README for usage. Currently is works only for inbound video streams in h264/aac format. If you need other codecs, or outbound stream, tell me. From g@REDACTED Tue Mar 16 17:10:45 2010 From: g@REDACTED (Garrett Smith) Date: Tue, 16 Mar 2010 11:10:45 -0500 Subject: [erlang-questions] two epmds running In-Reply-To: <6a36e7291003160736j60736011sede34e1ba0bf20d2@mail.gmail.com> References: <201003162023.13790.als@iinet.net.au> <6a36e7291003160736j60736011sede34e1ba0bf20d2@mail.gmail.com> Message-ID: On Tue, Mar 16, 2010 at 9:36 AM, Bob Ippolito wrote: > On Tue, Mar 16, 2010 at 2:23 AM, Anthony Shipman wrote: >> Sometimes it happens that I discover two epmd processes running. One of >> them is in a tight loop consuming 100% of CPU time. My guess is that the >> second one is started automatically because the first one is no longer >> responding. Is this a known bug in epmd? > > I think we have seen this before, one of them is probably violently > logging "epmd: epmd: error in accept" as well. We have only seen this > on boot-up of a machine, probably due to several Erlang VMs trying to > start up at the same time. We don't currently have a solution for this > issue (mostly because we don't know the root cause yet). > > I am not sure we get two of them, it might be just one in our case. I haven't seen two running, but I've seen none running, which is a real bummer. I've written a monitor process (probably gen_fsm based) that keeps an eye on epmd and starts it and reinitializes it when it goes away. A properly functioning epmd is important enough that you might consider something similar to ensure that, in your case, that rogue process is dealt with (killed?). I suppose that's somewhat flippant -- to say write your own monitor for this, but losing epmd is like losing your network and people go to great lengths to keep networks up. Garrett From roberto.aloi@REDACTED Tue Mar 16 17:52:31 2010 From: roberto.aloi@REDACTED (Roberto Aloi) Date: Tue, 16 Mar 2010 16:52:31 +0000 Subject: [erlang-questions] eunit failure - "*** test module not found ***" In-Reply-To: <8606aef41003160833r7d9d0159ra34983a4ae459e77@mail.gmail.com> References: <8606aef41003160833r7d9d0159ra34983a4ae459e77@mail.gmail.com> Message-ID: <4B9FB74F.7090601@erlang-solutions.com> Hi, > > 4> eunit:test(csv). > undefined > *** test module not found *** > ::true > > ======================================================= > Failed: 0. Skipped: 0. Passed: 0. > One or more tests were canceled. > error Can you share the content of your "csv" (or "csv_tests") module? It seems to me eunit can't actually find the "csv" module. Are you *really* sure it's in the path? What surprises me a bit is that if I reproduce that error, it will print ::csv to me, rather than ::true. Which version of eunit are you using? Roberto Aloi -- University of Kent - Erlang Solutions Ltd. Twitter: @prof3ta Blog: http://aloiroberto.wordpress.com --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From bob@REDACTED Tue Mar 16 18:13:54 2010 From: bob@REDACTED (Bob Ippolito) Date: Tue, 16 Mar 2010 10:13:54 -0700 Subject: [erlang-questions] two epmds running In-Reply-To: References: <201003162023.13790.als@iinet.net.au> <6a36e7291003160736j60736011sede34e1ba0bf20d2@mail.gmail.com> Message-ID: <6a36e7291003161013n3954348ah2515eeaa9b1f2f2b@mail.gmail.com> On Tue, Mar 16, 2010 at 9:10 AM, Garrett Smith wrote: > On Tue, Mar 16, 2010 at 9:36 AM, Bob Ippolito wrote: >> On Tue, Mar 16, 2010 at 2:23 AM, Anthony Shipman wrote: >>> Sometimes it happens that I discover two epmd processes running. One of >>> them is in a tight loop consuming 100% of CPU time. My guess is that the >>> second one is started automatically because the first one is no longer >>> responding. Is this a known bug in epmd? >> >> I think we have seen this before, one of them is probably violently >> logging "epmd: epmd: error in accept" as well. We have only seen this >> on boot-up of a machine, probably due to several Erlang VMs trying to >> start up at the same time. We don't currently have a solution for this >> issue (mostly because we don't know the root cause yet). >> >> I am not sure we get two of them, it might be just one in our case. > > I haven't seen two running, but I've seen none running, which is a > real bummer. I've written a monitor process (probably gen_fsm based) > that keeps an eye on epmd and starts it and reinitializes it when it > goes away. A properly functioning epmd is important enough that you > might consider something similar to ensure that, in your case, that > rogue process is dealt with (killed?). > > I suppose that's somewhat flippant -- to say write your own monitor > for this, but losing epmd is like losing your network and people go to > great lengths to keep networks up. Yeah absolutely it needs to be killed when it's in that state. It eats up a lot of CPU, spews endless crap to syslog, and breaks erlang distribution on that node. We haven't seen it often enough to feel too much pain yet but it's something on our roadmap to try and reproduce and fix or work around it. When we kill it we also bring down all of the applications on that node, which sucks because we can't shut them down cleanly since doing that (at least by the means that our tools know how) depends on epmd being up. Fortunately we have only seen this happen just after a reboot. -bob From Mike.French@REDACTED Tue Mar 16 18:39:15 2010 From: Mike.French@REDACTED (French, Mike) Date: Tue, 16 Mar 2010 17:39:15 -0000 Subject: [erlang-questions] eunit failure - "*** test module not found ***" Message-ID: <3F8EEA01CF53D74DB4A9EC314D82B4F32246B6@wells154942.int.rdel.co.uk> Graeme, I think this occurs when you omit a leading underscore on an eunit macro in a test-generating function. For example, say you write a simple test function using a basic macro: basic_test() -> ?assert( 1 + 1 =:= 2 ). Then you decide to convert it to a test-generating function, you should append an '_' to the function name, and prepend an '_' to the macro name: fancy_test_() -> ?_assert( 1 + 1 =:= 2 ). but if you forget to change the macro name: bad_test_() -> ?assert( 1 + 1 =:= 2 ). then you get the error as you describe: undefined *** test module not found *** ::ok ======================================================= Failed: 0. Skipped: 0. Passed: 0. One or more tests were cancelled. error The 'ok' value in the error message is the result of evaluating the function returned by the macro, so your mistake is on a macro that returns 'true'. Mike > -----Original Message----- > From: erlang-questions@REDACTED > [mailto:erlang-questions@REDACTED]On > Behalf Of Graeme Defty > Sent: 16 March 2010 15:34 > To: erlang-questions@REDACTED > Subject: [erlang-questions] eunit failure - "*** test module not found > ***" > > > Hi, > > I have a problem executing eunit tests in my current environment > (which i am sure used to work fine - I think - curse this > failing memory :-( ) > > Anyway, I have included eunit in my source: > > -include_lib("eunit/include/eunit.hrl"). > > and it compiles without complaint, but when i try to run the > tests it fails: > > 4> eunit:test(csv). > undefined > *** test module not found *** > ::true > > ======================================================= > Failed: 0. Skipped: 0. Passed: 0. > One or more tests were canceled. > error > > I can see the auto-generated test functions using module_info/0 and > can even execute them manually. > > I am clearly not accessing a library, and I am sure I have missed some > simple step ( a parameter to the erl > command perhaps?) or something equally dumb, but i have scoured the > docs and cant find it. > > Any ideas, anyone? > > Thanks > > graeme > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > Thales UK Ltd (Wells) DISCLAIMER: The information contained in this e-mail is confidential. It may also be legally privileged. It is intended only for the stated addressee(s) and access to it by any other person is unauthorised. If you are not an addressee, you must not disclose, copy, circulate or in any other way use or rely on the information contained in this e-mail. Such unauthorised use may be unlawful. We may monitor all e-mail communications through our networks. If you have received this e-mail in error, please inform us immediately on sender's telephone number above and delete it and all copies from your system. We accept no responsibility for changes to any e-mail which occur after it has been sent. Attachments to this e-mail may contain software viruses which could damage your system. We therefore recommend you virus-check all attachments before opening. Thales UK Ltd. Registered Office: 2 Dashwood Lang Road, The Bourne Business Park, Addlestone, Weybridge, Surrey KT15 2NX Registered in England No. 868273 From bernie@REDACTED Wed Mar 17 00:20:43 2010 From: bernie@REDACTED (Bernard Duggan) Date: Wed, 17 Mar 2010 10:20:43 +1100 Subject: Dialyzer type complexity limit Message-ID: <4BA0124B.5020903@m5net.com> Hi all (especially the dialyzer folks), In running dialyzer over our code, we're striking what appears to be the limit of type complexity. Specifically, we have a type which is composed of 29 different possible atoms, but evidence suggests that dialyzer is collapsing the type down to just atom(), since we can assign any atom to record elements of that type without dialyzer throwing a warning. That behaviour remains until I reduce the number of atoms down to 23 at which point incorrect assignments are picked up. I'm presuming this is the "union limit" referred to in the paper "Practical Type Inference Based on Success Typings", though 23 atoms seems (to my mind, at least) like a fairly small limit. I looked around but couldn't find any specific details on what that limit is or how it's calculated (since I understand that it probably wouldn't just be a simple number when you're dealing with integer ranges etc). So I have three questions: * Am I right in my assessment of what's going on? * Is there an "easy" way (for some definition of "easy"), either through external configuration or in the source code, to adjust this limit? A quick scan through the source code showed me only that the people who wrote it are much smarter than me ;) * Is it possible to get a notification or something when a type is being treated more broadly than its strict definition? Cheers, Bernard From kostis@REDACTED Wed Mar 17 01:36:10 2010 From: kostis@REDACTED (Kostis Sagonas) Date: Wed, 17 Mar 2010 02:36:10 +0200 Subject: [erlang-questions] Dialyzer type complexity limit In-Reply-To: <4BA0124B.5020903@m5net.com> References: <4BA0124B.5020903@m5net.com> Message-ID: <4BA023FA.5080100@cs.ntua.gr> Bernard Duggan wrote: > Hi all (especially the dialyzer folks), > In running dialyzer over our code, we're striking what appears to be > the limit of type complexity. Specifically, we have a type which is > composed of 29 different possible atoms, but evidence suggests that > dialyzer is collapsing the type down to just atom(), since we can assign > any atom to record elements of that type without dialyzer throwing a > warning. That behaviour remains until I reduce the number of atoms down > to 23 at which point incorrect assignments are picked up. > I'm presuming this is the "union limit" referred to in the paper > "Practical Type Inference Based on Success Typings", though 23 atoms > seems (to my mind, at least) like a fairly small limit. I looked around > but couldn't find any specific details on what that limit is or how it's > calculated (since I understand that it probably wouldn't just be a > simple number when you're dealing with integer ranges etc). > So I have three questions: > > * Am I right in my assessment of what's going on? More or less right, but I am a bit confused by your 23 -- I thought it was actually a bit less than that -- 13 to be exact. > * Is there an "easy" way (for some definition of "easy"), either through > external configuration or in the source code, to adjust this limit? A > quick scan through the source code showed me only that the people who > wrote it are much smarter than me ;) Yes, we are ;-) We've succeeded in hidding this in a place nobody would possibly search for... in a file called erl_types.erl. Anyway, change the following line to a number you do not feel confident it matches your needs: lib/hipe/cerl/erl_types.erl:-define(SET_LIMIT, 13). and re-compile the file. > * Is it possible to get a notification or something when a type is being > treated more broadly than its strict definition? The answer is "yes, of course it is possible" but doing this in the near future is of quite low priority to us. Cheers, Kostis From bernie@REDACTED Wed Mar 17 02:39:55 2010 From: bernie@REDACTED (Bernard Duggan) Date: Wed, 17 Mar 2010 12:39:55 +1100 Subject: [erlang-questions] Dialyzer type complexity limit In-Reply-To: <4BA023FA.5080100@cs.ntua.gr> References: <4BA0124B.5020903@m5net.com> <4BA023FA.5080100@cs.ntua.gr> Message-ID: <4BA032EB.6010909@m5net.com> Kostis Sagonas wrote: >> * Am I right in my assessment of what's going on? > More or less right, but I am a bit confused by your 23 -- I thought it > was actually a bit less than that -- 13 to be exact. Ah, I can explain that. I presumed the issue was occurring in a compound type we had made up of a 10 atom type and a 19 atom type. I was editing the latter and got it down to 13, but I assumed it was the larger sum that caused the issue. 13 also makes perfect sense though - obviously (had I looked more closely), the errors that we got were actually specific to the places we were using the 19 element one on its own. >> external configuration or in the source code, to adjust this limit? A >> quick scan through the source code showed me only that the people who >> wrote it are much smarter than me ;) > Yes, we are ;-) We've succeeded in hidding this in a place nobody > would possibly search for... in a file called erl_types.erl. Anyway, > change the following line to a number you do not feel confident it > matches your needs: > > lib/hipe/cerl/erl_types.erl:-define(SET_LIMIT, 13). That (plus the fact that I was looking for a number around 23) would explain it. I was foolishly looking in the dialyzer source tree :) > The answer is "yes, of course it is possible" but doing this in the > near future is of quite low priority to us. No problem - I may even investigate writing a patch for it myself "when I have time" :) Thanks a lot for the reply. Cheers, Bernard From vinayakapawar@REDACTED Wed Mar 17 04:17:12 2010 From: vinayakapawar@REDACTED (Vinayak Pawar) Date: Wed, 17 Mar 2010 08:47:12 +0530 Subject: Erlang list comprehension optimization Message-ID: <23237d041003162017h628bdfd8hc9be35f3432e9ece@mail.gmail.com> Are these equivalent in terms of space utilization? 1) lists:foreach(fun(X) -> SomeOpFun(X) end, Xs). 2) [SomeOpFun(X) || X <- Xs]. In case 1) output list isn't generated. In case 2) output list is generated, but it is not used(or not assigned to any variable). So in such cases, does Erlang VM optimize and doesn't create any temporary list? In other words, is it OK to use list comprehension in place of lists:foreach/2 without any extra memory utilization? Thanks in advance, Vinayak From bernie@REDACTED Wed Mar 17 04:28:11 2010 From: bernie@REDACTED (Bernard Duggan) Date: Wed, 17 Mar 2010 14:28:11 +1100 Subject: [erlang-questions] Erlang list comprehension optimization In-Reply-To: <23237d041003162017h628bdfd8hc9be35f3432e9ece@mail.gmail.com> References: <23237d041003162017h628bdfd8hc9be35f3432e9ece@mail.gmail.com> Message-ID: <4BA04C4B.7060307@m5net.com> Vinayak Pawar wrote: > Are these equivalent in terms of space utilization? > > 1) lists:foreach(fun(X) -> SomeOpFun(X) end, Xs). > > 2) [SomeOpFun(X) || X <- Xs]. > > In case 1) output list isn't generated. In case 2) output list is generated, > but it is not used(or not assigned to any variable). So in such cases, does > Erlang VM optimize and doesn't create any temporary list? > >From http://www.erlang.org/doc/efficiency_guide/listHandling.html#id2261027 : "In R12B [and presumably later], if the result of the list comprehension will *obviously* not be used, a list will not be constructed." Cheers, Bernard From rvirding@REDACTED Wed Mar 17 05:07:09 2010 From: rvirding@REDACTED (Robert Virding) Date: Wed, 17 Mar 2010 05:07:09 +0100 Subject: [erlang-questions] Erlang list comprehension optimization In-Reply-To: <4BA04C4B.7060307@m5net.com> References: <23237d041003162017h628bdfd8hc9be35f3432e9ece@mail.gmail.com> <4BA04C4B.7060307@m5net.com> Message-ID: <3dbc6d1c1003162107g65e313f1g8255c724013abef7@mail.gmail.com> On 17 March 2010 04:28, Bernard Duggan wrote: > Vinayak Pawar wrote: >> Are these equivalent in terms of space utilization? >> >> 1) lists:foreach(fun(X) -> SomeOpFun(X) end, Xs). >> >> 2) [SomeOpFun(X) || X <- Xs]. >> >> In case 1) output list isn't generated. In case 2) output list is generated, >> but it is not used(or not assigned to any variable). So in such cases, does >> Erlang VM optimize and doesn't create any temporary list? >> > From > http://www.erlang.org/doc/efficiency_guide/listHandling.html#id2261027 : > > "In R12B [and presumably later], if the result of the list comprehension > will *obviously* not be used, a list will not be constructed." That is obviously good when it can be done although there are cases when the list must still be created even if it not wanted, for example if the list comprehension is the last thing done in a function so its value must be returned. There is one strange thing further up in the text: "Lists comprehensions still have a reputation for being slow. They used to be implemented using funs, which used to be slow." List comprehensions have never been implemented with funs, at least not when they were first introduced. I know. Robert From bgustavsson@REDACTED Wed Mar 17 08:30:02 2010 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Wed, 17 Mar 2010 08:30:02 +0100 Subject: [erlang-questions] Erlang list comprehension optimization In-Reply-To: <3dbc6d1c1003162107g65e313f1g8255c724013abef7@mail.gmail.com> References: <23237d041003162017h628bdfd8hc9be35f3432e9ece@mail.gmail.com> <4BA04C4B.7060307@m5net.com> <3dbc6d1c1003162107g65e313f1g8255c724013abef7@mail.gmail.com> Message-ID: <6672d0161003170030q297d69c7sac2ba66e46de9f2f@mail.gmail.com> On Wed, Mar 17, 2010 at 5:07 AM, Robert Virding wrote: > > There is one strange thing further up in the text: > > "Lists comprehensions still have a reputation for being slow. They > used to be implemented using funs, which used to be slow." > > List comprehensions have never been implemented with funs, at least > not when they were first introduced. I know. Have a look the function lc_tq/3 starting at line 430 in R6B: http://github.com/mfoemmel/erlang-otp/blob/b48c3645b0e28fe61cb53771d2b84bfc30d48bad/lib/compiler/src/sys_pre_expand.erl It seems clear to me from the code that list comprehensions are rewritten to an expression that uses a fun. Also see the comment before the function. It says that because Erlang doesn't have letrecs, the lambda (fun) is explicitly passed as an extra argument. Nowadays, list comprehensions are translated to letrecs (which are available in Core Erlang), and the letrecs are in turn translated to ordinary recursive functions. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From graeme.defty@REDACTED Wed Mar 17 08:42:31 2010 From: graeme.defty@REDACTED (Graeme Defty) Date: Wed, 17 Mar 2010 14:42:31 +0700 Subject: [erlang-questions] eunit failure - "*** test module not found ***" In-Reply-To: <3F8EEA01CF53D74DB4A9EC314D82B4F32246B6@wells154942.int.rdel.co.uk> References: <3F8EEA01CF53D74DB4A9EC314D82B4F32246B6@wells154942.int.rdel.co.uk> Message-ID: <8606aef41003170042u4eb00223l503209248081c0a6@mail.gmail.com> Mike, Brilliant! ...and almost exactly right, except that 'true' is not the result of a macro but literally the last line of code. It comes about because of the old "Why cant I have a null function call?" (AKA "Why cant I add in the extra ';'?") issue. I have read the history on this one, and come down firmly on the side that says this little bit of syntactic sugar would NOT in fact bring about the end of the world as we know it. It iss the one thing about erlang which causes me physical pain. Virtually every time I edit a module, the first compilation throws up one or more syntax errors due to missing/surplus commas/semi-colons. I would guess that it adds about 25% to my erlang development time. My work-around (for test functions, where I dont care about the result) is to add a 'true' as the last line so that all my real tests can have a comma on the end and I can duplicate/re-order them at will without incurring the wrath of the syntax gods. In the case of a generator function of course . . . I had a feeling it would be something dopey, but am pleased to find that the root cause is not MY dopeyness (IMHO - your mileage may vary) Anyway, thanks again to all for the help. Graeme On 17 March 2010 00:39, French, Mike wrote: > > Graeme, > > I think this occurs when you omit a leading underscore > on an eunit macro in a test-generating function. > > For example, say you write a simple test function using a basic macro: > > ?basic_test() -> ?assert( 1 + 1 =:= 2 ). > > Then you decide to convert it to a test-generating function, you should > append ?an '_' to the function name, and > prepend an '_' to the macro ? ?name: > > ?fancy_test_() -> ?_assert( 1 + 1 =:= 2 ). > > but if you forget to change the macro name: > > ?bad_test_() -> ?assert( 1 + 1 =:= 2 ). > > then you get the error as you describe: > > ?undefined > ?*** test module not found *** > ?::ok > ?======================================================= > ? ?Failed: 0. ?Skipped: 0. ?Passed: 0. > ?One or more tests were cancelled. > ?error > > The 'ok' value in the error message is the result of > evaluating the function returned by the macro, > so your mistake is on a macro that returns 'true'. > > Mike > > > > > >> -----Original Message----- >> From: erlang-questions@REDACTED >> [mailto:erlang-questions@REDACTED]On >> Behalf Of Graeme Defty >> Sent: 16 March 2010 15:34 >> To: erlang-questions@REDACTED >> Subject: [erlang-questions] eunit failure - "*** test module not found >> ***" >> >> >> Hi, >> >> I have a problem executing eunit tests in my current environment >> (which i am sure used to work fine - I think - curse this >> failing memory :-( ?) >> >> Anyway, I have included eunit in my source: >> >> ?-include_lib("eunit/include/eunit.hrl"). >> >> and it compiles without complaint, but when i try to run the >> tests it fails: >> >> ?4> eunit:test(csv). >> ?undefined >> ?*** test module not found *** >> ?::true >> >> ?======================================================= >> ? ?Failed: 0. ?Skipped: 0. ?Passed: 0. >> ?One or more tests were canceled. >> ?error >> >> I can see the auto-generated test functions using module_info/0 and >> can even execute them manually. >> >> I am clearly not accessing a library, and I am sure I have missed some >> simple step ( a parameter to the erl >> command perhaps?) or something equally dumb, but i have scoured the >> docs and cant find it. >> >> Any ideas, anyone? >> >> Thanks >> >> graeme >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED >> > > Thales UK Ltd (Wells) DISCLAIMER: The information contained in this e-mail > is confidential. It may also be legally privileged. It is intended only for > the stated addressee(s) and access to it by any other person is > unauthorised. If you are not an addressee, you must not disclose, copy, > circulate or in any other way use or rely on the information contained in > this e-mail. Such unauthorised use may be unlawful. We may monitor all > e-mail communications through our networks. If you have received this e-mail > in error, please inform us immediately on sender's telephone number above > and delete it and all copies from your system. We accept no responsibility > for changes to any e-mail which occur after it has been sent. ?Attachments > to this e-mail may contain software viruses which could damage your system. > We therefore recommend you virus-check all attachments before opening. > Thales UK Ltd. Registered Office: 2 Dashwood Lang Road, The Bourne Business > Park, Addlestone, Weybridge, Surrey KT15 2NX Registered in England No. > 868273 > From kenji.rikitake@REDACTED Wed Mar 17 09:29:31 2010 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Wed, 17 Mar 2010 17:29:31 +0900 Subject: [erlang-questions] Italian User Group In-Reply-To: References: <20100315135724.GA6985@jetzback> <4B9E6CBB.4080108@erlang-solutions.com> <804cd4021003160240v5385d457uac86b6c3cbbcbfed@mail.gmail.com> Message-ID: <20100317082931.GA46455@k2r.org> In the message dated Tue, Mar 16, 2010 at 09:47:42AM +0000, Chandru writes: > > On 16 March 2010 09:40, Ovidiu Deac wrote: > > > On Mon, Mar 15, 2010 at 7:22 PM, Francesca Gangemi > > wrote: > > > If you speak Italian (no matter where you live) join the Erlang Etna > > > User group at http://groups.google.com/group/erlang-etna?pli=1 :) > > > > Just for my curiosity, what's the point of having an erlang group > > based on the language you speak? > > > > Probably because not everyone speaks fluent english? And sometimes such > people find it easier to express their thoughts in their native language? This is one of the reasons I do not post primarily-Japanese-speaking meeting on this mailing list. Unfortunately in Japan majority of people showing interest in Erlang do not necessarily speak English well. Kenji Rikitake From kenji.rikitake@REDACTED Wed Mar 17 09:35:59 2010 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Wed, 17 Mar 2010 17:35:59 +0900 Subject: [erlang-questions] Italian User Group In-Reply-To: <9dfb3ec1003160305m1d4d02feuf5ffc85daca5d5e3@mail.gmail.com> References: <20100315135724.GA6985@jetzback> <4B9E6CBB.4080108@erlang-solutions.com> <804cd4021003160240v5385d457uac86b6c3cbbcbfed@mail.gmail.com> <9dfb3ec1003160305m1d4d02feuf5ffc85daca5d5e3@mail.gmail.com> Message-ID: <20100317083559.GB46455@k2r.org> In the message <9dfb3ec1003160305m1d4d02feuf5ffc85daca5d5e3@REDACTED> dated Tue, Mar 16, 2010 at 01:05:15PM +0300, Konstantin Sorokin writes: > My point is that it is not necessary to speak fluent English to > communicate, right ? I've found from my experience that generally > people are very tolerant to the > grammar mistakes if they still can understand you. Erlang community is > too small to be stratified by native languages. I strongly and always suggest all talented Japanese-speaking programmers and users of Erlang in Japan to write their ideas in English, and some of them do. They are brave people. But that does not necessarily mean that they do not have any difficulty on speaking/listening to English. I think one of the main reason why Erlang has been getting popularity in Japan is that Programming Erlang by Joe Armstrong is very well translated into Japanese. (And I hope Erlang Programming by Francesco Cesarini and Simon Thompson will be in a near future.) BTW I appreciate any regional/linguistical programming communities to emerge anyway. Kenji Rikitake From norton@REDACTED Wed Mar 17 02:07:39 2010 From: norton@REDACTED (Joseph Wayne Norton) Date: Wed, 17 Mar 2010 10:07:39 +0900 Subject: [erlang-questions] two epmds running In-Reply-To: <6a36e7291003161013n3954348ah2515eeaa9b1f2f2b@mail.gmail.com> References: <201003162023.13790.als@iinet.net.au> <6a36e7291003160736j60736011sede34e1ba0bf20d2@mail.gmail.com> <6a36e7291003161013n3954348ah2515eeaa9b1f2f2b@mail.gmail.com> Message-ID: We have faced the same behavior described by Bob. The problem occurs only when rebooting a server that has two or more Erlang virtual machines started by init. The problem when it happens can easily consume a significant amount of disk space in the /var/log directory by epmd's error logging. It is unknown how to directly trigger the problem. On Wed, 17 Mar 2010 02:13:54 +0900, Bob Ippolito wrote: > On Tue, Mar 16, 2010 at 9:10 AM, Garrett Smith wrote: >> On Tue, Mar 16, 2010 at 9:36 AM, Bob Ippolito wrote: >>> On Tue, Mar 16, 2010 at 2:23 AM, Anthony Shipman >>> wrote: >>>> Sometimes it happens that I discover two epmd processes running. One >>>> of >>>> them is in a tight loop consuming 100% of CPU time. My guess is that >>>> the >>>> second one is started automatically because the first one is no longer >>>> responding. Is this a known bug in epmd? >>> >>> I think we have seen this before, one of them is probably violently >>> logging "epmd: epmd: error in accept" as well. We have only seen this >>> on boot-up of a machine, probably due to several Erlang VMs trying to >>> start up at the same time. We don't currently have a solution for this >>> issue (mostly because we don't know the root cause yet). >>> >>> I am not sure we get two of them, it might be just one in our case. >> >> I haven't seen two running, but I've seen none running, which is a >> real bummer. I've written a monitor process (probably gen_fsm based) >> that keeps an eye on epmd and starts it and reinitializes it when it >> goes away. A properly functioning epmd is important enough that you >> might consider something similar to ensure that, in your case, that >> rogue process is dealt with (killed?). >> >> I suppose that's somewhat flippant -- to say write your own monitor >> for this, but losing epmd is like losing your network and people go to >> great lengths to keep networks up. > > Yeah absolutely it needs to be killed when it's in that state. It eats > up a lot of CPU, spews endless crap to syslog, and breaks erlang > distribution on that node. We haven't seen it often enough to feel too > much pain yet but it's something on our roadmap to try and reproduce > and fix or work around it. > > When we kill it we also bring down all of the applications on that > node, which sucks because we can't shut them down cleanly since doing > that (at least by the means that our tools know how) depends on epmd > being up. Fortunately we have only seen this happen just after a > reboot. > > -bob > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > -- norton@REDACTED From nc@REDACTED Wed Mar 17 11:10:14 2010 From: nc@REDACTED (Nicolas Charpentier) Date: Wed, 17 Mar 2010 11:10:14 +0100 Subject: [erlang-questions] two epmds running In-Reply-To: References: <201003162023.13790.als@iinet.net.au> <6a36e7291003160736j60736011sede34e1ba0bf20d2@mail.gmail.com> <6a36e7291003161013n3954348ah2515eeaa9b1f2f2b@mail.gmail.com> Message-ID: <36C8AE69-432F-4074-BBA3-B623FDA1149E@charpi.net> Hi If the problem only occurs when two nodes start at the same time, you can start epmd before any nodes. If you are running Linux you can add a init script to start epmd and ensure that other init script are run after epmd. Nicolas On Mar 17, 2010, at 2:07, "Joseph Wayne Norton" wrote: > > We have faced the same behavior described by Bob. The problem > occurs only when rebooting a server that has two or more Erlang > virtual machines started by init. The problem when it happens can > easily consume a significant amount of disk space in the /var/log > directory by epmd's error logging. It is unknown how to directly > trigger the problem. > > > On Wed, 17 Mar 2010 02:13:54 +0900, Bob Ippolito > wrote: > >> On Tue, Mar 16, 2010 at 9:10 AM, Garrett Smith wrote: >>> On Tue, Mar 16, 2010 at 9:36 AM, Bob Ippolito >>> wrote: >>>> On Tue, Mar 16, 2010 at 2:23 AM, Anthony Shipman >>>> wrote: >>>>> Sometimes it happens that I discover two epmd processes running. >>>>> One of >>>>> them is in a tight loop consuming 100% of CPU time. My guess is >>>>> that the >>>>> second one is started automatically because the first one is no >>>>> longer >>>>> responding. Is this a known bug in epmd? >>>> >>>> I think we have seen this before, one of them is probably violently >>>> logging "epmd: epmd: error in accept" as well. We have only seen >>>> this >>>> on boot-up of a machine, probably due to several Erlang VMs >>>> trying to >>>> start up at the same time. We don't currently have a solution for >>>> this >>>> issue (mostly because we don't know the root cause yet). >>>> >>>> I am not sure we get two of them, it might be just one in our case. >>> >>> I haven't seen two running, but I've seen none running, which is a >>> real bummer. I've written a monitor process (probably gen_fsm based) >>> that keeps an eye on epmd and starts it and reinitializes it when it >>> goes away. A properly functioning epmd is important enough that you >>> might consider something similar to ensure that, in your case, that >>> rogue process is dealt with (killed?). >>> >>> I suppose that's somewhat flippant -- to say write your own monitor >>> for this, but losing epmd is like losing your network and people >>> go to >>> great lengths to keep networks up. >> >> Yeah absolutely it needs to be killed when it's in that state. It >> eats >> up a lot of CPU, spews endless crap to syslog, and breaks erlang >> distribution on that node. We haven't seen it often enough to feel >> too >> much pain yet but it's something on our roadmap to try and reproduce >> and fix or work around it. >> >> When we kill it we also bring down all of the applications on that >> node, which sucks because we can't shut them down cleanly since doing >> that (at least by the means that our tools know how) depends on epmd >> being up. Fortunately we have only seen this happen just after a >> reboot. >> >> -bob >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED >> > > > -- > norton@REDACTED > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > From bflatmaj7th@REDACTED Wed Mar 17 11:11:54 2010 From: bflatmaj7th@REDACTED (Richard Andrews) Date: Wed, 17 Mar 2010 21:11:54 +1100 Subject: [erlang-questions] two epmds running In-Reply-To: References: <201003162023.13790.als@iinet.net.au> <6a36e7291003160736j60736011sede34e1ba0bf20d2@mail.gmail.com> <6a36e7291003161013n3954348ah2515eeaa9b1f2f2b@mail.gmail.com> Message-ID: <7702c0611003170311p72954bc2saab02e90b2ecd188@mail.gmail.com> I've seen it too and I think it goes like this: Only seems to happen on SMP machines which have a lot of grunt Two erlang nodes start and require epmd Both start epmd Two epmd instances start and check for a valid epmd (find none) One of the epmd instance is able to bind and listen on the epmd port The other fails but believes that it must be able to claim the port. Doesn't seem to check for another program now listening on the port and goes around a bust loop trying to bind+listen. On Wed, Mar 17, 2010 at 12:07 PM, Joseph Wayne Norton wrote: > > We have faced the same behavior described by Bob. ?The problem occurs only > when rebooting a server that has two or more Erlang virtual machines started > by init. ?The problem when it happens can easily consume a significant > amount of disk space in the /var/log directory by epmd's error logging. ? It > is unknown how to directly trigger the problem. > From karlsson.rm@REDACTED Wed Mar 17 12:01:56 2010 From: karlsson.rm@REDACTED (Mikael Karlsson) Date: Wed, 17 Mar 2010 12:01:56 +0100 Subject: Using -spec for callbacks when defining behaviours Message-ID: <872e77ab1003170401u54f391cdi181d67eca20012af@mail.gmail.com> Hi, I understand that -spec (and -type) constructs may be used in include (.hrl) files and the module itself when specifying functions. Has there been any discussion on beeing able to use them in behaviour defining modules to specify the "callback" modules in more detail? When defining a behaviour today you "just" specify the function names and their arity with the behaviour_info/1 function. I think it would be good to be able to also specify the types of the arguments and their return type for the module implementing the behaviour. This would make a behaviour defining module closer to a interface specification and also decrease the depenencies of include files. Mikael From Mike.French@REDACTED Wed Mar 17 12:40:55 2010 From: Mike.French@REDACTED (French, Mike) Date: Wed, 17 Mar 2010 11:40:55 -0000 Subject: [erlang-questions] eunit failure - "*** test module not found ***" Message-ID: <3F8EEA01CF53D74DB4A9EC314D82B4F32246B7@wells154942.int.rdel.co.uk> > -----Original Message----- > From: erlang-questions@REDACTED > [mailto:erlang-questions@REDACTED]On > Behalf Of Graeme Defty > Sent: 17 March 2010 07:43 > To: erlang-questions@REDACTED > Subject: Re: [erlang-questions] eunit failure - "*** test module not found ***" > > Brilliant! > > ...and almost exactly right, except that 'true' is not > the result of a macro but literally the last line of code. The result and the last line are very often the same. The result of the test-generating function will be the evaluation of the basic unprefixed macro, say 'ok' or 'true', which is handled like this: http://www.erlang.org/doc/apps/eunit/chapter.html#Primitives which says that a single atom is interpreted as a module name, and presumably EUnit will try to look-up test functions for that module: http://www.erlang.org/doc/reference_manual/modules.html#id2270797 and it's the call to true:module_info() that fails with bad module 'true'. Mike > On 17 March 2010 00:39, French, Mike > wrote: > > > > Graeme, > > > > I think this occurs when you omit a leading underscore > > on an eunit macro in a test-generating function. > > > > For example, say you write a simple test function using a basic macro: > > > > ?basic_test() -> ?assert( 1 + 1 =:= 2 ). > > > > Then you decide to convert it to a test-generating function, you should > > append ?an '_' to the function name, and > > prepend an '_' to the macro ? ?name: > > > > ?fancy_test_() -> ?_assert( 1 + 1 =:= 2 ). > > > > but if you forget to change the macro name: > > > > ?bad_test_() -> ?assert( 1 + 1 =:= 2 ). > > > > then you get the error as you describe: > > > > ?undefined > > ?*** test module not found *** > > ?::ok > > ?======================================================= > > ? ?Failed: 0. ?Skipped: 0. ?Passed: 0. > > ?One or more tests were cancelled. > > ?error > > > > The 'ok' value in the error message is the result of > > evaluating the function returned by the macro, > > so your mistake is on a macro that returns 'true'. > > > > Mike Thales UK Ltd (Wells) DISCLAIMER: The information contained in this e-mail is confidential. It may also be legally privileged. It is intended only for the stated addressee(s) and access to it by any other person is unauthorised. If you are not an addressee, you must not disclose, copy, circulate or in any other way use or rely on the information contained in this e-mail. Such unauthorised use may be unlawful. We may monitor all e-mail communications through our networks. If you have received this e-mail in error, please inform us immediately on sender's telephone number above and delete it and all copies from your system. We accept no responsibility for changes to any e-mail which occur after it has been sent. Attachments to this e-mail may contain software viruses which could damage your system. We therefore recommend you virus-check all attachments before opening. Thales UK Ltd. Registered Office: 2 Dashwood Lang Road, The Bourne Business Park, Addlestone, Weybridge, Surrey KT15 2NX Registered in England No. 868273 From dizzyd@REDACTED Wed Mar 17 15:04:04 2010 From: dizzyd@REDACTED (Dave Smith) Date: Wed, 17 Mar 2010 08:04:04 -0600 Subject: Erlang initiated kernel panic on OSX Message-ID: Greetings, Using Snow Leopard 10.6.2 and Erlang R13B04 it's possible to cause a kernel panic using the following steps: 1. Start new terminal window 2. erl +K true -s crypto 3. Cmd-W (close the terminal window without stopping erlang) Alternatively, if you're running SL 10.6.2 and Erlang R13B03: 1. Start new terminal window 2. erl +K true -s crypto 3. Cmd-Q (quit the terminal app without stopping erlang) This appears to work with either 32 or 64 bit builds of Erlang. Thanks, D. From vladdu55@REDACTED Wed Mar 17 15:08:52 2010 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 17 Mar 2010 15:08:52 +0100 Subject: [erlang-questions] Using -spec for callbacks when defining behaviours In-Reply-To: <872e77ab1003170401u54f391cdi181d67eca20012af@mail.gmail.com> References: <872e77ab1003170401u54f391cdi181d67eca20012af@mail.gmail.com> Message-ID: <95be1d3b1003170708p6b4fdaf3o51d330d5377f78bb@mail.gmail.com> On Wed, Mar 17, 2010 at 12:01, Mikael Karlsson wrote: > I understand that -spec (and -type) ?constructs may be used in include > (.hrl) files and the module itself when specifying functions. > > Has there been any discussion on beeing able to use them in behaviour > defining modules to specify the "callback" modules in more detail? > > When defining a behaviour today you "just" specify the function names and > their arity with the behaviour_info/1 function. > > I think it would be good to be able to also specify the types of the > arguments and their return type for the module implementing the behaviour. > This would make a behaviour defining module closer to a interface > specification and also decrease the depenencies of include files. Good suggestion! There are two issues here: - attach the -spec to the callback functions. I think that a simple way to do that is to have the module declaring the behaviour implement even the callbacks (as dummy functions) and then type specs can be attached to them. There might be problems with name conflicts, but I don't think there are that many behaviours out there besides the standard ones to be a problem. In the worst case, these dummy functions could be put in a separate module. - check that a module implementing a behaviour respects the declared specs. This I let to the dialyzer team to work out :) regards, Vlad From max.lapshin@REDACTED Wed Mar 17 15:17:23 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Wed, 17 Mar 2010 17:17:23 +0300 Subject: [erlang-questions] Erlang initiated kernel panic on OSX In-Reply-To: References: Message-ID: Damn, second recipe works when repeated twice! It is severe bug in OS X, which should be reported to apple. Have you done it? From magnus@REDACTED Wed Mar 17 15:26:51 2010 From: magnus@REDACTED (Magnus Henoch) Date: Wed, 17 Mar 2010 14:26:51 +0000 Subject: Using -spec for callbacks when defining behaviours In-Reply-To: <95be1d3b1003170708p6b4fdaf3o51d330d5377f78bb@mail.gmail.com> (Vlad Dumitrescu's message of "Wed, 17 Mar 2010 15:08:52 +0100") References: <872e77ab1003170401u54f391cdi181d67eca20012af@mail.gmail.com> <95be1d3b1003170708p6b4fdaf3o51d330d5377f78bb@mail.gmail.com> Message-ID: <847hpbgh1w.fsf@linux-b2a3.site> Vlad Dumitrescu writes: > - attach the -spec to the callback functions. I think that a simple > way to do that is to have the module declaring the behaviour implement > even the callbacks (as dummy functions) and then type specs can be > attached to them. There might be problems with name conflicts, but I > don't think there are that many behaviours out there besides the > standard ones to be a problem. In the worst case, these dummy > functions could be put in a separate module. I was thinking about this the other day, and came up with the idea of creating a new directive: -behaviour_spec. It would look just like the normal -spec directive, except that it describes the types of the functions required by the behaviour. It would be nice to be able parameterise those types somehow. For example, the State variable accepted and returned by almost all functions in the gen_server behaviour obviously has type any(), but for any given callback module the state should have a narrower type. In order to save typing and avoid mistakes, you'd want to specify that type once and for all in that module. I can't think of any good syntax for that, though... This is ugly but should get the idea across: %% gen_server.erl -behaviour_spec handle_call(any(), {pid(), any()}, State) -> {'reply', any(), State}. %% my_callback.erl -behaviour(gen_server). -record(state, {foo}). -behaviour_type(State, #state{}). -- Magnus Henoch, magnus@REDACTED Erlang Solutions http://www.erlang-solutions.com/ --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From dizzyd@REDACTED Wed Mar 17 15:33:49 2010 From: dizzyd@REDACTED (Dave Smith) Date: Wed, 17 Mar 2010 08:33:49 -0600 Subject: [erlang-questions] Erlang initiated kernel panic on OSX In-Reply-To: References: Message-ID: Yes, a bug was also filed w/ Apple. However, I was hoping that making the VM team aware might be useful in narrowing down the specific interactions between the VM and the system. The fact that it requires kernel polling and the crypto app suggests something is up with how kernel polling is used with /dev/urandom or something...random guess. :) D. On Wed, Mar 17, 2010 at 8:17 AM, Max Lapshin wrote: > Damn, second recipe works when repeated twice! It is severe bug in OS > X, which should be reported to apple. > Have you done it? > From kostis@REDACTED Wed Mar 17 16:41:54 2010 From: kostis@REDACTED (Kostis Sagonas) Date: Wed, 17 Mar 2010 17:41:54 +0200 Subject: [erlang-questions] Using -spec for callbacks when defining behaviours In-Reply-To: <872e77ab1003170401u54f391cdi181d67eca20012af@mail.gmail.com> References: <872e77ab1003170401u54f391cdi181d67eca20012af@mail.gmail.com> Message-ID: <4BA0F842.6050706@cs.ntua.gr> Mikael Karlsson wrote: > Hi, > > I understand that -spec (and -type) constructs may be used in include > (.hrl) files and the module itself when specifying functions. > > Has there been any discussion on beeing able to use them in behaviour > defining modules to specify the "callback" modules in more detail? > > When defining a behaviour today you "just" specify the function names and > their arity with the behaviour_info/1 function. > > I think it would be good to be able to also specify the types of the > arguments and their return type for the module implementing the behaviour. > This would make a behaviour defining module closer to a interface > specification and also decrease the dependencies of include files. Absolutely! In fact, we have had similar thoughts to yours and have been working for about half a year now on extending Erlang to do exactly what you are hinting at in your mail. The good news is that it's all done and finished (dialyzer already supports this) and for about a month now we've even written an EEP for it, but I've been so swamped that I've not found time to properly send it to those responsible for EEPs. I am including it below -- comments welcome, Kostis PS. Can I also please ask the folks of the Erlang/OTP team to put this in the EEP homepage? ============================================================================ EEP: XXX Title: Behaviour Specifications Version: $Revision: 1 $ Last-Modified: $Date: Mon Mar 8 12:14:35 EET 2010$ Author: Stavros Aronis [aronisstav(at)gmail(dot)com], Kostis Sagonas [kostis(at)cs(dot)ntua(dot)gr Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 03-Feb-2010 Erlang-Version: Post-History: Abstract ======= We describe a small, backwards compatible change for behaviours to specify the types which are expected of their callbacks. Rationale ======= In Erlang a behaviour is usually a complete design pattern implemented in a module. Users can use these design patterns easily, writing in some other module just the callback functions required to provide the behaviour's functionality. As all these callbacks are called somewhere within the behaviour's code, it is important to check that behaviour callbacks have the functionality which is expected from them. Currently, not only is this the responsibility of the programmer but this checking is not even semi-automatic as there is no formal way for the module defining the behaviour to specify what is expected from its callback module. Instead, the programmer must check manually if the callback functions accept the correct arguments and return the correct results, and are indeed in accordance with the behaviour's available documentation, which often only exists in paper form. What this EEP aims at is to propose infrastructure which will ease the automatization of checking that callback modules adhere to what's expected from them. Given the wide usage of behaviours in current Erlang application development, we believe that providing a means to include such specification in a behaviour's implementation is useful for both the behaviour's implementor, who can make clear what the types of the callbacks should be and the behaviour's user who can employ tools that check automatically for errors in the callback module's implementation. Specification ========== Currently, all behaviours must define a behaviour_info/1 function. Among other pieces of information, a clause of this function enumerates (in the form of 2-tuples) the function names and arities of the required callbacks. The following example is taken from the 'gen_server' behaviour: behaviour_info(callbacks) -> [{init,1}, {handle_call,3}, {handle_cast,2}, {terminate, 2}, {code_change, 3}]. Often, though not always, the behaviour module also contains some additional information in the form of comments. Continuing the same example, the gen_server module includes the following comments: %%% The user module should export: %%% %%% init(Args) %%% ==> {ok, State} %%% {ok, State, Timeout} %%% ignore %%% {stop, Reason} %%% %%% handle_call(Msg, {From, Tag}, State) %%% %%% ==> {reply, Reply, State} %%% {reply, Reply, State, Timeout} %%% {noreply, State} %%% {noreply, State, Timeout} %%% {stop, Reason, Reply, State} %%% Reason = normal | shutdown | Term terminate(State) is called %%% %%% .... MORE COMMENTS FOR THE OTHER THREE CALLBACKS HERE ..... The problem with comments is that they are in free text form, often lacking some information as in the case above, and cannot be mechanically processed. We propose a modification in the behaviour_info(callbacks) clause so that it also specifies the types which are expected from these callbacks. The modification itself is very simple, adding a third element in the tuple list. The third element is a string whose contents is a -spec in the already existing language of EEP8: behaviour_info(callbacks) -> [{init, 1, "-spec init(Args) -> {'ok', State} | {'ok', State, timeout() | 'hibernate'} | {'stop', Reason} | 'ignore'."},"}, {handle_call, 3, "-spec handle_call(Request, From :: {pid(), Tag}, State) -> {'reply', Reply, NewState} | {'reply', Reply, NewState, timeout() | 'hibernate'} | {'noreply', NewState} | {'noreply', NewState, timeout() | 'hibernate'} | {'stop', Reason, Reply, NewState} | {'stop', Reason, NewState}."}, {handle_cast, 2, "-spec ... SOME SPEC HERE ..."}, ....]. A defect detection tool (e.g. dialyzer) can then use these specs as a reference to compare the inferred types of the callbacks. Incidentally, the above example shows various interesting things: 1) Using the language of types and specs, one can provide information both for documentation purposes and for types as e.g. in From :: {pid(), Tag} 2) It's not necessary to specify every type as e.g. the Tag variable above, which is a convenient shorthand for Tag :: term() 3) Comments are often incomplete or can easily become obsolete as e.g. the 'hibernate' value is nowhere mentioned. A final note: One may wonder why the specs are written as strings instead of as -specs. There are various reasons for this, though none of them is deep or cast in stone. First of all specs are not proper Erlang terms (they are file attributes), so they cannot be used as is in places where Erlang terms are expected. Since we wanted to reuse as much of the existing infrastructure of behaviours as possible, the natural place to put them was to extend the behaviour_info(callbacks) clause. Second, they specify a type obligation (i.e., a contract) for all the callback modules, not for some specific known module or the behaviour module that contains them (the behaviour module does not contain definitions for these functions). Because of this, they cannot be placed in the behaviour defining module since currently there is no way for the language of specs to express something of the form: for all callback modules M, -spec M:init(Args) -> .... If we use a file attribute other than -spec (e.g. -callback_spec) these specs could be part of the module defining the behaviour instead of being part of the behaviour_info(callbacks) clause. Implementation ============== We have already implemented the above proposal and we can provide a fully working implementation. Trivial changes were needed in the compiler to accept the new behaviour_info format when checking for the presence of all the required callbacks in a module that uses the behaviour, as well as minor changes in some other library modules. Using this extension of dialyzer in a significant corpus of Erlang code we have already detected many violations of the published behaviour documentation. Backwards Compatibility ======================= The extension is fully backwards compatible. The old format is still supported (the clause of the behaviour_info function can contain both pairs and triples). The inclusion of the -spec string is optional and no warnings are emitted unless Dialyzer is asked explicitly to check the behaviour usage via a corresponding option. Copyright ========= This document has been placed in the public domain. .. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 coding: utf-8 From magnus@REDACTED Wed Mar 17 17:26:38 2010 From: magnus@REDACTED (Magnus Henoch) Date: Wed, 17 Mar 2010 16:26:38 +0000 Subject: Using -spec for callbacks when defining behaviours In-Reply-To: <4BA0F842.6050706@cs.ntua.gr> (Kostis Sagonas's message of "Wed, 17 Mar 2010 17:41:54 +0200") References: <872e77ab1003170401u54f391cdi181d67eca20012af@mail.gmail.com> <4BA0F842.6050706@cs.ntua.gr> Message-ID: <8439zyhq2p.fsf@linux-b2a3.site> Kostis Sagonas writes: > The extension is fully backwards compatible. The old format is still > supported (the clause of the behaviour_info function can contain both > pairs and triples). I'd call that "forwards compatible" :) If I write a file in the new format, and pass it to an "old" compiler, I get a warning about a bad callbacks definition, and I don't get any warnings about missing behaviour functions: %% foo.erl -module(foo). -compile(export_all). behaviour_info(callbacks) -> [{foo, 1, "-spec foo(A) -> A."}, {bar, 0}]. %% bar.erl -module(bar). -behaviour(foo). -export([baz/1]). baz(A) -> A. %% $ erlc foo.erl $ erlc bar.erl ./bar.erl:2: Warning: behaviour foo callback functions erroneously defined I.e., I get no warnings, neither for foo/1 (new-style) nor bar/0 (old-style). How about using a separate clause of the behaviour_info function for type specs? Like this: %% foo.erl -module(foo). -compile(export_all). behaviour_info(callbacks_with_types) -> [{foo, 1, "-spec foo(A) -> A."}, {bar, 0, "-spec bar() -> 'ok'."}]; behaviour_info(callbacks) -> [{F,A} || {F,A,_Spec} <- behaviour_info(callbacks_with_types)]. %% With bar.erl being the same, I get: $ erlc bar.erl ./bar.erl:2: Warning: undefined callback function bar/0 (behaviour 'foo') ./bar.erl:2: Warning: undefined callback function foo/1 (behaviour 'foo') which is what I'd like to see. -- Magnus Henoch, magnus@REDACTED Erlang Solutions http://www.erlang-solutions.com/ --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From ulf.wiger@REDACTED Wed Mar 17 18:17:41 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Wed, 17 Mar 2010 18:17:41 +0100 Subject: [erlang-questions] Re: Using -spec for callbacks when defining behaviours In-Reply-To: <8439zyhq2p.fsf@linux-b2a3.site> References: <872e77ab1003170401u54f391cdi181d67eca20012af@mail.gmail.com> <4BA0F842.6050706@cs.ntua.gr> <8439zyhq2p.fsf@linux-b2a3.site> Message-ID: On Wed, 17 Mar 2010 17:26:38 +0100, Magnus Henoch wrote: > How about using a separate clause of the behaviour_info function for > type specs? Like this: > > %% foo.erl > -module(foo). > -compile(export_all). > > behaviour_info(callbacks_with_types) -> > [{foo, 1, "-spec foo(A) -> A."}, > {bar, 0, "-spec bar() -> 'ok'."}]; > behaviour_info(callbacks) -> > [{F,A} || {F,A,_Spec} <- behaviour_info(callbacks_with_types)]. > Perhaps the clause could rather be behaviour_info(specification) -> [{foo, 1, "-spec foo(A) -> A."}, ...]. The behaviour_info(callbacks) clause would only be needed for backwards compatibility. BR, Ulf -- Ulf Wiger CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd http://www.erlang-solutions.com --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From hynek@REDACTED Wed Mar 17 18:48:33 2010 From: hynek@REDACTED (Hynek Vychodil) Date: Wed, 17 Mar 2010 18:48:33 +0100 Subject: [erlang-questions] How to send a message to all nodes without UDP broadcast? In-Reply-To: References: Message-ID: <4d08db371003171048i38b7eb6cl8c8f19be0645a6d0@mail.gmail.com> [{foo,X} ! Msg || X<- nodes()]. On Tue, Mar 9, 2010 at 12:31 AM, ??? wrote: > Hi, this may be a simple question, but I am newer and did not find the > answer in book. I want to send a message to all nodes(using same cookie) in > one call, but not using the UDP broadcast. How can I do this ? Can someone > take one minute to answer me ? thanks! > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try GoodData now for free: www.gooddata.com From ulf.wiger@REDACTED Wed Mar 17 19:21:15 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Wed, 17 Mar 2010 19:21:15 +0100 Subject: [erlang-questions] How to send a message to all nodes without UDP broadcast? In-Reply-To: <4d08db371003171048i38b7eb6cl8c8f19be0645a6d0@mail.gmail.com> References: <4d08db371003171048i38b7eb6cl8c8f19be0645a6d0@mail.gmail.com> Message-ID: If you want to include the node you're on: [{foo,X} ! Msg || X <- [node()|nodes()]]. BR, Ulf W On Wed, 17 Mar 2010 18:48:33 +0100, Hynek Vychodil wrote: > [{foo,X} ! Msg || X<- nodes()]. > > On Tue, Mar 9, 2010 at 12:31 AM, ??? wrote: >> Hi, this may be a simple question, but I am newer and did not find the >> answer in book. I want to send a message to all nodes(using same >> cookie) in >> one call, but not using the UDP broadcast. How can I do this ? Can >> someone >> take one minute to answer me ? thanks! >> > > > -- Ulf Wiger CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd http://www.erlang-solutions.com --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From francesco@REDACTED Wed Mar 17 19:54:51 2010 From: francesco@REDACTED (Francesco Cesarini (Erlang Solutions)) Date: Wed, 17 Mar 2010 18:54:51 +0000 Subject: [erlang-questions] Italian User Group In-Reply-To: <4B9E6C36.9010105@erlang-solutions.com> References: <20100315135724.GA6985@jetzback> <4B9E6C36.9010105@erlang-solutions.com> Message-ID: <4BA1257B.1020704@erlang-solutions.com> > I think I should chasing *someone* at Erlang Solutions Ltd. a bit more > [wink wink...] to organize some of the Erlang events in Italy, to boost > a potential new Italian Erlang user group down there. > You referring to Francesca, of course, but if you [wink wink...] at her, Enzo will use the lupara.... ;-) /F PS. Point taken, think it is a brilliant idea. --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From francesco@REDACTED Wed Mar 17 21:19:54 2010 From: francesco@REDACTED (Francesco Cesarini (Erlang Solutions)) Date: Wed, 17 Mar 2010 20:19:54 +0000 Subject: [erlang-questions] Italian User Group In-Reply-To: <20100317083559.GB46455@k2r.org> References: <20100315135724.GA6985@jetzback> <4B9E6CBB.4080108@erlang-solutions.com> <804cd4021003160240v5385d457uac86b6c3cbbcbfed@mail.gmail.com> <9dfb3ec1003160305m1d4d02feuf5ffc85daca5d5e3@mail.gmail.com> <20100317083559.GB46455@k2r.org> Message-ID: <4BA1396A.3090807@erlang-solutions.com> Hi All, interesting discussions on various user groups. Having started the one in Stockholm and London, and helped the Michals initiate the one in Krakow, the main focus of these user groups is to meet up and listen to talks, exchange experiences, war stories, network, do code dojos and meet new people. It is not about a language or a mailing list. More about a particular location. (Even if this location is secondary, as people from all over have registered on the London user group list). As far as I know, the most up to date list list of all Erlang user groups is on trapexit: http://www.trapexit.org/ErlangUserGroups This lists are used to announce meetups. In some cases, mailing lists and discussions in local languages are a must. As Chandru states, not everyone speaks English, and those who do might not have the confidence of posting to such a heavily trafficated list... Great examples of large Erlang communities exist in China and Japan. They run their own conferences, workshops and blogs: http://ecug.org/ and http://erlang-china.org/ are an example. I am sure Kenji can share similar experiences and links on Japan. I have not looked for them, but am sure they are there. South Korea is another country with a large user base you rarely come across here in Europe but boy do they show up on the erlang.org google analytics page. If you take Joe's book, it has been translated to Chinese, Japanese and Korean. Simon and my Erlang Programming is being translated to Chinese (It is now out for review), Japanese and Russian (The latter two due out later this year). I hope both books will come out in many other languages. Also hoping that Manning is looking to translate Martin, Eric and Richard's excellent book, as local translations help the community and reduce the barrier to entry when teaching Erlang in universities. There was a great talk at OSCON 2008 on starting a user group. The slides are here: http://www.slideshare.net/selenamarie/running-a-successful-user-group As a result of this thread, we are hoping to arrange a one day event in Italy. Events in local languages (The Erlang Factory Lite we ran in Krakow was in Polish, except for Ulf's talk. He is practising for next year, but in the meantime preferred English). Also, to provide some numbers... Last week, we had a London User Group meeting in conjunction with QCON. 50 people showed up. The Michals also kicked off the Wrocklaw User Group , where 60 people showed up! I think that there were about 20 people in Paris this Monday. The next Erl Lounge (aka Bay Area User Group Meeting) will be next week in conjunction with the Erlang Factory in the bay area. Expect 100+ people and free beer. Joanna will be sending an email out to this mailing list with the details, but it will be an excellent opportunity for everyone who could not take time off to come and mingle with the speakers and conference delegates. So all in all, all noise is good noise, in whatever language and whatever location you are in. Hope to see many of you in SF next week! Francesco > In the message <9dfb3ec1003160305m1d4d02feuf5ffc85daca5d5e3@REDACTED> > dated Tue, Mar 16, 2010 at 01:05:15PM +0300, > Konstantin Sorokin writes: > >> My point is that it is not necessary to speak fluent English to >> communicate, right ? I've found from my experience that generally >> people are very tolerant to the >> grammar mistakes if they still can understand you. Erlang community is >> too small to be stratified by native languages. >> > > I strongly and always suggest all talented Japanese-speaking programmers > and users of Erlang in Japan to write their ideas in English, and some > of them do. They are brave people. But that does not necessarily mean > that they do not have any difficulty on speaking/listening to English. > > I think one of the main reason why Erlang has been getting popularity in > Japan is that Programming Erlang by Joe Armstrong is very well > translated into Japanese. (And I hope Erlang Programming by Francesco > Cesarini and Simon Thompson will be in a near future.) > > BTW I appreciate any regional/linguistical programming communities to > emerge anyway. > > Kenji Rikitake > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From hakan@REDACTED Wed Mar 17 23:10:07 2010 From: hakan@REDACTED (=?ISO-8859-1?Q?H=E5kan_Mattsson?=) Date: Wed, 17 Mar 2010 23:10:07 +0100 Subject: [erlang-questions] How to send a message to all nodes without UDP broadcast? In-Reply-To: References: <4d08db371003171048i38b7eb6cl8c8f19be0645a6d0@mail.gmail.com> Message-ID: <922d05851003171510j6ce90869qcc7613de41458a7a@mail.gmail.com> Yet another alternative: rpc:abcast(foo, Msg). /H?kan 2010/3/17 Ulf Wiger : > > If you want to include the node you're on: > > [{foo,X} ! Msg || X <- [node()|nodes()]]. > > BR, > Ulf W > > On Wed, 17 Mar 2010 18:48:33 +0100, Hynek Vychodil > wrote: > >> [{foo,X} ! Msg || X<- nodes()]. >> >> On Tue, Mar 9, 2010 at 12:31 AM, ??? wrote: >>> >>> Hi, this may be a simple question, but I am newer and did not find the >>> answer in book. I want to send a message to all nodes(using same cookie) >>> in >>> one call, but not using the UDP broadcast. How can I do this ? Can >>> someone >>> take one minute to answer me ? thanks! From vladdu55@REDACTED Wed Mar 17 23:43:35 2010 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 17 Mar 2010 23:43:35 +0100 Subject: [erlang-questions] Using -spec for callbacks when defining behaviours In-Reply-To: <4BA0F842.6050706@cs.ntua.gr> References: <872e77ab1003170401u54f391cdi181d67eca20012af@mail.gmail.com> <4BA0F842.6050706@cs.ntua.gr> Message-ID: <95be1d3b1003171543i5849de59i12ef808f8d6dbe4d@mail.gmail.com> On Wed, Mar 17, 2010 at 16:41, Kostis Sagonas wrote: > behaviour_info(callbacks) -> > ?[{init, 1, > ? ?"-spec init(Args) -> > ? ? ? ? ? {'ok', State} | > ? ? ? ? ? {'ok', State, timeout() | 'hibernate'} | > ? ? ? ? ? {'stop', Reason} | > ? ? ? ? ? 'ignore'."},"}, While this is good because it is easy to implement and somewhat compatible to the old way (cf the other comments), it has the distinct feeling of a duct tape fix. At least to me it does. Type specifications are part of the language, although not expressions, as you point out. But is it a good idea to use them as data by having them as strings? Tools will have to know that strings returned by behaviour_info are to be interpreted as type specs. Soon there will be other functions that could return those, and also other metadata will be hidden inside strings. I don't know about you, but I don't like that at all... Actually, I'd go further and say that the current data returned by behaviour_info already suffers of the same problem: tools have to know that "{init, 1}" in this case is in fact "fun ?MODULE:init/1". A way to handle this that keeps the data in a sane format would be to introduce callback declarations, in the style of -callback init/1. %% old style -callback init(Args) -> {'ok', State} | {'ok', State, timeout() | 'hibernate'} | {'stop', Reason} | 'ignore'. The compiler would generate automagically behaviour_info from these declarations, so that after compilation everything looks like in the other case. Looking at the resulting behaviour module, it looks funny: no functions, just some declarations... I won't push this further now, except to note that I can imagine taking several steps and seeing it not as a module, but as an interface description. Replace -module() with -interface() and then we could remove the -callback. I can see this interface descriptions extending to address process interfaces, something in the style of UBF(B). There's a lot of potential. I am well aware that many will hate the idea (which can be improved), but I'm sure that at least as many hate the idea of "strings as complex data types that the compiler doesn't know about and tools have to know about of all these special cases". best regards, Vlad From ok@REDACTED Thu Mar 18 02:23:34 2010 From: ok@REDACTED (Richard O'Keefe) Date: Thu, 18 Mar 2010 14:23:34 +1300 Subject: [erlang-questions] Re: Using -spec for callbacks when defining behaviours In-Reply-To: References: <872e77ab1003170401u54f391cdi181d67eca20012af@mail.gmail.com> <4BA0F842.6050706@cs.ntua.gr> <8439zyhq2p.fsf@linux-b2a3.site> Message-ID: <51E65BB5-290F-4000-BCF4-6A79E053A3BF@cs.otago.ac.nz> >> >> behaviour_info(callbacks_with_types) -> >> [{foo, 1, "-spec foo(A) -> A."}, >> {bar, 0, "-spec bar() -> 'ok'."}]; If the string can only be a spec, - is "-" required or optional? - is "spec" required or optional? - is "." required or optional? - the function name has to appear twice, is the second appearance required or optional? So could this be behaviour_info(callbacks_with_types) -> [ {foo, 1, "(A) -> A"} , {bar, 0, "() -> 'ok'"} ]; From steven.charles.davis@REDACTED Thu Mar 18 05:49:39 2010 From: steven.charles.davis@REDACTED (Steve Davis) Date: Wed, 17 Mar 2010 21:49:39 -0700 (PDT) Subject: Using -spec for callbacks when defining behaviours In-Reply-To: <872e77ab1003170401u54f391cdi181d67eca20012af@mail.gmail.com> References: <872e77ab1003170401u54f391cdi181d67eca20012af@mail.gmail.com> Message-ID: Hmm. I find myself, having read this discussion, left rather cold and wondering: what problem does this idea resolve? I haven't really hit any practical issues with using behaviours, or with dependencies on include files. Both seem to work pretty well as they stand. As a coder, I'm concerned that this suggestion (and other forms of... type-envy?) may not actually get in the way of what we are trying to get done rather than assist it? fwiw, a year ago I would probably have been an active advocate of more language support for type constraints, but the longer I spend building things using erlang, the more I have come to see things in an entirely different light. Just my 2c here of course. /s On Mar 17, 6:01?am, Mikael Karlsson wrote: > This would make a behaviour defining module closer to a interface > specification and also decrease the depenencies of include files. From ulf.wiger@REDACTED Thu Mar 18 08:37:43 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Thu, 18 Mar 2010 08:37:43 +0100 Subject: [erlang-questions] How to send a message to all nodes without UDP broadcast? In-Reply-To: <7fa241f31003171729q5c9d8a25ubced6d51d82d7d80@mail.gmail.com> References: <4d08db371003171048i38b7eb6cl8c8f19be0645a6d0@mail.gmail.com> <7fa241f31003171729q5c9d8a25ubced6d51d82d7d80@mail.gmail.com> Message-ID: On Thu, 18 Mar 2010 01:29:33 +0100, Martin Logan wrote: > You probably want to go with a foreach instead of a comprehension. > There is no need to collect and then discard the results of each use > of ! :) Yes... there was a discussion about this some time ago on the list. I can't be bothered to dig it up, but remember partly because I argued for LCs to not build the result unless it was needed. In a very recent post, Bernard Duggan pointed to a section in the Efficiency Guide: http://www.erlang.org/doc/efficiency_guide/listHandling.html#id2261027 "In R12B [and presumably later], if the result of the list comprehension will *obviously* not be used, a list will not be constructed." ...so there is hope still, for those who prefer the LC style over foreach. :) BR, Ulf W -- Ulf Wiger CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd http://www.erlang-solutions.com --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From corticalcomputer@REDACTED Thu Mar 18 09:02:37 2010 From: corticalcomputer@REDACTED (G.S.) Date: Thu, 18 Mar 2010 01:02:37 -0700 Subject: A good way to do 3d graphics, or display moving objects in 3d space using Erlang (exp. Wings3d). Message-ID: <2a67d3ff1003180102u3560e849qb85fa45af2612970@mail.gmail.com> Hello, I know that there is such a thing as Wings3d built in pure Erlang, where you can do 3d design. But anyone know of anything in erlang where you have actual moving objects in 3d space? All written in Erlang? Where you can for example interface with the program to control the objects all through Erlang, if that makes any sense. Can it be done, a simple version of it, using the gs library? what are some other good graphics libraries in Erlang? Regards, -Gene From johanmon@REDACTED Thu Mar 18 09:30:30 2010 From: johanmon@REDACTED (Johan Montelius) Date: Thu, 18 Mar 2010 09:30:30 +0100 Subject: [erlang-questions] How to send a message to all nodes without UDP broadcast? In-Reply-To: <922d05851003171510j6ce90869qcc7613de41458a7a@mail.gmail.com> References: <4d08db371003171048i38b7eb6cl8c8f19be0645a6d0@mail.gmail.com> <922d05851003171510j6ce90869qcc7613de41458a7a@mail.gmail.com> Message-ID: A word of warning and: rpc:abcast/1 is not atomic multicast as abcast normally refers to. It implements a basic multicast. If the sender dies you might have a situation where only some of the processes have received the message. This also goes for the list comprehension solution and also for how the pg module is implemented. The pg modules does however give you a total order of message delivery something that rpc:abcast does not. Johan On Wed, 17 Mar 2010 23:10:07 +0100, H?kan Mattsson wrote: > Yet another alternative: > > rpc:abcast(foo, Msg). > > /H?kan > > 2010/3/17 Ulf Wiger : >> >> If you want to include the node you're on: >> >> [{foo,X} ! Msg || X <- [node()|nodes()]]. >> >> BR, >> Ulf W >> >> On Wed, 17 Mar 2010 18:48:33 +0100, Hynek Vychodil >> wrote: >> >>> [{foo,X} ! Msg || X<- nodes()]. >>> >>> On Tue, Mar 9, 2010 at 12:31 AM, ??? wrote: >>>> >>>> Hi, this may be a simple question, but I am newer and did not find the >>>> answer in book. I want to send a message to all nodes(using same >>>> cookie) >>>> in >>>> one call, but not using the UDP broadcast. How can I do this ? Can >>>> someone >>>> take one minute to answer me ? thanks! > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > -- Dr Johan Montelius Royal Institute of Technology - KTH School of Information and Communication Technology - ICT From vladdu55@REDACTED Thu Mar 18 10:14:28 2010 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Thu, 18 Mar 2010 10:14:28 +0100 Subject: simplified attribute declaration Message-ID: <95be1d3b1003180214o37cbdab8lb2633fde53c97fd1@mail.gmail.com> Hi, I don't remember anyone mentioning this before, but I think it's cool and should be promoted as the recommended syntax: All attributes can now (R13) be specified without parantheses! -module hello_world. -export [init/1, stop/2]. -define DEBUG(X), io:format("debug: ~p~n", [X]). best regards, Vlad From bengt.kleberg@REDACTED Thu Mar 18 10:33:25 2010 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 18 Mar 2010 10:33:25 +0100 Subject: [erlang-questions] simplified attribute declaration In-Reply-To: <95be1d3b1003180214o37cbdab8lb2633fde53c97fd1@mail.gmail.com> References: <95be1d3b1003180214o37cbdab8lb2633fde53c97fd1@mail.gmail.com> Message-ID: <1268904805.4799.8.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Greetings, Are you sure about -define without parentheses? On my system (R13B03) I get: ./bfile.erl:3: badly formed 'define' Perhaps I need a flag to the compilation? bengt On Thu, 2010-03-18 at 10:14 +0100, Vlad Dumitrescu wrote: > Hi, > > I don't remember anyone mentioning this before, but I think it's cool > and should be promoted as the recommended syntax: > > All attributes can now (R13) be specified without parantheses! > > -module hello_world. > -export [init/1, stop/2]. > -define DEBUG(X), io:format("debug: ~p~n", [X]). > > best regards, > Vlad > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > From karlsson.rm@REDACTED Thu Mar 18 10:56:07 2010 From: karlsson.rm@REDACTED (Mikael Karlsson) Date: Thu, 18 Mar 2010 10:56:07 +0100 Subject: [erlang-questions] Using -spec for callbacks when defining behaviours In-Reply-To: <4BA0F842.6050706@cs.ntua.gr> References: <872e77ab1003170401u54f391cdi181d67eca20012af@mail.gmail.com> <4BA0F842.6050706@cs.ntua.gr> Message-ID: <872e77ab1003180256q24b40592i36204b6402d1b54a@mail.gmail.com> 2010/3/17 Kostis Sagonas > Mikael Karlsson wrote: > >> Hi, >> >> I understand that -spec (and -type) constructs may be used in include >> (.hrl) files and the module itself when specifying functions. >> >> Has there been any discussion on beeing able to use them in behaviour >> defining modules to specify the "callback" modules in more detail? >> >> When defining a behaviour today you "just" specify the function names and >> their arity with the behaviour_info/1 function. >> >> I think it would be good to be able to also specify the types of the >> arguments and their return type for the module implementing the behaviour. >> This would make a behaviour defining module closer to a interface >> specification and also decrease the dependencies of include files. >> > > Absolutely! > > In fact, we have had similar thoughts to yours and have been working for > about half a year now on extending Erlang to do exactly what you are hinting > at in your mail. The good news is that it's all done and finished (dialyzer > already supports this) and for about a month now we've even written an EEP > for it, but I've been so swamped that I've not found time to properly send > it to those responsible for EEPs. > > I am including it below -- comments welcome, > > Kostis > > PS. Can I also please ask the folks of the Erlang/OTP team to put this in > the EEP homepage? > > > ============================================================================ > > EEP: XXX > Title: Behaviour Specifications > Version: $Revision: 1 $ > Last-Modified: $Date: Mon Mar 8 12:14:35 EET 2010$ > Author: Stavros Aronis [aronisstav(at)gmail(dot)com], Kostis Sagonas > [kostis(at)cs(dot)ntua(dot)gr > Status: Draft > Type: Standards Track > Content-Type: text/x-rst > Created: 03-Feb-2010 > Erlang-Version: > Post-History: > > > Abstract > ======= > > We describe a small, backwards compatible change for behaviours to specify > the types which are expected of their callbacks. > > > Rationale > ======= > > In Erlang a behaviour is usually a complete design pattern implemented in a > module. Users can use these design patterns easily, writing in some other > module just the callback functions required to provide the behaviour's > functionality. As all these callbacks are called somewhere within the > behaviour's code, it is important to check that behaviour callbacks have the > functionality which is expected from them. Currently, not only is this the > responsibility of the programmer but this checking is not even > semi-automatic as there is no formal way for the module defining the > behaviour to specify what is expected from its callback module. Instead, the > programmer must check manually if the callback functions accept the correct > arguments and return the correct results, and are indeed in accordance with > the behaviour's available documentation, which often only exists in paper > form. What this EEP aims at is to propose infrastructure which will ease the > automatization of checking that callback modules adhere to what's expected > from them. > > Given the wide usage of behaviours in current Erlang application > development, we believe that providing a means to include such specification > in a behaviour's implementation is useful for both the behaviour's > implementor, who can make clear what the types of the callbacks should be > and the behaviour's user who can employ tools that check automatically for > errors in the callback module's implementation. > > > Specification > ========== > > Currently, all behaviours must define a behaviour_info/1 function. Among > other pieces of information, a clause of this function enumerates (in the > form of 2-tuples) the function names and arities of the required callbacks. > > The following example is taken from the 'gen_server' behaviour: > > behaviour_info(callbacks) -> > [{init,1}, {handle_call,3}, {handle_cast,2}, {terminate, 2}, {code_change, > 3}]. > > Often, though not always, the behaviour module also contains some > additional information in the form of comments. Continuing the same example, > the gen_server module includes the following comments: > > %%% The user module should export: > %%% > %%% init(Args) > %%% ==> {ok, State} > %%% {ok, State, Timeout} > %%% ignore > %%% {stop, Reason} > %%% > %%% handle_call(Msg, {From, Tag}, State) > %%% > %%% ==> {reply, Reply, State} > %%% {reply, Reply, State, Timeout} > %%% {noreply, State} > %%% {noreply, State, Timeout} > %%% {stop, Reason, Reply, State} > %%% Reason = normal | shutdown | Term terminate(State) is called > %%% > %%% .... MORE COMMENTS FOR THE OTHER THREE CALLBACKS HERE ..... > > The problem with comments is that they are in free text form, often lacking > some information as in the case above, and cannot be mechanically processed. > > We propose a modification in the behaviour_info(callbacks) clause so that > it also specifies the types which are expected from these callbacks. > > The modification itself is very simple, adding a third element in the tuple > list. > > The third element is a string whose contents is a -spec in the already > existing language of EEP8: > > behaviour_info(callbacks) -> > [{init, 1, > "-spec init(Args) -> > {'ok', State} | > {'ok', State, timeout() | 'hibernate'} | > {'stop', Reason} | > 'ignore'."},"}, > {handle_call, 3, > "-spec handle_call(Request, From :: {pid(), Tag}, State) -> > {'reply', Reply, NewState} | > {'reply', Reply, NewState, timeout() | 'hibernate'} | > {'noreply', NewState} | > {'noreply', NewState, timeout() | 'hibernate'} | > {'stop', Reason, Reply, NewState} | > {'stop', Reason, NewState}."}, > {handle_cast, 2, "-spec ... SOME SPEC HERE ..."}, > ....]. > > A defect detection tool (e.g. dialyzer) can then use these specs as a > reference to compare the inferred types of the callbacks. > > Incidentally, the above example shows various interesting things: > > 1) Using the language of types and specs, one can provide information both > for documentation purposes and for types as e.g. in From :: {pid(), Tag} > > 2) It's not necessary to specify every type as e.g. the Tag variable above, > which is a convenient shorthand for Tag :: term() > > 3) Comments are often incomplete or can easily become obsolete as e.g. the > 'hibernate' value is nowhere mentioned. > > A final note: One may wonder why the specs are written as strings instead > of as -specs. There are various reasons for this, though none of them is > deep or cast in stone. First of all specs are not proper Erlang terms (they > are file attributes), so they cannot be used as is in places where Erlang > terms are expected. Since we wanted to reuse as much of the existing > infrastructure of behaviours as possible, the natural place to put them was > to extend the behaviour_info(callbacks) clause. Second, they specify a type > obligation (i.e., a contract) for all the callback modules, not for some > specific known module or the behaviour module that contains them (the > behaviour module does not contain definitions for these functions). Because > of this, they cannot be placed in the behaviour defining module since > currently there is no way for the language of specs to express something of > the form: for all callback modules M, -spec M:init(Args) -> .... > If we use a file attribute other than -spec (e.g. -callback_spec) these > specs could be part of the module defining the behaviour instead of being > part of the behaviour_info(callbacks) clause. > > > Implementation > ============== > > We have already implemented the above proposal and we can provide a fully > working implementation. > > Trivial changes were needed in the compiler to accept the new > behaviour_info format when checking for the presence of all the required > callbacks in a module that uses the behaviour, as well as minor changes in > some other library modules. Using this extension of dialyzer in a > significant corpus of Erlang code we have already detected many violations > of the published behaviour documentation. > > > Backwards Compatibility > ======================= > > The extension is fully backwards compatible. The old format is still > supported (the clause of the behaviour_info function can contain both pairs > and triples). > > The inclusion of the -spec string is optional and no warnings are emitted > unless Dialyzer is asked explicitly to check the behaviour usage via a > corresponding option. > > > Copyright > ========= > > This document has been placed in the public domain. > > .. > > Local Variables: > mode: indented-text > indent-tabs-mode: nil > sentence-end-double-space: t > fill-column: 70 > coding: utf-8 > Great news! As I can see from the following discussion there can be several things to say about the how to implement this, nevertheless it is already in the works which is really nice. I have one question: It is not clear to me how to declare -type in the behaviour_info function. If I have a recurring pattern in several of the -specs it is of course nice to be able to do this. You mention "contract" as a "type obligation" in the final note. I read in a little more in a contract, that is that you also have runtime checks in a contract (like UBF contract checks or Eiffel contracts). Anyway I think that it will be quite straightforward to include (runtime) contract checking as well in behaviours, at least if we will be allowed to officially play with parameterized (abstract) modules in the future, meaning that we will have "everything" in place : -module(behave). -export([behaviour_info/1, contract_check/1]). behaviour_info(callbacks) -> [{set,2},{get,1}]. %% Should of course use new "-specs.." contract_check(M) -> behave_contract:new(M). ------ -module(behave_contract,[M]). -behaviour(behave). -export([set/2, get/1]). get(A) -> M:get(A). set(Key, Value) -> M1 = M:set(Key, Value), Value = M1:get(Key), %% Contract check new(M1). ---- Im my implementation module: -ifdef(debug). M = behave:contract_check(my_behave_impl:new(Args)), -else. M = my_behave_impl:new(Args), -endif. ---- /Mikael From vladdu55@REDACTED Thu Mar 18 10:59:05 2010 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Thu, 18 Mar 2010 10:59:05 +0100 Subject: [erlang-questions] simplified attribute declaration In-Reply-To: <1268904805.4799.8.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> References: <95be1d3b1003180214o37cbdab8lb2633fde53c97fd1@mail.gmail.com> <1268904805.4799.8.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Message-ID: <95be1d3b1003180259o6f4168a3o89d5cd27d1bf425e@mail.gmail.com> On Thu, Mar 18, 2010 at 10:33, Bengt Kleberg wrote: > Are you sure about -define without parentheses? Yes, of course, I was too hasty -- the define is handled by the preprocessor first and it doesn't recognize it without parantheses... The problem there is that the definition needs not be an Erlang term, so in that case the parantheses are necessary (or one can't have a dot inside it). For well-behaved macros it shouldn't be too difficult to make epp work without parantheses, if it's something people want. In any case, since the current parser has this new functionality, it would be useful to have it documented and either recommended or not recommended to use except for -spec. regards, Vlad From hakan@REDACTED Thu Mar 18 11:11:16 2010 From: hakan@REDACTED (=?ISO-8859-1?Q?H=E5kan_Mattsson?=) Date: Thu, 18 Mar 2010 11:11:16 +0100 Subject: [erlang-questions] How to send a message to all nodes without UDP broadcast? In-Reply-To: References: <4d08db371003171048i38b7eb6cl8c8f19be0645a6d0@mail.gmail.com> <922d05851003171510j6ce90869qcc7613de41458a7a@mail.gmail.com> Message-ID: <922d05851003180311y27cbc962k3291f3b29d771adc@mail.gmail.com> On Thu, Mar 18, 2010 at 9:30 AM, Johan Montelius wrote: > > A word of warning and: rpc:abcast/1 is not atomic multicast as abcast > normally refers to. It implements a basic multicast. If the sender dies you > might have a situation where only some of the processes have received > the message. This is the normal case in Erlang. There are power outages, sending nodes may crash, network connections may be closed, sending processes may be brutally killed by their supervisors at shutdown etc. You do always need to be prepared to recover from such cases. An truly ATOMIC multicast is a far more advanced service than the rpc module provides. > This also goes for the list comprehension solution and also for how the pg > module is implemented. The pg modules does however give you a total > order of message delivery something that rpc:abcast does not. rpc:sbcast/2 is a little bit better than rpc:abcast/2 in this regard. /H?kan From roberto.aloi@REDACTED Thu Mar 18 12:09:35 2010 From: roberto.aloi@REDACTED (Roberto Aloi) Date: Thu, 18 Mar 2010 11:09:35 +0000 Subject: [erlang-questions] A good way to do 3d graphics, or display moving objects in 3d space using Erlang (exp. Wings3d). In-Reply-To: <2a67d3ff1003180102u3560e849qb85fa45af2612970@mail.gmail.com> References: <2a67d3ff1003180102u3560e849qb85fa45af2612970@mail.gmail.com> Message-ID: <4BA209EF.20605@erlang-solutions.com> On 03/18/2010 08:02 AM, G.S. wrote: > Hello, > > I know that there is such a thing as Wings3d built in pure Erlang, where you > can do 3d design. But anyone know of anything in erlang where you have > actual moving objects in 3d space? All written in Erlang? Where you can for > example interface with the program to control the objects all through > Erlang, if that makes any sense. > Can it be done, a simple version of it, using the gs library? what are some > other good graphics libraries in Erlang? You might want to have a look to Rosen (RObotic Simulation Erlang eNgine): http://sourceforge.net/projects/rosen/ Reading from the doc: "is a software library, written in Erlang, which simulates 3D environments and in particular autonomous mobile robots, each with its behaviour and interaction capabilities." It's probably not exactly what you need, but some of the libraries might deserve a look... Regards, Roberto Aloi -- University of Kent - Erlang Solutions Ltd. Twitter: @prof3ta Blog: http://aloiroberto.wordpress.com --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From karlsson.rm@REDACTED Thu Mar 18 12:33:13 2010 From: karlsson.rm@REDACTED (Mikael Karlsson) Date: Thu, 18 Mar 2010 04:33:13 -0700 (PDT) Subject: Using -spec for callbacks when defining behaviours In-Reply-To: References: <872e77ab1003170401u54f391cdi181d67eca20012af@mail.gmail.com> Message-ID: <3d94c7e4-2c1a-4826-9c45-7ca453cbee15@e1g2000yqh.googlegroups.com> On 18 mar, 05:49, Steve Davis wrote: > Hmm. > > I find myself, having read this discussion, left rather cold and > wondering: what problem does this idea resolve? I haven't really hit > any practical issues with using behaviours, or with dependencies on > include files. Both seem to work pretty well as they stand. Yes, well as Kostis pointed out they already found violations of the -specs in the Erlang code, so the problem addressed is quality of code I guess. You could of course say that since no one seem to have any bad experience (yet) of the violations they do not have any practical impact anyway. Include files are OK, but sometimes I feel that they are problematic, setting include paths right to external libraries etc. I guess if you look at the problem of that the include files often holds records and that you may wan't to move away from using records and use "opaque" types instead (can give cold wonderings as well :) then I think that behaviour modules is a good place to start. Since specs then go into compiled code, it is "only" needed that the compiler holds the compiled behaviour code in the load path. > As a coder, I'm concerned that this suggestion (and other forms of... > type-envy?) may not actually get in the way of what we are trying to > get done rather than assist it? I do not think any of the proposed things will be mandatory, but optional, you can choose to use them at your own will. > fwiw, a year ago I would probably have been an active advocate of more > language support for type constraints, but the longer I spend building > things using erlang, the more I have come to see things in an entirely > different light. I confess I have very ambigous feelings about this, and partly agree, ..but if opaque types (or abstract data types/patterns) become more frequent in Erlang I guess there will be more need for type specifications. > Just my 2c here of course. > /s I will not bet with you on this. /Mikael From vladdu55@REDACTED Thu Mar 18 12:34:08 2010 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Thu, 18 Mar 2010 12:34:08 +0100 Subject: [proposal] Declarative syntax for metadata (long!) Message-ID: <95be1d3b1003180434l7e76c610if40faed29efa647c@mail.gmail.com> Hi all, I feel I should follow up on my rant from last night (I hope the tone wasn't too harsh!). I have been thinking about these things for a long while, but I'm sure I still miss some points. Erlang source code contains besides actual code even meta-data and configuration data, disguised as Erlang terms, comments or strings. Some of this data has been integrated into the language (type specifications, for example), but not all of it. I would like to present arguments for and against integrating all such data. First a non-exhaustive list of data that IMHO would benefit from becoming a first-class citizen of the language: - behaviour callback specifications - supervisor child specifications - match specifications - edoc Today, there are three ways to encode this data: as Erlang terms, as strings and as comments. (I know strings are terms, but they are different) Comments are used to store structured documentation info (edoc) and are the weakest case for "uplift" to citizenship. The argument for it is that there is a mini-language involved anyway, so almost everything is already in place. I think that there is a very simple way to go all the way: introduce block comments. The main problem for me is those pesky "%%" when reformatting the documentation. It would be nice if there were special edoc comments, so that it's easy for a tool to tell them apart from regular comments. Erlang terms are a very flexible representation that works fine at the lowest level, but I argue that programmers shouldn't be forced to think at that level. Using Erlang terms is in fact forcing the programmer to do the work of a parser and convert a high-level declaration into a bunch of terms with complex structure (thus easy to get wrong). If integrated in the language, the parser and compiler would be able to detect errors and inconsistencies that otherwise would result in run-time bugs. Strings are a special case because they can contain the high-level declarations I mentioned above and thus are easier to reason about, but they are still not properly parsed and any error will reveal itself at run-time. Some of the data encoded as terms is already partially integrated: some match specifications can be written using the fun_ms parse transform. What I argue for here is going all the way and provide this kind of support for all of them and for the other data mentioned here, hopefully without having to clutter all files with parse_transform declarations. A closely related issue is that some of this data is declarative but returned by magic functions. I can't see any use case (except for match specifications) where these specifications need to be generated dynamically, so the data could just as well be provided by an attribute. The compiler can generate the magic functions if needed, or (better IMHO) we could provide a better API to module attributes. If using attributes, the advantage is that we can use specific mini-languages that fit better the domain, because we're not limited to Erlang expressions. By emphasizing declarative features in the language we can start considering other things that can be handled in a similar way, thereby moving on a higher abstraction level. Like Mikael mentioned too, contract declarations (UBF or other kinds) come to mind easily. We can extend supervisor child specs to a description of all processes in an application or even the whole system. Of course, this can already be done today. The problem is that without a dedicated language, the declarations end up very difficult to read, to reason about and to debug. In some cases they can even be more verbose than the Erlang code that would achieve the same result. Working on a higher level gives better understanding Now, going even further into the future: if this will turn out to work as well as I hope it will, making everybody twice as productive and twice as happy, it might happen that more and more applications and tools will see benefits from going the same way, but for non-OTP applications it won't be possible to integrate "their" declaration mini-language. I see two ways to handle this, both being definitely not something one could throw together over a weekend: - allow application-defined parsers to be called on parts of the source code. This could provide even cooler functionality, but I'm not going to dig into that right now :) - define a single declaration language that can be extended with user code and with extensible syntax. By that I mean something in the spirit of Ruby, where it is extremely easy to write domain-specific languages that are at the same correct Ruby programs. == Conclusion == The part in the beginning is something that I think is useful, relatively easy to specify and implement and without too many compatibility issues. Is there anybody sharing this opinion? Is it EEP material? Is even the exploratory_mode part worth detailing right now? (so that when 5 or 10 years from now someone wants to implement it, he/she doesn't discover it requires rewriting everything). Another way to put the question is: what parts (if any) should become part of the Erlang language, and what parts (if any) fit better in an Erlang-based language? I feel that it is important to sometimes raise one's eyes and try to get a glimpse of what the future holds and even to try to shape it. best regards, Vlad From martindemello@REDACTED Thu Mar 18 12:34:37 2010 From: martindemello@REDACTED (Martin DeMello) Date: Thu, 18 Mar 2010 17:04:37 +0530 Subject: implementing a notification list Message-ID: I'm new to Erlang, and having a bit of trouble coming up with the right way to do this: I have a set of mnesia triggers that watch for various db events. I now want to have a persistent notification list that supports the following two operations efficiently: 1. insert a new event, with timestamp 2. retrieve all events between two given timestamps and possibly less efficiently 3. compact the table (combine several updates to a single object into a single row) This post http://groups.google.com/group/erlang-programming/browse_thread/thread/522f4dfce53ca4e7 seems to imply that simply storing the notifications as an mnesia table is a bad idea. martin From erlang@REDACTED Thu Mar 18 14:06:48 2010 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 18 Mar 2010 14:06:48 +0100 Subject: [erlang-questions] [proposal] Declarative syntax for metadata (long!) In-Reply-To: <95be1d3b1003180434l7e76c610if40faed29efa647c@mail.gmail.com> References: <95be1d3b1003180434l7e76c610if40faed29efa647c@mail.gmail.com> Message-ID: <9b08084c1003180606g68f1c060r10635f571b6c642c@mail.gmail.com> I agree, this is one of the things that is missing from Erlang I think the problem is one of introspection. Basically every "thing" has three representations (1) The external print representation of the thing (ie the thing you type into a module, or in the shell) (2) The parse tree representing (1) (3) The internal compiled form of the thing It should be possible to convert at run-time between any of these three representations. We should be able to introspect a module at run-time and recover a list of funs, we should be able to take a fun and recover its syntax tree or an ascii representation of the fun. The same should be true for types, specs, edoc strings an so on. All things should be invertible. The simple things like atoms,floats etc can be converted to and from lists. But funs and modules cannot. We need modules, funs, attributes, types, specs edoc strings etc. all to be introspective and to be able to convert them to and from lists at run time. We should be able to say mod2list(lists) and get back a list of forms (say) [{name,lists}, {export,member,2}, ... {function,member,2,F1}, ... ] Then we should be able to rip apart the funs fun2list(F1) which might return "fun(H, [H|_]) -> true;..." or fun2abs(F1) which might return {function, member, 2, [{clause,...}]} ... We would need to sort out the external printed representation of a reference to a fun and so on ... On Thu, Mar 18, 2010 at 12:34 PM, Vlad Dumitrescu wrote: > Hi all, > > I feel I should follow up on my rant from last night (I hope the tone > wasn't too harsh!). I have been thinking about these things for a long > while, but I'm sure I still miss some points. > > > Erlang source code contains besides actual code even meta-data and > configuration data, disguised as Erlang terms, comments or strings. > Some of this data has been integrated into the language (type > specifications, for example), but not all of it. I would like to > present arguments for and against integrating all such data. > > First a non-exhaustive list of data that IMHO would benefit from > becoming a first-class citizen of the language: > - behaviour callback specifications > - supervisor child specifications > - match specifications > - edoc > > Today, there are three ways to encode this data: as Erlang terms, as > strings and as comments. (I know strings are terms, but they are > different) > > Comments are used to store structured documentation info (edoc) and > are the weakest case for "uplift" to citizenship. The argument for it > is that there is a mini-language involved anyway, so almost everything > is already in place. I think that there is a very simple way to go all > the way: introduce block comments. The main problem for me is those > pesky "%%" when reformatting the documentation. It would be nice if > there were special edoc comments, so that it's easy for a tool to tell > them apart from regular comments. > > Erlang terms are a very flexible representation that works fine at the > lowest level, but I argue that programmers shouldn't be forced to > think at that level. Using Erlang terms is in fact forcing the > programmer to do the work of a parser and convert a high-level > declaration into a bunch of terms with complex structure (thus easy to > get wrong). If integrated in the language, the parser and compiler > would be able to detect errors and inconsistencies that otherwise > would result in run-time bugs. > > Strings are a special case because they can contain the high-level > declarations I mentioned above and thus are easier to reason about, > but they are still not properly parsed and any error will reveal > itself at run-time. > > Some of the data encoded as terms is already partially integrated: > some match specifications can be written using the fun_ms parse > transform. What I argue for here is going all the way and provide this > kind of support for all of them and for the other data mentioned here, > hopefully without having to clutter all files with parse_transform > declarations. > > A closely related issue is that some of this data is declarative but > returned by magic functions. I can't see any use case (except for > match specifications) where these specifications need to be generated > dynamically, so the data could just as well be provided by an > attribute. The compiler can generate the magic functions if needed, or > (better IMHO) we could provide a better API to module attributes. If > using attributes, the advantage is that we can use specific > mini-languages that fit better the domain, because we're not limited > to Erlang expressions. > > > By emphasizing declarative features in the language we can start > considering other things that can be handled in a similar way, thereby > moving on a higher abstraction level. Like Mikael mentioned too, > contract declarations (UBF or other kinds) come to mind easily. We can > extend supervisor child specs to a description of all processes in an > application or even the whole system. > > Of course, this can already be done today. The problem is that without > a dedicated language, the declarations end up very difficult to read, > to reason about and to debug. In some cases they can even be more > verbose than the Erlang code that would achieve the same result. > Working on a higher level gives better understanding > > Now, going even further into the future: if this will turn out to work > as well as I hope it will, making everybody twice as productive and > twice as happy, it might happen that more and more applications and > tools will see benefits from going the same way, but for non-OTP > applications it won't be possible to integrate "their" declaration > mini-language. I see two ways to handle this, both being definitely > not something one could throw together over a weekend: > ?- allow application-defined parsers to be called on parts of the > source code. This could provide even cooler functionality, but I'm not > going to dig into that right now :) > ?- define a single declaration language that can be extended with > user code and with extensible syntax. By that I mean something in the > spirit of Ruby, where it is extremely easy to write domain-specific > languages that are at the same correct Ruby programs. > > > == Conclusion == > > The part in the beginning is something that I think is useful, > relatively easy to specify and implement and without too many > compatibility issues. Is there anybody sharing this opinion? Is it EEP > material? Is even the exploratory_mode part worth detailing right now? > (so that when 5 or 10 years from now someone wants to implement it, > he/she doesn't discover it requires rewriting everything). > > Another way to put the question is: what parts (if any) should become > part of the Erlang language, and what parts (if any) fit better in an > Erlang-based language? > > I feel that it is important to sometimes raise one's eyes and try to > get a glimpse of what the future holds and even to try to shape it. > > best regards, > Vlad > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From vladdu55@REDACTED Thu Mar 18 14:22:55 2010 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Thu, 18 Mar 2010 14:22:55 +0100 Subject: [erlang-questions] [proposal] Declarative syntax for metadata (long!) In-Reply-To: <9b08084c1003180606g68f1c060r10635f571b6c642c@mail.gmail.com> References: <95be1d3b1003180434l7e76c610if40faed29efa647c@mail.gmail.com> <9b08084c1003180606g68f1c060r10635f571b6c642c@mail.gmail.com> Message-ID: <95be1d3b1003180622h3a3a5acdrc2e0109b7918b736@mail.gmail.com> On Thu, Mar 18, 2010 at 14:06, Joe Armstrong wrote: > We should be able to introspect a module at run-time and recover a > list of funs, we should be able to take a fun and recover its syntax > tree or an ascii representation of the fun. The same should be true > for types, specs, edoc strings an so on. Yep, that too! I think even applications could exist as 'things': get a list of applications, query an application for its modules. There is no such thing in Erlang as a module, just a name in the documentation and the attribute with the said name. Otherwise one does handle and refer to beam files. There should be an API to handle modules that hides the underlying beam_lib, as an example. regards, Vlad From waterding@REDACTED Thu Mar 18 14:48:42 2010 From: waterding@REDACTED (Aeolus) Date: Thu, 18 Mar 2010 14:48:42 +0100 Subject: common test perform coverage analysis on large lib Message-ID: hi, we used common test to perform coverage analysis on our system, the problem is it hangs when giving the "Coverage analysing...? msg, we suspect this could be due to common test and our system is competing for file writing access. so our question is it possible to run coverage with ct_master module so it will run test on slave node but do coverage updating at master node. we tried to feed master node with test spec and it seems it skipped execution of {cover, "cover.file"} opt. We use R12 of erlang. thx in advance. //Chengwei From steven.charles.davis@REDACTED Thu Mar 18 16:37:52 2010 From: steven.charles.davis@REDACTED (Steve Davis) Date: Thu, 18 Mar 2010 08:37:52 -0700 (PDT) Subject: implementing a notification list In-Reply-To: References: Message-ID: <3c1ca06c-9432-415e-9115-12bfce6d1bca@t23g2000yqt.googlegroups.com> HI Martin, A couple of approaches to consider for a starting point: 1) If appropriate you could use the timestamp as the key on your db_event record, i.e. -record(db_event, {timestamp, data, ...}) 2) If using the timestamp as the key isn't appropriate, you can index the timestamp field, http://erlang.org/doc/apps/mnesia/Mnesia_chap5.html#id2273564 hth, /s On Mar 18, 6:34?am, Martin DeMello wrote: > I'm new to Erlang, and having a bit of trouble coming up with the > right way to do this: > > I have a set of mnesia triggers that watch for various db events. I > now want to have a persistent notification list that supports the > following two operations efficiently: > > 1. insert a new event, with timestamp > 2. retrieve all events between two given timestamps > > and possibly less efficiently > > 3. compact the table (combine several updates to a single object into > a single row) > > This posthttp://groups.google.com/group/erlang-programming/browse_thread/threa... > seems to imply that simply storing the notifications as an mnesia > table is a bad idea. > > martin > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > Seehttp://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED From hynek@REDACTED Thu Mar 18 17:37:35 2010 From: hynek@REDACTED (Hynek Vychodil) Date: Thu, 18 Mar 2010 17:37:35 +0100 Subject: [erlang-questions] re: re:pain (and stripping whitespace from text) In-Reply-To: <3dbc6d1c1003132235uf966501p74e8fc5d3f51180f@mail.gmail.com> References: <65c3bfa7-ca63-4707-9472-2a53712095e0@i25g2000yqm.googlegroups.com> <5490C43B-26FB-4B02-8546-788870F7489D@souja.net> <3dbc6d1c1003132235uf966501p74e8fc5d3f51180f@mail.gmail.com> Message-ID: <4d08db371003180937i5398bf3fpb97dfb6f981fe0a4@mail.gmail.com> On Sun, Mar 14, 2010 at 7:35 AM, Robert Virding wrote: > On 14 March 2010 03:45, Jayson Vantuyl wrote: >> Also, note that backtracking and recursion can create very undesirable behavior in terms of stack usage and execution time. ?This is so problematic that Google has written a special regex library that uses research in automata theory to make it behave better. ?See here: >> >> RE2: ?http://code.google.com/p/re2/ > > I did a regexp version in Erlang based on these principles and it is > actually time linear in the size of the input. It is fun to see it zip > through what would be for Perl/PCRE a super backtracking pathological > case in a flash. One day when I get the time to cleanup the code I > will release it. I thought about similar in context of http://shootout.alioth.debian.org/u32q/performance.php?test=regexdna but with limited functionality and as specialized parse transformation. But I didn't because I was too busy. > > Robert > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try GoodData now for free: www.gooddata.com From lovei.laszlo@REDACTED Thu Mar 18 20:33:20 2010 From: lovei.laszlo@REDACTED (Laszlo Lovei) Date: Thu, 18 Mar 2010 12:33:20 -0700 (PDT) Subject: simplified attribute declaration In-Reply-To: <95be1d3b1003180259o6f4168a3o89d5cd27d1bf425e@mail.gmail.com> References: <95be1d3b1003180214o37cbdab8lb2633fde53c97fd1@mail.gmail.com> <1268904805.4799.8.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> <95be1d3b1003180259o6f4168a3o89d5cd27d1bf425e@mail.gmail.com> Message-ID: On Mar 18, 10:59?am, Vlad Dumitrescu wrote: > On Thu, Mar 18, 2010 at 10:33, Bengt Kleberg wrote: > > Are you sure about -define without parentheses? > > The problem there is that the definition needs not be an Erlang term, > so in that case the parantheses are necessary (or one can't have a dot > inside it). No, the open parenthesis after -define is not used for any purpose (apart from checking its presence), it would be trivial to make it optional. The preprocessor only checks that parentheses are balanced inside the macro body, and the closing ')' of -define can even be left out (probably because of historic reasons). About dots: you can have simple '.' tokens (without subsequent whitespace) regardless of parentheses, and you cannot have a stop token (a dot followed by whitespace or end of file) in a macro whatever you do, because it delimits forms and is handled before preprocessing. > In any case, since the current parser has this new functionality, it > would be useful to have it documented and either recommended or not > recommended to use except for -spec. I completely agree. As this feature is not mentioned in the docs, I have the impression that it is an incidental side effect of the syntactic support for -type and -spec, and it would be nice to have this clarified. Laszlo From ishwar@REDACTED Thu Mar 18 23:09:24 2010 From: ishwar@REDACTED (Ish Rattan) Date: Thu, 18 Mar 2010 18:09:24 -0400 (EDT) Subject: code replacement example code? Message-ID: Where can I find an example of code replacemnet in a running program? -ishwar From steven.charles.davis@REDACTED Fri Mar 19 00:21:48 2010 From: steven.charles.davis@REDACTED (Steve Davis) Date: Thu, 18 Mar 2010 16:21:48 -0700 (PDT) Subject: code replacement example code? In-Reply-To: References: Message-ID: <6c9be861-beda-4b48-9073-e9c63c2affac@b30g2000yqd.googlegroups.com> http://github.com/ngerakines/mochiweb/blob/master/src/reloader.erl On Mar 18, 5:09?pm, Ish Rattan wrote: > Where can I find an example of code replacemnet > in a running program? > > -ishwar > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > Seehttp://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED From steven.charles.davis@REDACTED Fri Mar 19 00:46:09 2010 From: steven.charles.davis@REDACTED (Steve Davis) Date: Thu, 18 Mar 2010 16:46:09 -0700 (PDT) Subject: Using -spec for callbacks when defining behaviours In-Reply-To: <3d94c7e4-2c1a-4826-9c45-7ca453cbee15@e1g2000yqh.googlegroups.com> References: <872e77ab1003170401u54f391cdi181d67eca20012af@mail.gmail.com> <3d94c7e4-2c1a-4826-9c45-7ca453cbee15@e1g2000yqh.googlegroups.com> Message-ID: Hi Mikael, On Mar 18, 6:33?am, Mikael Karlsson wrote: > I do not think any of the proposed things will be mandatory, but > optional, > you can choose to use them at your own will. For sure, and it's an interesting and useful discussion to have. > > fwiw, a year ago I would probably have been an active advocate of more > > language support for type constraints, but the longer I spend building > I confess I have very ambigous feelings about this, and partly agree, > ..but > if opaque types (or abstract data types/patterns) become more frequent > in > Erlang I guess there will be more need for type specifications. I'd temper this with the known effective approaches: 1) "let it crash" 2) apply checks only at the application/system boundary ..to which I'll add... 3) beware any form of cruft. regs, /s From karlsson.rm@REDACTED Fri Mar 19 09:59:49 2010 From: karlsson.rm@REDACTED (Mikael Karlsson) Date: Fri, 19 Mar 2010 01:59:49 -0700 (PDT) Subject: Using -spec for callbacks when defining behaviours In-Reply-To: References: <872e77ab1003170401u54f391cdi181d67eca20012af@mail.gmail.com> <3d94c7e4-2c1a-4826-9c45-7ca453cbee15@e1g2000yqh.googlegroups.com> Message-ID: <187b9671-8a9a-43c4-8554-a308220a9676@l25g2000yqd.googlegroups.com> Hi Steve, On 19 mar, 00:46, Steve Davis wrote: > Hi Mikael, > > On Mar 18, 6:33?am, Mikael Karlsson wrote: > > > I do not think any of the proposed things will be mandatory, but > > optional, > > you can choose to use them at your own will. > > For sure, and it's an interesting and useful discussion to have. Agree. > > > fwiw, a year ago I would probably have been an active advocate of more > > > language support for type constraints, but the longer I spend building > > I confess I have very ambigous feelings about this, and partly agree, > > ..but > > if opaque types (or abstract data types/patterns) become more frequent > > in > > Erlang I guess there will be more need for type specifications. > > I'd temper this with the known effective approaches: > 1) "let it crash" > 2) apply checks only at the application/system boundary > > ..to which I'll add... > > 3) beware any form of cruft. > > regs, > /s OK, a use case maybe. Suppose you wan't a uniform interface to access SQL databases for different native database implementations. Similar to jdbc in Java or PDO in PHP. You know how to implement it in MySQL, but would like to leave the door open to others to implement it for other dabases (postgresql,Oracle). An interface specification is good for the implementors (and for the end users), and the more support you have from your build and debug environment the better I would say. In a sense I would say that your second item concering system boundaries applies here. Erlang is very efficient to implement applications in and as long as you roll your own stuff or are within a tight group I think your points apply, but I would like to argue that for building large community based infrastructure it is very important to be able to have useful interface specifications/contracts. Regards Mikael From kenneth.lundin@REDACTED Fri Mar 19 10:36:33 2010 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Fri, 19 Mar 2010 10:36:33 +0100 Subject: [erlang-questions] simplified attribute declaration In-Reply-To: <95be1d3b1003180214o37cbdab8lb2633fde53c97fd1@mail.gmail.com> References: <95be1d3b1003180214o37cbdab8lb2633fde53c97fd1@mail.gmail.com> Message-ID: Hi, The possibility to specify attributes without parentheses is a mistake that we will corrected as soon as possible. It was introduced together with the -spec and -type notation which does not need parentheses. I don't understand why it is cool. Don't even try to use this syntax in your code you will be punished with syntax error as soon as we fix this bug. /Kenneth Erlang/OTP, Ericsson On Thu, Mar 18, 2010 at 10:14 AM, Vlad Dumitrescu wrote: > Hi, > > I don't remember anyone mentioning this before, but I think it's cool > and should be promoted as the recommended syntax: > > All attributes can now (R13) be specified without parantheses! > > -module hello_world. > -export [init/1, stop/2]. > -define DEBUG(X), io:format("debug: ~p~n", [X]). > > best regards, > Vlad > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From pekadan@REDACTED Fri Mar 19 10:55:16 2010 From: pekadan@REDACTED (Peter Andersson) Date: Fri, 19 Mar 2010 10:55:16 +0100 Subject: [erlang-questions] common test perform coverage analysis on large lib Message-ID: <359628171003190255xd300c42ne56035d9b4002451@mail.gmail.com> Hi Chengwei, Unfortunately there's no support for running cover from the ct_master as of yet. ct_master passes the testspec on to the ct nodes, so cover will run on each node as expected. But then what exactly goes wrong during cover analysis I can't say without first doing a bit of investigation. In any case, proper support for cover in a "large scale testing" environment should provide the option to use the master node as central node also for the cover data collection and analysis (so the result can include all execution on all nodes). This feature could be introduced simply by allowing a {cover, master, MasterCoverFile} term in the test specification. I.e. the existing {cover, CoverFile} would mean "run cover analysis locally on each node" (which "almost" works already...), while the new term would state "collect and analyse coverage of all tests, and print the cover logs, on the master node". Cool! I'll add this to the list of proposed new features for CT. Thanks! /Peter Erlang/OTP, Ericsson AB Aeolus wrote: > hi, > > we used common test to perform coverage analysis on our system, the > problem is it hangs when giving the "Coverage analysing...? msg, we > suspect this could be due to common test and our system is competing > for file writing access. so our question is it possible to run > coverage with ct_master module so it will run test on slave node but > do coverage updating at master node. we tried to feed master node with > test spec and it seems it skipped execution of {cover, "cover.file"} > opt. We use R12 of erlang. > > thx in advance. > > > //Chengwei > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > > From vladdu55@REDACTED Fri Mar 19 12:25:36 2010 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 19 Mar 2010 12:25:36 +0100 Subject: [erlang-questions] Re: Using -spec for callbacks when defining behaviours In-Reply-To: References: <872e77ab1003170401u54f391cdi181d67eca20012af@mail.gmail.com> <3d94c7e4-2c1a-4826-9c45-7ca453cbee15@e1g2000yqh.googlegroups.com> Message-ID: <95be1d3b1003190425u5b5e1e95mb78e8a5a938876f6@mail.gmail.com> On Fri, Mar 19, 2010 at 00:46, Steve Davis wrote: > I'd temper this with the known effective approaches: > 1) "let it crash" > 2) apply checks only at the application/system boundary > ..to which I'll add... > 3) beware any form of cruft. Hi Steve, I'd like to amend number 2 above by replacing "application/system" with "component". There might be an internal structure to an application, if it is complex enough. These approaches are indeed effective, but there are use cases where it's more efficient to do checks before run-time. It's all a matter of where the break-even is for the amount of effort spent debugging problems at run-time vs specifying constraints at compile time. And this break-even depends on the specific application's complexity and architecture. To put it another way, "let it crash" is a strategy for handling errors, so that hopefully the user doesn't even realize there was a problem. But the problem is still there. The static tools are helping us to make sure that certain types of errors can't occur, including subtle errors that don't cause crashes. In my view, this kind of specification falls under the same category of bug prevention as the compiler warning for the expression "5 + O" (where the latter term is a big-oh, not a zero) that is going to cause a run-time exception. It is more effective to catch that before running and also you catch all these problems in all your code base once you enable the warning. best regards, Vlad From martindemello@REDACTED Fri Mar 19 13:14:09 2010 From: martindemello@REDACTED (Martin DeMello) Date: Fri, 19 Mar 2010 17:44:09 +0530 Subject: [erlang-questions] Re: implementing a notification list In-Reply-To: <3c1ca06c-9432-415e-9115-12bfce6d1bca@t23g2000yqt.googlegroups.com> References: <3c1ca06c-9432-415e-9115-12bfce6d1bca@t23g2000yqt.googlegroups.com> Message-ID: Thanks, Steve. When searching I need to filter on the event type as well as retrieving records within a range of timestamps, so I'll probably have the timestamp as the pk and index on the event type. What worried me was this post: -------------------------- When we scaled this up, we discovered that we were doing one or both of the following alot: 1) insert at the front or 2) delete from the back. Since the underlying implementation is trying to be a balanced tree, this leads to alot of rebalancing, which slows things down (doubly so since our ordered set was on disk). We switched to specialized data structures at that point. -------------------------- It seems to me that I'd be doing much the same thing, that is inserting a series of timestamps in increasing order, which would potentially lead to a lot of rebalancing of the tree. I don't want to optimise prematurely, of course, but I also don't want to find out a few months down the line that I've made the wrong decision and have to face a potentially expensive ripping-out and reworking. martin On Thu, Mar 18, 2010 at 9:07 PM, Steve Davis wrote: > HI Martin, > > A couple of approaches to consider for a starting point: > > 1) If appropriate you could use the timestamp as the key on your > db_event record, i.e. -record(db_event, {timestamp, data, ...}) > 2) If using the timestamp as the key isn't appropriate, you can index > the timestamp field, http://erlang.org/doc/apps/mnesia/Mnesia_chap5.html#id2273564 > > hth, > /s > > On Mar 18, 6:34?am, Martin DeMello wrote: >> I'm new to Erlang, and having a bit of trouble coming up with the >> right way to do this: >> >> I have a set of mnesia triggers that watch for various db events. I >> now want to have a persistent notification list that supports the >> following two operations efficiently: >> >> 1. insert a new event, with timestamp >> 2. retrieve all events between two given timestamps >> >> and possibly less efficiently >> >> 3. compact the table (combine several updates to a single object into >> a single row) >> >> This posthttp://groups.google.com/group/erlang-programming/browse_thread/threa... >> seems to imply that simply storing the notifications as an mnesia >> table is a bad idea. >> >> martin From kostis@REDACTED Fri Mar 19 13:23:55 2010 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 19 Mar 2010 14:23:55 +0200 Subject: [erlang-questions] simplified attribute declaration In-Reply-To: References: <95be1d3b1003180214o37cbdab8lb2633fde53c97fd1@mail.gmail.com> Message-ID: <4BA36CDB.6090109@cs.ntua.gr> Kenneth Lundin wrote: > Hi, > > The possibility to specify attributes without parentheses is a mistake > that we will corrected as soon as > possible. It was introduced together with the -spec and -type notation > which does not need parentheses. > > I don't understand why it is cool. > Don't even try to use this syntax in your code you will be punished > with syntax error as soon as we fix this bug. > > /Kenneth Erlang/OTP, Ericsson > > > On Thu, Mar 18, 2010 at 10:14 AM, Vlad Dumitrescu wrote: >> Hi, >> >> I don't remember anyone mentioning this before, but I think it's cool >> and should be promoted as the recommended syntax: >> >> All attributes can now (R13) be specified without parantheses! >> >> -module hello_world. >> -export [init/1, stop/2]. >> -define DEBUG(X), io:format("debug: ~p~n", [X]). Let me try to clarify the issue of having the possibility to write attributes without parentheses because I see a lot of confusion (perhaps naturally so, as this feature is not documented), first in Vlad's mail, then in the various replies that his mail has generated -- which has provoked Kenneth's "threatening" mail to the mailing list. What is really happening is that attributes which take just one argument do not need to be enclosed in parentheses. On the other hand, attributes with more than one argument (read: whenever there is a ',' involved, as in the case of -define above) need to be enclosed in parentheses. This was introduced in order to allow types and specs to be written without parentheses but the mechanism is more general and applies to all 1-arity attributes. This is fine, I think, and does not need to be changed. It is true that users who have spent years getting used to the "Erlang way of doing things" might find this possibility confusing at first. On the other hand, those that have some exposure to ML or Haskell will recognize something familiar to them: think of all attributes as taking only _one_ parameter and the parentheses are needed for grouping what's inside this parameter. In other words, read the three attributes above as written: -module hello_world . -export [init/1, stop/2] . -define (DEBUG(X), io:format("debug: ~p~n", [X])) . So, in the last case, it's really the ',' that forces the parentheses. Personally, I do not see any compelling reason why one should be REQUIRED to put parentheses around the single argument of unary attributes. Of course, note that even today this is entirely optional: one CAN put parentheses around this argument if one really wishes to, in the same sense that one can write 40 + 2, (40 + 2), (40 + (2)), etc. Kostis From erlang@REDACTED Fri Mar 19 13:44:10 2010 From: erlang@REDACTED (Dominic Williams) Date: Fri, 19 Mar 2010 13:44:10 +0100 Subject: [erlang-questions] [proposal] Declarative syntax for metadata (long!) In-Reply-To: <9b08084c1003180606g68f1c060r10635f571b6c642c@mail.gmail.com> References: <95be1d3b1003180434l7e76c610if40faed29efa647c@mail.gmail.com> <9b08084c1003180606g68f1c060r10635f571b6c642c@mail.gmail.com> Message-ID: Le 18 mars 2010 ? 14:06, Joe Armstrong a ?crit : > I agree, this is one of the things that is missing from Erlang > > I think the problem is one of introspection. > > Basically every "thing" has three representations > > (1) The external print representation of the thing > (ie the thing you type into a module, or in the shell) > (2) The parse tree representing (1) > (3) The internal compiled form of the thing > > It should be possible to convert at run-time between any of these > three representations. > > [...] Joe, and Vlad, what kind of programming problems could be solved more easily thanks to such a feature (which I believe is actually reification, introspection being just the possibility to see - ask questions about - but not manipulate)? I can see one area which would become much easier to work on: development tools. But for everyday programming, I'm afraid introducing reification would actually make Erlang less simple, less easy to reason about, less reliable... and these properties of Erlang are more important to me, given that I want to ship working software quickly, than being able to do cool things with reification. I've always been a fan of Joe's principle that for every thing one adds to Erlang, one should remove something else - so since Joe is supporting adding introspection, I'm interested to hear what he would be prepared to remove in exchange? Best regards, Dominic Williams http://dominicwilliams.net ---- From vladdu55@REDACTED Fri Mar 19 14:18:48 2010 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 19 Mar 2010 14:18:48 +0100 Subject: [erlang-questions] simplified attribute declaration In-Reply-To: <4BA36CDB.6090109@cs.ntua.gr> References: <95be1d3b1003180214o37cbdab8lb2633fde53c97fd1@mail.gmail.com> <4BA36CDB.6090109@cs.ntua.gr> Message-ID: <95be1d3b1003190618m5e6c74a4u618feccda4e05fc@mail.gmail.com> On Fri, Mar 19, 2010 at 13:23, Kostis Sagonas wrote: > What is really happening is that attributes which take just one argument do > not need to be enclosed in parentheses. On the other hand, attributes with > more than one argument (read: whenever there is a ',' involved, as in the > case of -define above) need to be enclosed in parentheses. Why? I tried it properly with the following module -module test. -export [test/1]. -import lists, [reverse/1]. -record x, {a=3}. test(X) -> {#x{a=4}, reverse(X)}. and it works just fine to compile and run it, giving the correct result. The only other attributes that accept two arguments are -module whith parameters, -file and -define. The first works too and the other two don't because they are both handled by epp (which has the parentheses hardcoded in its scanner/parser). I don't see why -file shouldn't work too and in the case of -define the only problem I can see is in the case of macro definitions that aren't well-formed expressions. best regards, Vlad From attila.r.nohl@REDACTED Fri Mar 19 14:28:05 2010 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Fri, 19 Mar 2010 14:28:05 +0100 Subject: [erlang-questions] simplified attribute declaration In-Reply-To: <4BA36CDB.6090109@cs.ntua.gr> References: <95be1d3b1003180214o37cbdab8lb2633fde53c97fd1@mail.gmail.com> <4BA36CDB.6090109@cs.ntua.gr> Message-ID: <401d3ba31003190628t69c68511wbcf0f6fcc9accfba@mail.gmail.com> 2010/3/19, Kostis Sagonas : [...] > It is true that users who have spent years getting used to the "Erlang > way of doing things" might find this possibility confusing at first. On > the other hand, those that have some exposure to ML or Haskell will > recognize something familiar to them: think of all attributes as taking > only _one_ parameter and the parentheses are needed for grouping what's > inside this parameter. Don't forget that it's not only the Erlang tools and programmers who parse Erlang source code, but e.g. ctags and etags too. As far as I checked, they do accept the non-documented no-parentheses format, but there might be some other tool that breaks on them. From hakan@REDACTED Fri Mar 19 14:36:06 2010 From: hakan@REDACTED (=?ISO-8859-1?Q?H=E5kan_Mattsson?=) Date: Fri, 19 Mar 2010 14:36:06 +0100 Subject: [erlang-questions] simplified attribute declaration In-Reply-To: <4BA36CDB.6090109@cs.ntua.gr> References: <95be1d3b1003180214o37cbdab8lb2633fde53c97fd1@mail.gmail.com> <4BA36CDB.6090109@cs.ntua.gr> Message-ID: <922d05851003190636o220b38b3m690b61d55fbfc60d@mail.gmail.com> On Fri, Mar 19, 2010 at 1:23 PM, Kostis Sagonas wrote: > What is really happening is that attributes which take just one argument do > not need to be enclosed in parentheses. On the other hand, attributes with > more than one argument (read: whenever there is a ',' involved, as in the > case of -define above) need to be enclosed in parentheses. This was > introduced in order to allow types and specs to be written without > parentheses but the mechanism is more general and applies to all 1-arity > attributes. This is fine, I think, and does not need to be changed. I think that this "mechanism" is unfortunate as it introduces an asymmetry between the source code and its internal form in the compiler. Either you should keep information about the optional parenthesis in the internal form or you should stick with mandatory parenthesis. Otherwise you cannot recreate the source code. I do not see the point in having yet another syntax alternative. It is about as useful as the misfeature with optional closing parenthesis in defines. /H?kan From kenneth.lundin@REDACTED Fri Mar 19 14:52:03 2010 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Fri, 19 Mar 2010 14:52:03 +0100 Subject: [erlang-questions] simplified attribute declaration In-Reply-To: <922d05851003190636o220b38b3m690b61d55fbfc60d@mail.gmail.com> References: <95be1d3b1003180214o37cbdab8lb2633fde53c97fd1@mail.gmail.com> <4BA36CDB.6090109@cs.ntua.gr> <922d05851003190636o220b38b3m690b61d55fbfc60d@mail.gmail.com> Message-ID: Just a clarification. We have no plans at all to support attributes without parentheses no matter if the attribute has one or several parameters. That this syntax is accepted now is a bug which will be corrected. We will also make it mandatory to have a closing parenthesis in defines. /Kenneth Erlang/OTP , Ericsson 2010/3/19 H?kan Mattsson : > On Fri, Mar 19, 2010 at 1:23 PM, Kostis Sagonas wrote: > >> What is really happening is that attributes which take just one argument do >> not need to be enclosed in parentheses. On the other hand, attributes with >> more than one argument (read: whenever there is a ',' involved, as in the >> case of -define above) need to be enclosed in parentheses. This was >> introduced in order to allow types and specs to be written without >> parentheses but the mechanism is more general and applies to all 1-arity >> attributes. This is fine, I think, and does not need to be changed. > > I think that this "mechanism" is unfortunate as it introduces an asymmetry > between the source code and its internal form in the compiler. Either you > should keep information about the optional parenthesis in the internal form > or you should stick with mandatory parenthesis. Otherwise you cannot recreate > the source code. I do not see the point in having yet another syntax > alternative. > It is about as useful as the misfeature with optional closing > parenthesis in defines. > > /H?kan > From kostis@REDACTED Fri Mar 19 14:59:46 2010 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 19 Mar 2010 15:59:46 +0200 Subject: [erlang-questions] simplified attribute declaration In-Reply-To: <922d05851003190636o220b38b3m690b61d55fbfc60d@mail.gmail.com> References: <95be1d3b1003180214o37cbdab8lb2633fde53c97fd1@mail.gmail.com> <4BA36CDB.6090109@cs.ntua.gr> <922d05851003190636o220b38b3m690b61d55fbfc60d@mail.gmail.com> Message-ID: <4BA38352.6060407@cs.ntua.gr> H?kan Mattsson wrote: > On Fri, Mar 19, 2010 at 1:23 PM, Kostis Sagonas wrote: > >> What is really happening is that attributes which take just one argument do >> not need to be enclosed in parentheses. On the other hand, attributes with >> more than one argument (read: whenever there is a ',' involved, as in the >> case of -define above) need to be enclosed in parentheses. This was >> introduced in order to allow types and specs to be written without >> parentheses but the mechanism is more general and applies to all 1-arity >> attributes. This is fine, I think, and does not need to be changed. > > I think that this "mechanism" is unfortunate as it introduces an asymmetry > between the source code and its internal form in the compiler. Either you > should keep information about the optional parenthesis in the internal form > or you should stick with mandatory parenthesis. Otherwise you cannot recreate > the source code. How is that different from what's happening today in other Erlang source code? E.g. in code that for whatever reason the user has decided to write as follows: -module(foo). -compile(export_all). foo1() -> 42. foo2() -> (42). foo3() -> (((42))). foo4() -> (m):(bar)((42)). Does the compiler maintain enough information on how many parentheses the user has written in each of these cases? Kostis From vladdu55@REDACTED Fri Mar 19 15:02:40 2010 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 19 Mar 2010 15:02:40 +0100 Subject: [erlang-questions] [proposal] Declarative syntax for metadata (long!) In-Reply-To: References: <95be1d3b1003180434l7e76c610if40faed29efa647c@mail.gmail.com> <9b08084c1003180606g68f1c060r10635f571b6c642c@mail.gmail.com> Message-ID: <95be1d3b1003190702j1096b838vdeda7302b6780186@mail.gmail.com> On Fri, Mar 19, 2010 at 13:44, Dominic Williams wrote: > Le 18 mars 2010 ? 14:06, Joe Armstrong a ?crit : >> (1) The external print representation of the thing >> (ie the thing you type into a module, or in the shell) >> (2) The parse tree representing (1) >> (3) The internal compiled form of the thing > > Joe, and Vlad, what kind of programming problems could be solved more easily thanks to such a feature (which I believe is actually reification, introspection being just the possibility to see - ask questions about - but not manipulate)? Good question. And yes, I think the correct term is reification. > But for everyday programming, I'm afraid introducing reification would actually make Erlang less simple, less easy to reason about, less reliable... and these properties of Erlang are more important to me, given that I want to ship working software quickly, than being able to do cool things with reification. Well, for the first thing, this kind of functionality shouldn't affect anything else unless it is used, just as little as I would not be affected at all if asn1 or megaco would be the buggiest applications on the planet. > I can see one area which would become much easier to work on: development tools. Yes, that is one. And my (partial) opinion is that they are quite important. Good tool support is essential and tool developers deserve help too :) The same kind of reification/introspection exists and in some places could be improved even at system level (to help manage installed applications, for example) and in the runtime (process management). > I've always been a fan of Joe's principle that for every thing one adds to Erlang, one should remove something else - so since Joe is supporting adding introspection, I'm interested to hear what he would be prepared to remove in exchange? I'm not Joe, but in my previous message to the list I mentioned something that could be removed :) best regards, Vlad From vladdu55@REDACTED Fri Mar 19 15:08:42 2010 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 19 Mar 2010 15:08:42 +0100 Subject: [erlang-questions] simplified attribute declaration In-Reply-To: References: <95be1d3b1003180214o37cbdab8lb2633fde53c97fd1@mail.gmail.com> <4BA36CDB.6090109@cs.ntua.gr> <922d05851003190636o220b38b3m690b61d55fbfc60d@mail.gmail.com> Message-ID: <95be1d3b1003190708r7779b44al5a0b1d9dd99b1052@mail.gmail.com> 2010/3/19 Kenneth Lundin : > We have no plans at all to support attributes without parentheses no matter if > the attribute has one or several parameters. That this syntax is > accepted now is a > bug which will be corrected. > > We will also make it mandatory to have a closing parenthesis in defines. This includes -spec and -type, or is the inconsistency going to remain? best regards, Vlad From ciprian.craciun@REDACTED Fri Mar 19 15:16:18 2010 From: ciprian.craciun@REDACTED (Ciprian Dorin, Craciun) Date: Fri, 19 Mar 2010 16:16:18 +0200 Subject: [erlang-questions] [proposal] Declarative syntax for metadata (long!) In-Reply-To: <95be1d3b1003180434l7e76c610if40faed29efa647c@mail.gmail.com> References: <95be1d3b1003180434l7e76c610if40faed29efa647c@mail.gmail.com> Message-ID: <8e04b5821003190716s1a5943c8s258bd9171e287146@mail.gmail.com> On Thu, Mar 18, 2010 at 1:34 PM, Vlad Dumitrescu wrote: > Hi all, > > I feel I should follow up on my rant from last night (I hope the tone > wasn't too harsh!). I have been thinking about these things for a long > while, but I'm sure I still miss some points. > > > Erlang source code contains besides actual code even meta-data and > configuration data, disguised as Erlang terms, comments or strings. > Some of this data has been integrated into the language (type > specifications, for example), but not all of it. I would like to > present arguments for and against integrating all such data. > > First a non-exhaustive list of data that IMHO would benefit from > becoming a first-class citizen of the language: > - behaviour callback specifications > - supervisor child specifications > - match specifications > - edoc > > Today, there are three ways to encode this data: as Erlang terms, as > strings and as comments. (I know strings are terms, but they are > different) > > [... snip, snip, a lot of snip snip ...] > > best regards, > Vlad (Disclaimer: I'm a big fan of Erlang, studied it, played with it, and only lately used it for something non-trivial, so please take my comments lightly.) (2nd disclaimer: I'm not wanting to start a pro-, or con-debate of what I'm going to describe. I've already did this a year or two ago on this mailing list.) What Vlad is describing here as `meta-data and configuration data, disguised as Erlang terms, comments or strings` and then he points them out: behaviour and supervisor specifications or match specifications, sounds to me like DSL's... So even though I'm not going to pronounce the magic word (ma***s) I would like to add that all these (and more) can be solved by allowing users to define their own custom languages. Ciprian. P.S.: After using Erlang a little bit more serious, I've found out, that at least for gen_servers, there is a lot of boiler plate code that one must write: `gen_server:call` wrappers... So I've actually invested a lot of time in writing `define`s that abstract away a lot of boiler-plate code... But believe me the result is ugly... From rwillmer@REDACTED Fri Mar 19 15:20:04 2010 From: rwillmer@REDACTED (Rachel Willmer) Date: Fri, 19 Mar 2010 14:20:04 +0000 Subject: [erlang-questions] 8k limit on gen_tcp:recv? In-Reply-To: <781EE251-9CFB-429B-9D49-123229AD591A@rogvall.se> References: <5cd112871003101540t4386d69anb5fc23e3d4ac93d3@mail.gmail.com> <6a36e7291003101548h137c040dve690e8cdcd378a82@mail.gmail.com> <65b2728e1003101943j3bbe04fjc29f3bc09f536b07@mail.gmail.com> <781EE251-9CFB-429B-9D49-123229AD591A@rogvall.se> Message-ID: <5cd112871003190720j6237effbg8b16d36d572bea17@mail.gmail.com> Thanks to everyone who responded, this is all really useful. Trying it now... Rachel On 11 March 2010 10:31, Tony Rogvall wrote: > Note that setting the recbuf not only updates the inet driver read buffer but also > the sets the SO_RCVBUF socket option. This is not always what you want!!! > First consult the networking documentation on TCP and buffer management to > see if this will result in unwanted behavior. > > If you do not know exactly what recbuf does you may instead use the option > {buffer, Size} which only affects the inet driver read buffer > > /Tony > > > On 11 mar 2010, at 04.43, Steve Vinoski wrote: > >> Try setting your socket's receive buffer to something larger than 8k >> before you do the recv: >> >> inet:setopts(Socket, [{recbuf,16384}]). >> >> By passing a 0 for the length to recv, you're telling it to receive >> all available bytes. I assume it can't receive more bytes than its >> buffer can store. >> >> --steve >> >> On Wed, Mar 10, 2010 at 6:48 PM, Bob Ippolito wrote: >>> Since this is definitely not clear in the question, the code would >>> look something like this: >>> >>> ? ?inet:setopts(Socket, [{packet, http}]), >>> ? ?case gen_tcp:recv(Socket, 0, ?IDLE_TIMEOUT) of >>> ? ? ? ?{ok, {http_request, Method, Path, Version}} -> >>> ? ? ? ? ? ?headers(Socket, {Method, Path, Version}, [], Body, 0) >>> ? ?end. >>> >>> Rachel - how about providing a reproducible test case and making it an >>> issue in the mochiweb project? There might be some continuation >>> response from recv that mochiweb doesn't currently expect to receive. >>> >>> http://code.google.com/p/mochiweb/issues/entry >>> >>> On Wed, Mar 10, 2010 at 3:40 PM, Rachel Willmer wrote: >>>> I've been debugging a problem whereby couchdb rejects a URL longer than 8k. >>>> >>>> At first, I thought it was an already known limitation in mochiweb >>>> (the stack is couchdb/mochiweb/erlang). >>>> >>>> But with large amounts of ioformat debugging, I've pinned it down to a >>>> call from mochiweb to gen_tcp:recv which fails on this long URL. >>>> >>>> Is this a known limitation in erlang's gen_tcp:recv? >>>> >>>> Rachel >>>> >>>> ________________________________________________________________ >>>> erlang-questions (at) erlang.org mailing list. >>>> See http://www.erlang.org/faq.html >>>> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED >>>> >>>> >>> >>> ________________________________________________________________ >>> erlang-questions (at) erlang.org mailing list. >>> See http://www.erlang.org/faq.html >>> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED >>> >>> >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED >> > > From vladdu55@REDACTED Fri Mar 19 15:33:44 2010 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 19 Mar 2010 15:33:44 +0100 Subject: [erlang-questions] [proposal] Declarative syntax for metadata (long!) In-Reply-To: <8e04b5821003190716s1a5943c8s258bd9171e287146@mail.gmail.com> References: <95be1d3b1003180434l7e76c610if40faed29efa647c@mail.gmail.com> <8e04b5821003190716s1a5943c8s258bd9171e287146@mail.gmail.com> Message-ID: <95be1d3b1003190733j34c27457m336dc6727b1ff251@mail.gmail.com> On Fri, Mar 19, 2010 at 15:16, Ciprian Dorin, Craciun wrote: > ? ?What Vlad is describing here as `meta-data and configuration data, > disguised as Erlang terms, comments or strings` and then he points > them out: behaviour and supervisor specifications or match > specifications, sounds to me like DSL's... Yes and no. Yes, there would be DSLs, just as there are some simple ones right now. For example, the list in the -export attribute is not a proper Erlang term and can be seen as a DSL. Type specifications definitely are DSLs. Edoc too. No, in that post I wasn't advocating user defined DSLs. Only their use in "standard" places instead of worse alternatives. Regarding metaprogramming in Erlang, it's another issue completely. For some years ago I submitted a proposal in the form of an EEP, but was met with a wall of silence (http://www.erlang.org/cgi-bin/ezmlm-cgi/5/010) and I got sidetracked on other projects. regards, Vlad From mevans@REDACTED Fri Mar 19 15:49:51 2010 From: mevans@REDACTED (Evans, Matthew) Date: Fri, 19 Mar 2010 10:49:51 -0400 Subject: Erlang Event Loop Question Message-ID: Hi All, I'm wondering about the inner workings of the Erlang event loop. Is the event loop single threaded? We have a service (the VM has epoll enabled) that is doing a lot of TCP (HTTP) ingesting and parsing of large files (25MB of data or more per second). It is also doing a lot of IPC, both to other Erlang nodes, and via a proprietary transport to C++ applications. We currently support two methods to ingest these files: straight TCP (gen_tcp), and a specialized linked-in driver (which passes the epoll socket to the Erlang event loop with driver_select and passes the driver-created socket to gen_tcp; we also have a pool of threads for this driver). My concern is that under load the event loop is getting very busy resulting in time-sensitive IPC messages getting delayed/slowed down. I could get around this by having the linked-in driver not do driver_select and instead read from the socket and do driver_output_binary to pass the data to an Erlang process when it has accumulated a large enough buffer (say 100K). I would however like to get an understanding of the event loop before we try this, and see if there are any ways we can measure its performance to see if it is indeed a bottleneck. Anyone have any suggestions? Regards Matt From kenneth.lundin@REDACTED Fri Mar 19 15:53:07 2010 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Fri, 19 Mar 2010 15:53:07 +0100 Subject: [erlang-questions] simplified attribute declaration In-Reply-To: <95be1d3b1003190708r7779b44al5a0b1d9dd99b1052@mail.gmail.com> References: <95be1d3b1003180214o37cbdab8lb2633fde53c97fd1@mail.gmail.com> <4BA36CDB.6090109@cs.ntua.gr> <922d05851003190636o220b38b3m690b61d55fbfc60d@mail.gmail.com> <95be1d3b1003190708r7779b44al5a0b1d9dd99b1052@mail.gmail.com> Message-ID: For -spec and -type you don't need the surrounding parentheses right now and we don't regard it as a bug. It is possible that we will do something about the so called inconsistency sooner or later. /Kenneth Erlang/OTP, Ericsson On Fri, Mar 19, 2010 at 3:08 PM, Vlad Dumitrescu wrote: > 2010/3/19 Kenneth Lundin : >> We have no plans at all to support attributes without parentheses no matter if >> the attribute has one or several parameters. That this syntax is >> accepted now is a >> bug which will be corrected. >> >> We will also make it mandatory to have a closing parenthesis in defines. > > This includes -spec and -type, or is the inconsistency going to remain? > > best regards, > Vlad > From vladdu55@REDACTED Fri Mar 19 15:54:35 2010 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 19 Mar 2010 15:54:35 +0100 Subject: [erlang-questions] simplified attribute declaration In-Reply-To: References: <95be1d3b1003180214o37cbdab8lb2633fde53c97fd1@mail.gmail.com> <4BA36CDB.6090109@cs.ntua.gr> <922d05851003190636o220b38b3m690b61d55fbfc60d@mail.gmail.com> <95be1d3b1003190708r7779b44al5a0b1d9dd99b1052@mail.gmail.com> Message-ID: <95be1d3b1003190754q5b990b3eie94ecf065d443e03@mail.gmail.com> On Fri, Mar 19, 2010 at 15:53, Kenneth Lundin wrote: > For -spec and -type you don't need the surrounding parentheses right > now and we don't regard it as a bug. > > It is possible that we will do something about the so called > inconsistency sooner or later. Ok, thanks. /Vlad From navaneethanit@REDACTED Fri Mar 19 19:27:46 2010 From: navaneethanit@REDACTED (NavaTux) Date: Fri, 19 Mar 2010 11:27:46 -0700 (PDT) Subject: Problem to start mysql conncetion with erlang Message-ID: <9dd55ab2-d4c6-492f-a308-49520f9e7922@s36g2000prh.googlegroups.com> We wanna create a database connectivity to retrieve the results from the database,so we have follow the tutorial for sample database check here i posted my problem to connect Erlang with mysql http://navaspot.wordpress.com/2010/03/19/erlang-database-connectivity-problem/ please give the solution for my application From zabrane3@REDACTED Fri Mar 19 19:31:57 2010 From: zabrane3@REDACTED (zabrane Mikael) Date: Fri, 19 Mar 2010 19:31:57 +0100 Subject: Speeding-up escript's starting time Message-ID: <18a1db031003191131o56d823dv8fc04b3020c69bef@mail.gmail.com> Hi List, I've an "escript" command used for batch processing. Each time a "data" appears in a special directory, this "escript" command handle it (apply some tranformations on it ...). I've noticed that my escript's "starting time" isn't fast enough and I'm wondering if there's a way to gain some speed. N.B: the only constraint here is to use this "escript" command and nothing else. Regards Zabrane From erlangy@REDACTED Fri Mar 19 19:55:13 2010 From: erlangy@REDACTED (Michael McDaniel) Date: Fri, 19 Mar 2010 11:55:13 -0700 Subject: [erlang-questions] Problem to start mysql conncetion with erlang In-Reply-To: <9dd55ab2-d4c6-492f-a308-49520f9e7922@s36g2000prh.googlegroups.com> References: <9dd55ab2-d4c6-492f-a308-49520f9e7922@s36g2000prh.googlegroups.com> Message-ID: <20100319185513.GU5805@delora.autosys.us> On Fri, Mar 19, 2010 at 11:27:46AM -0700, NavaTux wrote: > We wanna create a database connectivity to retrieve the results from > the database,so we have follow the tutorial for sample database check > > here i posted my problem to connect Erlang with mysql > > http://navaspot.wordpress.com/2010/03/19/erlang-database-connectivity-problem/ > > please give the solution for my application > ________________________________________________________________ try ... f(Results), Results = odbc:sql_query(Conn, \u201cSELECT * FROM test_table\u201d). It looks like Results already has value and the pattern match Return = ... fails. Type help() in shell to read about f(). ~Michael From caio.ariede@REDACTED Fri Mar 19 21:55:04 2010 From: caio.ariede@REDACTED (caio ariede) Date: Fri, 19 Mar 2010 17:55:04 -0300 Subject: [erlang-questions] Erlang list comprehension optimization In-Reply-To: <6672d0161003170030q297d69c7sac2ba66e46de9f2f@mail.gmail.com> References: <23237d041003162017h628bdfd8hc9be35f3432e9ece@mail.gmail.com> <4BA04C4B.7060307@m5net.com> <3dbc6d1c1003162107g65e313f1g8255c724013abef7@mail.gmail.com> <6672d0161003170030q297d69c7sac2ba66e46de9f2f@mail.gmail.com> Message-ID: <6a9ba5691003191355q695c8ef7rd316d4833846057c@mail.gmail.com> Just a small question. http://www.erlang.org/doc/efficiency_guide/listHandling.html#id2261027 'lc^0'([E|Tail], Expr) -> Expr(E), 'lc^0'(Tail, Expr); 'lc^0'([], _Expr) -> []. Where this name ('lc^0') is generated? Thanks Caio Ariede http://caioariede.com/ 2010/3/17 Bj?rn Gustavsson > On Wed, Mar 17, 2010 at 5:07 AM, Robert Virding > wrote: > > > > There is one strange thing further up in the text: > > > > "Lists comprehensions still have a reputation for being slow. They > > used to be implemented using funs, which used to be slow." > > > > List comprehensions have never been implemented with funs, at least > > not when they were first introduced. I know. > > Have a look the function lc_tq/3 starting at line 430 in R6B: > > > http://github.com/mfoemmel/erlang-otp/blob/b48c3645b0e28fe61cb53771d2b84bfc30d48bad/lib/compiler/src/sys_pre_expand.erl > > It seems clear to me from the code that list comprehensions are > rewritten to an expression that uses a fun. Also see the comment > before the function. It says that because Erlang doesn't have letrecs, the > lambda (fun) is explicitly passed as an extra argument. > > Nowadays, list comprehensions are translated to letrecs > (which are available in Core Erlang), and the letrecs are in > turn translated to ordinary recursive functions. > > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From jay@REDACTED Fri Mar 19 22:53:28 2010 From: jay@REDACTED (Jay Nelson) Date: Fri, 19 Mar 2010 14:53:28 -0700 Subject: httph_bin works, but missing from type spec Message-ID: <32A84B39-61E5-4C53-A81E-C0F488B9BC48@duomark.com> http_reply.erl:147: The call erlang:decode_packet('httph_bin',Binary::binary(),[]) will never return since it differs in the 1st argument from the success typing arguments: ('asn1' | 'cdr' | 'fcgi' | 'http' | 'http_bin' | 'httph' | 'line' | 'raw' | 'sunrm' | 'tpkt' | 0 | 1 | 2 | 4,binary(), [{'line_length',non_neg_integer()} | {'packet_size',non_neg_integer()}]) The function works just fine but dialyzer complains. jay From jay@REDACTED Sat Mar 20 00:56:15 2010 From: jay@REDACTED (Jay Nelson) Date: Fri, 19 Mar 2010 16:56:15 -0700 Subject: pos_integer() type not recognized by emacs in R13B04 Message-ID: <44220C3F-BE45-46AC-A333-3302B09E8B6F@duomark.com> When writing a -type spec, in emacs non_neg_integer() will highlight purple but pos_integer() does not. jay From bernie@REDACTED Sat Mar 20 02:05:15 2010 From: bernie@REDACTED (Bernard Duggan) Date: Sat, 20 Mar 2010 12:05:15 +1100 Subject: Performance with large queues Message-ID: <4BA41F4B.2080000@m5net.com> Hi list. I have a bit of an involved issue, and I'm not even entirely sure what the question I need to ask is, so I'll explain our setup, the problem, my theory and why I'm not 100% convinced I'm right :) We have a couple of what I'll call "high load" processes. At peak times these processes deal with a reasonably high number of messages (hundreds per second at least - I haven't measured exactly) and do a non-trivial amount of work on each one - most notably several mnesia operations, all contained within a single transaction. They are implemented as gen_servers. Most of the time, although they chew up a fair bit of CPU (maybe 50% of one core on a 4 core box at peak time), they chug along quite happily and keep up with what's being fed to them. Twice in the last month, however, one of them has gotten into a state that has ended with a queue getting so big that it's exhausted the memory and crashed the VM. Now that in itself wouldn't be a mystery - we've encountered it before with processes that simply can't service their queue fast enough and had that been the root of the issue then I'm quite happy that I know how to go about fixing it. What's different in this case, however, is that once the queue passes a certain length (I can't say how long exactly - I've inferred most of this from crash dumps, CPU and memory use graphs and so on) the performance of the process drops drastically to the point that it's serving well under one message per second and even over the course of a night, where load drops to near-negligible levels, it doesn't even come close to catching up and clearing the queue. (In the most recent case CPU and memory use started climbing at 2pm one day, memory use levelled out overnight (with the CPU still maxed out), then continued to climb the next day before crashing the VM at about 1:30pm). From the logs, it appears that some messages are served quite quickly, but those resulting in mnesia operations are, by midnight, taking anything from 1 up to ~30 seconds /each/. The mnesia tables in question are rarely contended (there's one other process that uses them once a minute), so it's not that we're waiting for a contended lock. So, my theory: I realised that, even though our code doesn't explicitly do a selective receive (and so can always just grab the first message on the queue) mnesia probably /does/ do one to get locks and that, in all likelihood, the cost of a selective receive goes O(N) with the length of the queue. I imagine that once the queue has passed a certain point those selective receives increase the load on our process to the point that it can't keep up. By the time the input load has died back down at night, the queue is so long (~1M messages) that it's taking a serious amount of time to traverse it, meaning that even over many hours the queue isn't significantly shrunk down (a queue of one million messages being processed at one message per second is still going to take 277 hours to clear). So why do I think I might be wrong? Actually, having written all this down, I'm now less convinced that I am :) It's more that I don't want to have missed some other possibility (garbage collection? Something in the internals of gen_server?) or make pronouncements/decisions based on a theory that's flawed in some way I can't see for myself. I've reworked the system so that incoming messages are delivered by gen_server:call which keeps the queues on the mnesia-using processes to a minimum and so far testing has looked pretty good. So I guess my question is, does my theory stack up to what people familiar with the internals know? (By the way - I'm aware that the system as it's described here is kind of terrible. I've recently rewritten the bits in question to avoid mnesia entirely and the load is way down. Unfortunately I'm in that position that every developer hates where I have to support an old-and-busted system for a while before the awesome new one has been through QA and into production. Also I just want to make sure I have the best possible understanding of things that I can :)) Thanks very much if you read this far :) Cheers, Bernard From paul.joseph.davis@REDACTED Sat Mar 20 02:38:10 2010 From: paul.joseph.davis@REDACTED (Paul Joseph Davis) Date: Fri, 19 Mar 2010 21:38:10 -0400 Subject: [erlang-questions] Performance with large queues In-Reply-To: <4BA41F4B.2080000@m5net.com> References: <4BA41F4B.2080000@m5net.com> Message-ID: <1BC2120C-5067-47BF-9C73-2049572E3BD9@gmail.com> I can't speak to mnesia but gen_servers do On Mar 19, 2010, at 9:05 PM, Bernard Duggan wrote: > Hi list. > > I have a bit of an involved issue, and I'm not even entirely sure what > the question I need to ask is, so I'll explain our setup, the problem, > my theory and why I'm not 100% convinced I'm right :) > > We have a couple of what I'll call "high load" processes. At peak > times > these processes deal with a reasonably high number of messages > (hundreds > per second at least - I haven't measured exactly) and do a non-trivial > amount of work on each one - most notably several mnesia operations, > all > contained within a single transaction. They are implemented as > gen_servers. Most of the time, although they chew up a fair bit of > CPU > (maybe 50% of one core on a 4 core box at peak time), they chug along > quite happily and keep up with what's being fed to them. Twice in > the > last month, however, one of them has gotten into a state that has > ended > with a queue getting so big that it's exhausted the memory and crashed > the VM. Now that in itself wouldn't be a mystery - we've > encountered it > before with processes that simply can't service their queue fast > enough > and had that been the root of the issue then I'm quite happy that I > know > how to go about fixing it. > > What's different in this case, however, is that once the queue > passes a > certain length (I can't say how long exactly - I've inferred most of > this from crash dumps, CPU and memory use graphs and so on) the > performance of the process drops drastically to the point that it's > serving well under one message per second and even over the course > of a > night, where load drops to near-negligible levels, it doesn't even > come > close to catching up and clearing the queue. (In the most recent case > CPU and memory use started climbing at 2pm one day, memory use > levelled > out overnight (with the CPU still maxed out), then continued to climb > the next day before crashing the VM at about 1:30pm). From the > logs, it > appears that some messages are served quite quickly, but those > resulting > in mnesia operations are, by midnight, taking anything from 1 up to > ~30 > seconds /each/. The mnesia tables in question are rarely contended > (there's one other process that uses them once a minute), so it's not > that we're waiting for a contended lock. > > So, my theory: I realised that, even though our code doesn't > explicitly > do a selective receive (and so can always just grab the first > message on > the queue) mnesia probably /does/ do one to get locks and that, in all > likelihood, the cost of a selective receive goes O(N) with the > length of > the queue. I imagine that once the queue has passed a certain point > those selective receives increase the load on our process to the point > that it can't keep up. By the time the input load has died back > down at > night, the queue is so long (~1M messages) that it's taking a serious > amount of time to traverse it, meaning that even over many hours the > queue isn't significantly shrunk down (a queue of one million messages > being processed at one message per second is still going to take 277 > hours to clear). > > So why do I think I might be wrong? Actually, having written all this > down, I'm now less convinced that I am :) It's more that I don't want > to have missed some other possibility (garbage collection? Something > in > the internals of gen_server?) or make pronouncements/decisions based > on > a theory that's flawed in some way I can't see for myself. > > I've reworked the system so that incoming messages are delivered by > gen_server:call which keeps the queues on the mnesia-using processes > to > a minimum and so far testing has looked pretty good. > > So I guess my question is, does my theory stack up to what people > familiar with the internals know? > > (By the way - I'm aware that the system as it's described here is kind > of terrible. I've recently rewritten the bits in question to avoid > mnesia entirely and the load is way down. Unfortunately I'm in that > position that every developer hates where I have to support an > old-and-busted system for a while before the awesome new one has been > through QA and into production. Also I just want to make sure I have > the best possible understanding of things that I can :)) > > Thanks very much if you read this far :) > > Cheers, > > Bernard > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > From enewhuis@REDACTED Sat Mar 20 02:38:44 2010 From: enewhuis@REDACTED (Eric Newhuis) Date: Fri, 19 Mar 2010 20:38:44 -0500 Subject: [erlang-questions] Performance with large queues In-Reply-To: <4BA41F4B.2080000@m5net.com> References: <4BA41F4B.2080000@m5net.com> Message-ID: <9C56EEE7-2890-4FE7-B966-51482EA26BC9@gmail.com> I am curious if you monitor your app's page faults? A common failure pattern is high CPU from many messages, then the queue grows because the process is CPU bound, and then after the queue grows too large to fit in RAM it starts page faulting to virtual memory on disk and the CPU utilization drops. After that you're lucky to see anything like steady processing. You're likely to see bursts followed by long pauses. (I am in that minority crowd that happens to think that virtual memory is a terrible solution to the problem of poor planning.) On Mar 19, 2010, at 8:05 PM, Bernard Duggan wrote: > Hi list. > > I have a bit of an involved issue, and I'm not even entirely sure what > the question I need to ask is, so I'll explain our setup, the problem, > my theory and why I'm not 100% convinced I'm right :) > > We have a couple of what I'll call "high load" processes. At peak times > these processes deal with a reasonably high number of messages (hundreds > per second at least - I haven't measured exactly) and do a non-trivial > amount of work on each one - most notably several mnesia operations, all > contained within a single transaction. They are implemented as > gen_servers. Most of the time, although they chew up a fair bit of CPU > (maybe 50% of one core on a 4 core box at peak time), they chug along > quite happily and keep up with what's being fed to them. Twice in the > last month, however, one of them has gotten into a state that has ended > with a queue getting so big that it's exhausted the memory and crashed > the VM. Now that in itself wouldn't be a mystery - we've encountered it > before with processes that simply can't service their queue fast enough > and had that been the root of the issue then I'm quite happy that I know > how to go about fixing it. > > What's different in this case, however, is that once the queue passes a > certain length (I can't say how long exactly - I've inferred most of > this from crash dumps, CPU and memory use graphs and so on) the > performance of the process drops drastically to the point that it's > serving well under one message per second and even over the course of a > night, where load drops to near-negligible levels, it doesn't even come > close to catching up and clearing the queue. (In the most recent case > CPU and memory use started climbing at 2pm one day, memory use levelled > out overnight (with the CPU still maxed out), then continued to climb > the next day before crashing the VM at about 1:30pm). From the logs, it > appears that some messages are served quite quickly, but those resulting > in mnesia operations are, by midnight, taking anything from 1 up to ~30 > seconds /each/. The mnesia tables in question are rarely contended > (there's one other process that uses them once a minute), so it's not > that we're waiting for a contended lock. > > So, my theory: I realised that, even though our code doesn't explicitly > do a selective receive (and so can always just grab the first message on > the queue) mnesia probably /does/ do one to get locks and that, in all > likelihood, the cost of a selective receive goes O(N) with the length of > the queue. I imagine that once the queue has passed a certain point > those selective receives increase the load on our process to the point > that it can't keep up. By the time the input load has died back down at > night, the queue is so long (~1M messages) that it's taking a serious > amount of time to traverse it, meaning that even over many hours the > queue isn't significantly shrunk down (a queue of one million messages > being processed at one message per second is still going to take 277 > hours to clear). > > So why do I think I might be wrong? Actually, having written all this > down, I'm now less convinced that I am :) It's more that I don't want > to have missed some other possibility (garbage collection? Something in > the internals of gen_server?) or make pronouncements/decisions based on > a theory that's flawed in some way I can't see for myself. > > I've reworked the system so that incoming messages are delivered by > gen_server:call which keeps the queues on the mnesia-using processes to > a minimum and so far testing has looked pretty good. > > So I guess my question is, does my theory stack up to what people > familiar with the internals know? > > (By the way - I'm aware that the system as it's described here is kind > of terrible. I've recently rewritten the bits in question to avoid > mnesia entirely and the load is way down. Unfortunately I'm in that > position that every developer hates where I have to support an > old-and-busted system for a while before the awesome new one has been > through QA and into production. Also I just want to make sure I have > the best possible understanding of things that I can :)) > > Thanks very much if you read this far :) > > Cheers, > > Bernard > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > From paul.joseph.davis@REDACTED Sat Mar 20 02:44:17 2010 From: paul.joseph.davis@REDACTED (Paul Joseph Davis) Date: Fri, 19 Mar 2010 21:44:17 -0400 Subject: [erlang-questions] Performance with large queues In-Reply-To: <4BA41F4B.2080000@m5net.com> References: <4BA41F4B.2080000@m5net.com> Message-ID: <82B65076-DE6B-4898-A805-F0438FC228AC@gmail.com> Oopsie on the phone... Gen_servers do alot of selective recieves to the point that someone wrote an optimized version called gen_server2. From what I understand it basically drains the process's message box and processes from a queue. I've heard of some pretty decent performance improvements with it but I haven't measured it myself. I don't have a project URL off the top of my head but I know dynomite was using it at one point as well as a couple different projects. That said you might also want to do some light measuring of your mnesia transaction times just in case. The first thing that popped into my head was message reception as well, but it might not hurt to check. HTH, Paul Davis On Mar 19, 2010, at 9:05 PM, Bernard Duggan wrote: > Hi list. > > I have a bit of an involved issue, and I'm not even entirely sure what > the question I need to ask is, so I'll explain our setup, the problem, > my theory and why I'm not 100% convinced I'm right :) > > We have a couple of what I'll call "high load" processes. At peak > times > these processes deal with a reasonably high number of messages > (hundreds > per second at least - I haven't measured exactly) and do a non-trivial > amount of work on each one - most notably several mnesia operations, > all > contained within a single transaction. They are implemented as > gen_servers. Most of the time, although they chew up a fair bit of > CPU > (maybe 50% of one core on a 4 core box at peak time), they chug along > quite happily and keep up with what's being fed to them. Twice in > the > last month, however, one of them has gotten into a state that has > ended > with a queue getting so big that it's exhausted the memory and crashed > the VM. Now that in itself wouldn't be a mystery - we've > encountered it > before with processes that simply can't service their queue fast > enough > and had that been the root of the issue then I'm quite happy that I > know > how to go about fixing it. > > What's different in this case, however, is that once the queue > passes a > certain length (I can't say how long exactly - I've inferred most of > this from crash dumps, CPU and memory use graphs and so on) the > performance of the process drops drastically to the point that it's > serving well under one message per second and even over the course > of a > night, where load drops to near-negligible levels, it doesn't even > come > close to catching up and clearing the queue. (In the most recent case > CPU and memory use started climbing at 2pm one day, memory use > levelled > out overnight (with the CPU still maxed out), then continued to climb > the next day before crashing the VM at about 1:30pm). From the > logs, it > appears that some messages are served quite quickly, but those > resulting > in mnesia operations are, by midnight, taking anything from 1 up to > ~30 > seconds /each/. The mnesia tables in question are rarely contended > (there's one other process that uses them once a minute), so it's not > that we're waiting for a contended lock. > > So, my theory: I realised that, even though our code doesn't > explicitly > do a selective receive (and so can always just grab the first > message on > the queue) mnesia probably /does/ do one to get locks and that, in all > likelihood, the cost of a selective receive goes O(N) with the > length of > the queue. I imagine that once the queue has passed a certain point > those selective receives increase the load on our process to the point > that it can't keep up. By the time the input load has died back > down at > night, the queue is so long (~1M messages) that it's taking a serious > amount of time to traverse it, meaning that even over many hours the > queue isn't significantly shrunk down (a queue of one million messages > being processed at one message per second is still going to take 277 > hours to clear). > > So why do I think I might be wrong? Actually, having written all this > down, I'm now less convinced that I am :) It's more that I don't want > to have missed some other possibility (garbage collection? Something > in > the internals of gen_server?) or make pronouncements/decisions based > on > a theory that's flawed in some way I can't see for myself. > > I've reworked the system so that incoming messages are delivered by > gen_server:call which keeps the queues on the mnesia-using processes > to > a minimum and so far testing has looked pretty good. > > So I guess my question is, does my theory stack up to what people > familiar with the internals know? > > (By the way - I'm aware that the system as it's described here is kind > of terrible. I've recently rewritten the bits in question to avoid > mnesia entirely and the load is way down. Unfortunately I'm in that > position that every developer hates where I have to support an > old-and-busted system for a while before the awesome new one has been > through QA and into production. Also I just want to make sure I have > the best possible understanding of things that I can :)) > > Thanks very much if you read this far :) > > Cheers, > > Bernard > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > From kagato@REDACTED Sat Mar 20 02:56:26 2010 From: kagato@REDACTED (Jayson Vantuyl) Date: Fri, 19 Mar 2010 18:56:26 -0700 Subject: [erlang-questions] Performance with large queues In-Reply-To: <4BA41F4B.2080000@m5net.com> References: <4BA41F4B.2080000@m5net.com> Message-ID: <83BA4C85-2D39-4889-AA3E-BB1FEFCD6581@souja.net> Selective receive isn't super-slow if you are picking up messages at the top of the queue. Remember that the mailbox is ordered, though. It's possible that the process mailbox is collecting messages that never, ever get consumed. In that case, memory usage would climb slowly, and receives would gradually slow down. You'd probably see a tipping point like you describe. It so happens, that you can use erlang:process_info(Pid,messages) should give you a copy of the mailbox. Although, on a loaded system, perhaps you should just do message_queue_len, as the actual mailbox could be huge. Alternatively, does this behavior happen if you restart the service every, say, four hours? That would clearly indicate a problem related to accumulating one resource, such as messages or GC problems. This might be particularly useful because, assuming you just restart that process, it would also rule out any accumulation problem in Mnesia itself. Good luck! On Mar 19, 2010, at 6:05 PM, Bernard Duggan wrote: > Hi list. > > I have a bit of an involved issue, and I'm not even entirely sure what > the question I need to ask is, so I'll explain our setup, the problem, > my theory and why I'm not 100% convinced I'm right :) > > We have a couple of what I'll call "high load" processes. At peak times > these processes deal with a reasonably high number of messages (hundreds > per second at least - I haven't measured exactly) and do a non-trivial > amount of work on each one - most notably several mnesia operations, all > contained within a single transaction. They are implemented as > gen_servers. Most of the time, although they chew up a fair bit of CPU > (maybe 50% of one core on a 4 core box at peak time), they chug along > quite happily and keep up with what's being fed to them. Twice in the > last month, however, one of them has gotten into a state that has ended > with a queue getting so big that it's exhausted the memory and crashed > the VM. Now that in itself wouldn't be a mystery - we've encountered it > before with processes that simply can't service their queue fast enough > and had that been the root of the issue then I'm quite happy that I know > how to go about fixing it. > > What's different in this case, however, is that once the queue passes a > certain length (I can't say how long exactly - I've inferred most of > this from crash dumps, CPU and memory use graphs and so on) the > performance of the process drops drastically to the point that it's > serving well under one message per second and even over the course of a > night, where load drops to near-negligible levels, it doesn't even come > close to catching up and clearing the queue. (In the most recent case > CPU and memory use started climbing at 2pm one day, memory use levelled > out overnight (with the CPU still maxed out), then continued to climb > the next day before crashing the VM at about 1:30pm). From the logs, it > appears that some messages are served quite quickly, but those resulting > in mnesia operations are, by midnight, taking anything from 1 up to ~30 > seconds /each/. The mnesia tables in question are rarely contended > (there's one other process that uses them once a minute), so it's not > that we're waiting for a contended lock. > > So, my theory: I realised that, even though our code doesn't explicitly > do a selective receive (and so can always just grab the first message on > the queue) mnesia probably /does/ do one to get locks and that, in all > likelihood, the cost of a selective receive goes O(N) with the length of > the queue. I imagine that once the queue has passed a certain point > those selective receives increase the load on our process to the point > that it can't keep up. By the time the input load has died back down at > night, the queue is so long (~1M messages) that it's taking a serious > amount of time to traverse it, meaning that even over many hours the > queue isn't significantly shrunk down (a queue of one million messages > being processed at one message per second is still going to take 277 > hours to clear). > > So why do I think I might be wrong? Actually, having written all this > down, I'm now less convinced that I am :) It's more that I don't want > to have missed some other possibility (garbage collection? Something in > the internals of gen_server?) or make pronouncements/decisions based on > a theory that's flawed in some way I can't see for myself. > > I've reworked the system so that incoming messages are delivered by > gen_server:call which keeps the queues on the mnesia-using processes to > a minimum and so far testing has looked pretty good. > > So I guess my question is, does my theory stack up to what people > familiar with the internals know? > > (By the way - I'm aware that the system as it's described here is kind > of terrible. I've recently rewritten the bits in question to avoid > mnesia entirely and the load is way down. Unfortunately I'm in that > position that every developer hates where I have to support an > old-and-busted system for a while before the awesome new one has been > through QA and into production. Also I just want to make sure I have > the best possible understanding of things that I can :)) > > Thanks very much if you read this far :) > > Cheers, > > Bernard > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > -- Jayson Vantuyl kagato@REDACTED From jay@REDACTED Sat Mar 20 02:01:43 2010 From: jay@REDACTED (Jay Nelson) Date: Fri, 19 Mar 2010 18:01:43 -0700 Subject: Utility for reporting running and loaded OTP applications Message-ID: <20DD0766-7620-4FE7-ABB0-CB6A6BC2F9A8@duomark.com> Thought I would share this little function for reporting the loaded applications. I find it helpful when testing or starting up a node to see whether all the code is included. -spec report_applications() -> ok. report_applications() -> ColSizes = [15, 10, 35], FmtStr = lists:flatten( io_lib:format(" ~~-~ws ~~-~ws ~~-~ws~~n", ColSizes)), RunningApps = application:which_applications(), LoadedApps = application:loaded_applications(), report_applications("Running Applications:", FmtStr, ColSizes, RunningApps), report_applications("Loaded Applications:", FmtStr, ColSizes, LoadedApps -- RunningApps). -spec report_applications(string(), string(), [pos_integer(),...], list({atom(), [any()], [any()]}) ) -> ok. report_applications(Title, ColumnFmt, ColSizes, Apps) -> io:format("~n~s~n~n", [Title]), io:format(ColumnFmt, ["Application"," Version"," Description"]), io:format(ColumnFmt, [lists:duplicate(Count, $-) || Count <- ColSizes]), [io:format(ColumnFmt, [App, Version, Desc]) || {App, Desc, Version} <- Apps], io:format("~n"). It also shows a little format string trickery. Hopefully the email client wrapping will not mess up the code. jay From bernie@REDACTED Sat Mar 20 03:10:50 2010 From: bernie@REDACTED (Bernard Duggan) Date: Sat, 20 Mar 2010 13:10:50 +1100 Subject: [erlang-questions] Performance with large queues In-Reply-To: <82B65076-DE6B-4898-A805-F0438FC228AC@gmail.com> References: <4BA41F4B.2080000@m5net.com> <82B65076-DE6B-4898-A805-F0438FC228AC@gmail.com> Message-ID: <4BA42EAA.9020104@m5net.com> Paul Joseph Davis wrote: > Gen_servers do alot of selective recieves to the point that someone > wrote an optimized version called gen_server2. You're quite right. Looking at the gen_server code, however, the main loop does a non-selective receive and it's only "special" cases that do a selective one. Even though they're probably happening from time to time, my suspicion is that it's the regular mnesia operations which are really doing the damage. Thanks for the tip about gen_server2 - I'll definitely be taking a look at that. > That said you might also want to do some light measuring of your mnesia > transaction times just in case. The first thing that popped into my head > was message reception as well, but it might not hurt to check. The logs and profiling I did certainly pointed to the commit at the end of the transaction being where the big cost is, both in normal operation and in the bad case described. Cheers, Bernard From bernie@REDACTED Sat Mar 20 03:23:05 2010 From: bernie@REDACTED (Bernard Duggan) Date: Sat, 20 Mar 2010 13:23:05 +1100 Subject: [erlang-questions] Performance with large queues In-Reply-To: <83BA4C85-2D39-4889-AA3E-BB1FEFCD6581@souja.net> References: <4BA41F4B.2080000@m5net.com> <83BA4C85-2D39-4889-AA3E-BB1FEFCD6581@souja.net> Message-ID: <4BA43189.5000401@m5net.com> Jayson Vantuyl wrote: > Selective receive isn't super-slow if you are picking up messages at the top of the queue. Indeed, that's what I figured. In the case I describe, though, the mnesia messages being looked for will be at the end of the queue - ie the last thing to be searched. > It's possible that the process mailbox is collecting messages that never, ever get consumed. I'm not sure it is, actually, in this case - the gen_server main loop should always be popping the first message off the queue, whatever it is. > It so happens, that you can use erlang:process_info(Pid,messages) should give you a copy of the mailbox. That's an excellent idea - I know, because I had the same one :) When we first saw this issue I added a monitor to keep an eye on queue lengths, and indeed to dump the queue once it passed a certain length. This was back when it hadn't occurred to me that there was any selective receiving happening and my best theory was that something was generating a "storm" of messages. Sadly, that too has not yet made it to production. My newer changes to minimise queue length, of course, should render this moot unless I've really messed something up. > Alternatively, does this behavior happen if you restart the service every, say, four hours? Difficult to say, although in both cases it's taken more than 4 hours to reach the point of crashing the VM. The tipping point (presuming that's what it is) has happened both times under high load, and even then it runs happily for many days at a time until that point. I've done some prodding of the live systems and there's nothing obviously "building up" (in terms of memory use, ETS table size, and everything else I could think to check). Further, two other systems with similar loads were running for far longer with no issues. > Good luck! Thanks :) B From kagato@REDACTED Sat Mar 20 03:44:01 2010 From: kagato@REDACTED (Jayson Vantuyl) Date: Fri, 19 Mar 2010 19:44:01 -0700 Subject: [erlang-questions] Performance with large queues In-Reply-To: <4BA43189.5000401@m5net.com> References: <4BA41F4B.2080000@m5net.com> <83BA4C85-2D39-4889-AA3E-BB1FEFCD6581@souja.net> <4BA43189.5000401@m5net.com> Message-ID: <1A1537CD-FB8C-406A-BAE0-62BDA6FE8C60@souja.net> >> It's possible that the process mailbox is collecting messages that never, ever get consumed. > I'm not sure it is, actually, in this case - the gen_server main loop > should always be popping the first message off the queue, whatever it is. In that case, I would assume no message build-up. >> Alternatively, does this behavior happen if you restart the service every, say, four hours? > Difficult to say, although in both cases it's taken more than 4 hours to > reach the point of crashing the VM. The tipping point (presuming that's > what it is) has happened both times under high load, and even then it > runs happily for many days at a time until that point. I've done some > prodding of the live systems and there's nothing obviously "building up" > (in terms of memory use, ETS table size, and everything else I could > think to check). Further, two other systems with similar loads were > running for far longer with no issues. That was actually the idea. Assume that your gen_server dies every four hours, instead of running continuously. Mnesia doesn't. So, if the problem still occurs (and it's related to accumulation), it would be clear that it wasn't something in your gen_server. If the problem goes away, then it would be pretty clear that it was in your gen_server. -- Jayson Vantuyl kagato@REDACTED From rvirding@REDACTED Sat Mar 20 05:03:09 2010 From: rvirding@REDACTED (Robert Virding) Date: Sat, 20 Mar 2010 05:03:09 +0100 Subject: [erlang-questions] simplified attribute declaration In-Reply-To: <4BA38352.6060407@cs.ntua.gr> References: <95be1d3b1003180214o37cbdab8lb2633fde53c97fd1@mail.gmail.com> <4BA36CDB.6090109@cs.ntua.gr> <922d05851003190636o220b38b3m690b61d55fbfc60d@mail.gmail.com> <4BA38352.6060407@cs.ntua.gr> Message-ID: <3dbc6d1c1003192103m1a380000taaf80882bba463ab@mail.gmail.com> On 19 March 2010 14:59, Kostis Sagonas wrote: > > How is that different from what's happening today in other Erlang source > code? ?E.g. in code that for whatever reason the user has decided to write > as follows: > > -module(foo). > -compile(export_all). > > foo1() -> 42. > > foo2() -> (42). > > foo3() -> (((42))). > > foo4() -> (m):(bar)((42)). > > Does the compiler maintain enough information on how many parentheses the > user has written in each of these cases? It implicitly maintains enough information about the effect of the parentheses when it builds the abstract syntax tree. If the AST is printed then enough parentheses are added to make an equivalent representation. If you really want to keep all information about parentheses then you should use lisp, or LFE to get the best of both worlds. Robert From leap@REDACTED Sat Mar 20 05:15:22 2010 From: leap@REDACTED (Michael Turner) Date: Sat, 20 Mar 2010 04:15:22 +0000 Subject: [erlang-questions] Performance with large queues In-Reply-To: <9C56EEE7-2890-4FE7-B966-51482EA26BC9@gmail.com> Message-ID: On 3/20/2010, "Eric Newhuis" wrote: [snip] >(I am in that minority crowd that happens to think that virtual >memory is a terrible solution to the problem of poor planning.) Ah, the hidden costs of transparent memory hierarchies. Seymour Cray once said of cache memory: "You can't fake what you don't have." Linear searches on machines with LRU caches can take a quantum leap upward in CPU seconds consumed, once they start looping over a list that's even *one item* longer than a certain threshold value. Depending on how our producer-consumer "food chain" is arranged, maybe this can cause some kind of memory hierarchy chain reaction that percolates from L1 down through the caches and eventually to the level of virtual memory, in some systems that otherwise run smoothly most of the time. Admittedly a stretch. -michael turner >On Mar 19, 2010, at 8:05 PM, Bernard Duggan wrote: > >> Hi list. >> >> I have a bit of an involved issue, and I'm not even entirely sure what >> the question I need to ask is, so I'll explain our setup, the problem, >> my theory and why I'm not 100% convinced I'm right :) >> >> We have a couple of what I'll call "high load" processes. At peak times >> these processes deal with a reasonably high number of messages (hundreds >> per second at least - I haven't measured exactly) and do a non-trivial >> amount of work on each one - most notably several mnesia operations, all >> contained within a single transaction. They are implemented as >> gen_servers. Most of the time, although they chew up a fair bit of CPU >> (maybe 50% of one core on a 4 core box at peak time), they chug along >> quite happily and keep up with what's being fed to them. Twice in the >> last month, however, one of them has gotten into a state that has ended >> with a queue getting so big that it's exhausted the memory and crashed >> the VM. Now that in itself wouldn't be a mystery - we've encountered it >> before with processes that simply can't service their queue fast enough >> and had that been the root of the issue then I'm quite happy that I know >> how to go about fixing it. >> >> What's different in this case, however, is that once the queue passes a >> certain length (I can't say how long exactly - I've inferred most of >> this from crash dumps, CPU and memory use graphs and so on) the >> performance of the process drops drastically to the point that it's >> serving well under one message per second and even over the course of a >> night, where load drops to near-negligible levels, it doesn't even come >> close to catching up and clearing the queue. (In the most recent case >> CPU and memory use started climbing at 2pm one day, memory use levelled >> out overnight (with the CPU still maxed out), then continued to climb >> the next day before crashing the VM at about 1:30pm). From the logs, it >> appears that some messages are served quite quickly, but those resulting >> in mnesia operations are, by midnight, taking anything from 1 up to ~30 >> seconds /each/. The mnesia tables in question are rarely contended >> (there's one other process that uses them once a minute), so it's not >> that we're waiting for a contended lock. >> >> So, my theory: I realised that, even though our code doesn't explicitly >> do a selective receive (and so can always just grab the first message on >> the queue) mnesia probably /does/ do one to get locks and that, in all >> likelihood, the cost of a selective receive goes O(N) with the length of >> the queue. I imagine that once the queue has passed a certain point >> those selective receives increase the load on our process to the point >> that it can't keep up. By the time the input load has died back down at >> night, the queue is so long (~1M messages) that it's taking a serious >> amount of time to traverse it, meaning that even over many hours the >> queue isn't significantly shrunk down (a queue of one million messages >> being processed at one message per second is still going to take 277 >> hours to clear). >> >> So why do I think I might be wrong? Actually, having written all this >> down, I'm now less convinced that I am :) It's more that I don't want >> to have missed some other possibility (garbage collection? Something in >> the internals of gen_server?) or make pronouncements/decisions based on >> a theory that's flawed in some way I can't see for myself. >> >> I've reworked the system so that incoming messages are delivered by >> gen_server:call which keeps the queues on the mnesia-using processes to >> a minimum and so far testing has looked pretty good. >> >> So I guess my question is, does my theory stack up to what people >> familiar with the internals know? >> >> (By the way - I'm aware that the system as it's described here is kind >> of terrible. I've recently rewritten the bits in question to avoid >> mnesia entirely and the load is way down. Unfortunately I'm in that >> position that every developer hates where I have to support an >> old-and-busted system for a while before the awesome new one has been >> through QA and into production. Also I just want to make sure I have >> the best possible understanding of things that I can :)) >> >> Thanks very much if you read this far :) >> >> Cheers, >> >> Bernard >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED >> > > >________________________________________________________________ >erlang-questions (at) erlang.org mailing list. >See http://www.erlang.org/faq.html >To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From rvirding@REDACTED Sat Mar 20 05:21:26 2010 From: rvirding@REDACTED (Robert Virding) Date: Sat, 20 Mar 2010 05:21:26 +0100 Subject: [erlang-questions] simplified attribute declaration In-Reply-To: References: <95be1d3b1003180214o37cbdab8lb2633fde53c97fd1@mail.gmail.com> <4BA36CDB.6090109@cs.ntua.gr> <922d05851003190636o220b38b3m690b61d55fbfc60d@mail.gmail.com> <95be1d3b1003190708r7779b44al5a0b1d9dd99b1052@mail.gmail.com> Message-ID: <3dbc6d1c1003192121p14c02762kdeed57e82ad3c540@mail.gmail.com> I think that it is unfortunate that there are two ways of writing attributes, there should only be one. I definitely support fixing this bug and only allow the parenthesized version. It is also unfortunate that there is an inconsistency between the ways of writing attributes and -spec and -type, it would be better if both were done in the same way, preferably with parentheses. Adding new constructs to the language is sometimes necessary, but adding them in an inconsistent way is definitely not good. You get too many special cases. If it is decided to remove the parentheses from attributes then I definitely think we should go all the way remove the surrounding parentheses from function definition heads as well. By forcing the user to sometimes (rarely) wrap arguments with parentheses it would also be possible to remove the commas between the arguments as well. Then we could probably do the same for function calls in bodies as well, though I haven't really thought it through properly that far yet. If we start going down that path then we might as well do it properly. -module foo. -export member/1. member X [X|_] -> true; member X [_|T] -> member X T; member X [] -> false. Robert On 19 March 2010 15:53, Kenneth Lundin wrote: > For -spec and -type you don't need the surrounding parentheses right > now and we don't > regard it as a bug. > > It is possible that we will do something about the so called > inconsistency sooner or later. > > /Kenneth Erlang/OTP, Ericsson > > On Fri, Mar 19, 2010 at 3:08 PM, Vlad Dumitrescu wrote: >> 2010/3/19 Kenneth Lundin : >>> We have no plans at all to support attributes without parentheses no matter if >>> the attribute has one or several parameters. That this syntax is >>> accepted now is a >>> bug which will be corrected. >>> >>> We will also make it mandatory to have a closing parenthesis in defines. >> >> This includes -spec and -type, or is the inconsistency going to remain? >> >> best regards, >> Vlad >> > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From rvirding@REDACTED Sat Mar 20 05:31:31 2010 From: rvirding@REDACTED (Robert Virding) Date: Sat, 20 Mar 2010 05:31:31 +0100 Subject: [erlang-questions] Using -spec for callbacks when defining behaviours In-Reply-To: <95be1d3b1003171543i5849de59i12ef808f8d6dbe4d@mail.gmail.com> References: <872e77ab1003170401u54f391cdi181d67eca20012af@mail.gmail.com> <4BA0F842.6050706@cs.ntua.gr> <95be1d3b1003171543i5849de59i12ef808f8d6dbe4d@mail.gmail.com> Message-ID: <3dbc6d1c1003192131p743b743am8a0ca52e6ca0156e@mail.gmail.com> On 17 March 2010 23:43, Vlad Dumitrescu wrote: > ... > I am well aware that many will hate the idea (which can be improved), > but I'm sure that at least as many hate the idea of "strings as > complex data types that the compiler doesn't know about and tools have > to know about of all these special cases". I don't know yet if I like your idea but I definitely agree with you and also dislike "strings as complex data types ...". In that case you might as well put the info in comments so it can more easily ignored. Robert From kostis@REDACTED Sat Mar 20 07:12:24 2010 From: kostis@REDACTED (Kostis Sagonas) Date: Sat, 20 Mar 2010 08:12:24 +0200 Subject: [erlang-questions] httph_bin works, but missing from type spec In-Reply-To: <32A84B39-61E5-4C53-A81E-C0F488B9BC48@duomark.com> References: <32A84B39-61E5-4C53-A81E-C0F488B9BC48@duomark.com> Message-ID: <4BA46748.8030804@cs.ntua.gr> Jay Nelson wrote: > http_reply.erl:147: > > The call erlang:decode_packet('httph_bin',Binary::binary(),[]) will > never return since it differs in the 1st argument from the success > typing arguments: > > ('asn1' | 'cdr' | 'fcgi' | 'http' | 'http_bin' | 'httph' | 'line' | > 'raw' | 'sunrm' | 'tpkt' | 0 | 1 | 2 | 4,binary(), > [{'line_length',non_neg_integer()} | > {'packet_size',non_neg_integer()}]) > > > The function works just fine but dialyzer complains. This can be fixed by the following patch, which will also appear in R14. Kostis ================ RCS file: /hipe/otp/lib/hipe/cerl/erl_bif_types.erl,v retrieving revision 1.263 diff -u -r1.263 erl_bif_types.erl --- lib/hipe/cerl/erl_bif_types.erl 16 Feb 2010 13:56:50 -0000 1.263 +++ lib/hipe/cerl/erl_bif_types.erl 20 Mar 2010 06:11:45 -0000 @@ -4534,7 +4534,7 @@ t_tuple([t_atom('line_length'), t_non_neg_integer()])]). t_decode_packet_type() -> - t_sup(t_inet_setoption_packettype(), t_atom('httph')). + t_sup([t_inet_setoption_packettype(), t_atom('httph'), t_atom('httph_bin')]). t_dist_exit() -> t_sup([t_atom('kill'), t_atom('noconnection'), t_atom('normal')]). From bgustavsson@REDACTED Sat Mar 20 10:45:52 2010 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Sat, 20 Mar 2010 10:45:52 +0100 Subject: [erlang-questions] Erlang list comprehension optimization In-Reply-To: <6a9ba5691003191355q695c8ef7rd316d4833846057c@mail.gmail.com> References: <23237d041003162017h628bdfd8hc9be35f3432e9ece@mail.gmail.com> <4BA04C4B.7060307@m5net.com> <3dbc6d1c1003162107g65e313f1g8255c724013abef7@mail.gmail.com> <6672d0161003170030q297d69c7sac2ba66e46de9f2f@mail.gmail.com> <6a9ba5691003191355q695c8ef7rd316d4833846057c@mail.gmail.com> Message-ID: <6672d0161003200245i55cef113y338b151ab95c77c9@mail.gmail.com> On Fri, Mar 19, 2010 at 9:55 PM, caio ariede wrote: > Just a small question. > > http://www.erlang.org/doc/efficiency_guide/listHandling.html#id2261027 > > 'lc^0'([E|Tail], Expr) -> > ? ?Expr(E), > ? ?'lc^0'(Tail, Expr); > 'lc^0'([], _Expr) -> []. > > > Where this name ('lc^0') is generated? The name "lc^0" is just an example. The actual name is more complicated. The name is generated by the v3_core module. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From jvliwanag@REDACTED Sat Mar 20 11:00:34 2010 From: jvliwanag@REDACTED (Jan Vincent) Date: Sat, 20 Mar 2010 18:00:34 +0800 Subject: [erlang-questions] Speeding-up escript's starting time In-Reply-To: <18a1db031003191131o56d823dv8fc04b3020c69bef@mail.gmail.com> References: <18a1db031003191131o56d823dv8fc04b3020c69bef@mail.gmail.com> Message-ID: <5C7E9437-2CB9-41B0-ABC1-A723135CACC4@gmail.com> Not exactly a solution. But I had this problem as well. I ended up writing a small private mochiweb app and I simply use curl to invoke it. On Mar 20, 2010, at 2:31 AM, zabrane Mikael wrote: > Hi List, > > I've an "escript" command used for batch processing. > Each time a "data" appears in a special directory, this "escript" command > handle it (apply some tranformations on it ...). > I've noticed that my escript's "starting time" isn't fast enough and I'm > wondering if there's a way to gain some speed. > > N.B: the only constraint here is to use this "escript" command and nothing > else. > > Regards > Zabrane Jan Vincent Liwanag jvliwanag@REDACTED From steven.charles.davis@REDACTED Sat Mar 20 11:17:52 2010 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sat, 20 Mar 2010 03:17:52 -0700 (PDT) Subject: Using -spec for callbacks when defining behaviours In-Reply-To: <3dbc6d1c1003192131p743b743am8a0ca52e6ca0156e@mail.gmail.com> References: <872e77ab1003170401u54f391cdi181d67eca20012af@mail.gmail.com> <4BA0F842.6050706@cs.ntua.gr> <95be1d3b1003171543i5849de59i12ef808f8d6dbe4d@mail.gmail.com> <3dbc6d1c1003192131p743b743am8a0ca52e6ca0156e@mail.gmail.com> Message-ID: Hi Robert, I most definitely share a strong negative reaction to: "strings as complex data types ..." Strings as a "type" are entirely bogus in my opinion. e.g. in SUCS (Steve's universal character set) the word "String" is by definition encoded as: <<0,1,2,3,4,5>> ...since the octet values for this charset standard happen to map as follows... 16#00 = "S", 16#01 = "t", 16#02 = "r", etc. regs, /s From steven.charles.davis@REDACTED Sat Mar 20 11:26:23 2010 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sat, 20 Mar 2010 03:26:23 -0700 (PDT) Subject: Using -spec for callbacks when defining behaviours In-Reply-To: <187b9671-8a9a-43c4-8554-a308220a9676@l25g2000yqd.googlegroups.com> References: <872e77ab1003170401u54f391cdi181d67eca20012af@mail.gmail.com> <3d94c7e4-2c1a-4826-9c45-7ca453cbee15@e1g2000yqh.googlegroups.com> <187b9671-8a9a-43c4-8554-a308220a9676@l25g2000yqd.googlegroups.com> Message-ID: <2a4dd2f5-5852-445d-bc8d-07d1dc7e4033@j21g2000yqh.googlegroups.com> Hi Mikael, A serious omission from "interfaces" that simply enforce type is that they totally ignore the concept of state, and are therefore necessarily incomplete. Contracts (as illustrated by UBF) are definitely more satisfactory... If I am understanding the problem correctly (and it's more than possible I am not), you'd generally apply contracts to protocols (i.e. to the messages exchanged), not to the specific arguments presented to the API functions used for any protocol implementation. regs, /s On Mar 19, 3:59?am, Mikael Karlsson wrote: > > Erlang is very efficient to implement applications in and as long as > you roll your own stuff or are within a tight group I think your > points apply, but I would like to argue that for building large > community based infrastructure it is very important to be able to have > useful interface specifications/contracts. > From luismarianoguerra@REDACTED Sat Mar 20 12:26:55 2010 From: luismarianoguerra@REDACTED (Mariano Guerra) Date: Sat, 20 Mar 2010 12:26:55 +0100 Subject: [ANN] efene 0.3 released, a language for the erlang VM Message-ID: if someone thinks that this announcements are out of place in this list, please let me know and I will stop posting them. any comment on the language will be welcome. ====================================================================================================== third release of efene. efene is a programming language that runs on the erlang virtual machine. the idea is to provide an alternative syntax to erlang that is most suitable for people coming from languages like Java, C, C++, C#, Javascript. the language is almost 100% compatible with erlang (and will be), the compiler allows to translate an efene source file into a readable erlang one or compile it directly to bytecode. It also adds some syntactic sugar in some places to make some tasks easier. changes ====== * interactive interpreter (try it with fnc -s) $ fnc -s efene 0.3 exit with Ctrl+D >>> A = 2 2 >>> B = A * 3 6 >>> F = fn (Name) { io.format("hi ~s!~n" [Name]) } #Fun >>> F("efene") hi efene! ok * command line eval $ fnc -c "io.format(\"hello world~n\")" hello world >>> io.format("hello world~n") ok * command line eval that translate the expression to erlang $ fnc -C "io.format(\"hello world~n\")" hello world 1> io:format("hello world~n") ok * get the exception type in a variable try { } catch _Type Error { } * allow to pattern match values inside lists and tuples test = fn (('+' = Op Num)) { io.format("~p ~p~n", [Op Num]) } * allow new lines between items in lists and tuples A = (1 2 3 4 5 6) * allow multiple files to be passed as arguments to fnc $ fnc file1.fn file2.fn file3.fn * efene compiler rewritten in efene for a complete reference see the LanguageReference[1] Participate ======== a mailing list is available at librelist just send a mail to efene@REDACTED to subscribe. as first mail you may send a hello world program in efene and present yourself by saying your name, where you are, how did you heard about efene and anything else you would like to say. [1] http://wiki.github.com/marianoguerra/efene/languagereference From karlsson.rm@REDACTED Sat Mar 20 12:50:55 2010 From: karlsson.rm@REDACTED (Mikael Karlsson) Date: Sat, 20 Mar 2010 04:50:55 -0700 (PDT) Subject: Using -spec for callbacks when defining behaviours In-Reply-To: <2a4dd2f5-5852-445d-bc8d-07d1dc7e4033@j21g2000yqh.googlegroups.com> References: <872e77ab1003170401u54f391cdi181d67eca20012af@mail.gmail.com> <3d94c7e4-2c1a-4826-9c45-7ca453cbee15@e1g2000yqh.googlegroups.com> <187b9671-8a9a-43c4-8554-a308220a9676@l25g2000yqd.googlegroups.com> <2a4dd2f5-5852-445d-bc8d-07d1dc7e4033@j21g2000yqh.googlegroups.com> Message-ID: <5502c815-600b-4fde-955d-b8a53a6bb154@x12g2000yqx.googlegroups.com> On Mar 20, 11:26?am, Steve Davis wrote: > Hi Mikael, > > A serious omission from "interfaces" that simply enforce type is that > they totally ignore the concept of state, and are therefore > necessarily incomplete. > Contracts (as illustrated by UBF) are definitely more satisfactory... > If I am understanding the problem correctly (and it's more than > possible I am not), you'd generally apply contracts to protocols (i.e. > to the messages exchanged), not to the specific arguments presented to > the API functions used for any protocol implementation. > > regs, > /s > Well, I have a vague idea that contracts may be protocols but also constraints on arguments (or state data) and that you need to check them at runtime (see example on contract check in my reply to Kostis earlier in this thread). Not all interfaces/protocols carry state, simple client-server non- transactional requests (like HTTP), for instance and compile time type checking can cover a lot of an interface specificaton, but in order to have "everything" in place you probably need to complement with contract (run-time) checks. Regards Mikael From lovei.laszlo@REDACTED Sat Mar 20 13:12:55 2010 From: lovei.laszlo@REDACTED (Laszlo Lovei) Date: Sat, 20 Mar 2010 05:12:55 -0700 (PDT) Subject: simplified attribute declaration In-Reply-To: <4BA36CDB.6090109@cs.ntua.gr> References: <95be1d3b1003180214o37cbdab8lb2633fde53c97fd1@mail.gmail.com> <4BA36CDB.6090109@cs.ntua.gr> Message-ID: <32c9cbcc-9753-440d-81a7-fedcbd2459bd@u9g2000yqb.googlegroups.com> On Mar 19, 1:23?pm, Kostis Sagonas wrote: > > What is really happening is that attributes which take just one argument > do not need to be enclosed in parentheses. On the other hand, attributes > with more than one argument (read: whenever there is a ',' involved, as > in the case of -define above) need to be enclosed in parentheses. Does this mean that you also consider accepting "-record f, {f}." a buggy behaviour? Because erl_parse.yrl explicitly supports it: http://github.com/erlang/otp/blob/dev/lib/stdlib/src/erl_parse.yrl#L77 attribute -> '-' atom attr_val attribute -> '-' atom typed_attr_val attribute -> '-' atom '(' typed_attr_val ')' attribute -> '-' 'spec' type_spec typed_attr_val -> expr ',' typed_record_fields typed_attr_val -> expr '::' top_type attr_val -> expr attr_val -> expr ',' exprs attr_val -> '(' expr ',' exprs ')' > -module hello_world . > -export [init/1, stop/2] . > > -define (DEBUG(X), io:format("debug: ~p~n", [X])) . > > So, in the last case, it's really the ',' that forces the parentheses. No, in this case the preprocessor forces the parentheses: http://github.com/erlang/otp/blob/dev/lib/stdlib/src/epp.erl#L492 > Personally, I do not see any compelling reason why one should be > REQUIRED to put parentheses around the single argument of unary > attributes. Consistency with other parts of the language? In the other hand, I do not see any compelling reason why should we write -type and -spec without parentheses. Laszlo From tuncer.ayaz@REDACTED Sat Mar 20 17:19:08 2010 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Sat, 20 Mar 2010 17:19:08 +0100 Subject: [erlang-questions] Speeding-up escript's starting time In-Reply-To: <5C7E9437-2CB9-41B0-ABC1-A723135CACC4@gmail.com> References: <18a1db031003191131o56d823dv8fc04b3020c69bef@mail.gmail.com> <5C7E9437-2CB9-41B0-ABC1-A723135CACC4@gmail.com> Message-ID: <4ac8254d1003200919u187337d0v1c081d42bad0cf58@mail.gmail.com> On Mar 20, 2010, at 2:31 AM, zabrane Mikael wrote: > Hi List, > > I've an "escript" command used for batch processing. > Each time a "data" appears in a special directory, this "escript" command > handle it (apply some tranformations on it ...). > I've noticed that my escript's "starting time" isn't fast enough and I'm > wondering if there's a way to gain some speed. > > N.B: the only constraint here is to use this "escript" command and nothing > else. Have you tried measuring how much of the startup time is in hostname lookup? I was able to shave off a whole second just by configuring ERL_INETRC to use the hosts file 1st on one particular system where I had quite noticeable startup delays. Also try -connect_all false as a test. On my Linux machines the VM usually starts up fast enough to be negligible when used via escript. From torben.lehoff@REDACTED Sat Mar 20 17:57:51 2010 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Sat, 20 Mar 2010 17:57:51 +0100 Subject: [erlang-questions] [ANN] efene 0.3 released, a language for the erlang VM In-Reply-To: References: Message-ID: Hi Mariano, I think that you should continue to post here. Your effort might help spread the usage of Erlang so do keep up the good work and keep the rest of us informed about your progress. Cheers, Torben On Sat, Mar 20, 2010 at 12:26, Mariano Guerra wrote: > if someone thinks that this announcements are out of place in this > list, please let me know and I will stop posting them. > > any comment on the language will be welcome. > > > ====================================================================================================== > > third release of efene. > > efene is a programming language that runs on the erlang virtual machine. > > the idea is to provide an alternative syntax to erlang that is most > suitable for people coming from languages like Java, C, C++, C#, > Javascript. > > the language is almost 100% compatible with erlang (and will be), the > compiler allows to translate an efene source file into a readable > erlang one or compile it directly to bytecode. It also adds some > syntactic sugar in some places to make some tasks easier. > > changes > ====== > > * interactive interpreter (try it with fnc -s) > > $ fnc -s > efene 0.3 exit with Ctrl+D > >>> A = 2 > 2 > >>> B = A * 3 > 6 > >>> F = fn (Name) { io.format("hi ~s!~n" [Name]) } > #Fun > >>> F("efene") > hi efene! > ok > > * command line eval > > $ fnc -c "io.format(\"hello world~n\")" > hello world > >>> io.format("hello world~n") > ok > > * command line eval that translate the expression to erlang > > $ fnc -C "io.format(\"hello world~n\")" > hello world > 1> io:format("hello world~n") > ok > > * get the exception type in a variable > > try { > > } catch _Type Error { > > } > > * allow to pattern match values inside lists and tuples > > test = fn (('+' = Op Num)) { > io.format("~p ~p~n", [Op Num]) > } > > * allow new lines between items in lists and tuples > > A = (1 2 3 > 4 5 6) > > * allow multiple files to be passed as arguments to fnc > > $ fnc file1.fn file2.fn file3.fn > > * efene compiler rewritten in efene > > for a complete reference see the LanguageReference[1] > > Participate > ======== > > a mailing list is available at librelist just send a mail to > efene@REDACTED to subscribe. > > as first mail you may send a hello world program in efene and present > yourself by saying your name, where you are, how did you heard about > efene and anything else you would like to say. > > [1] http://wiki.github.com/marianoguerra/efene/languagereference > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > -- http://www.linkedin.com/in/torbenhoffmann From steven.charles.davis@REDACTED Sat Mar 20 20:46:44 2010 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sat, 20 Mar 2010 12:46:44 -0700 (PDT) Subject: Using -spec for callbacks when defining behaviours In-Reply-To: <5502c815-600b-4fde-955d-b8a53a6bb154@x12g2000yqx.googlegroups.com> References: <872e77ab1003170401u54f391cdi181d67eca20012af@mail.gmail.com> <3d94c7e4-2c1a-4826-9c45-7ca453cbee15@e1g2000yqh.googlegroups.com> <187b9671-8a9a-43c4-8554-a308220a9676@l25g2000yqd.googlegroups.com> <2a4dd2f5-5852-445d-bc8d-07d1dc7e4033@j21g2000yqh.googlegroups.com> <5502c815-600b-4fde-955d-b8a53a6bb154@x12g2000yqx.googlegroups.com> Message-ID: <00f9fc8f-c5a9-4b3b-ada4-aafc437292a7@t20g2000yqe.googlegroups.com> Hi Mikael, You make good points (consistently). I'm wondering, and this is probably amounts to "my input" here, whether further research into contracts may be an interesting way to go with this. In order to validate large components, you'd "run them under contract" to check their behavior. "Component" is not a terminology i'm fond of, thanks to the stunning range of meaning assigned to that word; but if you have a "component" that is sufficiently complex as to require a formalized interface, you may be better advised to establish a full protocol for it. For sure, you'd be very ill-advised to rely on static checks and not test it thoroughly prior to committing to its use by other apps/subsystems/ components. Best regards, Steve ps. Whilst HTTP is indeed stateless, it's very interesting to observe that a considerable amount of effort is put in worldwide every single day to make it look otherwise! On Mar 20, 6:50?am, Mikael Karlsson wrote: > Well, I have a vague idea that contracts may be protocols but also > constraints on arguments (or state data) and that you need to check > them at runtime (see example on contract check in my reply to Kostis > earlier in this thread). > Not all interfaces/protocols carry state, simple client-server non- > transactional requests (like HTTP), for instance and compile time type > checking can cover a lot of an interface specificaton, but in order to > have "everything" in place you probably need to complement with > contract (run-time) checks. From mailtome200420032002@REDACTED Sat Mar 20 19:59:54 2010 From: mailtome200420032002@REDACTED (john blair) Date: Sat, 20 Mar 2010 11:59:54 -0700 (PDT) Subject: error compiling r13b04: /usr/include/nptl/pthread.h:658: error: array type has incomplete element type Message-ID: <491091.24684.qm@web53104.mail.re2.yahoo.com> I am building the latest release r13b04 on a lin64 machine (RHEL 3.8) with gcc-4.1.1 and get the following error: gcc -DUSE_THREADS -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS -D_POSIX_THREAD_SAFE_FUNCTIONS -isystem /usr/include/nptl -g -O3 -I/opt/src/erlang-otp-r13b04/otp_src_R13B04/erts/x86_64-unknown-linux-gnu -I/opt/lin64/ncurses-5.5/include -D_GNU_SOURCE -fomit-frame-pointer -Wall -Wstrict-prototypes -Wmissing-prototypes -Wdeclaration-after-statement -DHAVE_CONFIG_H -I../include -I../include/x86_64-unknown-linux-gnu -I../include/internal -I../include/internal/x86_64-unknown-linux-gnu -I../emulator/beam -I../emulator/sys/unix -c common/ethread.c -o obj/x86_64-unknown-linux-gnu/opt/r/ethread.o In file included from ../include/internal/ethread.h:124, from common/ethread.c:68: /usr/include/nptl/pthread.h:658: error: array type has incomplete element type make[5]: *** [obj/x86_64-unknown-linux-gnu/opt/r/ethread.o] Error 1 make[5]: Leaving directory `/opt/src/erlang-otp-r13b04/otp_src_R13B04/erts/lib_src' make[4]: *** [opt] Error 2 make[4]: Leaving directory `/opt/src/erlang-otp-r13b04/otp_src_R13B04/erts/lib_src' make[3]: *** [erts_lib] Error 2 make[3]: Leaving directory `/opt/src/erlang-otp-r13b04/otp_src_R13B04/erts/emulator' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/opt/src/erlang-otp-r13b04/otp_src_R13B04/erts/emulator' make[1]: *** [smp] Error 2 make[1]: Leaving directory `/opt/src/erlang-otp-r13b04/otp_src_R13B04/erts' make: *** [emulator] Error 2 Anyone knows how to resolve this? From max.lapshin@REDACTED Sat Mar 20 21:41:25 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Sat, 20 Mar 2010 23:41:25 +0300 Subject: match_delete and fun2ms Message-ID: Is it possible to delete entries from ets, basing on fun2ms spec? Spec = ets:fun2ms(fun(#video_frame{dts = TS} ) when TS < Limit -> true end), Count = ets:select_count(Frames, Spec), ets:match_delete(Frames, Spec) This code shows me increasing Count, but doesn't delete anything. From mikpe@REDACTED Sat Mar 20 21:42:29 2010 From: mikpe@REDACTED (Mikael Pettersson) Date: Sat, 20 Mar 2010 21:42:29 +0100 Subject: [erlang-questions] error compiling r13b04: /usr/include/nptl/pthread.h:658: error: array type has incomplete element type In-Reply-To: <491091.24684.qm@web53104.mail.re2.yahoo.com> References: <491091.24684.qm@web53104.mail.re2.yahoo.com> Message-ID: <19365.13109.566495.585865@pilspetsen.it.uu.se> john blair writes: > I am building the latest release r13b04 on a lin64 machine (RHEL 3.8) with gcc-4.1.1 and get the following error: > > gcc -DUSE_THREADS -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS -D_POSIX_THREAD_SAFE_FUNCTIONS -isystem /usr/include/nptl -g -O3 -I/opt/src/erlang-otp-r13b04/otp_src_R13B04/erts/x86_64-unknown-linux-gnu -I/opt/lin64/ncurses-5.5/include -D_GNU_SOURCE -fomit-frame-pointer -Wall -Wstrict-prototypes -Wmissing-prototypes -Wdeclaration-after-statement -DHAVE_CONFIG_H -I../include -I../include/x86_64-unknown-linux-gnu -I../include/internal -I../include/internal/x86_64-unknown-linux-gnu -I../emulator/beam -I../emulator/sys/unix -c common/ethread.c -o obj/x86_64-unknown-linux-gnu/opt/r/ethread.o > In file included from ../include/internal/ethread.h:124, > from common/ethread.c:68: > /usr/include/nptl/pthread.h:658: error: array type has incomplete element type > make[5]: *** [obj/x86_64-unknown-linux-gnu/opt/r/ethread.o] Error 1 > make[5]: Leaving directory `/opt/src/erlang-otp-r13b04/otp_src_R13B04/erts/lib_src' > make[4]: *** [opt] Error 2 > make[4]: Leaving directory `/opt/src/erlang-otp-r13b04/otp_src_R13B04/erts/lib_src' > make[3]: *** [erts_lib] Error 2 > make[3]: Leaving directory `/opt/src/erlang-otp-r13b04/otp_src_R13B04/erts/emulator' > make[2]: *** [opt] Error 2 > make[2]: Leaving directory `/opt/src/erlang-otp-r13b04/otp_src_R13B04/erts/emulator' > make[1]: *** [smp] Error 2 > make[1]: Leaving directory `/opt/src/erlang-otp-r13b04/otp_src_R13B04/erts' > make: *** [emulator] Error 2 This is your gcc complaining about your system's glibc headers. This is not an Erlang bug. The warning in question was common when gcc-4.1 was new, lots of slightly broken code had to be repaired for it. But that was ages ago. > Anyone knows how to resolve this? Use the system gcc (RHEL3 seems to use gcc-3.2.3) or update the entire system to something less antique. A self-compiled gcc-3.4.6 might work too. From zabrane3@REDACTED Sat Mar 20 22:16:57 2010 From: zabrane3@REDACTED (zabrane Mikael) Date: Sat, 20 Mar 2010 22:16:57 +0100 Subject: [erlang-questions] Speeding-up escript's starting time In-Reply-To: <5C7E9437-2CB9-41B0-ABC1-A723135CACC4@gmail.com> References: <18a1db031003191131o56d823dv8fc04b3020c69bef@mail.gmail.com> <5C7E9437-2CB9-41B0-ABC1-A723135CACC4@gmail.com> Message-ID: <18a1db031003201416r3c9b5335n73c683ac2c6599d3@mail.gmail.com> Thanks for the hints ... 2010/3/20 Jan Vincent > Not exactly a solution. But I had this problem as well. I ended up writing > a small private mochiweb app and I simply use curl to invoke it. > > On Mar 20, 2010, at 2:31 AM, zabrane Mikael wrote: > > > Hi List, > > > > I've an "escript" command used for batch processing. > > Each time a "data" appears in a special directory, this "escript" command > > handle it (apply some tranformations on it ...). > > I've noticed that my escript's "starting time" isn't fast enough and I'm > > wondering if there's a way to gain some speed. > > > > N.B: the only constraint here is to use this "escript" command and > nothing > > else. > > > > Regards > > Zabrane > > Jan Vincent Liwanag > jvliwanag@REDACTED > > > > From mailtome200420032002@REDACTED Sat Mar 20 22:12:32 2010 From: mailtome200420032002@REDACTED (john blair) Date: Sat, 20 Mar 2010 14:12:32 -0700 (PDT) Subject: [erlang-questions] error compiling r13b04: /usr/include/nptl/pthread.h:658: error: array type has incomplete element type In-Reply-To: <19365.13109.566495.585865@pilspetsen.it.uu.se> Message-ID: <33256.20645.qm@web53105.mail.re2.yahoo.com> Thanks for reply Mikael. I tried building it with gcc-4.1.2, gcc-4.2.4 but got the same error. Finally I removed the package nptl-devel and it built successfully. --- On Sun, 3/21/10, Mikael Pettersson wrote: > From: Mikael Pettersson > Subject: Re: [erlang-questions] error compiling r13b04: /usr/include/nptl/pthread.h:658: error: array type has incomplete element type > To: "john blair" > Cc: erlang-questions@REDACTED > Date: Sunday, March 21, 2010, 2:12 AM > john blair writes: > > I am building the latest release r13b04 on a lin64 > machine (RHEL 3.8) with gcc-4.1.1 and get the following > error: > > > > gcc -DUSE_THREADS -D_THREAD_SAFE -D_REENTRANT > -DPOSIX_THREADS -D_POSIX_THREAD_SAFE_FUNCTIONS -isystem > /usr/include/nptl? -g -O3 > -I/opt/src/erlang-otp-r13b04/otp_src_R13B04/erts/x86_64-unknown-linux-gnu???-I/opt/lin64/ncurses-5.5/include > -D_GNU_SOURCE -fomit-frame-pointer -Wall -Wstrict-prototypes > -Wmissing-prototypes -Wdeclaration-after-statement > -DHAVE_CONFIG_H? -I../include > -I../include/x86_64-unknown-linux-gnu -I../include/internal > -I../include/internal/x86_64-unknown-linux-gnu > -I../emulator/beam -I../emulator/sys/unix -c > common/ethread.c -o > obj/x86_64-unknown-linux-gnu/opt/r/ethread.o > > In file included from > ../include/internal/ethread.h:124, > >? ? ? ? ? ? ? > ? ? from common/ethread.c:68: > > /usr/include/nptl/pthread.h:658: error: array type > has incomplete element type > > make[5]: *** > [obj/x86_64-unknown-linux-gnu/opt/r/ethread.o] Error 1 > > make[5]: Leaving directory > `/opt/src/erlang-otp-r13b04/otp_src_R13B04/erts/lib_src' > > make[4]: *** [opt] Error 2 > > make[4]: Leaving directory > `/opt/src/erlang-otp-r13b04/otp_src_R13B04/erts/lib_src' > > make[3]: *** [erts_lib] Error 2 > > make[3]: Leaving directory > `/opt/src/erlang-otp-r13b04/otp_src_R13B04/erts/emulator' > > make[2]: *** [opt] Error 2 > > make[2]: Leaving directory > `/opt/src/erlang-otp-r13b04/otp_src_R13B04/erts/emulator' > > make[1]: *** [smp] Error 2 > > make[1]: Leaving directory > `/opt/src/erlang-otp-r13b04/otp_src_R13B04/erts' > > make: *** [emulator] Error 2 > > This is your gcc complaining about your system's glibc > headers. > This is not an Erlang bug. > > The warning in question was common when gcc-4.1 was new, > lots of > slightly broken code had to be repaired for it. But that > was ages ago. > > > Anyone knows how to resolve this? > > Use the system gcc (RHEL3 seems to use gcc-3.2.3) or update > the entire system > to something less antique. > > A self-compiled gcc-3.4.6 might work too. > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From erlang@REDACTED Sat Mar 20 23:16:28 2010 From: erlang@REDACTED (Dominic Williams) Date: Sat, 20 Mar 2010 23:16:28 +0100 Subject: [erlang-questions] [proposal] Declarative syntax for metadata (long!) In-Reply-To: <95be1d3b1003190702j1096b838vdeda7302b6780186@mail.gmail.com> References: <95be1d3b1003180434l7e76c610if40faed29efa647c@mail.gmail.com> <9b08084c1003180606g68f1c060r10635f571b6c642c@mail.gmail.com> <95be1d3b1003190702j1096b838vdeda7302b6780186@mail.gmail.com> Message-ID: <4256C136-DE2A-4560-9D81-38070B9ECFDD@dominicwilliams.net> Hi, Le 19 mars 2010 ? 15:02, Vlad Dumitrescu a ?crit : >> But for everyday programming, I'm afraid introducing reification would actually make Erlang less simple, less easy to reason about, less reliable... and these properties of Erlang are more important to me, given that I want to ship working software quickly, than being able to do cool things with reification. > > Well, for the first thing, this kind of functionality shouldn't affect > anything else unless it is used, just as little as I would not be > affected at all if asn1 or megaco would be the buggiest applications > on the planet. But asn1 and megaco are just erlang applications and modules. Using them or not does not affect the appearance and understandability of one's code. What you are suggesting is a change in the language. People will use it, so the possible disadvantages have to weighed against the possible benefits. >> I can see one area which would become much easier to work on: development tools. > > Yes, that is one. And my (partial) opinion is that they are quite > important. Good tool support is essential and tool developers deserve > help too :) The same kind of reification/introspection exists and in > some places could be improved even at system level (to help manage > installed applications, for example) and in the runtime (process > management). Agreed, tool support is important. But if it's the only area that needs reification? >> I've always been a fan of Joe's principle that for every thing one adds to Erlang, one should remove something else - so since Joe is supporting adding introspection, I'm interested to hear what he would be prepared to remove in exchange? > > I'm not Joe, but in my previous message to the list I mentioned > something that could be removed :) Sorry, I've read your previous message 3 times but cannot see it. Cheers, Dominic From erlang@REDACTED Sat Mar 20 23:32:55 2010 From: erlang@REDACTED (Dominic Williams) Date: Sat, 20 Mar 2010 23:32:55 +0100 Subject: [erlang-questions] Performance with large queues In-Reply-To: <4BA41F4B.2080000@m5net.com> References: <4BA41F4B.2080000@m5net.com> Message-ID: Hi Bernard, Le 20 mars 2010 ? 02:05, Bernard Duggan a ?crit : > Hi list. > > I have a bit of an involved issue, and I'm not even entirely sure what > the question I need to ask is, so I'll explain our setup, the problem, > my theory and why I'm not 100% convinced I'm right :) > > We have a couple of what I'll call "high load" processes. At peak times > these processes deal with a reasonably high number of messages (hundreds > per second at least - I haven't measured exactly) and do a non-trivial > amount of work on each one - most notably several mnesia operations, all > contained within a single transaction. They are implemented as > gen_servers. Most of the time, although they chew up a fair bit of CPU > (maybe 50% of one core on a 4 core box at peak time), they chug along > quite happily and keep up with what's being fed to them. Twice in the > last month, however, one of them has gotten into a state that has ended > with a queue getting so big that it's exhausted the memory and crashed > the VM. Now that in itself wouldn't be a mystery - we've encountered it > before with processes that simply can't service their queue fast enough > and had that been the root of the issue then I'm quite happy that I know > how to go about fixing it. > > What's different in this case, however, is that once the queue passes a > certain length (I can't say how long exactly - I've inferred most of > this from crash dumps, CPU and memory use graphs and so on) the > performance of the process drops drastically to the point that it's > serving well under one message per second and even over the course of a > night, where load drops to near-negligible levels, it doesn't even come > close to catching up and clearing the queue. (In the most recent case > CPU and memory use started climbing at 2pm one day, memory use levelled > out overnight (with the CPU still maxed out), then continued to climb > the next day before crashing the VM at about 1:30pm). From the logs, it > appears that some messages are served quite quickly, but those resulting > in mnesia operations are, by midnight, taking anything from 1 up to ~30 > seconds /each/. The mnesia tables in question are rarely contended > (there's one other process that uses them once a minute), so it's not > that we're waiting for a contended lock. > > So, my theory: I realised that, even though our code doesn't explicitly > do a selective receive (and so can always just grab the first message on > the queue) mnesia probably /does/ do one to get locks and that, in all > likelihood, the cost of a selective receive goes O(N) with the length of > the queue. I imagine that once the queue has passed a certain point > those selective receives increase the load on our process to the point > that it can't keep up. By the time the input load has died back down at > night, the queue is so long (~1M messages) that it's taking a serious > amount of time to traverse it, meaning that even over many hours the > queue isn't significantly shrunk down (a queue of one million messages > being processed at one message per second is still going to take 277 > hours to clear). > > So why do I think I might be wrong? Actually, having written all this > down, I'm now less convinced that I am :) It's more that I don't want > to have missed some other possibility (garbage collection? Something in > the internals of gen_server?) or make pronouncements/decisions based on > a theory that's flawed in some way I can't see for myself. > > I've reworked the system so that incoming messages are delivered by > gen_server:call which keeps the queues on the mnesia-using processes to > a minimum and so far testing has looked pretty good. > > So I guess my question is, does my theory stack up to what people > familiar with the internals know? > > (By the way - I'm aware that the system as it's described here is kind > of terrible. I've recently rewritten the bits in question to avoid > mnesia entirely and the load is way down. Unfortunately I'm in that > position that every developer hates where I have to support an > old-and-busted system for a while before the awesome new one has been > through QA and into production. Also I just want to make sure I have > the best possible understanding of things that I can :)) > > Thanks very much if you read this far :) > > Cheers, > > Bernard I think your analysis is correct (and as others have, said, the selective receives are done by gen_servers). The issue was nicely explained (with an easily reproducible test, if you're running Linux) by Pascal Brisset 5 years ago: http://www.erlang.org/cgi-bin/ezmlm-cgi/4/17758 Best regards, Dominic Williams http://dominicwilliams.net --- From g9414002.pccu.edu.tw@REDACTED Mon Mar 22 01:01:16 2010 From: g9414002.pccu.edu.tw@REDACTED (=?UTF-8?B?6buD6ICA6LOiIChZYXUtSHNpZW4gSHVhbmcp?=) Date: Mon, 22 Mar 2010 08:01:16 +0800 Subject: [erlang-questions] Performance with large queues In-Reply-To: <4BA41F4B.2080000@m5net.com> References: <4BA41F4B.2080000@m5net.com> Message-ID: Giving one cent quickly, I think that a large queue can be optimized by implementing it using two stacks. enque(Data, {InStack, OutStack}) when length(InStack) < 50000 -> {[Data|InStack], OutStack}; enque(Data, {InStack, OutStack}) -> enque(Data, {[], OutStack ++ lists:reverse(InStack)}). deque({[], []}) -> []; deque({InStack, [Data|OutStack]}) -> {Data, {InStack, OutStack}}; deque({InStack, []}) -> deque({[], lists:reverse(InStack)}). Then, the cost of accessing a queue goes O(1) in general while sometimes it goes O(N). On Sat, Mar 20, 2010 at 9:05 AM, Bernard Duggan wrote: > So, my theory: I realised that, even though our code doesn't explicitly > do a selective receive (and so can always just grab the first message on > the queue) mnesia probably /does/ do one to get locks and that, in all > likelihood, the cost of a selective receive goes O(N) with the length of > the queue. I imagine that once the queue has passed a certain point > those selective receives increase the load on our process to the point > that it can't keep up. By the time the input load has died back down at > night, the queue is so long (~1M messages) that it's taking a serious > amount of time to traverse it, meaning that even over many hours the > queue isn't significantly shrunk down (a queue of one million messages > being processed at one message per second is still going to take 277 > hours to clear). > > From chandrashekhar.mullaparthi@REDACTED Mon Mar 22 06:56:31 2010 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Mon, 22 Mar 2010 05:56:31 +0000 Subject: [erlang-questions] match_delete and fun2ms In-Reply-To: References: Message-ID: On 20 March 2010 20:41, Max Lapshin wrote: > Is it possible to delete entries from ets, basing on fun2ms spec? > > > Spec = ets:fun2ms(fun(#video_frame{dts = TS} ) when TS < Limit -> > true > end), > Count = ets:select_count(Frames, Spec), > ets:match_delete(Frames, Spec) > > This code shows me increasing Count, but doesn't delete anything. > Did you mean to write ets:select_delete(Frames, Spec) instead of match_delete? cheers Chandru From max.lapshin@REDACTED Mon Mar 22 07:01:15 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Mon, 22 Mar 2010 09:01:15 +0300 Subject: [erlang-questions] match_delete and fun2ms In-Reply-To: References: Message-ID: On Mon, Mar 22, 2010 at 8:56 AM, Chandru wrote: > > Did you mean to write ets:select_delete(Frames, Spec) instead of > match_delete? Damn, you are quite right! I've missed this function in list. Why do two functions exists: match_delete and select_delete? From vladdu55@REDACTED Mon Mar 22 09:00:24 2010 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 22 Mar 2010 09:00:24 +0100 Subject: [erlang-questions] [proposal] Declarative syntax for metadata (long!) In-Reply-To: <4256C136-DE2A-4560-9D81-38070B9ECFDD@dominicwilliams.net> References: <95be1d3b1003180434l7e76c610if40faed29efa647c@mail.gmail.com> <9b08084c1003180606g68f1c060r10635f571b6c642c@mail.gmail.com> <95be1d3b1003190702j1096b838vdeda7302b6780186@mail.gmail.com> <4256C136-DE2A-4560-9D81-38070B9ECFDD@dominicwilliams.net> Message-ID: <95be1d3b1003220100n323296e2x2f7ad31ceaa86ae4@mail.gmail.com> Hi! On Sat, Mar 20, 2010 at 23:16, Dominic Williams wrote: >>> But for everyday programming, I'm afraid introducing reification would actually make Erlang less simple, less easy to reason about, less reliable... and these properties of Erlang are more important to me, given that I want to ship working software quickly, than being able to do cool things with reification. >> >> Well, for the first thing, this kind of functionality shouldn't affect >> anything else unless it is used, just as little as I would not be >> affected at all if asn1 or megaco would be the buggiest applications >> on the planet. > > But asn1 and megaco are just erlang applications and modules. Using them or not does not affect the appearance and understandability of one's code. What you are suggesting is a change in the language. People will use it, so the possible disadvantages have to weighed against the possible benefits. I'm not sure exactly what we are talking about in the piece above: my suggestion to use domain specific languages instead of strings for some meta-data, or Joe's addition regarding reification? They are related, but the latter is not really a language change but a library one. erl_scan, erl_parse, erl_syntax have to keep track of the exact textual information. erl_pp shall use that info. Some new constructs will be handled, but that doesn't affect code that doesn't mind about them. >>> I can see one area which would become much easier to work on: development tools. >> Yes, that is one. And my (partial) opinion is that they are quite >> important. > Agreed, tool support is important. But if it's the only area that needs reification? Well, it's not. Any code manipulation tool or code generator would benefit from that. Parse transforms would be easier to write and read. I agree these aren't the most common applications, but they might become more common if they will be easier to write. >>> I've always been a fan of Joe's principle that for every thing one adds to Erlang, one should remove something else - so since Joe is supporting adding introspection, I'm interested to hear what he would be prepared to remove in exchange? >> I'm not Joe, but in my previous message to the list I mentioned >> something that could be removed :) > Sorry, I've read your previous message 3 times but cannot see it. Oh, it was in the parallel thread where I revealed what I thought was a feature but it really was a bug (optional parentheses around attribute arguments). best regards, Vlad From martindemello@REDACTED Mon Mar 22 12:49:51 2010 From: martindemello@REDACTED (Martin DeMello) Date: Mon, 22 Mar 2010 17:19:51 +0530 Subject: passing a function to lists:map Message-ID: ta(X) when is_list(X) -> list_to_atom(X); ta(X) when is_tuple(X) -> tuple_to_list(X); ta(X) when is_integer(X) -> X. % this doesn't work atomize(List) -> lists:map(ta, List). % this does atomize(List) -> lists:map(fun(X) -> ta(X) end, List). What's the difference? Have I just got the syntax wrong, or is there some fundamental reason I need the second version? martin From koops.j@REDACTED Mon Mar 22 12:53:07 2010 From: koops.j@REDACTED (Jeroen Koops) Date: Mon, 22 Mar 2010 12:53:07 +0100 Subject: [erlang-questions] passing a function to lists:map In-Reply-To: References: Message-ID: <331a9abb1003220453ydb085eaxe5411d9a0741230e@mail.gmail.com> Hi Martin, use: -export([ ta/1 ]). and then: atomize(List) -> lists:map(fun ta/1, List). Regards, On Mon, Mar 22, 2010 at 12:49 PM, Martin DeMello wrote: > ta(X) when is_list(X) -> list_to_atom(X); > ta(X) when is_tuple(X) -> tuple_to_list(X); > ta(X) when is_integer(X) -> X. > > % this doesn't work > atomize(List) -> lists:map(ta, List). > > % this does > atomize(List) -> lists:map(fun(X) -> ta(X) end, List). > > What's the difference? Have I just got the syntax wrong, or is there > some fundamental reason I need the second version? > > martin > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From bob@REDACTED Mon Mar 22 12:55:04 2010 From: bob@REDACTED (Bob Ippolito) Date: Mon, 22 Mar 2010 07:55:04 -0400 Subject: [erlang-questions] passing a function to lists:map In-Reply-To: References: Message-ID: <6a36e7291003220455y21c56e49m461f34586e57479@mail.gmail.com> atomize(List) -> lists:map(fun ta/1, List). On Mon, Mar 22, 2010 at 7:49 AM, Martin DeMello wrote: > ta(X) when is_list(X) ? ?-> list_to_atom(X); > ta(X) when is_tuple(X) ? -> tuple_to_list(X); > ta(X) when is_integer(X) -> X. > > % this doesn't work > atomize(List) -> lists:map(ta, List). > > % this does > atomize(List) -> lists:map(fun(X) -> ta(X) end, List). > > What's the difference? Have I just got the syntax wrong, or is there > some fundamental reason I need the second version? > > martin > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From bengt.kleberg@REDACTED Mon Mar 22 12:57:14 2010 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 22 Mar 2010 12:57:14 +0100 Subject: [erlang-questions] passing a function to lists:map In-Reply-To: <331a9abb1003220453ydb085eaxe5411d9a0741230e@mail.gmail.com> References: <331a9abb1003220453ydb085eaxe5411d9a0741230e@mail.gmail.com> Message-ID: <1269259035.4952.29.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Greetings, You do not need to export the function to be able to use it in a fun func/arity expression. ebngt On Mon, 2010-03-22 at 12:53 +0100, Jeroen Koops wrote: > Hi Martin, > > use: > > -export([ ta/1 ]). > > and then: > > atomize(List) -> lists:map(fun ta/1, List). > > Regards, > > > > On Mon, Mar 22, 2010 at 12:49 PM, Martin DeMello wrote: > > > ta(X) when is_list(X) -> list_to_atom(X); > > ta(X) when is_tuple(X) -> tuple_to_list(X); > > ta(X) when is_integer(X) -> X. > > > > % this doesn't work > > atomize(List) -> lists:map(ta, List). > > > > % this does > > atomize(List) -> lists:map(fun(X) -> ta(X) end, List). > > > > What's the difference? Have I just got the syntax wrong, or is there > > some fundamental reason I need the second version? > > > > martin > > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > See http://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > > > From martindemello@REDACTED Mon Mar 22 12:57:45 2010 From: martindemello@REDACTED (Martin DeMello) Date: Mon, 22 Mar 2010 17:27:45 +0530 Subject: [erlang-questions] passing a function to lists:map In-Reply-To: <331a9abb1003220453ydb085eaxe5411d9a0741230e@mail.gmail.com> References: <331a9abb1003220453ydb085eaxe5411d9a0741230e@mail.gmail.com> Message-ID: Thanks, Jeroen (and you too, Bob). martin On Mon, Mar 22, 2010 at 5:23 PM, Jeroen Koops wrote: > Hi Martin, > use: > -export([ ta/1 ]). > and then: > atomize(List) -> lists:map(fun ta/1, List). > Regards, > > > On Mon, Mar 22, 2010 at 12:49 PM, Martin DeMello > wrote: >> >> ta(X) when is_list(X) ? ?-> list_to_atom(X); >> ta(X) when is_tuple(X) ? -> tuple_to_list(X); >> ta(X) when is_integer(X) -> X. >> >> % this doesn't work >> atomize(List) -> lists:map(ta, List). >> >> % this does >> atomize(List) -> lists:map(fun(X) -> ta(X) end, List). >> >> What's the difference? Have I just got the syntax wrong, or is there >> some fundamental reason I need the second version? >> >> martin >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED >> > > From koops.j@REDACTED Mon Mar 22 13:01:04 2010 From: koops.j@REDACTED (Jeroen Koops) Date: Mon, 22 Mar 2010 13:01:04 +0100 Subject: [erlang-questions] passing a function to lists:map In-Reply-To: <1269259035.4952.29.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> References: <331a9abb1003220453ydb085eaxe5411d9a0741230e@mail.gmail.com> <1269259035.4952.29.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Message-ID: <331a9abb1003220501x453287eew3265c01098e90dd3@mail.gmail.com> Really now? That goes to show, teaching =:= learning ! On Mon, Mar 22, 2010 at 12:57 PM, Bengt Kleberg wrote: > Greetings, > > You do not need to export the function to be able to use it in a > fun func/arity > expression. > > > ebngt > > On Mon, 2010-03-22 at 12:53 +0100, Jeroen Koops wrote: > > Hi Martin, > > > > use: > > > > -export([ ta/1 ]). > > > > and then: > > > > atomize(List) -> lists:map(fun ta/1, List). > > > > Regards, > > > > > > > > On Mon, Mar 22, 2010 at 12:49 PM, Martin DeMello < > martindemello@REDACTED>wrote: > > > > > ta(X) when is_list(X) -> list_to_atom(X); > > > ta(X) when is_tuple(X) -> tuple_to_list(X); > > > ta(X) when is_integer(X) -> X. > > > > > > % this doesn't work > > > atomize(List) -> lists:map(ta, List). > > > > > > % this does > > > atomize(List) -> lists:map(fun(X) -> ta(X) end, List). > > > > > > What's the difference? Have I just got the syntax wrong, or is there > > > some fundamental reason I need the second version? > > > > > > martin > > > > > > ________________________________________________________________ > > > erlang-questions (at) erlang.org mailing list. > > > See http://www.erlang.org/faq.html > > > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > > > > > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From raimo+erlang-questions@REDACTED Mon Mar 22 13:34:10 2010 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Mon, 22 Mar 2010 13:34:10 +0100 Subject: [erlang-questions] passing a function to lists:map In-Reply-To: <331a9abb1003220501x453287eew3265c01098e90dd3@mail.gmail.com> References: <331a9abb1003220453ydb085eaxe5411d9a0741230e@mail.gmail.com> <1269259035.4952.29.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> <331a9abb1003220501x453287eew3265c01098e90dd3@mail.gmail.com> Message-ID: <20100322123410.GA770@erix.ericsson.se> On Mon, Mar 22, 2010 at 01:01:04PM +0100, Jeroen Koops wrote: > Really now? That goes to show, teaching =:= learning ! > > On Mon, Mar 22, 2010 at 12:57 PM, Bengt Kleberg > wrote: > > > Greetings, > > > > You do not need to export the function to be able to use it in a > > fun func/arity > > expression. The export is not needed since the "fun Fun/1" construct is essentially syntactical sugar for "fun (Arg) -> Fun(Arg) end" like this: atomize(List) -> lists:map(fun(Arg) -> ta(Arg) end, List). So you could do a macro approach to replace "fun Fun/1": -define(FUN1(Fun), fun (Arg) -> (Fun)(Arg) end). atomize(List) -> lists:map(?FUN1(ta), List). > > > > > > ebngt > > > > On Mon, 2010-03-22 at 12:53 +0100, Jeroen Koops wrote: > > > Hi Martin, > > > > > > use: > > > > > > -export([ ta/1 ]). > > > > > > and then: > > > > > > atomize(List) -> lists:map(fun ta/1, List). > > > > > > Regards, > > > > > > > > > > > > On Mon, Mar 22, 2010 at 12:49 PM, Martin DeMello < > > martindemello@REDACTED>wrote: > > > > > > > ta(X) when is_list(X) -> list_to_atom(X); > > > > ta(X) when is_tuple(X) -> tuple_to_list(X); > > > > ta(X) when is_integer(X) -> X. > > > > > > > > % this doesn't work > > > > atomize(List) -> lists:map(ta, List). > > > > > > > > % this does > > > > atomize(List) -> lists:map(fun(X) -> ta(X) end, List). > > > > > > > > What's the difference? Have I just got the syntax wrong, or is there > > > > some fundamental reason I need the second version? > > > > > > > > martin > > > > > > > > ________________________________________________________________ > > > > erlang-questions (at) erlang.org mailing list. > > > > See http://www.erlang.org/faq.html > > > > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > > > > > > > > > > > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > See http://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > > > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From kostis@REDACTED Mon Mar 22 13:34:44 2010 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 22 Mar 2010 14:34:44 +0200 Subject: [erlang-questions] passing a function to lists:map In-Reply-To: References: Message-ID: <4BA763E4.6000403@cs.ntua.gr> Martin DeMello wrote: > ta(X) when is_list(X) -> list_to_atom(X); > ta(X) when is_tuple(X) -> tuple_to_list(X); > ta(X) when is_integer(X) -> X. > > % this doesn't work > atomize(List) -> lists:map(ta, List). > > % this does > atomize(List) -> lists:map(fun(X) -> ta(X) end, List). > > What's the difference? Have I just got the syntax wrong, or is there > some fundamental reason I need the second version? There is a very fundamental reason. In Erlang 'ta' is just an atom; it does not have a function type as it does in e.g. ML or Haskell. Functions in Erlang do not only have a name but also an arity (*) hence the need to use the "fun ta/1" construct there, as many have mentioned. Kostis (*) for example in Erlang it is possible to have two functions with the same name but different arities. From rwillmer@REDACTED Mon Mar 22 13:40:58 2010 From: rwillmer@REDACTED (Rachel Willmer) Date: Mon, 22 Mar 2010 12:40:58 +0000 Subject: [erlang-questions] 8k limit on gen_tcp:recv? In-Reply-To: <5cd112871003190720j6237effbg8b16d36d572bea17@mail.gmail.com> References: <5cd112871003101540t4386d69anb5fc23e3d4ac93d3@mail.gmail.com> <6a36e7291003101548h137c040dve690e8cdcd378a82@mail.gmail.com> <65b2728e1003101943j3bbe04fjc29f3bc09f536b07@mail.gmail.com> <781EE251-9CFB-429B-9D49-123229AD591A@rogvall.se> <5cd112871003190720j6237effbg8b16d36d572bea17@mail.gmail.com> Message-ID: <5cd112871003220540r552078die5ef9e29e4a89c99@mail.gmail.com> Thanks again, I've got a version working now with the longer receive buffer. The use case for the long URL is couchdb replication, by the way. https://issues.apache.org/jira/browse/COUCHDB-644 Rachel From mazen.harake@REDACTED Mon Mar 22 13:53:54 2010 From: mazen.harake@REDACTED (Mazen Harake) Date: Mon, 22 Mar 2010 14:53:54 +0200 Subject: Reading (and ignoring) escape-sequences Message-ID: <4BA76862.3050609@erlang-solutions.com> Hi list, Lets say I read 1 char at a time: l() -> Chr = io:get_chars('',1), ... l(). and the person giving me input press ^[[A (UpArrow). This will yield three loops in my program, one for each of these characters. Well that is not a problem I can flag for collecting an escape-sequence but there is another problem. Say that I want to be able to catch UpArrow but not LeftArrow (or any other escape-sequence for that matter) I can't start reading the ^[ character and suddenly stop when there is something I don't recognise because there might be "garbage" which I have to skip (the rest of the sequence)... and to skip this I have to implement the whole list of escape-sequences to know how much to skip. Is there any other way to do this in Erlang? I can't seem to find any facility to read or get escape-sequences (like UpArrow or whatever). Did I overlook something or anyone have any tip on how to do this? /Mazen --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From bob@REDACTED Mon Mar 22 14:10:41 2010 From: bob@REDACTED (Bob Ippolito) Date: Mon, 22 Mar 2010 09:10:41 -0400 Subject: [erlang-questions] 8k limit on gen_tcp:recv? In-Reply-To: <5cd112871003220540r552078die5ef9e29e4a89c99@mail.gmail.com> References: <5cd112871003101540t4386d69anb5fc23e3d4ac93d3@mail.gmail.com> <6a36e7291003101548h137c040dve690e8cdcd378a82@mail.gmail.com> <65b2728e1003101943j3bbe04fjc29f3bc09f536b07@mail.gmail.com> <781EE251-9CFB-429B-9D49-123229AD591A@rogvall.se> <5cd112871003190720j6237effbg8b16d36d572bea17@mail.gmail.com> <5cd112871003220540r552078die5ef9e29e4a89c99@mail.gmail.com> Message-ID: <6a36e7291003220610q45121c8fp13b66fb565b80b9a@mail.gmail.com> Is changing the limit from 8k to 16k really the best solution? Beyond technical reasons, e.g. some kinds of proxies might limit URL length, is there a guarantee that all CouchDB URLs will be shorter than 16k? I'd be fine with changing the default buffer size, but only if there's proof that 16k is going to be big enough for all CouchDB use cases. 8kb is certainly enough for exposing URLs to browsers since their practical limits are much lower. On Mon, Mar 22, 2010 at 8:40 AM, Rachel Willmer wrote: > Thanks again, I've got a version working now with the longer receive buffer. > > The use case for the long URL is couchdb replication, by the way. > > https://issues.apache.org/jira/browse/COUCHDB-644 > > Rachel > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From williamstw@REDACTED Mon Mar 22 14:33:14 2010 From: williamstw@REDACTED (Tim Williams) Date: Mon, 22 Mar 2010 09:33:14 -0400 Subject: Retrieving values from Env in mod_esi or webtools Message-ID: <499888441003220633m5e0d783dp215d4220808173f4@mail.gmail.com> A complete noob question, but how exactly do I get values (e.g. path_info) from inside the callback? From the docs, I thought it was a list of tuples, which I thought would make it accessible via lists:keyfind, but I've had no luck. So far, all the examples I've found only show how to print everything with io_lib but not how to access the values by key... Thanks, --tim From rwillmer@REDACTED Mon Mar 22 15:52:55 2010 From: rwillmer@REDACTED (Rachel Willmer) Date: Mon, 22 Mar 2010 14:52:55 +0000 Subject: [erlang-questions] 8k limit on gen_tcp:recv? In-Reply-To: <6a36e7291003220610q45121c8fp13b66fb565b80b9a@mail.gmail.com> References: <5cd112871003101540t4386d69anb5fc23e3d4ac93d3@mail.gmail.com> <6a36e7291003101548h137c040dve690e8cdcd378a82@mail.gmail.com> <65b2728e1003101943j3bbe04fjc29f3bc09f536b07@mail.gmail.com> <781EE251-9CFB-429B-9D49-123229AD591A@rogvall.se> <5cd112871003190720j6237effbg8b16d36d572bea17@mail.gmail.com> <5cd112871003220540r552078die5ef9e29e4a89c99@mail.gmail.com> <6a36e7291003220610q45121c8fp13b66fb565b80b9a@mail.gmail.com> Message-ID: <5cd112871003220752n3f7eb0f7g7e5345fe0c3f4ded@mail.gmail.com> On 22 March 2010 13:10, Bob Ippolito wrote: > Is changing the limit from 8k to 16k really the best solution? Beyond > technical reasons, e.g. some kinds of proxies might limit URL length, > is there a guarantee that all CouchDB URLs will be shorter than 16k? It's a good enough solution for what I need right now, (which is to be able to replicate some very large couchdb databases without the system falling over). But I'd agree that it's probably not the "best" solution, and I wouldn't suggest changing the default buffer size. I'm going to do some further digging around inside the couchdb code to figure out why these long URLs are being generated in the first place. There is supposed to be code in there which splits the request into multiple requests if the revision list is too long, but that doesn't seem to be working. Fixing that would be a better solution. Rachel From preichar@REDACTED Mon Mar 22 16:38:41 2010 From: preichar@REDACTED (patrick) Date: Mon, 22 Mar 2010 16:38:41 +0100 Subject: how to call gen_server with JInterface Message-ID: Is it possible to access a gen_server with JInterface? Here's an excerpt of my (global) gen_server: -module(sys_man). -behaviour(gen_server). start() -> gen_server:start_link({global, ?MODULE}, ?MODULE, [], []). register({Pid, Mbx, Node}) -> gen_server:call({global, ?MODULE}, {register, Pid, Mbx, Node}). handle_call({register, Pid, Mbx, Node}, _From, Tab) -> Reply = ets:insert(Tab, {Pid, Mbx, Node}), {reply, Reply, Tab}. %% snipp ... and here's the java snippet which (obviously) doesn't work OtpNode otpNode = new OtpNode("javaNode@REDACTED", "ourCookie"); OtpMbox myMbox = otpNode.createMbox("myMbox"); OtpErlangObject[] o = new OtpErlangObject[4]; o[0] = new OtpErlangAtom("register"); o[1] = myMbox.self(); o[2] = new OtpErlangString("a string"); o[3] = new OtpErlangString("another"); OtpErlangTuple tuple = new OtpErlangTuple(o); myMbox.send("sys_man", "pat@REDACTED", tuple); thank you for any hints regarding (global/local) gen_server and JInterface. Regards, Patrick From g@REDACTED Mon Mar 22 17:34:38 2010 From: g@REDACTED (Garrett Smith) Date: Mon, 22 Mar 2010 11:34:38 -0500 Subject: Supervisors as factories *and* registries Message-ID: I've gotten into the habit of using supervisors as factories and really like the pattern. I think it's clean to delegate process life cycle to supervisors, since that's what they're there for. So far so good, with one big exception... As factories, supervisors are also a logical candidate as registries. supervisor:which_children, for example, is a brute force way to get at the processes under supervision. Bit I need a finer grained interface to supervised children. I wish supervisors exposed state the way gen_server does, in which case I could maintain an index (for example) that would let me access children more efficiently. (This seems like a conspicuously missing feature, but there's probably a good reason for it.) Is there a recommended pattern for this sort of thing? To summarize what I'm looking for: - Wrap calls to supervisor:start_child in a factory function for processes - Provide a lookup interface to supervised children that doesn't rely on a linear scan of supervisor:which_children(Sup) I could obviously maintain a separate process as a registry, but I'd prefer to avoid the sync/link/cleanup overhead associated with that. I'd be okay with hacking supervisor (create a supervisor2?), but I haven't explored that option. Garrett From mevans@REDACTED Mon Mar 22 19:07:11 2010 From: mevans@REDACTED (Evans, Matthew) Date: Mon, 22 Mar 2010 14:07:11 -0400 Subject: Erlang Event Loop Question Message-ID: I'm hoping that this got missed because I sent it on a Friday afternoon. If someone knows how to benchmark this it'll be great (I tried a simple echo - server type application, but that'll include network slowness too)... ________________________________ From: Evans, Matthew Sent: Friday, March 19, 2010 10:50 AM To: erlang-questions@REDACTED Subject: Erlang Event Loop Question Hi All, I'm wondering about the inner workings of the Erlang event loop. Is the event loop single threaded? We have a service (the VM has epoll enabled) that is doing a lot of TCP (HTTP) ingesting and parsing of large files (25MB of data or more per second). It is also doing a lot of IPC, both to other Erlang nodes, and via a proprietary transport to C++ applications. We currently support two methods to ingest these files: straight TCP (gen_tcp), and a specialized linked-in driver (which passes the epoll socket to the Erlang event loop with driver_select and passes the driver-created socket to gen_tcp; we also have a pool of threads for this driver). My concern is that under load the event loop is getting very busy resulting in time-sensitive IPC messages getting delayed/slowed down. I could get around this by having the linked-in driver not do driver_select and instead read from the socket and do driver_output_binary to pass the data to an Erlang process when it has accumulated a large enough buffer (say 100K). I would however like to get an understanding of the event loop before we try this, and see if there are any ways we can measure its performance to see if it is indeed a bottleneck. Anyone have any suggestions? Regards Matt From vladdu55@REDACTED Mon Mar 22 19:09:28 2010 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 22 Mar 2010 19:09:28 +0100 Subject: [erlang-questions] how to call gen_server with JInterface In-Reply-To: References: Message-ID: <95be1d3b1003221109i25f1f144sc2316620757a7f9e@mail.gmail.com> On Mon, Mar 22, 2010 at 16:38, patrick wrote: > Is it possible to access a gen_server with JInterface? Of course there is. > ... and here's the java snippet which (obviously) doesn't work > > OtpNode otpNode = new OtpNode("javaNode@REDACTED", "ourCookie"); > OtpMbox myMbox = otpNode.createMbox("myMbox"); > > OtpErlangObject[] o = new OtpErlangObject[4]; > o[0] = new OtpErlangAtom("register"); > o[1] = myMbox.self(); > o[2] = new OtpErlangString("a string"); > o[3] = new OtpErlangString("another"); > OtpErlangTuple tuple = new OtpErlangTuple(o); OtpErlangObject[] tag = new OtpErlangObject[2]; tag[0] = myMbox.self(); tag[1] = new OtpErlangRef(otpNode); OtpErlangObject[] msg = new OtpErlangObject[3]; msg[0] = new OtpErlangAtom("$gen_call"); msg[1] = new OtpErlangTuple(tag); msg[2] = o; myMbox.send("sys_man", "pat@REDACTED", msg); With reservation for silly mistakes, this corresponds wrapping your o above inside a {'$gen_call', {self(), make_ref()}, o} best regards, Vlad From chandrashekhar.mullaparthi@REDACTED Mon Mar 22 19:30:11 2010 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Mon, 22 Mar 2010 18:30:11 +0000 Subject: [erlang-questions] match_delete and fun2ms In-Reply-To: References: Message-ID: On 22 March 2010 06:01, Max Lapshin wrote: > On Mon, Mar 22, 2010 at 8:56 AM, Chandru > wrote: >> >> Did you mean to write ets:select_delete(Frames, Spec) instead of >> match_delete? > > > Damn, you are quite right! ?I've missed this function in list. Why do > two functions exists: match_delete and select_delete? If I remember correctly, match_delete came first and then select_delete came along a while later. match_delete operates on patterns which are not as powerful as match specs. cheers Chandru From jacob.vorreuter@REDACTED Mon Mar 22 20:00:05 2010 From: jacob.vorreuter@REDACTED (Jacob Vorreuter) Date: Mon, 22 Mar 2010 12:00:05 -0700 Subject: closing a port doesn't kill the connected process? Message-ID: I'm starting a redis server instance by opening an Erlang port. When the Erlang process exits or I explicitly close the port the os process is not killed. Is there a way to accomplish that? 1> Port = erlang:open_port({spawn, "redis-server"}, [binary, exit_status]). #Port<0.429> 2> erlang:port_close(Port). true $ ps -ax | grep redis-server 31374 ?? 0:00.02 redis-server Thanks, Jake From paul.joseph.davis@REDACTED Mon Mar 22 20:17:38 2010 From: paul.joseph.davis@REDACTED (Paul Davis) Date: Mon, 22 Mar 2010 15:17:38 -0400 Subject: [erlang-questions] closing a port doesn't kill the connected process? In-Reply-To: References: Message-ID: On Mon, Mar 22, 2010 at 3:00 PM, Jacob Vorreuter wrote: > I'm starting a redis server instance by opening an Erlang port. ?When the Erlang process exits or I explicitly close the port the os process is not killed. ?Is there a way to accomplish that? > > 1> Port = erlang:open_port({spawn, "redis-server"}, [binary, exit_status]). > #Port<0.429> > 2> erlang:port_close(Port). > true > > $ ps -ax | grep redis-server > 31374 ?? ? ? ? ? 0:00.02 redis-server > > Thanks, > > Jake > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > Jacob, We had to deal with that issue in CouchDB, although our solution isn't extremely elegant [1]. That spawnkillable code basically echos the os process id back to Erlang and then uses exec to replace itself with the requested command. Well behaved processes are expected to still close when they detect that their stdin has been closed. It all seems less than ideal, so I'd also be quite interested if someone knows of a better way to handle such things. Paul Davis [1] http://github.com/apache/couchdb/tree/trunk/src/couchdb/priv/spawnkillable/ From jay@REDACTED Mon Mar 22 19:31:49 2010 From: jay@REDACTED (Jay Nelson) Date: Mon, 22 Mar 2010 11:31:49 -0700 Subject: Supervisors as factories *and* registries Message-ID: <554D4310-6F7A-4823-9BBD-18EC56CBAB85@duomark.com> Garrett Smith while using supervisors wrote: > I wish ... I could maintain an index (for example) that would let me > access children more efficiently. This is not a very "functional" (as in functional language) approach, but it should do the trick in the way supervisors are intended to be used. It relies on ets for the stateful (i.e., non-functional) aspect but the locally known name of the ets table affords you to treat it as if it were stored in the state argument (which doesn't exist in the case of supervisors). Whenever you start a child, it calls apply(M, F, A) which is identified in your init function for each childspec. In the start_link of the supervisor create a named ets table. Write a function that is local to your supervisor (this is conceptual, you need to play with return values, errors, restart vs start, and so on): launch_child(SupRef, Childspec, ChildKey) -> case supervisor:start_child(Childspec) of {ok, Pid} = ets:insert(?ETS_NAME, {ChildKey, Pid, Childspec}), {ok, Pid}; ... other cases ... end. Now you can globally access the ets table to lookup a Childspec or Pid using your own key. Supervisor is no more complicated and works as is. You need to make sure your launch_child function doesn't crash the supervisor, so try to make it as simple as possible to do what you need. jay From steven.charles.davis@REDACTED Mon Mar 22 22:10:07 2010 From: steven.charles.davis@REDACTED (Steve Davis) Date: Mon, 22 Mar 2010 14:10:07 -0700 (PDT) Subject: Supervisors as factories *and* registries In-Reply-To: References: Message-ID: <697cc223-18ed-4453-b212-5b809b47192c@15g2000yqi.googlegroups.com> I believe the data you need is already there/accessible. Check out sys:get_status(). /s From sgardell@REDACTED Mon Mar 22 22:15:22 2010 From: sgardell@REDACTED (Gardell, Steven) Date: Mon, 22 Mar 2010 17:15:22 -0400 Subject: More megaco examples? Message-ID: <6B3E29721F78364AA2C43697AFB15D9102CCE7AB@sonusmail07.sonusnet.com> Can anyone point me to some more Megaco examples? I have gotten the simple MGC talking to a (non-Erlang) MG endpoint, now I want to go the next step and get something like the following out on the wire: "MEGACO/3 [10.128.254.81]:2944 \r\n" "TRANSACTION = ".$sendtid ." {\r\n" " CONTEXT = $ { \r\n" " ADD = ip/1/$/$ { \r\n" " MEDIA { \r\n" " STREAM = 1 { \r\n" " LOCALCONTROL { MODE = RECEIVEONLY },\r\n" " LOCAL {\r\n" "v=0\r\n" "c=IN IP4 $\r\n" "m=audio $ RTP/AVP 8\r\n" "a=rtpmap:8 PCMA/8000\r\n" "a=ptime:20\r\n" "b=AS:64\r\n" " }\r\n" " }\r\n" " }\r\n" " }\r\n" " }\r\n" " }\r\n"; (with suitable variable substitution, of course). I have spent a modest amount of time with the documentation, sample code, and include files - but being new to Erlang it is somewhat slow going. Thanks I am also currious as to whether there is any special signficiance to the #'foo_bar' record convention. I can't seem to find that described anywhere. From bflatmaj7th@REDACTED Mon Mar 22 23:59:24 2010 From: bflatmaj7th@REDACTED (Richard Andrews) Date: Tue, 23 Mar 2010 09:59:24 +1100 Subject: [erlang-questions] closing a port doesn't kill the connected process? In-Reply-To: References: Message-ID: <7702c0611003221559s6dda89b3q185d4efe73fdef99@mail.gmail.com> On Tue, Mar 23, 2010 at 6:00 AM, Jacob Vorreuter wrote: > I'm starting a redis server instance by opening an Erlang port. ?When the Erlang process exits or I explicitly close the port the os process is not killed. ?Is there a way to accomplish that? > > 1> Port = erlang:open_port({spawn, "redis-server"}, [binary, exit_status]). > #Port<0.429> > 2> erlang:port_close(Port). > true > > $ ps -ax | grep redis-server > 31374 ?? ? ? ? ? 0:00.02 redis-server If it's always UNIX perhaps you could insert a pipe forwarder process which kills redis-server on EOF; and call: open_port({spawn, "pipe-wrapper redis-server"}, [binary, nouse_stdio, exit_status]) nouse_stdio would be required because pipe-wrapper would be talking stdin/stdout to redis-server. Implementing pipe-wrapper is up to you. -- Rich From g@REDACTED Tue Mar 23 00:32:36 2010 From: g@REDACTED (Garrett Smith) Date: Mon, 22 Mar 2010 18:32:36 -0500 Subject: [erlang-questions] Re: Supervisors as factories *and* registries In-Reply-To: <697cc223-18ed-4453-b212-5b809b47192c@15g2000yqi.googlegroups.com> References: <697cc223-18ed-4453-b212-5b809b47192c@15g2000yqi.googlegroups.com> Message-ID: On Mon, Mar 22, 2010 at 4:10 PM, Steve Davis wrote: > I believe the data you need is already there/accessible. > > Check out sys:get_status(). I'm seeing a list of child specs, which still leaves me with the problem of maintaining an index. My wish list would include support for custom supervisor behaviors (i.e. exposing a set of callback functions ala gen_server), but short of that, it looks like a process local ETS table is my best option. Garrett From kenji.rikitake@REDACTED Tue Mar 23 00:40:06 2010 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Tue, 23 Mar 2010 08:40:06 +0900 Subject: [erlang-questions] Reading (and ignoring) escape-sequences In-Reply-To: <4BA76862.3050609@erlang-solutions.com> References: <4BA76862.3050609@erlang-solutions.com> Message-ID: <20100322234006.GA48453@k2r.org> I suggest you to learn termcap/terminfo libraries on UNIX, and the curses library (ncurses now I guess) source code. You need to parse the whole sequence anyway. And the definition of those sequences depends on the type to terminals you're going to connect. Kenji Rikitake In the message <4BA76862.3050609@REDACTED> dated Mon, Mar 22, 2010 at 02:53:30PM +0200, Mazen Harake writes: > Say that I want to be able to catch UpArrow but not LeftArrow (or any > other escape-sequence for that matter) I can't start reading the ^[ > character and suddenly stop when there is something I don't recognise > because there might be "garbage" which I have to skip (the rest of the > sequence)... and to skip this I have to implement the whole list of > escape-sequences to know how much to skip. Is there any other way to do > this in Erlang? I can't seem to find any facility to read or get > escape-sequences (like UpArrow or whatever). > > Did I overlook something or anyone have any tip on how to do this? From g@REDACTED Tue Mar 23 00:40:18 2010 From: g@REDACTED (Garrett Smith) Date: Mon, 22 Mar 2010 18:40:18 -0500 Subject: [erlang-questions] Re: Supervisors as factories *and* registries In-Reply-To: <554D4310-6F7A-4823-9BBD-18EC56CBAB85@duomark.com> References: <554D4310-6F7A-4823-9BBD-18EC56CBAB85@duomark.com> Message-ID: On Mon, Mar 22, 2010 at 1:31 PM, Jay Nelson wrote: > Garrett Smith while using supervisors wrote: > >> I wish ... I could maintain an index (for example) that would let me >> access children more efficiently. > > This is not a very "functional" (as in functional language) approach, but it > should do the trick in the way supervisors are intended to be used. ?It > relies on ets for the stateful (i.e., non-functional) aspect but the locally > known name of the ets table affords you to treat it as if it were stored in > the state argument (which doesn't exist in the case of supervisors). Up to this point, I've been leery of using ETS tables (feels like cheating, like using the process registry), but given the closed nature of supervisor, I suppose it's a good option to keep this logic contained in a single module. (I'm also conveniently overlooking the fact that core Erlang, like timer, uses ETS extensively, still.) > Whenever you start a child, it calls apply(M, F, A) which is identified in > your init function for each childspec. > > In the start_link of the supervisor create a named ets table. > > Write a function that is local to your supervisor (this is conceptual, you > need to play with return values, errors, restart vs start, and so on): > > launch_child(SupRef, Childspec, ChildKey) -> > ? ?case supervisor:start_child(Childspec) of > ? ? ? ?{ok, Pid} = > ? ? ? ? ?ets:insert(?ETS_NAME, {ChildKey, Pid, Childspec}), > ? ? ? ? {ok, Pid}; > ? ? ? ... other cases ... > ? ?end. > > > Now you can globally access the ets table to lookup a Childspec or Pid using > your own key. ?Supervisor is no more complicated and works as is. ?You need > to make sure your launch_child function doesn't crash the supervisor, so try > to make it as simple as possible to do what you need. Okay, gonna give this a try. Thanks! Garrett From steven.charles.davis@REDACTED Tue Mar 23 00:46:49 2010 From: steven.charles.davis@REDACTED (Steve Davis) Date: Mon, 22 Mar 2010 16:46:49 -0700 (PDT) Subject: Supervisors as factories *and* registries In-Reply-To: References: <697cc223-18ed-4453-b212-5b809b47192c@15g2000yqi.googlegroups.com> Message-ID: <664c3c80-7065-43be-89d8-3a2976a119dc@x12g2000yqx.googlegroups.com> Hi Garrett, Ah, ok - I was rather thinking of using get_status on the started/ registered gen_servers not on the sup itself... ...could be that's not what you want but for sure the gen_server state is accessible from that. regs, /s On Mar 22, 6:32?pm, Garrett Smith wrote: > On Mon, Mar 22, 2010 at 4:10 PM, Steve Davis > > wrote: > > I believe the data you need is already there/accessible. > > > Check out sys:get_status(). > > I'm seeing a list of child specs, which still leaves me with the > problem of maintaining an index. > From jay@REDACTED Tue Mar 23 01:33:57 2010 From: jay@REDACTED (Jay Nelson) Date: Mon, 22 Mar 2010 17:33:57 -0700 Subject: [erlang-questions] Re: Supervisors as factories *and* registries In-Reply-To: References: <554D4310-6F7A-4823-9BBD-18EC56CBAB85@duomark.com> Message-ID: <7A8307A7-14D0-46B2-B693-4E99DFA81358@duomark.com> On Mar 22, 2010, at 4:40 PM, Garrett Smith wrote: > Up to this point, I've been leery of using ETS tables (feels like > cheating, like using the process registry) It's not quite the same, but you have to worry about side effects and testability for solid software. You can do the same thing using gb_trees and a separate process. The key is that the separate process (or the ets table) have an externally visible way to access it. Since there's no state location or way to store it, you end up using a global name. I tend to avoid global names if possible because I want the option of concurrency everywhere and global names make that hard. But sometimes you don't need it (there is a single supervisor in this case after all), and you need to solve the problem at hand. The ets approach is clear, concise and conceptually easy to understand and can be verified independently of the supervisor itself in a test environment. jay From ulf.wiger@REDACTED Tue Mar 23 05:26:48 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Tue, 23 Mar 2010 05:26:48 +0100 Subject: [erlang-questions] Supervisors as factories *and* registries In-Reply-To: References: Message-ID: <4BA84308.60804@erlang-solutions.com> Garrett Smith wrote: > > Bit I need a finer grained interface to supervised children. I wish > supervisors exposed state the way gen_server does, in which case I > could maintain an index (for example) that would let me access > children more efficiently. (This seems like a conspicuously missing > feature, but there's probably a good reason for it.) I'm not entirely sure what you're after, but it seems a bit similar to what I described in the gproc paper from the Erlang Workshop '07: http://github.com/uwiger/gproc/raw/master/doc/erlang07-wiger.pdf See e.g. chapters 2.2.2 and 6.1 BR, Ulf W -- Ulf Wiger CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd http://www.erlang-solutions.com --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From icfp.publicity@REDACTED Tue Mar 23 08:58:47 2010 From: icfp.publicity@REDACTED (Wouter Swierstra) Date: Tue, 23 Mar 2010 08:58:47 +0100 Subject: ICFP 2010: Final Call for Papers Message-ID: <53ff55481003230058l2cc57306tce5fa8b1efa7a82d@mail.gmail.com> ===================================================================== Final Call for Papers ICFP 2010: International Conference on Functional Programming Baltimore, Maryland, 27 -- 29 September 2010 http://www.icfpconference.org/icfp2010 ===================================================================== Important Info ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Submission: 2 April 2010 Author response: 24 -- 25 May 2010 Notification: 7 June 2010 Final papers due: 12 July 2010 All deadlines are at 14:00 UTC. Submission is now open at http://icfp2010.seas.upenn.edu/ Scope ~~~~~ ICFP 2010 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: type systems; concurrency and distribution; modules; components and composition; metaprogramming; relations to object-oriented or logic programming; interoperability * Implementation: abstract machines; compilation; compile-time and run-time optimization; memory management; multi-threading; exploiting parallel hardware; interfaces to foreign functions, services, components or low-level machine resources * Software-Development Techniques: algorithms and data structures; design patterns; specification; verification; validation; proof assistants; debugging; testing; tracing; profiling * Foundations: formal semantics; lambda calculus; rewriting; type theory; monads; continuations; control; state; effects * Transformation and Analysis: abstract interpretation; partial evaluation; program transformation; program calculation; program proof * Applications and Domain-Specific Languages: symbolic computing; formal-methods tools; artificial intelligence; systems programming; distributed-systems and web programming; hardware design; databases; XML processing; scientific and numerical computing; graphical user interfaces; multimedia programming; scripting; system administration; security; education * Functional Pearls: elegant, instructive, and fun essays on functional programming 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. Abbreviated instructions for authors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ By 2 April 2010, 14:00 UTC, submit an abstract of at most 300 words and a full paper of at most 12 pages (6 pages for an Experience Report), including bibliography and figures. The deadline will be strictly enforced and papers exceeding the page limits will be summarily rejected. Authors have the option to attach supplementary material to a submission, on the understanding that reviewers may choose not to look at it. A submission will be evaluated according to its relevance, correctness, significance, originality, and clarity. It should explain its contributions in both general and technical terms, clearly identifying what has been accomplished, explaining why it is significant, and comparing it with previous work. The technical content should be accessible to a broad audience. Functional Pearls and Experience Reports are separate categories of papers that need not report original research results and must be marked as such at the time of submission. Detailed guidelines on both categories are on the conference web site. Each submission must adhere to SIGPLAN's republication policy, as explained on the web at http://www.acm.org/sigplan/republicationpolicy.htm. Proceedings will be published by ACM Press. Authors of accepted submissions are expected to transfer the copyright to the ACM. Presentations will be videotaped and released online if the presenter consents by signing an additional permission form at the time of the presentation. Formatting: Submissions must be in PDF format printable in black and white on US Letter sized paper and interpretable by Ghostscript. If this requirement is a hardship, make contact with the program chair at least one week before the deadline. Papers must adhere to the standard ACM conference format: two columns, nine-point font on a ten-point baseline, with columns 20pc (3.33in) wide and 54pc (9in) tall, with a column gutter of 2pc (0.33in). A suitable document template for LATEX is available from SIGPLAN at http://www.acm.org/sigs/sigplan/authorInformation.htm. Submission: Submissions will be accepted electronically at a URL to be named later. Improved versions of a paper may be submitted at any point before the submission deadline using the same web interface. Author response: Authors will have a 48-hour period, starting at 14:00 UTC on 24 May 2010, to read and respond to reviews. Special Journal Issue: There will be a special issue of the Journal of Functional Programming with papers from ICFP 2010. The program committee will invite the authors of select accepted papers to submit a journal version to this issue. Organization ~~~~~~~~~~~~ Conference Chair Paul Hudak, Yale University Program Chair Stephanie Weirich, University of Pennsylvania Program Committee: Umut Acar, Max Planck Institute for Software Systems Zena Ariola, University of Oregon James Cheney, University of Edinburgh Peter Dybjer, Chalmers University of Technology Robert Bruce Findler, Northwestern University Andy Gill, Kansas University Fritz Henglein, University of Copenhagen Michael Hicks, University of Maryland, College Park Patricia Johann, University of Strathclyde Andres L?h, Utrecht University Simon L. Peyton Jones, Microsoft Research Didier R?my, INRIA Paris-Rocquencourt John Reppy, University of Chicago Manuel Serrano, INRIA Sophia-Antipolis Matthieu Sozeau, Harvard University From als@REDACTED Tue Mar 23 09:01:32 2010 From: als@REDACTED (Anthony Shipman) Date: Tue, 23 Mar 2010 19:01:32 +1100 Subject: [erlang-questions] Re: Supervisors as factories *and* registries In-Reply-To: <554D4310-6F7A-4823-9BBD-18EC56CBAB85@duomark.com> References: <554D4310-6F7A-4823-9BBD-18EC56CBAB85@duomark.com> Message-ID: <201003231901.32360.als@iinet.net.au> On Tue, 23 Mar 2010 05:31:49 am Jay Nelson wrote: > Write a function that is local to your supervisor (this is ? > conceptual, you need to play with return values, errors, restart vs ? > start, and so on): > > launch_child(SupRef, Childspec, ChildKey) -> > ? ? ?case supervisor:start_child(Childspec) of > ????????{ok, Pid} = > ? ? ? ? ? ?ets:insert(?ETS_NAME, {ChildKey, Pid, Childspec}), > ? ? ? ? ? {ok, Pid}; > ? ? ? ? ... other cases ... > ? ? ?end. > > > Now you can globally access the ets table to lookup a Childspec or ? > Pid using your own key. ?Supervisor is no more complicated and works ? > as is. ?You need to make sure your launch_child function doesn't ? > crash the supervisor, so try to make it as simple as possible to do ? > what you need. > > jay But if the child crashes and restarts the pid will be out of date. -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From lucevers@REDACTED Tue Mar 23 09:54:35 2010 From: lucevers@REDACTED (Luc Evers) Date: Tue, 23 Mar 2010 09:54:35 +0100 Subject: Dets Tables or Mnesia Message-ID: Hi, ToDo Analyzing syslog message from a big amount of routers, with a different message structure. Sending alarms via (regular expression) message check. Question: Should I use 'Dets Tables ' or 'Mnesia' as database? Thanks! Luc. From mazen.harake@REDACTED Tue Mar 23 10:13:44 2010 From: mazen.harake@REDACTED (Mazen Harake) Date: Tue, 23 Mar 2010 11:13:44 +0200 Subject: [erlang-questions] Reading (and ignoring) escape-sequences In-Reply-To: <20100322234006.GA48453@k2r.org> References: <4BA76862.3050609@erlang-solutions.com> <20100322234006.GA48453@k2r.org> Message-ID: <4BA88648.80809@erlang-solutions.com> Yeah I've already started digging into that. The problem is more fundamental then I thought and in the end it turns out that all libraries (including ncurses) depend on the the fact that a human can not type in the escape sequence as fast as it is received by a computer. This makes it _extreamly_ hard (I would say impossible) to do this from pure Erlang; it has to be done from inside the driver. The core problem was in fact "If an escape character, ^[, is received how do you know if it is the beginning of a sequence or if someone simply pressed escape" and the answer seems to be "Timing.". Not what I had hoped for because now I have to implement some asynch io scheme to handle it. Hopefully this is something that could be handled by the official driver in the future (e.g. start the driver with a flag or something to get mapped key-input); I tried looking at it but my C-fetish only reach so far *shrug*. Anyway, Thank you for the reply, Kenji. /Mazen On 23/03/2010 01:40, Kenji Rikitake wrote: > I suggest you to learn termcap/terminfo libraries on UNIX, > and the curses library (ncurses now I guess) source code. > You need to parse the whole sequence anyway. > And the definition of those sequences depends on the type to > terminals you're going to connect. > > Kenji Rikitake > > In the message<4BA76862.3050609@REDACTED> > dated Mon, Mar 22, 2010 at 02:53:30PM +0200, > Mazen Harake writes: > >> Say that I want to be able to catch UpArrow but not LeftArrow (or any >> other escape-sequence for that matter) I can't start reading the ^[ >> character and suddenly stop when there is something I don't recognise >> because there might be "garbage" which I have to skip (the rest of the >> sequence)... and to skip this I have to implement the whole list of >> escape-sequences to know how much to skip. Is there any other way to do >> this in Erlang? I can't seem to find any facility to read or get >> escape-sequences (like UpArrow or whatever). >> >> Did I overlook something or anyone have any tip on how to do this? >> > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From steven.charles.davis@REDACTED Tue Mar 23 10:20:06 2010 From: steven.charles.davis@REDACTED (Steve Davis) Date: Tue, 23 Mar 2010 02:20:06 -0700 (PDT) Subject: Phased start - bug or misconception? Message-ID: Hi, I've a need to use a phased start for an application, but came across some unexpected behaviour. i.e. that a start failure in a phase leaves things in an apparently inconsistent state.... Boiling this down to the minimum, and given: --- %%phased.app {application, phased, [ {description, "Is this behaviour expected?"}, {vsn, "1.0"}, {applications, [kernel, stdlib]}, {mod, {phased, []}}, {start_phases, [ {first, []}, {second, []} ]}, {env, []} ]}. --- %% phased.erl -module(phased). -behaviour(application). -export([start/2, start_phase/3, config_change/3, prep_stop/1, stop/ 1]). -behaviour(supervisor). -export([init/1]). start(normal, []) -> io:format("start~n"), supervisor:start_link({local, phased_sup}, ?MODULE, []). start_phase(first, normal, []) -> io:format("start_phase: first~n"), ok; start_phase(second, normal, []) -> io:format("start_phase: second~n"), {error, intentional}. config_change(_, _, _) -> ok. prep_stop(State) -> State. stop(_State) -> ok. init([]) -> {ok, {{one_for_all, 0, 1}, []}}. --- Noting that I'm intentionally failing phase 2 of the startup process... here's the console session: 4> application:start(phased). start start_phase: first start_phase: second =INFO REPORT==== 23-Mar-2010::04:11:25 === application: phased exited: {intentional,{phased,start_phase,[second,normal,[]]}} type: temporary {error,{intentional,{phased,start_phase, [second,normal,[]]}}} 5> application:which_applications(). [{stdlib,"ERTS CXC 138 10","1.16.5"}, {kernel,"ERTS CXC 138 10","2.13.5"}] 6> application:start(phased). start =INFO REPORT==== 23-Mar-2010::04:11:49 === application: phased exited: {{already_started,<0.45.0>},{phased,start,[normal,[]]}} type: temporary {error,{{already_started,<0.45.0>}, {phased,start,[normal,[]]}}} 7> application:stop(phased). {error,{not_started,phased}} 8> registered(). [global_group,init,erl_prim_loader,user,error_logger,rex, standard_error_sup,kernel_sup,global_name_server,inet_db, file_server_2,code_server,user_drv,phased_sup, standard_error,application_controller,kernel_safe_sup] Should phased_sup still be running here? Is so, how do you recover? This looks like a bug to me but before reporting as such, I thought I'd better check that thIs is not some misconception on my part? TIA, /s From max.lapshin@REDACTED Tue Mar 23 10:27:07 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 23 Mar 2010 12:27:07 +0300 Subject: Help with storing data in memory Message-ID: Erlyvideo has got a timeshift feature. It means, that last 10 minutes of videostream are stored in stream_media gen_server. When client want to seek back in live stream, it starts to read from timeshift buffer just like from plain file. 43000 frames take about 1,5MB in ets table. They are stored as tuples with float timestamp as a key. Once in 5 seconds message clean_timeshift is received by stream_media and it deletes all expired frames from this ets table. When deletion doesn't work, erlyvideo takes about 10% CPU per several clients. When I turn it on, it raises to 17%CPU. I don't know what to do. When I works the same feature on ObjectiveC, there was a ring buffer in memory, but Erlang isn't suitable for such structures. Currently I have an idea to keep two ets tables: when first entry from first table comes to timeshift limit, I add second table and begin to track from which table to take frames. When first entry from second table comes to timeshift limit, I drop first table. So I eliminate ets:select_delete call From schramm.ingo@REDACTED Tue Mar 23 11:07:26 2010 From: schramm.ingo@REDACTED (ingo.schramm) Date: Tue, 23 Mar 2010 03:07:26 -0700 (PDT) Subject: how to call gen_server with JInterface In-Reply-To: <95be1d3b1003221109i25f1f144sc2316620757a7f9e@mail.gmail.com> References: <95be1d3b1003221109i25f1f144sc2316620757a7f9e@mail.gmail.com> Message-ID: <1e8da1ad-e0f1-472a-b10d-b0c81ff5ac9b@k17g2000yqb.googlegroups.com> Just a hint :) As a side effect of a project I'm working on I wrote a rather generic facade from Erlang to Java and back. I have an Erlang app ej supervising a Java node. On Erlang you can use an ej_srv:send or ej_srv:call and on the Java side you implement a message handler. That's it. The solution has still some limitations but it abstracts a lot of the marshalling stuff. You may find it here: http://github.com/nerlo/nerlo. I think about releasing ej sometimes as a separate package, if useful. Cheers, Ingo On Mar 22, 7:09?pm, Vlad Dumitrescu wrote: > On Mon, Mar 22, 2010 at 16:38, patrick wrote: > > Is it possible to access a gen_server with JInterface? > > Of course there is. > > > ... and here's the java snippet which (obviously) doesn't work > > > OtpNode otpNode = new OtpNode("javaN...@REDACTED", "ourCookie"); > > OtpMbox myMbox = otpNode.createMbox("myMbox"); > > > OtpErlangObject[] o = new OtpErlangObject[4]; > > o[0] = new OtpErlangAtom("register"); > > o[1] = myMbox.self(); > > o[2] = new OtpErlangString("a string"); > > o[3] = new OtpErlangString("another"); > > OtpErlangTuple tuple = new OtpErlangTuple(o); > > OtpErlangObject[] tag = new OtpErlangObject[2]; > tag[0] = myMbox.self(); > tag[1] = new OtpErlangRef(otpNode); > > OtpErlangObject[] msg = new OtpErlangObject[3]; > msg[0] = new OtpErlangAtom("$gen_call"); > msg[1] = new OtpErlangTuple(tag); > msg[2] = o; > > myMbox.send("sys_man", "p...@REDACTED", msg); > > With reservation for silly mistakes, this corresponds wrapping your o > above inside a {'$gen_call', {self(), make_ref()}, o} > > best regards, > Vlad > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > Seehttp://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED From bob@REDACTED Tue Mar 23 11:27:25 2010 From: bob@REDACTED (Bob Ippolito) Date: Tue, 23 Mar 2010 06:27:25 -0400 Subject: [erlang-questions] Help with storing data in memory In-Reply-To: References: Message-ID: <6a36e7291003230327t5b0d9f08q59388964544ce880@mail.gmail.com> Why ets and not a gen_server with a queue (or queue-like) data structure? Sending big enough binaries around should be cheap since it's by reference. On Tue, Mar 23, 2010 at 5:27 AM, Max Lapshin wrote: > Erlyvideo has got a timeshift feature. It means, that last 10 minutes > of videostream are stored in stream_media gen_server. > When client want to seek back in live stream, it starts to read from > timeshift buffer just like from plain file. > > 43000 frames take about 1,5MB in ets table. They are stored as tuples > with float timestamp as a key. > > Once in 5 seconds message clean_timeshift is received by stream_media > and it deletes all expired frames from this ets table. > When deletion doesn't work, erlyvideo takes about 10% CPU per several > clients. When I turn it on, it raises to 17%CPU. > > I don't know what to do. When I works the same feature on ObjectiveC, > there was a ring buffer in memory, but Erlang isn't suitable for > such structures. > > Currently I have an idea to keep two ets tables: when first entry from > first table comes to timeshift limit, I add second table and begin > to track from which table to take frames. When first entry from second > table comes to timeshift limit, I drop first table. > So I eliminate ets:select_delete call > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From cthulahoops@REDACTED Tue Mar 23 11:46:52 2010 From: cthulahoops@REDACTED (Adam Kelly) Date: Tue, 23 Mar 2010 10:46:52 +0000 Subject: [erlang-questions] Help with storing data in memory In-Reply-To: References: Message-ID: <8d1798e91003230346i5a87f3e0xb5c64369319da4fe@mail.gmail.com> On 23 March 2010 09:27, Max Lapshin wrote: > Currently I have an idea to keep two ets tables: when first entry from > first table comes to timeshift limit, I add second table and begin > to track from which table to take frames. When first entry from second > table comes to timeshift limit, I drop first table. > So I eliminate ets:select_delete call I'm guessing that you are using one of the hash map table types, in which case lookups by time range are going to be O(N)? You've already hit one solution, build an index and use the index to delete entries from the main table. You should also be able to get the performance you need by changing your table type to ordered_set, presuming ets is smart about that comparison operator. Adam. From max.lapshin@REDACTED Tue Mar 23 11:54:32 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 23 Mar 2010 13:54:32 +0300 Subject: [erlang-questions] Help with storing data in memory In-Reply-To: <8d1798e91003230346i5a87f3e0xb5c64369319da4fe@mail.gmail.com> References: <8d1798e91003230346i5a87f3e0xb5c64369319da4fe@mail.gmail.com> Message-ID: ets is of type ordered_set, because each client can read by Key from its own place in ets table and it needs to know ets:next for each Key. So, queue doesn't fit, because I need random access to frame list. Also, I'm afraid that array will not fit: when client seeks back in timeshift table, I need to find closest frame, with conditions: #video_frame{type = video, frame_type = keyframe, decoder_config = false, dts = DTS} when DTS =< RequestedDTS If use array, I will have to perform lookup through 40K of entries. However, maybe it is not bad? I need to test. From bernie@REDACTED Tue Mar 23 12:04:34 2010 From: bernie@REDACTED (Bernard Duggan) Date: Tue, 23 Mar 2010 22:04:34 +1100 Subject: [erlang-questions] Help with storing data in memory In-Reply-To: References: Message-ID: <4BA8A042.1090304@m5net.com> On 23/03/2010 8:27 PM, Max Lapshin wrote: > I don't know what to do. When I works the same feature on ObjectiveC, > there was a ring buffer in memory, but Erlang isn't suitable for > such structures. I implemented a ring buffer just the other day using the array module. Seems to work fine, though I don't claim to have benchmarked the performance, and I know access isn't exactly O(1) as it is in a "real" array. Still, it may be suitable for what you need. Cheers, Bernard From max.lapshin@REDACTED Tue Mar 23 12:11:05 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 23 Mar 2010 14:11:05 +0300 Subject: [erlang-questions] Help with storing data in memory In-Reply-To: <4BA8A042.1090304@m5net.com> References: <4BA8A042.1090304@m5net.com> Message-ID: On Tue, Mar 23, 2010 at 2:04 PM, Bernard Duggan wrote: > On 23/03/2010 8:27 PM, Max Lapshin wrote: >> I don't know what to do. When I works the same feature on ObjectiveC, >> there was a ring buffer in memory, but Erlang isn't suitable for >> such structures. > I implemented a ring buffer just the other day using the array module. > Seems to work fine, though I don't claim to have benchmarked the > performance, and I know access isn't exactly O(1) as it is in a "real" > array. ?Still, it may be suitable for what you need. > Ok, I will benchmark. I'm going also to test what overhead takes ets to copy each binary. From bob@REDACTED Tue Mar 23 13:14:41 2010 From: bob@REDACTED (Bob Ippolito) Date: Tue, 23 Mar 2010 08:14:41 -0400 Subject: [erlang-questions] Help with storing data in memory In-Reply-To: References: <8d1798e91003230346i5a87f3e0xb5c64369319da4fe@mail.gmail.com> Message-ID: <6a36e7291003230514k7a0806d4x7ba7f9725f7ee21b@mail.gmail.com> On Tue, Mar 23, 2010 at 6:54 AM, Max Lapshin wrote: > ets is of type ordered_set, because each client can read by Key from > its own place in ets table and it needs to know ets:next for each Key. > > So, queue doesn't fit, because I need random access to frame list. > Also, I'm afraid that array will not fit: when client seeks back in > timeshift table, I need to find closest frame, with conditions: > #video_frame{type = video, frame_type = keyframe, decoder_config = > false, dts = DTS} when DTS =< RequestedDTS > > If use array, I will have to perform lookup through 40K of entries. > However, maybe it is not bad? I need to test. Use a binary search! Since it's used as a ring you'll have to slightly modify the standard algorithm but all of the data is sorted and you have cheap random access so there is no good reason to do a sequential scan. -bob From max.lapshin@REDACTED Tue Mar 23 14:03:50 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 23 Mar 2010 16:03:50 +0300 Subject: [erlang-questions] Help with storing data in memory In-Reply-To: <6a36e7291003230514k7a0806d4x7ba7f9725f7ee21b@mail.gmail.com> References: <8d1798e91003230346i5a87f3e0xb5c64369319da4fe@mail.gmail.com> <6a36e7291003230514k7a0806d4x7ba7f9725f7ee21b@mail.gmail.com> Message-ID: What cost array:nth is? From dizzyd@REDACTED Tue Mar 23 14:20:44 2010 From: dizzyd@REDACTED (Dave Smith) Date: Tue, 23 Mar 2010 07:20:44 -0600 Subject: [erlang-questions] Help with storing data in memory In-Reply-To: References: <8d1798e91003230346i5a87f3e0xb5c64369319da4fe@mail.gmail.com> <6a36e7291003230514k7a0806d4x7ba7f9725f7ee21b@mail.gmail.com> Message-ID: It is O log n, if my chemo brain serves me correctly. The best you can hope for in a purely functional language implementation of arrays. I strongly recommend Okaski's book on functional data structures. http://www.amazon.com/Purely-Functional-Structures-Chris-Okasaki/dp/0521663504/ref=sr_1_1?ie=UTF8&s=books&qid=1269350406&sr=8-1 D. On Tue, Mar 23, 2010 at 7:03 AM, Max Lapshin wrote: > What cost array:nth is? > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From anders@REDACTED Tue Mar 23 14:31:47 2010 From: anders@REDACTED (Anders Dahlin) Date: Tue, 23 Mar 2010 14:31:47 +0100 Subject: Some thoughts/suggestions after using sftp Message-ID: <4BA8C2C3.7010202@dahlinenergy.se> Warning: Not all related to sftp. Suggestion 1: The documentation could do with some examples and description of prerequisites. The first thing I did was trying to use it with password authentication, like this: ssh_sftp:start_channel(Host, Port, [{user, User}, {password, Pwd}, {silently_accept_hosts, true}]). This resulted in {error,"Key exchange failed"}. After some debugging I found that the real error was that ssh_file:add_host_key/3 tried to open the known_hosts file. This did not exist, in fact I had no .ssh directory at all, and file:open returned {error,enoent}. Suggestion 2: Make ssh_file:add_host_key/3 create .ssh directory and known_hosts if it does not already exist or at least give a better error reason. Next thing I did was accidentally give the user name as an atom. Of course this is not correct but the error message I got was: {error,[69,114,108,97,110,103,32,115,115,104,32,99,111,110, 110,101,99,116,105,111,110,32,104,97,110,100,108|...]} So I did lists:flatten(element(2, v(-1))) and got this: "Erlang ssh connection handler failed with reason: {badarg,\n [{erlang,list_to_binary,\n [username]},\n {ssh_bits,enc,3},\n {ssh_bits,encode,1},\n {ssh_transport,\n ssh_packet,2},\n {ssh_connection_handler,\n userauth,2},\n {gen_fsm,handle_msg,7},\n {proc_lib,\n init_p_do_apply,3}]} , please report this to erlang-bugs@REDACTED \n" This message comes from ssh_connection_handler:terminate/3 and the formatting is result of an old annoyance; There is no nice way of getting a pretty result in io(_lib):format without using ~Xp, where X is an arbitrary large number. I keep writing stuff like: io_lib:format("~30000p\n", [Error]) because I want the pretty part without the line breaks and indentation. Suggestion 3: Add a control sequence to io(_lib):format/fwrite that behaves as ~p but does not add line breaks and indentation. Suggestion 4: And while we are in this region. Sometimes you really want to create a flat formatted string and not a possibly deep io_list. How about adding string:format/2, that behaves as lists:flatten(io_lib:format(Format, Data))? When I had the connection, I realized that the interface presented by ssh_sftp does not use the standard (s)ftp command names and seems to be lacking some basic functionality such as pwd and cd. You can get pwd with the undocumented ssh_sftp:real_path/2,3. Suggestion 5: Add the standard sftp command names (like cd, pwd, ls, put, get etc) as functions in ssh_sftp. /Anders From mevans@REDACTED Tue Mar 23 14:34:11 2010 From: mevans@REDACTED (Evans, Matthew) Date: Tue, 23 Mar 2010 09:34:11 -0400 Subject: [erlang-questions] Help with storing data in memory In-Reply-To: <6a36e7291003230514k7a0806d4x7ba7f9725f7ee21b@mail.gmail.com> References: <8d1798e91003230346i5a87f3e0xb5c64369319da4fe@mail.gmail.com> <6a36e7291003230514k7a0806d4x7ba7f9725f7ee21b@mail.gmail.com> Message-ID: I agree with this. Implement it as a binary with offsets in the binary block as pointers marking the MPEG GOP boundaries. You could then use gb_trees to find the closest offset when provided with a requested DTS. So given a DTS query to gb_trees it would return the byte offset in the binary structure (MPEG data) that is closest to the requested DTS. You would actually need to modify gb_trees so that it returns the closest match, but this should be trivial. For example: lookup_closest(Key, {_, T}) -> lookup_closest1(Key, T, 0). lookup_closest1(Key, {Key1, Value, Smaller, _}, _OldValue) when Key < Key1 -> lookup_closest1(Key, Smaller, Value); lookup_closest1(Key, {Key1, _Value, _, Bigger}, OldValue) when Key > Key1 -> lookup_closest1(Key, Bigger, OldValue); lookup_closest1(_, {_, Value, _, _},_OldValue) -> {value, Value}; lookup_closest1(_, nil, Value) -> {closest, Value}. Then you could use split_binary to remove the head of the binary structure to simulate a circular buffer. -----Original Message----- From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] On Behalf Of Bob Ippolito Sent: Tuesday, March 23, 2010 8:15 AM To: Max Lapshin Cc: Adam Kelly; Erlang-Questions Questions Subject: Re: [erlang-questions] Help with storing data in memory On Tue, Mar 23, 2010 at 6:54 AM, Max Lapshin wrote: > ets is of type ordered_set, because each client can read by Key from > its own place in ets table and it needs to know ets:next for each Key. > > So, queue doesn't fit, because I need random access to frame list. > Also, I'm afraid that array will not fit: when client seeks back in > timeshift table, I need to find closest frame, with conditions: > #video_frame{type = video, frame_type = keyframe, decoder_config = > false, dts = DTS} when DTS =< RequestedDTS > > If use array, I will have to perform lookup through 40K of entries. > However, maybe it is not bad? I need to test. Use a binary search! Since it's used as a ring you'll have to slightly modify the standard algorithm but all of the data is sorted and you have cheap random access so there is no good reason to do a sequential scan. -bob ________________________________________________________________ erlang-questions (at) erlang.org mailing list. See http://www.erlang.org/faq.html To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED From max.lapshin@REDACTED Tue Mar 23 14:40:33 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 23 Mar 2010 16:40:33 +0300 Subject: [erlang-questions] Help with storing data in memory In-Reply-To: References: <8d1798e91003230346i5a87f3e0xb5c64369319da4fe@mail.gmail.com> <6a36e7291003230514k7a0806d4x7ba7f9725f7ee21b@mail.gmail.com> Message-ID: But that means that I will copy megabytes of data each 5 seconds... Also, video frame is a complicated structure. I will need to serialize it. From wiener.guy@REDACTED Tue Mar 23 15:57:03 2010 From: wiener.guy@REDACTED (Guy Wiener) Date: Tue, 23 Mar 2010 16:57:03 +0200 Subject: Type analysis in Erlang? Message-ID: <69fbcaf61003230757n414b29eeu623d8dd9e04786e0@mail.gmail.com> Hello everybody, Is there some available tool that provides type analysis for Erlang (approximated, of course, since that it is an untyped language). Alt., is it possible to get some program analysis facts from existing tools, such as dialyzer? Thanks, Guy Wiener From brendan.g.hay@REDACTED Tue Mar 23 16:06:05 2010 From: brendan.g.hay@REDACTED (Brendan Hay) Date: Tue, 23 Mar 2010 16:06:05 +0100 Subject: [erlang-questions] Type analysis in Erlang? In-Reply-To: <69fbcaf61003230757n414b29eeu623d8dd9e04786e0@mail.gmail.com> References: <69fbcaf61003230757n414b29eeu623d8dd9e04786e0@mail.gmail.com> Message-ID: <777051541003230806l73f1fe29gbf11f967bbc22c4d@mail.gmail.com> Not sure what you are asking if you've already investigated dialyzer? Have you looked into using typer also? On 23 March 2010 15:57, Guy Wiener wrote: > Hello everybody, > Is there some available tool that provides type analysis for Erlang > (approximated, of course, since that it is an untyped language). > Alt., is it possible to get some program analysis facts from existing > tools, > such as dialyzer? > > Thanks, > Guy Wiener > From wiener.guy@REDACTED Tue Mar 23 16:28:45 2010 From: wiener.guy@REDACTED (Guy Wiener) Date: Tue, 23 Mar 2010 17:28:45 +0200 Subject: Help with Dialyzer Message-ID: <69fbcaf61003230828y1be3bb65yde5a05e17e0cc770@mail.gmail.com> Hello everyone, Following my last question, I tried to run dialyzer, but got immediately into problems. To run, dialyzer is looking for a PLT that includes, preferably, the entire standard Erlang library. However, the stdlib does not come with debug information, so the dialyzer cannot proceed. I looked in all the dialyzers manuals that I could find. They all suggest how to build the PLT for the stdlib, but do not mention how to get the debug info for it. Do I have to re-build the entire Erlang library with debug info in order to run the dialyzer? What is the simplest way to do so? It there a simpler way? I am using Erlang R13B01 taken from the Ubuntu repository. Thanks in advance, Guy Wiener. From brendan.doyle@REDACTED Tue Mar 23 16:40:32 2010 From: brendan.doyle@REDACTED (Brendan Doyle) Date: Tue, 23 Mar 2010 10:40:32 -0500 Subject: [erlang-questions] Help with Dialyzer In-Reply-To: <69fbcaf61003230828y1be3bb65yde5a05e17e0cc770@mail.gmail.com> References: <69fbcaf61003230828y1be3bb65yde5a05e17e0cc770@mail.gmail.com> Message-ID: <2F7E16A6-87FD-4131-8BCF-45DC2B9FA5E6@epicadvertising.com> This is a known issue, last time I checked erlang bundled with Ubuntu was built without debug. The standard distro from erlang.org gets built with debug, I suggest installing from source. You will have to build the whole plt though which takes a while On 2010-03-23, at 11:28 AM, Guy Wiener wrote: > Hello everyone, > Following my last question, I tried to run dialyzer, but > got immediately into problems. > To run, dialyzer is looking for a PLT that includes, preferably, the entire > standard Erlang library. However, the stdlib does not come with debug > information, so the dialyzer cannot proceed. > I looked in all the dialyzers manuals that I could find. They all suggest > how to build the PLT for the stdlib, but do not mention how to get the debug > info for it. > Do I have to re-build the entire Erlang library with debug info in order to > run the dialyzer? What is the simplest way to do so? It there a simpler way? > I am using Erlang R13B01 taken from the Ubuntu repository. > > Thanks in advance, > Guy Wiener. Brendan Doyle Manager, Application Development Epic Advertising - New York, Toronto, San Francisco, London www.EpicAdvertising.com 60 Columbia Way, Suite 310 Markham, ON L3R 0C9 (905) 946-0300 x.2358 work (647) 885-7159 mobile (888) 666-3120 fax brendan.doyle@REDACTED From magnus@REDACTED Tue Mar 23 17:29:45 2010 From: magnus@REDACTED (Magnus Henoch) Date: Tue, 23 Mar 2010 16:29:45 +0000 Subject: Help with Dialyzer In-Reply-To: <2F7E16A6-87FD-4131-8BCF-45DC2B9FA5E6@epicadvertising.com> (Brendan Doyle's message of "Tue, 23 Mar 2010 10:40:32 -0500") References: <69fbcaf61003230828y1be3bb65yde5a05e17e0cc770@mail.gmail.com> <2F7E16A6-87FD-4131-8BCF-45DC2B9FA5E6@epicadvertising.com> Message-ID: <848w9jt30m.fsf@linux-b2a3.site> Brendan Doyle writes: > This is a known issue, last time I checked erlang bundled with Ubuntu was built without debug. > > The standard distro from erlang.org gets built with debug, I suggest installing from source. Or get packages with debug info from the erlang-dev PPA, as described at https://wiki.ubuntu.com/Erlang . -- Magnus Henoch, magnus@REDACTED Erlang Solutions http://www.erlang-solutions.com/ --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From jay@REDACTED Tue Mar 23 16:57:29 2010 From: jay@REDACTED (Jay Nelson) Date: Tue, 23 Mar 2010 08:57:29 -0700 Subject: Supervisors as factories *and* registries Message-ID: <8060C533-B516-4946-8FC7-4307E17F5066@duomark.com> Anthony Shipman wrote: > But if the child crashes and restarts the pid will be out of date. That was why I had a caveat about restarts, etc. In the general case, Ulf's gproc gives you global access to find processes. If you want to keep something local or of limited propagation, you have to build extra machinery to monitor the processes: 1) A gen_server to store the ets table (or gb_trees or dict since you now have a pid container for any data structure) 2) A supervisor for the new gen_server. It could be the same supervisor for the child processes, with the gen_server started first and a rest_for_one policy... 3) But if it is a simple_one_for_one supervisor now, you need a parent supervisor with rest_for_one and then start the gen_server first and the child supervisor second. 4) Inside the gen_server, you can cast new Child Pids, monitor them and remove them from the gen_server state when the go 'DOWN' This seems like a lot of machinery, so I can see the desire to want a State internal to the supervisor, but this approach actual uses a "separation of concerns" method of isolating each of the new features and allows you to monitor and manage them independently. Supervisor is a well established and reliable implementation that is kept simple but allows composition of hierarchies. This follows the functional way of compositional design. I do believe it may be time to start talking about a family of supervisors which have different strategies for managing their children. Right now there is one supervisor with a flag mechanism for management style. Maybe now the experience with non-telco problem areas can advise the development of a larger family of process supervision models. The second point I wanted to make was to show how a functional design is extended (as opposed to an object-oriented design). An exported function is an entry point that can be extended or augmented (in this case it would be called a decorator pattern in OO). A new function is exported which calls the previous function and does some additional work to make it look like a new implementation. So the existing model allows both API augmentation, and functional composition of the hierarchy to add functionality. It is possible, although maybe tedious for complicated situations, to achieve the goal with the existing structure. But I think a discussion of alternative supervision approaches may lead to an expanded view of managing processes which OTP could accommodate. jay From wiener.guy@REDACTED Tue Mar 23 17:59:23 2010 From: wiener.guy@REDACTED (Guy Wiener) Date: Tue, 23 Mar 2010 18:59:23 +0200 Subject: [erlang-questions] Help with Dialyzer In-Reply-To: <2F7E16A6-87FD-4131-8BCF-45DC2B9FA5E6@epicadvertising.com> References: <69fbcaf61003230828y1be3bb65yde5a05e17e0cc770@mail.gmail.com> <2F7E16A6-87FD-4131-8BCF-45DC2B9FA5E6@epicadvertising.com> Message-ID: <69fbcaf61003230959g1518baa0g8d252a17ac62e324@mail.gmail.com> I tried to build R13B04 from source on my Ubuntu, but I repeatedly encountered error such as: erlc -W +debug_info -I/home/gwiener/Download/Erlang/otp_src_R13B04/lib/stdlib +warn_unused_vars -o../ebin asn1rt_ber_bin.erl ./asn1rt_ber_bin.erl:none: internal error in core_module; crash reason: {{case_clause,{{op,293,'bsr',{var,293,'Class'},{integer,293,6}}, []}}, [{v3_core,'-constant_bin_1/1-anonymous-0-',2}, {eval_bits,eval_field,3}, {eval_bits,expr_grp,4}, {v3_core,constant_bin_1,1}, {v3_core,constant_bin,1}, {v3_core,expr_bin,3}, {v3_core,expr,2}, {v3_core,exprs,2}]} make[2]: *** [../ebin/asn1rt_ber_bin.beam] Error 1 Any ideas? The full spec is Ubuntu 9.10 64 bit. The configuration script showed no errors. Thanks, Guy On Tue, Mar 23, 2010 at 5:40 PM, Brendan Doyle < brendan.doyle@REDACTED> wrote: > This is a known issue, last time I checked erlang bundled with Ubuntu was > built without debug. > > The standard distro from erlang.org gets built with debug, I suggest > installing from source. > > You will have to build the whole plt though which takes a while > > On 2010-03-23, at 11:28 AM, Guy Wiener wrote: > > > Hello everyone, > > Following my last question, I tried to run dialyzer, but > > got immediately into problems. > > To run, dialyzer is looking for a PLT that includes, preferably, the > entire > > standard Erlang library. However, the stdlib does not come with debug > > information, so the dialyzer cannot proceed. > > I looked in all the dialyzers manuals that I could find. They all suggest > > how to build the PLT for the stdlib, but do not mention how to get the > debug > > info for it. > > Do I have to re-build the entire Erlang library with debug info in order > to > > run the dialyzer? What is the simplest way to do so? It there a simpler > way? > > I am using Erlang R13B01 taken from the Ubuntu repository. > > > > Thanks in advance, > > Guy Wiener. > > Brendan Doyle > Manager, Application Development > Epic Advertising - New York, Toronto, San Francisco, London > www.EpicAdvertising.com > 60 Columbia Way, Suite 310 > Markham, ON L3R 0C9 > (905) 946-0300 x.2358 work > (647) 885-7159 mobile > (888) 666-3120 fax > brendan.doyle@REDACTED > > From navaneethanit@REDACTED Tue Mar 23 18:11:02 2010 From: navaneethanit@REDACTED (NavaTux) Date: Tue, 23 Mar 2010 10:11:02 -0700 (PDT) Subject: Error start the server Message-ID: <67b34fce-afdf-44c7-b794-d8104098e30d@k5g2000pra.googlegroups.com> Eshell V5.6.5 (abort with ^G) (nitrogen@REDACTED)1> Recompile: ./src/pages/web_index i use nitrogen framework,whenever i started my web app,http:// localhost:8000 the error shows the follwed one: what does it mean elaborately? what is the solution? how to identify the errors easily ??#generic question =ERROR REPORT==== 23-Mar-2010::22:05:02 === Failed initiating web server: undefined {{listen,eaddrinuse}, {child,undefined, {httpd_acceptor,{0,0,0,0},8000}, {httpd_acceptor,start_link, [<0.69.0>,ip_comm, {0,0,0,0}, 8000,httpd_conf__0_0_0_0__8000,15000]}, permanent,1000,worker, [httpd_acceptor]}} =INFO REPORT==== 23-Mar-2010::22:05:02 === application: navatest exited: {shutdown,{navatest_app,start,[normal,[]]}} type: temporary From mononcqc@REDACTED Tue Mar 23 18:15:19 2010 From: mononcqc@REDACTED (Fred Hebert) Date: Tue, 23 Mar 2010 13:15:19 -0400 Subject: [erlang-questions] Error start the server In-Reply-To: <67b34fce-afdf-44c7-b794-d8104098e30d@k5g2000pra.googlegroups.com> References: <67b34fce-afdf-44c7-b794-d8104098e30d@k5g2000pra.googlegroups.com> Message-ID: <8b9ee55b1003231015m2683b724k865b0393ab648bc0@mail.gmail.com> {listen,eaddrinuse} usually means the port is already used on this operating system. On Tue, Mar 23, 2010 at 1:11 PM, NavaTux wrote: > Eshell V5.6.5 (abort with ^G) > (nitrogen@REDACTED)1> Recompile: ./src/pages/web_index > > i use nitrogen framework,whenever i started my web app,http:// > localhost:8000 > the error shows the follwed one: > what does it mean elaborately? > what is the solution? > how to identify the errors easily ??#generic question > > > =ERROR REPORT==== 23-Mar-2010::22:05:02 === > Failed initiating web server: > undefined > {{listen,eaddrinuse}, > {child,undefined, > {httpd_acceptor,{0,0,0,0},8000}, > {httpd_acceptor,start_link, > [<0.69.0>,ip_comm, > {0,0,0,0}, > 8000,httpd_conf__0_0_0_0__8000,15000]}, > permanent,1000,worker, > [httpd_acceptor]}} > > > =INFO REPORT==== 23-Mar-2010::22:05:02 === > application: navatest > exited: {shutdown,{navatest_app,start,[normal,[]]}} > type: temporary > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From g@REDACTED Tue Mar 23 18:18:04 2010 From: g@REDACTED (Garrett Smith) Date: Tue, 23 Mar 2010 11:18:04 -0600 Subject: [erlang-questions] Supervisors as factories *and* registries In-Reply-To: <4BA84308.60804@erlang-solutions.com> References: <4BA84308.60804@erlang-solutions.com> Message-ID: On Mon, Mar 22, 2010 at 10:26 PM, Ulf Wiger wrote: > Garrett Smith wrote: >> >> Bit I need a finer grained interface to supervised children. I wish >> supervisors exposed state the way gen_server does, in which case I >> could maintain an index (for example) that would let me access >> children more efficiently. (This seems like a conspicuously missing >> feature, but there's probably a good reason for it.) > > I'm not entirely sure what you're after, but it seems a bit similar > to what I described in the gproc paper from the Erlang Workshop '07: > > http://github.com/uwiger/gproc/raw/master/doc/erlang07-wiger.pdf > > See e.g. chapters 2.2.2 and 6.1 Now I finally know what gproc is! Yes, this is exactly what I'm talking about. In particular: 3.4: When performing operations on batches of calls/processes, it is vital that the operations scale to tens or hundreds of thousand processes. Furthermore, while debugging a live system, the sup-port engineer or designer needs to be able to browse process list-ings without risking damage or overload to the system. Due to the complexity of the software, it is important that dependencies be-tween processes are as visible and regular as possible. At the moment, I'm using supervisor:which_children/1. This isn't terrible as long as the process count stays low and the processes expose a common interface to their properties. My thinking was to extend the supervisor as a registry for use in things like dispatch, process queries, etc. Obviously gproc is a bit more comprehensive :) Is there a recommended branch (trunk?) for using gproc with R13B03+ ? I wouldn't be using the global/distributed functionality, but local registry would I think handily meet my requirements. Garrett From navaneethanit@REDACTED Tue Mar 23 18:19:24 2010 From: navaneethanit@REDACTED (NavaTux) Date: Tue, 23 Mar 2010 10:19:24 -0700 (PDT) Subject: Error start the server In-Reply-To: <8b9ee55b1003231015m2683b724k865b0393ab648bc0@mail.gmail.com> References: <67b34fce-afdf-44c7-b794-d8104098e30d@k5g2000pra.googlegroups.com> <8b9ee55b1003231015m2683b724k865b0393ab648bc0@mail.gmail.com> Message-ID: <5a884c62-1953-4935-be9f-6aaf6e4fbf54@33g2000yqj.googlegroups.com> what is the solution for both? How it causes? This error also happened when i click the URL. CAUGHT ERROR: error-badarg [{erlang,hd,[[]]}, {web_index,body,0}, {element_template,eval_callbacks,2}, {element_template,eval,2}, {element_template,eval,2}, {element_template,eval,2}, {element_template,eval,2}, {element_template,eval,2}] CAUGHT ERROR: error-badarg [{erlang,hd,[[]]}, {web_index,body,0}, {element_template,eval_callbacks,2}, {element_template,eval,2}, {element_template,eval,2}, {element_template,eval,2}, {element_template,eval,2}, {element_template,eval,2}] On Mar 23, 10:15?pm, Fred Hebert wrote: > {listen,eaddrinuse} usually means the port is already used on this operating > system. > > On Tue, Mar 23, 2010 at 1:11 PM, NavaTux wrote: > > Eshell V5.6.5 ?(abort with ^G) > > (nitrogen@REDACTED)1> Recompile: ./src/pages/web_index > > > i use nitrogen framework,whenever i started my web app,http:// > > localhost:8000 > > the error shows the follwed one: > > what does it mean elaborately? > > what is the solution? > > how to identify the errors easily ??#generic question > > > =ERROR REPORT==== 23-Mar-2010::22:05:02 === > > Failed initiating web server: > > undefined > > {{listen,eaddrinuse}, > > ?{child,undefined, > > ? ? ? ?{httpd_acceptor,{0,0,0,0},8000}, > > ? ? ? ?{httpd_acceptor,start_link, > > ? ? ? ? ? ? ? ? ? ? ? ?[<0.69.0>,ip_comm, > > ? ? ? ? ? ? ? ? ? ? ? ? {0,0,0,0}, > > ? ? ? ? ? ? ? ? ? ? ? ? 8000,httpd_conf__0_0_0_0__8000,15000]}, > > ? ? ? ?permanent,1000,worker, > > ? ? ? ?[httpd_acceptor]}} > > > =INFO REPORT==== 23-Mar-2010::22:05:02 === > > ? ?application: navatest > > ? ?exited: {shutdown,{navatest_app,start,[normal,[]]}} > > ? ?type: temporary > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > Seehttp://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > From g@REDACTED Tue Mar 23 18:46:32 2010 From: g@REDACTED (Garrett Smith) Date: Tue, 23 Mar 2010 11:46:32 -0600 Subject: [erlang-questions] Re: Supervisors as factories *and* registries In-Reply-To: <8060C533-B516-4946-8FC7-4307E17F5066@duomark.com> References: <8060C533-B516-4946-8FC7-4307E17F5066@duomark.com> Message-ID: On Tue, Mar 23, 2010 at 9:57 AM, Jay Nelson wrote: > Anthony Shipman wrote: > >> But if the child crashes and restarts the pid will be out of date. > > That was why I had a caveat about restarts, etc. ?In the general case, Ulf's > gproc gives you global access to find processes. ?If you want to keep > something local or of limited propagation, you have to build extra machinery > to monitor the processes: > > 1) A gen_server to store the ets table (or gb_trees or dict since you now > have a pid container for any data structure) > > 2) A supervisor for the new gen_server. ?It could be the same supervisor for > the child processes, with the gen_server started first and a rest_for_one > policy... > > 3) But if it is a simple_one_for_one supervisor now, you need a parent > supervisor with rest_for_one and then start the gen_server first and the > child supervisor second. > > 4) Inside the gen_server, you can cast new Child Pids, monitor them and > remove them from the gen_server state when the go 'DOWN' > > This seems like a lot of machinery, so I can see the desire to want a State > internal to the supervisor, but this approach actual uses a "separation of > concerns" method of isolating each of the new features and allows you to > monitor and manage them independently. Yes, though this machinery is my motivation for using supervisors to handle the process life cycle house keeping in the first place. > Supervisor is a well established and reliable implementation that is kept > simple but allows composition of hierarchies. ?This follows the functional > way of compositional design. ?I do believe it may be time to start talking > about a family of supervisors which have different strategies for managing > their children. ?Right now there is one supervisor with a flag mechanism for > management style. ?Maybe now the experience with non-telco problem areas can > advise the development of a larger family of process supervision models. I'm curious why this doesn't come up more often :) > The second point I wanted to make was to show how a functional design is > extended (as opposed to an object-oriented design). ?An exported function is > an entry point that can be extended or augmented (in this case it would be > called a decorator pattern in OO). ?A new function is exported which calls > the previous function and does some additional work to make it look like a > new implementation. > > So the existing model allows both API augmentation, and functional > composition of the hierarchy to add functionality. ?It is possible, although > maybe tedious for complicated situations, to achieve the goal with the > existing structure. ?But I think a discussion of alternative supervision > approaches may lead to an expanded view ?of managing processes which OTP > could accommodate. Usability (including initial development, transparency of design, and maintainability) is of high importance to me. I *really* try to avoid trap_exit, because it seems a slippery slope into process management spaghetti code. But maybe I'm just a coward :\ I still wonder though why there isn't a supervisor variant that lets you manage custom state the way gen_server and gen_fsm do. I'm assuming it's to avoid complicating an otherwise very simple module. But you'd get some pretty useful stuff: - Ability to index processes (this is not as general purpose as gproc, but it could be used to solve similar problems) - Custom start and restart behavior - Other housekeeping associated with process life cycle management It seems that a handful of behavior callbacks would enable this, but I may be over simplifying things. Garrett From mononcqc@REDACTED Tue Mar 23 19:03:43 2010 From: mononcqc@REDACTED (Fred Hebert) Date: Tue, 23 Mar 2010 14:03:43 -0400 Subject: [erlang-questions] Re: Error start the server In-Reply-To: <5a884c62-1953-4935-be9f-6aaf6e4fbf54@33g2000yqj.googlegroups.com> References: <67b34fce-afdf-44c7-b794-d8104098e30d@k5g2000pra.googlegroups.com> <8b9ee55b1003231015m2683b724k865b0393ab648bc0@mail.gmail.com> <5a884c62-1953-4935-be9f-6aaf6e4fbf54@33g2000yqj.googlegroups.com> Message-ID: <8b9ee55b1003231103sa4bba77l62352268742fb853@mail.gmail.com> On Tue, Mar 23, 2010 at 1:19 PM, NavaTux wrote: > what is the solution for both? How it causes? > For the port problem, it is simply that another service is using that particular port. Either kill that service/application (if you don't need it) or pick a different port for your application. > This error also happened when i click the URL. > > CAUGHT ERROR: error-badarg > [{erlang,hd,[[]]}, > {web_index,body,0}, > {element_template,eval_callbacks,2}, > {element_template,eval,2}, > {element_template,eval,2}, > {element_template,eval,2}, > {element_template,eval,2}, > {element_template,eval,2}] > CAUGHT ERROR: error-badarg > [{erlang,hd,[[]]}, > {web_index,body,0}, > {element_template,eval_callbacks,2}, > {element_template,eval,2}, > {element_template,eval,2}, > {element_template,eval,2}, > {element_template,eval,2}, > {element_template,eval,2}] > > > The error mentioned says that the function {erlang,hd,[[]]} fails with a badarg. {erlang,hd,[[]]} is a different way to write 'erlang:hd([])'. Obviously, the 'hd/1' function can not return anything on empty lists. This is why it fails. > > On Mar 23, 10:15 pm, Fred Hebert wrote: > > {listen,eaddrinuse} usually means the port is already used on this > operating > > system. > > > > On Tue, Mar 23, 2010 at 1:11 PM, NavaTux > wrote: > > > Eshell V5.6.5 (abort with ^G) > > > (nitrogen@REDACTED)1> Recompile: ./src/pages/web_index > > > > > i use nitrogen framework,whenever i started my web app,http:// > > > localhost:8000 > > > the error shows the follwed one: > > > what does it mean elaborately? > > > what is the solution? > > > how to identify the errors easily ??#generic question > > > > > =ERROR REPORT==== 23-Mar-2010::22:05:02 === > > > Failed initiating web server: > > > undefined > > > {{listen,eaddrinuse}, > > > {child,undefined, > > > {httpd_acceptor,{0,0,0,0},8000}, > > > {httpd_acceptor,start_link, > > > [<0.69.0>,ip_comm, > > > {0,0,0,0}, > > > 8000,httpd_conf__0_0_0_0__8000,15000]}, > > > permanent,1000,worker, > > > [httpd_acceptor]}} > > > > > =INFO REPORT==== 23-Mar-2010::22:05:02 === > > > application: navatest > > > exited: {shutdown,{navatest_app,start,[normal,[]]}} > > > type: temporary > > > > > ________________________________________________________________ > > > erlang-questions (at) erlang.org mailing list. > > > Seehttp://www.erlang.org/faq.html > > > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From navaneethanit@REDACTED Tue Mar 23 19:25:40 2010 From: navaneethanit@REDACTED (NavaTux) Date: Tue, 23 Mar 2010 11:25:40 -0700 (PDT) Subject: how to redirect? Message-ID: i am using nitrogen framework, I wanna redirect from one page to another page,I mean in my application i will give the register no as a GET method request, It should be processesed and some value need to be displayed in next page it ll be the result for appropriate register no that we given what i need to do?how to do that?please just give the explanation elabarately From navaneethanit@REDACTED Tue Mar 23 19:27:26 2010 From: navaneethanit@REDACTED (NavaTux) Date: Tue, 23 Mar 2010 11:27:26 -0700 (PDT) Subject: Error start the server In-Reply-To: <8b9ee55b1003231103sa4bba77l62352268742fb853@mail.gmail.com> References: <67b34fce-afdf-44c7-b794-d8104098e30d@k5g2000pra.googlegroups.com> <8b9ee55b1003231015m2683b724k865b0393ab648bc0@mail.gmail.com> <5a884c62-1953-4935-be9f-6aaf6e4fbf54@33g2000yqj.googlegroups.com> <8b9ee55b1003231103sa4bba77l62352268742fb853@mail.gmail.com> Message-ID: <4c1e5dc7-d653-4640-baf9-c9fcd42b8ef3@z18g2000prh.googlegroups.com> fine On Mar 23, 11:03?pm, Fred Hebert wrote: > On Tue, Mar 23, 2010 at 1:19 PM, NavaTux wrote: > > what is the solution for both? How it causes? > > For the port problem, it is simply that another service is using that > particular port. Either kill that service/application (if you don't need it) > or pick a different port for your application. > > > > > This error also happened when i click the URL. > > > CAUGHT ERROR: error-badarg > > [{erlang,hd,[[]]}, > > ?{web_index,body,0}, > > ?{element_template,eval_callbacks,2}, > > ?{element_template,eval,2}, > > ?{element_template,eval,2}, > > ?{element_template,eval,2}, > > ?{element_template,eval,2}, > > ?{element_template,eval,2}] > > CAUGHT ERROR: error-badarg > > [{erlang,hd,[[]]}, > > ?{web_index,body,0}, > > ?{element_template,eval_callbacks,2}, > > ?{element_template,eval,2}, > > ?{element_template,eval,2}, > > ?{element_template,eval,2}, > > ?{element_template,eval,2}, > > ?{element_template,eval,2}] > > > The error mentioned says that the function {erlang,hd,[[]]} fails with a > > badarg. {erlang,hd,[[]]} is a different way to write 'erlang:hd([])'. > Obviously, the 'hd/1' function can not return anything on empty lists. > > This is why it fails. > > > > > On Mar 23, 10:15 pm, Fred Hebert wrote: > > > {listen,eaddrinuse} usually means the port is already used on this > > operating > > > system. > > > > On Tue, Mar 23, 2010 at 1:11 PM, NavaTux > > wrote: > > > > Eshell V5.6.5 ?(abort with ^G) > > > > (nitrogen@REDACTED)1> Recompile: ./src/pages/web_index > > > > > i use nitrogen framework,whenever i started my web app,http:// > > > > localhost:8000 > > > > the error shows the follwed one: > > > > what does it mean elaborately? > > > > what is the solution? > > > > how to identify the errors easily ??#generic question > > > > > =ERROR REPORT==== 23-Mar-2010::22:05:02 === > > > > Failed initiating web server: > > > > undefined > > > > {{listen,eaddrinuse}, > > > > ?{child,undefined, > > > > ? ? ? ?{httpd_acceptor,{0,0,0,0},8000}, > > > > ? ? ? ?{httpd_acceptor,start_link, > > > > ? ? ? ? ? ? ? ? ? ? ? ?[<0.69.0>,ip_comm, > > > > ? ? ? ? ? ? ? ? ? ? ? ? {0,0,0,0}, > > > > ? ? ? ? ? ? ? ? ? ? ? ? 8000,httpd_conf__0_0_0_0__8000,15000]}, > > > > ? ? ? ?permanent,1000,worker, > > > > ? ? ? ?[httpd_acceptor]}} > > > > > =INFO REPORT==== 23-Mar-2010::22:05:02 === > > > > ? ?application: navatest > > > > ? ?exited: {shutdown,{navatest_app,start,[normal,[]]}} > > > > ? ?type: temporary > > > > > ________________________________________________________________ > > > > erlang-questions (at) erlang.org mailing list. > > > > Seehttp://www.erlang.org/faq.html > > > > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > Seehttp://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > From jay@REDACTED Tue Mar 23 19:09:53 2010 From: jay@REDACTED (Jay Nelson) Date: Tue, 23 Mar 2010 11:09:53 -0700 Subject: [erlang-questions] Re: Supervisors as factories *and* registries In-Reply-To: References: <8060C533-B516-4946-8FC7-4307E17F5066@duomark.com> Message-ID: On Mar 23, 2010, at 10:46 AM, Garrett Smith wrote: > > Yes, though this machinery is my motivation for using supervisors to > handle the process life cycle house keeping in the first place. That may be the problem. Supervisors are a design construct intended to manage the restart startegy of processes automatically. As a "separation of concerns" and a reliability issue, it should serve no other purpose. There is the side-effect of organizing the processes so that something like appmon can navigate the system, but it is an artifact of what supervision trees are intended to accomplish. >> Maybe now the experience with non-telco problem areas can >> advise the development of a larger family of process supervision >> models. > > I'm curious why this doesn't come up more often :) Discovery of processes should not be generally available, lest an interloper accidentally send the wrong message (although locking it down makes it hard to diagnose operational errors). In general, an architecture makes choices about the availability and access to processes and uses other mechanisms to provide that access. You are bending the supervision of processes to include a role as a factory and access mechanism and I believe that is bundling too many roles into a critical element of a system. > - Custom start and restart behavior > - Other housekeeping associated with process life cycle management > > It seems that a handful of behavior callbacks would enable this, but I > may be over simplifying things. Now you're on the right track. These two things should be within the realm of a supervisor. Keeping to the bare minimum number of callbacks is ideal because there is less chance of a supervisor failing because of programmer error. Supervisor should have the following goals: 1) Manage the restart strategy of processes so that the system runs continuously 2) Propagate failures so that restart logic can be layered dynamically and failure can be routed around at higher levels of the system 3) Minimal functionality and API so that programmer error is less likely 4) Complete set of features to allow automated reaction to process life cycle events 5) Ability to observe and augment supervisor functionality for parallel mechanisms to implement additional life cycle event responses The last point suggests to me a pairing of supervisor + gen_event might be more useful than exposing the State of supervisor as an architectural choice. Events can be emitted without risk of faulting the supervisor, they can be ignored or collected, and the reaction can be managed in a separate isolated process hierarchy. jay From navaneethanit@REDACTED Tue Mar 23 20:52:12 2010 From: navaneethanit@REDACTED (NavaTux) Date: Tue, 23 Mar 2010 12:52:12 -0700 (PDT) Subject: Need help Simple interconnection problem Message-ID: <25e3b927-01be-4cbb-930f-95a7c8952339@a16g2000pre.googlegroups.com> I have written a code 1.erl which i wanna to be connected with 2.erl to make the link for print some information 1.erl -module(1). -Author("nava"). -export([start/0,loop/1]). start() -> Pid = spawn(fun()->loop() end), register(nava,Pid). loop()-> receive message-> io:format("This is ur message Nava:~n",[]), 2:start(); //to execute 2.erl _-> io:format("Empty"), void end. 2.erl -module(2). -export([start/0,print/1]). start()-> Pid1=spawn(fun() -> print() end). print()-> receive welcome-> io:format("Success:~n"); _-> io:format("try once again u ll get success~n"); end. when i used to compile (nitrogen@REDACTED)3> sync:go(). Recompile: ./src/libs/2 ./src/libs/2.erl:1: bad module declaration ./src/libs/2.erl:19: syntax error before: 'end' ./src/libs/2.erl:2: no module definition ./src/libs/2.erl:2: function print/1 undefined ./src/libs/2.erl:6: function print/0 undefined ./src/libs/2.erl:6: Warning: variable 'Pid1' is unused ok what does go wrong here? why it happens?/ help me plz!! From mononcqc@REDACTED Tue Mar 23 21:07:03 2010 From: mononcqc@REDACTED (Fred Hebert) Date: Tue, 23 Mar 2010 16:07:03 -0400 Subject: [erlang-questions] Need help Simple interconnection problem In-Reply-To: <25e3b927-01be-4cbb-930f-95a7c8952339@a16g2000pre.googlegroups.com> References: <25e3b927-01be-4cbb-930f-95a7c8952339@a16g2000pre.googlegroups.com> Message-ID: <8b9ee55b1003231307r33a1092fq261c3aff0f379643@mail.gmail.com> 2 things: 1. module names have to be atoms. Numbers won't do it. 2. in 2.erl, the last branch of the receive ('_ -> ...') ends with a ';'. This is not required. On Tue, Mar 23, 2010 at 3:52 PM, NavaTux wrote: > I have written a code 1.erl which i wanna to be connected with 2.erl > to make the link for print some information > > 1.erl > > -module(1). > -Author("nava"). > -export([start/0,loop/1]). > start() -> > > Pid = spawn(fun()->loop() end), > register(nava,Pid). > > > > loop()-> > receive > > message-> > io:format("This is ur message Nava:~n",[]), > 2:start(); //to execute 2.erl > > _-> > io:format("Empty"), > void > > end. > > > > 2.erl > > > -module(2). > -export([start/0,print/1]). > > start()-> > > Pid1=spawn(fun() -> print() end). > > print()-> > > receive > > welcome-> > > io:format("Success:~n"); > > _-> > > io:format("try once again u ll get success~n"); > end. > > when i used to compile > > > (nitrogen@REDACTED)3> sync:go(). > Recompile: ./src/libs/2 > ./src/libs/2.erl:1: bad module declaration > ./src/libs/2.erl:19: syntax error before: 'end' > ./src/libs/2.erl:2: no module definition > ./src/libs/2.erl:2: function print/1 undefined > ./src/libs/2.erl:6: function print/0 undefined > ./src/libs/2.erl:6: Warning: variable 'Pid1' is unused > ok > > > what does go wrong here? > why it happens?/ > help me plz!! > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From rpettit@REDACTED Tue Mar 23 22:24:38 2010 From: rpettit@REDACTED (Rick Pettit) Date: Tue, 23 Mar 2010 16:24:38 -0500 Subject: compiler crash with eheap_alloc error compiling an erlang module with R13B04 Message-ID: <5d64f4797686db14fa000d1648d2a60e.squirrel@squirrelmail.vail> I am having some trouble compiling a particular erlang module for R13B04. This particular module was coded back in the days of R11B, and has compiled and run fine on a number of erlang releases since then, including an earlier release of R13B (R13B03). Having grabbed and built the latest R13B04 release, I am having trouble compiling this particular module (many other modules in this same system compile with no problem on R13B04, just not this one). When I try to compile this module, the compiler seems to hang for a very long time--minutes actually. Eventually it crashes with the following error: Crash dump was written to: erl_crash.dump eheap_alloc: Cannot allocate 1781763260 bytes of memory (of type "heap"). Abort (core dumped) The problem is completely reproducible--this particular module just doesn't want to compile. But again, it compiles and runs fine on a number of previous erlang releases, and has run reliably in production for *years* now. I would share the contents of the file with this list, but need to clear that with work first. In the meantime, can anyone shed some light on what might possibly be going on here? Is there anything I can look for in my code that might cause this? -Rick P.S. The exact compiler invocation which is crashing is pretty simple and looks like: prompt> erlc -I /usr/pkg/.../somelib/include -bbeam -o../ebin foo.erl From ok@REDACTED Tue Mar 23 23:29:07 2010 From: ok@REDACTED (Richard O'Keefe) Date: Wed, 24 Mar 2010 11:29:07 +1300 Subject: [erlang-questions] Reading (and ignoring) escape-sequences In-Reply-To: <4BA88648.80809@erlang-solutions.com> References: <4BA76862.3050609@erlang-solutions.com> <20100322234006.GA48453@k2r.org> <4BA88648.80809@erlang-solutions.com> Message-ID: On Mar 23, 2010, at 10:13 PM, Mazen Harake wrote: > Yeah I've already started digging into that. > > The problem is more fundamental then I thought and in the end it > turns out that all libraries (including ncurses) depend on the the > fact that a human can not type in the escape sequence as fast as it > is received by a computer. This makes it _extreamly_ hard (I would > say impossible) to do this from pure Erlang; it has to be done from > inside the driver. There seems to be no fundamental reason why the Erlang _language_ would be unsuitable for the task, it does have time-outs, after all. My own emacs-like screen editor handles this by not _caring_ whether the ESC was generated by some other key or by the user pressing the ESC key. If the sequence "\027[A" comes in, I just don't care whether the user pressed one key (Up arrow) or three (ESC, [, A). (In emacs terms, Meta-[ has its own keymap.) For me, processing fancy-key sequences got a _lot_ easier when I decided to support the ECMA sequences only. These days, when practically all terminals are actually terminal emulators, and they emulate the ECMA/ANSI interface more or less well, it's not too hard. In the old days, we _desperately_ needed termcap/ termlib, because you might have a computer with twenty terminals, no two of them using the same codes. Perhaps the place to start, then, is just how many kinds of terminal you want to support. On my system, toe | wc lists 1562 different terminal descriptions. (There aren't that many ways to encode the fancy keys, but there _are_ lots.) If you want to support any fraction of those terminals, you have no realistic option but to use termcap/termlib. You could process that using Erlang, but why bother? You might as well use the method ncurses uses, by using ncurses in an outboard program. If you only want to support ECMA/ANSI escape sequences, the best way is to redesign your protocol so that you don't care any more than I do whether a sequence was typed by hand or the result of a single keypress. ECMA/ANSI escapes generally have the form ESC [ {parameter;...;parameter} letter so simply ensuring that nobody ever has any other reason to send ESC [ should get you a long way. From spam@REDACTED Tue Mar 23 23:11:56 2010 From: spam@REDACTED (Ian Brown) Date: Tue, 23 Mar 2010 15:11:56 -0700 Subject: [erlang-questions] Need help Simple interconnection problem In-Reply-To: <8b9ee55b1003231307r33a1092fq261c3aff0f379643@mail.gmail.com> References: <25e3b927-01be-4cbb-930f-95a7c8952339@a16g2000pre.googlegroups.com> <8b9ee55b1003231307r33a1092fq261c3aff0f379643@mail.gmail.com> Message-ID: <9A37DD9E-D97C-42DD-B043-749E0139B470@hccp.org> Also, use the '%' for comments...not the slash '/' >> //to execute 2.erl should be % to execute... On Mar 23, 2010, at 1:07 PM, Fred Hebert wrote: > 2 things: > 1. module names have to be atoms. Numbers won't do it. > 2. in 2.erl, the last branch of the receive ('_ -> ...') ends with a ';'. > This is not required. > > > On Tue, Mar 23, 2010 at 3:52 PM, NavaTux wrote: > >> I have written a code 1.erl which i wanna to be connected with 2.erl >> to make the link for print some information >> >> 1.erl >> >> -module(1). >> -Author("nava"). >> -export([start/0,loop/1]). >> start() -> >> >> Pid = spawn(fun()->loop() end), >> register(nava,Pid). >> >> >> >> loop()-> >> receive >> >> message-> >> io:format("This is ur message Nava:~n",[]), >> 2:start(); //to execute 2.erl >> >> _-> >> io:format("Empty"), >> void >> >> end. >> >> >> >> 2.erl >> >> >> -module(2). >> -export([start/0,print/1]). >> >> start()-> >> >> Pid1=spawn(fun() -> print() end). >> >> print()-> >> >> receive >> >> welcome-> >> >> io:format("Success:~n"); >> >> _-> >> >> io:format("try once again u ll get success~n"); >> end. >> >> when i used to compile >> >> >> (nitrogen@REDACTED)3> sync:go(). >> Recompile: ./src/libs/2 >> ./src/libs/2.erl:1: bad module declaration >> ./src/libs/2.erl:19: syntax error before: 'end' >> ./src/libs/2.erl:2: no module definition >> ./src/libs/2.erl:2: function print/1 undefined >> ./src/libs/2.erl:6: function print/0 undefined >> ./src/libs/2.erl:6: Warning: variable 'Pid1' is unused >> ok >> >> >> what does go wrong here? >> why it happens?/ >> help me plz!! >> >> >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED >> >> From hynek@REDACTED Wed Mar 24 01:08:47 2010 From: hynek@REDACTED (Hynek Vychodil) Date: Wed, 24 Mar 2010 01:08:47 +0100 Subject: [erlang-questions] closing a port doesn't kill the connected process? In-Reply-To: References: Message-ID: <4d08db371003231708k14deceeeh8bb96aaf7f67271e@mail.gmail.com> I'm using similar approach. First thing which port process does is sending its PID. Then I set monitor or other linked process to port owner which kills port process if doesn't behave right. Well behaving process is ended by protocol message. If BEAM exits, process should receive SIGPIPE. Default behavior is die on SIGPIPE and well behaving process should not override it. All this together should catch most of cases. It is mine best. On Mon, Mar 22, 2010 at 8:17 PM, Paul Davis wrote: > On Mon, Mar 22, 2010 at 3:00 PM, Jacob Vorreuter > wrote: >> I'm starting a redis server instance by opening an Erlang port. ?When the Erlang process exits or I explicitly close the port the os process is not killed. ?Is there a way to accomplish that? >> >> 1> Port = erlang:open_port({spawn, "redis-server"}, [binary, exit_status]). >> #Port<0.429> >> 2> erlang:port_close(Port). >> true >> >> $ ps -ax | grep redis-server >> 31374 ?? ? ? ? ? 0:00.02 redis-server >> >> Thanks, >> >> Jake >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED >> >> > > Jacob, > > We had to deal with that issue in CouchDB, although our solution isn't > extremely elegant [1]. That spawnkillable code basically echos the os > process id back to Erlang and then uses exec to replace itself with > the requested command. Well behaved processes are expected to still > close when they detect that their stdin has been closed. > > It all seems less than ideal, so I'd also be quite interested if > someone knows of a better way to handle such things. > > Paul Davis > > [1] http://github.com/apache/couchdb/tree/trunk/src/couchdb/priv/spawnkillable/ > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try GoodData now for free: www.gooddata.com From ulf.wiger@REDACTED Wed Mar 24 02:52:50 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Wed, 24 Mar 2010 02:52:50 +0100 Subject: [erlang-questions] Supervisors as factories *and* registries In-Reply-To: References: <4BA84308.60804@erlang-solutions.com> Message-ID: <4BA97072.5070403@erlang-solutions.com> Garrett Smith wrote: > > Is there a recommended branch (trunk?) for using gproc with R13B03+ ? > I wouldn't be using the global/distributed functionality, but local > registry would I think handily meet my requirements. The latest version is the one on http://github.com/uwiger/gproc BR, Ulf W -- Ulf Wiger CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd http://www.erlang-solutions.com --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From rvirding@REDACTED Wed Mar 24 05:47:54 2010 From: rvirding@REDACTED (Robert Virding) Date: Wed, 24 Mar 2010 05:47:54 +0100 Subject: [erlang-questions] closing a port doesn't kill the connected process? In-Reply-To: References: Message-ID: <3dbc6d1c1003232147j4b23df14vafdafbd451bf05e9@mail.gmail.com> When the port is closed the spawned port should get an end-of-file on its stdin. This is the "standard" way for the process to detect when the port has been closed: an end-of-file on stdin. Robert On 22 March 2010 20:00, Jacob Vorreuter wrote: > I'm starting a redis server instance by opening an Erlang port. ?When the Erlang process exits or I explicitly close the port the os process is not killed. ?Is there a way to accomplish that? > > 1> Port = erlang:open_port({spawn, "redis-server"}, [binary, exit_status]). > #Port<0.429> > 2> erlang:port_close(Port). > true > > $ ps -ax | grep redis-server > 31374 ?? ? ? ? ? 0:00.02 redis-server > > Thanks, > > Jake > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From navaneethanit@REDACTED Wed Mar 24 06:27:13 2010 From: navaneethanit@REDACTED (NavaTux) Date: Tue, 23 Mar 2010 22:27:13 -0700 (PDT) Subject: How to use GET or POST method? Message-ID: Here i wanna how to use the GET or POST method in nitrogen using erlang just i ll give a input in textbox,then the result needs to display there, how ll process the input using GET or POST method to get the result,what i need to do it? help me...i am a newbie .. From vladdu55@REDACTED Wed Mar 24 11:23:26 2010 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 24 Mar 2010 11:23:26 +0100 Subject: [erlang-questions] Re: how to call gen_server with JInterface In-Reply-To: <1e8da1ad-e0f1-472a-b10d-b0c81ff5ac9b@k17g2000yqb.googlegroups.com> References: <95be1d3b1003221109i25f1f144sc2316620757a7f9e@mail.gmail.com> <1e8da1ad-e0f1-472a-b10d-b0c81ff5ac9b@k17g2000yqb.googlegroups.com> Message-ID: <95be1d3b1003240323w7cbcec93j95bf10545206e6da@mail.gmail.com> On Tue, Mar 23, 2010 at 11:07, ingo.schramm wrote: > As a side effect of a project I'm working on I wrote a rather generic > facade from Erlang to Java and back. I have an Erlang app ej > supervising a > Java node. On Erlang you can use an ej_srv:send or ej_srv:call and on > the Java side you implement a message handler. That's it. The solution > has > still some limitations but it abstracts a lot of the marshalling > stuff. We have similar functionality (and more) in the libraries used by erlide. Maybe it would be useful to put all these basic additions in a separate project, to make it easier to use for everybody? In the end, if the functionality is generic and useful enough, it might be included in jinterface. regards, Vlad From shomodj@REDACTED Wed Mar 24 11:24:07 2010 From: shomodj@REDACTED (Boris Shomodjvarac) Date: Wed, 24 Mar 2010 11:24:07 +0100 Subject: function_clause Message-ID: <4BA9E847.9010505@gmail.com> Hi all, I have a question about function_clause exception, I have this function_clause: [code] {function_clause, [{foo, '-bar/1-lc$^0/1-0-', [undefined]}, ... [code] Now I know where the problems is, I'm interested in erlang naming convention for naming funs (anonymous functions). From the error above I know its a list comprehension, but is there a document? source code? that I can see how will erlang name those function? I'm using R13. Thanks, Boris. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 260 bytes Desc: OpenPGP digital signature URL: From ivan@REDACTED Wed Mar 24 11:28:22 2010 From: ivan@REDACTED (Ivan Uemlianin) Date: Wed, 24 Mar 2010 10:28:22 +0000 Subject: Generating sine waves and/or audio stream output Message-ID: <4BA9E946.5000009@llaisdy.com> Dear All I am learning Erlang and one of the things I'm interested in is generating sine waves, merging them and streaming them to audio output. I can kind of imagine how generating and merging would work, with a sine wave represented as a list of numbers. Is there an Erlang library or project working with sine waves? I can't imagine how to stream a list of numbers to audio output. Can anyone point me to projects/libraries/ideas for that one? Writing the data to a file would be OK for now, but "live" sound would be much nicer. With thanks and best wishes Ivan -- ============================================================ Ivan A. Uemlianin Speech Technology Research and Development ivan@REDACTED www.llaisdy.com llaisdy.wordpress.com www.linkedin.com/in/ivanuemlianin "Froh, froh! Wie seine Sonnen, seine Sonnen fliegen" (Schiller, Beethoven) ============================================================ From zerthurd@REDACTED Wed Mar 24 11:39:38 2010 From: zerthurd@REDACTED (Maxim Treskin) Date: Wed, 24 Mar 2010 16:39:38 +0600 Subject: [erlang-questions] function_clause In-Reply-To: <4BA9E847.9010505@gmail.com> References: <4BA9E847.9010505@gmail.com> Message-ID: http://groups.google.com/group/erlang-programming/browse_thread/thread/a178a121761ddc24 On 24 March 2010 16:24, Boris Shomodjvarac wrote: > > Hi all, > > I have a question about function_clause exception, I have this > function_clause: > > [code] > {function_clause, > ?[{foo, > ? ?'-bar/1-lc$^0/1-0-', > ? ?[undefined]}, > ?... > [code] > > Now I know where the problems is, I'm interested in erlang naming > convention for naming funs (anonymous functions). From the error above I > know its a list comprehension, but is there a document? source code? > that I can see how will erlang name those function? > > I'm using R13. > > Thanks, > Boris. > > -- Maxim Treskin From shomodj@REDACTED Wed Mar 24 11:44:00 2010 From: shomodj@REDACTED (Boris Shomodjvarac) Date: Wed, 24 Mar 2010 11:44:00 +0100 Subject: [erlang-questions] function_clause In-Reply-To: References: <4BA9E847.9010505@gmail.com> Message-ID: <4BA9ECF0.4070809@gmail.com> Maxim Treskin wrote: > http://groups.google.com/group/erlang-programming/browse_thread/thread/a178a121761ddc24 > Thanks. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 260 bytes Desc: OpenPGP digital signature URL: From mazen.harake@REDACTED Wed Mar 24 12:11:07 2010 From: mazen.harake@REDACTED (Mazen Harake) Date: Wed, 24 Mar 2010 13:11:07 +0200 Subject: [erlang-questions] Reading (and ignoring) escape-sequences In-Reply-To: References: <4BA76862.3050609@erlang-solutions.com> <20100322234006.GA48453@k2r.org> <4BA88648.80809@erlang-solutions.com> Message-ID: <4BA9F34B.4010002@erlang-solutions.com> I think you misunderstood a little of what my problem was; let me try to describe the problem in another way. Take the following assumptions: 1) You have a menu in the terminal, this menu "pops up" prompting for an optional selection 2) You can perform one of the following two actions: a) Exit: Press Esc (\027) to exit the menu and don't make a selection b) Move: Press UpArrow (\027[A) or DownArrow (\027B) to move between selections 3) The program reads character by character In order to distinguish between action a and b you have to be able to (very quickly) peek at the next character in buffer to know if there is a "[" after the "\e". If there isn't then you _assume_ that the user pressed Esc only. This is because it is assumed that a user can not press another key fast enough. Had it been a special key then you would have found a "[" character waiting there after the "\e" because all the related keys would have been copied to the buffer before the first getch() even returns. To relate this to what you wrote; Erlang does have timeouts but this is not relevant because what is really needed is the ability to peek into the second character without blocking for input. An even better solution would be if this was done at a lower level so that perhaps (like ncurses) in erlang you would get e.g. 40x as the character for UpArrow (or whatever, it would probably be defined as macros anyway). I'm curious; how would you handle the mentioned scenario in your editor? Anyway it was a surprise to me that these sort of things weren't handled in a better way overall and even if Erlang wasn't really made to handle these kind of things I would hope that it would have better support in the future because it is absolutely gold to be able to write tools like e.g. table view and the debugger without the need for gs (or wx) without the nasty scrolling all the time (e.g. like top). /Mazen Let's assume that we tried doing this in Erlang, then there would be Well it is interesting when you say: If the sequence is "\027[A" On 24/03/2010 00:29, Richard O'Keefe wrote: > > On Mar 23, 2010, at 10:13 PM, Mazen Harake wrote: > >> Yeah I've already started digging into that. >> >> The problem is more fundamental then I thought and in the end it >> turns out that all libraries (including ncurses) depend on the the >> fact that a human can not type in the escape sequence as fast as it >> is received by a computer. This makes it _extreamly_ hard (I would >> say impossible) to do this from pure Erlang; it has to be done from >> inside the driver. > > There seems to be no fundamental reason why the Erlang _language_ > would be unsuitable for the task, it does have time-outs, after all. > > My own emacs-like screen editor handles this by not _caring_ > whether the ESC was generated by some other key or by the user > pressing the ESC key. If the sequence "\027[A" comes in, I just > don't care whether the user pressed one key (Up arrow) or three > (ESC, [, A). (In emacs terms, Meta-[ has its own keymap.) > > For me, processing fancy-key sequences got a _lot_ easier when I > decided to support the ECMA sequences only. These days, when > practically all terminals are actually terminal emulators, and > they emulate the ECMA/ANSI interface more or less well, it's not > too hard. In the old days, we _desperately_ needed termcap/ > termlib, because you might have a computer with twenty terminals, > no two of them using the same codes. > > Perhaps the place to start, then, is just how many kinds of terminal > you want to support. On my system, > toe | wc > lists 1562 different terminal descriptions. (There aren't that > many ways to encode the fancy keys, but there _are_ lots.) If you > want to support any fraction of those terminals, you have no > realistic option but to use termcap/termlib. You could process > that using Erlang, but why bother? You might as well use the method > ncurses uses, by using ncurses in an outboard program. > > If you only want to support ECMA/ANSI escape sequences, the best way > is to redesign your protocol so that you don't care any more than I > do whether a sequence was typed by hand or the result of a single > keypress. ECMA/ANSI escapes generally have the form > ESC [ {parameter;...;parameter} letter > so simply ensuring that nobody ever has any other reason to send > ESC [ should get you a long way. > --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From kostis@REDACTED Wed Mar 24 14:50:53 2010 From: kostis@REDACTED (Kostis Sagonas) Date: Wed, 24 Mar 2010 15:50:53 +0200 Subject: [erlang-questions] compiler crash with eheap_alloc error compiling an erlang module with R13B04 In-Reply-To: <5d64f4797686db14fa000d1648d2a60e.squirrel@squirrelmail.vail> References: <5d64f4797686db14fa000d1648d2a60e.squirrel@squirrelmail.vail> Message-ID: <4BAA18BD.1010602@cs.ntua.gr> Rick Pettit wrote: > I am having some trouble compiling a particular erlang module for R13B04. > > This particular module was coded back in the days of R11B, and has > compiled and run fine on a number of erlang releases since then, including > an earlier release of R13B (R13B03). > > Having grabbed and built the latest R13B04 release, I am having trouble > compiling this particular module .... > > When I try to compile this module, the compiler seems to hang for a very > long time--minutes actually. Eventually it crashes with the following > error: > > Crash dump was written to: erl_crash.dump > eheap_alloc: Cannot allocate 1781763260 bytes of memory (of type "heap"). > Abort (core dumped) > > The problem is completely reproducible--this particular module just > doesn't want to compile. But again, it compiles and runs fine on a number > of previous erlang releases, and has run reliably in production for > *years* now. > > I would share the contents of the file with this list, but need to clear > that with work first. It's conceivable that somebody from the OTP team has replied to you already but, in case they have not, here is what you should do. From your description of the problem, most probably either the compiler is hitting some bug that causes it to go into an infinite loop allocating like crazy, or it triggers a bug in the garbage collector. What you should do is try to minimize the file so that only functions that trigger the bad behaviour are part of the file (they may be only very few such functions) and send the file either to this list (a stripped down version of your code is for all practical purposes unusable for anybody other than a compiler writer) or to Bjorn Gustavsson. Kostis From thomasl_erlang@REDACTED Wed Mar 24 14:54:24 2010 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 24 Mar 2010 06:54:24 -0700 (PDT) Subject: [erlang-questions] function_clause In-Reply-To: <4BA9E847.9010505@gmail.com> References: <4BA9E847.9010505@gmail.com> Message-ID: <892636.18994.qm@web111405.mail.gq1.yahoo.com> ----- Original Message ---- > From: Boris Shomodjvarac > Now I know where the problems is, > I'm interested in erlang naming convention for naming funs (anonymous > functions). From the error above I know its a list comprehension, but is > there a document? source code? that I can see how will erlang name those > function? Look in the compiler sources. You probably shouldn't rely on the name having any deep meaning apart from being a fresh function name. Best, Thomas From jay@REDACTED Wed Mar 24 15:24:20 2010 From: jay@REDACTED (Jay Nelson) Date: Wed, 24 Mar 2010 07:24:20 -0700 Subject: Trouble with init/1 spec Message-ID: <03DF3025-90DD-4DF8-AA08-A109487DA03A@duomark.com> I am having trouble specifying an init/1 function. This should be a problem for most gen_xxx applications that use records for State, so I must have not used the right query terms to search the archives. Here is my init/1 function for a gen_fsm: -spec init(list()) -> {ok, ?RECONNECT, #twfsm_state{}}. init([Server, Port, User, Pwd]) -> {ok, ?RECONNECT, #twfsm_state{server=Server, port=Port, user=User, pwd=Pwd}}. The problem is that I cannot figure out how to specify that I really am passing in a list of the type [string(), non_neg_integer(), string (), string()]. Declaring it as list(any()) means the fields on the record have to all be declared any(). As long as my port field is declared non_neg_integer() in the record definition, I can't get past the dialyzer warning. On a separate note non_neg_integer() is equivalent to 0.. Can the user declare something like my_lucky_numbers() = 12..17 or is the integer .. notation just used to explain what happens internally for the special built-in types? jay From kostis@REDACTED Wed Mar 24 17:00:52 2010 From: kostis@REDACTED (Kostis Sagonas) Date: Wed, 24 Mar 2010 18:00:52 +0200 Subject: [erlang-questions] Trouble with init/1 spec In-Reply-To: <03DF3025-90DD-4DF8-AA08-A109487DA03A@duomark.com> References: <03DF3025-90DD-4DF8-AA08-A109487DA03A@duomark.com> Message-ID: <4BAA3734.6050701@cs.ntua.gr> Jay Nelson wrote: > I am having trouble specifying an init/1 function. This should be a > problem for most gen_xxx applications that use records for State, so I > must have not used the right query terms to search the archives. > > Here is my init/1 function for a gen_fsm: > > -spec init(list()) -> {ok, ?RECONNECT, #twfsm_state{}}. > > init([Server, Port, User, Pwd]) -> > {ok, ?RECONNECT, > #twfsm_state{server=Server, port=Port, user=User, pwd=Pwd}}. > > > The problem is that I cannot figure out how to specify that I really am > passing in a list of the type [string(), non_neg_integer(), string(), > string()]. You cannot do that. The type language is not expressive enough to allow the declaration of a 4-element list and this is what's the problem here. However, you can specify a slightly more accurate type than list() though (btw, this is also written as [_].) The type [string() | non_neg_integer()] constrains the input argument better than list() > Declaring it as list(any()) means the fields on the record > have to all be declared any(). As long as my port field is declared > non_neg_integer() in the record definition, I can't get past the > dialyzer warning. Huh? Are you sure? The record fields can be declared whatever type you want. I am not sure to what dialyzer warning you are referring to, but perhaps we can take this off list. > On a separate note non_neg_integer() is equivalent to 0.. > Can the user declare something like my_lucky_numbers() = 12..17 or is > the integer .. notation just used to explain what happens internally for > the special built-in types? Well, sort of. The .. notation can be used to define your lucky numbers, but it can only be used if you specify both a lower and an upper limit. In other words, this is allowed: -type my_lucky_number() :: 12..17. but this one is not: -type my_lucky_number() :: 12.. . Kostis From jay@REDACTED Wed Mar 24 17:19:59 2010 From: jay@REDACTED (Jay Nelson) Date: Wed, 24 Mar 2010 09:19:59 -0700 Subject: [erlang-questions] Trouble with init/1 spec In-Reply-To: <4BAA3734.6050701@cs.ntua.gr> References: <03DF3025-90DD-4DF8-AA08-A109487DA03A@duomark.com> <4BAA3734.6050701@cs.ntua.gr> Message-ID: On Mar 24, 2010, at 9:00 AM, Kostis Sagonas wrote: > The type > > [string() | non_neg_integer()] > > constrains the input argument better than list() > >> Declaring it as list(any()) means the fields on the record have >> to all be declared any(). As long as my port field is declared >> non_neg_integer() in the record definition, I can't get past the >> dialyzer warning. > > Huh? Are you sure? The record fields can be declared whatever > type you want. I am not sure to what dialyzer warning you are > referring to, but perhaps we can take this off list. I didn't state that too clearly. The list(any()) caused dialyzer to deduce that the record assignment was creating an any() value in a field, therefore my record declaration each field needs to be any() rather than string() or non_neg_integer(). If I make the arglist [string() | non_neg_integer()], then I have to declare all my string() fields in the record to be of the same type because of the record constructor assignments which is really misleading to label a server name or user name as a non_neg_integer() and propagate that to any functions that access the field. Right now the only way to get around it easily is to make my port field a string() and do the list_to_integer/1 conversion every time I access it. That way all the fields in the init/1 list just happen to become string(). This seems to be a general problem for the init/1 behaviour callbacks which are designed to be flexible, but don't map easily to a record assignment that dialyzer can reason about. jay From magnus@REDACTED Wed Mar 24 17:20:52 2010 From: magnus@REDACTED (Magnus Henoch) Date: Wed, 24 Mar 2010 16:20:52 +0000 Subject: Trouble with init/1 spec In-Reply-To: <03DF3025-90DD-4DF8-AA08-A109487DA03A@duomark.com> (Jay Nelson's message of "Wed, 24 Mar 2010 07:24:20 -0700") References: <03DF3025-90DD-4DF8-AA08-A109487DA03A@duomark.com> Message-ID: <848w9hsnbv.fsf@linux-b2a3.site> Jay Nelson writes: > I am having trouble specifying an init/1 function. This should be a > problem for most gen_xxx applications that use records for State, so > I must have not used the right query terms to search the archives. > > Here is my init/1 function for a gen_fsm: > > -spec init(list()) -> {ok, ?RECONNECT, #twfsm_state{}}. > > init([Server, Port, User, Pwd]) -> > {ok, ?RECONNECT, > #twfsm_state{server=Server, port=Port, user=User, pwd=Pwd}}. My favourite fix for that is to pass a tuple instead of a list. gen_{server,fsm}:start_link accept any term as the argument, and pass it unchanged to the init callback function, so I don't really see any reason to use a list there. -- Magnus Henoch, magnus@REDACTED Erlang Solutions http://www.erlang-solutions.com/ --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From mbj@REDACTED Wed Mar 24 17:22:51 2010 From: mbj@REDACTED (Martin Bjorklund) Date: Wed, 24 Mar 2010 09:22:51 -0700 (PDT) Subject: [erlang-questions] Trouble with init/1 spec In-Reply-To: <03DF3025-90DD-4DF8-AA08-A109487DA03A@duomark.com> References: <03DF3025-90DD-4DF8-AA08-A109487DA03A@duomark.com> Message-ID: <20100324.092251.47274081.mbj@tail-f.com> Hi, Jay Nelson wrote: > I am having trouble specifying an init/1 function. This should be a > problem for most gen_xxx applications that use records for State, so I > must have not used the right query terms to search the archives. > > Here is my init/1 function for a gen_fsm: > > -spec init(list()) -> {ok, ?RECONNECT, #twfsm_state{}}. > > init([Server, Port, User, Pwd]) -> > {ok, ?RECONNECT, > #twfsm_state{server=Server, port=Port, user=User, pwd=Pwd}}. > > > The problem is that I cannot figure out how to specify that I really > am passing in a list of the type [string(), non_neg_integer(), > string(), string()]. Declaring it as list(any()) means the fields on > the record have to all be declared any(). As long as my port field is > declared non_neg_integer() in the record definition, I can't get past > the dialyzer warning. Make the argument to init/1 a 4-tuple instead of a list. /martin From kostis@REDACTED Wed Mar 24 17:40:39 2010 From: kostis@REDACTED (Kostis Sagonas) Date: Wed, 24 Mar 2010 18:40:39 +0200 Subject: [erlang-questions] Trouble with init/1 spec In-Reply-To: References: <03DF3025-90DD-4DF8-AA08-A109487DA03A@duomark.com> <4BAA3734.6050701@cs.ntua.gr> Message-ID: <4BAA4087.1010308@cs.ntua.gr> Jay Nelson wrote: > > On Mar 24, 2010, at 9:00 AM, Kostis Sagonas wrote: > >> The type >> >> [string() | non_neg_integer()] >> >> constrains the input argument better than list() >> >>> Declaring it as list(any()) means the fields on the record have to >>> all be declared any(). As long as my port field is declared >>> non_neg_integer() in the record definition, I can't get past the >>> dialyzer warning. >> >> Huh? Are you sure? The record fields can be declared whatever type >> you want. I am not sure to what dialyzer warning you are referring >> to, but perhaps we can take this off list. > > I didn't state that too clearly. The list(any()) caused dialyzer to > deduce that the record assignment was creating an any() value in a > field, therefore my record declaration each field needs to be any() > rather than string() or non_neg_integer(). > > If I make the arglist [string() | non_neg_integer()], then I have to > declare all my string() fields in the record to be of the same type > because of the record constructor assignments which is really misleading > to label a server name or user name as a non_neg_integer() and propagate > that to any functions that access the field. > > Right now the only way to get around it easily is to make my port field > a string() and do the list_to_integer/1 conversion every time I access > it. That way all the fields in the init/1 list just happen to become > string(). I really have no idea what you are referring to... Have you actually tried the above (if so, some example code showing the dialyzer warning will help me see what the trouble is), or you are just assuming that you will have to do them? For example, I tried the following (a simplified version of your code): --------------------------------------------------------------- -module(jay). -export([init/1]). -record(twfsm_state, {server = "abc" :: string(), port = 42 :: integer()}). -spec init(list()) -> {ok, #twfsm_state{}}. init([Server, Port]) -> {ok, #twfsm_state{server=Server, port=Port}}. --------------------------------------------------------------- run dialyzer as follows: % dialyzer jay.erl Checking whether the PLT /home/kostis/.dialyzer_plt is up-to-date... yes Proceeding with analysis... done in 0m4.38s done (passed successfully) and as you can see I got no warnings from dialyzer. I've even changed the spec to: -spec init([string() | integer()]) -> {ok, #twfsm_state{}}. and still got no warnings from dialyzer. I really want to understand this. What exactly is that you claim you cannot really do without getting a dialyzer warning? Kostis From schramm.ingo@REDACTED Wed Mar 24 18:03:00 2010 From: schramm.ingo@REDACTED (ingo.schramm) Date: Wed, 24 Mar 2010 10:03:00 -0700 (PDT) Subject: how to call gen_server with JInterface In-Reply-To: <95be1d3b1003240323w7cbcec93j95bf10545206e6da@mail.gmail.com> References: <95be1d3b1003221109i25f1f144sc2316620757a7f9e@mail.gmail.com> <1e8da1ad-e0f1-472a-b10d-b0c81ff5ac9b@k17g2000yqb.googlegroups.com> <95be1d3b1003240323w7cbcec93j95bf10545206e6da@mail.gmail.com> Message-ID: Cool. I will do this as soon as possible and the solution is stable. It is BTW all on top of Jinterface. On Mar 24, 11:23?am, Vlad Dumitrescu wrote: > On Tue, Mar 23, 2010 at 11:07, ingo.schramm wrote: > > As a side effect of a project I'm working on I wrote a rather generic > > facade from Erlang to Java and back. I have an Erlang app ej > > supervising a > > Java node. On Erlang you can use an ej_srv:send or ej_srv:call and on > > the Java side you implement a message handler. That's it. The solution > > has > > still some limitations but it abstracts a lot of the marshalling > > stuff. > > We have similar functionality (and more) in the libraries used by > erlide. Maybe it would be useful to put all these basic additions in a > separate project, to make it easier to use for everybody? In the end, > if the functionality is generic and useful enough, it might be > included in jinterface. > > regards, > Vlad > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > Seehttp://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED From jay@REDACTED Wed Mar 24 17:30:56 2010 From: jay@REDACTED (Jay Nelson) Date: Wed, 24 Mar 2010 09:30:56 -0700 Subject: Trouble with init/1 spec In-Reply-To: <848w9hsnbv.fsf@linux-b2a3.site> References: <03DF3025-90DD-4DF8-AA08-A109487DA03A@duomark.com> <848w9hsnbv.fsf@linux-b2a3.site> Message-ID: <37B13782-0AEF-4D13-87C1-131F49EE81DD@duomark.com> On Mar 24, 2010, at 9:20 AM, Magnus Henoch wrote: > > My favourite fix for that is to pass a tuple instead of a list. > gen_{server,fsm}:start_link accept any term as the argument, and > pass it > unchanged to the init callback function, so I don't really see any > reason to use a list there. Wow! After all these years, for some reason I always thought init/1 took a list of args the way {M,F,A} does. I don't know if I picked it up because of all the examples or what, but of course it makes no sense that fun/1 could specify the type of the argument. I always have boiler plate code from start_link/xx to init/1 that rebundles all my args as a list. Doh! And of course using a tuple follows the OTP coding standard for fixed length data structures, as well as utilizing dialyzer the way it was intended. Thanks All! jay From jim.mccoy@REDACTED Wed Mar 24 18:31:53 2010 From: jim.mccoy@REDACTED (Jim McCoy) Date: Wed, 24 Mar 2010 10:31:53 -0700 Subject: [erlang-questions] Dets Tables or Mnesia In-Reply-To: References: Message-ID: Will you be processing the data on the fly and using persistent storage mostly for archival purposes or will you be doing a lot of data analysis and processing on the old messages? Will the server be on a single box or multiple boxes? Will access to the persistent storage be mostly random or mostly sequential? More info would really help out on the potential list of suggetions. For starters though, neither dets nor mnesia are likely to be the storage mechanism you want to use for this if you are dealing with anything a message load of any significance. On Tue, Mar 23, 2010 at 1:54 AM, Luc Evers wrote: > Hi, > > ? ToDo > > ? ?Analyzing syslog message from a big amount of routers, with a different > message structure. > ? ?Sending alarms via (regular expression) message ?check. > > ? Question: > ? ? ? Should I use 'Dets Tables ' or 'Mnesia' ?as database? > > ?Thanks! > > ?Luc. > From w.a.de.jong@REDACTED Wed Mar 24 19:34:34 2010 From: w.a.de.jong@REDACTED (Willem de Jong) Date: Wed, 24 Mar 2010 19:34:34 +0100 Subject: [erlang-questions] Generating sine waves and/or audio stream output In-Reply-To: <4BA9E946.5000009@llaisdy.com> References: <4BA9E946.5000009@llaisdy.com> Message-ID: <407d9ef81003241134v6d119a7cl4538c38ef90f24ec@mail.gmail.com> Hello Ivan, I have an erlang module that generates sounds. It can generate different wave forms (right now all I need is a saw-like shape and a sinus shape). I am attaching it. It is a bit messy, perhaps, but it should give you an impression of how it can be done. The synthesize() function uses the sinus() function to create a number of complete waves, and then pastes these together repeatedly (I assumed that would be more efficient that calculating the sinus() function for each sample). The syntesize() function returns a couple of sound fragments: an "attaque" bit that starts with an amplitude of zero, a fade-out bit where the volume decreases back to 0, and a long and a short bit of sound with a stable volume. Another module creates a complete sound-fragment of the desired duration by pasting together the attaque, a number of long fragments and short fragments in such a way that it matches the duration (as precisely as possible), and a fade out bit. As you can see this creates sounds with a fixed pitch and volume (within one sound, that is). Also note that both the length and the pitch of the sound will be approximations. I created this to generate music for my web-site: http://coria.nl. You can try the result there, if you want. It is a site that enables me and the other members of my choir (and anyone else who is interested) to practise our music. Any comments or suggestions will be quite welcome, Good luck, Willem On Wed, Mar 24, 2010 at 11:28 AM, Ivan Uemlianin wrote: > Dear All > > I am learning Erlang and one of the things I'm interested in is > generating sine waves, merging them and streaming them to audio output. > > I can kind of imagine how generating and merging would work, with a sine > wave represented as a list of numbers. Is there an Erlang library or > project working with sine waves? > > I can't imagine how to stream a list of numbers to audio output. Can > anyone point me to projects/libraries/ideas for that one? Writing the > data to a file would be OK for now, but "live" sound would be much nicer. > > With thanks and best wishes > > Ivan > > -- > ============================================================ > Ivan A. Uemlianin > Speech Technology Research and Development > > ivan@REDACTED > www.llaisdy.com > llaisdy.wordpress.com > www.linkedin.com/in/ivanuemlianin > > "Froh, froh! Wie seine Sonnen, seine Sonnen fliegen" > (Schiller, Beethoven) > ============================================================ > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: sound.hrl Type: application/octet-stream Size: 159 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: sound.erl Type: application/octet-stream Size: 4495 bytes Desc: not available URL: From francesco@REDACTED Wed Mar 24 20:00:51 2010 From: francesco@REDACTED (Francesco Cesarini (Erlang Solutions)) Date: Wed, 24 Mar 2010 19:00:51 +0000 Subject: ErlLounge in Conjunction with the SF Bay Erlang Factory 25/3 18.30pm Message-ID: <4BAA6163.10506@erlang-solutions.com> The SF Erlounge this Thursday (25/3) is open to Erlang enthusiasts who can not make it to the Erlang Factory but still want the chance to meet the speakers and other conference attendees. Attending is free, but as there are limited places, non-conference attendees must register here: http://bit.ly/cEVyvJ >From 18:30-19:30 on Thursday 25th, in an environment of beer, cool drinks and snacks, there will be a series of 10-minute talks as the first part of the Erlounge. User-groups and other Erlang interested parties will be given the opportunity to introduce themselves , their interests, their projects etc. If you wish to give a 10-minute talk, sign up on the day. We will be meeting at the Coyote Point Yacht Club. For those who will not be driving, we have arranged a shuttle bus between Burlingame Caltrain station, SFO Hilton (The Conference Venue) and the Coyote Point Yacht Club (Erl Lounge Location). We will let you have the details once you've signed up. You can othewise take the BART to SFO and catch the complimentary hotel Shuttle bus to the SF Airport Hilton (10 minute drive) and catch the ErlLounge shuttle/ or walk from the Hotel. If you want to walk, expect a very pleasant 40 minute walk via Coyote Point Park with views of the SF bay. Directions for those walking / driving are available here: http://www.erlang-factory.com/upload/item/4/Erloungedirections.pdf If you are able to make it to the Factory for two days of talks with over 40 speakers, there are still a few places left. Pls register here: https://www.erlang-factory.com/conference/SFBay2010/register Hope to see you there! Francesco --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From jay@REDACTED Wed Mar 24 19:19:43 2010 From: jay@REDACTED (Jay Nelson) Date: Wed, 24 Mar 2010 11:19:43 -0700 Subject: [erlang-questions] Trouble with init/1 spec In-Reply-To: <4BAA4087.1010308@cs.ntua.gr> References: <03DF3025-90DD-4DF8-AA08-A109487DA03A@duomark.com> <4BAA3734.6050701@cs.ntua.gr> <4BAA4087.1010308@cs.ntua.gr> Message-ID: <9EAAE192-4A69-4E5F-BD90-C27872BE1819@duomark.com> On Mar 24, 2010, at 9:40 AM, Kostis Sagonas wrote: > For example, I tried the following (a simplified version of your > code): > --------------------------------------------------------------- > -module(jay). > -export([init/1]). > > -record(twfsm_state, {server = "abc" :: string(), > port = 42 :: integer()}). > > -spec init(list()) -> {ok, #twfsm_state{}}. > > init([Server, Port]) -> > {ok, #twfsm_state{server=Server, port=Port}}. > --------------------------------------------------------------- > I really want to understand this. What exactly is that you claim > you cannot really do without getting a dialyzer warning? > > Kostis > I had another mistake in one of the other fields in the record that caused the problem (but other errors led me to my arguments issue). I had declared: -record(twfsm_state, { server :: string(), port :: pos_integer(), conn_attempts = 0 :: pos_integer() }. jay.erl:20: The specification for jay:init/1 states that the function might also return {'ok',{'twfsm_state','undefined' | string (),'undefined' | pos_integer(),pos_integer(),binary()}} but the inferred return is none() jay.erl:22: Function init/1 has no local return jay.erl:23: Record construction #twfsm_state{server::any(),port::any (),conn_attempts::0} violates the declared type for #twfsm_state{} Changing conn_attempts to non_neg_integer() solves the problem that my initial value is invalid for the type. What would have helped is if the record construction error singled out only the fields that violated the declared datatypes after the entry 'jay.erl:23', maybe as a list similar to error_logger:error_report might present, since I actually had 15 or so fields. For example: jay.erl:23: Record construction #twfsm_state{server::any(),port::any (),conn_attempts::0} violates the declared type for #twfsm_state{} jay.erl:23: The following fields are incorrect: conn_attempts::0 => pos_integer() Although, I still would have thought there was a type failure. In your example, you set the values of the record to values of type any () even though they were declared to be of type string() and integer (). Why is that acceptable? In my error printout it shows dialyzer interpreting the fields as type any(). jay From kostis@REDACTED Wed Mar 24 21:34:54 2010 From: kostis@REDACTED (Kostis Sagonas) Date: Wed, 24 Mar 2010 22:34:54 +0200 Subject: [erlang-questions] Trouble with init/1 spec In-Reply-To: <9EAAE192-4A69-4E5F-BD90-C27872BE1819@duomark.com> References: <03DF3025-90DD-4DF8-AA08-A109487DA03A@duomark.com> <4BAA3734.6050701@cs.ntua.gr> <4BAA4087.1010308@cs.ntua.gr> <9EAAE192-4A69-4E5F-BD90-C27872BE1819@duomark.com> Message-ID: <4BAA776E.4000804@cs.ntua.gr> Jay Nelson wrote: > > On Mar 24, 2010, at 9:40 AM, Kostis Sagonas wrote: >> For example, I tried the following (a simplified version of your code): >> --------------------------------------------------------------- >> -module(jay). >> -export([init/1]). >> >> -record(twfsm_state, {server = "abc" :: string(), >> port = 42 :: integer()}). >> >> -spec init(list()) -> {ok, #twfsm_state{}}. >> >> init([Server, Port]) -> >> {ok, #twfsm_state{server=Server, port=Port}}. >> --------------------------------------------------------------- >> I really want to understand this. What exactly is that you claim you >> cannot really do without getting a dialyzer warning? >> >> Kostis >> > > I had another mistake in one of the other fields in the record that > caused the problem (but other errors led me to my arguments issue). I > had declared: > > -record(twfsm_state, { > server :: string(), > port :: pos_integer(), > conn_attempts = 0 :: pos_integer() > }. > > jay.erl:20: The specification for jay:init/1 states that the function > might also return {'ok',{'twfsm_state','undefined' | > string(),'undefined' | pos_integer(),pos_integer(),binary()}} but the > inferred return is none() > jay.erl:22: Function init/1 has no local return > jay.erl:23: Record construction > #twfsm_state{server::any(),port::any(),conn_attempts::0} violates the > declared type for #twfsm_state{} > > > Changing conn_attempts to non_neg_integer() solves the problem that my > initial value is invalid for the type. > > What would have helped is if the record construction error singled out > only the fields that violated the declared datatypes after the entry > 'jay.erl:23', maybe as a list similar to error_logger:error_report might > present, since I actually had 15 or so fields. > > For example: > > jay.erl:23: Record construction > #twfsm_state{server::any(),port::any(),conn_attempts::0} violates the > declared type for #twfsm_state{} > > jay.erl:23: The following fields are incorrect: > conn_attempts::0 => pos_integer() Yes, this would have indeed helped, but I do not see how this error is relevant/related to the input arguments of the spec, which triggered this discussion. The dialyzer warnings you got clearly state that: 1) there is an error in the return type of function init/1 2) the function has no local return and 3) there is some type violation in the record construction. Nothing of these is related to whether the spec for init/1 has arguments of type list(any()) or something else. > Although, I still would have thought there was a type failure. In your > example, you set the values of the record to values of type any() even > though they were declared to be of type string() and integer(). Why is > that acceptable? In my error printout it shows dialyzer interpreting > the fields as type any(). The type any() means "anything goes". It's possible that you are not fully aware of what specs and type declarations in records do. They put extra constraints that have to be compatible with the types that dialyzer infers (the so called "success typings"). An inferred type of any() for some record field is compatible with a user declaration that the field is of type string(). If compatible, the strongest of the two -- in this case string() -- is used from then on. Kostis From jeedward@REDACTED Wed Mar 24 20:48:35 2010 From: jeedward@REDACTED (John Edward) Date: Wed, 24 Mar 2010 12:48:35 -0700 (PDT) Subject: Call for papers (Deadline Extended): MULTICONF-10, USA, July 2010 Message-ID: <459762.62895.qm@web45913.mail.sp1.yahoo.com> It would be highly appreciated if you could share this announcement with your colleagues, students and individuals whose research is in computer science, computer engineering, information science and related areas. Call for papers (Deadline Extended): MULTICONF-10, USA, July 2010 The 2010 multi-conference (MULTICONF-10) (website: http://www.PromoteResearch.org ) will be held during July 12-14, 2010 in Orlando, Florida, USA. The primary goal of MULTICONF is to promote research and developmental activities in computer science, information technology, control engineering, and related fields. Another goal is to promote the dissemination of research to a multidisciplinary audience and to facilitate communication among researchers, developers, practitioners in different fields. The following conferences are planned to be organized as part of MULTICONF-10. ? International Conference on Artificial Intelligence and Pattern Recognition (AIPR-10) ? International Conference on Automation, Robotics and Control Systems (ARCS-10) ? International Conference on Bioinformatics, Computational Biology, Genomics and Chemoinformatics (BCBGC-10) ? International Conference on Computer Communications and Networks (CCN-10) ? International Conference on Enterprise Information Systems and Web Technologies (EISWT-10) ? International Conference on High Performance Computing Systems (HPCS-10) ? International Conference on Information Security and Privacy (ISP-10) ? International Conference on Image and Video Processing and Computer Vision (IVPCV-10) ? International Conference on Software Engineering Theory and Practice (SETP-10) ? International Conference on Theoretical and Mathematical Foundations of Computer Science (TMFCS-10) MULTICONF-10 will be held at Imperial Swan Hotel and Suites. It is a full-service resort that puts you in the middle of the fun! Located 1/2 block south of the famed International Drive, the hotel is just minutes from great entertainment like Walt Disney World? Resort, Universal Studios and Sea World Orlando. Guests can enjoy free scheduled transportation to these theme parks, as well as spacious accommodations, outdoor pools and on-site dining ? all situated on 10 tropically landscaped acres. Here, guests can experience a full-service resort with discount hotel pricing in Orlando. Please see the website http://www.PromoteResearch.org for more details. Sincerely John Edward From jay@REDACTED Wed Mar 24 22:19:23 2010 From: jay@REDACTED (Jay Nelson) Date: Wed, 24 Mar 2010 14:19:23 -0700 Subject: [erlang-questions] Trouble with init/1 spec In-Reply-To: <4BAA776E.4000804@cs.ntua.gr> References: <03DF3025-90DD-4DF8-AA08-A109487DA03A@duomark.com> <4BAA3734.6050701@cs.ntua.gr> <4BAA4087.1010308@cs.ntua.gr> <9EAAE192-4A69-4E5F-BD90-C27872BE1819@duomark.com> <4BAA776E.4000804@cs.ntua.gr> Message-ID: <00D9B519-0611-49AC-9D19-0C88D8848C1F@duomark.com> On Mar 24, 2010, at 1:34 PM, Kostis Sagonas wrote: > Yes, this would have indeed helped, but I do not see how this error > is relevant/related to the input arguments of the spec, which > triggered this discussion. The dialyzer warnings you got clearly > state that: > > 1) there is an error in the return type of function init/1 > 2) the function has no local return and > 3) there is some type violation in the record construction. I got this, but took the declaration of any() to mean that I was willing to stick any kind of object into a field declared to accept only string(). > > Nothing of these is related to whether the spec for init/1 has > arguments of type list(any()) or something else. I had a two line function that failed on the return value, which was initialized only from the input args (and the implicitly defined fields) so I believed the input args caused the failure. If the error message had indicated only the implicitly initialized field was in error, I would have corrected my record definition. The size of the record prevented me from visually matching all the constraints in the output. > > The type any() means "anything goes". It's possible that you are > not fully aware of what specs and type declarations in records do. > They put extra constraints that have to be compatible with the > types that dialyzer infers (the so called "success typings"). An > inferred type of any() for some record field is compatible with a > user declaration that the field is of type string(). If > compatible, the strongest of the two -- in this case string() -- is > used from then on. Yes, I have this backwards. I thought any() meant the code may try to put any type of value, so no constraints can be applied. In my example, I thought I had declared the field 'port' to accept only integer() values, but the value of the arg being supplied could be any term. That was why I thought it failed. Rather than restricting the types, the arguments of a function declare the widest acceptable range and if by inference the type can be restricted after the binding, the restriction is used as the inferred type. Does this only apply to the special case of records? I get no error for the following code: -module(jay). -export([init/1, foo/1]). -spec init(any()) -> integer(). init(Val) -> Val. -spec foo(string()) -> integer(). foo(Val) -> init(Val). Should dialyzer complain about this code? If not, what is the interpretation? jay From ok@REDACTED Wed Mar 24 23:22:42 2010 From: ok@REDACTED (Richard O'Keefe) Date: Thu, 25 Mar 2010 11:22:42 +1300 Subject: [erlang-questions] Reading (and ignoring) escape-sequences In-Reply-To: <4BA9F34B.4010002@erlang-solutions.com> References: <4BA76862.3050609@erlang-solutions.com> <20100322234006.GA48453@k2r.org> <4BA88648.80809@erlang-solutions.com> <4BA9F34B.4010002@erlang-solutions.com> Message-ID: On Mar 25, 2010, at 12:11 AM, Mazen Harake wrote: > I think you misunderstood a little of what my problem was; let me > try to describe the problem in another way. > > Take the following assumptions: > > 1) You have a menu in the terminal, this menu "pops up" prompting > for an optional selection > 2) You can perform one of the following two actions: > a) Exit: Press Esc (\027) to exit the menu and don't make a > selection > b) Move: Press UpArrow (\027[A) or DownArrow (\027B) to move > between selections > 3) The program reads character by character Patient: It hurts when I do . Doctor: Don't do . This is an old MS-DOS convention, and MS-DOS programs that did it used keycodes, not characters. If you want to do that sort of thing in the terminal, use ncurses, or choose some other character or key for "exit". Full stop, delete, or for that matter, use left arrow (I want this menu LEFT). > In order to distinguish between action a and b you have to be able > to (very quickly) peek at the next character in buffer to know if > there is a "[" after the "\e". I think we all understand the problem: trying to retrofit an MS-DOS keycode-based design onto an ECMA/ANSI terminal interface which was never intended to be used that way. > If there isn't then you _assume_ that the user pressed Esc only. > This is because it is assumed that a user can not press another key > fast enough. However, on machines where Cmd-V pastes whatever is in the clipboard, the user can *command* the (virtual) pressing of (virtual) keys at the speed of electricity. With all GUI desktop operating systems these days having some such facility, there is now *NO* reliable way to tell a "manually" typed ESC from an ESC that came from a keypress. Indeed, using the Terminal application on a Mac, I can tell it to make the up arrow key send "Hello World!". (I just did, for the fun of it. And of course immediately changed it back.) By looking at the byte stream you get from a terminal emulator, there is *NO* way you can tell what key was pressed. > To relate this to what you wrote; Erlang does have timeouts but this > is not relevant because what is really needed is the ability to peek > into the second character without blocking for input. No, it's relevant because waiting for the second character to turn up or giving up after a few milliseconds gets the job done. Hmm. Is there anything that stops you (temporarily) configuring the terminal emulator so that it sends ^B ^F ^N ^P for left arrow, right arrow, down arrow, up arrow? Or could you tell people to move down using space and up using backspace? > An even better solution would be if this was done at a lower level > so that perhaps (like ncurses) in erlang you would get e.g. 40x as > the character for UpArrow (or whatever, it would probably be defined > as macros anyway). And that's what I recommended: doing it in ncurses and feeding Erlang a byte stream that is NOT ambiguous. (However, as noted above, even ncurses is not and these days CANNOT be infallible.) > > I'm curious; how would you handle the mentioned scenario in your > editor? As I said, by designing the command sequences so that it doesn't MATTER whether the ESC was manually typed or not. > Anyway it was a surprise to me that these sort of things weren't > handled in a better way overall Because there _isn't_ any good way to handle it. Possible approaches: (0) use a window library like Erlang's gs for menus (1) don't use ESC (2) tell the emulator to send non-ESC sequences for arrows (3) use UNIX ptys to put some program of your own between Erlang and a "terminal", using ncurses to recognise "keys" and forwarding an unambiguous byte stream to Erlang. > and even if Erlang wasn't really made to handle these kind of things > I would hope that it would have better support in the future because > it is absolutely gold to be able to write tools like e.g. table view > and the debugger without the need for gs (or wx) without the nasty > scrolling all the time (e.g. like top). You can write such tools in Erlang right now, no worries; just don't try to use ESC and ECMA escape sequences at the same point in your protocols. Let's imagine a little C program that is trying to handle the problem. read one character with blocking; if (that character was ESC) { /* did the user press ESC or an arrow key? */ A: if (it is possible to read one character without blocking) { /*it was an arrow key*/ } else { /*it was not*/ } } else { /* it was some other key */ } Now let's imagine a possible execution of this program. This involves nothing strange, indeed, nothing I have not experienced. the program is running. the user types an ESC character. the program reads a character. the operating system switches to another process. the user types another character. the operating system switches back to our program. the program discovers that another character is ready. WHOOPS! The program just mistook a manually typed ESC for the beginning of an escape sequence. This happened a lot more on PDP-11s than on Pentiums, but it is still _possible_. There really isn't ANY reliable way to tell an ESC from an escape sequence, and you are much better off designing your interface so that you don't *care* than trying to fight it. From ivan@REDACTED Thu Mar 25 09:51:15 2010 From: ivan@REDACTED (Ivan Uemlianin) Date: Thu, 25 Mar 2010 08:51:15 +0000 Subject: [erlang-questions] Generating sine waves and/or audio stream output In-Reply-To: <407d9ef81003241134v6d119a7cl4538c38ef90f24ec@mail.gmail.com> References: <4BA9E946.5000009@llaisdy.com> <407d9ef81003241134v6d119a7cl4538c38ef90f24ec@mail.gmail.com> Message-ID: <4BAB2403.10306@llaisdy.com> Dear Willem Thanks very much for you email and your code. This looks good. The functions generate binaries. Do you stream the binaries to audio or do you write them to a file? Do you have a function that writes wav files? If not I shall write one (unless a function to stream to audio will be easier but I don't think it will be). Thanks and best wishes Ivan Willem de Jong wrote: > Hello Ivan, > > I have an erlang module that generates sounds. It can generate > different wave forms (right now all I need is a saw-like shape and a > sinus shape). I am attaching it. It is a bit messy, perhaps, but it > should give you an impression of how it can be done. > > The synthesize() function uses the sinus() function to create a number > of complete waves, and then pastes these together repeatedly (I > assumed that would be more efficient that calculating the sinus() > function for each sample). > > The syntesize() function returns a couple of sound fragments: an > "attaque" bit that starts with an amplitude of zero, a fade-out bit > where the volume decreases back to 0, and a long and a short bit of > sound with a stable volume. Another module creates a complete > sound-fragment of the desired duration by pasting together the > attaque, a number of long fragments and short fragments in such a way > that it matches the duration (as precisely as possible), and a fade > out bit. > > As you can see this creates sounds with a fixed pitch and volume > (within one sound, that is). Also note that both the length and the > pitch of the sound will be approximations. > > I created this to generate music for my web-site: http://coria.nl. > You can try the result there, if you want. It is a site that enables > me and the other members of my choir (and anyone else who is > interested) to practise our music. > > Any comments or suggestions will be quite welcome, > Good luck, > Willem > > > > > > On Wed, Mar 24, 2010 at 11:28 AM, Ivan Uemlianin > wrote: > > Dear All > > I am learning Erlang and one of the things I'm interested in is > generating sine waves, merging them and streaming them to audio > output. > > I can kind of imagine how generating and merging would work, with > a sine > wave represented as a list of numbers. Is there an Erlang library or > project working with sine waves? > > I can't imagine how to stream a list of numbers to audio output. Can > anyone point me to projects/libraries/ideas for that one? Writing the > data to a file would be OK for now, but "live" sound would be much > nicer. > > With thanks and best wishes > > Ivan > > -- > ============================================================ > Ivan A. Uemlianin > Speech Technology Research and Development > > ivan@REDACTED > www.llaisdy.com > llaisdy.wordpress.com > > www.linkedin.com/in/ivanuemlianin > > > "Froh, froh! Wie seine Sonnen, seine Sonnen fliegen" > (Schiller, Beethoven) > ============================================================ > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > > -- ============================================================ Ivan A. Uemlianin Speech Technology Research and Development ivan@REDACTED www.llaisdy.com llaisdy.wordpress.com www.linkedin.com/in/ivanuemlianin "Froh, froh! Wie seine Sonnen, seine Sonnen fliegen" (Schiller, Beethoven) ============================================================ From corticalcomputer@REDACTED Thu Mar 25 10:05:50 2010 From: corticalcomputer@REDACTED (G.S.) Date: Thu, 25 Mar 2010 02:05:50 -0700 Subject: [erlang-questions] Generating sine waves and/or audio stream output In-Reply-To: <4BAB2403.10306@llaisdy.com> References: <4BA9E946.5000009@llaisdy.com> <407d9ef81003241134v6d119a7cl4538c38ef90f24ec@mail.gmail.com> <4BAB2403.10306@llaisdy.com> Message-ID: <2a67d3ff1003250205w614cde36kadf658c7812bb36e@mail.gmail.com> Hello Willem, Could you also please send me the code if possible? as I am also highly interested in using Erlang for sound generation. Regards and thanks, -Gene On Thu, Mar 25, 2010 at 1:51 AM, Ivan Uemlianin wrote: > Dear Willem > > Thanks very much for you email and your code. This looks good. > > The functions generate binaries. Do you stream the binaries to audio or do > you write them to a file? > > Do you have a function that writes wav files? If not I shall write one > (unless a function to stream to audio will be easier but I don't think it > will be). > > Thanks and best wishes > > Ivan > > Willem de Jong wrote: > >> Hello Ivan, >> >> I have an erlang module that generates sounds. It can generate different >> wave forms (right now all I need is a saw-like shape and a sinus shape). I >> am attaching it. It is a bit messy, perhaps, but it should give you an >> impression of how it can be done. >> >> The synthesize() function uses the sinus() function to create a number of >> complete waves, and then pastes these together repeatedly (I assumed that >> would be more efficient that calculating the sinus() function for each >> sample). >> >> The syntesize() function returns a couple of sound fragments: an "attaque" >> bit that starts with an amplitude of zero, a fade-out bit where the volume >> decreases back to 0, and a long and a short bit of sound with a stable >> volume. Another module creates a complete sound-fragment of the desired >> duration by pasting together the attaque, a number of long fragments and >> short fragments in such a way that it matches the duration (as precisely as >> possible), and a fade out bit. >> >> As you can see this creates sounds with a fixed pitch and volume (within >> one sound, that is). Also note that both the length and the pitch of the >> sound will be approximations. >> >> I created this to generate music for my web-site: http://coria.nl. You >> can try the result there, if you want. It is a site that enables me and the >> other members of my choir (and anyone else who is interested) to practise >> our music. >> Any comments or suggestions will be quite welcome, Good luck, >> Willem >> >> >> >> >> On Wed, Mar 24, 2010 at 11:28 AM, Ivan Uemlianin > ivan@REDACTED>> wrote: >> >> Dear All >> >> I am learning Erlang and one of the things I'm interested in is >> generating sine waves, merging them and streaming them to audio >> output. >> >> I can kind of imagine how generating and merging would work, with >> a sine >> wave represented as a list of numbers. Is there an Erlang library or >> project working with sine waves? >> >> I can't imagine how to stream a list of numbers to audio output. Can >> anyone point me to projects/libraries/ideas for that one? Writing the >> data to a file would be OK for now, but "live" sound would be much >> nicer. >> >> With thanks and best wishes >> >> Ivan >> >> -- ============================================================ >> Ivan A. Uemlianin >> Speech Technology Research and Development >> >> ivan@REDACTED >> www.llaisdy.com >> llaisdy.wordpress.com >> >> www.linkedin.com/in/ivanuemlianin >> >> >> "Froh, froh! Wie seine Sonnen, seine Sonnen fliegen" >> (Schiller, Beethoven) >> ============================================================ >> >> >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED >> >> >> >> > > -- > ============================================================ > Ivan A. Uemlianin > Speech Technology Research and Development > > ivan@REDACTED > www.llaisdy.com > llaisdy.wordpress.com > www.linkedin.com/in/ivanuemlianin > > "Froh, froh! Wie seine Sonnen, seine Sonnen fliegen" > (Schiller, Beethoven) > ============================================================ > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From als@REDACTED Thu Mar 25 10:43:23 2010 From: als@REDACTED (Anthony Shipman) Date: Thu, 25 Mar 2010 20:43:23 +1100 Subject: [erlang-questions] Reading (and ignoring) escape-sequences In-Reply-To: References: <4BA76862.3050609@erlang-solutions.com> <4BA9F34B.4010002@erlang-solutions.com> Message-ID: <201003252043.23947.als@iinet.net.au> On Thu, 25 Mar 2010 09:22:42 am Richard O'Keefe wrote: > Because there _isn't_ any good way to handle it. > Possible approaches: > ? (0) use a window library like Erlang's gs for menus > ? (1) don't use ESC > ? (2) tell the emulator to send non-ESC sequences for arrows > ? (3) use UNIX ptys to put some program of your own between Erlang > ? ? ? and a "terminal", using ncurses to recognise "keys" and > ? ? ? forwarding an unambiguous byte stream to Erlang. What ncurses does is fiddle with the line discipline to set a 100ms time delay. If a second character does not arrive from the tty within this time it reports a single Esc to the program. If an arrow key is pressed then all of the characters of the escape sequence will be presented to the program. I don't know of any way of doing this with a standard Erlang module but you might be able to fake it by doing something like os:cmd("/bin/stty -icanon min 2 time 1") or erlang:open_port if that doesn't work. Don't forget to restore the settings after. -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From mazen.harake@REDACTED Thu Mar 25 12:45:43 2010 From: mazen.harake@REDACTED (Mazen Harake) Date: Thu, 25 Mar 2010 13:45:43 +0200 Subject: [erlang-questions] Reading (and ignoring) escape-sequences In-Reply-To: References: <4BA76862.3050609@erlang-solutions.com> <20100322234006.GA48453@k2r.org> <4BA88648.80809@erlang-solutions.com> <4BA9F34B.4010002@erlang-solutions.com> Message-ID: <4BAB4CE7.3050809@erlang-solutions.com> On 25/03/2010 00:22, Richard O'Keefe wrote: > > On Mar 25, 2010, at 12:11 AM, Mazen Harake wrote: > >> An even better solution would be if this was done at a lower level so >> that perhaps (like ncurses) in erlang you would get e.g. 40x as the >> character for UpArrow (or whatever, it would probably be defined as >> macros anyway). > > And that's what I recommended: doing it in ncurses and feeding Erlang > a byte stream that is NOT ambiguous. (However, as noted above, even > ncurses is not and these days CANNOT be infallible.) I tested this now and it seems to work well. In my driver I now make an initial port_command which calls driver_async which runs an input function. Even though this function is intended to return at some point and data be collected using ready_async I put it in an endless loop which only does getch(). When getch() returns I send a message straight back to Erlang. This wasn't enough though... so I also did a middle buffer process; if an Erlang program does cecho:getch() it will block by first sending a message to the middle process saying that it is waiting for input and then blocks waiting in a receive. When a message comes from the driver it checks if any process is waiting for input, if there is it gets the character, if it doesn't then the message from the port is simply discarded. Using this together with keypad(stdscr, TRUE) I now get unambiguous codes back (without the keypad() I seem to get only the '\027'), the only work left is to map all the keys (probably steal them from ncurses.h). Initial tests indicate good results. This is great because I would _never_ have used a terminal GUI which asks me to hit _space_ for going down a list and _bksp_ for going up... it is simply not good usability. Anyway, thank you for your time. /Mazen --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From kostis@REDACTED Thu Mar 25 13:10:36 2010 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 25 Mar 2010 14:10:36 +0200 Subject: [erlang-questions] Trouble with init/1 spec In-Reply-To: <00D9B519-0611-49AC-9D19-0C88D8848C1F@duomark.com> References: <03DF3025-90DD-4DF8-AA08-A109487DA03A@duomark.com> <4BAA3734.6050701@cs.ntua.gr> <4BAA4087.1010308@cs.ntua.gr> <9EAAE192-4A69-4E5F-BD90-C27872BE1819@duomark.com> <4BAA776E.4000804@cs.ntua.gr> <00D9B519-0611-49AC-9D19-0C88D8848C1F@duomark.com> Message-ID: <4BAB52BC.6070904@cs.ntua.gr> Jay Nelson wrote: > > On Mar 24, 2010, at 1:34 PM, Kostis Sagonas wrote: >> >> The type any() means "anything goes". It's possible that you are not >> fully aware of what specs and type declarations in records do. They >> put extra constraints that have to be compatible with the types that >> dialyzer infers (the so called "success typings"). An inferred type of >> any() for some record field is compatible with a user declaration that >> the field is of type string(). If compatible, the strongest of the >> two -- in this case string() -- is used from then on. > > Yes, I have this backwards. I thought any() meant the code may try to > put any type of value, so no constraints can be applied. In my example, > I thought I had declared the field 'port' to accept only integer() > values, but the value of the arg being supplied could be any term. That > was why I thought it failed. > > Rather than restricting the types, the arguments of a function declare > the widest acceptable range and if by inference the type can be > restricted after the binding, the restriction is used as the inferred > type. Does this only apply to the special case of records? Sorry, but either I do not understand what you've written or you have this backwards again. Rather than continuing this, I suggest you read the following papers: Practical type inference based on success typings http://www.it.uu.se/research/group/hipe/dialyzer/publications/succ_types.pdf and A Language for Specifying Type Contracts in Erlang and its Interaction with Success Typings http://user.it.uu.se/~kostis/Papers/contracts.pdf which perhaps will shed more light to how type inference in Dialyzer takes place. > I get no error for the following code: > > -module(jay). > -export([init/1, foo/1]). > > -spec init(any()) -> integer(). > init(Val) -> Val. > > -spec foo(string()) -> integer(). > foo(Val) -> init(Val). > > > Should dialyzer complain about this code? If not, what is the > interpretation? Once again you have this backwards. Dialyzer does not _have_ to complain about this code. In fact, dialyzer does nowhere promised to find all errors in a program or check that all its specifications are indeed possible or make sense. Instead, all that dialyzer promises is that when it does report a discrepancy then there is indeed something wrong in your code. (Of course, this does not mean that some future dialyzer version will not be able to detect more discrepancies and complain about such code.) What happens in your program is that dialyzer initially infers the following types for its functions: init(any()) -> any() and foo(any()) -> any() (*) Note that the types nowhere have dependencies between the type(s) of input arguments and the return. The specs you have written are not in violation with these inferred types so these are considered ok and are trusted. There is only one call in the program and this call is to a function (init/1) which does not constrain its input argument in any way, so there are no discrepancies in call sites either. Moreover, the spec of init/1 specifies that the return of this call is of type integer() which is consistent with the return in the spec of foo/1. So that's what's happening here. Is it possible to do better than that you may ask? Of course it's possible! In fact, dialyzer's code is open source, so be my guest ;-) Cheers, Kostis (*) I lied on purpose here to simplify the presentation. In fact dialyzer infers the following types init(any()) -> any() and foo(any()) -> integer() because the -spec for the init/1 function is trusted before the analysis of foo/1 starts. From wiener.guy@REDACTED Thu Mar 25 14:38:34 2010 From: wiener.guy@REDACTED (Guy Wiener) Date: Thu, 25 Mar 2010 15:38:34 +0200 Subject: Dialyzer's PLT format Message-ID: <69fbcaf61003250638r8e14c04oaaa33ab9881e5701@mail.gmail.com> Hello everyone, I want to re-use the Dialyzer's PLT files for some tools I'm developing, similarly to what the Typer does. I tried to look it up, but the format of the PLT file is not in the documents. How can one re-use a PLT file? Is it a Mnesia DB, or something similar? Is the format or schema documented somewhere? Btw, thanks for the great answers about these tools fro my previous questions. Thanks in advance, Guy Wiener. From kostis@REDACTED Thu Mar 25 16:17:09 2010 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 25 Mar 2010 17:17:09 +0200 Subject: [erlang-questions] Dialyzer's PLT format In-Reply-To: <69fbcaf61003250638r8e14c04oaaa33ab9881e5701@mail.gmail.com> References: <69fbcaf61003250638r8e14c04oaaa33ab9881e5701@mail.gmail.com> Message-ID: <4BAB7E75.8000407@cs.ntua.gr> Guy Wiener wrote: > Hello everyone, > I want to re-use the Dialyzer's PLT files for some tools I'm developing, > similarly to what the Typer does. I tried to look it up, but the format of > the PLT file is not in the documents. > How can one re-use a PLT file? Is it a Mnesia DB, or something similar? Is > the format or schema documented somewhere? No, the format of the PLT file is not documented anywhere. On the other hand, file lib/dialyzer/src/dialyzer_plt.erl most probably contains most of what there is to know about it and includes some functions to manipulate it. Kostis From lucevers@REDACTED Thu Mar 25 18:47:07 2010 From: lucevers@REDACTED (Luc Evers) Date: Thu, 25 Mar 2010 18:47:07 +0100 Subject: [erlang-questions] Dets Tables or Mnesia In-Reply-To: References: Message-ID: Jim, The syslog messages will be processed on the fly for generating alarms via regular expressions + persistent storage of the messages for one month. The server is a single box and the data access must be sequential. named pipe -> check message for alarms -> store message -> correlate alarms from different routers. I'm thinking of a process per message, I can keep the sequence of the messages via a label per /msg/router. Luc. On Wed, Mar 24, 2010 at 6:31 PM, Jim McCoy wrote: > Will you be processing the data on the fly and using persistent > storage mostly for archival purposes or will you be doing a lot of > data analysis and processing on the old messages? Will the server be > on a single box or multiple boxes? Will access to the persistent > storage be mostly random or mostly sequential? > > More info would really help out on the potential list of suggetions. > For starters though, neither dets nor mnesia are likely to be the > storage mechanism you want to use for this if you are dealing with > anything a message load of any significance. > > On Tue, Mar 23, 2010 at 1:54 AM, Luc Evers wrote: > > Hi, > > > > ToDo > > > > Analyzing syslog message from a big amount of routers, with a > different > > message structure. > > Sending alarms via (regular expression) message check. > > > > Question: > > Should I use 'Dets Tables ' or 'Mnesia' as database? > > > > Thanks! > > > > Luc. > > > From w.a.de.jong@REDACTED Thu Mar 25 20:04:39 2010 From: w.a.de.jong@REDACTED (Willem de Jong) Date: Thu, 25 Mar 2010 20:04:39 +0100 Subject: [erlang-questions] Generating sine waves and/or audio stream output In-Reply-To: <4BAB2403.10306@llaisdy.com> References: <4BA9E946.5000009@llaisdy.com> <407d9ef81003241134v6d119a7cl4538c38ef90f24ec@mail.gmail.com> <4BAB2403.10306@llaisdy.com> Message-ID: <407d9ef81003251204u36a716b7tab2e66a686f19ea8@mail.gmail.com> Hmm, I had forgotten about some of the complexities involved. I do not have a function that writes wav files. I put the pcm data that is generated by this into a flash file. For wav files you have to do add a header and framing, I believe. I added a function that puts together the parts of the sound. You can write it to a file like this: > file:write_file("sinus.raw", sound:sound(440, 3, 0.5, sinus)). (440 hertz, 3 seconds, volume 0.5 (50%), sinus wave form). This file will be in "raw" format (pcm without headers). With the current settings the sample rate is 22050, mono, sample size 16 bits big endian. Regards, Willem On Thu, Mar 25, 2010 at 9:51 AM, Ivan Uemlianin wrote: > Dear Willem > > Thanks very much for you email and your code. This looks good. > > The functions generate binaries. Do you stream the binaries to audio or do > you write them to a file? > > Do you have a function that writes wav files? If not I shall write one > (unless a function to stream to audio will be easier but I don't think it > will be). > > Thanks and best wishes > > Ivan > > Willem de Jong wrote: > >> Hello Ivan, >> >> I have an erlang module that generates sounds. It can generate different >> wave forms (right now all I need is a saw-like shape and a sinus shape). I >> am attaching it. It is a bit messy, perhaps, but it should give you an >> impression of how it can be done. >> >> The synthesize() function uses the sinus() function to create a number of >> complete waves, and then pastes these together repeatedly (I assumed that >> would be more efficient that calculating the sinus() function for each >> sample). >> >> The syntesize() function returns a couple of sound fragments: an "attaque" >> bit that starts with an amplitude of zero, a fade-out bit where the volume >> decreases back to 0, and a long and a short bit of sound with a stable >> volume. Another module creates a complete sound-fragment of the desired >> duration by pasting together the attaque, a number of long fragments and >> short fragments in such a way that it matches the duration (as precisely as >> possible), and a fade out bit. >> >> As you can see this creates sounds with a fixed pitch and volume (within >> one sound, that is). Also note that both the length and the pitch of the >> sound will be approximations. >> >> I created this to generate music for my web-site: http://coria.nl. You >> can try the result there, if you want. It is a site that enables me and the >> other members of my choir (and anyone else who is interested) to practise >> our music. >> Any comments or suggestions will be quite welcome, Good luck, >> Willem >> >> >> >> >> On Wed, Mar 24, 2010 at 11:28 AM, Ivan Uemlianin > ivan@REDACTED>> wrote: >> >> Dear All >> >> I am learning Erlang and one of the things I'm interested in is >> generating sine waves, merging them and streaming them to audio >> output. >> >> I can kind of imagine how generating and merging would work, with >> a sine >> wave represented as a list of numbers. Is there an Erlang library or >> project working with sine waves? >> >> I can't imagine how to stream a list of numbers to audio output. Can >> anyone point me to projects/libraries/ideas for that one? Writing the >> data to a file would be OK for now, but "live" sound would be much >> nicer. >> >> With thanks and best wishes >> >> Ivan >> >> -- ============================================================ >> Ivan A. Uemlianin >> Speech Technology Research and Development >> >> ivan@REDACTED >> www.llaisdy.com >> llaisdy.wordpress.com >> >> >> www.linkedin.com/in/ivanuemlianin >> >> >> >> "Froh, froh! Wie seine Sonnen, seine Sonnen fliegen" >> (Schiller, Beethoven) >> ============================================================ >> >> >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED >> >> >> >> > > -- > ============================================================ > Ivan A. Uemlianin > Speech Technology Research and Development > > ivan@REDACTED > www.llaisdy.com > llaisdy.wordpress.com > www.linkedin.com/in/ivanuemlianin > > "Froh, froh! Wie seine Sonnen, seine Sonnen fliegen" > (Schiller, Beethoven) > ============================================================ > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: sound.erl Type: application/octet-stream Size: 5718 bytes Desc: not available URL: From lucevers@REDACTED Thu Mar 25 20:05:04 2010 From: lucevers@REDACTED (Luc Evers) Date: Thu, 25 Mar 2010 20:05:04 +0100 Subject: Fwd: Dets Tables or Mnesia In-Reply-To: References: Message-ID: ---------- Forwarded message ---------- From: Luc Evers Date: Tue, Mar 23, 2010 at 9:54 AM Subject: Dets Tables or Mnesia To: erlang-questions@REDACTED Hi, ToDo Analyzing syslog message from a big amount of routers, with a different message structure. Sending alarms via (regular expression) message check. Question: Should I use 'Dets Tables ' or 'Mnesia' as database? Thanks! Luc. From max.lapshin@REDACTED Thu Mar 25 20:12:39 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Thu, 25 Mar 2010 22:12:39 +0300 Subject: [erlang-questions] Help with storing data in memory In-Reply-To: References: <8d1798e91003230346i5a87f3e0xb5c64369319da4fe@mail.gmail.com> <6a36e7291003230514k7a0806d4x7ba7f9725f7ee21b@mail.gmail.com> Message-ID: As I'm very disappointed of working with ets, tried to use fixed size array. There are about 80 frames per second, so need to store 80*seconds entries. In an hour server used all memory =)) Best thing will be dirty updatable tuple with 400K elements. From mononcqc@REDACTED Thu Mar 25 22:59:08 2010 From: mononcqc@REDACTED (Fred Hebert) Date: Thu, 25 Mar 2010 17:59:08 -0400 Subject: Sets, ordsets, gb_sets, sofs. What is going on? Message-ID: <8b9ee55b1003251459s5f13e591kbf2da97519bb98d1@mail.gmail.com> I'm working on the next chapter of Learn You Some Erlang and I've decided to describe common data structures (proplists, orddicts, dicts, gb_trees, arrays, etc.) I wanted to discuss a few of the sets modules and then maybe hint for digraph after that. However, studying the different sets modules (sets, ordsets, gb_sets and sofs), I'm starting to wonder what that is all about and what is the purpose of each of them. Here's what I got: - sets: module implemented on top of a structure similar to the one used in the dict module. Uses =:= as the comparison function; - ordsets: implemented as a sorted list. Uses == as the comparison function. Same interface as sets. - gb_sets: implemented over the gb_trees structure. Uses == as a comparison function. Same interface as sets and ordsets. - sofs: implemented as an ordered list with some meta data inside a tuple. Can also contain ordered sets (tuples or single values). Implements pretty much every standard set operation seen in textbooks, including relations, functions and whatnot. Seems to use '==' as a comparison function. This raises the question about what module to use, and under what circumstances. Obviously, sofs is to be used whenever 'advanced' set operations are required. However, it is not clear why ordsets should be used over this one whenever the sets are small -- except if you plan to later move on to either sets or gb_sets or when you need '=:=' as a comparison function. Then I'm not sure what's the point of using 'sets' over gb_sets (or the opposite). The gb_sets implementation has a bunch more functions available than sets, but that's about it. I suppose performance must be relatively close between both modules, as it is between gb_trees and dicts. It is also mentioned that gb_sets compare badly to ordsets when operating on many sets of almost equal size, but otherwise do a much better job. Is there any way to know what I should suggest to readers [or use myself], depending on the use cases? I think this lack of comparisons is something that would be greatly appreciated in Erlang's documentation (if there is anything about that already, I'll be glad to read it!) I got the same kind of questions relative to dicts and gb_trees, although there are fewer modules to compare in this case. Any help is appreciated. From stondage123@REDACTED Thu Mar 25 22:01:17 2010 From: stondage123@REDACTED (Andrew Stone) Date: Thu, 25 Mar 2010 14:01:17 -0700 (PDT) Subject: [erlang-questions] closing a port doesn't kill the connected process? In-Reply-To: <3dbc6d1c1003232147j4b23df14vafdafbd451bf05e9@mail.gmail.com> References: <3dbc6d1c1003232147j4b23df14vafdafbd451bf05e9@mail.gmail.com> Message-ID: <581759.25049.qm@web35906.mail.mud.yahoo.com> EOF detected by the client is what we use. It's been in production for a year now without a problem. -Andrew ----- Original Message ---- From: Robert Virding To: Jacob Vorreuter Cc: Erlang-Questions Questions Sent: Wed, March 24, 2010 12:47:54 AM Subject: Re: [erlang-questions] closing a port doesn't kill the connected process? When the port is closed the spawned port should get an end-of-file on its stdin. This is the "standard" way for the process to detect when the port has been closed: an end-of-file on stdin. Robert On 22 March 2010 20:00, Jacob Vorreuter wrote: > I'm starting a redis server instance by opening an Erlang port. When the Erlang process exits or I explicitly close the port the os process is not killed. Is there a way to accomplish that? > > 1> Port = erlang:open_port({spawn, "redis-server"}, [binary, exit_status]). > #Port<0.429> > 2> erlang:port_close(Port). > true > > $ ps -ax | grep redis-server > 31374 ?? 0:00.02 redis-server > > Thanks, > > Jake > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > ________________________________________________________________ erlang-questions (at) erlang.org mailing list. See http://www.erlang.org/faq.html To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED From bob@REDACTED Thu Mar 25 23:10:50 2010 From: bob@REDACTED (Bob Ippolito) Date: Thu, 25 Mar 2010 15:10:50 -0700 Subject: [erlang-questions] Help with storing data in memory In-Reply-To: References: <8d1798e91003230346i5a87f3e0xb5c64369319da4fe@mail.gmail.com> <6a36e7291003230514k7a0806d4x7ba7f9725f7ee21b@mail.gmail.com> Message-ID: <6a36e7291003251510p1d81ee3fkc5d72cb73de856d9@mail.gmail.com> You might need to tune the frequency of garbage collection or make manual calls to erlang:garbage_collect(). You should also make sure you are using the latest Erlang VM, the garbage collection strategy for binaries has been significantly improved in recent versions. On Thu, Mar 25, 2010 at 12:12 PM, Max Lapshin wrote: > As I'm very disappointed of working with ets, tried to use fixed size > array. There are about 80 frames per second, so need to store > 80*seconds entries. > In an hour server used all memory =)) > > Best thing will be dirty updatable tuple with 400K elements. > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From acton@REDACTED Thu Mar 25 23:33:05 2010 From: acton@REDACTED (Brian Acton) Date: Thu, 25 Mar 2010 15:33:05 -0700 Subject: [erlang-questions] upgrading from R12 to R13 in a heterogeneous fashion In-Reply-To: References: <7a9fe0201002162008u22ba17f4i116ff63754153a41@mail.gmail.com> Message-ID: <7a9fe0201003251533o37be5980yaa2059aefd1cb599@mail.gmail.com> Hi guys, On Friday night, we added R13 SMP mnesia nodes into our R12 cluster. Everything worked fairly well. On Sunday afternoon, we removed the R12 nodes from the cluster. We used the following commands: %% on R12 node: mnesia:stop(). mnesia:delete_schema([node()]). %% on R13 node mnesia:del_table_copy(schema, R12Node). We immediately started having transactional coherence problems. More importantly, we didn't detect until 24 hours later :( For the record, our application performs the following meta operations: % process A F = fun() -> mnesia:write(Id). mnesia:transaction(F) B ! Id % process B receive Id -> mnesia:dirty_read(Id). The problem is that process B started returning [] empty results when before it would return non zero results. Thinking that this was just a weird R12/R13 conversion bug, we rebooted our R13 nodes and everything returned to normal. Unfortunately, the problem resurfaced over night. We don't see any trigger in the erlang logs, it is simply that mnesia starts returning empty results. We do start to see a backlog of messages of process B and eventually the problem cascades and all the nodes effectively become poisoned returning empty results. Does anyone have any flashes of insight on this? I tried to condense the problem as simply as possible. Really the only change that we made is conversion from R12 to R13+SMP. Hope this rings some bells. If anyone wants to discuss this face to face, I'm at Erlang Factory SF today / tomorrow. --b On Tue, Feb 16, 2010 at 11:10 PM, Kenneth Lundin wrote: > The compatibility between major releases is intended just for the case > when a cluster > is upgraded in service node by node. > It will probably work well for many applications to run a > heterogeneous cluster in > steady state as well but the general recommendation is to upgrade to > the same version of Erlang > on every node as fast as possible. > This applies if you are using the Erlang distribution between the nodes. > If you have invented > your own communication between the nodes it is up to your solution if > it is important to have > the same version of Erlang on every node. > > /Kenneth Erlang/OTP, Ericsson > > > On Wed, Feb 17, 2010 at 5:08 AM, Brian Acton wrote: > > Hi guys, > > > > We are currently running an 8 node cluster running R12. We are wanting to > > get all the bug fixes and performance improvements from R13 (not to > mention > > better support). We've been advised in the past that we shouldn't run a > > heterogeneous cluster with a mix of R12 and R13 as it is potentially > > unstable. > > > > I'm wondering if anyone has any advice on the matter and if it is OK for > us > > to run a heterogeneous environment (even if it is for a short duration > (like > > 24 hours) ). I'm also wondering if there are any specific gotchas or > caveats > > that we should be aware of as we go down this path. > > > > Thanks! > > > > --b > > > From max.lapshin@REDACTED Thu Mar 25 23:40:59 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 26 Mar 2010 01:40:59 +0300 Subject: [erlang-questions] Help with storing data in memory In-Reply-To: <6a36e7291003251510p1d81ee3fkc5d72cb73de856d9@mail.gmail.com> References: <8d1798e91003230346i5a87f3e0xb5c64369319da4fe@mail.gmail.com> <6a36e7291003230514k7a0806d4x7ba7f9725f7ee21b@mail.gmail.com> <6a36e7291003251510p1d81ee3fkc5d72cb73de856d9@mail.gmail.com> Message-ID: On Fri, Mar 26, 2010 at 1:10 AM, Bob Ippolito wrote: > You might need to tune the frequency of garbage collection or make > manual calls to erlang:garbage_collect(). You should also make sure > you are using the latest Erlang VM, the garbage collection strategy > for binaries has been significantly improved in recent versions. > R13B4. There is one question: f({a, b, A}) -> g({e,f, A}). Will the A element be copied twice or compiler is smart enought to keep it untouched? I.e. when I set element number 405450 in array, is the whole array recreated or maybe just small part of it? From bob@REDACTED Thu Mar 25 23:49:46 2010 From: bob@REDACTED (Bob Ippolito) Date: Thu, 25 Mar 2010 15:49:46 -0700 Subject: [erlang-questions] Help with storing data in memory In-Reply-To: References: <8d1798e91003230346i5a87f3e0xb5c64369319da4fe@mail.gmail.com> <6a36e7291003230514k7a0806d4x7ba7f9725f7ee21b@mail.gmail.com> <6a36e7291003251510p1d81ee3fkc5d72cb73de856d9@mail.gmail.com> Message-ID: <6a36e7291003251549r7c88ea24p18bd06038df4056f@mail.gmail.com> On Thursday, March 25, 2010, Max Lapshin wrote: > On Fri, Mar 26, 2010 at 1:10 AM, Bob Ippolito wrote: >> You might need to tune the frequency of garbage collection or make >> manual calls to erlang:garbage_collect(). You should also make sure >> you are using the latest Erlang VM, the garbage collection strategy >> for binaries has been significantly improved in recent versions. >> > > R13B4. There is one question: > > f({a, b, A}) -> > ?g({e,f, A}). > > Will the A element be copied twice or compiler is smart enought to > keep it untouched? > I.e. when I set element number 405450 in array, is the whole array > recreated or maybe just small part of it? > There is no copying of A, but there is a new tuple created {e, f, A} of course. -bob From ok@REDACTED Fri Mar 26 02:06:35 2010 From: ok@REDACTED (Richard O'Keefe) Date: Fri, 26 Mar 2010 14:06:35 +1300 Subject: [erlang-questions] Reading (and ignoring) escape-sequences In-Reply-To: <4BAB4CE7.3050809@erlang-solutions.com> References: <4BA76862.3050609@erlang-solutions.com> <20100322234006.GA48453@k2r.org> <4BA88648.80809@erlang-solutions.com> <4BA9F34B.4010002@erlang-solutions.com> <4BAB4CE7.3050809@erlang-solutions.com> Message-ID: On Mar 26, 2010, at 12:45 AM, Mazen Harake wrote: > Initial tests indicate good results. This is great because I would > _never_ have used a terminal GUI which asks me to hit _space_ for > going down a list and _bksp_ for going up... it is simply not good > usability. It may have escaped your attention, but - space for forwards and backspace for backwards is an old convention that was in use before even MS-DOS existed; worked fine - the space and delete keys are much bigger than the arrow keys and are therefore easier to hit; they are _more_ usable for people with shaky hands. I think you mean "doesn't look like Windows". From dmurray@REDACTED Thu Mar 25 23:18:17 2010 From: dmurray@REDACTED (David N Murray) Date: Thu, 25 Mar 2010 18:18:17 -0400 (EDT) Subject: Building R13B04 on OpenBSD 4.6 Message-ID: Hi, I'm trying to build R13B04 on OpenBSD 4.6. I ran into a similar problem when I built Gambit Scheme on this box a while back: checking sys/sysctl.h usability... no checking sys/sysctl.h presence... yes configure: WARNING: sys/sysctl.h: present but cannot be compiled configure: WARNING: sys/sysctl.h: check for missing prerequisite headers? configure: WARNING: sys/sysctl.h: see the Autoconf documentation configure: WARNING: sys/sysctl.h: section "Present But Cannot Be Compiled" configure: WARNING: sys/sysctl.h: proceeding with the preprocessor's result configure: WARNING: sys/sysctl.h: in the future, the compiler will take precedence configure: WARNING: ## ------------------------------------------ ## configure: WARNING: ## Report this to the AC_PACKAGE_NAME lists. ## configure: WARNING: ## ------------------------------------------ ## checking for sys/sysctl.h... yes I generated a fix for Gambit, but I'm not sure how to apply it to Erlang (there's no configure.ac): --- configure.ac.~1~ Thu Jan 7 14:58:50 2010 +++ configure.ac Sat Jan 30 15:32:36 2010 @@ -622,7 +622,21 @@ AC_CHECK_HEADERS(sys/socket.h) AC_CHECK_HEADERS(strings.h) AC_CHECK_HEADERS(memory.h) - AC_CHECK_HEADERS(sys/sysctl.h) + case "$target_os" in + + openbsd*) # needs param.h + AC_CHECK_HEADERS(sys/param.h) + AC_CHECK_HEADERS(sys/sysctl.h,,, +[#ifdef HAVE_PARAM_H +# include +#endif +]) + ;; + + *) + AC_CHECK_HEADERS(sys/sysctl.h) + ;; + esac if test "$C_COMP_VISUALC" != yes; then I haven't tried to 'make' yet. I'm not sure if sys/sysctl.h is really required or can be worked around. Thoughts? TIA, Dave From comptekki@REDACTED Fri Mar 26 03:36:35 2010 From: comptekki@REDACTED (Wes James) Date: Thu, 25 Mar 2010 20:36:35 -0600 Subject: error on first run Message-ID: <533df7fa1003251936gd88be1drbe2ea2cd2abd2aa5@mail.gmail.com> I'm new to erlang and I've compiled and installed on os x. I'm going through the Erlang Programming 1st edition book. I fired up erl from the cli and I pasted: factorial(0) -> 1; factorial(N) -> N * factorial(N-1). but I get the error: * 1: syntax error before: '->' What am I doing wrong? thx, -wes From comptekki@REDACTED Fri Mar 26 03:54:16 2010 From: comptekki@REDACTED (Wes James) Date: Thu, 25 Mar 2010 20:54:16 -0600 Subject: [erlang-questions] error on first run In-Reply-To: <79EE3AF3-603B-40F2-8AAC-E5B4F967BAAA@cs.otago.ac.nz> References: <533df7fa1003251936gd88be1drbe2ea2cd2abd2aa5@mail.gmail.com> <79EE3AF3-603B-40F2-8AAC-E5B4F967BAAA@cs.otago.ac.nz> Message-ID: <533df7fa1003251954v65aab92jb930c798f89ae9e1@mail.gmail.com> On Thu, Mar 25, 2010 at 8:43 PM, Richard O'Keefe wrote: > > On Mar 26, 2010, at 3:36 PM, Wes James wrote: > >> * 1: syntax error before: '->' >> >> What am I doing wrong? > > Typing function definitions at the interactive loop. > It _is_ in the book, but named functions can ONLY be > defined inside modules, which you then load with the > c(module_name) shell command. > > I went back and saw "do not try to type functions directly in the shell" lots to learn... :) From g9414002.pccu.edu.tw@REDACTED Fri Mar 26 04:02:42 2010 From: g9414002.pccu.edu.tw@REDACTED (=?UTF-8?B?6buD6ICA6LOiIChZYXUtSHNpZW4gSHVhbmcp?=) Date: Fri, 26 Mar 2010 11:02:42 +0800 Subject: [erlang-questions] error on first run In-Reply-To: <533df7fa1003251936gd88be1drbe2ea2cd2abd2aa5@mail.gmail.com> References: <533df7fa1003251936gd88be1drbe2ea2cd2abd2aa5@mail.gmail.com> Message-ID: No. Steps are: 1. Paste functions in a file, with the head written as -module(mod_name). -compile(export_all). and name the file as 'mod_name.erl'. 2. Switch to the directory containing 'mod_name.erl' in Erl shell by using the command > cd("D:\\folder_with_mod_name.erl"). 3. Compile the module 'mod_name' by using the command > c(mod_name). It gives 'ok' when compiling completed. 4. Run the function by calling the function name accompanied with module name and arguments. > mod_name:factorial(5). On Fri, Mar 26, 2010 at 10:36 AM, Wes James wrote: > I'm new to erlang and I've compiled and installed on os x. I'm going > through the Erlang Programming 1st edition book. I fired up erl from > the cli and I pasted: > > factorial(0) -> 1; > factorial(N) -> > N * factorial(N-1). > > but I get the error: > > * 1: syntax error before: '->' > > What am I doing wrong? > > thx, > > -wes > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From comptekki@REDACTED Fri Mar 26 04:07:26 2010 From: comptekki@REDACTED (Wes James) Date: Thu, 25 Mar 2010 21:07:26 -0600 Subject: [erlang-questions] error on first run In-Reply-To: References: <533df7fa1003251936gd88be1drbe2ea2cd2abd2aa5@mail.gmail.com> Message-ID: <533df7fa1003252007k33c4b4ffoe3bc800a2428524@mail.gmail.com> 2010/3/25 ??? (Yau-Hsien Huang) : > No. Steps are: > 1. Paste functions in a file, with the head written as > ? ?-module(mod_name). > ? ?-compile(export_all). > ? and name the file as 'mod_name.erl'. Thanks. I was just doing that from the book. I put this in a factorial file: -module(factorial). -export([factorial/1]). factorial(0) -> 1; factorial(N) -> N * factorial(N-1). and then ran: factorial(3). and got an error then I remembered I had to do module_name:function(value) this is an interesting language... -wes From halayli@REDACTED Fri Mar 26 06:01:51 2010 From: halayli@REDACTED (Hasan Alayli) Date: Thu, 25 Mar 2010 22:01:51 -0700 Subject: [erlang-questions] Reading (and ignoring) escape-sequences In-Reply-To: <4BA9F34B.4010002@erlang-solutions.com> References: <4BA76862.3050609@erlang-solutions.com> <20100322234006.GA48453@k2r.org> <4BA88648.80809@erlang-solutions.com> <4BA9F34B.4010002@erlang-solutions.com> Message-ID: <80c550b91003252201g42429e59v4ed0ef20385b424c@mail.gmail.com> > Anyway it was a surprise to me that these sort of things weren't handled in > a better way overall and even if Erlang wasn't really made to handle these > kind of things I would hope that it would have better support in the future > because it is absolutely gold to be able to write tools like e.g. table view > and the debugger without the need for gs (or wx) without the nasty scrolling > all the time (e.g. like top). > > /Mazen > My gut feeling says you are taking Erlang out of its context. Erlang is not a general purpose programming language so it should be no surprise. :) From steven.charles.davis@REDACTED Fri Mar 26 10:06:34 2010 From: steven.charles.davis@REDACTED (Steve Davis) Date: Fri, 26 Mar 2010 02:06:34 -0700 (PDT) Subject: Reading (and ignoring) escape-sequences In-Reply-To: <80c550b91003252201g42429e59v4ed0ef20385b424c@mail.gmail.com> References: <4BA76862.3050609@erlang-solutions.com> <20100322234006.GA48453@k2r.org> <4BA88648.80809@erlang-solutions.com> <4BA9F34B.4010002@erlang-solutions.com> <80c550b91003252201g42429e59v4ed0ef20385b424c@mail.gmail.com> Message-ID: On Mar 26, 12:01?am, Hasan Alayli wrote: > Erlang is not a general purpose programming language so it should be > no surprise. :) What inspired this comment? Certainly nothing that I see in the discussion preceding in it. There are no domain-specific constructs in the language. If this is an argument based on heritage (telephony), you could just as well argue that Java is designed for programming toasters (Oak). /s From ivan@REDACTED Fri Mar 26 10:35:21 2010 From: ivan@REDACTED (Ivan Uemlianin) Date: Fri, 26 Mar 2010 09:35:21 +0000 Subject: [erlang-questions] Generating sine waves and/or audio stream output In-Reply-To: <407d9ef81003251204u36a716b7tab2e66a686f19ea8@mail.gmail.com> References: <4BA9E946.5000009@llaisdy.com> <407d9ef81003241134v6d119a7cl4538c38ef90f24ec@mail.gmail.com> <4BAB2403.10306@llaisdy.com> <407d9ef81003251204u36a716b7tab2e66a686f19ea8@mail.gmail.com> Message-ID: <4BAC7FD9.20003@llaisdy.com> You've done all the hard work! Thanks Willem. I'll write a function to write a wav header and report back: I've got one I wrote in C somewhere; might be interesting to compare the two. I'll also look into streaming to audio (there is esdl, an erlang binding for sdl, but that looks a bit hefty, and doesn'ty work with smp enabled erlang). Best Ivan On 25/03/2010 19:04, Willem de Jong wrote: > Hmm, I had forgotten about some of the complexities involved. > > I do not have a function that writes wav files. I put the pcm data > that is generated by this into a flash file. For wav files you have to > do add a header and framing, I believe. > > I added a function that puts together the parts of the sound. You can > write it to a file like this: > > file:write_file("sinus.raw", sound:sound(440, 3, 0.5, sinus)). > > (440 hertz, 3 seconds, volume 0.5 (50%), sinus wave form). > > This file will be in "raw" format (pcm without headers). With the > current settings the sample rate is 22050, mono, sample size 16 bits > big endian. > > Regards, > Willem -- ============================================================ Ivan A. Uemlianin Speech Technology Research and Development ivan@REDACTED www.llaisdy.com llaisdy.wordpress.com www.linkedin.com/in/ivanuemlianin "Froh, froh! Wie seine Sonnen, seine Sonnen fliegen" (Schiller, Beethoven) ============================================================ From bgustavsson@REDACTED Fri Mar 26 11:31:08 2010 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Fri, 26 Mar 2010 11:31:08 +0100 Subject: [erlang-questions] Sets, ordsets, gb_sets, sofs. What is going on? In-Reply-To: <8b9ee55b1003251459s5f13e591kbf2da97519bb98d1@mail.gmail.com> References: <8b9ee55b1003251459s5f13e591kbf2da97519bb98d1@mail.gmail.com> Message-ID: <6672d0161003260331o5994abf4p5981600f502a299a@mail.gmail.com> On Thu, Mar 25, 2010 at 10:59 PM, Fred Hebert wrote: > This raises the question about what module to use, and under what > circumstances. Obviously, sofs is to be used whenever 'advanced' set > operations are required. However, it is not clear why ordsets should be used > over this one whenever the sets are small -- except if you plan to later > move on to either sets or gb_sets or when you need '=:=' as a comparison > function. > > Then I'm not sure what's the point of using 'sets' over gb_sets (or the > opposite). The gb_sets implementation has a bunch more functions available > than sets, but that's about it. I suppose performance must be relatively > close between both modules, as it is between gb_trees and dicts. It is also > mentioned that gb_sets compare badly to ordsets when operating on many sets > of almost equal size, but otherwise do a much better job. > > Is there any way to know what I should suggest to readers [or use myself], > depending on the use cases? > > I think this lack of comparisons is something that would be greatly > appreciated in Erlang's documentation (if there is anything about that > already, I'll be glad to read it!) I got the same kind of questions relative > to dicts and gb_trees, although there are fewer modules to compare in this > case. If something is to be included in the documentation, it must be well researched and any recommendations should be based on benchmarks results (not on intuition or folklore). Here are some rules of thumb based on my own experience and measurements of various operations in the Wings3D application. Note that the type of the data and the size of the process heap can influence the results, so if you are writing a time-critical application, you should do your own measurements. Anyway, my recommendation is to use the gb_sets module in most circumstances. gb_sets has the following properties: 1. Creating a gb_set from a list is very fast, as is converting a gb_set to to a sorted list. That means that if you need to process the set using sofs or your own code, you don't have to be afraid of converting between representations. 2. Incrementally constructing a gb_set by adding one element at the time is also fast (but not as fast doing gb_sets:from_list/1). As far as I know (I haven't done measurements), incrementally building up a gb_set is faster than incrementally building a 'sets' set. The ordsets module is useful if you'll need a known representation that you can process with your own code without conversion and/or the sets are very small. If your set must use the '=:=' operator, 'sets' is the only module you can use. Also, test for membership will probably be faster with 'sets' if the set has many elements. But note that sets:from_list/1 is not any faster than incrementally inserting one element at a time into an initially empty set, and is much slower than gb_sets:from_list/1. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From karlsson.rm@REDACTED Fri Mar 26 12:14:41 2010 From: karlsson.rm@REDACTED (Mikael Karlsson) Date: Fri, 26 Mar 2010 04:14:41 -0700 (PDT) Subject: Using -spec for callbacks when defining behaviours In-Reply-To: <00f9fc8f-c5a9-4b3b-ada4-aafc437292a7@t20g2000yqe.googlegroups.com> References: <872e77ab1003170401u54f391cdi181d67eca20012af@mail.gmail.com> <3d94c7e4-2c1a-4826-9c45-7ca453cbee15@e1g2000yqh.googlegroups.com> <187b9671-8a9a-43c4-8554-a308220a9676@l25g2000yqd.googlegroups.com> <2a4dd2f5-5852-445d-bc8d-07d1dc7e4033@j21g2000yqh.googlegroups.com> <5502c815-600b-4fde-955d-b8a53a6bb154@x12g2000yqx.googlegroups.com> <00f9fc8f-c5a9-4b3b-ada4-aafc437292a7@t20g2000yqe.googlegroups.com> Message-ID: <8800f3ba-898a-4445-94e4-36189dd1627e@n34g2000yqb.googlegroups.com> Yes, I think that contract checkers that are "pluggable" at validation time is a good way to go, and if you find a standardized way or "formalized" pattern to put it in the process of Erlang code making the better. Joe Armstrongs UBF contracts is a good example. I agree that you should not rely on static checks, but on the other hand they are a good first check and especially for Erlang I think you can catch errors that you would later at run-time (Dialyzer do find errors). Best Regards Mikael On 20 mar, 20:46, Steve Davis wrote: > Hi Mikael, > > You make good points (consistently). I'm wondering, and this is > probably amounts to "my input" here, whether further research into > contracts may be an interesting way to go with this. In order to > validate large components, you'd "run them under contract" to check > their behavior. > > "Component" is not a terminology i'm fond of, thanks to the stunning > range of meaning assigned to that word; but if you have a "component" > that is sufficiently complex as to require a formalized interface, you > may be better advised to establish a full protocol for it. For sure, > you'd be very ill-advised to rely on static checks and not test it > thoroughly prior to committing to its use by other apps/subsystems/ > components. > > Best regards, > Steve > > ps. Whilst HTTP is indeed stateless, it's very interesting to observe > that a considerable amount of effort is put in worldwide every single > day to make it look otherwise! > > On Mar 20, 6:50?am, Mikael Karlsson wrote: > > > Well, I have a vague idea that contracts may be protocols but also > > constraints on arguments (or state data) and that you need to check > > them at runtime (see example on contract check in my reply to Kostis > > earlier in this thread). > > Not all interfaces/protocols carry state, simple client-server non- > > transactional requests (like HTTP), for instance and compile time type > > checking can cover a lot of an interface specificaton, but in order to > > have "everything" in place you probably need to complement with > > contract (run-time) checks. From mazen.harake@REDACTED Fri Mar 26 12:16:58 2010 From: mazen.harake@REDACTED (Mazen Harake) Date: Fri, 26 Mar 2010 13:16:58 +0200 Subject: [erlang-questions] Reading (and ignoring) escape-sequences In-Reply-To: References: <4BA76862.3050609@erlang-solutions.com> <20100322234006.GA48453@k2r.org> <4BA88648.80809@erlang-solutions.com> <4BA9F34B.4010002@erlang-solutions.com> <4BAB4CE7.3050809@erlang-solutions.com> Message-ID: <4BAC97AA.1040806@erlang-solutions.com> Actually it had, I never knew that sort of things had existed. It is ok though, worse ideas have been implemented. Usability is a whole topic on its own but keep in mind that "usability" can mean different things for different people. If a person with shaky hands is operating a computer _only_ selecting menus with space, bksp and enter, then sure I'm with you all the way; If he/she need to type on any of the 50+ other keys on the keyboard then I take it that it doesn't matter _how_ you design your software the "usability" is going to be bad either way unless you make all the keys to scale of course but that would look silly wouldn't it (although perhaps "usable" for that person). "look like Windows" in this case is, believe it or not, actually a good thing [in this case]. On 26/03/2010 03:06, Richard O'Keefe wrote: > > On Mar 26, 2010, at 12:45 AM, Mazen Harake wrote: >> Initial tests indicate good results. This is great because I would >> _never_ have used a terminal GUI which asks me to hit _space_ for >> going down a list and _bksp_ for going up... it is simply not good >> usability. > > It may have escaped your attention, but > - space for forwards and backspace for backwards is an old > convention that was in use before even MS-DOS existed; > worked fine > - the space and delete keys are much bigger than the arrow keys > and are therefore easier to hit; they are _more_ usable for > people with shaky hands. > I think you mean "doesn't look like Windows". > --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From mazen.harake@REDACTED Fri Mar 26 12:27:29 2010 From: mazen.harake@REDACTED (Mazen Harake) Date: Fri, 26 Mar 2010 13:27:29 +0200 Subject: [erlang-questions] Reading (and ignoring) escape-sequences In-Reply-To: <80c550b91003252201g42429e59v4ed0ef20385b424c@mail.gmail.com> References: <4BA76862.3050609@erlang-solutions.com> <20100322234006.GA48453@k2r.org> <4BA88648.80809@erlang-solutions.com> <4BA9F34B.4010002@erlang-solutions.com> <80c550b91003252201g42429e59v4ed0ef20385b424c@mail.gmail.com> Message-ID: <4BAC9A21.3020409@erlang-solutions.com> Well, I think you are wrong to be honest. It is probably more general purpose than you might think. I have seen Erlang being used from everything from telecom-systems to sorting and processing files on local disk. It is exactly this that is my point that it needs better support for these things if it is to become more general purpose. On 26/03/2010 07:01, Hasan Alayli wrote: >> Anyway it was a surprise to me that these sort of things weren't handled in >> a better way overall and even if Erlang wasn't really made to handle these >> kind of things I would hope that it would have better support in the future >> because it is absolutely gold to be able to write tools like e.g. table view >> and the debugger without the need for gs (or wx) without the nasty scrolling >> all the time (e.g. like top). >> >> /Mazen >> >> > My gut feeling says you are taking Erlang out of its context. > > Erlang is not a general purpose programming language so it should be > no surprise. :) > --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From mononcqc@REDACTED Fri Mar 26 13:20:11 2010 From: mononcqc@REDACTED (Fred Hebert) Date: Fri, 26 Mar 2010 08:20:11 -0400 Subject: [erlang-questions] Sets, ordsets, gb_sets, sofs. What is going on? In-Reply-To: <6672d0161003260331o5994abf4p5981600f502a299a@mail.gmail.com> References: <8b9ee55b1003251459s5f13e591kbf2da97519bb98d1@mail.gmail.com> <6672d0161003260331o5994abf4p5981600f502a299a@mail.gmail.com> Message-ID: <8b9ee55b1003260520u2cac2d1eh62ed04fe8db50554@mail.gmail.com> 2010/3/26 Bj?rn Gustavsson > On Thu, Mar 25, 2010 at 10:59 PM, Fred Hebert wrote: > > If something is to be included in the documentation, it must be well > researched and any recommendations should be based on benchmarks > results (not on intuition or folklore). > Yes, of course. I would have thought there was some rationale behind having the four modules - that people would not reinvent the wheel for the sake of it. This is partially what I am after. I'm not advocating putting unverified claims in the documentation -- if there were any author associated with these modules, I'd have rather contacted them directly to know the details. Maybe I should have taken a look at the commit logs. > > Here are some rules of thumb based on my own experience and > measurements of various operations in the Wings3D application. Note > that the type of the data and the size of the process heap can influence > the results, so if you are writing a time-critical application, you should > do > your own measurements. > > Anyway, my recommendation is to use the gb_sets module in most > circumstances. gb_sets has the following properties: > > 1. Creating a gb_set from a list is very fast, as is converting a > gb_set to to a sorted list. That means that if you need to process > the set using sofs or your own code, you don't have to be afraid > of converting between representations. > > 2. Incrementally constructing a gb_set by adding one element > at the time is also fast (but not as fast doing gb_sets:from_list/1). > As far as I know (I haven't done measurements), incrementally > building up a gb_set is faster than incrementally building a > 'sets' set. > Thanks for the reply. It sounds pretty much like the differences I benchmarked between gb_trees and the dict module (the comments mention they're based on the same respective algorithms, so it makes sense) -- dicts are faster on reads, while gb_trees are faster on most other operations. > > The ordsets module is useful if you'll need a known representation > that you can process with your own code without conversion and/or > the sets are very small. > Oh, good to know. I tend to treat most datatypes as opaque. I guess it is wanted that ordsets makes it easy to operate with lists and whatnot. > > If your set must use the '=:=' operator, 'sets' is the only module > you can use. Also, test for membership will probably be faster > with 'sets' if the set has many elements. But note that > sets:from_list/1 is not any faster than incrementally > inserting one element at a time into an initially empty set, > and is much slower than gb_sets:from_list/1. > > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB > Thanks for your reply, much appreciated. From max.lapshin@REDACTED Fri Mar 26 15:02:53 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 26 Mar 2010 17:02:53 +0300 Subject: [erlang-questions] Help with storing data in memory In-Reply-To: <6a36e7291003251549r7c88ea24p18bd06038df4056f@mail.gmail.com> References: <8d1798e91003230346i5a87f3e0xb5c64369319da4fe@mail.gmail.com> <6a36e7291003230514k7a0806d4x7ba7f9725f7ee21b@mail.gmail.com> <6a36e7291003251510p1d81ee3fkc5d72cb73de856d9@mail.gmail.com> <6a36e7291003251549r7c88ea24p18bd06038df4056f@mail.gmail.com> Message-ID: I thought, that hipe_bifs:array_update should help me, but it can store only immediate values =( From max.lapshin@REDACTED Fri Mar 26 15:59:06 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 26 Mar 2010 17:59:06 +0300 Subject: erlang.org infication Message-ID: This page: http://www.erlang.org/cgi-bin/ezmlm-cgi/4/11899 has an embedded not-escaped OBJECT. http://yandex.ru/ has already listed erlang.org as a dangereous site, maybe google will soon do the same. I think it would be great to fix mailman to escape user messages. From jeraymond@REDACTED Fri Mar 26 17:10:45 2010 From: jeraymond@REDACTED (Jeremy Raymond) Date: Fri, 26 Mar 2010 12:10:45 -0400 Subject: Is it possible to get Erlide compile source via a Makefile Message-ID: <59da11981003260910kd2cbbf9g7f5503c4f2babc5d@mail.gmail.com> Hi, I have an Erlang project which I'm currently building via make on Linux. Is it possible to get Erlide to compile my project by using the makefiles but still use Erlide to debug the application? Thanks, Jeremy From halayli@REDACTED Fri Mar 26 17:11:35 2010 From: halayli@REDACTED (Hasan Alayli) Date: Fri, 26 Mar 2010 09:11:35 -0700 Subject: [erlang-questions] Reading (and ignoring) escape-sequences In-Reply-To: <4BAC9A21.3020409@erlang-solutions.com> References: <4BA76862.3050609@erlang-solutions.com> <20100322234006.GA48453@k2r.org> <4BA88648.80809@erlang-solutions.com> <4BA9F34B.4010002@erlang-solutions.com> <80c550b91003252201g42429e59v4ed0ef20385b424c@mail.gmail.com> <4BAC9A21.3020409@erlang-solutions.com> Message-ID: <80c550b91003260911geec60beg271c33303dd666aa@mail.gmail.com> On Fri, Mar 26, 2010 at 4:27 AM, Mazen Harake wrote: > Well, I think you are wrong to be honest. It is probably more general > purpose than you might think. I have seen Erlang being used from everything > from telecom-systems to sorting and processing files on local disk. > > It is exactly this that is my point that it needs better support for these > things if it is to become more general purpose. > I can see telecom-systems requiring fault tolerance, high availability and the ability to handle concurrent operations. So Erlang feels natural in this context because it solves such problems easier than other languages. Erlang wasn't designed to be used in the context you are using although it is possible. But you will hit many walls and blame the language, and that was my original point. It is like when a programmer attempts to implement object oriented patterns in Perl. It is possible, but it is not natural compared to Java/Python/Smalltalk for example. The programmer has to go out of his way to do that and this is when he should figure out that the language was not designed for this purpose. Just a thought. From steven.charles.davis@REDACTED Fri Mar 26 17:41:29 2010 From: steven.charles.davis@REDACTED (Steve Davis) Date: Fri, 26 Mar 2010 09:41:29 -0700 (PDT) Subject: Reading (and ignoring) escape-sequences In-Reply-To: <80c550b91003260911geec60beg271c33303dd666aa@mail.gmail.com> References: <4BA76862.3050609@erlang-solutions.com> <20100322234006.GA48453@k2r.org> <4BA88648.80809@erlang-solutions.com> <4BA9F34B.4010002@erlang-solutions.com> <80c550b91003252201g42429e59v4ed0ef20385b424c@mail.gmail.com> <4BAC9A21.3020409@erlang-solutions.com> <80c550b91003260911geec60beg271c33303dd666aa@mail.gmail.com> Message-ID: From: http://erlang.org/faq/faq.html "1 What is Erlang "1.1 In a nutshell, what is Erlang? "Erlang is a general-purpose programming language and runtime environment. ..." I would be wary about making broad statements about what erlang is and what it was "designed to do". OTOH, discussions about how well the platform integrates with a particular supported OS is certainly up for grabs. /s On Mar 26, 11:11?am, Hasan Alayli wrote: > On Fri, Mar 26, 2010 at 4:27 AM, Mazen Harake > Erlang wasn't designed to be used in the context you are using > although it is possible. But you will hit many walls and blame the > language, and that was my original point. From rvirding@REDACTED Fri Mar 26 17:48:05 2010 From: rvirding@REDACTED (Robert Virding) Date: Fri, 26 Mar 2010 17:48:05 +0100 Subject: [erlang-questions] Sets, ordsets, gb_sets, sofs. What is going on? In-Reply-To: <8b9ee55b1003260520u2cac2d1eh62ed04fe8db50554@mail.gmail.com> References: <8b9ee55b1003251459s5f13e591kbf2da97519bb98d1@mail.gmail.com> <6672d0161003260331o5994abf4p5981600f502a299a@mail.gmail.com> <8b9ee55b1003260520u2cac2d1eh62ed04fe8db50554@mail.gmail.com> Message-ID: <3dbc6d1c1003260948w5885aac0s70fa315e54d13885@mail.gmail.com> The original idea behind having different implementations of sets was the acceptance of that no implementation is "best" for everything and everyone. We would therefore define an API and a number of modules which followed this API but were based on different algorithms so users could easily experiment and find which was best for their app. We did two initial implementations: sets which uses hashing algorithm (the same algorithm as ets actually) but whose structure is otherwise undefined and ordsets which uses the defined ordered list. It was never meant that these were to be the only set modules, but that these were a base upon which others could be added and by having the same API it would be easier for users to choose. It was also never meant that the API was cast in stone and could not be extended with more useful functions, the only requirement being that they work on all implementations. Gb_sets provide an alternative tree based algorithm which for many apps will be the best. While it does provide a sets compatible API it is unfortunate that it seems like an afterthought and not the base set of functions. While ordsets is usually slower it does have one benefit in that it is easy to read when printed which is definitely not the case for any others. I often find that unless the set is big and the set operations critical then the difference in speed is less noticeable than you would expect. The discussions apply for dict's as well but here it is even more unfortunate that gb_trees does have dict compatible API. The discussion about using or not using '=:=' operator for comparison is an unfortunate by-product of Erlang not having a complete set of pure term comparison operators which do not convert integers. With 20-20 hindsight it would have been much better to have a set of proper term comparison operators and a separate set of numerical comparison operators which only work on numbers. Then there would be no difference. I will be submitting (real soon now) a patch which slightly extends the sets/dict APIs and adds compatible modules which use another tree-based algorithm (red-black trees) but which are API compatible. Just to confuse the issue. That was a bit about the thoughts behind the dict/sets modules. Robert P.S. I have another question. How do we handle/where do we put code which may not be directly useful but would be good as a base for user specialisation? As an example I have another tree based implementation of dict/sets which uses the same algorithm as in gb_trees but expressed in a simpler way. It is almost as good as the red-black trees but much simpler and would be a good base for someone who needs a specialised dict or sets module. From erwan@REDACTED Fri Mar 26 19:01:14 2010 From: erwan@REDACTED (Erwan MAS) Date: Fri, 26 Mar 2010 19:01:14 +0100 Subject: max nodes on one server Message-ID: <20100326180114.GU11467@voyageur.mas.nom.fr> Hello , I tried to start many nodes on one server . Currently i can not have more than 1017 nodes . My system is rhel 5.4 . On the shell , before i start the command , i set the max open file limit with ulimit -n 4096 . my erl command is : erl -hidden -connect_all false -rsh ssh +K true -env ERL_MAX_PORTS 4096 +P 134217727 I think i reach a limit but i dont know which ? ps : My code is : startnodes(NumberOfNodes, NodeNamePrefix) -> startnodes1(NumberOfNodes, NodeNamePrefix, []). startnodes1(0, _NodeNamePrefix, Acc) -> Acc; startnodes1(NumberOfNodes, NodeNamePrefix, Acc) -> NodeName = "benchnode"++ atom_to_list(NodeNamePrefix) ++ integer_to_list(NumberOfNodes), Args = "-setcookie " ++ atom_to_list(erlang:get_cookie()), Pas = case init:get_argument(pa) of error -> ""; {ok, Palist} -> lists:foldl( fun(X, Str) -> Str ++ " -pa " ++ filename:absname(X) end, "", lists:append(Palist)) end, Res=slave:start_link("localhost", NodeName, Args ++ Pas), case Res of {ok, Node} -> startnodes1(NumberOfNodes - 1, NodeNamePrefix, Acc ++ [Node]) ; Error -> io:format("Error ~p OK~n", [Error]), io:format("~p processes was not started.~n", [NumberOfNodes]), Acc end. -- Erwan MAS From vladdu55@REDACTED Fri Mar 26 19:33:10 2010 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 26 Mar 2010 19:33:10 +0100 Subject: [erlang-questions] Is it possible to get Erlide compile source via a Makefile In-Reply-To: <59da11981003260910kd2cbbf9g7f5503c4f2babc5d@mail.gmail.com> References: <59da11981003260910kd2cbbf9g7f5503c4f2babc5d@mail.gmail.com> Message-ID: <95be1d3b1003261133h288465f3g48dcd5ba9305d7c@mail.gmail.com> On Fri, Mar 26, 2010 at 17:10, Jeremy Raymond wrote: > I have an Erlang project which I'm currently building via make on Linux. Is > it possible to get Erlide to compile my project by using the makefiles but > still use Erlide to debug the application? Hi! I haven't tried it, but it might be possible. I think you still have to configure the eclipse project with the right source and include directories, just disable the auto-build feature. Please note that you won't get any compilation errors/warings inside erlide in this case (will be fixed in a future version). You would also miss the auto-update feature if editing your sources while debugging, you have to load the modules by hand. If your make build just compiles the erlang files and the project doesn't have any external dependencies, you can enable auto-build and use erlide with all features. Even the external dependencies problem can be handled, if needed. Please let me know how it goes, it's useful to know. And of course if it doesn't work, I can try to find a workaround. best regards, Vlad From mazen.harake@REDACTED Fri Mar 26 20:51:07 2010 From: mazen.harake@REDACTED (Mazen Harake) Date: Fri, 26 Mar 2010 21:51:07 +0200 Subject: [erlang-questions] Reading (and ignoring) escape-sequences In-Reply-To: <80c550b91003260911geec60beg271c33303dd666aa@mail.gmail.com> References: <4BA76862.3050609@erlang-solutions.com> <20100322234006.GA48453@k2r.org> <4BA88648.80809@erlang-solutions.com> <4BA9F34B.4010002@erlang-solutions.com> <80c550b91003252201g42429e59v4ed0ef20385b424c@mail.gmail.com> <4BAC9A21.3020409@erlang-solutions.com> <80c550b91003260911geec60beg271c33303dd666aa@mail.gmail.com> Message-ID: <4BAD102B.3060501@erlang-solutions.com> Ok fair enough I understand what you were aiming for but I certainly don't agree. I believe your comparison to OOP in perl is not at all the same. Just because Erlang has certain characteristics which it is known for (which doesn't involve reading input data) it doesn't mean that it shouldn't have a decent way of reading input data!? It is like saying "Why do you want good wheels on an air plane when it spends most of its time flying?" Erlang must be able to read input, so why not do that well? On 26/03/2010 18:11, Hasan Alayli wrote: > On Fri, Mar 26, 2010 at 4:27 AM, Mazen Harake > wrote: > >> Well, I think you are wrong to be honest. It is probably more general >> purpose than you might think. I have seen Erlang being used from everything >> from telecom-systems to sorting and processing files on local disk. >> >> It is exactly this that is my point that it needs better support for these >> things if it is to become more general purpose. >> >> > I can see telecom-systems requiring fault tolerance, high availability > and the ability to handle concurrent operations. So Erlang feels > natural in this context because it solves such problems easier than > other languages. > > Erlang wasn't designed to be used in the context you are using > although it is possible. But you will hit many walls and blame the > language, and that was my original point. > > It is like when a programmer attempts to implement object oriented > patterns in Perl. It is possible, but it is not natural compared to > Java/Python/Smalltalk for example. The programmer has to go out of his > way to do that and this is when he should figure out that the language > was not designed for this purpose. > > Just a thought. > --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From hynek@REDACTED Fri Mar 26 22:22:21 2010 From: hynek@REDACTED (Hynek Vychodil) Date: Fri, 26 Mar 2010 14:22:21 -0700 Subject: [erlang-questions] Reading (and ignoring) escape-sequences In-Reply-To: <4BAD102B.3060501@erlang-solutions.com> References: <4BA76862.3050609@erlang-solutions.com> <20100322234006.GA48453@k2r.org> <4BA88648.80809@erlang-solutions.com> <4BA9F34B.4010002@erlang-solutions.com> <80c550b91003252201g42429e59v4ed0ef20385b424c@mail.gmail.com> <4BAC9A21.3020409@erlang-solutions.com> <80c550b91003260911geec60beg271c33303dd666aa@mail.gmail.com> <4BAD102B.3060501@erlang-solutions.com> Message-ID: <4d08db371003261422q6b383208j3a7c3c9a020c9064@mail.gmail.com> On Fri, Mar 26, 2010 at 12:51 PM, Mazen Harake wrote: > Ok fair enough I understand what you were aiming for but I certainly don't > agree. I believe your comparison to OOP in perl is not at all the same. Just > because Erlang has certain characteristics which it is known for (which > doesn't involve reading input data) it doesn't mean that it shouldn't have a > decent way of reading input data!? It is like saying "Why do you want good > wheels on an air plane when it spends most of its time flying?" > > Erlang must be able to read input, so why not do that well? Well, I think Erlang is able read input well. What are you arguing is distinguish escape codes from other input. Sorry, it is not same. > > On 26/03/2010 18:11, Hasan Alayli wrote: >> >> On Fri, Mar 26, 2010 at 4:27 AM, Mazen Harake >> ?wrote: >> >>> >>> Well, I think you are wrong to be honest. It is probably more general >>> purpose than you might think. I have seen Erlang being used from >>> everything >>> from telecom-systems to sorting and processing files on local disk. >>> >>> It is exactly this that is my point that it needs better support for >>> these >>> things if it is to become more general purpose. >>> >>> >> >> I can see telecom-systems requiring fault tolerance, high availability >> and the ability to handle concurrent operations. So Erlang feels >> natural in this context because it solves such problems easier than >> other languages. >> >> Erlang wasn't designed to be used in the context you are using >> although it is possible. But you will hit many walls and blame the >> language, and that was my original point. >> >> It is like when a programmer attempts to implement object oriented >> patterns in Perl. It is possible, but it is not natural compared to >> Java/Python/Smalltalk for example. The programmer has to go out of his >> way to do that and this is when he should figure out that the language >> was not designed for this purpose. >> >> Just a thought. >> > > --------------------------------------------------- > > --------------------------------------------------- > > WE'VE CHANGED NAMES! > > Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG > SOLUTIONS LTD. > > www.erlang-solutions.com > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try GoodData now for free: www.gooddata.com From mazen.harake@REDACTED Sat Mar 27 07:54:45 2010 From: mazen.harake@REDACTED (Mazen Harake) Date: Sat, 27 Mar 2010 08:54:45 +0200 Subject: [erlang-questions] Reading (and ignoring) escape-sequences In-Reply-To: <4d08db371003261422q6b383208j3a7c3c9a020c9064@mail.gmail.com> References: <4BA76862.3050609@erlang-solutions.com> <20100322234006.GA48453@k2r.org> <4BA88648.80809@erlang-solutions.com> <4BA9F34B.4010002@erlang-solutions.com> <80c550b91003252201g42429e59v4ed0ef20385b424c@mail.gmail.com> <4BAC9A21.3020409@erlang-solutions.com> <80c550b91003260911geec60beg271c33303dd666aa@mail.gmail.com> <4BAD102B.3060501@erlang-solutions.com> <4d08db371003261422q6b383208j3a7c3c9a020c9064@mail.gmail.com> Message-ID: <4BADABB5.2090007@erlang-solutions.com> Actually you are right, for general input it is good enough (specially when reading from files) and what I am arguing is not the same you are correct. However, if you will do lower-level stuff you are a bit constrained. I guess I just meant that I would like to have: a peak function, a get_chars function that take in character by character instead of taking the N number of characters in the line. In other words: the ability to read in keystrokes and not just N chars from a line. a get_char function which includes special keys (in some way) a way of aborting a blocking get_char function without spawning it into a separate process and killing it when timing out and a way to get events of when a terminal changes size (which I can simulate but still). Currently you have to do all this in a driver. But there are many things I like to have :) I'm not too sad about it... I'm just saying it would be nice to see in the future (although I know it is not exactly priority). On 26/03/2010 23:22, Hynek Vychodil wrote: > On Fri, Mar 26, 2010 at 12:51 PM, Mazen Harake > wrote: > >> Ok fair enough I understand what you were aiming for but I certainly don't >> agree. I believe your comparison to OOP in perl is not at all the same. Just >> because Erlang has certain characteristics which it is known for (which >> doesn't involve reading input data) it doesn't mean that it shouldn't have a >> decent way of reading input data!? It is like saying "Why do you want good >> wheels on an air plane when it spends most of its time flying?" >> >> Erlang must be able to read input, so why not do that well? >> > Well, I think Erlang is able read input well. What are you arguing is > distinguish escape codes from other input. Sorry, it is not same. > >> On 26/03/2010 18:11, Hasan Alayli wrote: >> >>> On Fri, Mar 26, 2010 at 4:27 AM, Mazen Harake >>> wrote: >>> >>> >>>> Well, I think you are wrong to be honest. It is probably more general >>>> purpose than you might think. I have seen Erlang being used from >>>> everything >>>> from telecom-systems to sorting and processing files on local disk. >>>> >>>> It is exactly this that is my point that it needs better support for >>>> these >>>> things if it is to become more general purpose. >>>> >>>> >>>> >>> I can see telecom-systems requiring fault tolerance, high availability >>> and the ability to handle concurrent operations. So Erlang feels >>> natural in this context because it solves such problems easier than >>> other languages. >>> >>> Erlang wasn't designed to be used in the context you are using >>> although it is possible. But you will hit many walls and blame the >>> language, and that was my original point. >>> >>> It is like when a programmer attempts to implement object oriented >>> patterns in Perl. It is possible, but it is not natural compared to >>> Java/Python/Smalltalk for example. The programmer has to go out of his >>> way to do that and this is when he should figure out that the language >>> was not designed for this purpose. >>> >>> Just a thought. >>> >>> >> --------------------------------------------------- >> >> --------------------------------------------------- >> >> WE'VE CHANGED NAMES! >> >> Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG >> SOLUTIONS LTD. >> >> www.erlang-solutions.com >> >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED >> >> >> > > > --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From navaneethanit@REDACTED Sat Mar 27 13:21:23 2010 From: navaneethanit@REDACTED (NavaTux) Date: Sat, 27 Mar 2010 05:21:23 -0700 (PDT) Subject: nxdomain error Message-ID: <70ac2a94-8859-496b-8ded-fcb6a7fcb10f@z18g2000prh.googlegroups.com> what is error nxdomain,when i open the sample application this error shown like these ERROR REPORT==== 27-Mar-2010::17:49:30 === Error : nxdomain =ERROR REPORT==== 27-Mar-2010::17:49:30 === Error : nxdomain =ERROR REPORT==== 27-Mar-2010::17:49:30 === Error : nxdomain =ERROR REPORT==== 27-Mar-2010::17:49:57 === ** Generic server <0.104.0> terminating ** Last message in was {tcp,#Port<0.2494>, <<"POST /web/stream/hello HTTP/1.1\r \nHost: localhost:8000\r\nUser-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.8) Gecko/2009033100 Ubuntu/9.04 (jaunty) Firefox/ 3.0.18\r\nAccept: text/plain, */*\r\nAccept-Language: en-us,en;q=0.5\r \nAccept-Encoding: gzip,deflate\r\nAccept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\nKeep-Alive: 300\r\nConnection: keep- alive\r\nContent-Type: application/x-www-form-urlencoded; charset=UTF-8\r\nX-Requested-With: XMLHttpRequest\r\nReferer: http://localhost:8000/web/stream/hello\r\nContent-Length: 281\r \nCookie: SESS23e7e949e8d5d6643636d5138b3fcde3=3b8cdce3644d0a356dfa3cf44303503f; wf=T6Wps4NQAAAAXHicy2DKY2XYVqx0lC- DKT2FQaKkPLOkJLUovrikKDUx1yEnPzkxJyO_uISBgSEeiBmYixiY8ShjBqpYxgAFADUcGlY \r\nPragma: no-cache\r\nCache-Control: no-cache\r\n\r \npostbackInfo=irS25INQAAAATHicy2DKY2XYVqx0lC- DLZuBpSAxPTWFgbM0LyU1LTMvNSWFgTU5Pze1BFUMmc1VnpoUX1xSlJqYCwCMUBjr&domState=OjByKYNQAAAAdXicFY0xDgIxDAStAxqEaGioeQk_sayzITk55BQv5Gf8gH9xKVejmU3T60DfuP3OTkS7NCkdP- JZBbXFMvYFVlYXGHcJnsXdVGmP9raBT_3Bcy0GXrM- la7oGbDGgWZS7l43JdXA1hcaJ8sfh7AlOw">>} ** When Server state == {state, {mod, {init_data,{52013,"127.0.0.1"},"nava- laptop"}, [],ip_comm,#Port<0.2494>, httpd_conf__0_0_0_0__8000,undefined, [], undefined,undefined,undefined, [],undefined, undefined}, <0.90.0>,accept, {httpd_request,parse,[{nolimit,10240}]}, infinity,false, 150000,#Ref<0.0.0.1011>,undefined, undefined} ** Reason for termination == ** {{badmatch,socket_closed}, [{httpd_response,send_body,3}, {httpd_response,generate_and_send_response,1}, {httpd_request_handler,handle_response,1}, {gen_server,handle_msg,5}, {proc_lib,init_p_do_apply,3}]} =ERROR REPORT==== 27-Mar-2010::17:49:59 === ** Generic server <0.94.0> terminating ** Last message in was {tcp,#Port<0.1782>, <<"POST /web/stream/hello HTTP/1.1\r \nHost: localhost:8000\r\nUser-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.8) Gecko/2009033100 Ubuntu/9.04 (jaunty) Firefox/ 3.0.18\r\nAccept: text/plain, */*\r\nAccept-Language: en-us,en;q=0.5\r \nAccept-Encoding: gzip,deflate\r\nAccept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\nKeep-Alive: 300\r\nConnection: keep- alive\r\nContent-Type: application/x-www-form-urlencoded; charset=UTF-8\r\nX-Requested-With: XMLHttpRequest\r\nReferer: http://localhost:8000/web/stream/hello\r\nContent-Length: 281\r \nCookie: SESS23e7e949e8d5d6643636d5138b3fcde3=3b8cdce3644d0a356dfa3cf44303503f; wf=o8GduYNQAAAAXHicy2DKY2XYUax0lC- DKT2FQaKkPLOkJLUovrikKDUx1yEnPzkxJyO_uISBgSEeiBmYixiY8ShjBqpYxgAFADXKGlg \r\nPragma: no-cache\r\nCache-Control: no-cache\r\n\r \npostbackInfo=dhFlWINQAAAATHicy2DKY2XYXqx0lC- DLZuBpSAxPTWFgbM0LyU1LTMvNSWFgTU5Pze1BFUMmc1VnpoUX1xSlJqYCwCMlxjs&domState=QAousINQAAAAdXicFY0xDgIxDAStAxqEaGioeQk_sayzITk55BQv5Gm8gH9xKVejmU3T60DfuP3OTkS7NCkdP- JZBbXFMvYFVlYXGHcJnsXdVGmP9raBT_3Bcy0GXrM- la7oGbDGgWZS7l43JdXA1s80TpY_iFglRA">>} ** When Server state == {state, {mod, {init_data,{52009,"127.0.0.1"},"nava- laptop"}, [],ip_comm,#Port<0.1782>, httpd_conf__0_0_0_0__8000,undefined, [], undefined,undefined,undefined, [],undefined, undefined}, <0.90.0>,accept, {httpd_request,parse,[{nolimit,10240}]}, infinity,false, 150000,#Ref<0.0.0.1096>,undefined, undefined} ** Reason for termination == ** {{badmatch,socket_closed}, [{httpd_response,send_body,3}, {httpd_response,generate_and_send_response,1}, {httpd_request_handler,handle_response,1}, {gen_server,handle_msg,5}, {proc_lib,init_p_do_apply,3}]} From erlang@REDACTED Sat Mar 27 14:02:15 2010 From: erlang@REDACTED (Dominic Williams) Date: Sat, 27 Mar 2010 14:02:15 +0100 Subject: [erlang-questions] nxdomain error In-Reply-To: <70ac2a94-8859-496b-8ded-fcb6a7fcb10f@z18g2000prh.googlegroups.com> References: <70ac2a94-8859-496b-8ded-fcb6a7fcb10f@z18g2000prh.googlegroups.com> Message-ID: <5AB36396-A241-4A1A-BAB7-4BADA9EA0954@dominicwilliams.net> Hi, Le 27 mars 2010 ? 13:21, NavaTux a ?crit : > what is error nxdomain,when i open the sample application this error > shown like these > > > ERROR REPORT==== 27-Mar-2010::17:49:30 === > Error : nxdomain > [...] nxdomain means "non-existent domain". The nxdomain error report from Erlang is just relayed to you after Erlang's httpd (or http client) received an NXDOMAIN error from a DNS. It can be caused by: 1) a badly-formed URL somewhere in the code 2) network configuration problems in your OS or your network (internet access) etc First check what URL is causing this, then try to ping the machine etc. and make sure your network is working. Best regards, Dominic Williams http://dominicwilliams.net ---- From clist@REDACTED Sat Mar 27 15:56:52 2010 From: clist@REDACTED (Angel) Date: Sat, 27 Mar 2010 15:56:52 +0100 Subject: [erlang-questions] max nodes on one server In-Reply-To: <20100326180114.GU11467@voyageur.mas.nom.fr> References: <20100326180114.GU11467@voyageur.mas.nom.fr> Message-ID: <201003271556.52175.clist@uah.es> On Viernes, 26 de Marzo de 2010 19:01:14 Erwan MAS escribi?: > Hello , > > I tried to start many nodes on one server . > > Currently i can not have more than 1017 nodes . > > My system is rhel 5.4 . > > On the shell , before i start the command , i set the max open file limit > with ulimit -n 4096 . > > my erl command is : > > erl -hidden -connect_all false -rsh ssh +K true -env ERL_MAX_PORTS 4096 > +P 134217727 > > I think i reach a limit but i dont know which ? > > > > ps : > My code is : > > startnodes(NumberOfNodes, NodeNamePrefix) -> > startnodes1(NumberOfNodes, NodeNamePrefix, []). > startnodes1(0, _NodeNamePrefix, Acc) -> > Acc; > startnodes1(NumberOfNodes, NodeNamePrefix, Acc) -> > NodeName = "benchnode"++ atom_to_list(NodeNamePrefix) ++ > integer_to_list(NumberOfNodes), Args = "-setcookie " ++ > atom_to_list(erlang:get_cookie()), Pas = case init:get_argument(pa) of > error -> > ""; > {ok, Palist} -> > lists:foldl( > fun(X, Str) -> > Str ++ " -pa " ++ > filename:absname(X) end, "", > lists:append(Palist)) > end, > Res=slave:start_link("localhost", NodeName, Args ++ Pas), > case Res of > {ok, Node} -> > startnodes1(NumberOfNodes - 1, NodeNamePrefix, Acc > ++ [Node]) ; Error -> > io:format("Error ~p OK~n", [Error]), > io:format("~p processes was not started.~n", > [NumberOfNodes]), Acc > end. > Hi What's the error you see? I played last year with slave and got several timeouts with large node numbers. Maybe this can help you: I was using pool and i came across failures on the timing logic (fixed to 32 secs) . I was using a remote code server for my nods so the more nodes i spawned the more load was put on the code server, and eventually new nodes werent able to startup in time so slave killed them. i modified slave to allow configurable timeout and that solved my problem... Ive attached my code (its old around R12..) the funtion wait_for_slave checks for a new option {timeout,TimeOut} and uses then to alter the after clause when she waits for new nodes to startup.. Now i can pass {timeout, 100000} on start_link and slave waits nicely for the nodes. /Angel Most people know C is not so high level.... ...Everybody else just got assembler overdose -------------- next part -------------- A non-text attachment was scrubbed... Name: myslave.erl Type: text/x-erlang Size: 9452 bytes Desc: not available URL: From max.lapshin@REDACTED Sat Mar 27 17:42:30 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Sat, 27 Mar 2010 19:42:30 +0300 Subject: specify error logger for process Message-ID: I've discussed how to store from 100MB to 1GB of data in one process and found out, that plain array is incredibly faster than ets. Now I have new problem: sometimes if process crashes, beam.smp takes all available memory and CPU for error_logger process, that wants to dump into screen about 450 MB of data, stored in gen_server state. Either I have to refuse from gen_server, either change way it logs about error. Have I missed something in documentation or in google? From clist@REDACTED Sat Mar 27 19:53:07 2010 From: clist@REDACTED (Angel) Date: Sat, 27 Mar 2010 19:53:07 +0100 Subject: The erlang baby and the green JVM Message-ID: <201003271953.07148.clist@uah.es> Another piece of the erlang history?? http://functional-orbitz.blogspot.com/2010/03/how-much-has-scala-affected- erlang.html I think this aspect never was detailed on the list nor on the blogs... Most people know C is not so high level.... ...Everybody else just got assembler overdose From rory@REDACTED Sat Mar 27 20:02:31 2010 From: rory@REDACTED (Rory Byrne) Date: Sat, 27 Mar 2010 20:02:31 +0100 Subject: Is tuple syntax function call deprecated? Message-ID: <20100327190231.GA11970@almeida.jinsky.com> Hello, I just noticed that the following is a valid function call: {io, format}("This actually works!!\n"). Since using {Module, Function} as a Fun in erlang:apply/2 is deprecated, I was wondering if this syntax is also deprecated? Thanks, Rory From brian@REDACTED Sat Mar 27 20:02:50 2010 From: brian@REDACTED (Brian Troutwine) Date: Sat, 27 Mar 2010 12:02:50 -0700 Subject: [erlang-questions] The erlang baby and the green JVM In-Reply-To: <201003271953.07148.clist@uah.es> References: <201003271953.07148.clist@uah.es> Message-ID: <466fba8d1003271202h74ae19b5gbeb49cd1c5cdf696@mail.gmail.com> Early April Fools? On Sat, Mar 27, 2010 at 11:53 AM, Angel wrote: > > Another piece of the erlang history?? > > http://functional-orbitz.blogspot.com/2010/03/how-much-has-scala-affected- > erlang.html > > I think this aspect never was detailed on the list nor on the blogs... > > > > > > Most people know C is not so high level.... > ? ? ? ? ? ? ? ?...Everybody else just got assembler overdose > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From kostis@REDACTED Sat Mar 27 20:07:06 2010 From: kostis@REDACTED (Kostis Sagonas) Date: Sat, 27 Mar 2010 21:07:06 +0200 Subject: [erlang-questions] Is tuple syntax function call deprecated? In-Reply-To: <20100327190231.GA11970@almeida.jinsky.com> References: <20100327190231.GA11970@almeida.jinsky.com> Message-ID: <4BAE575A.10805@cs.ntua.gr> Rory Byrne wrote: > Hello, > > I just noticed that the following is a valid function call: > > {io, format}("This actually works!!\n"). > > Since using {Module, Function} as a Fun in erlang:apply/2 is deprecated, > I was wondering if this syntax is also deprecated? Yes. These function calls are deprecated but possibly still allowed in some parts of the system for "backwards compatibility" reasons and for giving time to applications to adapt. Do not use this. Kostis From navaneethanit@REDACTED Sat Mar 27 20:09:42 2010 From: navaneethanit@REDACTED (NavaTux) Date: Sat, 27 Mar 2010 12:09:42 -0700 (PDT) Subject: how to use mysql driver with nitrogen Message-ID: Hello friends, Here i downloaded http://wiki.github.com/dizzyd/erlang-mysql-driver/ to use for my web application,as well as i wanna know how to use it.. how to compile it..how to integrate with my application created by nitrogen, please help me From rory@REDACTED Sat Mar 27 20:14:49 2010 From: rory@REDACTED (Rory Byrne) Date: Sat, 27 Mar 2010 20:14:49 +0100 Subject: [erlang-questions] Is tuple syntax function call deprecated? In-Reply-To: <4BAE575A.10805@cs.ntua.gr> References: <20100327190231.GA11970@almeida.jinsky.com> <4BAE575A.10805@cs.ntua.gr> Message-ID: <20100327191449.GB11970@almeida.jinsky.com> On Sat, Mar 27, 2010 at 09:07:06PM +0200, Kostis Sagonas wrote: > Rory Byrne wrote: > >Hello, > > > >I just noticed that the following is a valid function call: > > > > {io, format}("This actually works!!\n"). > > > >Since using {Module, Function} as a Fun in erlang:apply/2 is deprecated, > >I was wondering if this syntax is also deprecated? > > Yes. These function calls are deprecated but possibly still allowed in > some parts of the system for "backwards compatibility" reasons and for > giving time to applications to adapt. Do not use this. Good to know - thanks! From valentin@REDACTED Sat Mar 27 20:54:00 2010 From: valentin@REDACTED (Valentin Micic) Date: Sat, 27 Mar 2010 21:54:00 +0200 Subject: [erlang-questions] The erlang baby and the green JVM In-Reply-To: <466fba8d1003271202h74ae19b5gbeb49cd1c5cdf696@mail.gmail.com> Message-ID: Has to be... "Richard" Virding?!? -----Original Message----- From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] On Behalf Of Brian Troutwine Sent: 27 March 2010 09:03 PM To: Angel Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] The erlang baby and the green JVM Early April Fools? On Sat, Mar 27, 2010 at 11:53 AM, Angel wrote: > > Another piece of the erlang history?? > > http://functional-orbitz.blogspot.com/2010/03/how-much-has-scala-affected- > erlang.html > > I think this aspect never was detailed on the list nor on the blogs... > > > > > > Most people know C is not so high level.... > ? ? ? ? ? ? ? ?...Everybody else just got assembler overdose > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > ________________________________________________________________ erlang-questions (at) erlang.org mailing list. See http://www.erlang.org/faq.html To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED From rvirding@REDACTED Sat Mar 27 21:45:56 2010 From: rvirding@REDACTED (Robert Virding) Date: Sat, 27 Mar 2010 21:45:56 +0100 Subject: [erlang-questions] The erlang baby and the green JVM In-Reply-To: <4bae685a.091abc0a.1f68.6a4dSMTPIN_ADDED@mx.google.com> References: <466fba8d1003271202h74ae19b5gbeb49cd1c5cdf696@mail.gmail.com> <4bae685a.091abc0a.1f68.6a4dSMTPIN_ADDED@mx.google.com> Message-ID: <3dbc6d1c1003271345r3d87e054y5221452315121107@mail.gmail.com> Oh, it is! "Richard" On 27 March 2010 20:54, Valentin Micic wrote: > Has to be... "Richard" Virding?!? > > -----Original Message----- > From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] On > Behalf Of Brian Troutwine > Sent: 27 March 2010 09:03 PM > To: Angel > Cc: erlang-questions@REDACTED > Subject: Re: [erlang-questions] The erlang baby and the green JVM > > Early April Fools? > > On Sat, Mar 27, 2010 at 11:53 AM, Angel wrote: >> >> Another piece of the erlang history?? >> >> http://functional-orbitz.blogspot.com/2010/03/how-much-has-scala-affected- >> erlang.html >> >> I think this aspect never was detailed on the list nor on the blogs... >> >> >> >> >> >> Most people know C is not so high level.... >> ? ? ? ? ? ? ? ?...Everybody else just got assembler overdose >> >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED >> >> > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From zhangjr2009@REDACTED Sat Mar 27 21:51:51 2010 From: zhangjr2009@REDACTED (JR Zhang) Date: Sat, 27 Mar 2010 20:51:51 +0000 Subject: How to Cross compile Erlang/OTP R13B04 for TileraPro64 Message-ID: <84a9e12c1003271351x6399e81cwee53cf8134dc815@mail.gmail.com> Hi, I couldn't cross compile Erlang/OTP R13B04 for Tilera board properly. I follow the steps described in INSTALL-CROSS.md, which are : (1) cd $ERL_TOP (2) ./otp_build configure --xcomp-conf= (3) ./otp_build boot -a (4) ./otp_build release -a /lhome/x/otp (5) ./Install -cross -minimal /lhome/x/otp The compilation is successful without any errors. But after I upload it to Tilera board and run it, I get an error, "Segmentation fault". I found a thread discussing how to cross compile R13B03 for Tilera Board http://www.erlang.org/cgi-bin/ezmlm-cgi/4/49164 . I tried to add steps like "touch lib/crypto/SKIP', "touch lib/ssl/SKIP", "touch lib/ssh/SKIP". But I still didn't succeed. Could someone help me? Thank you in advance. Best Regards, Jianrong Zhang Kista Multicore Center, SICS From andrew@REDACTED Sun Mar 28 03:08:10 2010 From: andrew@REDACTED (Andrew Thompson) Date: Sat, 27 Mar 2010 21:08:10 -0400 Subject: [erlang-questions] specify error logger for process In-Reply-To: References: Message-ID: <20100328010810.GG1969@hijacked.us> On Sat, Mar 27, 2010 at 07:42:30PM +0300, Max Lapshin wrote: > I've discussed how to store from 100MB to 1GB of data in one process > and found out, that plain array is incredibly faster than ets. > Now I have new problem: sometimes if process crashes, beam.smp takes > all available memory and CPU for error_logger process, > that wants to dump into screen about 450 MB of data, stored in gen_server state. > > Either I have to refuse from gen_server, either change way it logs > about error. Have I missed something in documentation or in google? > There's a patch in the OTP 'pu' branch that lets you use the format_status callback to format the state data passed to the error_logger. Hopefully it'll make it into the next release. Andrew From max.lapshin@REDACTED Sun Mar 28 03:32:36 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Sun, 28 Mar 2010 04:32:36 +0300 Subject: [erlang-questions] specify error logger for process In-Reply-To: <20100328010810.GG1969@hijacked.us> References: <20100328010810.GG1969@hijacked.us> Message-ID: > There's a patch in the OTP 'pu' branch that lets you use the > format_status callback to format the state data passed to the > error_logger. Hopefully it'll make it into the next release. > > Andrew > It would be so great to see this feature! From ok@REDACTED Sun Mar 28 07:38:54 2010 From: ok@REDACTED (Richard O'Keefe) Date: Sun, 28 Mar 2010 18:38:54 +1300 Subject: [erlang-questions] Sets, ordsets, gb_sets, sofs. What is going on? In-Reply-To: <3dbc6d1c1003260948w5885aac0s70fa315e54d13885@mail.gmail.com> References: <8b9ee55b1003251459s5f13e591kbf2da97519bb98d1@mail.gmail.com> <6672d0161003260331o5994abf4p5981600f502a299a@mail.gmail.com> <8b9ee55b1003260520u2cac2d1eh62ed04fe8db50554@mail.gmail.com> <3dbc6d1c1003260948w5885aac0s70fa315e54d13885@mail.gmail.com> Message-ID: <82D7535B-E61A-4A16-B45F-23764F095D94@cs.otago.ac.nz> On Mar 27, 2010, at 5:48 AM, Robert Virding wrote: > > The discussion about using or not using '=:=' operator for comparison > is an unfortunate by-product of Erlang not having a complete set of > pure term comparison operators which do not convert integers. With > 20-20 hindsight it would have been much better to have a set of proper > term comparison operators and a separate set of numerical comparison > operators which only work on numbers. Then there would be no > difference. Given Erlang's Prolog ancestry, and the fact that Prolog _had_ two complete sets of operators, I really can't take "hindsight" as the appropriate term. It's also particularly unfortunate that Erlang switch the meaning of Prolog's == (exact identity) and =:= (numeric identity) operators. From ok@REDACTED Sun Mar 28 07:52:46 2010 From: ok@REDACTED (Richard O'Keefe) Date: Sun, 28 Mar 2010 18:52:46 +1300 Subject: [erlang-questions] Reading (and ignoring) escape-sequences In-Reply-To: <4BAD102B.3060501@erlang-solutions.com> References: <4BA76862.3050609@erlang-solutions.com> <20100322234006.GA48453@k2r.org> <4BA88648.80809@erlang-solutions.com> <4BA9F34B.4010002@erlang-solutions.com> <80c550b91003252201g42429e59v4ed0ef20385b424c@mail.gmail.com> <4BAC9A21.3020409@erlang-solutions.com> <80c550b91003260911geec60beg271c33303dd666aa@mail.gmail.com> <4BAD102B.3060501@erlang-solutions.com> Message-ID: On Mar 27, 2010, at 8:51 AM, Mazen Harake wrote: > Ok fair enough I understand what you were aiming for but I certainly > don't agree. I believe your comparison to OOP in perl is not at all > the same. Just because Erlang has certain characteristics which it > is known for (which doesn't involve reading input data) it doesn't > mean that it shouldn't have a decent way of reading input data!? It > is like saying "Why do you want good wheels on an air plane when it > spends most of its time flying?" > > Erlang must be able to read input, so why not do that well? I am more than a little puzzled here. There is a problem which is not merely theoretically intractable, but for which all purported practical solutions are unhappily easy to break. There is NO programming language which is good at this problem, because it isn't the _kind_ of problem a language could be good at: it's an OS/interface issue. And somehow Erlang is being slagged off for not making it easy, when *no* language actually makes it easy? If you want to distinguish - user pressed ESC key from - user pressed some arrow key *reliably*, then you *have* to work at the level of key codes. At the level of "ASCII byte sequences" the situation is inherently ambiguous, and NO, timeouts _usually_ work but are by no means infallible. Erlang doesn't have any way to work at the level of key codes in the same way that C doesn't have any way to work at the level of key codes. You can search the ANSI/ISO C documentation and the POSIX documentation to your heart's content, and you will not find any portable way to read key codes in C. If there were, Erlang could call it. I know how to get key codes in MS-DOS without involving a GUI. But everything else that I use, information about key codes is only available through some sort of GUI library. And it's not just a matter of different systems using different key codes; different keyboards may use different key codes. If the terminal in question is a separate physical terminal, perhaps connected through a serial port, then you are stuck with the inherently unreliable dodge of educated guesswork, just like ncurses. It wouldn't surprise me if Joe Armstrong were to explain that the right thing to do is to define a *protocol* between the guts of your program and the user interface part, and then make an informed decision about whether to implement the user interface part all in Erlang, or some in a C node or a driver or whatever. From ok@REDACTED Sun Mar 28 08:03:25 2010 From: ok@REDACTED (Richard O'Keefe) Date: Sun, 28 Mar 2010 19:03:25 +1300 Subject: [erlang-questions] The erlang baby and the green JVM In-Reply-To: <201003271953.07148.clist@uah.es> References: <201003271953.07148.clist@uah.es> Message-ID: <88B3ED0D-4276-41C6-B55D-2195AD9FD5F3@cs.otago.ac.nz> On Mar 28, 2010, at 7:53 AM, Angel wrote: > > Another piece of the erlang history?? > > http://functional-orbitz.blogspot.com/2010/03/how-much-has-scala-affected- > erlang.html Looks like April Fools' Day came early this year... From mazen.harake@REDACTED Sun Mar 28 11:31:49 2010 From: mazen.harake@REDACTED (Mazen Harake) Date: Sun, 28 Mar 2010 11:31:49 +0200 Subject: [erlang-questions] Reading (and ignoring) escape-sequences In-Reply-To: References: <4BA76862.3050609@erlang-solutions.com> <20100322234006.GA48453@k2r.org> <4BA88648.80809@erlang-solutions.com> <4BA9F34B.4010002@erlang-solutions.com> <80c550b91003252201g42429e59v4ed0ef20385b424c@mail.gmail.com> <4BAC9A21.3020409@erlang-solutions.com> <80c550b91003260911geec60beg271c33303dd666aa@mail.gmail.com> <4BAD102B.3060501@erlang-solutions.com> Message-ID: <4BAF2205.5070805@erlang-solutions.com> I get your point but you don't get mine. I _know_ that there is no way out of the unambiguity part of escape sequences but it can be made a _little easier for me (the developer)_ by letting Erlang guess for me. > And somehow Erlang is being slagged off for not making it easy, > when *no* language actually makes it easy? So in other words I should have said "easier". Hope this makes you less puzzled. "slagging off" Erlang is a bit of a far stretch I'd say but I do question things for the sake of discussions and improvements. > If the terminal in question is a separate physical terminal, > perhaps connected through a serial port, then you are stuck > with the inherently unreliable dodge of educated guesswork, > just like ncurses. I implemented it as a C driver using ncurses' educated guesswork instead of my own by creating some kind of sync-over-async-call to ncurses. Fair enough it isn't very difficult but if I could have called it in Erlang, e,g, io:getch() and Erlang would have returned "Ummm... I think it is UpArrow" it _still_ would have been easier wouldn't it? That is my only point; it could have been made "easier" to reach an educated guess by letting Erlang guess for me. --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From navaneethanit@REDACTED Sun Mar 28 15:34:41 2010 From: navaneethanit@REDACTED (NavaTux) Date: Sun, 28 Mar 2010 06:34:41 -0700 (PDT) Subject: Show the performance Message-ID: <9ad31154-2e6c-4eff-9af5-8871287c5794@t9g2000prh.googlegroups.com> Is it possible to measure the performance of my erlang web application with mysql ???Is it get improved when i compare to other language 's performance??? how to demonstrate the erlang performance in a great way??if you have any suggestion please share here... From ulf.wiger@REDACTED Sun Mar 28 17:25:14 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Sun, 28 Mar 2010 17:25:14 +0200 Subject: [erlang-questions] Sets, ordsets, gb_sets, sofs. What is going on? In-Reply-To: <3dbc6d1c1003260948w5885aac0s70fa315e54d13885@mail.gmail.com> References: <8b9ee55b1003251459s5f13e591kbf2da97519bb98d1@mail.gmail.com> <6672d0161003260331o5994abf4p5981600f502a299a@mail.gmail.com> <8b9ee55b1003260520u2cac2d1eh62ed04fe8db50554@mail.gmail.com> <3dbc6d1c1003260948w5885aac0s70fa315e54d13885@mail.gmail.com> Message-ID: <4BAF74DA.5050507@erlang-solutions.com> Robert Virding wrote: > > While ordsets is usually slower it does have one benefit in that it is > easy to read when printed which is definitely not the case for any > others. I often find that unless the set is big and the set operations > critical then the difference in speed is less noticeable than you > would expect. I once wrote a prototype extension of the pretty-printing in the shell, that allowed for custom formatting of 'ugly' data structures. http://ulf.wiger.net/weblog/2007/11/20/extending-the-erlang-shell-part-1/ With lots of flattery and bribes, I could perhaps become motivated to port it to the latest OTP*, or someone else could take it on; the code is available. BR, Ulf W * The issue is mainly time. This is on my list of things that would be fun to do someday, but that list is pretty long... -- Ulf Wiger CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd http://www.erlang-solutions.com --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From navaneethanit@REDACTED Sun Mar 28 18:37:02 2010 From: navaneethanit@REDACTED (NavaTux) Date: Sun, 28 Mar 2010 09:37:02 -0700 (PDT) Subject: database retrieve problem Message-ID: I wanna to use the query to retrieve some results from the database,so i used these lines event(continue) -> [Name] = wf:q(no_id), Message = wf:f("The Result is~p", [Name]), ConnString = "DSN=mysqldb", {ok, Conn} = odbc:connect(ConnString, []), [Results] = odbc:sql_query(Conn, "SELECT * FROM marks where id=1"), io:format("~p",[Results]), wf:flash([Results]), ok; event(_) -> ok. but i am unable to get the output,Here continue is the postback for button,here what goes wrong? I am getting output in my terminal is =INFO REPORT==== 28-Mar-2010::21:56:22 === ERROR: error {badmatch,{selected,["id","tamil","english","maths","science"], [{1,45,55,67,89}]}} [{web_index,event,1}, {wf_handle_postback,run_module_event,2}, {wf_handle_postback,handle_normal_request,3}, {wf_inets,do,3}, {httpd_response,traverse_modules,2}, {httpd_response,generate_and_send_response,1}, {httpd_request_handler,handle_response,1}, {gen_server,handle_msg,5}] id,tamil,english,maths,science are database fields.... please help me as well as i wanna know how to flash the output that i retrieved from the database in my webpage.. From bob@REDACTED Sun Mar 28 18:57:20 2010 From: bob@REDACTED (Bob Ippolito) Date: Sun, 28 Mar 2010 09:57:20 -0700 Subject: [erlang-questions] database retrieve problem In-Reply-To: References: Message-ID: <6a36e7291003280957y23fcf55es909975dcf635f85a@mail.gmail.com> Take a closer look at the documentation for odbc:sql_query/2 and what its expected return value is for a non-batched query. On Sun, Mar 28, 2010 at 9:37 AM, NavaTux wrote: > I wanna to use the query to retrieve some results from the database,so > i used these lines > > event(continue) -> > ? ? ? ?[Name] = wf:q(no_id), > ? ? ? ?Message = wf:f("The Result is~p", [Name]), > ? ? ? ?ConnString = "DSN=mysqldb", > ? ? ? ?{ok, Conn} = odbc:connect(ConnString, []), > ? ? ? ?[Results] = odbc:sql_query(Conn, "SELECT * FROM marks where id=1"), > ? ? ? ?io:format("~p",[Results]), > ? ? ? ?wf:flash([Results]), > ?ok; > event(_) -> ok. > > but i am unable to get the output,Here continue is the postback for > button,here what goes wrong? > > I am getting output in my terminal is > > > =INFO REPORT==== 28-Mar-2010::21:56:22 === > ERROR: error > {badmatch,{selected,["id","tamil","english","maths","science"], > ? ? ? ? ? ? ? ? ? ?[{1,45,55,67,89}]}} > [{web_index,event,1}, > ?{wf_handle_postback,run_module_event,2}, > ?{wf_handle_postback,handle_normal_request,3}, > ?{wf_inets,do,3}, > ?{httpd_response,traverse_modules,2}, > ?{httpd_response,generate_and_send_response,1}, > ?{httpd_request_handler,handle_response,1}, > ?{gen_server,handle_msg,5}] > > > id,tamil,english,maths,science are database fields.... > > please help me > as well as i wanna know how to flash the output that i retrieved from > the database in my webpage.. > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From hynek@REDACTED Sun Mar 28 18:58:35 2010 From: hynek@REDACTED (Hynek Vychodil) Date: Sun, 28 Mar 2010 09:58:35 -0700 Subject: [erlang-questions] database retrieve problem In-Reply-To: References: Message-ID: <4d08db371003280958q308a2845j3ec100ed92a22724@mail.gmail.com> When I look at your error message and code then I easily can guess, that badmatch is on row [Results] = odbc:sql_query(Conn, "SELECT * FROM marks where id=1") so I look at documentation and bingo! It is. I strongly recommend you try code in shell and look what code returns when you don't want read documentation. You should try it in shell even have read documentation. Above row should be {selected, _Cols, [Result]} = odbc:sql_query(Conn, "SELECT * FROM marks where id=1") or {selected, _Cols, Results} = odbc:sql_query(Conn, "SELECT * FROM marks where id=1") On Sun, Mar 28, 2010 at 9:37 AM, NavaTux wrote: > I wanna to use the query to retrieve some results from the database,so > i used these lines > > event(continue) -> > ? ? ? ?[Name] = wf:q(no_id), > ? ? ? ?Message = wf:f("The Result is~p", [Name]), > ? ? ? ?ConnString = "DSN=mysqldb", > ? ? ? ?{ok, Conn} = odbc:connect(ConnString, []), > ? ? ? ?[Results] = odbc:sql_query(Conn, "SELECT * FROM marks where id=1"), > ? ? ? ?io:format("~p",[Results]), > ? ? ? ?wf:flash([Results]), > ?ok; > event(_) -> ok. > > but i am unable to get the output,Here continue is the postback for > button,here what goes wrong? > > I am getting output in my terminal is > > > =INFO REPORT==== 28-Mar-2010::21:56:22 === > ERROR: error > {badmatch,{selected,["id","tamil","english","maths","science"], > ? ? ? ? ? ? ? ? ? ?[{1,45,55,67,89}]}} > [{web_index,event,1}, > ?{wf_handle_postback,run_module_event,2}, > ?{wf_handle_postback,handle_normal_request,3}, > ?{wf_inets,do,3}, > ?{httpd_response,traverse_modules,2}, > ?{httpd_response,generate_and_send_response,1}, > ?{httpd_request_handler,handle_response,1}, > ?{gen_server,handle_msg,5}] > > > id,tamil,english,maths,science are database fields.... > > please help me > as well as i wanna know how to flash the output that i retrieved from > the database in my webpage.. > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try GoodData now for free: www.gooddata.com From navaneethanit@REDACTED Sun Mar 28 19:33:11 2010 From: navaneethanit@REDACTED (NavaTux) Date: Sun, 28 Mar 2010 10:33:11 -0700 (PDT) Subject: database retrieve problem In-Reply-To: <4d08db371003280958q308a2845j3ec100ed92a22724@mail.gmail.com> References: <4d08db371003280958q308a2845j3ec100ed92a22724@mail.gmail.com> Message-ID: <4fe02992-538d-4dd7-bf3a-b309ff8ddc4a@k36g2000prb.googlegroups.com> ya..it displayes in shell,when i wanna to display in my web page i used to give wf:flash([Results]) it throws the error below, event(continue) -> [Name] = wf:q(no_id), Message = wf:f("The Result is~p", [Name]), ConnString = "DSN=mysqldb", {ok, Conn} = odbc:connect(ConnString, []), {selected, _Cols, [Results]} = odbc:sql_query(Conn, "SELECT * FROM marks where id=1"), io:format("~p",[Results]), wf:flash([Results]), ok; (nitrogen@REDACTED)15> {1,45,55,67,89}CAUGHT ERROR: error- {badrecord,elementbase} [{wf_render,render,1}, {wf_render,'-render/1-lc$^0/1-0-',1}, {element_panel,render,2}, {wf_render,render,1}, {wf_render,'-render/1-lc$^0/1-0-',1}, {wf_render,'-render/1-lc$^0/1-0-',1}, {element_panel,render,2}, {wf_render,render,1}] Here let me know what happened? On Mar 28, 9:58?pm, Hynek Vychodil wrote: > When I look at your error message and code then I easily can guess, > that badmatch is on row > > [Results] = odbc:sql_query(Conn, "SELECT * FROM marks where id=1") > > so I look at documentation and bingo! It is. I strongly recommend you > try code in shell and look what code returns when you don't want read > documentation. You should try it in shell even have read > documentation. Above row should be > > {selected, _Cols, [Result]} = odbc:sql_query(Conn, "SELECT * FROM > marks where id=1") > > or > > {selected, _Cols, Results} = odbc:sql_query(Conn, "SELECT * FROM marks > where id=1") > > > > On Sun, Mar 28, 2010 at 9:37 AM, NavaTux wrote: > > I wanna to use the query to retrieve some results from the database,so > > i used these lines > > > event(continue) -> > > ? ? ? ?[Name] = wf:q(no_id), > > ? ? ? ?Message = wf:f("The Result is~p", [Name]), > > ? ? ? ?ConnString = "DSN=mysqldb", > > ? ? ? ?{ok, Conn} = odbc:connect(ConnString, []), > > ? ? ? ?[Results] = odbc:sql_query(Conn, "SELECT * FROM marks where id=1"), > > ? ? ? ?io:format("~p",[Results]), > > ? ? ? ?wf:flash([Results]), > > ?ok; > > event(_) -> ok. > > > but i am unable to get the output,Here continue is the postback for > > button,here what goes wrong? > > > I am getting output in my terminal is > > > =INFO REPORT==== 28-Mar-2010::21:56:22 === > > ERROR: error > > {badmatch,{selected,["id","tamil","english","maths","science"], > > ? ? ? ? ? ? ? ? ? ?[{1,45,55,67,89}]}} > > [{web_index,event,1}, > > ?{wf_handle_postback,run_module_event,2}, > > ?{wf_handle_postback,handle_normal_request,3}, > > ?{wf_inets,do,3}, > > ?{httpd_response,traverse_modules,2}, > > ?{httpd_response,generate_and_send_response,1}, > > ?{httpd_request_handler,handle_response,1}, > > ?{gen_server,handle_msg,5}] > > > id,tamil,english,maths,science are database fields.... > > > please help me > > as well as i wanna know how to flash the output that i retrieved from > > the database in my webpage.. > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > Seehttp://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > -- > --Hynek (Pichi) Vychodil > > Analyze your data in minutes. Share your insights instantly. Thrill > your boss. ?Be a data hero! > Try GoodData now for free:www.gooddata.com > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > Seehttp://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED From steven.charles.davis@REDACTED Sun Mar 28 20:44:17 2010 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sun, 28 Mar 2010 11:44:17 -0700 (PDT) Subject: Show the performance In-Reply-To: <9ad31154-2e6c-4eff-9af5-8871287c5794@t9g2000prh.googlegroups.com> References: <9ad31154-2e6c-4eff-9af5-8871287c5794@t9g2000prh.googlegroups.com> Message-ID: <64e826ca-67cf-4b77-b02a-849fc7f9c251@u22g2000yqf.googlegroups.com> Hello Nava, Since it's all HTTP, I guess you can just point the same client load agent that you used to test your original web app implementation at the erlang instance. If you want to profile the application, you'll need to do some reading at: http://erlang.org/doc/man/fprof.html Steve On Mar 28, 8:34?am, NavaTux wrote: > Is it possible to measure the performance of my erlang web application > with mysql ???Is it get improved when i compare to other language 's > performance??? > how to demonstrate the erlang performance in a great way??if you have > any suggestion please share here... > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > Seehttp://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED From hynek@REDACTED Sun Mar 28 20:53:05 2010 From: hynek@REDACTED (Hynek Vychodil) Date: Sun, 28 Mar 2010 11:53:05 -0700 Subject: [erlang-questions] Re: database retrieve problem In-Reply-To: <4fe02992-538d-4dd7-bf3a-b309ff8ddc4a@k36g2000prb.googlegroups.com> References: <4d08db371003280958q308a2845j3ec100ed92a22724@mail.gmail.com> <4fe02992-538d-4dd7-bf3a-b309ff8ddc4a@k36g2000prb.googlegroups.com> Message-ID: <4d08db371003281153h1f1a71a7v1f8ee4ebdbe89568@mail.gmail.com> There is raised {badrecord,elementbase} exception in wf_render:render/1 function. Just guess, should not event/1 return some record? wf:flash/1 parameter should be some sort of record? Something other expecting record where wf:flash/1 parameter is passed to? I don't know, look at documentation and if it doesn't there, blame author. I'm just curious, why you consistently write [Results] when there one result row will be binded to Results variable? On Sun, Mar 28, 2010 at 10:33 AM, NavaTux wrote: > ya..it displayes in shell,when i wanna to display in my web page i > used to give wf:flash([Results]) it throws the error below, > > event(continue) -> > ? ? ? ?[Name] = wf:q(no_id), > ? ? ? ?Message = wf:f("The Result is~p", [Name]), > ? ? ? ?ConnString = "DSN=mysqldb", > ? ? ? ?{ok, Conn} = odbc:connect(ConnString, []), > ? ? ? ?{selected, _Cols, [Results]} = odbc:sql_query(Conn, "SELECT * FROM > marks where id=1"), > ? ? ? ?io:format("~p",[Results]), > ? ? ? ?wf:flash([Results]), > ?ok; > > > (nitrogen@REDACTED)15> {1,45,55,67,89}CAUGHT ERROR: error- > {badrecord,elementbase} > [{wf_render,render,1}, > ?{wf_render,'-render/1-lc$^0/1-0-',1}, > ?{element_panel,render,2}, > ?{wf_render,render,1}, > ?{wf_render,'-render/1-lc$^0/1-0-',1}, > ?{wf_render,'-render/1-lc$^0/1-0-',1}, > ?{element_panel,render,2}, > ?{wf_render,render,1}] > > Here let me know what happened? > > > On Mar 28, 9:58?pm, Hynek Vychodil wrote: >> When I look at your error message and code then I easily can guess, >> that badmatch is on row >> >> [Results] = odbc:sql_query(Conn, "SELECT * FROM marks where id=1") >> >> so I look at documentation and bingo! It is. I strongly recommend you >> try code in shell and look what code returns when you don't want read >> documentation. You should try it in shell even have read >> documentation. Above row should be >> >> {selected, _Cols, [Result]} = odbc:sql_query(Conn, "SELECT * FROM >> marks where id=1") >> >> or >> >> {selected, _Cols, Results} = odbc:sql_query(Conn, "SELECT * FROM marks >> where id=1") >> >> >> >> On Sun, Mar 28, 2010 at 9:37 AM, NavaTux wrote: >> > I wanna to use the query to retrieve some results from the database,so >> > i used these lines >> >> > event(continue) -> >> > ? ? ? ?[Name] = wf:q(no_id), >> > ? ? ? ?Message = wf:f("The Result is~p", [Name]), >> > ? ? ? ?ConnString = "DSN=mysqldb", >> > ? ? ? ?{ok, Conn} = odbc:connect(ConnString, []), >> > ? ? ? ?[Results] = odbc:sql_query(Conn, "SELECT * FROM marks where id=1"), >> > ? ? ? ?io:format("~p",[Results]), >> > ? ? ? ?wf:flash([Results]), >> > ?ok; >> > event(_) -> ok. >> >> > but i am unable to get the output,Here continue is the postback for >> > button,here what goes wrong? >> >> > I am getting output in my terminal is >> >> > =INFO REPORT==== 28-Mar-2010::21:56:22 === >> > ERROR: error >> > {badmatch,{selected,["id","tamil","english","maths","science"], >> > ? ? ? ? ? ? ? ? ? ?[{1,45,55,67,89}]}} >> > [{web_index,event,1}, >> > ?{wf_handle_postback,run_module_event,2}, >> > ?{wf_handle_postback,handle_normal_request,3}, >> > ?{wf_inets,do,3}, >> > ?{httpd_response,traverse_modules,2}, >> > ?{httpd_response,generate_and_send_response,1}, >> > ?{httpd_request_handler,handle_response,1}, >> > ?{gen_server,handle_msg,5}] >> >> > id,tamil,english,maths,science are database fields.... >> >> > please help me >> > as well as i wanna know how to flash the output that i retrieved from >> > the database in my webpage.. >> >> > ________________________________________________________________ >> > erlang-questions (at) erlang.org mailing list. >> > Seehttp://www.erlang.org/faq.html >> > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED >> >> -- >> --Hynek (Pichi) Vychodil >> >> Analyze your data in minutes. Share your insights instantly. Thrill >> your boss. ?Be a data hero! >> Try GoodData now for free:www.gooddata.com >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> Seehttp://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try GoodData now for free: www.gooddata.com From navaneethanit@REDACTED Sun Mar 28 21:15:19 2010 From: navaneethanit@REDACTED (NavaTux) Date: Sun, 28 Mar 2010 12:15:19 -0700 (PDT) Subject: database retrieve problem In-Reply-To: <4d08db371003281153h1f1a71a7v1f8ee4ebdbe89568@mail.gmail.com> References: <4d08db371003280958q308a2845j3ec100ed92a22724@mail.gmail.com> <4fe02992-538d-4dd7-bf3a-b309ff8ddc4a@k36g2000prb.googlegroups.com> <4d08db371003281153h1f1a71a7v1f8ee4ebdbe89568@mail.gmail.com> Message-ID: may i know what i need use instead of using [Results] variable, (nitrogen@REDACTED)28> {1,45,55,67,89} //whole row displaying yes if i use the variable [Results] meant i am getting the full row,but i wanna display a field by field for that what i have to declare please explain friend let me know how to fetch the results from shell to my webpage On Mar 28, 11:53?pm, Hynek Vychodil wrote: > There is raised {badrecord,elementbase} exception in > wf_render:render/1 function. Just guess, should not event/1 return > some record? wf:flash/1 parameter should be some sort of record? > Something other expecting record where wf:flash/1 parameter is passed > to? I don't know, look at documentation and if it doesn't there, blame > author. > > I'm just curious, why you consistently write [Results] when there one > result row will be binded to Results variable? > > > > On Sun, Mar 28, 2010 at 10:33 AM, NavaTux wrote: > > ya..it displayes in shell,when i wanna to display in my web page i > > used to give wf:flash([Results]) it throws the error below, > > > event(continue) -> > > ? ? ? ?[Name] = wf:q(no_id), > > ? ? ? ?Message = wf:f("The Result is~p", [Name]), > > ? ? ? ?ConnString = "DSN=mysqldb", > > ? ? ? ?{ok, Conn} = odbc:connect(ConnString, []), > > ? ? ? ?{selected, _Cols, [Results]} = odbc:sql_query(Conn, "SELECT * FROM > > marks where id=1"), > > ? ? ? ?io:format("~p",[Results]), > > ? ? ? ?wf:flash([Results]), > > ?ok; > > > (nitrogen@REDACTED)15> {1,45,55,67,89}CAUGHT ERROR: error- > > {badrecord,elementbase} > > [{wf_render,render,1}, > > ?{wf_render,'-render/1-lc$^0/1-0-',1}, > > ?{element_panel,render,2}, > > ?{wf_render,render,1}, > > ?{wf_render,'-render/1-lc$^0/1-0-',1}, > > ?{wf_render,'-render/1-lc$^0/1-0-',1}, > > ?{element_panel,render,2}, > > ?{wf_render,render,1}] > > > Here let me know what happened? > > > On Mar 28, 9:58?pm, Hynek Vychodil wrote: > >> When I look at your error message and code then I easily can guess, > >> that badmatch is on row > > >> [Results] = odbc:sql_query(Conn, "SELECT * FROM marks where id=1") > > >> so I look at documentation and bingo! It is. I strongly recommend you > >> try code in shell and look what code returns when you don't want read > >> documentation. You should try it in shell even have read > >> documentation. Above row should be > > >> {selected, _Cols, [Result]} = odbc:sql_query(Conn, "SELECT * FROM > >> marks where id=1") > > >> or > > >> {selected, _Cols, Results} = odbc:sql_query(Conn, "SELECT * FROM marks > >> where id=1") > > >> On Sun, Mar 28, 2010 at 9:37 AM, NavaTux wrote: > >> > I wanna to use the query to retrieve some results from the database,so > >> > i used these lines > > >> > event(continue) -> > >> > ? ? ? ?[Name] = wf:q(no_id), > >> > ? ? ? ?Message = wf:f("The Result is~p", [Name]), > >> > ? ? ? ?ConnString = "DSN=mysqldb", > >> > ? ? ? ?{ok, Conn} = odbc:connect(ConnString, []), > >> > ? ? ? ?[Results] = odbc:sql_query(Conn, "SELECT * FROM marks where id=1"), > >> > ? ? ? ?io:format("~p",[Results]), > >> > ? ? ? ?wf:flash([Results]), > >> > ?ok; > >> > event(_) -> ok. > > >> > but i am unable to get the output,Here continue is the postback for > >> > button,here what goes wrong? > > >> > I am getting output in my terminal is > > >> > =INFO REPORT==== 28-Mar-2010::21:56:22 === > >> > ERROR: error > >> > {badmatch,{selected,["id","tamil","english","maths","science"], > >> > ? ? ? ? ? ? ? ? ? ?[{1,45,55,67,89}]}} > >> > [{web_index,event,1}, > >> > ?{wf_handle_postback,run_module_event,2}, > >> > ?{wf_handle_postback,handle_normal_request,3}, > >> > ?{wf_inets,do,3}, > >> > ?{httpd_response,traverse_modules,2}, > >> > ?{httpd_response,generate_and_send_response,1}, > >> > ?{httpd_request_handler,handle_response,1}, > >> > ?{gen_server,handle_msg,5}] > > >> > id,tamil,english,maths,science are database fields.... > > >> > please help me > >> > as well as i wanna know how to flash the output that i retrieved from > >> > the database in my webpage.. > > >> > ________________________________________________________________ > >> > erlang-questions (at) erlang.org mailing list. > >> > Seehttp://www.erlang.org/faq.html > >> > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > >> -- > >> --Hynek (Pichi) Vychodil > > >> Analyze your data in minutes. Share your insights instantly. Thrill > >> your boss. ?Be a data hero! > >> Try GoodData now for free:www.gooddata.com > > >> ________________________________________________________________ > >> erlang-questions (at) erlang.org mailing list. > >> Seehttp://www.erlang.org/faq.html > >> To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > Seehttp://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > -- > --Hynek (Pichi) Vychodil > > Analyze your data in minutes. Share your insights instantly. Thrill > your boss. ?Be a data hero! > Try GoodData now for free:www.gooddata.com > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > Seehttp://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED From ryanhuffman@REDACTED Sun Mar 28 21:23:39 2010 From: ryanhuffman@REDACTED (Ryan Huffman) Date: Sun, 28 Mar 2010 12:23:39 -0700 Subject: [erlang-questions] Re: database retrieve problem In-Reply-To: References: <4d08db371003280958q308a2845j3ec100ed92a22724@mail.gmail.com> <4fe02992-538d-4dd7-bf3a-b309ff8ddc4a@k36g2000prb.googlegroups.com> <4d08db371003281153h1f1a71a7v1f8ee4ebdbe89568@mail.gmail.com> Message-ID: <4fe6072a1003281223x54ec8211yef3d7ba05251ff68@mail.gmail.com> As far as I can tell, wf:flash() is expecting a valid nitrogen element, but it isn't finding one. You need to convert the Results tuple into a string before passing it into wf:flash(). Ryan On Sun, Mar 28, 2010 at 12:15 PM, NavaTux wrote: > may i know what i need use instead of using [Results] variable, > > (nitrogen@REDACTED)28> {1,45,55,67,89} //whole row > displaying > > yes if i use the variable [Results] meant i am getting the full > row,but i wanna display a field by field for that what i have to > declare > > please explain friend > > let me know how to fetch the results from shell to my webpage > > On Mar 28, 11:53 pm, Hynek Vychodil wrote: > > There is raised {badrecord,elementbase} exception in > > wf_render:render/1 function. Just guess, should not event/1 return > > some record? wf:flash/1 parameter should be some sort of record? > > Something other expecting record where wf:flash/1 parameter is passed > > to? I don't know, look at documentation and if it doesn't there, blame > > author. > > > > I'm just curious, why you consistently write [Results] when there one > > result row will be binded to Results variable? > > > > > > > > On Sun, Mar 28, 2010 at 10:33 AM, NavaTux > wrote: > > > ya..it displayes in shell,when i wanna to display in my web page i > > > used to give wf:flash([Results]) it throws the error below, > > > > > event(continue) -> > > > [Name] = wf:q(no_id), > > > Message = wf:f("The Result is~p", [Name]), > > > ConnString = "DSN=mysqldb", > > > {ok, Conn} = odbc:connect(ConnString, []), > > > {selected, _Cols, [Results]} = odbc:sql_query(Conn, "SELECT * > FROM > > > marks where id=1"), > > > io:format("~p",[Results]), > > > wf:flash([Results]), > > > ok; > > > > > (nitrogen@REDACTED)15> {1,45,55,67,89}CAUGHT ERROR: error- > > > {badrecord,elementbase} > > > [{wf_render,render,1}, > > > {wf_render,'-render/1-lc$^0/1-0-',1}, > > > {element_panel,render,2}, > > > {wf_render,render,1}, > > > {wf_render,'-render/1-lc$^0/1-0-',1}, > > > {wf_render,'-render/1-lc$^0/1-0-',1}, > > > {element_panel,render,2}, > > > {wf_render,render,1}] > > > > > Here let me know what happened? > > > > > On Mar 28, 9:58 pm, Hynek Vychodil wrote: > > >> When I look at your error message and code then I easily can guess, > > >> that badmatch is on row > > > > >> [Results] = odbc:sql_query(Conn, "SELECT * FROM marks where id=1") > > > > >> so I look at documentation and bingo! It is. I strongly recommend you > > >> try code in shell and look what code returns when you don't want read > > >> documentation. You should try it in shell even have read > > >> documentation. Above row should be > > > > >> {selected, _Cols, [Result]} = odbc:sql_query(Conn, "SELECT * FROM > > >> marks where id=1") > > > > >> or > > > > >> {selected, _Cols, Results} = odbc:sql_query(Conn, "SELECT * FROM marks > > >> where id=1") > > > > >> On Sun, Mar 28, 2010 at 9:37 AM, NavaTux > wrote: > > >> > I wanna to use the query to retrieve some results from the > database,so > > >> > i used these lines > > > > >> > event(continue) -> > > >> > [Name] = wf:q(no_id), > > >> > Message = wf:f("The Result is~p", [Name]), > > >> > ConnString = "DSN=mysqldb", > > >> > {ok, Conn} = odbc:connect(ConnString, []), > > >> > [Results] = odbc:sql_query(Conn, "SELECT * FROM marks where > id=1"), > > >> > io:format("~p",[Results]), > > >> > wf:flash([Results]), > > >> > ok; > > >> > event(_) -> ok. > > > > >> > but i am unable to get the output,Here continue is the postback for > > >> > button,here what goes wrong? > > > > >> > I am getting output in my terminal is > > > > >> > =INFO REPORT==== 28-Mar-2010::21:56:22 === > > >> > ERROR: error > > >> > {badmatch,{selected,["id","tamil","english","maths","science"], > > >> > [{1,45,55,67,89}]}} > > >> > [{web_index,event,1}, > > >> > {wf_handle_postback,run_module_event,2}, > > >> > {wf_handle_postback,handle_normal_request,3}, > > >> > {wf_inets,do,3}, > > >> > {httpd_response,traverse_modules,2}, > > >> > {httpd_response,generate_and_send_response,1}, > > >> > {httpd_request_handler,handle_response,1}, > > >> > {gen_server,handle_msg,5}] > > > > >> > id,tamil,english,maths,science are database fields.... > > > > >> > please help me > > >> > as well as i wanna know how to flash the output that i retrieved > from > > >> > the database in my webpage.. > > > > >> > ________________________________________________________________ > > >> > erlang-questions (at) erlang.org mailing list. > > >> > Seehttp://www.erlang.org/faq.html > > >> > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > > > >> -- > > >> --Hynek (Pichi) Vychodil > > > > >> Analyze your data in minutes. Share your insights instantly. Thrill > > >> your boss. Be a data hero! > > >> Try GoodData now for free:www.gooddata.com > > > > >> ________________________________________________________________ > > >> erlang-questions (at) erlang.org mailing list. > > >> Seehttp://www.erlang.org/faq.html > > >> To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > > > > ________________________________________________________________ > > > erlang-questions (at) erlang.org mailing list. > > > Seehttp://www.erlang.org/faq.html > > > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > > > -- > > --Hynek (Pichi) Vychodil > > > > Analyze your data in minutes. Share your insights instantly. Thrill > > your boss. Be a data hero! > > Try GoodData now for free:www.gooddata.com > > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > Seehttp://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From hynek@REDACTED Sun Mar 28 21:40:59 2010 From: hynek@REDACTED (Hynek Vychodil) Date: Sun, 28 Mar 2010 12:40:59 -0700 Subject: [erlang-questions] Re: database retrieve problem In-Reply-To: References: <4d08db371003280958q308a2845j3ec100ed92a22724@mail.gmail.com> <4fe02992-538d-4dd7-bf3a-b309ff8ddc4a@k36g2000prb.googlegroups.com> <4d08db371003281153h1f1a71a7v1f8ee4ebdbe89568@mail.gmail.com> Message-ID: <4d08db371003281240o3dba3ba8n7df180d76743cdab@mail.gmail.com> When I get one result, I'm used to write [Result] or [Row] just to not confuse reader. If I know what is there I write [{Id,Tamil,English,Maths,Science} = Row]. If I want split tuple I write Values = tuple_to_list(Row). Readability of code is one of valuable characteristic of code. On Sun, Mar 28, 2010 at 12:15 PM, NavaTux wrote: > may i know what i need use instead of using [Results] variable, > > (nitrogen@REDACTED)28> {1,45,55,67,89} ? ? ? ? ? ? ? ? //whole row > displaying > > yes if i use the variable [Results] meant i am getting the full > row,but i wanna display a field by field for that what i have to > declare > > please explain friend > > let me know how to fetch the results from shell to my webpage > > On Mar 28, 11:53?pm, Hynek Vychodil wrote: >> There is raised {badrecord,elementbase} exception in >> wf_render:render/1 function. Just guess, should not event/1 return >> some record? wf:flash/1 parameter should be some sort of record? >> Something other expecting record where wf:flash/1 parameter is passed >> to? I don't know, look at documentation and if it doesn't there, blame >> author. >> >> I'm just curious, why you consistently write [Results] when there one >> result row will be binded to Results variable? >> >> >> >> On Sun, Mar 28, 2010 at 10:33 AM, NavaTux wrote: >> > ya..it displayes in shell,when i wanna to display in my web page i >> > used to give wf:flash([Results]) it throws the error below, >> >> > event(continue) -> >> > ? ? ? ?[Name] = wf:q(no_id), >> > ? ? ? ?Message = wf:f("The Result is~p", [Name]), >> > ? ? ? ?ConnString = "DSN=mysqldb", >> > ? ? ? ?{ok, Conn} = odbc:connect(ConnString, []), >> > ? ? ? ?{selected, _Cols, [Results]} = odbc:sql_query(Conn, "SELECT * FROM >> > marks where id=1"), >> > ? ? ? ?io:format("~p",[Results]), >> > ? ? ? ?wf:flash([Results]), >> > ?ok; >> >> > (nitrogen@REDACTED)15> {1,45,55,67,89}CAUGHT ERROR: error- >> > {badrecord,elementbase} >> > [{wf_render,render,1}, >> > ?{wf_render,'-render/1-lc$^0/1-0-',1}, >> > ?{element_panel,render,2}, >> > ?{wf_render,render,1}, >> > ?{wf_render,'-render/1-lc$^0/1-0-',1}, >> > ?{wf_render,'-render/1-lc$^0/1-0-',1}, >> > ?{element_panel,render,2}, >> > ?{wf_render,render,1}] >> >> > Here let me know what happened? >> >> > On Mar 28, 9:58?pm, Hynek Vychodil wrote: >> >> When I look at your error message and code then I easily can guess, >> >> that badmatch is on row >> >> >> [Results] = odbc:sql_query(Conn, "SELECT * FROM marks where id=1") >> >> >> so I look at documentation and bingo! It is. I strongly recommend you >> >> try code in shell and look what code returns when you don't want read >> >> documentation. You should try it in shell even have read >> >> documentation. Above row should be >> >> >> {selected, _Cols, [Result]} = odbc:sql_query(Conn, "SELECT * FROM >> >> marks where id=1") >> >> >> or >> >> >> {selected, _Cols, Results} = odbc:sql_query(Conn, "SELECT * FROM marks >> >> where id=1") >> >> >> On Sun, Mar 28, 2010 at 9:37 AM, NavaTux wrote: >> >> > I wanna to use the query to retrieve some results from the database,so >> >> > i used these lines >> >> >> > event(continue) -> >> >> > ? ? ? ?[Name] = wf:q(no_id), >> >> > ? ? ? ?Message = wf:f("The Result is~p", [Name]), >> >> > ? ? ? ?ConnString = "DSN=mysqldb", >> >> > ? ? ? ?{ok, Conn} = odbc:connect(ConnString, []), >> >> > ? ? ? ?[Results] = odbc:sql_query(Conn, "SELECT * FROM marks where id=1"), >> >> > ? ? ? ?io:format("~p",[Results]), >> >> > ? ? ? ?wf:flash([Results]), >> >> > ?ok; >> >> > event(_) -> ok. >> >> >> > but i am unable to get the output,Here continue is the postback for >> >> > button,here what goes wrong? >> >> >> > I am getting output in my terminal is >> >> >> > =INFO REPORT==== 28-Mar-2010::21:56:22 === >> >> > ERROR: error >> >> > {badmatch,{selected,["id","tamil","english","maths","science"], >> >> > ? ? ? ? ? ? ? ? ? ?[{1,45,55,67,89}]}} >> >> > [{web_index,event,1}, >> >> > ?{wf_handle_postback,run_module_event,2}, >> >> > ?{wf_handle_postback,handle_normal_request,3}, >> >> > ?{wf_inets,do,3}, >> >> > ?{httpd_response,traverse_modules,2}, >> >> > ?{httpd_response,generate_and_send_response,1}, >> >> > ?{httpd_request_handler,handle_response,1}, >> >> > ?{gen_server,handle_msg,5}] >> >> >> > id,tamil,english,maths,science are database fields.... >> >> >> > please help me >> >> > as well as i wanna know how to flash the output that i retrieved from >> >> > the database in my webpage.. >> >> >> > ________________________________________________________________ >> >> > erlang-questions (at) erlang.org mailing list. >> >> > Seehttp://www.erlang.org/faq.html >> >> > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED >> >> >> -- >> >> --Hynek (Pichi) Vychodil >> >> >> Analyze your data in minutes. Share your insights instantly. Thrill >> >> your boss. ?Be a data hero! >> >> Try GoodData now for free:www.gooddata.com >> >> >> ________________________________________________________________ >> >> erlang-questions (at) erlang.org mailing list. >> >> Seehttp://www.erlang.org/faq.html >> >> To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED >> >> > ________________________________________________________________ >> > erlang-questions (at) erlang.org mailing list. >> > Seehttp://www.erlang.org/faq.html >> > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED >> >> -- >> --Hynek (Pichi) Vychodil >> >> Analyze your data in minutes. Share your insights instantly. Thrill >> your boss. ?Be a data hero! >> Try GoodData now for free:www.gooddata.com >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> Seehttp://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try GoodData now for free: www.gooddata.com From navaneethanit@REDACTED Sun Mar 28 22:25:01 2010 From: navaneethanit@REDACTED (NavaTux) Date: Sun, 28 Mar 2010 13:25:01 -0700 (PDT) Subject: database retrieve problem In-Reply-To: <4fe6072a1003281223x54ec8211yef3d7ba05251ff68@mail.gmail.com> References: <4d08db371003280958q308a2845j3ec100ed92a22724@mail.gmail.com> <4fe02992-538d-4dd7-bf3a-b309ff8ddc4a@k36g2000prb.googlegroups.com> <4d08db371003281153h1f1a71a7v1f8ee4ebdbe89568@mail.gmail.com> <4fe6072a1003281223x54ec8211yef3d7ba05251ff68@mail.gmail.com> Message-ID: <90ef31f1-d6aa-44de-b1c9-b1aa19650f2d@k5g2000pra.googlegroups.com> here [Result]=[{23,_,_,56}]. // grouply displaying a full row by the variable how to seperate each field by a seperate variable that need to be printed in shell On Mar 29, 12:23?am, Ryan Huffman wrote: > As far as I can tell, wf:flash() is expecting a valid nitrogen element, but > it isn't finding one. ?You need to convert the Results tuple into a string > before passing it into wf:flash(). > > Ryan > > On Sun, Mar 28, 2010 at 12:15 PM, NavaTux wrote: > > may i know what i need use instead of using [Results] variable, > > > (nitrogen@REDACTED)28> {1,45,55,67,89} ? ? ? ? ? ? ? ? //whole row > > displaying > > > yes if i use the variable [Results] meant i am getting the full > > row,but i wanna display a field by field for that what i have to > > declare > > > please explain friend > > > let me know how to fetch the results from shell to my webpage > > > On Mar 28, 11:53 pm, Hynek Vychodil wrote: > > > There is raised {badrecord,elementbase} exception in > > > wf_render:render/1 function. Just guess, should not event/1 return > > > some record? wf:flash/1 parameter should be some sort of record? > > > Something other expecting record where wf:flash/1 parameter is passed > > > to? I don't know, look at documentation and if it doesn't there, blame > > > author. > > > > I'm just curious, why you consistently write [Results] when there one > > > result row will be binded to Results variable? > > > > On Sun, Mar 28, 2010 at 10:33 AM, NavaTux > > wrote: > > > > ya..it displayes in shell,when i wanna to display in my web page i > > > > used to give wf:flash([Results]) it throws the error below, > > > > > event(continue) -> > > > > ? ? ? ?[Name] = wf:q(no_id), > > > > ? ? ? ?Message = wf:f("The Result is~p", [Name]), > > > > ? ? ? ?ConnString = "DSN=mysqldb", > > > > ? ? ? ?{ok, Conn} = odbc:connect(ConnString, []), > > > > ? ? ? ?{selected, _Cols, [Results]} = odbc:sql_query(Conn, "SELECT * > > FROM > > > > marks where id=1"), > > > > ? ? ? ?io:format("~p",[Results]), > > > > ? ? ? ?wf:flash([Results]), > > > > ?ok; > > > > > (nitrogen@REDACTED)15> {1,45,55,67,89}CAUGHT ERROR: error- > > > > {badrecord,elementbase} > > > > [{wf_render,render,1}, > > > > ?{wf_render,'-render/1-lc$^0/1-0-',1}, > > > > ?{element_panel,render,2}, > > > > ?{wf_render,render,1}, > > > > ?{wf_render,'-render/1-lc$^0/1-0-',1}, > > > > ?{wf_render,'-render/1-lc$^0/1-0-',1}, > > > > ?{element_panel,render,2}, > > > > ?{wf_render,render,1}] > > > > > Here let me know what happened? > > > > > On Mar 28, 9:58 pm, Hynek Vychodil wrote: > > > >> When I look at your error message and code then I easily can guess, > > > >> that badmatch is on row > > > > >> [Results] = odbc:sql_query(Conn, "SELECT * FROM marks where id=1") > > > > >> so I look at documentation and bingo! It is. I strongly recommend you > > > >> try code in shell and look what code returns when you don't want read > > > >> documentation. You should try it in shell even have read > > > >> documentation. Above row should be > > > > >> {selected, _Cols, [Result]} = odbc:sql_query(Conn, "SELECT * FROM > > > >> marks where id=1") > > > > >> or > > > > >> {selected, _Cols, Results} = odbc:sql_query(Conn, "SELECT * FROM marks > > > >> where id=1") > > > > >> On Sun, Mar 28, 2010 at 9:37 AM, NavaTux > > wrote: > > > >> > I wanna to use the query to retrieve some results from the > > database,so > > > >> > i used these lines > > > > >> > event(continue) -> > > > >> > ? ? ? ?[Name] = wf:q(no_id), > > > >> > ? ? ? ?Message = wf:f("The Result is~p", [Name]), > > > >> > ? ? ? ?ConnString = "DSN=mysqldb", > > > >> > ? ? ? ?{ok, Conn} = odbc:connect(ConnString, []), > > > >> > ? ? ? ?[Results] = odbc:sql_query(Conn, "SELECT * FROM marks where > > id=1"), > > > >> > ? ? ? ?io:format("~p",[Results]), > > > >> > ? ? ? ?wf:flash([Results]), > > > >> > ?ok; > > > >> > event(_) -> ok. > > > > >> > but i am unable to get the output,Here continue is the postback for > > > >> > button,here what goes wrong? > > > > >> > I am getting output in my terminal is > > > > >> > =INFO REPORT==== 28-Mar-2010::21:56:22 === > > > >> > ERROR: error > > > >> > {badmatch,{selected,["id","tamil","english","maths","science"], > > > >> > ? ? ? ? ? ? ? ? ? ?[{1,45,55,67,89}]}} > > > >> > [{web_index,event,1}, > > > >> > ?{wf_handle_postback,run_module_event,2}, > > > >> > ?{wf_handle_postback,handle_normal_request,3}, > > > >> > ?{wf_inets,do,3}, > > > >> > ?{httpd_response,traverse_modules,2}, > > > >> > ?{httpd_response,generate_and_send_response,1}, > > > >> > ?{httpd_request_handler,handle_response,1}, > > > >> > ?{gen_server,handle_msg,5}] > > > > >> > id,tamil,english,maths,science are database fields.... > > > > >> > please help me > > > >> > as well as i wanna know how to flash the output that i retrieved > > from > > > >> > the database in my webpage.. > > > > >> > ________________________________________________________________ > > > >> > erlang-questions (at) erlang.org mailing list. > > > >> > Seehttp://www.erlang.org/faq.html > > > >> > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > > > >> -- > > > >> --Hynek (Pichi) Vychodil > > > > >> Analyze your data in minutes. Share your insights instantly. Thrill > > > >> your boss. ?Be a data hero! > > > >> Try GoodData now for free:www.gooddata.com > > > > >> ________________________________________________________________ > > > >> erlang-questions (at) erlang.org mailing list. > > > >> Seehttp://www.erlang.org/faq.html > > > >> To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > > > > ________________________________________________________________ > > > > erlang-questions (at) erlang.org mailing list. > > > > Seehttp://www.erlang.org/faq.html > > > > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > > > -- > > > --Hynek (Pichi) Vychodil > > > > Analyze your data in minutes. Share your insights instantly. Thrill > > > your boss. ?Be a data hero! > > > Try GoodData now for free:www.gooddata.com > > > > ________________________________________________________________ > > > erlang-questions (at) erlang.org mailing list. > > > Seehttp://www.erlang.org/faq.html > > > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > Seehttp://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > From jerome@REDACTED Mon Mar 29 00:25:18 2010 From: jerome@REDACTED (=?UTF-8?B?SsOpcsO0bWUgRGVzcXVpbGJldA==?=) Date: Mon, 29 Mar 2010 00:25:18 +0200 Subject: [erlang-questions] Building R13B04 on OpenBSD 4.6 In-Reply-To: References: Message-ID: <4BAFD74E.1050604@desquilbet.org> I didn't have problems. But before compiling from sources I installed the erlang package. Here's what I did (I wrote it somewhere, here's a copy): pkg_add wget pkg_add erlang pkg_add gcc-4.2.4p2 pkg_add gmake mkdir /usr/tools cd /usr/tools mkdir erlang cd erlang wget http://www.erlang.org/download/otp_src_R13B04.tar.gz tar zxf otp_src_R13B04.tar.gz mkdir otp_R13B04 cd otp_src_R13B04 ./configure --help ./configure --prefix=/usr/tools/erlang/otp_R13B04 --with-ssl gmake gmake install Good luck, J?r?me. David N Murray a ?crit : > Hi, > > I'm trying to build R13B04 on OpenBSD 4.6. I ran into a similar problem > when I built Gambit Scheme on this box a while back: > > checking sys/sysctl.h usability... no > checking sys/sysctl.h presence... yes > configure: WARNING: sys/sysctl.h: present but cannot be compiled > configure: WARNING: sys/sysctl.h: check for missing prerequisite > headers? > configure: WARNING: sys/sysctl.h: see the Autoconf documentation > configure: WARNING: sys/sysctl.h: section "Present But Cannot Be > Compiled" > configure: WARNING: sys/sysctl.h: proceeding with the preprocessor's > result > configure: WARNING: sys/sysctl.h: in the future, the compiler will take > precedence > configure: WARNING: ## ------------------------------------------ ## > configure: WARNING: ## Report this to the AC_PACKAGE_NAME lists. ## > configure: WARNING: ## ------------------------------------------ ## > checking for sys/sysctl.h... yes > > I generated a fix for Gambit, but I'm not sure how to apply it to Erlang > (there's no configure.ac): > > --- configure.ac.~1~ Thu Jan 7 14:58:50 2010 > +++ configure.ac Sat Jan 30 15:32:36 2010 > @@ -622,7 +622,21 @@ > AC_CHECK_HEADERS(sys/socket.h) > AC_CHECK_HEADERS(strings.h) > AC_CHECK_HEADERS(memory.h) > - AC_CHECK_HEADERS(sys/sysctl.h) > + case "$target_os" in > + > + openbsd*) # needs param.h > + AC_CHECK_HEADERS(sys/param.h) > + AC_CHECK_HEADERS(sys/sysctl.h,,, > +[#ifdef HAVE_PARAM_H > +# include > +#endif > +]) > + ;; > + > + *) > + AC_CHECK_HEADERS(sys/sysctl.h) > + ;; > + esac > > if test "$C_COMP_VISUALC" != yes; then > > I haven't tried to 'make' yet. I'm not sure if sys/sysctl.h is really > required or can be worked around. > > Thoughts? > > TIA, > Dave > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From steven.charles.davis@REDACTED Mon Mar 29 02:07:49 2010 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sun, 28 Mar 2010 17:07:49 -0700 (PDT) Subject: database retrieve problem In-Reply-To: <90ef31f1-d6aa-44de-b1c9-b1aa19650f2d@k5g2000pra.googlegroups.com> References: <4d08db371003280958q308a2845j3ec100ed92a22724@mail.gmail.com> <4fe02992-538d-4dd7-bf3a-b309ff8ddc4a@k36g2000prb.googlegroups.com> <4d08db371003281153h1f1a71a7v1f8ee4ebdbe89568@mail.gmail.com> <4fe6072a1003281223x54ec8211yef3d7ba05251ff68@mail.gmail.com> <90ef31f1-d6aa-44de-b1c9-b1aa19650f2d@k5g2000pra.googlegroups.com> Message-ID: <52fa0485-548d-43de-948c-0c406230c684@33g2000yqj.googlegroups.com> file:///C:/Erlang-R13B-04/doc/getting_started/seq_prog.html#id2252713 On Mar 28, 3:25?pm, NavaTux wrote: > here [Result]=[{23,_,_,56}]. ? // grouply displaying a full row by the > variable > > how to seperate each field by a seperate variable that need to be > printed in shell > > On Mar 29, 12:23?am, Ryan Huffman wrote: > > > > > > > As far as I can tell, wf:flash() is expecting a valid nitrogen element, but > > it isn't finding one. ?You need to convert the Results tuple into a string > > before passing it into wf:flash(). > > > Ryan > > > On Sun, Mar 28, 2010 at 12:15 PM, NavaTux wrote: > > > may i know what i need use instead of using [Results] variable, > > > > (nitrogen@REDACTED)28> {1,45,55,67,89} ? ? ? ? ? ? ? ? //whole row > > > displaying > > > > yes if i use the variable [Results] meant i am getting the full > > > row,but i wanna display a field by field for that what i have to > > > declare > > > > please explain friend > > > > let me know how to fetch the results from shell to my webpage > > > > On Mar 28, 11:53 pm, Hynek Vychodil wrote: > > > > There is raised {badrecord,elementbase} exception in > > > > wf_render:render/1 function. Just guess, should not event/1 return > > > > some record? wf:flash/1 parameter should be some sort of record? > > > > Something other expecting record where wf:flash/1 parameter is passed > > > > to? I don't know, look at documentation and if it doesn't there, blame > > > > author. > > > > > I'm just curious, why you consistently write [Results] when there one > > > > result row will be binded to Results variable? > > > > > On Sun, Mar 28, 2010 at 10:33 AM, NavaTux > > > wrote: > > > > > ya..it displayes in shell,when i wanna to display in my web page i > > > > > used to give wf:flash([Results]) it throws the error below, > > > > > > event(continue) -> > > > > > ? ? ? ?[Name] = wf:q(no_id), > > > > > ? ? ? ?Message = wf:f("The Result is~p", [Name]), > > > > > ? ? ? ?ConnString = "DSN=mysqldb", > > > > > ? ? ? ?{ok, Conn} = odbc:connect(ConnString, []), > > > > > ? ? ? ?{selected, _Cols, [Results]} = odbc:sql_query(Conn, "SELECT * > > > FROM > > > > > marks where id=1"), > > > > > ? ? ? ?io:format("~p",[Results]), > > > > > ? ? ? ?wf:flash([Results]), > > > > > ?ok; > > > > > > (nitrogen@REDACTED)15> {1,45,55,67,89}CAUGHT ERROR: error- > > > > > {badrecord,elementbase} > > > > > [{wf_render,render,1}, > > > > > ?{wf_render,'-render/1-lc$^0/1-0-',1}, > > > > > ?{element_panel,render,2}, > > > > > ?{wf_render,render,1}, > > > > > ?{wf_render,'-render/1-lc$^0/1-0-',1}, > > > > > ?{wf_render,'-render/1-lc$^0/1-0-',1}, > > > > > ?{element_panel,render,2}, > > > > > ?{wf_render,render,1}] > > > > > > Here let me know what happened? > > > > > > On Mar 28, 9:58 pm, Hynek Vychodil wrote: > > > > >> When I look at your error message and code then I easily can guess, > > > > >> that badmatch is on row > > > > > >> [Results] = odbc:sql_query(Conn, "SELECT * FROM marks where id=1") > > > > > >> so I look at documentation and bingo! It is. I strongly recommend you > > > > >> try code in shell and look what code returns when you don't want read > > > > >> documentation. You should try it in shell even have read > > > > >> documentation. Above row should be > > > > > >> {selected, _Cols, [Result]} = odbc:sql_query(Conn, "SELECT * FROM > > > > >> marks where id=1") > > > > > >> or > > > > > >> {selected, _Cols, Results} = odbc:sql_query(Conn, "SELECT * FROM marks > > > > >> where id=1") > > > > > >> On Sun, Mar 28, 2010 at 9:37 AM, NavaTux > > > wrote: > > > > >> > I wanna to use the query to retrieve some results from the > > > database,so > > > > >> > i used these lines > > > > > >> > event(continue) -> > > > > >> > ? ? ? ?[Name] = wf:q(no_id), > > > > >> > ? ? ? ?Message = wf:f("The Result is~p", [Name]), > > > > >> > ? ? ? ?ConnString = "DSN=mysqldb", > > > > >> > ? ? ? ?{ok, Conn} = odbc:connect(ConnString, []), > > > > >> > ? ? ? ?[Results] = odbc:sql_query(Conn, "SELECT * FROM marks where > > > id=1"), > > > > >> > ? ? ? ?io:format("~p",[Results]), > > > > >> > ? ? ? ?wf:flash([Results]), > > > > >> > ?ok; > > > > >> > event(_) -> ok. > > > > > >> > but i am unable to get the output,Here continue is the postback for > > > > >> > button,here what goes wrong? > > > > > >> > I am getting output in my terminal is > > > > > >> > =INFO REPORT==== 28-Mar-2010::21:56:22 === > > > > >> > ERROR: error > > > > >> > {badmatch,{selected,["id","tamil","english","maths","science"], > > > > >> > ? ? ? ? ? ? ? ? ? ?[{1,45,55,67,89}]}} > > > > >> > [{web_index,event,1}, > > > > >> > ?{wf_handle_postback,run_module_event,2}, > > > > >> > ?{wf_handle_postback,handle_normal_request,3}, > > > > >> > ?{wf_inets,do,3}, > > > > >> > ?{httpd_response,traverse_modules,2}, > > > > >> > ?{httpd_response,generate_and_send_response,1}, > > > > >> > ?{httpd_request_handler,handle_response,1}, > > > > >> > ?{gen_server,handle_msg,5}] > > > > > >> > id,tamil,english,maths,science are database fields.... > > > > > >> > please help me > > > > >> > as well as i wanna know how to flash the output that i retrieved > > > from > > > > >> > the database in my webpage.. > > > > > >> > ________________________________________________________________ > > > > >> > erlang-questions (at) erlang.org mailing list. > > > > >> > Seehttp://www.erlang.org/faq.html > > > > >> > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > > > > >> -- > > > > >> --Hynek (Pichi) Vychodil > > > > > >> Analyze your data in minutes. Share your insights instantly. Thrill > > > > >> your boss. ?Be a data hero! > > > > >> Try GoodData now for free:www.gooddata.com > > > > > >> ________________________________________________________________ > > > > >> erlang-questions (at) erlang.org mailing list. > > > > >> Seehttp://www.erlang.org/faq.html > > > > >> To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > > > > > ________________________________________________________________ > > > > > erlang-questions (at) erlang.org mailing list. > > > > > Seehttp://www.erlang.org/faq.html > > > > > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > > > > -- > > > > --Hynek (Pichi) Vychodil > > > > > Analyze your data in minutes. Share your insights instantly. Thrill > > > > your boss. ?Be a data hero! > > > > Try GoodData now for free:www.gooddata.com > > > > > ________________________________________________________________ > > > > erlang-questions (at) erlang.org mailing list. > > > > Seehttp://www.erlang.org/faq.html > > > > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > > > ________________________________________________________________ > > > erlang-questions (at) erlang.org mailing list. > > > Seehttp://www.erlang.org/faq.html > > > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > Seehttp://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED From ok@REDACTED Mon Mar 29 02:16:54 2010 From: ok@REDACTED (Richard O'Keefe) Date: Mon, 29 Mar 2010 13:16:54 +1300 Subject: [erlang-questions] Reading (and ignoring) escape-sequences In-Reply-To: <4BAF2205.5070805@erlang-solutions.com> References: <4BA76862.3050609@erlang-solutions.com> <20100322234006.GA48453@k2r.org> <4BA88648.80809@erlang-solutions.com> <4BA9F34B.4010002@erlang-solutions.com> <80c550b91003252201g42429e59v4ed0ef20385b424c@mail.gmail.com> <4BAC9A21.3020409@erlang-solutions.com> <80c550b91003260911geec60beg271c33303dd666aa@mail.gmail.com> <4BAD102B.3060501@erlang-solutions.com> <4BAF2205.5070805@erlang-solutions.com> Message-ID: <6BF3DC8A-7359-4516-9E53-A3B9BE5D2471@cs.otago.ac.nz> On Mar 28, 2010, at 10:31 PM, Mazen Harake wrote: > I get your point but you don't get mine. I _know_ that there is no > way out of the unambiguity part of escape sequences but it can be > made a _little easier for me (the developer)_ by letting Erlang > guess for me. >> And somehow Erlang is being slagged off for not making it easy, >> when *no* language actually makes it easy? > So in other words I should have said "easier". No, you should not have said >>ERLANG<<. It really really is not Erlang's job, any more than it's Fortran's job or Ada's job or C's job or AWK's job or Lisp's job or ... >> I implemented it as a C driver using ncurses' educated guesswork >> instead of my own by creating some kind of sync-over-async-call to >> ncurses. Fair enough it isn't very difficult but if I could have >> called it in Erlang, e,g, io:getch() and Erlang would have returned >> "Ummm... I think it is UpArrow" it _still_ would have been easier >> wouldn't it? Where is the C function that does this? Why are you not criticising C for failing to give you such a function? There isn't any getch() in C. (In any case, what you want is not get _character_ but get _key_.) The proper home for a function to fix an interface bug like this is in the interface layer that *creates* the bug. If not in that layer, then in the one immediately above. That's the C library layer. > That is my only point; it could have been made "easier" to reach an > educated guess by letting Erlang guess for me. Well, now that you've done it, it _will_ be easier for the next person with your problem, if there ever is one, provided you release your code. From ben@REDACTED Mon Mar 29 04:00:59 2010 From: ben@REDACTED (Ben Lackey) Date: Mon, 29 Mar 2010 03:00:59 +0100 Subject: Question about slave:start() In-Reply-To: <4BAFFB43.5060109@nonplatonic.com> References: <4BAFFB43.5060109@nonplatonic.com> Message-ID: <4BB009DB.4090901@nonplatonic.com> Hi, I'm trying to use the slave:start() function. I've tried on both my windows box and a 64bit build of erlang on OpenSUSE 11 with no luck. For instance, my windows box is called columbia. Here's a sample session: C:\Windows\system32>erl Eshell V5.7.5 (abort with ^G) 1> slave:start(columbia). ** exception exit: not_alive in function slave:start/5 2> slave:start(localhost). ** exception exit: not_alive in function slave:start/5 3> slave:start(columbia, foo). ** exception exit: not_alive in function slave:start/5 4> slave:start(columbia, foo). Any idea what I'm doing wrong with the host? From the doc it looks like it should be an atom, so I'm guessing this is what I ought to do. Likewise, how do I specify the node name? Thanks in advance, Ben From mihai@REDACTED Mon Mar 29 05:29:13 2010 From: mihai@REDACTED (Mihai Balea) Date: Sun, 28 Mar 2010 23:29:13 -0400 Subject: [erlang-questions] Question about slave:start() In-Reply-To: <4BB009DB.4090901@nonplatonic.com> References: <4BAFFB43.5060109@nonplatonic.com> <4BB009DB.4090901@nonplatonic.com> Message-ID: <20E3CB87-88BC-4C5B-93E2-44A620A2C4F1@hates.ms> On Mar 28, 2010, at 10:00 PM, Ben Lackey wrote: > Hi, > > I'm trying to use the slave:start() function. I've tried on both my windows box and a 64bit build of erlang on OpenSUSE 11 with no luck. > > For instance, my windows box is called columbia. Here's a sample session: > > C:\Windows\system32>erl > Eshell V5.7.5 (abort with ^G) > 1> slave:start(columbia). > ** exception exit: not_alive > in function slave:start/5 > 2> slave:start(localhost). > ** exception exit: not_alive > in function slave:start/5 > 3> slave:start(columbia, foo). > ** exception exit: not_alive > in function slave:start/5 > 4> slave:start(columbia, foo). > > Any idea what I'm doing wrong with the host? From the doc it looks like it should be an atom, so I'm guessing this is what I ought to do. Likewise, how do I specify the node name? Maybe this sample session will help you: cartman:~ mihai$ erl -rsh ssh -sname foo -setcookie mycookie Erlang R13B04 (erts-5.7.5) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.7.5 (abort with ^G) (foo@REDACTED)1> slave:start_link(cartman, bar, "-setcookie mycookie"). {ok,bar@REDACTED} (foo@REDACTED)2> nodes(). [bar@REDACTED] (foo@REDACTED)3> node(). foo@REDACTED (foo@REDACTED)4> Here I'm starting a node named foo with cookie "mycookie". Then I use slave:start_link to launch another node named bar on the same machine, with the same cookie. Starting slave nodes is a finicky operation, you need to make sure you jump through the appropriate hoops: - make sure you are allowed to execute commands on the remote host. Not so much of a problem if you're running on the same host - by default, the erlang vm will try to use rsh to run remote commands, you might want to override that when you start it. I'm using ssh in my example - both master and slave VMs need to be "alive" (have assigned node names) and need to have the same cookies Hope this helps, Mihai From mazen.harake@REDACTED Mon Mar 29 09:41:10 2010 From: mazen.harake@REDACTED (Mazen Harake) Date: Mon, 29 Mar 2010 09:41:10 +0200 Subject: [erlang-questions] Reading (and ignoring) escape-sequences In-Reply-To: <6BF3DC8A-7359-4516-9E53-A3B9BE5D2471@cs.otago.ac.nz> References: <4BA76862.3050609@erlang-solutions.com> <20100322234006.GA48453@k2r.org> <4BA88648.80809@erlang-solutions.com> <4BA9F34B.4010002@erlang-solutions.com> <80c550b91003252201g42429e59v4ed0ef20385b424c@mail.gmail.com> <4BAC9A21.3020409@erlang-solutions.com> <80c550b91003260911geec60beg271c33303dd666aa@mail.gmail.com> <4BAD102B.3060501@erlang-solutions.com> <4BAF2205.5070805@erlang-solutions.com> <6BF3DC8A-7359-4516-9E53-A3B9BE5D2471@cs.otago.ac.nz> Message-ID: <4BB05996.4090805@erlang-solutions.com> On 29/03/2010 02:16, Richard O'Keefe wrote: > Well, now that you've done it, it _will_ be easier for the next > person with your problem, if there ever is one, provided you > release your code. For future reference in case someone search the archives... Project: http://github.com/mazenharake/cecho Code relevant to this discussion : http://github.com/mazenharake/cecho/blob/input/src/cecho_srv.erl http://github.com/mazenharake/cecho/blob/input/c_src/cecho.c /Mazen --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From B.Candler@REDACTED Mon Mar 29 10:31:55 2010 From: B.Candler@REDACTED (Brian Candler) Date: Mon, 29 Mar 2010 09:31:55 +0100 Subject: Show the performance In-Reply-To: <9ad31154-2e6c-4eff-9af5-8871287c5794@t9g2000prh.googlegroups.com> References: <9ad31154-2e6c-4eff-9af5-8871287c5794@t9g2000prh.googlegroups.com> Message-ID: <20100329083155.GA4849@uk.tiscali.com> On Sun, Mar 28, 2010 at 06:34:41AM -0700, NavaTux wrote: > Is it possible to measure the performance of my erlang web application > with mysql ???Is it get improved when i compare to other language 's > performance??? > how to demonstrate the erlang performance in a great way??if you have > any suggestion please share here... The Apache webserver comes with a tool called ab (apache benchmark) which will throw HTTP requests at a webserver and measure the response performance. This is a simple starting point. From ben@REDACTED Mon Mar 29 13:16:07 2010 From: ben@REDACTED (Ben Lackey) Date: Mon, 29 Mar 2010 12:16:07 +0100 Subject: Addressing on nodes v processes Message-ID: <4BB08BF7.6080006@nonplatonic.com> Hi, Say I have a machine running a 32 bit Erlang node and want to address 16GB of memory across some number of erlang processes/nodes. Is it the case that: (i) each process get its own 32 bit addressing space eg I could have a single node with 16GB of memory distributed across 4 process or (ii) the node running the processes gets a single 32 bit addressing space that is then used in part by each process eg I would need to start 4 nodes each with a process that used 4GB of memory. Is mnesia treated any differently in all this, or would it just be another process within a node that is using some more memory? Are there any memory limitations across nodes eg some scenario in which a 32 bit erlang environment could only address 4GB even over a large number of nodes? Thanks, Ben From max.lapshin@REDACTED Mon Mar 29 13:18:07 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Mon, 29 Mar 2010 15:18:07 +0400 Subject: =?UTF-8?Q?Erlang_=D0=B8_MPEG=2DTS?= Message-ID: ? ???????? ???????? Erlyvideo ? ???????? ?? ??????? ????????? MPEG-TS ? ????????? ??????????: http://github.com/erlyvideo/mpegts ??????? ?????????? ?????????? ?????????? ??? ? RTMP ?? ?????, ?????? ??? ????????? ????? ? ??????? ???????? ? ????????? H.264 ??????. ? ?????? ?????? ?????????? ?????????? ?? ??? ??????: ??????? MPEG-TS ????? ? H.264/AAC ?????????? (???????? ?????????? VLC) ? ?????? MPEG-TS (??????????????iPhone, VLC ??? erlyvideo). ?????? ?????: ???? ????-?? ??? ????? ???????? ???????????????? ???????? ?? erlyvideo, ????? ????????. ? ?? ???????? ??????????? ????? MPEG-2 ?????, ??????? ??????? ? ???? ????? ?? ????? ?????. From ben@REDACTED Mon Mar 29 13:07:13 2010 From: ben@REDACTED (Ben Lackey) Date: Mon, 29 Mar 2010 12:07:13 +0100 Subject: [erlang-questions] Question about slave:start() In-Reply-To: <20E3CB87-88BC-4C5B-93E2-44A620A2C4F1@hates.ms> References: <4BAFFB43.5060109@nonplatonic.com> <4BB009DB.4090901@nonplatonic.com> <20E3CB87-88BC-4C5B-93E2-44A620A2C4F1@hates.ms> Message-ID: <4BB089E1.2000008@nonplatonic.com> Hi Mihai, >From your example, it looks like the start_link function starts a link to an already running node. I was really hoping to start an entirely new node programatically. It looks like that is what the slave:start() function is supposed to do, but I can't call it successfully. Any idea what I have to do to call slave:start()? Thanks, Ben From vladdu55@REDACTED Mon Mar 29 14:16:42 2010 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 29 Mar 2010 14:16:42 +0200 Subject: [erlang-questions] Question about slave:start() In-Reply-To: <4BB009DB.4090901@nonplatonic.com> References: <4BAFFB43.5060109@nonplatonic.com> <4BB009DB.4090901@nonplatonic.com> Message-ID: <95be1d3b1003290516t6a0ba490ye07c06ea27197092@mail.gmail.com> On Mon, Mar 29, 2010 at 04:00, Ben Lackey wrote: > C:\Windows\system32>erl > Eshell V5.7.5 ?(abort with ^G) > 1> slave:start(columbia). > ** exception exit: not_alive > ? in function ?slave:start/5 The message says that the master node is not alive. Try with "erl -sname master" for example. regards, Vlad From max.lapshin@REDACTED Mon Mar 29 14:23:11 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Mon, 29 Mar 2010 16:23:11 +0400 Subject: Erlang and MPEG-TS Message-ID: During Erlyvideo development, I've extracted MPEG-TS library: http://github.com/erlyvideo/mpegts It requires basic library: http://github.com/erlyvideo/erlmedia because working with MPEG-TS streams requires active working with H.264 stream. Currently library can accept inbound MPEG-TS stream with H.264/AAC content (primarily from VLC, maybe DVB-T will work), and stream outbound MPEG-TS (forVLC and even for iPhones!) If someone requires this functionality, it will be good to discuss. I haven't tried to accept raw MPEG-2 stream, but think it will be not very hard to. P.S. Sorry for first letter in russian, I've missed two mailing lists. From caio.ariede@REDACTED Mon Mar 29 14:28:48 2010 From: caio.ariede@REDACTED (caio ariede) Date: Mon, 29 Mar 2010 09:28:48 -0300 Subject: =?KOI8-R?Q?Re=3A_=5Berlang=2Dquestions=5D_Erlang_=C9_MPEG=2DTS?= In-Reply-To: References: Message-ID: <6a9ba5691003290528y4c5325cbs4d4c1c24f26e1f80@mail.gmail.com> I think english would be better :) Caio Ariede http://caioariede.com/ 2010/3/29 Max Lapshin > ? ???????? ???????? Erlyvideo ? ???????? ?? ??????? ????????? MPEG-TS > ? ????????? ??????????: http://github.com/erlyvideo/mpegts > ??????? ?????????? ?????????? ?????????? ??? ? RTMP ?? ?????, ?????? > ??? ????????? ????? ? ??????? ???????? ? ????????? H.264 ??????. > > ? ?????? ?????? ?????????? ?????????? ?? ??? ??????: ??????? MPEG-TS > ????? ? H.264/AAC ?????????? (???????? ???????? -- VLC) > ? ?????? MPEG-TS (??????????? -- iPhone, VLC ??? erlyvideo). > > ?????? ?????: ???? ????-?? ??? ????? ???????? ???????????????? > ???????? ?? erlyvideo, ????? ????????. > > ? ?? ???????? ??????????? ????? MPEG-2 ?????, ??????? ??????? ? ???? > ????? ?? ????? ?????. > From clist@REDACTED Mon Mar 29 14:30:22 2010 From: clist@REDACTED (Angel) Date: Mon, 29 Mar 2010 14:30:22 +0200 Subject: [erlang-questions] The erlang baby and the green JVM In-Reply-To: <88B3ED0D-4276-41C6-B55D-2195AD9FD5F3@cs.otago.ac.nz> References: <201003271953.07148.clist@uah.es> <88B3ED0D-4276-41C6-B55D-2195AD9FD5F3@cs.otago.ac.nz> Message-ID: <201003291430.22189.clist@uah.es> On Domingo, 28 de Marzo de 2010 08:03:25 usted escribi?: > On Mar 28, 2010, at 7:53 AM, Angel wrote: > > Another piece of the erlang history?? > > > > http://functional-orbitz.blogspot.com/2010/03/how-much-has-scala-affected > >- erlang.html > > Looks like April Fools' Day came early this year... > ha ha!! Everyone knows that prolog was never used again after HAL accident.. /Angel "My God, its full of stars!" Commander Dave Bowman discovers that Jupiter monolith was coded in C abusing pointers.. From max.lapshin@REDACTED Mon Mar 29 14:30:41 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Mon, 29 Mar 2010 16:30:41 +0400 Subject: =?UTF-8?Q?Re=3A_=5Berlang=2Dquestions=5D_Erlang_=D0=B8_MPEG=2DTS?= In-Reply-To: <6a9ba5691003290528y4c5325cbs4d4c1c24f26e1f80@mail.gmail.com> References: <6a9ba5691003290528y4c5325cbs4d4c1c24f26e1f80@mail.gmail.com> Message-ID: 2010/3/29 caio ariede : > I think english would be better :) > Yes, I've missed mailing list and repeated here next message in english. From ben@REDACTED Mon Mar 29 14:43:24 2010 From: ben@REDACTED (Ben Lackey) Date: Mon, 29 Mar 2010 13:43:24 +0100 Subject: [erlang-questions] Question about slave:start() In-Reply-To: <95be1d3b1003290516t6a0ba490ye07c06ea27197092@mail.gmail.com> References: <4BAFFB43.5060109@nonplatonic.com> <4BB009DB.4090901@nonplatonic.com> <95be1d3b1003290516t6a0ba490ye07c06ea27197092@mail.gmail.com> Message-ID: <4BB0A06C.905@nonplatonic.com> Thanks Vlad! That's it! It looks like the issue was that when I just run erl I get: C:\Windows\system32>erl Eshell V5.7.5 (abort with ^G) 1> node(). nonode@REDACTED 2> However, when I specify the node name master, erlang seems to pick up the name of the computer columbia as well. Is this a bug or some sort of feature I don't understand? C:\Windows\system32>erl -sname master Eshell V5.7.5 (abort with ^G) (master@REDACTED)1> node(). master@REDACTED (master@REDACTED)2> slave:start(columbia, slavenode). {ok,slavenode@REDACTED} (master@REDACTED)3> Thanks, Ben From vladdu55@REDACTED Mon Mar 29 14:51:38 2010 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 29 Mar 2010 14:51:38 +0200 Subject: [erlang-questions] Question about slave:start() In-Reply-To: <4BB0A06C.905@nonplatonic.com> References: <4BAFFB43.5060109@nonplatonic.com> <4BB009DB.4090901@nonplatonic.com> <95be1d3b1003290516t6a0ba490ye07c06ea27197092@mail.gmail.com> <4BB0A06C.905@nonplatonic.com> Message-ID: <95be1d3b1003290551u40fce1b1o9cc0d1005097d8c3@mail.gmail.com> On Mon, Mar 29, 2010 at 14:43, Ben Lackey wrote: > 1> node(). > nonode@REDACTED > 2> > > However, when I specify the node name master, erlang seems to pick up the > name of the computer columbia as well. Is this a bug or some sort of > feature I don't understand? > > C:\Windows\system32>erl -sname master > Eshell V5.7.5 (abort with ^G) > (master@REDACTED)1> node(). > master@REDACTED When starting with "erl" the distribution mechanism is not enabled and the nonode@REDACTED name is just a placeholder. You can match against that value to check if the current node is alive or not. By specifying -sname or -name, you tell the runtime to enable distribution and then it checks the computer name and a lot of other related things. See also http://erlang.org/doc/reference_manual/distributed.html for details. regards, Vlad From mihai@REDACTED Mon Mar 29 15:05:50 2010 From: mihai@REDACTED (Mihai Balea) Date: Mon, 29 Mar 2010 09:05:50 -0400 Subject: [erlang-questions] Question about slave:start() In-Reply-To: <4BB0A06C.905@nonplatonic.com> References: <4BAFFB43.5060109@nonplatonic.com> <4BB009DB.4090901@nonplatonic.com> <95be1d3b1003290516t6a0ba490ye07c06ea27197092@mail.gmail.com> <4BB0A06C.905@nonplatonic.com> Message-ID: <56AA6454-8596-4A90-8397-FA711259CABE@hates.ms> On Mar 29, 2010, at 8:43 AM, Ben Lackey wrote: > However, when I specify the node name master, erlang seems to pick up the name of the computer columbia as well. Is this a bug or some sort of feature I don't understand? An Erlang node is referenced by its name and host, as in 'nodename@REDACTED'. You can run multiple nodes (basically multiple VMs) on the same machine and you can also run multiple nodes on multiple machines. From mihai@REDACTED Mon Mar 29 15:08:51 2010 From: mihai@REDACTED (Mihai Balea) Date: Mon, 29 Mar 2010 09:08:51 -0400 Subject: [erlang-questions] Question about slave:start() In-Reply-To: <4BB087F8.6020807@nonplatonic.com> References: <4BAFFB43.5060109@nonplatonic.com> <4BB009DB.4090901@nonplatonic.com> <20E3CB87-88BC-4C5B-93E2-44A620A2C4F1@hates.ms> <4BB087F8.6020807@nonplatonic.com> Message-ID: <75BE12A9-51F1-4D27-BDC9-52A5345ED79D@hates.ms> On Mar 29, 2010, at 6:59 AM, Ben Lackey wrote: > Hi Mihai, > > >From your example, it looks like the start_link function starts a link to an already running node. I was really hoping to start an entirely new node programatically. It looks like that is what the slave:start() function is supposed to do, but I can't call it successfully. Any idea what I have to do to call slave:start()? No, the difference between start and start_link is that with start_link, if the process (on the master node) that starts the slave node dies, the slave node is terminated as well. With start, the slave node will get to hang around after the starting process dies. Otherwise they're pretty much identical, and they will both start a new node. Mihai From gianfranco.alongi@REDACTED Mon Mar 29 16:01:18 2010 From: gianfranco.alongi@REDACTED (Gianfranco Alongi) Date: Mon, 29 Mar 2010 14:01:18 +0000 (GMT) Subject: =?utf-8?Q?Re:_[erlang-questions]_Erlang_=D0=B8_MPEG-TS?= In-Reply-To: Message-ID: <1414417724.182061269871278698.JavaMail.root@zimbra> Google translate: Russian to English translationShow romanization In the process of development Erlyvideo I inferred from the project support MPEG-TS in a separate library: http://github.com/erlyvideo/mpegts Make absolutely standalone library as a RTMP does not work, because it takes a lot and actively get into the structure of H.264 stream. At the moment the library is designed for two purposes: to take MPEG-TS stream from H.264/AAC content (the main source - VLC) and give the MPEG-TS (consumers - iPhone, VLC or erlyvideo). The question is: if someone else needed such functionality separately from erlyvideo, could be discussed. I have not tried to capture raw MPEG-2 stream, but problems with this is not very much. /G ----- Original Message ----- From: "Max Lapshin" To: "caio ariede" Cc: "Erlang-Questions Questions" Sent: Monday, March 29, 2010 1:30:41 PM GMT +00:00 GMT Britain, Ireland, Portugal Subject: Re: [erlang-questions] Erlang ? MPEG-TS 2010/3/29 caio ariede : > I think english would be better :) > Yes, I've missed mailing list and repeated here next message in english. ________________________________________________________________ erlang-questions (at) erlang.org mailing list. See http://www.erlang.org/faq.html To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED From rickard@REDACTED Mon Mar 29 16:13:01 2010 From: rickard@REDACTED (Rickard Green) Date: Mon, 29 Mar 2010 16:13:01 +0200 Subject: [erlang-questions] How to Cross compile Erlang/OTP R13B04 for TileraPro64 In-Reply-To: <84a9e12c1003271351x6399e81cwee53cf8134dc815@mail.gmail.com> References: <84a9e12c1003271351x6399e81cwee53cf8134dc815@mail.gmail.com> Message-ID: <10d7e35f1003290713l58928849h1718c488067a1d01@mail.gmail.com> The following patch hopefully fixes you problem. The bug only manifests itself when the number of logical processors found is fewer than reported by sysconf(_SC_NPROCESSORS_CONF). This is normally never the case, but on the tilera (with a relatively new MDE) it is. Regards, Rickard, Erlang/OTP, Ericsson AB $ diff -Nau otp_src_R13B04/erts/lib_src/common/erl_misc_utils.c{~,} --- otp_src_R13B04/erts/lib_src/common/erl_misc_utils.c~ 2009-11-20 14:32:23.000000000 +0100 +++ otp_src_R13B04/erts/lib_src/common/erl_misc_utils.c 2010-03-29 15:53:28.000000000 +0200 @@ -373,8 +373,8 @@ return 0; memcpy((void *) topology, (void *) cpuinfo->topology, - cpuinfo->configured*sizeof(erts_cpu_topology_t)); - return cpuinfo->configured; + cpuinfo->topology_size*sizeof(erts_cpu_topology_t)); + return cpuinfo->topology_size; } int 2010/3/27 JR Zhang : > Hi, > > I couldn't cross compile Erlang/OTP R13B04 for Tilera board properly. I > follow the steps described in INSTALL-CROSS.md, which are : > (1) cd $ERL_TOP > (2) ./otp_build configure --xcomp-conf= erl-xcomp-TileraMDE2.0-tilepro.conf> > (3) ./otp_build boot -a > (4) ./otp_build release -a /lhome/x/otp > (5) ./Install -cross -minimal /lhome/x/otp > The compilation is successful without any errors. But after I upload it to > Tilera board and run it, I get an error, "Segmentation fault". > > ?I found a thread discussing how to cross compile R13B03 for Tilera Board > http://www.erlang.org/cgi-bin/ezmlm-cgi/4/49164 . ?I tried to add steps like > "touch lib/crypto/SKIP', "touch lib/ssl/SKIP", "touch lib/ssh/SKIP". But I > still didn't succeed. > > Could someone help me? Thank you in advance. > > Best Regards, > Jianrong Zhang > Kista Multicore Center, SICS > From dmercer@REDACTED Mon Mar 29 16:38:20 2010 From: dmercer@REDACTED (David Mercer) Date: Mon, 29 Mar 2010 09:38:20 -0500 Subject: [erlang-questions] The erlang baby and the green JVM In-Reply-To: <3dbc6d1c1003271345r3d87e054y5221452315121107@mail.gmail.com> References: <466fba8d1003271202h74ae19b5gbeb49cd1c5cdf696@mail.gmail.com> <4bae685a.091abc0a.1f68.6a4dSMTPIN_ADDED@mx.google.com> <3dbc6d1c1003271345r3d87e054y5221452315121107@mail.gmail.com> Message-ID: <5287075483C24C4D87E0BA93CFADE093@SSI.CORP> My favorite line: "A lot of the fault tolerance aspects of Erlang come from people trying to work around Joe's buggy VM." > -----Original Message----- > From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] On > Behalf Of Robert Virding > Sent: Saturday, March 27, 2010 3:46 PM > To: Valentin Micic > Cc: Brian Troutwine; Angel; erlang-questions@REDACTED > Subject: Re: [erlang-questions] The erlang baby and the green JVM > > Oh, it is! > > "Richard" > > On 27 March 2010 20:54, Valentin Micic wrote: > > Has to be... "Richard" Virding?!? > > > > -----Original Message----- > > From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] > On > > Behalf Of Brian Troutwine > > Sent: 27 March 2010 09:03 PM > > To: Angel > > Cc: erlang-questions@REDACTED > > Subject: Re: [erlang-questions] The erlang baby and the green JVM > > > > Early April Fools? > > > > On Sat, Mar 27, 2010 at 11:53 AM, Angel wrote: > >> > >> Another piece of the erlang history?? > >> > >> http://functional-orbitz.blogspot.com/2010/03/how-much-has-scala- > affected- > >> erlang.html > >> > >> I think this aspect never was detailed on the list nor on the blogs... > >> > >> > >> > >> > >> > >> Most people know C is not so high level.... > >> ? ? ? ? ? ? ? ?...Everybody else just got assembler overdose > >> > >> > >> ________________________________________________________________ > >> erlang-questions (at) erlang.org mailing list. > >> See http://www.erlang.org/faq.html > >> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > >> > >> > > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > See http://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > > > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > See http://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED From dmurray@REDACTED Mon Mar 29 17:10:16 2010 From: dmurray@REDACTED (David N Murray) Date: Mon, 29 Mar 2010 11:10:16 -0400 (EDT) Subject: [erlang-questions] Building R13B04 on OpenBSD 4.6 In-Reply-To: <4BAFD74E.1050604@desquilbet.org> References: <4BAFD74E.1050604@desquilbet.org> Message-ID: Thanks! I had to do one other thing, prior to ./configure: $ export CC=egcc which is the gcc that pkg_add installed (it left the old gcc-3.3.5-propolice in place as /usr/bin/gcc). $ erl Erlang R13B04 (erts-5.7.5) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [kernel-poll:false] Eshell V5.7.5 (abort with ^G) 1> Dave On Mar 29, J?r?me Desquilbet scribed: > I didn't have problems. But before compiling from sources I installed > the erlang package. Here's what I did (I wrote it somewhere, here's a copy): > > > pkg_add wget > pkg_add erlang > pkg_add gcc-4.2.4p2 > pkg_add gmake > mkdir /usr/tools > cd /usr/tools > mkdir erlang > cd erlang > wget http://www.erlang.org/download/otp_src_R13B04.tar.gz > tar zxf otp_src_R13B04.tar.gz > mkdir otp_R13B04 > cd otp_src_R13B04 > ./configure --help > ./configure --prefix=/usr/tools/erlang/otp_R13B04 --with-ssl > gmake > gmake install > > > Good luck, > J?r?me. > > > David N Murray a ?crit : > > Hi, > > > > I'm trying to build R13B04 on OpenBSD 4.6. I ran into a similar problem > > when I built Gambit Scheme on this box a while back: > > > > checking sys/sysctl.h usability... no > > checking sys/sysctl.h presence... yes > > configure: WARNING: sys/sysctl.h: present but cannot be compiled > > configure: WARNING: sys/sysctl.h: check for missing prerequisite > > headers? > > configure: WARNING: sys/sysctl.h: see the Autoconf documentation > > configure: WARNING: sys/sysctl.h: section "Present But Cannot Be > > Compiled" > > configure: WARNING: sys/sysctl.h: proceeding with the preprocessor's > > result > > configure: WARNING: sys/sysctl.h: in the future, the compiler will take > > precedence > > configure: WARNING: ## ------------------------------------------ ## > > configure: WARNING: ## Report this to the AC_PACKAGE_NAME lists. ## > > configure: WARNING: ## ------------------------------------------ ## > > checking for sys/sysctl.h... yes > > > > I generated a fix for Gambit, but I'm not sure how to apply it to Erlang > > (there's no configure.ac): > > > > --- configure.ac.~1~ Thu Jan 7 14:58:50 2010 > > +++ configure.ac Sat Jan 30 15:32:36 2010 > > @@ -622,7 +622,21 @@ > > AC_CHECK_HEADERS(sys/socket.h) > > AC_CHECK_HEADERS(strings.h) > > AC_CHECK_HEADERS(memory.h) > > - AC_CHECK_HEADERS(sys/sysctl.h) > > + case "$target_os" in > > + > > + openbsd*) # needs param.h > > + AC_CHECK_HEADERS(sys/param.h) > > + AC_CHECK_HEADERS(sys/sysctl.h,,, > > +[#ifdef HAVE_PARAM_H > > +# include > > +#endif > > +]) > > + ;; > > + > > + *) > > + AC_CHECK_HEADERS(sys/sysctl.h) > > + ;; > > + esac > > > > if test "$C_COMP_VISUALC" != yes; then > > > > I haven't tried to 'make' yet. I'm not sure if sys/sysctl.h is really > > required or can be worked around. > > > > Thoughts? > > > > TIA, > > Dave > > > > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > See http://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > From rapsey@REDACTED Mon Mar 29 17:18:55 2010 From: rapsey@REDACTED (Rapsey) Date: Mon, 29 Mar 2010 17:18:55 +0200 Subject: [Erlyaws-list] run yaws on port < 1024 non root In-Reply-To: <533df7fa1003290706i5618813eta550a9e7986066ba@mail.gmail.com> References: <533df7fa1003271934t44bc195cv2f8a4261f9ffad64@mail.gmail.com> <97619b171003280043r8c2682cr729221c3fd8e48dc@mail.gmail.com> <533df7fa1003290706i5618813eta550a9e7986066ba@mail.gmail.com> Message-ID: <97619b171003290818s595dd3ffg1b2ed016f6de1f5b@mail.gmail.com> I haven't found a viable solution for OSX. Run haproxy or nginx on port 80 and reverse proxy to yaws on a higher port. Sergej On Mon, Mar 29, 2010 at 4:06 PM, Wes James wrote: > On Sun, Mar 28, 2010 at 1:43 AM, Rapsey wrote: > > It completely depends on your OS. > > > OS X snow leopard > > > > > > Sergej > > > > On Sun, Mar 28, 2010 at 4:34 AM, Wes James wrote: > >> > >> in chapter 11 of the pdf on yaws it says: > >> > >> YAWS is of course susceptible to intrusions. YAWS has the ability to > >> run under a different user than root - Assuming we need to listen to > >> privileged port numbers. > >> > >> I don't quite understand this phrase. I can run yaws as user foo, but > >> I don't see how with port < 1024. How is this done? > > > I've been looking at ipfw fwd, but it seems to be broken in OS X SL . > > -wes > > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Erlyaws-list mailing list > Erlyaws-list@REDACTED > https://lists.sourceforge.net/lists/listinfo/erlyaws-list > From zhangjr2009@REDACTED Mon Mar 29 19:36:54 2010 From: zhangjr2009@REDACTED (JR Zhang) Date: Mon, 29 Mar 2010 19:36:54 +0200 Subject: [erlang-questions] How to Cross compile Erlang/OTP R13B04 for TileraPro64 In-Reply-To: <10d7e35f1003290713l58928849h1718c488067a1d01@mail.gmail.com> References: <84a9e12c1003271351x6399e81cwee53cf8134dc815@mail.gmail.com> <10d7e35f1003290713l58928849h1718c488067a1d01@mail.gmail.com> Message-ID: <84a9e12c1003291036i534cf690uf76b71bb1618607f@mail.gmail.com> Thank you Rickard. It solved the problem. Best Regards, Jianrong Zhang Kista Multicore Center, SICS On Mon, Mar 29, 2010 at 4:13 PM, Rickard Green wrote: > The following patch hopefully fixes you problem. The bug only > manifests itself when the number of logical processors found is fewer > than reported by sysconf(_SC_NPROCESSORS_CONF). This is normally never > the case, but on the tilera (with a relatively new MDE) it is. > > Regards, > Rickard, Erlang/OTP, Ericsson AB > > $ diff -Nau otp_src_R13B04/erts/lib_src/common/erl_misc_utils.c{~,} > --- otp_src_R13B04/erts/lib_src/common/erl_misc_utils.c~ > 2009-11-20 14:32:23.000000000 +0100 > +++ otp_src_R13B04/erts/lib_src/common/erl_misc_utils.c 2010-03-29 > 15:53:28.000000000 +0200 > @@ -373,8 +373,8 @@ > return 0; > memcpy((void *) topology, > (void *) cpuinfo->topology, > - cpuinfo->configured*sizeof(erts_cpu_topology_t)); > - return cpuinfo->configured; > + cpuinfo->topology_size*sizeof(erts_cpu_topology_t)); > + return cpuinfo->topology_size; > } > > int > > > > 2010/3/27 JR Zhang : > > Hi, > > > > I couldn't cross compile Erlang/OTP R13B04 for Tilera board properly. I > > follow the steps described in INSTALL-CROSS.md, which are : > > (1) cd $ERL_TOP > > (2) ./otp_build configure --xcomp-conf= > erl-xcomp-TileraMDE2.0-tilepro.conf> > > (3) ./otp_build boot -a > > (4) ./otp_build release -a /lhome/x/otp > > (5) ./Install -cross -minimal /lhome/x/otp > > The compilation is successful without any errors. But after I upload it > to > > Tilera board and run it, I get an error, "Segmentation fault". > > > > I found a thread discussing how to cross compile R13B03 for Tilera Board > > http://www.erlang.org/cgi-bin/ezmlm-cgi/4/49164 . I tried to add steps > like > > "touch lib/crypto/SKIP', "touch lib/ssl/SKIP", "touch lib/ssh/SKIP". But > I > > still didn't succeed. > > > > Could someone help me? Thank you in advance. > > > > Best Regards, > > Jianrong Zhang > > Kista Multicore Center, SICS > > > From max.lapshin@REDACTED Mon Mar 29 20:27:52 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Mon, 29 Mar 2010 22:27:52 +0400 Subject: [erlang-questions] specify error logger for process In-Reply-To: References: <20100328010810.GG1969@hijacked.us> Message-ID: At least, I've changed gen_server to gen_server2 and fixed printing of state: http://github.com/erlyvideo/erlyvideo/commit/b01d15abc3189226dbf824db19db22da35fa33a0#diff-0 Now erlyvideo doesn't hang in error_logger when stream_media dies. From ok@REDACTED Mon Mar 29 23:30:38 2010 From: ok@REDACTED (Richard O'Keefe) Date: Tue, 30 Mar 2010 10:30:38 +1300 Subject: [erlang-questions] Reading (and ignoring) escape-sequences In-Reply-To: <4BB05996.4090805@erlang-solutions.com> References: <4BA76862.3050609@erlang-solutions.com> <20100322234006.GA48453@k2r.org> <4BA88648.80809@erlang-solutions.com> <4BA9F34B.4010002@erlang-solutions.com> <80c550b91003252201g42429e59v4ed0ef20385b424c@mail.gmail.com> <4BAC9A21.3020409@erlang-solutions.com> <80c550b91003260911geec60beg271c33303dd666aa@mail.gmail.com> <4BAD102B.3060501@erlang-solutions.com> <4BAF2205.5070805@erlang-solutions.com> <6BF3DC8A-7359-4516-9E53-A3B9BE5D2471@cs.otago.ac.nz> <4BB05996.4090805@erlang-solutions.com> Message-ID: On Mar 29, 2010, at 8:41 PM, Mazen Harake wrote: > For future reference in case someone search the archives... > Project: > http://github.com/mazenharake/cecho Thank you. From caox@REDACTED Tue Mar 30 08:34:25 2010 From: caox@REDACTED (caox) Date: Tue, 30 Mar 2010 14:34:25 +0800 Subject: problem when use g++ to compile erl_nif Message-ID: <4BB19B71.6060706@lightpole.net> I am trying to use erl_nif to implement some drivers.And I am wondering if there is any way to compile nif files with g++, just like what #ifdef __cplusplus extern "C" { // shouldn't this be in the DRIVER_INIT macro? #endif DRIVER_INIT(template_drv) { return &template_drv_entry; } #ifdef __cplusplus } #endif can do for erl_driver. In that way, it will be more convenient to code with c++ libs. But now, I got an error when using g++ to run the example with OTPR1303: g++ -shared -fpic -ldl -I/usr/lib64/erlang/usr/include -I/usr/include -I/usr/lib64/erlang/lib/erl_interface-3.6.4/include -I/mnt/hgfs/work/ewp_new_trunk/drivers/template -I/mnt/hgfs/work/vendor/clearsilver-0.10.5 -o ./priv/niftest.so c_src/niftest.c -L/usr/lib64/erlang/lib/erl_interface-3.6.4/lib -L/usr/lib64/erlang/usr/lib -lei -lxerces-c -lxqilla -L/mnt/hgfs/work/vendor/clearsilver-0.10.5/libs -lneo_cs -lneo_cgi -lneo_utl c_src/niftest.c:28: error: invalid conversion from ?ERL_NIF_TERM (*)(ErlNifEnv*)? to ?void*? make: *** [nif] Er/ Appreciate your help. From dizzyd@REDACTED Tue Mar 30 08:39:11 2010 From: dizzyd@REDACTED (Dave Smith) Date: Tue, 30 Mar 2010 00:39:11 -0600 Subject: [erlang-questions] problem when use g++ to compile erl_nif In-Reply-To: <4BB19B71.6060706@lightpole.net> References: <4BB19B71.6060706@lightpole.net> Message-ID: Take a look at the ebloom project: http://hg.basho.com/ebloom/ That's a NIF which wraps a C++ header-style bloom filter. Bottom line, you need to include erl_nif.h in a separate header and then make sure that all the stuff required by erlang happens in a extern "C" section. D. On Tue, Mar 30, 2010 at 12:34 AM, caox wrote: > I am trying to use erl_nif to implement some drivers.And I am wondering if > there is any way to compile ?nif files with g++, just like what > > #ifdef __cplusplus > extern "C" { // shouldn't this be in the DRIVER_INIT macro? > #endif > DRIVER_INIT(template_drv) { > ? ?return &template_drv_entry; > } > #ifdef __cplusplus > } > #endif > > can do for erl_driver. In that way, it will be more convenient to code with > c++ libs. > But now, I got an error when using g++ to run the example with OTPR1303: > > g++ -shared -fpic -ldl -I/usr/lib64/erlang/usr/include -I/usr/include > -I/usr/lib64/erlang/lib/erl_interface-3.6.4/include > -I/mnt/hgfs/work/ewp_new_trunk/drivers/template > -I/mnt/hgfs/work/vendor/clearsilver-0.10.5 -o ./priv/niftest.so > c_src/niftest.c -L/usr/lib64/erlang/lib/erl_interface-3.6.4/lib > -L/usr/lib64/erlang/usr/lib -lei -lxerces-c ? -lxqilla > ?-L/mnt/hgfs/work/vendor/clearsilver-0.10.5/libs -lneo_cs -lneo_cgi > -lneo_utl > c_src/niftest.c:28: error: invalid conversion from ?ERL_NIF_TERM > (*)(ErlNifEnv*)? to ?void*? > make: *** [nif] Er/ > > Appreciate your help. > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From kyleqian@REDACTED Tue Mar 30 09:09:20 2010 From: kyleqian@REDACTED (=?GB2312?B?x67P/sP3?=) Date: Tue, 30 Mar 2010 15:09:20 +0800 Subject: How to reduce the repetitious code in create mnesia table? Message-ID: Hi, I want to create many tables in mnesia, but I find the code is very long if check the return value of mnesia:create_table every time: case mnesia:create_table(ig_master, [{attributes, record_info(fields, ig_master)}]) of {aborted, Reason} -> error_logger:error_msg("Fail to create table ~p: ~p!", [ig_master, Reason]), throw({error, create_table}); {atomic, ok} -> ok end, %% repetitious code to create other 6 tables. Is there any way I can do to reduce the repetitious code? I have tried defining a new function accepting the name of record to do the same thing above, but can not compile code because of record_info. By the way, I do not find the way to leave a function except using throw/exit. Is there any way I can use to just leave current function, replace the "throw" statement above? Thanks! From mazen.harake@REDACTED Tue Mar 30 09:44:34 2010 From: mazen.harake@REDACTED (Mazen Harake) Date: Tue, 30 Mar 2010 09:44:34 +0200 Subject: [erlang-questions] How to reduce the repetitious code in create mnesia table? In-Reply-To: References: Message-ID: <4BB1ABE2.9030408@erlang-solutions.com> Why are you case-ing everything? I remember I've done something similar before and what I did was that I always pattern matched on expected results (I.e. _why_ would you expect create_table to fail when creating only 6 tables?) and never cared about the "{aborted, Reason}" part. _if_ you get {aborted, Reason} you will get a badmatch... this is good because you can use pattern matching to get the reason from that instead of using 6+ case-clauses. E.g: try Options = [{attributes, record_info(fields, ig_master)}], {atomic, ok} = mnesia:create_table(ig_master, Options), ... ok catch error:{badmatch,{aborted,Reason}} -> {error, Reason} end. On 30/03/2010 09:09, ??? wrote: > Hi, I want to create many tables in mnesia, but I find the code is very long > if check the return value of mnesia:create_table every time: > > case mnesia:create_table(ig_master, [{attributes, record_info(fields, > ig_master)}]) of > {aborted, Reason} -> > error_logger:error_msg("Fail to create table ~p: ~p!", [ig_master, > Reason]), > throw({error, create_table}); > {atomic, ok} -> > ok > end, > %% repetitious code to create other 6 tables. > > Is there any way I can do to reduce the repetitious code? I have > tried defining a new function accepting the name of record to do the same > thing above, but can not compile code because of record_info. > > By the way, I do not find the way to leave a function except using > throw/exit. Is there any way I can use to just leave current function, > replace the "throw" statement above? > > Thanks! > > --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From navaneethanit@REDACTED Tue Mar 30 13:02:44 2010 From: navaneethanit@REDACTED (NavaTux) Date: Tue, 30 Mar 2010 04:02:44 -0700 (PDT) Subject: database retrieve problem In-Reply-To: <52fa0485-548d-43de-948c-0c406230c684@33g2000yqj.googlegroups.com> References: <4d08db371003280958q308a2845j3ec100ed92a22724@mail.gmail.com> <4fe02992-538d-4dd7-bf3a-b309ff8ddc4a@k36g2000prb.googlegroups.com> <4d08db371003281153h1f1a71a7v1f8ee4ebdbe89568@mail.gmail.com> <4fe6072a1003281223x54ec8211yef3d7ba05251ff68@mail.gmail.com> <90ef31f1-d6aa-44de-b1c9-b1aa19650f2d@k5g2000pra.googlegroups.com> <52fa0485-548d-43de-948c-0c406230c684@33g2000yqj.googlegroups.com> Message-ID: friend please i have red that,I think it is not related me,kindly i noticed my problem regarding retrieval of each field from the mysql data base to use inside the nitrogen simply,yet to need the fair one to show the results, if you wanna know my fuss elaborately mean i am ready to explain detaily please inform dude On Mar 29, 5:07?am, Steve Davis wrote: > file:///C:/Erlang-R13B-04/doc/getting_started/seq_prog.html#id2252713 > > On Mar 28, 3:25?pm, NavaTux wrote: > > > > > here [Result]=[{23,_,_,56}]. ? // grouply displaying a full row by the > > variable > > > how to seperate each field by a seperate variable that need to be > > printed in shell > > > On Mar 29, 12:23?am, Ryan Huffman wrote: > > > > As far as I can tell, wf:flash() is expecting a valid nitrogen element, but > > > it isn't finding one. ?You need to convert the Results tuple into a string > > > before passing it into wf:flash(). > > > > Ryan > > > > On Sun, Mar 28, 2010 at 12:15 PM, NavaTux wrote: > > > > may i know what i need use instead of using [Results] variable, > > > > > (nitrogen@REDACTED)28> {1,45,55,67,89} ? ? ? ? ? ? ? ? //whole row > > > > displaying > > > > > yes if i use the variable [Results] meant i am getting the full > > > > row,but i wanna display a field by field for that what i have to > > > > declare > > > > > please explain friend > > > > > let me know how to fetch the results from shell to my webpage > > > > > On Mar 28, 11:53 pm, Hynek Vychodil wrote: > > > > > There is raised {badrecord,elementbase} exception in > > > > > wf_render:render/1 function. Just guess, should not event/1 return > > > > > some record? wf:flash/1 parameter should be some sort of record? > > > > > Something other expecting record where wf:flash/1 parameter is passed > > > > > to? I don't know, look at documentation and if it doesn't there, blame > > > > > author. > > > > > > I'm just curious, why you consistently write [Results] when there one > > > > > result row will be binded to Results variable? > > > > > > On Sun, Mar 28, 2010 at 10:33 AM, NavaTux > > > > wrote: > > > > > > ya..it displayes in shell,when i wanna to display in my web page i > > > > > > used to give wf:flash([Results]) it throws the error below, > > > > > > > event(continue) -> > > > > > > ? ? ? ?[Name] = wf:q(no_id), > > > > > > ? ? ? ?Message = wf:f("The Result is~p", [Name]), > > > > > > ? ? ? ?ConnString = "DSN=mysqldb", > > > > > > ? ? ? ?{ok, Conn} = odbc:connect(ConnString, []), > > > > > > ? ? ? ?{selected, _Cols, [Results]} = odbc:sql_query(Conn, "SELECT * > > > > FROM > > > > > > marks where id=1"), > > > > > > ? ? ? ?io:format("~p",[Results]), > > > > > > ? ? ? ?wf:flash([Results]), > > > > > > ?ok; > > > > > > > (nitrogen@REDACTED)15> {1,45,55,67,89}CAUGHT ERROR: error- > > > > > > {badrecord,elementbase} > > > > > > [{wf_render,render,1}, > > > > > > ?{wf_render,'-render/1-lc$^0/1-0-',1}, > > > > > > ?{element_panel,render,2}, > > > > > > ?{wf_render,render,1}, > > > > > > ?{wf_render,'-render/1-lc$^0/1-0-',1}, > > > > > > ?{wf_render,'-render/1-lc$^0/1-0-',1}, > > > > > > ?{element_panel,render,2}, > > > > > > ?{wf_render,render,1}] > > > > > > > Here let me know what happened? > > > > > > > On Mar 28, 9:58 pm, Hynek Vychodil wrote: > > > > > >> When I look at your error message and code then I easily can guess, > > > > > >> that badmatch is on row > > > > > > >> [Results] = odbc:sql_query(Conn, "SELECT * FROM marks where id=1") > > > > > > >> so I look at documentation and bingo! It is. I strongly recommend you > > > > > >> try code in shell and look what code returns when you don't want read > > > > > >> documentation. You should try it in shell even have read > > > > > >> documentation. Above row should be > > > > > > >> {selected, _Cols, [Result]} = odbc:sql_query(Conn, "SELECT * FROM > > > > > >> marks where id=1") > > > > > > >> or > > > > > > >> {selected, _Cols, Results} = odbc:sql_query(Conn, "SELECT * FROM marks > > > > > >> where id=1") > > > > > > >> On Sun, Mar 28, 2010 at 9:37 AM, NavaTux > > > > wrote: > > > > > >> > I wanna to use the query to retrieve some results from the > > > > database,so > > > > > >> > i used these lines > > > > > > >> > event(continue) -> > > > > > >> > ? ? ? ?[Name] = wf:q(no_id), > > > > > >> > ? ? ? ?Message = wf:f("The Result is~p", [Name]), > > > > > >> > ? ? ? ?ConnString = "DSN=mysqldb", > > > > > >> > ? ? ? ?{ok, Conn} = odbc:connect(ConnString, []), > > > > > >> > ? ? ? ?[Results] = odbc:sql_query(Conn, "SELECT * FROM marks where > > > > id=1"), > > > > > >> > ? ? ? ?io:format("~p",[Results]), > > > > > >> > ? ? ? ?wf:flash([Results]), > > > > > >> > ?ok; > > > > > >> > event(_) -> ok. > > > > > > >> > but i am unable to get the output,Here continue is the postback for > > > > > >> > button,here what goes wrong? > > > > > > >> > I am getting output in my terminal is > > > > > > >> > =INFO REPORT==== 28-Mar-2010::21:56:22 === > > > > > >> > ERROR: error > > > > > >> > {badmatch,{selected,["id","tamil","english","maths","science"], > > > > > >> > ? ? ? ? ? ? ? ? ? ?[{1,45,55,67,89}]}} > > > > > >> > [{web_index,event,1}, > > > > > >> > ?{wf_handle_postback,run_module_event,2}, > > > > > >> > ?{wf_handle_postback,handle_normal_request,3}, > > > > > >> > ?{wf_inets,do,3}, > > > > > >> > ?{httpd_response,traverse_modules,2}, > > > > > >> > ?{httpd_response,generate_and_send_response,1}, > > > > > >> > ?{httpd_request_handler,handle_response,1}, > > > > > >> > ?{gen_server,handle_msg,5}] > > > > > > >> > id,tamil,english,maths,science are database fields.... > > > > > > >> > please help me > > > > > >> > as well as i wanna know how to flash the output that i retrieved > > > > from > > > > > >> > the database in my webpage.. > > > > > > >> > ________________________________________________________________ > > > > > >> > erlang-questions (at) erlang.org mailing list. > > > > > >> > Seehttp://www.erlang.org/faq.html > > > > > >> > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > > > > > >> -- > > > > > >> --Hynek (Pichi) Vychodil > > > > > > >> Analyze your data in minutes. Share your insights instantly. Thrill > > > > > >> your boss. ?Be a data hero! > > > > > >> Try GoodData now for free:www.gooddata.com > > > > > > >> ________________________________________________________________ > > > > > >> erlang-questions (at) erlang.org mailing list. > > > > > >> Seehttp://www.erlang.org/faq.html > > > > > >> To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > > > > > > ________________________________________________________________ > > > > > > erlang-questions (at) erlang.org mailing list. > > > > > > Seehttp://www.erlang.org/faq.html > > > > > > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > > > > > -- > > > > > --Hynek (Pichi) Vychodil > > > > > > Analyze your data in minutes. Share your insights instantly. Thrill > > > > > your boss. ?Be a data hero! > > > > > Try GoodData now for free:www.gooddata.com > > > > > > ________________________________________________________________ > > > > > erlang-questions (at) erlang.org mailing list. > > > > > Seehttp://www.erlang.org/faq.html > > > > > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > > > > ________________________________________________________________ > > > > erlang-questions (at) erlang.org mailing list. > > > > Seehttp://www.erlang.org/faq.html > > > > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > Seehttp://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > Seehttp://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED From magnus@REDACTED Tue Mar 30 12:12:44 2010 From: magnus@REDACTED (Magnus Henoch) Date: Tue, 30 Mar 2010 11:12:44 +0100 Subject: How to reduce the repetitious code in create mnesia table? In-Reply-To: (=?utf-8?B?IumSsQnmmZPmmI4iJ3M=?= message of "Tue, 30 Mar 2010 15:09:20 +0800") References: Message-ID: <84d3ym6rtv.fsf@linux-b2a3.site> ??? writes: > Is there any way I can do to reduce the repetitious code? I have > tried defining a new function accepting the name of record to do the same > thing above, but can not compile code because of record_info. You could do it with a macro. Something like: -define(CHECK_CREATE_TABLE(Name, Attrs), case mnesia:create_table(Name, [{attributes, record_info(fields, Name)}|Attrs]) of {atomic, ok} -> ok; {aborted, {already_exists, Name}} -> ok end). It's used like this: ?CHECK_CREATE_TABLE(user, [{disc_copies, DiscCopies}]), > By the way, I do not find the way to leave a function except using > throw/exit. Is there any way I can use to just leave current function, > replace the "throw" statement above? First of all, I'd suggest using erlang:error instead of throw. In my mind, "throw" is for flow control within a small set of related functions, while "erlang:error" is for error messages to whoever is listening. (Usually the supervisor and the error logger.) Back to your question. Mazen already explained how you can do this. I'll try to explain why you usually don't want to do it :) Failure to create a table is probably something that the calling function can't do anything about, so if the table creating function returns {error, something}, the calling function would have to detect that and return the same, and so on along the call stack until you reach a function that can do something about it - but then you've duplicated the functionality of Erlang errors _and_ supervisors. More often than not, you get what you want for free if you just signal errors and let the code crash. -- Magnus Henoch, magnus@REDACTED Erlang Solutions http://www.erlang-solutions.com/ --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From rvg@REDACTED Tue Mar 30 13:44:34 2010 From: rvg@REDACTED (Rudolph van Graan) Date: Tue, 30 Mar 2010 12:44:34 +0100 Subject: Mnesia transaction crash (locks and ______WHOLETABLE_____ ) Message-ID: <927BC978-9407-4CAE-9C51-69446E2BD905@patternmatched.com> Hi there, I think we've run into an old problem today http://forum.trapexit.org/viewtopic.php?t=4722&view=next&sid=0e6044c509dfd1cc0ecfcea8869079cb Basically all (transactional) writes to the table fails with the following error: {aborted,{badarg,[{ets,match_object, [58700001, {{locks,emr_user_permission,'______WHOLETABLE_____'}, write}]}, {mnesia_locker,need_lock,4}, {mnesia_locker,wlock,3}, {mnesia,write,5}, {gdb_enforcer,perform_write,6}, {gdb,'-wrap_exception_fun/1-fun-0-',1}, {mnesia_tm,apply_fun,3}, {mnesia_tm,execute_transaction,5}]}} dirty writes succeed, but the data is lost. And suggestions? Thanks, Rudolph -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2482 bytes Desc: not available URL: From mazen.harake@REDACTED Tue Mar 30 13:57:13 2010 From: mazen.harake@REDACTED (Mazen Harake) Date: Tue, 30 Mar 2010 13:57:13 +0200 Subject: [erlang-questions] Re: How to reduce the repetitious code in create mnesia table? In-Reply-To: <84d3ym6rtv.fsf@linux-b2a3.site> References: <84d3ym6rtv.fsf@linux-b2a3.site> Message-ID: <4BB1E719.6000608@erlang-solutions.com> On 30/03/2010 12:12, Magnus Henoch wrote: > ??? writes: > > >> Is there any way I can do to reduce the repetitious code? I have >> tried defining a new function accepting the name of record to do the same >> thing above, but can not compile code because of record_info. >> > You could do it with a macro. Something like: > > -define(CHECK_CREATE_TABLE(Name, Attrs), > case mnesia:create_table(Name, [{attributes, record_info(fields, Name)}|Attrs]) of > {atomic, ok} -> ok; > {aborted, {already_exists, Name}} -> ok > end). > > It's used like this: > > ?CHECK_CREATE_TABLE(user, [{disc_copies, DiscCopies}]), > > >> By the way, I do not find the way to leave a function except using >> throw/exit. Is there any way I can use to just leave current function, >> replace the "throw" statement above? >> > First of all, I'd suggest using erlang:error instead of throw. In my > mind, "throw" is for flow control within a small set of related > functions, while "erlang:error" is for error messages to whoever is > listening. (Usually the supervisor and the error logger.) > > Back to your question. Mazen already explained how you can do this. > I'll try to explain why you usually don't want to do it :) > > Failure to create a table is probably something that the calling > function can't do anything about, so if the table creating function > returns {error, something}, the calling function would have to detect > that and return the same, and so on along the call stack until you reach > a function that can do something about it - but then you've duplicated > the functionality of Erlang errors _and_ supervisors. More often than > not, you get what you want for free if you just signal errors and let > the code crash. > I agree with Magnus but just wanted to add one thing: Rollback. If you would want to "revert" some data written somewhere (or tmp tables created) if something goes wrong then catching is a good thing. This is why you *usually* do it like Magnus says (just let it crash) and sometimes catch it. More here: http://mazenharake.wordpress.com/2009/09/14/let-it-crash-the-right-way/ --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From icfp.publicity@REDACTED Tue Mar 30 14:33:21 2010 From: icfp.publicity@REDACTED (Wouter Swierstra) Date: Tue, 30 Mar 2010 14:33:21 +0200 Subject: ICFP 2010 deadline Message-ID: <53ff55481003300533s5cd3161ah5b461c153fd0596c@mail.gmail.com> On behalf of Stephanie Weirich, this year's PC Chair, I would like to emphasize that the deadline for ICFP this year is at *14:00 UTC*. You may want to double check what time this is using the following link: http://www.timeanddate.com/worldclock/fixedtime.html?day=2&month=4&year=2010&hour=14&min=0&sec=0&p1=0 Submission is already open through: http://icfp2010.seas.upenn.edu/ All the best, Wouter From dangud@REDACTED Tue Mar 30 14:42:23 2010 From: dangud@REDACTED (Dan Gudmundsson) Date: Tue, 30 Mar 2010 14:42:23 +0200 Subject: [erlang-questions] Mnesia transaction crash (locks and ______WHOLETABLE_____ ) In-Reply-To: <927BC978-9407-4CAE-9C51-69446E2BD905@patternmatched.com> References: <927BC978-9407-4CAE-9C51-69446E2BD905@patternmatched.com> Message-ID: <93df43b61003300542y663d0c0bp82e63d84f0af836e@mail.gmail.com> Looks like the transaction store (the ets table 58700001) have been deleted. /Dan On Tue, Mar 30, 2010 at 1:44 PM, Rudolph van Graan wrote: > Hi there, > I think we've run into an old problem today > http://forum.trapexit.org/viewtopic.php?t=4722&view=next&sid=0e6044c509dfd1cc0ecfcea8869079cb > > > Basically all (transactional) writes to the table fails with the following > error: > {aborted,{badarg,[{ets,match_object, > ?? ? ? ? ? ? ? ? ? ? ?[58700001, > ?? ? ? ? ? ? ? ? ? ? ? {{locks,emr_user_permission,'______WHOLETABLE_____'}, > ?? ? ? ? ? ? ? ? ? ? ? ?write}]}, > ?? ? ? ? ? ? ? ? {mnesia_locker,need_lock,4}, > ?? ? ? ? ? ? ? ? {mnesia_locker,wlock,3}, > ?? ? ? ? ? ? ? ? {mnesia,write,5}, > ?? ? ? ? ? ? ? ? {gdb_enforcer,perform_write,6}, > ?? ? ? ? ? ? ? ? {gdb,'-wrap_exception_fun/1-fun-0-',1}, > ?? ? ? ? ? ? ? ? {mnesia_tm,apply_fun,3}, > ?? ? ? ? ? ? ? ? {mnesia_tm,execute_transaction,5}]}} > > dirty writes succeed, but the data is lost. And suggestions? > Thanks, > Rudolph > > From ft@REDACTED Tue Mar 30 13:59:47 2010 From: ft@REDACTED (Fredrik Thulin) Date: Tue, 30 Mar 2010 13:59:47 +0200 Subject: dots in regexps Message-ID: <1269950387.20240.226.camel@ft-laptop.thulin.net> Hi This surprises me : 1> re:replace("123foobar456", ".*foo(...)", "foo\\1", [{return, list}]). "foobar456" I would have expected "foobar", because in my book a dot matches a single character. Adding .* after the parentheses gives me "foobar", but I don't think it should be necessary. 2> re:replace("123foobar456", ".*foo(...).*", "foo\\1", [{return, list}]). "foobar" Erlang R13B04 (erts-5.7.5) /Fredrik From dmercer@REDACTED Tue Mar 30 15:16:52 2010 From: dmercer@REDACTED (David Mercer) Date: Tue, 30 Mar 2010 08:16:52 -0500 Subject: [erlang-questions] dots in regexps In-Reply-To: <1269950387.20240.226.camel@ft-laptop.thulin.net> References: <1269950387.20240.226.camel@ft-laptop.thulin.net> Message-ID: <5AEBCFD882B240FF94F2180D3F45CEA2@SSI.CORP> On Tuesday, March 30, 2010, Fredrik Thulin wrote: > This surprises me : > > 1> re:replace("123foobar456", ".*foo(...)", "foo\\1", [{return, list}]). > "foobar456" > > I would have expected "foobar", because in my book a dot matches a > single character. > > Adding .* after the parentheses gives me "foobar", but I don't think it > should be necessary. > > 2> re:replace("123foobar456", ".*foo(...).*", "foo\\1", > [{return, list}]). > "foobar" Parts of the string that do not match the regexp are unaffected by re:replace, so are retained in the result. Your regexp ".*foo(...)" is matching the "123foobar" in "123foobar456". Replace it with whatever you like, the "456" will still be there. When you replace "123foobar" with "foo\\1" = "foobar", you still have the "456" tacked on. That is, "foobar" is replacing "123foobar", not the whole string. When you add the ".*" to the end of your regexp, it now matches the entire string, which is replaced with "foobar". Cheers, DBM From navaneethanit@REDACTED Tue Mar 30 15:27:53 2010 From: navaneethanit@REDACTED (NavaTux) Date: Tue, 30 Mar 2010 06:27:53 -0700 (PDT) Subject: Speciality to use erlang-mysql-driver Message-ID: Have you used erlang-mysql-driver? Have you found any speciality to use it? Is it awesome?makes job easy or how about performance perceptive? From ft@REDACTED Tue Mar 30 15:45:02 2010 From: ft@REDACTED (Fredrik Thulin) Date: Tue, 30 Mar 2010 15:45:02 +0200 Subject: [erlang-questions] dots in regexps In-Reply-To: <5AEBCFD882B240FF94F2180D3F45CEA2@SSI.CORP> References: <1269950387.20240.226.camel@ft-laptop.thulin.net> <5AEBCFD882B240FF94F2180D3F45CEA2@SSI.CORP> Message-ID: <1269956702.20240.346.camel@ft-laptop.thulin.net> On Tue, 2010-03-30 at 08:16 -0500, David Mercer wrote: ... > Parts of the string that do not match the regexp are unaffected by > re:replace, so are retained in the result. Thanks for explaining, it makes sense now. Silly me, since I know fully well that a new list is created, it seemed much more logical to me at the time that the \1 would only extract the three chars following "foo" and result in "foobar". /Fredrik From bob@REDACTED Tue Mar 30 16:11:23 2010 From: bob@REDACTED (Bob Ippolito) Date: Tue, 30 Mar 2010 07:11:23 -0700 Subject: [erlang-questions] dots in regexps In-Reply-To: <1269956702.20240.346.camel@ft-laptop.thulin.net> References: <1269950387.20240.226.camel@ft-laptop.thulin.net> <5AEBCFD882B240FF94F2180D3F45CEA2@SSI.CORP> <1269956702.20240.346.camel@ft-laptop.thulin.net> Message-ID: <6a36e7291003300711w9b2eeack3abc91ed81df1dfa@mail.gmail.com> On Tue, Mar 30, 2010 at 6:45 AM, Fredrik Thulin wrote: > On Tue, 2010-03-30 at 08:16 -0500, David Mercer wrote: > ... >> Parts of the string that do not match the regexp are unaffected by >> re:replace, so are retained in the result. > > Thanks for explaining, it makes sense now. > > Silly me, since I know fully well that a new list is created, it seemed > much more logical to me at the time that the \1 would only extract the > three chars following "foo" and result in "foobar". The \1 does only match the three chars following "foo", but the replace operation leaves all unmatched portions of the string as-is in the result. -bob From rumata-estor@REDACTED Tue Mar 30 16:35:26 2010 From: rumata-estor@REDACTED (Dmitry Belayev) Date: Tue, 30 Mar 2010 18:35:26 +0400 Subject: [erlang-questions] dots in regexps In-Reply-To: <5AEBCFD882B240FF94F2180D3F45CEA2@SSI.CORP> References: <1269950387.20240.226.camel@ft-laptop.thulin.net> <5AEBCFD882B240FF94F2180D3F45CEA2@SSI.CORP> Message-ID: <4BB20C2E.7030207@nm.ru> Then why first .* is greedy and last one is not? David Mercer wrote: > On Tuesday, March 30, 2010, Fredrik Thulin wrote: > > >> This surprises me : >> >> 1> re:replace("123foobar456", ".*foo(...)", "foo\\1", [{return, list}]). >> "foobar456" >> >> I would have expected "foobar", because in my book a dot matches a >> single character. >> >> Adding .* after the parentheses gives me "foobar", but I don't think it >> should be necessary. >> >> 2> re:replace("123foobar456", ".*foo(...).*", "foo\\1", >> [{return, list}]). >> "foobar" >> > > > Parts of the string that do not match the regexp are unaffected by > re:replace, so are retained in the result. > > Your regexp ".*foo(...)" is matching the "123foobar" in "123foobar456". > Replace it with whatever you like, the "456" will still be there. When you > replace "123foobar" with "foo\\1" = "foobar", you still have the "456" > tacked on. That is, "foobar" is replacing "123foobar", not the whole > string. When you add the ".*" to the end of your regexp, it now matches the > entire string, which is replaced with "foobar". > > Cheers, > > DBM > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > > From rumata-estor@REDACTED Tue Mar 30 16:40:07 2010 From: rumata-estor@REDACTED (Dmitry Belayev) Date: Tue, 30 Mar 2010 18:40:07 +0400 Subject: [erlang-questions] dots in regexps In-Reply-To: <4BB20C2E.7030207@nm.ru> References: <1269950387.20240.226.camel@ft-laptop.thulin.net> <5AEBCFD882B240FF94F2180D3F45CEA2@SSI.CORP> <4BB20C2E.7030207@nm.ru> Message-ID: <4BB20D47.9030505@nm.ru> Ahh, sorry, I read the problem and looked at the second example. Dmitry Belayev wrote: > > Then why first .* is greedy and last one is not? > > > David Mercer wrote: >> On Tuesday, March 30, 2010, Fredrik Thulin wrote: >> >> >>> This surprises me : >>> >>> 1> re:replace("123foobar456", ".*foo(...)", "foo\\1", [{return, >>> list}]). >>> "foobar456" >>> >>> I would have expected "foobar", because in my book a dot matches a >>> single character. >>> >>> Adding .* after the parentheses gives me "foobar", but I don't think it >>> should be necessary. >>> >>> 2> re:replace("123foobar456", ".*foo(...).*", "foo\\1", >>> [{return, list}]). >>> "foobar" >>> >> >> >> Parts of the string that do not match the regexp are unaffected by >> re:replace, so are retained in the result. >> >> Your regexp ".*foo(...)" is matching the "123foobar" in "123foobar456". >> Replace it with whatever you like, the "456" will still be there. >> When you >> replace "123foobar" with "foo\\1" = "foobar", you still have the "456" >> tacked on. That is, "foobar" is replacing "123foobar", not the whole >> string. When you add the ".*" to the end of your regexp, it now >> matches the >> entire string, which is replaced with "foobar". >> >> Cheers, >> >> DBM >> >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED >> >> >> > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From dmercer@REDACTED Tue Mar 30 16:41:51 2010 From: dmercer@REDACTED (David Mercer) Date: Tue, 30 Mar 2010 09:41:51 -0500 Subject: [erlang-questions] dots in regexps In-Reply-To: <4BB20C2E.7030207@nm.ru> References: <1269950387.20240.226.camel@ft-laptop.thulin.net> <5AEBCFD882B240FF94F2180D3F45CEA2@SSI.CORP> <4BB20C2E.7030207@nm.ru> Message-ID: <63E65A015472445D8B656CE7544A1514@SSI.CORP> On Tuesday, March 30, 2010, Dmitry Belayev wrote: > Then why first .* is greedy and last one is not? The last one *is* greedy. When he adds it into his regexp, it matches the entire rest of the string. Regexp ".*foo(...)" matches "123foobar". Regexp ".*foo(...).*" matches "123foobar456". From williamvdoorn@REDACTED Tue Mar 30 16:54:35 2010 From: williamvdoorn@REDACTED (William v Doorn) Date: Tue, 30 Mar 2010 16:54:35 +0200 Subject: erl_nif interface Message-ID: <6eb53c7e1003300754lcbee800vfd800b182e66363b@mail.gmail.com> Hello all, I'm pretty new to Erlang and decided to try out the erl_nif interface. I tried to make a simple counter, but I can't get it to work. It seems to go wrong at enif_make_int, where it seems to return the memory address instead of the integer itself. I've included these things in the paste: - C code using erl_nif - Erlang module - Interpreter session http://gist.github.com/348161 Thanks, William van Doorn From aleksey.eschenko@REDACTED Tue Mar 30 17:08:19 2010 From: aleksey.eschenko@REDACTED (Aleksey Eschenko) Date: Tue, 30 Mar 2010 18:08:19 +0300 Subject: [erlang-questions] erl_nif interface In-Reply-To: <6eb53c7e1003300754lcbee800vfd800b182e66363b@mail.gmail.com> References: <6eb53c7e1003300754lcbee800vfd800b182e66363b@mail.gmail.com> Message-ID: <5c6f8a091003300808v5d6a13e4v8f24baeeba7075c1@mail.gmail.com> static ERL_NIF_TERM increase(ErlNifEnv* env, ERL_NIF_TERM a1) should now be static ERL_NIF_TERM increase(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) See http://www.erlang.org/doc/man/erl_nif.html 2010/3/30 William v Doorn : > Hello all, > > I'm pretty new to Erlang and decided to try out the erl_nif interface. I > tried to make a simple counter, but I can't get it to work. It seems to go > wrong at enif_make_int, where it seems to return the memory address instead > of the integer itself. > > I've included these things in the paste: > > - C code using erl_nif > - Erlang module > - Interpreter session > > http://gist.github.com/348161 > > Thanks, > > William van Doorn > From kyleqian@REDACTED Tue Mar 30 17:12:47 2010 From: kyleqian@REDACTED (=?GB2312?B?x67P/sP3?=) Date: Tue, 30 Mar 2010 23:12:47 +0800 Subject: About mnesia in multi-nodes Message-ID: Hi, I create mnesia schema in 2 nodes successfully, and create tables with disc_copies option. After writing one record into one table, I close all erlang nodes. Then I restart one node, call mnesia:start(), use tv:start() to view records in that table, but I see none. If I start 2 nodes, I can see records. Is there any way I can make sure records wrote all nodes, so I can start my system when only one node runing? Thanks! From sverker@REDACTED Tue Mar 30 17:25:18 2010 From: sverker@REDACTED (Sverker Eriksson) Date: Tue, 30 Mar 2010 17:25:18 +0200 Subject: [erlang-questions] erl_nif interface In-Reply-To: <6eb53c7e1003300754lcbee800vfd800b182e66363b@mail.gmail.com> References: <6eb53c7e1003300754lcbee800vfd800b182e66363b@mail.gmail.com> Message-ID: <4BB217DE.1010408@erix.ericsson.se> Looks ok in case you are running R13B03. If you are running R13B04 then the NIFs should look like this with argc and argv (http://erlang.org/doc/man/erl_nif.html): static ERL_NIF_TERM increase(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) { int i; enif_get_int(env, argv[0], &i); PrivData* data = (PrivData*) enif_get_data(env); return enif_make_int(env, i); } A good practice is to always check the return value of enif_get_int and friends. I think that's what's happening in your case; enif_get_int fails and you return an integer term with whatever value that 'i' happens to get by default. /Sverker, Erlang/OTP Ericsson William v Doorn wrote: > Hello all, > > I'm pretty new to Erlang and decided to try out the erl_nif interface. I > tried to make a simple counter, but I can't get it to work. It seems to go > wrong at enif_make_int, where it seems to return the memory address instead > of the integer itself. > > I've included these things in the paste: > > - C code using erl_nif > - Erlang module > - Interpreter session > > http://gist.github.com/348161 > > Thanks, > > William van Doorn > > From sverker@REDACTED Tue Mar 30 18:06:26 2010 From: sverker@REDACTED (Sverker Eriksson) Date: Tue, 30 Mar 2010 18:06:26 +0200 Subject: [erlang-questions] problem when use g++ to compile erl_nif In-Reply-To: References: <4BB19B71.6060706@lightpole.net> Message-ID: <4BB22182.7050509@erix.ericsson.se> @caox: The important thing is that both #include "erl_nif.h" and ERL_NIF_INIT are within export "C" {}. I will put some #ifdef __cplusplus in erl_nif.h for next release to make it more convenient for C++ users. By your compile error, it looks like you are running R13B03. I would recommend R13B04, even though you might get that to work with some (void*) casting at the right place. @Dave: Nice bloom filter. A performance tip is to do enif_make_atom's and store in static variables at load. Atom terms are allowed to be kept between calls. /Sverker, Erlang/OTP Ericsson Dave Smith wrote: > Take a look at the ebloom project: > > http://hg.basho.com/ebloom/ > > That's a NIF which wraps a C++ header-style bloom filter. > > Bottom line, you need to include erl_nif.h in a separate header and > then make sure that all the stuff required by erlang happens in a > extern "C" section. > > D. > > On Tue, Mar 30, 2010 at 12:34 AM, caox wrote: > >> I am trying to use erl_nif to implement some drivers.And I am wondering if >> there is any way to compile nif files with g++, just like what >> >> #ifdef __cplusplus >> extern "C" { // shouldn't this be in the DRIVER_INIT macro? >> #endif >> DRIVER_INIT(template_drv) { >> return &template_drv_entry; >> } >> #ifdef __cplusplus >> } >> #endif >> >> can do for erl_driver. In that way, it will be more convenient to code with >> c++ libs. >> But now, I got an error when using g++ to run the example with OTPR1303: >> >> g++ -shared -fpic -ldl -I/usr/lib64/erlang/usr/include -I/usr/include >> -I/usr/lib64/erlang/lib/erl_interface-3.6.4/include >> -I/mnt/hgfs/work/ewp_new_trunk/drivers/template >> -I/mnt/hgfs/work/vendor/clearsilver-0.10.5 -o ./priv/niftest.so >> c_src/niftest.c -L/usr/lib64/erlang/lib/erl_interface-3.6.4/lib >> -L/usr/lib64/erlang/usr/lib -lei -lxerces-c -lxqilla >> -L/mnt/hgfs/work/vendor/clearsilver-0.10.5/libs -lneo_cs -lneo_cgi >> -lneo_utl >> c_src/niftest.c:28: error: invalid conversion from ?ERL_NIF_TERM >> (*)(ErlNifEnv*)? to ?void*? >> make: *** [nif] Er/ >> >> Appreciate your help. >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED >> >> >> > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > > From ulf.wiger@REDACTED Tue Mar 30 18:45:33 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Tue, 30 Mar 2010 18:45:33 +0200 Subject: [erlang-questions] The erlang baby and the green JVM In-Reply-To: <5287075483C24C4D87E0BA93CFADE093@SSI.CORP> References: <466fba8d1003271202h74ae19b5gbeb49cd1c5cdf696@mail.gmail.com> <4bae685a.091abc0a.1f68.6a4dSMTPIN_ADDED@mx.google.com> <3dbc6d1c1003271345r3d87e054y5221452315121107@mail.gmail.com> <5287075483C24C4D87E0BA93CFADE093@SSI.CORP> Message-ID: <4BB22AAD.7020104@erlang-solutions.com> David Mercer wrote: > My favorite line: > > "A lot of the fault tolerance aspects of Erlang come from people trying to > work around Joe's buggy VM." This took on a whole new meaning at the SF Erlang Factory, as Kresten Krab Thorup ("Kresten Krarup"?) demonstrated how Erlang produced nice error reports when calling not-yet-implemented BIFs in the Erjang VM. Erlang code is in fact tolerant of bugs in the VM. :) BR, Ulf W -- Ulf Wiger CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd http://www.erlang-solutions.com --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From ulf.wiger@REDACTED Tue Mar 30 18:58:06 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Tue, 30 Mar 2010 18:58:06 +0200 Subject: [erlang-questions] Re: How to reduce the repetitious code in create mnesia table? In-Reply-To: <84d3ym6rtv.fsf@linux-b2a3.site> References: <84d3ym6rtv.fsf@linux-b2a3.site> Message-ID: <4BB22D9E.30104@erlang-solutions.com> Magnus Henoch wrote: > ??? writes: > >> Is there any way I can do to reduce the repetitious code? I have >> tried defining a new function accepting the name of record to do the same >> thing above, but can not compile code because of record_info. > > You could do it with a macro. Something like: > > -define(CHECK_CREATE_TABLE(Name, Attrs), > case mnesia:create_table(Name, [{attributes, record_info(fields, Name)}|Attrs]) of > {atomic, ok} -> ok; > {aborted, {already_exists, Name}} -> ok > end). Having spent far too much time digging into mnesia internals, I prefer to do it this way: mktab(Name, Opts) -> mnesia_schema:do_create_table( mnesia_schema:list2cs([{name,Name}|Opts])). mnesia_schema:schema_transaction( fun() -> mktab(t1, [{disc_copies, ...},...]), mktab(t2, [{ram_copies, ...},...]), ... end) No need for lots of checks, and all tables are created, or none are, which is usually what you want. And, no, this isn't documented. BR, Ulf W -- Ulf Wiger CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd http://www.erlang-solutions.com --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From williamvdoorn@REDACTED Tue Mar 30 19:14:56 2010 From: williamvdoorn@REDACTED (William v Doorn) Date: Tue, 30 Mar 2010 19:14:56 +0200 Subject: Memory management using erl_nif Message-ID: <6eb53c7e1003301014y6bc90cfag61373457da77725d@mail.gmail.com> Hello again, First of all; sorry for my second question today, but I just can't get my head around it. I'm trying to write a simple pair of functions; one sets the binary, the other returns it. However it crashes at the get part. erl.exe crashes when trying to do niftest:get(). Here is the source: http://gist.github.com/349316 Thanks, William van Doorn From dave.smith.to@REDACTED Tue Mar 30 19:23:55 2010 From: dave.smith.to@REDACTED (Dave Smith) Date: Tue, 30 Mar 2010 13:23:55 -0400 Subject: fun question... Message-ID: <5ea453f91003301023n6f3cfcecvd638f25d941fe7d5@mail.gmail.com> I have a scenario where I have a atom bound to a variable, and I want to construct a fun using this variable as the module name. This is what I have... encode(CodecModule, CodePoints) when is_atom(CodecModule) -> encode(*fun(C) -> CodecModule:endode(C) end*, CodePoints); encode(EncodeFn, CodePoints) -> {ok, list_to_binary(lists:map(EncodeFn, CodePoints))}. This works fine, but I was expecting to be able to something like this... encode(CodecModule, CodePoints) when is_atom(CodecModule) -> encode(*fun CodecModule:endode/1*, CodePoints); encode(EncodeFn, CodePoints) -> {ok, list_to_binary(lists:map(EncodeFn, CodePoints))}. I can call the function directly using the variable like this... Bin = CodecModule:encode(CodePt). So I was expecting this to work... EncFn = fun CodecModule:encode/1. Can someone clarify? Is this second form expanded at compiled time? Is the first example above the best approach? --DS From fritchie@REDACTED Tue Mar 30 19:41:38 2010 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Tue, 30 Mar 2010 12:41:38 -0500 Subject: [erlang-questions] Erlang Event Loop Question In-Reply-To: Message of "Mon, 22 Mar 2010 14:07:11 EDT." Message-ID: <62046.1269970898@snookles.snookles.com> Evans, Matthew wrote: me> I'm hoping that this got missed because I sent it on a Friday me> afternoon. As far as I can tell, looking at my own archive of erlang-questions traffic and the Google Groups archive, your question still doesn't have any followups. I'd been on the road last night, both for work-work and for the Erlang Factory conference, so this followup is over a full week later than Matthew probably wished. Assuming you've already been down the paths suggested below... ... time to invoke help for the Ericsson OTP team. Hello? :-) The OTP folks who'd travelled to California are probably still jetlagged from their return home. Looking at the archive for past postings, it looks like you're already aware of the end/bottom of the "ErlDrvEntry" structure. Fiddling with those items "correctly" is suppose to help play nicely with the SMP scheduler(*). If you're still in doubt, posting some code excerpts to the list would be helpful. me> If someone knows how to benchmark this it'll be great (I tried a me> simple echo - server type application, but that'll include network me> slowness too)... If you haven't fiddled with during on & off the SMP scheduler entirely to see if behavior changes significantly, it's probably worth trying. Also, assuming you have a build that supports poll/epoll/kqueue, then enabling & disabling via "+K enable/disable" could also be useful. me> I'm wondering about the inner workings of the Erlang event loop. Is me> the event loop single threaded? me> We have a service (the VM has epoll enabled) that is doing a lot of me> TCP (HTTP) ingesting and parsing of large files (25MB of data or me> more per second). It is also doing a lot of IPC, both to other me> Erlang nodes, and via a proprietary transport to C++ me> applications. We currently support two methods to ingest these me> files: straight TCP (gen_tcp), and a specialized linked-in driver me> (which passes the epoll socket to the Erlang event loop with me> driver_select and passes the driver-created socket to gen_tcp; we me> also have a pool of threads for this driver). If your gen_tcp code is reading a single (or very small number) of binaries (not lists), then passing it/them into a driver via binaries should be quite quick. Using lists with that much data will be slower... though not as slow as one might think.(**) me> My concern is that under load the event loop is getting very busy me> resulting in time-sensitive IPC messages getting delayed/slowed me> down. If your driver is inadvertantly blocking the VM's scheduler(s), then you're in for a serious problem. If using a large number of schedulers helps, e.g. "+S 32" on a dual- or quad-core box, then your driver might be the culprit. The "percept" app can be helpful in finding causes of scheduling bursts and lulls. If you haven't subscribed to system events via the erlang:system_monitor/1,2 BIF, then now is the time to do it. If the TCP connection between node A and node B is congested, then *any and all processes* on A that tries to send a message to B will be blocked/unscheduled. The events from the system_monitor are the only way I know of to be able to see if/when that's happening to you. Other suggestions are more speculation than anything else. If you're using the I/O worker pool that's created with the "erl +A" flag, then you may be bitten by the port -> thread mapping algorithm that the VM uses: IIRC it is still possible to be forced to wait for certain I/O worker pool threads while others are completely idle. The Berkeley DB driver for Erlang, developed by Chris Newcombe, created & managed its own Pthread pool to avoid interacting badly with the VM's Pthreads, both scheduler threads and I/O worker threads. -Scott (*) I don't have direct experience with them, sorry, so I can't offer much advice beyond what the docs say. But others on the list certainly do. (**) Way back in my Sendmail, Inc. days, using the Erlang/OTP R6B release, we had an Erlang app using "inefficient", list-based I/O for bulk data transfers that performed on par with a hand-coded C program that took pains to be efficient both in terms of memory management and data copying. The Erlang VM has improved enormously since then. From sverker@REDACTED Tue Mar 30 19:52:51 2010 From: sverker@REDACTED (Sverker Eriksson) Date: Tue, 30 Mar 2010 19:52:51 +0200 Subject: [erlang-questions] Memory management using erl_nif In-Reply-To: <6eb53c7e1003301014y6bc90cfag61373457da77725d@mail.gmail.com> References: <6eb53c7e1003301014y6bc90cfag61373457da77725d@mail.gmail.com> Message-ID: <4BB23A73.1050104@erix.ericsson.se> I think you are trying to do something that is not currently possible, that is keeping a reference to a read-only binary between NIF calls. Only writable binaries obtained from enif_alloc_binary can be kept between calls. But as soon as you make terms out of them, they get read-only and in total control of the VM (garbage collector). The only way to keep an inspected binary is to copy the content into a raw buffer or a writable binary. /Sverker, Erlang/OTP William v Doorn wrote: > Hello again, > > First of all; sorry for my second question today, but I just can't get my > head around it. I'm trying to write a simple pair of functions; one sets the > binary, the other returns it. However it crashes at the get part. erl.exe > crashes when trying to do niftest:get(). > > Here is the source: > > http://gist.github.com/349316 > > Thanks, > > William van Doorn > > From fritchie@REDACTED Tue Mar 30 19:58:26 2010 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Tue, 30 Mar 2010 12:58:26 -0500 Subject: [erlang-questions] Re: Supervisors as factories *and* registries In-Reply-To: Message of "Tue, 23 Mar 2010 11:09:53 PDT." Message-ID: <62966.1269971906@snookles.snookles.com> This was a thread from last week, sorry I didn't read it sooner. Jay Nelson wrote: jn> Supervisor should have the following goals: jn> [...] jn> 3) Minimal functionality and API so that programmer error is less jn> likely I just wanted to add something to this point. An unstated reason for the minimal 'supervisor' API is that it also needs to be responsive/fast. If you have a supervisor that's responsible for a lot of children, you don't want communication with that supervisor to timeout while it's simultaneously managing its children. One way to simulate this is to have gen_server-based workers that each take multiple seconds to execute their init() callback. IIRC the supervisor is blocked waiting for that. With lots of children and slow child startup, and then if the supervisor is responsible for doing even more stuff, then it's possible for the supervisor to fail to start at all. Such a failure defeats the purpose of using 'supervisor' behavior. Ericsson's collective experience in this area greatly exceeds mine, and even I've been bitten by supervisors failing when asked to do too much. The 'supervisor' simplicity probably isn't a matter of, "Less is more", it's more like, "Less is necessary." Having said that ... there's no reason why you can't roll your own behaviors. How many behaviors are part of OTP? Five? And OTP has been around for well over 10 years now? One of the goals behind OTP behaviors is to foster good code amongst large development teams. Open source development certainly qualifies. If we find more design patterns that others find useful, then they should be let loose onto the world. -Scott From enewhuis@REDACTED Wed Mar 31 03:40:17 2010 From: enewhuis@REDACTED (Eric Newhuis) Date: Tue, 30 Mar 2010 20:40:17 -0500 Subject: The "idle-time" gen_server Pattern Message-ID: I've been experimenting with using the handle_info(timeout, State) callback. Push lots of crud into State by way of handle_call, handle_cast, and always return {(no)reply, State, Timeout} where Timeout = 0. Then do CPU-bound processing in handle_info(timeout... This causes handle_info(timeout...) to be called only when the message queue is empty. Assumption: handle_call/cast simply append work to do and a single algorithm is more efficient if it knows there are many queued items. Has anyone tried this? Any hints? Gotchas? I am theoretically aware (?) of the possibility of starvation. But what else? From navaneethanit@REDACTED Wed Mar 31 06:29:07 2010 From: navaneethanit@REDACTED (NavaTux) Date: Tue, 30 Mar 2010 21:29:07 -0700 (PDT) Subject: Is any possibility to know the mean of the error and mean of each function Message-ID: <589ac12b-9060-4c34-9cd1-e504c94a261b@u22g2000yqf.googlegroups.com> Here whenever i use i get lot of errors,bad record ,undef etc...as well as i have lot of functions like wf,wf_path,wf_flash etc if i get to know which type of arguments will be passed inside each module?where it ll be used ??those informations that ll be very useful to me as well as need to know what kind of errors occurred? From navaneethanit@REDACTED Wed Mar 31 08:51:40 2010 From: navaneethanit@REDACTED (NavaTux) Date: Tue, 30 Mar 2010 23:51:40 -0700 (PDT) Subject: odbc missed how to get it again?? Message-ID: <74dbaff1-ca9f-4973-add7-3ff9b53b627e@c34g2000pri.googlegroups.com> application:start(odbc). {error,{"no such file or directory","odbc.app"}} (nitrogen@REDACTED)2> I newly upgraded my erlang otp asked by some one,but after that when i give application:start(odbc) .....it shows above one Is any way to copy those file only inside the otp directory to work odbc? or i need to install again it fresh otp??? please clarify friends From bgustavsson@REDACTED Wed Mar 31 08:59:00 2010 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Wed, 31 Mar 2010 08:59:00 +0200 Subject: [erlang-questions] fun question... In-Reply-To: <5ea453f91003301023n6f3cfcecvd638f25d941fe7d5@mail.gmail.com> References: <5ea453f91003301023n6f3cfcecvd638f25d941fe7d5@mail.gmail.com> Message-ID: On Tue, Mar 30, 2010 at 7:23 PM, Dave Smith wrote: > So I was expecting this to work... > EncFn = fun ?CodecModule:encode/1. > It currently does not work, but it might in a future release. There is an EEP: http://www.erlang.org/eeps/eep-0023.html Before that EEP is implemented, you can use erlang:make_fun(Mod, Name, Arity) to create a fun. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From navaneethanit@REDACTED Wed Mar 31 09:08:34 2010 From: navaneethanit@REDACTED (NavaTux) Date: Wed, 31 Mar 2010 00:08:34 -0700 (PDT) Subject: odbc missed how to get it again?? In-Reply-To: <74dbaff1-ca9f-4973-add7-3ff9b53b627e@c34g2000pri.googlegroups.com> References: <74dbaff1-ca9f-4973-add7-3ff9b53b627e@c34g2000pri.googlegroups.com> Message-ID: http://www.erlang.org/cgi-bin/ezmlm-cgi/4/40693 This helped me, then again when i load my application i got this error frequently what does mean that? =INFO REPORT==== 31-Mar-2010::12:33:21 === ERROR: error undef [{odbc,connect,["DSN=mysqldb",[]]}, {web_index,event,1}, {wf_handle_postback,run_module_event,2}, {wf_handle_postback,handle_normal_request,3}, {wf_inets,do,3}, {httpd_response,traverse_modules,2}, {httpd_response,generate_and_send_response,1}, {httpd_request_handler,handle_response,1}] where is the problem? On Mar 31, 11:51?am, NavaTux wrote: > application:start(odbc). > {error,{"no such file or directory","odbc.app"}} > (nitrogen@REDACTED)2> > > I newly upgraded my erlang otp asked by some one,but after that when i > give application:start(odbc) .....it shows above one > > Is any way to copy those file only inside the otp directory to work > odbc? or i need to install again it fresh otp??? > > please clarify friends > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > Seehttp://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED From caox@REDACTED Wed Mar 31 09:25:25 2010 From: caox@REDACTED (caox) Date: Wed, 31 Mar 2010 15:25:25 +0800 Subject: error msg in http:request Message-ID: <4BB2F8E5.3010305@lightpole.net> After updated erlang version to R13B04, I found unexpected error messages prompted when using http:request to call an invalid URL. Is this reasonable? (ewp@REDACTED)1> Url="http://127.0.0.1:3002/mobilebank/srvStatus.jsp". "http://127.0.0.1:3002/mobilebank/srvStatus.jsp" (ewp@REDACTED)2> http:request(Url). {error,{error,{connect_failed,{#Ref<0.0.0.271>, {error,econnrefused}}}}} (ewp@REDACTED)3> =ERROR REPORT==== 31-Mar-2010::14:39:49 === ** Generic server <0.103.0> terminating ** Last message in was {connect_and_send, {request,#Ref<0.0.0.271>,<0.44.0>,0,http, {"127.0.0.1",3002}, "/mobilebank/srvStatus.jsp",[],get, {http_request_h,undefined,"keep-alive", undefined,undefined,undefined,undefined, undefined,undefined,undefined,undefined, undefined,undefined,undefined,undefined, undefined,undefined,"127.0.0.1:3002", undefined,undefined,undefined,undefined, undefined,undefined,undefined,undefined, undefined,[],undefined,undefined,undefined, undefined,"0",undefined,undefined, undefined,undefined,undefined,undefined,[]}, {[],[]}, {http_options,"HTTP/1.1",infinity,true,[], undefined,false,infinity}, "http://127.0.0.1:3002/mobilebank/srvStatus.jsp", [],none,[],1270017589276,undefined,undefined}} ** When Server state == {state, {request,#Ref<0.0.0.271>,<0.44.0>,0,http, {"127.0.0.1",3002}, "/mobilebank/srvStatus.jsp",[],get, {http_request_h,undefined,"keep-alive", undefined,undefined,undefined,undefined, undefined,undefined,undefined,undefined, undefined,undefined,undefined,undefined, undefined,undefined,"127.0.0.1:3002", undefined,undefined,undefined,undefined, undefined,undefined,undefined,undefined, undefined,[],undefined,undefined, undefined,undefined,"0",undefined, undefined,undefined,undefined,undefined, undefined,[]}, {[],[]}, {http_options,"HTTP/1.1",infinity,true,[], undefined,false,infinity}, "http://127.0.0.1:3002/mobilebank/srvStatus.jsp", [],none,[],1270017589276,undefined,undefined}, undefined,undefined,undefined,undefined,undefined, {[],[]}, {[],[]}, undefined,[],nolimit,nolimit, {options, {undefined,[]}, 0,2,5,120000,2,disabled,false,inet,default, default,[]}, {timers,[],undefined}, httpc_manager,undefined} ** Reason for termination == ** {error,{connect_failed,{#Ref<0.0.0.271>,{error,econnrefused}}}} =ERROR REPORT==== 31-Mar-2010::14:39:49 === HTTPC-MANAGER handler (<0.103.0>, started) failed to connect and/or send request #Ref<0.0.0.271> Result: {error,{connect_failed,{#Ref<0.0.0.271>,{error,econnrefused}}}} From mazen.harake@REDACTED Wed Mar 31 09:27:43 2010 From: mazen.harake@REDACTED (Mazen Harake) Date: Wed, 31 Mar 2010 09:27:43 +0200 Subject: [erlang-questions] Re: How to reduce the repetitious code in create mnesia table? In-Reply-To: <4BB22D9E.30104@erlang-solutions.com> References: <84d3ym6rtv.fsf@linux-b2a3.site> <4BB22D9E.30104@erlang-solutions.com> Message-ID: <4BB2F96F.6080200@erlang-solutions.com> On 30/03/2010 18:58, Ulf Wiger wrote: > And, no, this isn't documented. That's cheating :) --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From mail@REDACTED Wed Mar 31 10:48:03 2010 From: mail@REDACTED (Tim Fletcher) Date: Wed, 31 Mar 2010 01:48:03 -0700 (PDT) Subject: keeping gen_server2 optional Message-ID: More projects are starting to "bundle" gen_server2, e.g., http://github.com/cstar/erldis/blob/master/src/gen_server2.erl http://github.com/erlyvideo/erlyvideo/blob/master/src/gen_server2.erl http://hg.basho.com/riak/src/tip/apps/riak/src/gen_server2.erl I don't dispute the benefits of the gen_server2 changes, but library developers shouldn't have to include it in every project, and application developers/users should have the freedom to choose whether to use it (or not). >From what I can tell (using diff), gen_server2 makes no changes to the gen_server API, in which case gen_server:call etc should work just fine with gen_server2 processes, and there is no benefit in changing these references to gen_server2:call etc. Is this correct? The stdlib gen_server implementation can be completely replaced at load time using another module with the same name. Using gen_server2 selectively may require a little more work, but should just involve changing gen_server:start_link calls to gen_server2:start_link. Should this just be left to the end application developer? More generally, is there a "recommended" mechanism for providing alternate implementations of a module whilst keeping the same interface? From mark.fine@REDACTED Wed Mar 31 11:17:30 2010 From: mark.fine@REDACTED (Mark Fine) Date: Wed, 31 Mar 2010 02:17:30 -0700 Subject: [erlang-questions] Supervisors as factories *and* registries In-Reply-To: References: Message-ID: Probably everyone's done this at least once, but I played around with redoing supervisor.erl to provide a which_child() API and to remove restrictions on dynamically adding various types of children -- http://github.com/mfine/manager. On Mon, Mar 22, 2010 at 9:34 AM, Garrett Smith wrote: > I've gotten into the habit of using supervisors as factories and > really like the pattern. I think it's clean to delegate process life > cycle to supervisors, since that's what they're there for. So far so > good, with one big exception... > > As factories, supervisors are also a logical candidate as registries. > supervisor:which_children, for example, is a brute force way to get at > the processes under supervision. > > Bit I need a finer grained interface to supervised children. I wish > supervisors exposed state the way gen_server does, in which case I > could maintain an index (for example) that would let me access > children more efficiently. (This seems like a conspicuously missing > feature, but there's probably a good reason for it.) > > Is there a recommended pattern for this sort of thing? To summarize > what I'm looking for: > > - Wrap calls to supervisor:start_child in a factory function for processes > - Provide a lookup interface to supervised children that doesn't rely > on a linear scan of supervisor:which_children(Sup) > > I could obviously maintain a separate process as a registry, but I'd > prefer to avoid the sync/link/cleanup overhead associated with that. > I'd be okay with hacking supervisor (create a supervisor2?), but I > haven't explored that option. > > Garrett > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From gleber.p@REDACTED Wed Mar 31 11:19:10 2010 From: gleber.p@REDACTED (Gleb Peregud) Date: Wed, 31 Mar 2010 11:19:10 +0200 Subject: [erlang-questions] error msg in http:request In-Reply-To: <4BB2F8E5.3010305@lightpole.net> References: <4BB2F8E5.3010305@lightpole.net> Message-ID: I don't think it is a bug. Looks like it is trying to connect to 127.0.0.1:3002 but TCP connection is being refused by a server. Try running `nmap -p 3002 127.0.0.1` and check if the port is indeed open. On Wed, Mar 31, 2010 at 09:25, caox wrote: > After updated erlang version to R13B04, I found unexpected error messages > prompted when using http:request to call an invalid URL. Is this reasonable? > > (ewp@REDACTED)1> Url="http://127.0.0.1:3002/mobilebank/srvStatus.jsp". > "http://127.0.0.1:3002/mobilebank/srvStatus.jsp" > (ewp@REDACTED)2> http:request(Url). > {error,{error,{connect_failed,{#Ref<0.0.0.271>, > {error,econnrefused}}}}} > (ewp@REDACTED)3> > =ERROR REPORT==== 31-Mar-2010::14:39:49 === > ** Generic server <0.103.0> terminating > ** Last message in was {connect_and_send, > {request,#Ref<0.0.0.271>,<0.44.0>,0,http, > {"127.0.0.1",3002}, > "/mobilebank/srvStatus.jsp",[],get, > {http_request_h,undefined,"keep-alive", > undefined,undefined,undefined,undefined, > undefined,undefined,undefined,undefined, > undefined,undefined,undefined,undefined, > undefined,undefined,"127.0.0.1:3002", > undefined,undefined,undefined,undefined, > undefined,undefined,undefined,undefined, > > undefined,[],undefined,undefined,undefined, > undefined,"0",undefined,undefined, > > undefined,undefined,undefined,undefined,[]}, > {[],[]}, > {http_options,"HTTP/1.1",infinity,true,[], > undefined,false,infinity}, > "http://127.0.0.1:3002/mobilebank/srvStatus.jsp", > > [],none,[],1270017589276,undefined,undefined}} > ** When Server state == {state, > {request,#Ref<0.0.0.271>,<0.44.0>,0,http, > {"127.0.0.1",3002}, > "/mobilebank/srvStatus.jsp",[],get, > {http_request_h,undefined,"keep-alive", > undefined,undefined,undefined,undefined, > undefined,undefined,undefined,undefined, > undefined,undefined,undefined,undefined, > undefined,undefined,"127.0.0.1:3002", > undefined,undefined,undefined,undefined, > undefined,undefined,undefined,undefined, > undefined,[],undefined,undefined, > undefined,undefined,"0",undefined, > undefined,undefined,undefined,undefined, > undefined,[]}, > {[],[]}, > {http_options,"HTTP/1.1",infinity,true,[], > undefined,false,infinity}, > "http://127.0.0.1:3002/mobilebank/srvStatus.jsp", > > [],none,[],1270017589276,undefined,undefined}, > > undefined,undefined,undefined,undefined,undefined, > {[],[]}, > {[],[]}, > undefined,[],nolimit,nolimit, > {options, > {undefined,[]}, > 0,2,5,120000,2,disabled,false,inet,default, > default,[]}, > {timers,[],undefined}, > httpc_manager,undefined} > ** Reason for termination == > ** {error,{connect_failed,{#Ref<0.0.0.271>,{error,econnrefused}}}} > > =ERROR REPORT==== 31-Mar-2010::14:39:49 === > HTTPC-MANAGER handler (<0.103.0>, started) failed to connect > and/or send request #Ref<0.0.0.271> > Result: {error,{connect_failed,{#Ref<0.0.0.271>,{error,econnrefused}}}} > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From caox@REDACTED Wed Mar 31 11:27:14 2010 From: caox@REDACTED (caox) Date: Wed, 31 Mar 2010 17:27:14 +0800 Subject: [erlang-questions] error msg in http:request In-Reply-To: References: <4BB2F8E5.3010305@lightpole.net> Message-ID: The request URL was indeed invalid, as I referred. But I am just wondering whether a common request failure should cause a server process to shutdown. ? 2010-3-31???5:19? Gleb Peregud ??? > I don't think it is a bug. Looks like it is trying to connect to > 127.0.0.1:3002 but TCP connection is being refused by a server. Try > running `nmap -p 3002 127.0.0.1` and check if the port is indeed open. > > On Wed, Mar 31, 2010 at 09:25, caox wrote: > After updated erlang version to R13B04, I found unexpected error > messages prompted when using http:request to call an invalid URL. Is > this reasonable? > > (ewp@REDACTED)1> Url="http://127.0.0.1:3002/mobilebank/srvStatus.jsp". > "http://127.0.0.1:3002/mobilebank/srvStatus.jsp" > (ewp@REDACTED)2> http:request(Url). > {error,{error,{connect_failed,{#Ref<0.0.0.271>, > {error,econnrefused}}}}} > (ewp@REDACTED)3> > =ERROR REPORT==== 31-Mar-2010::14:39:49 === > ** Generic server <0.103.0> terminating > ** Last message in was {connect_and_send, > {request,#Ref<0.0.0.271>,<0.44.0>,0,http, > {"127.0.0.1",3002}, > "/mobilebank/srvStatus.jsp",[],get, > {http_request_h,undefined,"keep-alive", > > undefined,undefined,undefined,undefined, > > undefined,undefined,undefined,undefined, > > undefined,undefined,undefined,undefined, > > undefined,undefined,"127.0.0.1:3002", > > undefined,undefined,undefined,undefined, > > undefined,undefined,undefined,undefined, > undefined, > [],undefined,undefined,undefined, > undefined,"0",undefined,undefined, > > undefined,undefined,undefined,undefined,[]}, > {[],[]}, > {http_options,"HTTP/1.1",infinity,true, > [], > undefined,false,infinity}, > "http://127.0.0.1:3002/mobilebank/srvStatus.jsp", > [],none,[], > 1270017589276,undefined,undefined}} > ** When Server state == {state, > {request,#Ref<0.0.0.271>,<0.44.0>,0,http, > {"127.0.0.1",3002}, > "/mobilebank/srvStatus.jsp",[],get, > {http_request_h,undefined,"keep-alive", > > undefined,undefined,undefined,undefined, > > undefined,undefined,undefined,undefined, > > undefined,undefined,undefined,undefined, > > undefined,undefined,"127.0.0.1:3002", > > undefined,undefined,undefined,undefined, > > undefined,undefined,undefined,undefined, > undefined,[],undefined,undefined, > undefined,undefined,"0",undefined, > > undefined,undefined,undefined,undefined, > undefined,[]}, > {[],[]}, > {http_options,"HTTP/ > 1.1",infinity,true,[], > undefined,false,infinity}, > "http://127.0.0.1:3002/mobilebank/srvStatus.jsp", > [],none,[], > 1270017589276,undefined,undefined}, > > undefined,undefined,undefined,undefined,undefined, > {[],[]}, > {[],[]}, > undefined,[],nolimit,nolimit, > {options, > {undefined,[]}, > > 0,2,5,120000,2,disabled,false,inet,default, > default,[]}, > {timers,[],undefined}, > httpc_manager,undefined} > ** Reason for termination == > ** {error,{connect_failed,{#Ref<0.0.0.271>,{error,econnrefused}}}} > > =ERROR REPORT==== 31-Mar-2010::14:39:49 === > HTTPC-MANAGER handler (<0.103.0>, started) failed to > connect and/or send request #Ref<0.0.0.271> > Result: {error,{connect_failed,{#Ref<0.0.0.271>, > {error,econnrefused}}}} > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From als@REDACTED Wed Mar 31 11:16:34 2010 From: als@REDACTED (Anthony Shipman) Date: Wed, 31 Mar 2010 20:16:34 +1100 Subject: [erlang-questions] How to reduce the repetitious code in create mnesia table? In-Reply-To: References: Message-ID: <201003312016.34958.als@iinet.net.au> On Tue, 30 Mar 2010 06:09:20 pm ??? wrote: > Is there any way I can do to reduce the repetitious code? I have > tried defining a new function accepting the name of record to do the same > thing above, but can not compile code because of record_info. Pass in two arguments, the name of the table and its record_info. -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From rtrlists@REDACTED Wed Mar 31 13:07:49 2010 From: rtrlists@REDACTED (Robert Raschke) Date: Wed, 31 Mar 2010 12:07:49 +0100 Subject: [erlang-questions] Re: odbc missed how to get it again?? In-Reply-To: References: <74dbaff1-ca9f-4973-add7-3ff9b53b627e@c34g2000pri.googlegroups.com> Message-ID: That error means that odbc:connect/2 is not defined (undef). Are you sure you have a proper Erlang installation? It somehow looks as if your odbc app hasn't been built properly. So, even if you point your path at the odbc folder, if you don't have any BEAM files there, you won't be running it. Robby On Wed, Mar 31, 2010 at 8:08 AM, NavaTux wrote: > http://www.erlang.org/cgi-bin/ezmlm-cgi/4/40693 This helped me, > > then again when i load my application i got this error frequently what > does mean that? > > =INFO REPORT==== 31-Mar-2010::12:33:21 === > ERROR: error > undef > [{odbc,connect,["DSN=mysqldb",[]]}, > {web_index,event,1}, > {wf_handle_postback,run_module_event,2}, > {wf_handle_postback,handle_normal_request,3}, > {wf_inets,do,3}, > {httpd_response,traverse_modules,2}, > {httpd_response,generate_and_send_response,1}, > {httpd_request_handler,handle_response,1}] > > where is the problem? > > On Mar 31, 11:51 am, NavaTux wrote: > > application:start(odbc). > > {error,{"no such file or directory","odbc.app"}} > > (nitrogen@REDACTED)2> > > > > I newly upgraded my erlang otp asked by some one,but after that when i > > give application:start(odbc) .....it shows above one > > > > Is any way to copy those file only inside the otp directory to work > > odbc? or i need to install again it fresh otp??? > > > > please clarify friends > > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > Seehttp://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > > From vincent.dephily@REDACTED Wed Mar 31 14:10:40 2010 From: vincent.dephily@REDACTED (Vincent de Phily) Date: Wed, 31 Mar 2010 14:10:40 +0200 Subject: httpc sending empty te header Message-ID: <201003311410.40664.vincent.dephily@mobile-devices.fr> Hi, the inets http client seems to add an empty "te:" http headers in all requests. At first I thought it was a bug, but looking at the code of httpc:validate_headers/3 it seems like it was done on purpose. So a few questions about this : * Is it indeed the intended behaviour ? What's the purpose ? * Shouldn't httpc provide a default value (whatever transfer encodings httpc does support) instead ? * What's the usefull difference between the "accept-encoding" and the "te" headers ? Thanks. -- Vincent de Phily From dave.smith.to@REDACTED Wed Mar 31 15:52:59 2010 From: dave.smith.to@REDACTED (Dave Smith) Date: Wed, 31 Mar 2010 09:52:59 -0400 Subject: [erlang-questions] fun question... In-Reply-To: References: <5ea453f91003301023n6f3cfcecvd638f25d941fe7d5@mail.gmail.com> Message-ID: Thanks, this was helpful. --DS 2010/3/31 Bj?rn Gustavsson > On Tue, Mar 30, 2010 at 7:23 PM, Dave Smith > wrote: > > > So I was expecting this to work... > > EncFn = fun CodecModule:encode/1. > > > > It currently does not work, but it might in a future release. > There is an EEP: > > http://www.erlang.org/eeps/eep-0023.html > > Before that EEP is implemented, you can use > > erlang:make_fun(Mod, Name, Arity) > > to create a fun. > > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB > From hakan@REDACTED Wed Mar 31 17:19:02 2010 From: hakan@REDACTED (=?ISO-8859-1?Q?H=E5kan_Mattsson?=) Date: Wed, 31 Mar 2010 17:19:02 +0200 Subject: [erlang-questions] fun question... In-Reply-To: References: <5ea453f91003301023n6f3cfcecvd638f25d941fe7d5@mail.gmail.com> Message-ID: Just be aware of that the function is undocumented (that is unsupported). /H?kan 2010/3/31 Dave Smith : > Thanks, ?this was helpful. > > --DS > > > 2010/3/31 Bj?rn Gustavsson > >> On Tue, Mar 30, 2010 at 7:23 PM, Dave Smith >> wrote: >> >> > So I was expecting this to work... >> > EncFn = fun ?CodecModule:encode/1. >> > >> >> It currently does not work, but it might in a future release. >> There is an EEP: >> >> http://www.erlang.org/eeps/eep-0023.html >> >> Before that EEP is implemented, you can use >> >> erlang:make_fun(Mod, Name, Arity) >> >> to create a fun. >> >> -- >> Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From kyleqian@REDACTED Wed Mar 31 17:48:03 2010 From: kyleqian@REDACTED (=?GB2312?B?x67P/sP3?=) Date: Wed, 31 Mar 2010 23:48:03 +0800 Subject: Why can not catch exception in gen_server init callback function? Message-ID: Hi, Why can not catch exception in gen_server init callback function? init([]) -> erlang:error(myerror), {ok, #state{}}. Ex = (catch myserver:start_link()). process is terminated by exception myerror, but Ex is still unbound. Why? From enewhuis@REDACTED Wed Mar 31 17:54:06 2010 From: enewhuis@REDACTED (Eric Newhuis) Date: Wed, 31 Mar 2010 10:54:06 -0500 Subject: [erlang-questions] Why can not catch exception in gen_server init callback function? In-Reply-To: References: Message-ID: <7FCDDB41-FC2F-45BA-AE9B-144A2332C066@gmail.com> init is called on a separate process On Mar 31, 2010, at 10:48 AM, ??? wrote: > Hi, Why can not catch exception in gen_server init callback function? > > init([]) -> > erlang:error(myerror), > {ok, #state{}}. > > Ex = (catch myserver:start_link()). > > process is terminated by exception myerror, but Ex is still unbound. Why? From paul.joseph.davis@REDACTED Wed Mar 31 18:09:41 2010 From: paul.joseph.davis@REDACTED (Paul Davis) Date: Wed, 31 Mar 2010 12:09:41 -0400 Subject: [erlang-questions] Why can not catch exception in gen_server init callback function? In-Reply-To: References: Message-ID: On Wed, Mar 31, 2010 at 11:48 AM, ??? wrote: > Hi, Why can not catch exception in gen_server init callback function? > > init([]) -> > ? ?erlang:error(myerror), > ? ?{ok, #state{}}. > > Ex = (catch myserver:start_link()). > > process is terminated by exception myerror, but Ex is still unbound. Why? > I've found that using proc_lib:start_link, proc_lib:init_ack and gen_server:enter_loop to be a very clean way to start gen_servers that might fail during initialization. No idea if that's proper or not, but it's treated me pretty well. HTH, Paul Davis From navaneethanit@REDACTED Wed Mar 31 20:43:50 2010 From: navaneethanit@REDACTED (Saravana) Date: Wed, 31 Mar 2010 11:43:50 -0700 (PDT) Subject: List processing Message-ID: Hi friends, Good morning,I have doubts Here I use the code to select the result for id from mysql db ConnString = "DSN=mysqldb", {ok, Conn} = odbc:connect(ConnString, []), {selected, _Cols, Results} = odbc:sql_query(Conn, "SELECT * FROM marks where id=1"), io:format("~p",Results), i get the output in terminal {1,45,55,67,89} Here I wanna to process each field seperately,How to seperate each field in the above tuple? I wanna print the result 1,45,55,67,89 like wise individually From caio.ariede@REDACTED Wed Mar 31 21:42:26 2010 From: caio.ariede@REDACTED (caio ariede) Date: Wed, 31 Mar 2010 16:42:26 -0300 Subject: [erlang-questions] List processing In-Reply-To: References: Message-ID: string:join(lists:map(fun erlang:integer_to_list/1, tuple_to_list({1, 2, 3})), ", "). Or just io:format("~B, ~B, ~B", tuple_to_list({1, 2, 3})). Caio Ariede http://caioariede.com/ On Wed, Mar 31, 2010 at 3:43 PM, Saravana wrote: > Hi friends, > > Good morning,I have doubts > > Here I use the code to select the result for id from mysql db > > ConnString = "DSN=mysqldb", > {ok, Conn} = odbc:connect(ConnString, []), > {selected, _Cols, Results} = odbc:sql_query(Conn, "SELECT * FROM > marks where id=1"), > io:format("~p",Results), > i get the output in terminal {1,45,55,67,89} > > Here I wanna to process each field seperately,How to seperate each > field in the above tuple? > > I wanna print the result 1,45,55,67,89 like wise individually > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED > >