From kenji.rikitake Wed Dec 1 01:09:29 2010 From: kenji.rikitake (Kenji Rikitake) Date: Wed, 1 Dec 2010 09:09:29 +0900 Subject: [erlang-questions] Implementation of a 2006 version of Wichmann-Hill random number generator for Erlang/OTP In-Reply-To: <832946219.146801291157435038.JavaMail.root@zimbra> References: <611195571.146781291157291062.JavaMail.root@zimbra> <832946219.146801291157435038.JavaMail.root@zimbra> Message-ID: <20101201000929.GA61918@k2r.org> Robert and all: The reason why I picked up Wichmann-Hill's 2006 algorithm was exactly what you wrote below. Here's some observations: * generated random number range: same (0.0 =< Result < 1.0) * performance: ~9% slower when running in an infinite loop (old: ~67000, new ~60000 samples/sec on Erlang/OTP R14B FreeBSD/i386 Core2Duo 1.8GHz with no HiPE) * seed elements: old 3, new 4, as Robert pointed out. I don't have an idea about generating two elements from one. Also I think the seeding function should be seed(A1, A2, A3, A4) -> put(random_wh06_seed, {abs(A1 - 1) rem 2147483578 + 1, abs(A2 - 1) rem 2147483542 + 1, abs(A3 - 1) rem 2147483422 + 1, abs(A4 - 1) rem 2147483122 + 1}). so that {0, 0, 0, 0} -> {1, 1, 1, 1} while {1, 2, 3, 4} -> {1, 2, 3, 4}. (The zero values must be avoided) * seed values: old unsigned 16bit, new unsigned 32bit (This will not cause any serious issue) * Licensing issues: the algorithm is openly published in an academic paper, though the NPL (the copyright holder) code is not in the open license. I think changing the default seeding (at seed/0) values from the NPL code (already done) will be sufficient to avoid the licensing issues. Any other points? Kenji Rikitake In the message <832946219.146801291157435038.JavaMail.root> dated Tue, Nov 30, 2010 at 10:50:11PM +0000, Robert Virding writes: > What would be nice is if we could just drop the new algorithm into the old module so we avoid having to have 2 random modules. As I see it the main problem is that the old random has 3 seeds while the new has 4, which makes the seed functions incompatible. Couldn't you just have one seed be two? > > It would mean that the "new" random would return better values, but they would be different from what the "old" random returned. I don't see this as a problem but others might. > > Robert > > > > The 2006 Wichmann-Hill RNG for Erlang moved to > > > > https://gist.github.com/713144 > > > > under the name of > > > > random_wh06.erl From kenji.rikitake Wed Dec 1 01:38:11 2010 From: kenji.rikitake (Kenji Rikitake) Date: Wed, 1 Dec 2010 09:38:11 +0900 Subject: [erlang-questions] Implementation of a 2006 version of Wichmann-Hill random number generator for Erlang/OTP In-Reply-To: <20101201000929.GA61918@k2r.org> References: <611195571.146781291157291062.JavaMail.root@zimbra> <832946219.146801291157435038.JavaMail.root@zimbra> <20101201000929.GA61918@k2r.org> Message-ID: <20101201003811.GA62613@k2r.org> In the message <20101201000929.GA61918> dated Wed, Dec 01, 2010 at 09:09:05AM +0900, Kenji Rikitake writes: > * seed elements: old 3, new 4, as Robert pointed out. The random module has seed/0, seed/1 with an argument of a 3-element tuple, and seed/3. new ran() type will be a 4-element tuple. Anything dependent of the assumption that ran() is a 3-element tuple will break. Adding seed/4 will not break the backward compatibility. Maybe additional code for handling seed({A1, A2, A3}) and seed({A1, A2, A3, A4}) in the seed/1 needed? > I don't have an idea about generating two elements from one. A crude implementation is: seed({B1, B2, B3}) -> seed({B1, B2, B3, B3}). (or seed(B1, B2, B3, B3)) Regards, Kenji Rikitake > In the message <832946219.146801291157435038.JavaMail.root> > dated Tue, Nov 30, 2010 at 10:50:11PM +0000, > Robert Virding writes: > > What would be nice is if we could just drop the new algorithm into the old module so we avoid having to have 2 random modules. As I see it the main problem is that the old random has 3 seeds while the new has 4, which makes the seed functions incompatible. Couldn't you just have one seed be two? > > > > It would mean that the "new" random would return better values, but they would be different from what the "old" random returned. I don't see this as a problem but others might. > > > > Robert > > > > > > The 2006 Wichmann-Hill RNG for Erlang moved to > > > > > https://gist.github.com/713144 > > > > > under the name of > > > > > random_wh06.erl From hd2010 Wed Dec 1 02:19:00 2010 From: hd2010 (Henning Diedrich) Date: Wed, 01 Dec 2010 02:19:00 +0100 Subject: Implementation of ports Message-ID: <4CF5A284.9030803@eonblast.com> Hi all, are ports implemented using sockets underneath? Are messages being sent between processes usually use sockets? Thanks a lot, Henning From xiaopong.tran Wed Dec 1 02:46:11 2010 From: xiaopong.tran (Xiaopong Tran) Date: Wed, 01 Dec 2010 09:46:11 +0800 Subject: Interested in Shanghai Erlang User Group meeting? Message-ID: <1291167971.28478.8.camel@shanghai> Hello, I'd like to know if there are people in Shanghai who are interested in the first Shanghai Erlang User Group meetup? Please reply and I'll organize a first one, hopefully aiming to make it a regular meeting, with tutorial, presentation, project road show, etc. Apologies if this is a bit off topic. Best, Xiaopong -- Xiaopong Tran http://renzhi.ca From ok Wed Dec 1 02:58:05 2010 From: ok (Richard O'Keefe) Date: Wed, 1 Dec 2010 14:58:05 +1300 Subject: [erlang-questions] Implementation of a 2006 version of Wichmann-Hill random number generator for Erlang/OTP In-Reply-To: <832946219.146801291157435038.JavaMail.root@zimbra> References: <832946219.146801291157435038.JavaMail.root@zimbra> Message-ID: <702DC514-B93F-4B18-A95C-071D9022A9E9@cs.otago.ac.nz> On 1/12/2010, at 11:50 AM, Robert Virding wrote: > What would be nice is if we could just drop the new algorithm into the old module so we avoid having to have 2 random modules. As I see it the main problem is that the old random has 3 seeds while the new has 4, which makes the seed functions incompatible. Couldn't you just have one seed be two? Backwards compatibility would be nice, but let's think about what that involves. If someone currently has a simulation program that saves random states in a file and reads them back, we really don't want to change what those states mean. Suppose someone is currently doing {F,{A1,B1,C1}} = random:uniform_s({A0,B0,C0}) If we turn 3-cycle states into 4-cycle states on the way in, what do we do on the way out? The simplest change seems to me to be this. (1) Decree that the random number module supports at least two kinds of generators, the 1986 Wichmann-Hill 3-cycle generator with states {A,B,C}, the 2006 Wichmann-Hill 4-cycle generator with states {A,B,C,D}, and possibly other generators. (2) Revise the existing function interfaces as follows: seed0() answer the default state, which might be any kind of supported state. In particular, it might be a 3-cycle state in one release and a 4-cycle one in the next. seed() -> seed(seed0()). seed(State) set the state and return the old state. The State might be a 3-cycle state, a 4-cycle state, or whatever other kind of state the system supports. seed(A,B,C) -> % deprecated seed({A,B,C}). uniform() Generate a random float using whatever the currently selected generator/state is. uniform(N) Generate a random integer using whatever the currently selected generator/state is. uniform_s(State) -> Old_State = seed(State), Result = uniform(), New_State = seed(Old_State), {Result, New_State}. uniform_s(N, State) -> Old_State = seed(State), Result = uniform(N), New_State = seed(Old_State), {Result, New_State}. (3) Currently there's a sort of pun which makes random:seed(now()) useful. We don't want to lose that, and with the interface above, it continues to work, but it continues to provide a 3-cycle state. So I suggest adding one more function: seed(Generator, Time) where Generator can be wichmann_hill_1986 or wichman_hill_2006 or whatever else the module supports, and Time is an Erlang time value as returned by now(). The 4-cycle generator really wants 124 bits of random state, and erlang:now() only provides at best 40, for practical purposes. The megaseconds value changes only once every twelve-and-a-bit days, so might as well be constant for random number seeding purposes. (4) Add one more function for information purposes, supported() -> list(atom). answer a list of the generators supported by the implementation, with the default at the head. I have a version of the 'random' module with this interface if anyone is interested. From ok Wed Dec 1 03:09:09 2010 From: ok (Richard O'Keefe) Date: Wed, 1 Dec 2010 15:09:09 +1300 Subject: [erlang-questions] Implementation of a 2006 version of Wichmann-Hill random number generator for Erlang/OTP In-Reply-To: <20101201003811.GA62613@k2r.org> References: <611195571.146781291157291062.JavaMail.root@zimbra> <832946219.146801291157435038.JavaMail.root@zimbra> <20101201000929.GA61918@k2r.org> <20101201003811.GA62613@k2r.org> Message-ID: <665E383D-0237-4E38-8BE3-B07CA70E4D91@cs.otago.ac.nz> > >> I don't have an idea about generating two elements from one. > > A crude implementation is: > seed({B1, B2, B3}) -> seed({B1, B2, B3, B3}). > (or seed(B1, B2, B3, B3)) > The classic way to expand k << N random bits into N ones (sometimes used, for example, to initialise lagged fibonacci generators) is to use the k bits to initialise a weaker generator and then generate N bits worth out of that. This _still_ doesn't give you access to all the possible states, so you are getting rather less randomness than you might think. We definitely need an Erlang interface to something that will (perhaps slowly) give us a lot more random bits than we find in a few smallish integers; by now there probably is one but I don't happen to know what it is. From sky Wed Dec 1 03:28:27 2010 From: sky (sky) Date: Wed, 01 Dec 2010 10:28:27 +0800 Subject: [erlang-questions] Some problem abount odbc? In-Reply-To: <1291167971.28478.8.camel@shanghai> References: <1291167971.28478.8.camel@shanghai> Message-ID: <4CF5B2CB.3020206@7road.com> Dear all, When i used odbc to connect a sql server database, i met some problem?all string data which returned by odbc:sql_query() has been convert to binary, even though i set option binary_strings=off, what's the matter? And how could i get the string format? the original string is "192.168.0.4", and the convert binary is <<49,0,57,0,50,0,46,0,49,0,54,0,56,0,46,0,48,0,46,0,52,0>>. and the datatype of the string is nvarchar? regards. this the sorce code: Code: -module(server_config). -export([]). -compile(export_all). start() -> odbc:start(), case odbc:connect("DSN=ErlangDSN;UID=wahaha;PWD=123456", []) of {ok, RefConnection} -> odbc:sql_query(RefConnection, "select top 1 Name, IP, Port from server_list"); {error, Reason} -> io:format("fail to connect database:~p~n", Reason), {error, Reason} end. this the result: Code: server_config:start(). {selected,["Name","IP","Port"], [{<<80,0,86,0,69,0,75,109,213,139,49,0>>, <<49,0,57,0,50,0,46,0,49,0,54,0,56,0,46,0,48,0,46,0,52,0>>, 9201}]} From info Wed Dec 1 09:01:10 2010 From: info (info) Date: Wed, 1 Dec 2010 09:01:10 +0100 Subject: [erlang-questions] emacs tool and the -smp erlang option References: <201011301049518598807@its3.ch>, , <201011301134059536446@its3.ch> Message-ID: <201012010901092967895@its3.ch> Thank you for your answer. Other guy found my fault: - inferior-erlang-machine-options parameter is overwritten in the .emacs file! Therefore the modification, for my case, shall be performed in .emacs file and not in erlang.el file: - (setq inferior-erlang-machine-options '("-sname" "emacs" "-smp" "enable")) But ... but this modification seems to not be sufficient. I tried to compile and execute one of the examples: C:\Program Files\erl5.8\lib\wx-0.98.6\examples\simple\hello.erl I run it with the following command: hello:start(). but nothing happens !!! Any ideas ? J-Ph. Constantin ITS3 Gen?ve www.its3.ch From jia.wang Wed Dec 1 11:48:08 2010 From: jia.wang (Jia Wang) Date: Wed, 1 Dec 2010 11:48:08 +0100 Subject: [erlang-questions] Interested in Shanghai Erlang User Group meeting? In-Reply-To: <1291167971.28478.8.camel@shanghai> References: <1291167971.28478.8.camel@shanghai> Message-ID: Sounds great. I'm interested in it. /Jia On Wed, Dec 1, 2010 at 2:46 AM, Xiaopong Tran wrote: > Hello, > > I'd like to know if there are people in Shanghai who are > interested in the first Shanghai Erlang User Group meetup? > Please reply and I'll organize a first one, hopefully aiming > to make it a regular meeting, with tutorial, presentation, > project road show, etc. > > Apologies if this is a bit off topic. > > Best, > > Xiaopong > > -- > Xiaopong Tran > http://renzhi.ca > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From bob Wed Dec 1 12:01:37 2010 From: bob (Bob Ippolito) Date: Wed, 1 Dec 2010 18:01:37 +0700 Subject: [erlang-questions] Interested in Shanghai Erlang User Group meeting? In-Reply-To: References: <1291167971.28478.8.camel@shanghai> Message-ID: Me too! :) On Wed, Dec 1, 2010 at 5:48 PM, Jia Wang wrote: > Sounds great. I'm interested in it. > > /Jia > > On Wed, Dec 1, 2010 at 2:46 AM, Xiaopong Tran wrote: > >> Hello, >> >> I'd like to know if there are people in Shanghai who are >> interested in the first Shanghai Erlang User Group meetup? >> Please reply and I'll organize a first one, hopefully aiming >> to make it a regular meeting, with tutorial, presentation, >> project road show, etc. >> >> Apologies if this is a bit off topic. >> >> Best, >> >> Xiaopong >> >> -- >> Xiaopong Tran >> http://renzhi.ca >> >> >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe >> >> > From ro4tub Wed Dec 1 12:11:47 2010 From: ro4tub (Oscar) Date: Wed, 1 Dec 2010 19:11:47 +0800 Subject: [erlang-questions] Interested in Shanghai Erlang User Group meeting? In-Reply-To: References: <1291167971.28478.8.camel@shanghai> Message-ID: Cool,I am very interested in it. On Wed, Dec 1, 2010 at 7:01 PM, Bob Ippolito wrote: > Me too! :) > > On Wed, Dec 1, 2010 at 5:48 PM, Jia Wang wrote: > > Sounds great. I'm interested in it. > > > > /Jia > > > > On Wed, Dec 1, 2010 at 2:46 AM, Xiaopong Tran >wrote: > > > >> Hello, > >> > >> I'd like to know if there are people in Shanghai who are > >> interested in the first Shanghai Erlang User Group meetup? > >> Please reply and I'll organize a first one, hopefully aiming > >> to make it a regular meeting, with tutorial, presentation, > >> project road show, etc. > >> > >> Apologies if this is a bit off topic. > >> > >> Best, > >> > >> Xiaopong > >> > >> -- > >> Xiaopong Tran > >> http://renzhi.ca > >> > >> > >> > >> ________________________________________________________________ > >> erlang-questions (at) erlang.org mailing list. > >> See http://www.erlang.org/faq.html > >> To unsubscribe; mailto:erlang-questions-unsubscribe > >> > >> > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From ingela.andin Wed Dec 1 12:51:58 2010 From: ingela.andin (Ingela Andin) Date: Wed, 1 Dec 2010 12:51:58 +0100 Subject: [erlang-questions] How to configure Inets so that ESI would work? In-Reply-To: References: <30260CE4-4C84-43F4-B22D-9F3B0A6A02BC@erlang-solutions.com> Message-ID: Hi! Yes, we know, on our long list of things to improve. If anyone feels an urge to contriubute please feel free ;) Regards Ingela - Erlang/OTP team - Ercisson AB 2010/11/28 Guy Wiener : > Thanks Ulf! These files are indeed unadvertised. I copied and modified the > conf file, and it worked. ?I don't know which property exactly my > configuration was missing, but starting with a working example seemed to do > the trick. > > And yes, the user guide could certainly use a Getting Started section that > walks through the existing example, at least... > > :- Guy > > On Sat, Nov 27, 2010 at 4:52 PM, Ulf Wiger > wrote: > >> >> So, the inets/examples/server_root/conf/8080.conf >> and inets/src/http_server/httpd_example.erl didn't help? >> >> (Perhaps you didn't find them? They are not that well advertised, and the >> examples themselves are not exactly minimal either.) >> >> The user guide could definitely use a Getting Started section that walks >> through the existing examples, at least. >> >> BR, >> Ulf W >> >> >> On 27 Nov 2010, at 15:00, Guy Wiener wrote: >> >> > Hello everyone, >> > I am trying to make Erlang's Inets mode_esi work and run some function. >> So, >> > far, I did not succeed. Can someone post a minimal example of how to run >> > Inets so that a url like http:localhost:8099/esi/my_mod:foo will invoke >> the >> > method my_mod:foo/3? >> > >> > (Due disclosure: I also posted this question at stackoverflow) >> > >> > Thanks, >> > ?Guy >> >> Ulf Wiger, CTO, Erlang Solutions, Ltd. >> http://erlang-solutions.com >> >> >> >> > From mbj Wed Dec 1 13:09:26 2010 From: mbj (Martin Bjorklund) Date: Wed, 01 Dec 2010 13:09:26 +0100 (CET) Subject: [erlang-questions] SNMP AGENT-CAPABILITIES In-Reply-To: References: Message-ID: <20101201.130926.74904160.mbj@tail-f.com> Hi, Dmitriy Kargapolov wrote: > Trying to improve SNMP agent for some app written in Erlang, I found that > Erlang MIB compiler does not support AGENT-CAPABILITIES statement which is > actually a macro from SNMPv2-CONF. Normally, an invocation of the AGENT-CAPABILITIES macro is specified in a separate document from the normal MIB modules. It documents how a certain agent (or family of agents) conforms to a set of MIB modules. Do you mean that you want the MIB compiler to support this use case? If so, what exactly do you want the compiler to do? In some (odd) cases you get files with both normal MIB modules, and an AGENT-CAPABILITIES invocation in the same file. Is this the use case you want to support? I have modified the MIB compiler to "support" this macro. The grammar builds a record of the information, and then the compiler ignores this record. Some day I should make it available in git... /martin From spawn.think Wed Dec 1 13:13:00 2010 From: spawn.think (Ahmed Omar) Date: Wed, 1 Dec 2010 13:13:00 +0100 Subject: [ANN] LinkedIn EUGs (Erlang Users' Groups) In-Reply-To: References: Message-ID: Dear all, New groups have been added : EUG-China EUG-Australia EUG-Norway EUG-Germany EUG-Egypt Get local and connect more! On Wed, Oct 27, 2010 at 11:46 AM, Ahmed Omar wrote: > Dear all, > In order to facilitate better communication and easier collaboration for > Erlang User Groups, I'm glad to announce the newly created location-oriented > subgroups under Erlang/OTP professionals group > . > > Benefits : > You can easily start discussions , share news, announcements and more, all > localized and organized professionally. > > Currently available: > > EUG-Sweden > EUG-UK > EUG-USA > EUG-Spain > > We can add up to 20 subgroups. Please if you want to add your EUG to the > list, send me an email with number of members you expect. > > Note : To join any of the EUGs you have to be a member of Erlang/OTP > professionals group., > so make sure to join if your are not already there. > > -- > Best Regards, > - Ahmed Omar > http://nl.linkedin.com/in/adiaa > Follow me on twitter > @spawn_think > > -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think From kenji.rikitake Wed Dec 1 13:56:50 2010 From: kenji.rikitake (Kenji Rikitake) Date: Wed, 1 Dec 2010 21:56:50 +0900 Subject: [erlang-questions] Implementation of a 2006 version of Wichmann-Hill random number generator for Erlang/OTP In-Reply-To: <702DC514-B93F-4B18-A95C-071D9022A9E9@cs.otago.ac.nz> References: <832946219.146801291157435038.JavaMail.root@zimbra> <702DC514-B93F-4B18-A95C-071D9022A9E9@cs.otago.ac.nz> Message-ID: <20101201125650.GA72253@k2r.org> Richard (and all): Your idea below looks fine to me. I'd appreciate if I could take a look at your code for the random module with multiple choice of algorithms. A NIF to pick up some bytes from /dev/urandom on UNIX (and from an equivalent API on Windows) will be a nice addition. Just for clarification (correct me if I'm wrong): uniform() value range: 0.0 =< uniform() < 1.0 uniform(N) when N = integer() value range: 1 =< uniform(N) <= N I guess I can put my SFMT generators in this framework. Regards, Kenji Rikitake In the message <702DC514-B93F-4B18-A95C-071D9022A9E9> dated Wed, Dec 01, 2010 at 02:57:41PM +1300, Richard O'Keefe writes: > On 1/12/2010, at 11:50 AM, Robert Virding wrote: > > > What would be nice is if we could just drop the new algorithm into the old module so we avoid having to have 2 random modules. As I see it the main problem is that the old random has 3 seeds while the new has 4, which makes the seed functions incompatible. Couldn't you just have one seed be two? > > Backwards compatibility would be nice, but let's think about what that > involves. If someone currently has a simulation program that saves random > states in a file and reads them back, we really don't want to change what > those states mean. Suppose someone is currently doing > > {F,{A1,B1,C1}} = random:uniform_s({A0,B0,C0}) > > If we turn 3-cycle states into 4-cycle states on the way in, what do we > do on the way out? > > The simplest change seems to me to be this. > > (1) Decree that the random number module supports at least two kinds of > generators, the 1986 Wichmann-Hill 3-cycle generator with states > {A,B,C}, the 2006 Wichmann-Hill 4-cycle generator with states > {A,B,C,D}, and possibly other generators. > > (2) Revise the existing function interfaces as follows: > > seed0() > answer the default state, which might be any kind > of supported state. In particular, it might be > a 3-cycle state in one release and a 4-cycle one in > the next. > > seed() -> > seed(seed0()). > > seed(State) > set the state and return the old state. > The State might be a 3-cycle state, a 4-cycle state, > or whatever other kind of state the system supports. > > seed(A,B,C) -> % deprecated > seed({A,B,C}). > > uniform() > Generate a random float using whatever the currently > selected generator/state is. > > uniform(N) > Generate a random integer using whatever the currently > selected generator/state is. > > uniform_s(State) -> > Old_State = seed(State), > Result = uniform(), > New_State = seed(Old_State), > {Result, New_State}. > > uniform_s(N, State) -> > Old_State = seed(State), > Result = uniform(N), > New_State = seed(Old_State), > {Result, New_State}. > > (3) Currently there's a sort of pun which makes random:seed(now()) > useful. We don't want to lose that, and with the interface > above, it continues to work, but it continues to provide a 3-cycle > state. So I suggest adding one more function: > > seed(Generator, Time) > > where Generator can be wichmann_hill_1986 or > wichman_hill_2006 or whatever else the module supports, > and Time is an Erlang time value as returned by now(). > > The 4-cycle generator really wants 124 bits of random state, > and erlang:now() only provides at best 40, for practical > purposes. The megaseconds value changes only once every > twelve-and-a-bit days, so might as well be constant for > random number seeding purposes. > > (4) Add one more function for information purposes, > > supported() -> list(atom). > > answer a list of the generators supported by the implementation, > with the default at the head. > > I have a version of the 'random' module with this interface if anyone > is interested. From chad Wed Dec 1 14:07:03 2010 From: chad (Chad DePue) Date: Wed, 1 Dec 2010 10:07:03 -0300 Subject: thoughts on rebar bundled with Erlang/OTP Message-ID: With every Erlang app Inaka has produced, the first step when telling a client how to deploy is "Go to Basho's Mercurial Repository and download Rebar". I which makes me think it would be great as part of the standard Erlang/OTP distribution. I know you could make the argument that sinan would be an equally valid candidate. Perhaps they're not mutually exclusive. Either way, Rebar does make building apps easier. Any thoughts? From lemenkov Wed Dec 1 14:15:44 2010 From: lemenkov (Peter Lemenkov) Date: Wed, 1 Dec 2010 16:15:44 +0300 Subject: [erlang-questions] thoughts on rebar bundled with Erlang/OTP In-Reply-To: References: Message-ID: 2010/12/1 Chad DePue : > With every Erlang app Inaka has produced, the first step when telling a > client how to deploy is "Go to Basho's Mercurial Repository and download > Rebar". I which makes me think it would be great as part of the standard > Erlang/OTP distribution. I know you could make the argument that sinan would > be an equally valid candidate. Perhaps they're not mutually exclusive. > ?Either way, Rebar does make building apps easier. Any thoughts? More proper way would be to push it directly into Linux/xBSD distributions (like we at Fedora already did). The main reason to not to bundle rebar with OTP is that their development cycles are differs. Rebar is emerging quite fast, so you'll end up with relatively old rebar bundled with OTP and your clients will be forced to update it anyway in *some* cases. -- With best regards, Peter Lemenkov. From alain.odea Wed Dec 1 14:24:40 2010 From: alain.odea (Alain O'Dea) Date: Wed, 1 Dec 2010 09:54:40 -0330 Subject: [erlang-questions] How to configure Inets so that ESI would work? In-Reply-To: References: <30260CE4-4C84-43F4-B22D-9F3B0A6A02BC@erlang-solutions.com> Message-ID: Hi Guy: It is *very* easy to contribute doc enhancements to Erlang/OTP. Just fork https://github.com/erlang/otp/ and send pull requests for your contributions. So please add the information on ESI where you would have expected it and send your enhancement as a Pull Request :) Best regards, Alain On Wed, Dec 1, 2010 at 8:21 AM, Ingela Andin wrote: > Hi! > > Yes, we know, on our long list of things to improve. > If anyone feels an urge to contriubute please feel free ;) > > Regards Ingela - Erlang/OTP team - Ercisson AB > > > 2010/11/28 Guy Wiener : > > Thanks Ulf! These files are indeed unadvertised. I copied and modified > the > > conf file, and it worked. I don't know which property exactly my > > configuration was missing, but starting with a working example seemed to > do > > the trick. > > > > And yes, the user guide could certainly use a Getting Started section > that > > walks through the existing example, at least... > > > > :- Guy > > > > On Sat, Nov 27, 2010 at 4:52 PM, Ulf Wiger > > wrote: > > > >> > >> So, the inets/examples/server_root/conf/8080.conf > >> and inets/src/http_server/httpd_example.erl didn't help? > >> > >> (Perhaps you didn't find them? They are not that well advertised, and > the > >> examples themselves are not exactly minimal either.) > >> > >> The user guide could definitely use a Getting Started section that walks > >> through the existing examples, at least. > >> > >> BR, > >> Ulf W > >> > >> > >> On 27 Nov 2010, at 15:00, Guy Wiener wrote: > >> > >> > Hello everyone, > >> > I am trying to make Erlang's Inets mode_esi work and run some > function. > >> So, > >> > far, I did not succeed. Can someone post a minimal example of how to > run > >> > Inets so that a url like http:localhost:8099/esi/my_mod:foo will > invoke > >> the > >> > method my_mod:foo/3? > >> > > >> > (Due disclosure: I also posted this question at stackoverflow) > >> > > >> > Thanks, > >> > Guy > >> > >> Ulf Wiger, CTO, Erlang Solutions, Ltd. > >> http://erlang-solutions.com > >> > >> > >> > >> > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From ebegumisa Wed Dec 1 14:36:13 2010 From: ebegumisa (Edmond Begumisa) Date: Thu, 02 Dec 2010 00:36:13 +1100 Subject: [erlang-questions] Erlounge Melbourne - Sat 4/12 In-Reply-To: References: <4CF48EAF.5070304@infinite-interactive.com> <201011302000.33706.als@iinet.net.au> Message-ID: We had put this Erlounge together in "honor" of Erlang consulting coming to Melbourne for YOW! (the date and time was originally co-ordinated with Ulf.) It would really be great if Francesco could make it. Please consider dragging him to Fed. Square :) - Edmond - On Wed, 01 Dec 2010 09:26:07 +1100, Julian Doherty wrote: > So many tech events happening in Melbourne around YOW this week all at > once! > Tricky to fit them all in. Would love to come along on Saturday night, > but > not sure if I'll make it or not. > > I'm hosting Francesco's talk at Lonely Planet on Saturday, so will see a > few > of you there. > > Am definitely keen for future events and getting regular meetups > happening > with the Erlang crowd in Melbourne. > > Cheers > Julian Doherty > > On 30 November 2010 20:00, Anthony Shipman wrote: > >> On Tue, 30 Nov 2010 04:42:07 pm Nikolas Bowe wrote: >> > Hi everyone. >> > >> > There will be an Erlounge at Beer DeLuxe from 7pm on Saturday 4th Dec. >> > This is just a social event. No presentations this time. Maybe next >> time >> > depending on what people want. >> >> How will we recognise you? >> -- >> Anthony Shipman Mamas don't let your babies >> als grow up to be outsourced. >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe >> >> -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ From ebegumisa Wed Dec 1 15:08:25 2010 From: ebegumisa (Edmond Begumisa) Date: Thu, 02 Dec 2010 01:08:25 +1100 Subject: [erlang-questions] thoughts on rebar bundled with Erlang/OTP In-Reply-To: References: Message-ID: From your suggestion, it appears to me that the problem you are trying to address is awareness. i.e. people don't know that tools like rebar/sinan exist and either re-invent the wheel or suffer silently. Perhaps a special section on erlang.org could address this. A page devoted to 3rd party developer tools with categories like IDEs, packaging, etc. Tool developers could then fill out a form with a summarised description of their tool, the type of license and a link to their repository then post it under the relevant category. Something like the current links page (http://www.erlang.org/links.html) but less general, more descriptive and user-generated. - Edmond - On Thu, 02 Dec 2010 00:07:03 +1100, Chad DePue wrote: > With every Erlang app Inaka has produced, the first step when telling a > client how to deploy is "Go to Basho's Mercurial Repository and download > Rebar". I which makes me think it would be great as part of the standard > Erlang/OTP distribution. I know you could make the argument that sinan > would > be an equally valid candidate. Perhaps they're not mutually exclusive. > Either way, Rebar does make building apps easier. Any thoughts? -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ From andy.kriger Wed Dec 1 16:11:33 2010 From: andy.kriger (Andy Kriger) Date: Wed, 1 Dec 2010 10:11:33 -0500 Subject: guard expression restriction Message-ID: As a newcomer to Erlang, I'm curious about the reason for the restriction on guard expressions to a subset of valid Erlang expressions >From http://www.erlang.org/doc/reference_manual/expressions.html#id75235 " The reason for restricting the set of valid expressions is that evaluation of a guard expression must be guaranteed to be free of side effects." That's nice, but basically says 'this is so important that the programmer cannot be trusted to get it right.' Many other parts of the language don't make this statement - fail early and often is encouraged, from what I understand. So, I'm wondering about the history behind that decision and if there's been any talk of removing that restriction now that Erlang has expanded far beyond the telecom world. There's a definite benefit to be had in clarity in allowing user-defined boolean functions that are specific to the application. Yes, this would leave more room for mistakes and, I'm guessing, cut off some compiler optimizations, but the decision would be left to the programmer to make rather than disallowed by the language. Not looking to start a fight if this is well hashed ground. As I said, curious about the history and whether it's been debated as an EEP. thx From attila.r.nohl Wed Dec 1 16:21:45 2010 From: attila.r.nohl (Attila Rajmund Nohl) Date: Wed, 1 Dec 2010 16:21:45 +0100 Subject: [erlang-questions] guard expression restriction In-Reply-To: References: Message-ID: It's not about mistakes, it's about avoiding side effects. Don't forget that the guards that eventually don't match are also executed. This is something that would lead to hugely surprising things. 2010/12/1, Andy Kriger : > As a newcomer to Erlang, I'm curious about the reason for the > restriction on guard expressions to a subset of valid Erlang > expressions > > From > http://www.erlang.org/doc/reference_manual/expressions.html#id75235 > " The reason for restricting the set of valid expressions is that > evaluation of a guard expression must be guaranteed to be free of side > effects." > > That's nice, but basically says 'this is so important that the > programmer cannot be trusted to get it right.' Many other parts of the > language don't make this statement - fail early and often is > encouraged, from what I understand. So, I'm wondering about the > history behind that decision and if there's been any talk of removing > that restriction now that Erlang has expanded far beyond the telecom > world. There's a definite benefit to be had in clarity in allowing > user-defined boolean functions that are specific to the application. > Yes, this would leave more room for mistakes and, I'm guessing, cut > off some compiler optimizations, but the decision would be left to the > programmer to make rather than disallowed by the language. > > Not looking to start a fight if this is well hashed ground. As I said, > curious about the history and whether it's been debated as an EEP. > > thx > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From ali.yakout Wed Dec 1 16:30:05 2010 From: ali.yakout (Ali Yakout) Date: Wed, 1 Dec 2010 16:30:05 +0100 Subject: [erlang-questions] spawning funs on other nodes that does not contain my module In-Reply-To: <4CF573E5.8040804@erlang-solutions.com> References: <4CF573E5.8040804@erlang-solutions.com> Message-ID: <591FA96352AC9946A403D860A601665203EFA1EC@ESESSCMS0357.eemea.ericsson.se> Hi, There is a shell function that does the same. 1> nl(my_mod) abcast 2> %% Network version of l/1 nl(Mod) -> case code:get_object_code(Mod) of {_Module, Bin, Fname} -> rpc:eval_everywhere(code,load_binary,[Mod,Fname,Bin]); Other -> Other end. -Ali -----Original Message----- From: erlang-questions [mailto:erlang-questions] On Behalf Of Mazen Harake Sent: Wednesday, December 01, 2010 12:00 AM Cc: Marcel Meyer; erlang-questions Subject: Re: [erlang-questions] spawning funs on other nodes that does not contain my module This is how I do it (taken from: https://github.com/mazenharake/entop/blob/master/src/entop_view.erl#L59) remote_load_code(Module, Node) -> {_, Binary, Filename} = code:get_object_code(Module), rpc:call(Node, code, load_binary, [Module, Filename, Binary]). /M On 30/11/2010 22:31, Lukas Larsson wrote: > It is not possible directly, you would have to get the code to the > other side somehow. code:load_binary is made specifically for this > purpose, > > http://erlang.org/doc/man/code.html#load_binary-3 > > Just use rpc:call(MyNode, > code,load_binary,[mymod,"mymod.erl",BinaryModuleCode]) and off you go! > > Lukas > > On Tue, Nov 30, 2010 at 7:36 PM, Marcel Meyerwrote: > >> Hi there, >> >> Is it possible to spawn a function (which is pretty straight forward, >> essentially a receive loop that grabs the message and >> file:write_file's it to the file system) on another node, which does >> not have a copy of my module? >> >> I thought I would be able to make a fun that returns the mentioned >> fun above and then spawn that message sink on another node. >> >> I am investigating writing a file propagation system and it would be >> nice if there is one process that gets notified of new files, which >> spawns a fun on each recipient node, which tells that node how to >> handle it. >> >> Any insights? Or should each node be running a file sink that just >> listens for these {save, Data} msgs? I am trying to write something >> where I dont have to manage the child nodes and their code. Perhaps a >> file sink gen_server on each node that supports upgrades? >> >> Regards, >> Marcel >> From ulf.wiger Wed Dec 1 16:35:10 2010 From: ulf.wiger (Ulf Wiger) Date: Wed, 1 Dec 2010 16:35:10 +0100 Subject: [erlang-questions] guard expression restriction In-Reply-To: References: Message-ID: <2E4B06E3-96B5-48A6-AD90-5D68DA540AEB@erlang-solutions.com> True, but there are related discussions, e.g. about a real syntax for match specifications, parameterised selective receive, abstract patterns, etc. - merely implementing user-defined guards with some clever code rewrites in the compiler would not do much to address the Bigger Picture (?). IOW, lack of user-defined guards is a minor nuisance, but solving one or all of the above could enable new approaches and/or significantly improve analysis of the code*. BR, Ulf W * Dialyzer, for example, knows little of match specifications, as they are often indistinguishable from data. On 1 Dec 2010, at 16:21, Attila Rajmund Nohl wrote: > It's not about mistakes, it's about avoiding side effects. Don't > forget that the guards that eventually don't match are also executed. > This is something that would lead to hugely surprising things. > > 2010/12/1, Andy Kriger : >> As a newcomer to Erlang, I'm curious about the reason for the >> restriction on guard expressions to a subset of valid Erlang >> expressions >> >> From >> http://www.erlang.org/doc/reference_manual/expressions.html#id75235 >> " The reason for restricting the set of valid expressions is that >> evaluation of a guard expression must be guaranteed to be free of side >> effects." >> >> That's nice, but basically says 'this is so important that the >> programmer cannot be trusted to get it right.' Many other parts of the >> language don't make this statement - fail early and often is >> encouraged, from what I understand. So, I'm wondering about the >> history behind that decision and if there's been any talk of removing >> that restriction now that Erlang has expanded far beyond the telecom >> world. There's a definite benefit to be had in clarity in allowing >> user-defined boolean functions that are specific to the application. >> Yes, this would leave more room for mistakes and, I'm guessing, cut >> off some compiler optimizations, but the decision would be left to the >> programmer to make rather than disallowed by the language. >> >> Not looking to start a fight if this is well hashed ground. As I said, >> curious about the history and whether it's been debated as an EEP. >> >> thx >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe >> >> > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > Ulf Wiger, CTO, Erlang Solutions, Ltd. http://erlang-solutions.com From andy.kriger Wed Dec 1 16:51:53 2010 From: andy.kriger (Andy Kriger) Date: Wed, 1 Dec 2010 10:51:53 -0500 Subject: [erlang-questions] guard expression restriction In-Reply-To: References: Message-ID: I understand about preventing side effects, but the approach seems to be saying that the language will make sure there are none, rather than letting the programmer make that mistake and learn from it. So, I was wondering if there was a deeper design decision behind that, a reason why, in guards, it's really really important that side effects don't happen. On Wed, Dec 1, 2010 at 10:21 AM, Attila Rajmund Nohl wrote: > It's not about mistakes, it's about avoiding side effects. Don't > forget that the guards that eventually don't match are also executed. > This is something that would lead to hugely surprising things. > > 2010/12/1, Andy Kriger : >> As a newcomer to Erlang, I'm curious about the reason for the >> restriction on guard expressions to a subset of valid Erlang >> expressions >> >> From >> http://www.erlang.org/doc/reference_manual/expressions.html#id75235 >> " The reason for restricting the set of valid expressions is that >> evaluation of a guard expression must be guaranteed to be free of side >> effects." >> >> That's nice, but basically says 'this is so important that the >> programmer cannot be trusted to get it right.' Many other parts of the >> language don't make this statement - fail early and often is >> encouraged, from what I understand. ?So, I'm wondering about the >> history behind that decision and if there's been any talk of removing >> that restriction now that Erlang has expanded far beyond the telecom >> world. There's a definite benefit to be had in clarity in allowing >> user-defined boolean functions that are specific to the application. >> Yes, this would leave more room for mistakes and, I'm guessing, cut >> off some compiler optimizations, but the decision would be left to the >> programmer to make rather than disallowed by the language. >> >> Not looking to start a fight if this is well hashed ground. As I said, >> curious about the history and whether it's been debated as an EEP. >> >> thx >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe >> >> > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > -- Be well, andy Welcome to http://householder-yogi.net On family, NYC, and practicing yoga. From ulf.wiger Wed Dec 1 17:00:59 2010 From: ulf.wiger (Ulf Wiger) Date: Wed, 1 Dec 2010 17:00:59 +0100 Subject: [erlang-questions] guard expression restriction In-Reply-To: References: Message-ID: <4F364129-4323-40EB-B043-7D42A3D37988@erlang-solutions.com> Think of guards as an extension of the pattern matching, i.e. a purely declarative, and quite pervasive, part of the language. Looking at it this way, it could be argued that the problem is that some parts of the patterns look like normal expressions. ;-) BR, Ulf W On 1 Dec 2010, at 16:51, Andy Kriger wrote: > I understand about preventing side effects, but the approach seems to > be saying that the language will make sure there are none, rather than > letting the programmer make that mistake and learn from it. So, I was > wondering if there was a deeper design decision behind that, a reason > why, in guards, it's really really important that side effects don't > happen. > > On Wed, Dec 1, 2010 at 10:21 AM, Attila Rajmund Nohl > wrote: >> It's not about mistakes, it's about avoiding side effects. Don't >> forget that the guards that eventually don't match are also executed. >> This is something that would lead to hugely surprising things. >> >> 2010/12/1, Andy Kriger : >>> As a newcomer to Erlang, I'm curious about the reason for the >>> restriction on guard expressions to a subset of valid Erlang >>> expressions >>> >>> From >>> http://www.erlang.org/doc/reference_manual/expressions.html#id75235 >>> " The reason for restricting the set of valid expressions is that >>> evaluation of a guard expression must be guaranteed to be free of side >>> effects." >>> >>> That's nice, but basically says 'this is so important that the >>> programmer cannot be trusted to get it right.' Many other parts of the >>> language don't make this statement - fail early and often is >>> encouraged, from what I understand. So, I'm wondering about the >>> history behind that decision and if there's been any talk of removing >>> that restriction now that Erlang has expanded far beyond the telecom >>> world. There's a definite benefit to be had in clarity in allowing >>> user-defined boolean functions that are specific to the application. >>> Yes, this would leave more room for mistakes and, I'm guessing, cut >>> off some compiler optimizations, but the decision would be left to the >>> programmer to make rather than disallowed by the language. >>> >>> Not looking to start a fight if this is well hashed ground. As I said, >>> curious about the history and whether it's been debated as an EEP. >>> >>> thx >>> >>> ________________________________________________________________ >>> erlang-questions (at) erlang.org mailing list. >>> See http://www.erlang.org/faq.html >>> To unsubscribe; mailto:erlang-questions-unsubscribe >>> >>> >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe >> >> > > > > -- > Be well, > andy > > Welcome to http://householder-yogi.net > On family, NYC, and practicing yoga. > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > Ulf Wiger, CTO, Erlang Solutions, Ltd. http://erlang-solutions.com From andy.kriger Wed Dec 1 17:22:40 2010 From: andy.kriger (Andy Kriger) Date: Wed, 1 Dec 2010 11:22:40 -0500 Subject: [erlang-questions] guard expression restriction In-Reply-To: <4F364129-4323-40EB-B043-7D42A3D37988@erlang-solutions.com> References: <4F364129-4323-40EB-B043-7D42A3D37988@erlang-solutions.com> Message-ID: Pattern matching is one of the most powerful and attractive parts of the language itself. I'm sure it's mostly my newness to the style of programming, but I keep running into situations where I'd like to write many fine-grained functions using pattern matching but end up using case statements or if clauses within a function because I don't see the pattern matching alternative (which is definitely not to say that it's not there - the lightbulb is still dim, that's all). That's what's driving my curiosity about opening pattern matching to greater expressiveness. And, from a previous response, it sounds like that is being discussed. On Wed, Dec 1, 2010 at 11:00 AM, Ulf Wiger wrote: > > Think of guards as an extension of the pattern matching, i.e. > a purely declarative, and quite pervasive, part of the language. > > Looking at it this way, it could be argued that the problem is that > some parts of the patterns look like normal expressions. ;-) > > BR, > Ulf W > > On 1 Dec 2010, at 16:51, Andy Kriger wrote: > >> I understand about preventing side effects, but the approach seems to >> be saying that the language will make sure there are none, rather than >> letting the programmer make that mistake and learn from it. So, I was >> wondering if there was a deeper design decision behind that, a reason >> why, in guards, it's really really important that side effects don't >> happen. >> >> On Wed, Dec 1, 2010 at 10:21 AM, Attila Rajmund Nohl >> wrote: >>> It's not about mistakes, it's about avoiding side effects. Don't >>> forget that the guards that eventually don't match are also executed. >>> This is something that would lead to hugely surprising things. >>> >>> 2010/12/1, Andy Kriger : >>>> As a newcomer to Erlang, I'm curious about the reason for the >>>> restriction on guard expressions to a subset of valid Erlang >>>> expressions >>>> >>>> From >>>> http://www.erlang.org/doc/reference_manual/expressions.html#id75235 >>>> " The reason for restricting the set of valid expressions is that >>>> evaluation of a guard expression must be guaranteed to be free of side >>>> effects." >>>> >>>> That's nice, but basically says 'this is so important that the >>>> programmer cannot be trusted to get it right.' Many other parts of the >>>> language don't make this statement - fail early and often is >>>> encouraged, from what I understand. ?So, I'm wondering about the >>>> history behind that decision and if there's been any talk of removing >>>> that restriction now that Erlang has expanded far beyond the telecom >>>> world. There's a definite benefit to be had in clarity in allowing >>>> user-defined boolean functions that are specific to the application. >>>> Yes, this would leave more room for mistakes and, I'm guessing, cut >>>> off some compiler optimizations, but the decision would be left to the >>>> programmer to make rather than disallowed by the language. >>>> >>>> Not looking to start a fight if this is well hashed ground. As I said, >>>> curious about the history and whether it's been debated as an EEP. >>>> >>>> thx >>>> >>>> ________________________________________________________________ >>>> erlang-questions (at) erlang.org mailing list. >>>> See http://www.erlang.org/faq.html >>>> To unsubscribe; mailto:erlang-questions-unsubscribe >>>> >>>> >>> >>> ________________________________________________________________ >>> erlang-questions (at) erlang.org mailing list. >>> See http://www.erlang.org/faq.html >>> To unsubscribe; mailto:erlang-questions-unsubscribe >>> >>> >> >> >> >> -- >> Be well, >> andy >> >> Welcome to http://householder-yogi.net >> On family, NYC, and practicing yoga. >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe >> > > Ulf Wiger, CTO, Erlang Solutions, Ltd. > http://erlang-solutions.com > > > > -- Be well, andy Welcome to http://householder-yogi.net On family, NYC, and practicing yoga. From kennethstone Wed Dec 1 17:39:30 2010 From: kennethstone (Kenny Stone) Date: Wed, 1 Dec 2010 10:39:30 -0600 Subject: [erlang-questions] guard expression restriction In-Reply-To: References: <4F364129-4323-40EB-B043-7D42A3D37988@erlang-solutions.com> Message-ID: This has surprised me a few times as well when I tried to do it (I forget things...) One pattern you can do is something like this: % call foo foo(Obj, check_my_obj(Obj1)). %% foo foo( Obj, {error, Reason}) -> handle_error(Reason); foo( Obj, ok ) -> % business logic. It's not a custom guard, but you are getting much the same thing with pattern matching. On Wed, Dec 1, 2010 at 10:22 AM, Andy Kriger wrote: > Pattern matching is one of the most powerful and attractive parts of > the language itself. I'm sure it's mostly my newness to the style of > programming, but I keep running into situations where I'd like to > write many fine-grained functions using pattern matching but end up > using case statements or if clauses within a function because I don't > see the pattern matching alternative (which is definitely not to say > that it's not there - the lightbulb is still dim, that's all). That's > what's driving my curiosity about opening pattern matching to greater > expressiveness. And, from a previous response, it sounds like that is > being discussed. > > On Wed, Dec 1, 2010 at 11:00 AM, Ulf Wiger > wrote: > > > > Think of guards as an extension of the pattern matching, i.e. > > a purely declarative, and quite pervasive, part of the language. > > > > Looking at it this way, it could be argued that the problem is that > > some parts of the patterns look like normal expressions. ;-) > > > > BR, > > Ulf W > > > > On 1 Dec 2010, at 16:51, Andy Kriger wrote: > > > >> I understand about preventing side effects, but the approach seems to > >> be saying that the language will make sure there are none, rather than > >> letting the programmer make that mistake and learn from it. So, I was > >> wondering if there was a deeper design decision behind that, a reason > >> why, in guards, it's really really important that side effects don't > >> happen. > >> > >> On Wed, Dec 1, 2010 at 10:21 AM, Attila Rajmund Nohl > >> wrote: > >>> It's not about mistakes, it's about avoiding side effects. Don't > >>> forget that the guards that eventually don't match are also executed. > >>> This is something that would lead to hugely surprising things. > >>> > >>> 2010/12/1, Andy Kriger : > >>>> As a newcomer to Erlang, I'm curious about the reason for the > >>>> restriction on guard expressions to a subset of valid Erlang > >>>> expressions > >>>> > >>>> From > >>>> http://www.erlang.org/doc/reference_manual/expressions.html#id75235 > >>>> " The reason for restricting the set of valid expressions is that > >>>> evaluation of a guard expression must be guaranteed to be free of side > >>>> effects." > >>>> > >>>> That's nice, but basically says 'this is so important that the > >>>> programmer cannot be trusted to get it right.' Many other parts of the > >>>> language don't make this statement - fail early and often is > >>>> encouraged, from what I understand. So, I'm wondering about the > >>>> history behind that decision and if there's been any talk of removing > >>>> that restriction now that Erlang has expanded far beyond the telecom > >>>> world. There's a definite benefit to be had in clarity in allowing > >>>> user-defined boolean functions that are specific to the application. > >>>> Yes, this would leave more room for mistakes and, I'm guessing, cut > >>>> off some compiler optimizations, but the decision would be left to the > >>>> programmer to make rather than disallowed by the language. > >>>> > >>>> Not looking to start a fight if this is well hashed ground. As I said, > >>>> curious about the history and whether it's been debated as an EEP. > >>>> > >>>> thx > >>>> > >>>> ________________________________________________________________ > >>>> erlang-questions (at) erlang.org mailing list. > >>>> See http://www.erlang.org/faq.html > >>>> To unsubscribe; mailto:erlang-questions-unsubscribe > >>>> > >>>> > >>> > >>> ________________________________________________________________ > >>> erlang-questions (at) erlang.org mailing list. > >>> See http://www.erlang.org/faq.html > >>> To unsubscribe; mailto:erlang-questions-unsubscribe > >>> > >>> > >> > >> > >> > >> -- > >> Be well, > >> andy > >> > >> Welcome to http://householder-yogi.net > >> On family, NYC, and practicing yoga. > >> > >> ________________________________________________________________ > >> erlang-questions (at) erlang.org mailing list. > >> See http://www.erlang.org/faq.html > >> To unsubscribe; mailto:erlang-questions-unsubscribe > >> > > > > Ulf Wiger, CTO, Erlang Solutions, Ltd. > > http://erlang-solutions.com > > > > > > > > > > > > -- > Be well, > andy > > Welcome to http://householder-yogi.net > On family, NYC, and practicing yoga. > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From jameschurchman Wed Dec 1 19:22:51 2010 From: jameschurchman (James Churchman) Date: Wed, 1 Dec 2010 18:22:51 +0000 Subject: [erlang-questions] guard expression restriction In-Reply-To: References: <4F364129-4323-40EB-B043-7D42A3D37988@erlang-solutions.com> Message-ID: Interestingly list comprehensions offer custom guards, if that it of use to you. But i agree, custom guards that can not only cause side effects but can crash, throw exceptions, do send and receives, pause code etc.. etc.. would be a horrible thing that i would never want to see in erlang You would need a try catch for just function names etc... tho maybe there is a compromise that could somehow be worked out. My personal very simple technique that fixes one type of need for custom guards is to name the variables the same. eg : > does_match("yes","no"). does_match(Var1,Var1)-> they_match; does_match(_,_)-> no_match. i find myself always looping threw stuff and needing to match all of inputs to a variable (only known at run time, that may even change during the recursion etc.. ) and this stops this type of code everywhere : does_match(Var1,Var2) when Var1==Var2 -> etc.. all threw my code and can be used to put a lot more of the logic in the function definition & modularity complex things can be build up like this and still be quite readable On 1 Dec 2010, at 16:39, Kenny Stone wrote: > This has surprised me a few times as well when I tried to do it (I forget > things...) > > One pattern you can do is something like this: > > % call foo > foo(Obj, check_my_obj(Obj1)). > > %% foo > foo( Obj, {error, Reason}) -> handle_error(Reason); > foo( Obj, ok ) -> > % business logic. > > It's not a custom guard, but you are getting much the same thing with > pattern matching. > > On Wed, Dec 1, 2010 at 10:22 AM, Andy Kriger wrote: > >> Pattern matching is one of the most powerful and attractive parts of >> the language itself. I'm sure it's mostly my newness to the style of >> programming, but I keep running into situations where I'd like to >> write many fine-grained functions using pattern matching but end up >> using case statements or if clauses within a function because I don't >> see the pattern matching alternative (which is definitely not to say >> that it's not there - the lightbulb is still dim, that's all). That's >> what's driving my curiosity about opening pattern matching to greater >> expressiveness. And, from a previous response, it sounds like that is >> being discussed. >> >> On Wed, Dec 1, 2010 at 11:00 AM, Ulf Wiger >> wrote: >>> >>> Think of guards as an extension of the pattern matching, i.e. >>> a purely declarative, and quite pervasive, part of the language. >>> >>> Looking at it this way, it could be argued that the problem is that >>> some parts of the patterns look like normal expressions. ;-) >>> >>> BR, >>> Ulf W >>> >>> On 1 Dec 2010, at 16:51, Andy Kriger wrote: >>> >>>> I understand about preventing side effects, but the approach seems to >>>> be saying that the language will make sure there are none, rather than >>>> letting the programmer make that mistake and learn from it. So, I was >>>> wondering if there was a deeper design decision behind that, a reason >>>> why, in guards, it's really really important that side effects don't >>>> happen. >>>> >>>> On Wed, Dec 1, 2010 at 10:21 AM, Attila Rajmund Nohl >>>> wrote: >>>>> It's not about mistakes, it's about avoiding side effects. Don't >>>>> forget that the guards that eventually don't match are also executed. >>>>> This is something that would lead to hugely surprising things. >>>>> >>>>> 2010/12/1, Andy Kriger : >>>>>> As a newcomer to Erlang, I'm curious about the reason for the >>>>>> restriction on guard expressions to a subset of valid Erlang >>>>>> expressions >>>>>> >>>>>> From >>>>>> http://www.erlang.org/doc/reference_manual/expressions.html#id75235 >>>>>> " The reason for restricting the set of valid expressions is that >>>>>> evaluation of a guard expression must be guaranteed to be free of side >>>>>> effects." >>>>>> >>>>>> That's nice, but basically says 'this is so important that the >>>>>> programmer cannot be trusted to get it right.' Many other parts of the >>>>>> language don't make this statement - fail early and often is >>>>>> encouraged, from what I understand. So, I'm wondering about the >>>>>> history behind that decision and if there's been any talk of removing >>>>>> that restriction now that Erlang has expanded far beyond the telecom >>>>>> world. There's a definite benefit to be had in clarity in allowing >>>>>> user-defined boolean functions that are specific to the application. >>>>>> Yes, this would leave more room for mistakes and, I'm guessing, cut >>>>>> off some compiler optimizations, but the decision would be left to the >>>>>> programmer to make rather than disallowed by the language. >>>>>> >>>>>> Not looking to start a fight if this is well hashed ground. As I said, >>>>>> curious about the history and whether it's been debated as an EEP. >>>>>> >>>>>> thx >>>>>> >>>>>> ________________________________________________________________ >>>>>> erlang-questions (at) erlang.org mailing list. >>>>>> See http://www.erlang.org/faq.html >>>>>> To unsubscribe; mailto:erlang-questions-unsubscribe >>>>>> >>>>>> >>>>> >>>>> ________________________________________________________________ >>>>> erlang-questions (at) erlang.org mailing list. >>>>> See http://www.erlang.org/faq.html >>>>> To unsubscribe; mailto:erlang-questions-unsubscribe >>>>> >>>>> >>>> >>>> >>>> >>>> -- >>>> Be well, >>>> andy >>>> >>>> Welcome to http://householder-yogi.net >>>> On family, NYC, and practicing yoga. >>>> >>>> ________________________________________________________________ >>>> erlang-questions (at) erlang.org mailing list. >>>> See http://www.erlang.org/faq.html >>>> To unsubscribe; mailto:erlang-questions-unsubscribe >>>> >>> >>> Ulf Wiger, CTO, Erlang Solutions, Ltd. >>> http://erlang-solutions.com >>> >>> >>> >>> >> >> >> >> -- >> Be well, >> andy >> >> Welcome to http://householder-yogi.net >> On family, NYC, and practicing yoga. >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe >> >> From rzezeski Wed Dec 1 19:37:45 2010 From: rzezeski (Ryan Zezeski) Date: Wed, 1 Dec 2010 13:37:45 -0500 Subject: [erlang-questions] ets question In-Reply-To: References: Message-ID: On Mon, Nov 29, 2010 at 12:26 AM, u a wrote: > Hello, > > i build a small service where i store a huge lit of devices in a > single ets table. When i query this list, i have to make a full table > scan, > because i have to look at each device. > For optimization i want to classify the devices, so i can strore them > in different ets tables. For instance, all symbian devices will be > stored in > the symbian ets table and in the all_devices table. > > My question is the following: > > When i create the device and store them in both tables, symbian and > all_devices, how is it managed. Is there only one object, which is > shared > across these two table or are there copies ? What, if a delete one > device in the symbian table? Is it still in the all_devices table? > If there are copies, i have to think about another solution, perhaps > storing the devices into mnesia. > > Thanks for your help, > Ulf > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > How many devices do you have total, and what are the sizes of the partitions across type? My gut reaction would be to use a 2-tuple key and use the match operator, but you are saying that's not efficient enough? If you store the device in two tables than you will need to maintain (remove) the entries in both tables as well. Furthermore, objects will not be shared unless maybe you are using binaries. However, you could instead store all the device data in a process and then each ETS table could act as an index from device attribute to pid(), i.e. a table for device identifiers and one for device type. In this way the data would be shared and killing the pid would guarantee that the data can no longer be accessed even if the index table still has an entry. -Ryan From chad Wed Dec 1 19:46:53 2010 From: chad (Chad DePue) Date: Wed, 1 Dec 2010 15:46:53 -0300 Subject: [erlang-questions] thoughts on rebar bundled with Erlang/OTP In-Reply-To: References: Message-ID: My suggestion is more that an easy to use build tool makes the platform more approchable and easier to use. However, separately, i really like your idea! Chad DePue skype: cdepue inakanetworks.com - Erlang and Ruby on Rails consulting +1 206.866.5707 forwards to mobile +54 9.11.6940.7097 mobile On Wed, Dec 1, 2010 at 11:08 AM, Edmond Begumisa < ebegumisa> wrote: > From your suggestion, it appears to me that the problem you are trying to > address is awareness. i.e. people don't know that tools like rebar/sinan > exist and either re-invent the wheel or suffer silently. > > Perhaps a special section on erlang.org could address this. A page devoted > to 3rd party developer tools with categories like IDEs, packaging, etc. Tool > developers could then fill out a form with a summarised description of their > tool, the type of license and a link to their repository then post it under > the relevant category. Something like the current links page ( > http://www.erlang.org/links.html) but less general, more descriptive and > user-generated. > > - Edmond - > > > On Thu, 02 Dec 2010 00:07:03 +1100, Chad DePue > wrote: > > With every Erlang app Inaka has produced, the first step when telling a >> client how to deploy is "Go to Basho's Mercurial Repository and download >> Rebar". I which makes me think it would be great as part of the standard >> Erlang/OTP distribution. I know you could make the argument that sinan >> would >> be an equally valid candidate. Perhaps they're not mutually exclusive. >> Either way, Rebar does make building apps easier. Any thoughts? >> > > > -- > Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ > From michael.santos Wed Dec 1 20:07:45 2010 From: michael.santos (Michael Santos) Date: Wed, 1 Dec 2010 14:07:45 -0500 Subject: [erlang-questions] Some problem abount odbc? In-Reply-To: <4CF5B2CB.3020206@7road.com> References: <1291167971.28478.8.camel@shanghai> <4CF5B2CB.3020206@7road.com> Message-ID: <20101201190745.GA18643@ecn.lan> On Wed, Dec 01, 2010 at 10:28:27AM +0800, sky wrote: > When i used odbc to connect a sql server database, i met some > problem???all string data which returned by odbc:sql_query() has been > convert to binary, > even though i set option binary_strings=off, binary_strings=off only works with SQL_C_CHAR data. The data type returned by nvarchar is SQL_C_WCHAR. > what's the matter? And how > could i get the string format? > > the original string is "192.168.0.4", and the convert binary is > <<49,0,57,0,50,0,46,0,49,0,54,0,56,0,46,0,48,0,46,0,52,0>>. and the The returned data is unicode, 2 bytes representing each character: "1\09\02\0.\01\06\08\0.\00\0.\04\0". > datatype of the string is nvarchar??? Try converting the data to varchar or using the unicode module: 1> IP = <<49,0,57,0,50,0,46,0,49,0,54,0,56,0,46,0,48,0,46,0,52,0>>. <<49,0,57,0,50,0,46,0,49,0,54,0,56,0,46,0,48,0,46,0,52,0>> 2> unicode:characters_to_list(IP, {utf16,little}). "192.168.0.4" From joelr1 Wed Dec 1 20:27:45 2010 From: joelr1 (Joel Reymont) Date: Wed, 1 Dec 2010 19:27:45 +0000 Subject: [available] expensive consultant for hire Message-ID: <3A883870-5316-40D4-96A5-16A62836A550@gmail.com> Folks, I have Erlang experience and I'm available immediately. I'm expensive but charge a fixed price per project. Thanks, Joel --- http://twitter.com/wagerlabs From co7eb Wed Dec 1 18:34:55 2010 From: co7eb (=?iso-8859-1?Q?Gilberio_Carmenates_Garc=EDa?=) Date: Wed, 1 Dec 2010 14:34:55 -0300 Subject: How to change the node to mnesia Message-ID: <000001cb917e\$138b1560\$3aa14020\$@co.cu> Hi all! I have a little problem with my system EVO, e.g. If I have already created a mnesia database and it creates a folder Mnesia.node_name so if I want to change the node name without reinstalling the database using mnesia:create in the new node because I want to pass the information that I already had in the old node to this new one and create a new folder Mnesia.new_node_name Exists any external tool to do that without entering in Erlang code to checkpoints or replicates the database. I mean, there are any external tool to migrate the database to other nodes. Regards, Ivan. ======================================================================= Este mensaje ha sido enviado mediante el servicio de correo electr?nico que ofrece la Federaci?n de Radioaficionados de Cuba a sus miembros para respaldar el cumplimiento de los objetivos de la organizaci?n y su pol?tica informativa. La persona que env?a este correo asume el compromiso de usar el servicio a tales fines y cumplir con las regulaciones establecidas. From co7eb Wed Dec 1 18:34:55 2010 From: co7eb (=?iso-8859-1?Q?Gilberio_Carmenates_Garc=EDa?=) Date: Wed, 1 Dec 2010 14:34:55 -0300 Subject: Improving Erlang! Message-ID: <000801cb917e\$1a1f0b20\$4e5d2160\$@co.cu> Hi all! Things like this could be nice in Erlang start(Type, Args)-> ChkArg = fun(Arg)-> case lists:keyfind(Arg, 1, StartArgs) of {Arg, true}-> true; _-> false end end, if ChkArg(install)-> ?MODULE:install(); ChkArg(debug)-> appmon:start(); true-> %% Starts the application. evo_debug_module:print([{debug, true}], "~n~nApplication: \"~p\" is starting...~n", [?MODULE]), evo_debug_module:print([{debug, true}], "~nType: ~p StartArgs: ~p~n", [Type, StartArgs]), R = evo_main_supervisor:start_link(StartArgs), evo_debug_module:print([{debug, true}], "~nApplication: \"~p\" is ready.~n", [?MODULE]), R end. But that is impossible since the ?if? clause only work with guards, so since we can not define our own guards that and many other limitations can come up. Other nice example of the Erlang limitations could be get(Name)-> MatchHead = #t_char{name='\$1', _='_'}, Guard = {'user_define_compare/2', '\$1', Name}, %% instead of {'==', '\$1', Name} Result = '\$_', mnesia:dirty_select(t_char,[{MatchHead, [Guard], [Result]}]). Or when are_approximately_equals(Name, Name2) -> %% if I want to Search a name in a list, that I don?t know exactly what name is could be in the list Iv?n Carmenates Garc?a and I search by Ivan Garcia if the names are in the database then using just mnesia:select/3 or match I can do that in just almost one step, since I used my own user defined compare that validates the approximately match between the real full name and the part of the name I introduced. Regards, Ivan. ======================================================================= Este mensaje ha sido enviado mediante el servicio de correo electr?nico que ofrece la Federaci?n de Radioaficionados de Cuba a sus miembros para respaldar el cumplimiento de los objetivos de la organizaci?n y su pol?tica informativa. La persona que env?a este correo asume el compromiso de usar el servicio a tales fines y cumplir con las regulaciones establecidas. From jameschurchman Wed Dec 1 21:20:13 2010 From: jameschurchman (James Churchman) Date: Wed, 1 Dec 2010 20:20:13 +0000 Subject: mailing list "reply to" Message-ID: <934FA413-459B-482B-80E6-225A67EED2A4@gmail.com> Is is deliberate that the erlang mailing list does not set the "reply to" to erlang-questions so that when you click reply in your client it does not reply to the list? This seems a strange option and unlike any other mailing list i have come across :-) From dmitriy.kargapolov Wed Dec 1 21:21:15 2010 From: dmitriy.kargapolov (Dmitriy Kargapolov) Date: Wed, 1 Dec 2010 15:21:15 -0500 Subject: [erlang-questions] SNMP AGENT-CAPABILITIES In-Reply-To: <20101201.130926.74904160.mbj@tail-f.com> References: <20101201.130926.74904160.mbj@tail-f.com> Message-ID: Hi Martin, On Wed, Dec 1, 2010 at 7:09 AM, Martin Bjorklund wrote: > Hi, > > Dmitriy Kargapolov wrote: > > Trying to improve SNMP agent for some app written in Erlang, I found that > > Erlang MIB compiler does not support AGENT-CAPABILITIES statement which > is > > actually a macro from SNMPv2-CONF. > > Normally, an invocation of the AGENT-CAPABILITIES macro is specified > in a separate document from the normal MIB modules. It documents how > a certain agent (or family of agents) conforms to a set of MIB > modules. > Compiler is indifferent to the layout and AGENT-CAPABILITIES location. It just did not recognize this construct. > Do you mean that you want the MIB compiler to support this use case? > If so, what exactly do you want the compiler to do? > In some (odd) cases you get files with both normal MIB modules, and an > AGENT-CAPABILITIES invocation in the same file. Is this the use case > you want to support? > >From SNMP agent perspective, it is enough to register OID of the AGENT-CAPABILITIES object, so I would later to use smpa:name_to_oid/1 to resolve its name and snmpa/add_agent_caps/2 to add this OID to sysORTable... This is exactly what I implemented in my minimalistic patch. >From SNMP manager perspective it would be nice to have access to the whole content of the AGENT-CAPABILITIES construct. To make possible to decide which part of features of agent have to be supported in manager at runtime. I understand that this task requires a bit more time (which I do not have), so its ok to leave this for future, if needed. > I have modified the MIB compiler to "support" this macro. The grammar > builds a record of the information, and then the compiler ignores this > record. Some day I should make it available in git... > > > /martin > I have published my changes to the branch agent_capabilities at git:// github.com/xoid/otp.git. From dmercer Wed Dec 1 21:41:48 2010 From: dmercer (David Mercer) Date: Wed, 1 Dec 2010 14:41:48 -0600 Subject: [erlang-questions] mailing list "reply to" In-Reply-To: <934FA413-459B-482B-80E6-225A67EED2A4@gmail.com> References: <934FA413-459B-482B-80E6-225A67EED2A4@gmail.com> Message-ID: <00ce01cb9198\$2dcd5900\$89680b00\$@com> On Wednesday, December 01, 2010, James Churchman wrote: > Is is deliberate that the erlang mailing list does not set the "reply to" > to erlang-questions so that when you click reply in your client > it does not reply to the list? Yes, it is deliberate. The idea was that it would be similar to how your email works. When someone emails a whole bunch of people, putting them on the To and Cc lines, when you want to reply, "reply" replies only to the sender, "reply-all" replies to all recipients. Likewise with erlang-questions: "reply" is intended to reply only to the sender, but "reply-all" will respond to the list. I'm not the list maintainer, it's just that this question has come up often enough that I remember the reasoning. Cheers, DBM From rpettit Wed Dec 1 21:24:39 2010 From: rpettit (Rick Pettit) Date: Wed, 1 Dec 2010 14:24:39 -0600 (CST) Subject: [erlang-questions] mailing list "reply to" In-Reply-To: <934FA413-459B-482B-80E6-225A67EED2A4@gmail.com> References: <934FA413-459B-482B-80E6-225A67EED2A4@gmail.com> Message-ID: <49898.192.168.129.133.1291235079.squirrel@squirrelmail.vail> On Wed, December 1, 2010 2:20 pm, James Churchman wrote: > Is is deliberate that the erlang mailing list does not set the "reply to" > to erlang-questions so that when you click reply in your client > it does not reply to the list? Yes. > This seems a strange option and unlike any other mailing list i have come across :-) Search the list archives and you will find out why this is so. -Rick From hynek Wed Dec 1 23:30:54 2010 From: hynek (Hynek Vychodil) Date: Wed, 1 Dec 2010 23:30:54 +0100 Subject: [erlang-questions] Improving Erlang! In-Reply-To: <000801cb917e\$1a1f0b20\$4e5d2160\$@co.cu> References: <000801cb917e\$1a1f0b20\$4e5d2160\$@co.cu> Message-ID: 2010/12/1 Gilberio Carmenates Garc?a : > Hi all! > > > > Things like this could be nice in Erlang > > > > start(Type, Args)-> > > ChkArg = fun(Arg)-> > > case lists:keyfind(Arg, 1, StartArgs) of > > {Arg, true}-> > > true; > > _-> > > false > > end > > end, > > ? ? ? ? ? ? ? ?if > > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ChkArg(install)-> > > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?MODULE:install(); > > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ChkArg(debug)-> > > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? appmon:start(); > > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? true-> > > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? %% Starts the application. > > > evo_debug_module:print([{debug, true}], "~n~nApplication: \"~p\" is > starting...~n", [?MODULE]), > > > evo_debug_module:print([{debug, true}], "~nType: ~p ? StartArgs: ~p~n", > [Type, StartArgs]), > > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? R = > evo_main_supervisor:start_link(StartArgs), > > > evo_debug_module:print([{debug, true}], "~nApplication: \"~p\" is ready.~n", > [?MODULE]), > > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? R > > ? ? ? ? ? ? ? ?end. If I understand what your code do (and I'm not sure that it is supposed to do) I would write it in this way: start(Type, Args)-> ChkArg = fun(Arg)-> not lists:member({Arg, true}, Args) end, case lists:dropwhile(ChkArg, [install, debug]) of [install|_] -> ?MODULE:install(); [debug|_] -> appmon:start(); [] -> %% Starts the application. evo_debug_module:print([{debug, true}], "~n~nApplication: \"~p\" is starting...~n", [?MODULE]), evo_debug_module:print([{debug, true}], "~nType: ~p StartArgs: ~p~n", [Type, StartArgs]), R = evo_main_supervisor:start_link(StartArgs), evo_debug_module:print([{debug, true}], "~nApplication: \"~p\" is ready.~n", [?MODULE]), R ? ?end. I think that lists:dropwhile(fun(X) -> not lists:member(X, Args) end, ToDo) is pretty idiomatic way for this purpose. > > But that is impossible since the ?if? clause only work with guards, so since > we can not define our own guards that and many other limitations can come > up. > > > > Other nice example of the Erlang limitations could be > > > > get(Name)-> > > MatchHead = #t_char{name='\$1', _='_'}, > > ? ? ? ? ? ? ? ?Guard = {'user_define_compare/2', '\$1', Name}, ? ? ? %% > instead of {'==', '\$1', Name} > > ? ? ? ? ? ? ? ?Result = '\$_', > > ? ? ? ? ? ? ? ?mnesia:dirty_select(t_char,[{MatchHead, [Guard], > [Result]}]). > > > > Or > > > > ? when are_approximately_equals(Name, Name2) ->? ? ? ? ? ? ? %% if I want to > Search a name in a list, that I don?t know exactly what name is? could be in > the list Iv?n Carmenates Garc?a and I search by Ivan Garcia? if the names > are in the database then using just mnesia:select/3 or match I can do that > in just almost one step, since I used my own user defined compare that > validates the approximately match between the real full name and the part of > the name I introduced. > > > > > > > > Regards, > > > > > > Ivan. > > > > ======================================================================= > Este mensaje ha sido enviado mediante el servicio de correo electr?nico que ofrece la Federaci?n de Radioaficionados de Cuba a sus miembros para respaldar el cumplimiento de los objetivos de la organizaci?n y su pol?tica informativa. La persona que env?a este correo asume el compromiso de ?usar el servicio a tales fines y cumplir con las regulaciones establecidas. > -- --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 kostis Thu Dec 2 00:44:05 2010 From: kostis (Kostis Sagonas) Date: Thu, 02 Dec 2010 01:44:05 +0200 Subject: [erlang-questions] guard expression restriction In-Reply-To: References: Message-ID: <4CF6DDC5.1010804@cs.ntua.gr> Andy Kriger wrote: > As a newcomer to Erlang, I'm curious about the reason for the > restriction on guard expressions to a subset of valid Erlang > expressions > > From > http://www.erlang.org/doc/reference_manual/expressions.html#id75235 > " The reason for restricting the set of valid expressions is that > evaluation of a guard expression must be guaranteed to be free of side > effects." > > That's nice, but basically says 'this is so important that the > programmer cannot be trusted to get it right.' Many other parts of the > language don't make this statement - fail early and often is > encouraged, from what I understand. So, I'm wondering about the > history behind that decision and if there's been any talk of removing > that restriction now that Erlang has expanded far beyond the telecom > world. There's a definite benefit to be had in clarity in allowing > user-defined boolean functions that are specific to the application. > Yes, this would leave more room for mistakes and, I'm guessing, cut > off some compiler optimizations, but the decision would be left to the > programmer to make rather than disallowed by the language. > > Not looking to start a fight if this is well hashed ground. As I said, > curious about the history and whether it's been debated as an EEP. As others have already mentioned, the rationale for this decision is that in Erlang guards are seen as an extension of pattern matching. Therefore it's desirable that they are pure functions -- although strictly speaking most but not all current guards are pure -- and also terminating. Throughout the years there have been various discussions debating the pros and cons of allowing user-defined guards, mostly on this mailing list, but very little action in doing something concrete about it. To me (and perhaps to many others), it was always clear that allowing user-defined guards has clear expressiveness benefits in some applications and there is no fundamental issue in disallowing them. However, it was equally clear that their introduction would need to happen cautiously based on program analysis that is able to guarantee the side-effect freeness and termination of functions used as guards. (On top of that, there are some engineering issues in extending the compiler to handle their presence and extending the loader to refuse the re-loading of modules that invalidate the analyses' results.) Bottomline: this is a far from trivial but probably worthwhile addition to the language. For about a year now, Mihalis Pitidis and I have been working on many of the ingredients needed for this change and we already have the necessary static analyses and a prototype implementation of changes to the compiler that allows for the introduction of user-defined guards. But often the devil is in the details. We currently have discussions with the OTP team about making a proper extension of the compiler to support user-defined guards. (But changes to the loader are still pending.) Anyway, our idea is to eventually allow for user-defined guards only functions which static analysis can determine as side-effect free and terminating. But our analyses are actually quite effective. So, stay tuned and user-defined guards may find their place in an Erlang/OTP release near you. Kostis PS. For those interested, a related paper titled "Purity in Erlang", with more information on this topic can be found at: http://user.it.uu.se/~kostis/Papers/purity.pdf Comments on the paper are welcome -- preferably off list, directly to the authors. From robert.virding Thu Dec 2 01:07:24 2010 From: robert.virding (Robert Virding) Date: Thu, 2 Dec 2010 00:07:24 +0000 (GMT) Subject: [erlang-questions] guard expression restriction In-Reply-To: <2056933092.151671291247726377.JavaMail.root@zimbra> Message-ID: <1601319670.151711291248444237.JavaMail.root@zimbra> ----- "Kostis Sagonas" wrote: > > As others have already mentioned, the rationale for this decision is > that in Erlang guards are seen as an extension of pattern matching. > Therefore it's desirable that they are pure functions -- although > strictly speaking most but not all current guards are pure -- and also > > terminating. > > Throughout the years there have been various discussions debating the > > pros and cons of allowing user-defined guards, mostly on this mailing > > list, but very little action in doing something concrete about it. > > To me (and perhaps to many others), it was always clear that allowing > > user-defined guards has clear expressiveness benefits in some > applications and there is no fundamental issue in disallowing them. > However, it was equally clear that their introduction would need to > happen cautiously based on program analysis that is able to guarantee > > the side-effect freeness and termination of functions used as guards. > > (On top of that, there are some engineering issues in extending the > compiler to handle their presence and extending the loader to refuse > the > re-loading of modules that invalidate the analyses' results.) > Bottomline: this is a far from trivial but probably worthwhile > addition > to the language. > > For about a year now, Mihalis Pitidis and I have been working on many > of > the ingredients needed for this change and we already have the > necessary > static analyses and a prototype implementation of changes to the > compiler that allows for the introduction of user-defined guards. But > > often the devil is in the details. We currently have discussions with > > the OTP team about making a proper extension of the compiler to > support > user-defined guards. (But changes to the loader are still pending.) > > Anyway, our idea is to eventually allow for user-defined guards only > functions which static analysis can determine as side-effect free and > > terminating. But our analyses are actually quite effective. > > So, stay tuned and user-defined guards may find their place in an > Erlang/OTP release near you. Would you allow user guard functions to call code in other modules? If so how would ensure that they are side-effect free and terminating in the presence of dynamic code loading? How are errors in user guard functions handled? Will they generate an exception or just cause the guard to fail as happens now? Robert From sysop Thu Dec 2 02:30:46 2010 From: sysop (Matt Stancliff) Date: Wed, 1 Dec 2010 17:30:46 -0800 Subject: [erlang-questions] [available] expensive consultant for hire In-Reply-To: <3A883870-5316-40D4-96A5-16A62836A550@gmail.com> References: <3A883870-5316-40D4-96A5-16A62836A550@gmail.com> Message-ID: <0E634497-DF9B-416E-9F65-01661E951CD4@mindspring.com> On Dec 1, 2010, at 11:27 AM, Joel Reymont wrote: > I have Erlang experience and I'm available immediately. > > I'm expensive but charge a fixed price per project. I'm 10% cheaper. Just FYI, -Matt -- Matt Stancliff San Jose, CA 95110 @mattsta Google Voice: 650-450-8826 "The best way to predict the future is to invent it." --Alan Kay From ok Thu Dec 2 02:59:41 2010 From: ok (Richard O'Keefe) Date: Thu, 2 Dec 2010 14:59:41 +1300 Subject: [erlang-questions] Implementation of a 2006 version of Wichmann-Hill random number generator for Erlang/OTP In-Reply-To: <20101201125650.GA72253@k2r.org> References: <832946219.146801291157435038.JavaMail.root@zimbra> <702DC514-B93F-4B18-A95C-071D9022A9E9@cs.otago.ac.nz> <20101201125650.GA72253@k2r.org> Message-ID: <422C08A9-DC91-4476-AE3C-9BD9C3B45B11@cs.otago.ac.nz> On 2/12/2010, at 1:56 AM, Kenji Rikitake wrote: > I'd appreciate if I could take a look at your code for the random module > with multiple choice of algorithms. I'll send this privately. The *interface* is general, the *code* is not. > uniform() value range: > 0.0 =< uniform() < 1.0 Same as drand48(). > uniform(N) when N = integer() value range: > 1 =< uniform(N) =< N Yes. From sky Thu Dec 2 03:11:03 2010 From: sky (sky) Date: Thu, 02 Dec 2010 10:11:03 +0800 Subject: [erlang-questions] Some problem abount odbc? In-Reply-To: <20101201190745.GA18643@ecn.lan> References: <1291167971.28478.8.camel@shanghai> <4CF5B2CB.3020206@7road.com> <20101201190745.GA18643@ecn.lan> Message-ID: <4CF70037.4020803@7road.com> Hi michael, I got the correct result by using unicode module: unicode:characters_to_list(Data, {utf16, little}. Thank you very much! ? 2010-12-2 3:07, Michael Santos ??: > On Wed, Dec 01, 2010 at 10:28:27AM +0800, sky wrote: > >> When i used odbc to connect a sql server database, i met some >> problem???all string data which returned by odbc:sql_query() has been >> convert to binary, >> even though i set option binary_strings=off, > binary_strings=off only works with SQL_C_CHAR data. The data type returned > by nvarchar is SQL_C_WCHAR. > >> what's the matter? And how >> could i get the string format? >> >> the original string is "192.168.0.4", and the convert binary is >> <<49,0,57,0,50,0,46,0,49,0,54,0,56,0,46,0,48,0,46,0,52,0>>. and the > The returned data is unicode, 2 bytes representing each character: > "1\09\02\0.\01\06\08\0.\00\0.\04\0". > >> datatype of the string is nvarchar??? > Try converting the data to varchar or using the unicode module: > > 1> IP =<<49,0,57,0,50,0,46,0,49,0,54,0,56,0,46,0,48,0,46,0,52,0>>. > <<49,0,57,0,50,0,46,0,49,0,54,0,56,0,46,0,48,0,46,0,52,0>> > > 2> unicode:characters_to_list(IP, {utf16,little}). > "192.168.0.4" > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > > __________ Information from ESET NOD32 Antivirus, version of virus signature database 5619 (20101114) __________ > > The message was checked by ESET NOD32 Antivirus. > > http://www.eset.com > > > > From ok Thu Dec 2 04:02:29 2010 From: ok (Richard O'Keefe) Date: Thu, 2 Dec 2010 16:02:29 +1300 Subject: [erlang-questions] guard expression restriction In-Reply-To: References: Message-ID: <3ECCCDBC-2EAC-41CB-952D-627991AFC98E@cs.otago.ac.nz> On 2/12/2010, at 4:11 AM, Andy Kriger wrote: > As a newcomer to Erlang, I'm curious about the reason for the > restriction on guard expressions to a subset of valid Erlang > expressions Strictly speaking, they aren't, and in earlier versions this was much clearer. Guards used "," for "and" and ";" for "or" and tests like atom(X) and P > Q, and *originally* these could not be expressed in bodies at all. What's more, for those operations which were allowed in both contexts, the *semantics* were different. In a body, 1+a raises an exception; in a guard, 1+a simply fails. With hindsight, it was a conceptual mistake when the language was changed to allow guard tests to be called in bodies as if they were functions, because now it _looked_ as though guards were a kind of expression, which thanks to the differing semantics, they are not. It was another conceptual mistake when the language was extended to give us (at least) four different ways of saying "and", and another blurring of categories when they were all allowed in guards. But it's _still_ the case that operations in guards and operations in bodies do not mean the same thing, so despite the blurring and confusion in recent versions of Erlang, it still is not true that guards are expressions. > http://www.erlang.org/doc/reference_manual/expressions.html#id75235 > " The reason for restricting the set of valid expressions is that > evaluation of a guard expression must be guaranteed to be free of side > effects." > Actually, that's wrong. Erlang guards were not obtained by restricting Erlang expressions, but by generalising Strand88 guards, which are basically the same as Parlog or FCP guards. It's also wrong because it is also important that guard tests *terminate*. The thing is that a "reduction" in Erlang is selecting a rule; it's the primitive computational step, and because it's the _primitive_ computational step, it should not result in any communication, the selection of one rule should be independent of the selection of any other that might be happening at the same time. > That's nice, but basically says 'this is so important that the > programmer cannot be trusted to get it right.' While that's not what it says, it appears to be true. > Many other parts of the > language don't make this statement - fail early and often is > encouraged, from what I understand. This is a non-sequitur. Not allowing communication, side effects, or non-termination is not about not *failing* but about not going *mad*. > So, I'm wondering about the > history behind that decision and if there's been any talk of removing > that restriction now that Erlang has expanded far beyond the telecom > world. It never had anything to do with "the telecom world". It has to do with Erlang's origins in the committed concurrent logic programming world (which is also why Erlang doesn't really have a proper Boolean type), and the conceptual integrity of the language. There has been a never-ending stream of people wanting or demanding Erlang guards to be replaced by expressions. Please do search the archives. > There's a definite benefit to be had in clarity in allowing > user-defined boolean functions that are specific to the application. So far nobody has demonstrated this. On the contrary, I have demonstrated that "user-defined boolean functions" are almost always a design disaster. (This is very far from an original observation. It was a commonplace in procedural programming back in the 80s that most Boolean variables should be of some other enumeration type, and it's a commonplace in functional languages that most Bools should be Maybes or Eithers or something else.) > > Not looking to start a fight if this is well hashed ground. This ground has been fought over so often that it's as much a mix of mud and blood as a WWI trench. > There is of course a fairly elementary transformation by means of which anyone who *really* needs a function call in a guard finds out that they don't. f(Arguments) when Expression -> Body; => f(Arguments) -> case Expression of true -> Body ; false -> f'(Arguments) end; f(Vars) -> f'(Vars). where f' is the rest of f with the name changed. I'm not providing an example, because I've tried four and each of them was immediately better without trying to do this in guards... From ok Thu Dec 2 04:05:13 2010 From: ok (Richard O'Keefe) Date: Thu, 2 Dec 2010 16:05:13 +1300 Subject: [erlang-questions] guard expression restriction In-Reply-To: References: <4F364129-4323-40EB-B043-7D42A3D37988@erlang-solutions.com> Message-ID: <517AD84F-2B27-43B5-B98A-C2046CCA474A@cs.otago.ac.nz> On 2/12/2010, at 5:22 AM, Andy Kriger wrote: > Pattern matching is one of the most powerful and attractive parts of > the language itself. I'm sure it's mostly my newness to the style of > programming, but I keep running into situations where I'd like to > write many fine-grained functions using pattern matching but end up > using case statements or if clauses within a function because I don't > see the pattern matching alternative So show us an example! I have two stickers from Brian Marick, which I treasure. The one on my door says To be less wrong than yesterday. The one I like to carry around says An example would be handy about now. From ok Thu Dec 2 04:16:51 2010 From: ok (Richard O'Keefe) Date: Thu, 2 Dec 2010 16:16:51 +1300 Subject: [erlang-questions] guard expression restriction In-Reply-To: References: <4F364129-4323-40EB-B043-7D42A3D37988@erlang-solutions.com> Message-ID: <0A07D514-8EF2-4513-B453-1395C372065C@cs.otago.ac.nz> On 2/12/2010, at 7:22 AM, James Churchman wrote: > Interestingly list comprehensions offer custom guards, if that it of use to you. And what a disaster THAT is. Consider 1> 1+a > 2. ** exception error: bad argument in an arithmetic expression in operator +/2 called as 1 + a In a *guard*, this would be a silent failure. As an expression (which it should never have been allowed to be), exceptions are raised and propagated through > . 2> [X || X <- lists:seq(1,100), X+a > 2]. [] Here the exception became a silent failure. So the guard is a guard. 3> math:cos(foo) > 1. ** exception error: bad argument in function math:cos/1 called as math:cos(foo) 4> [X || X <- lists:seq(1,100), math:cos(foo) > X]. ** exception error: bad argument in function math:cos/1 called as math:cos(foo) Here the exception did NOT become a silent failure! If the guards in list comprehensions are GUARDS, then *any* exception inside one should turn into a silent failure, and query 4 should have the answer [] with no carping. If the guards in list comprehensions are EXPRESSIONS, then every expression inside one should be propagated, and query 2 should have raised an exception. It's even worse. If guards in list comprehensions had been guards, we'd have been able to use Pattern = Expression to bind variables locally inside comprehensions, instead of having to use the kluge Pattern <- [Expression]. Inconsistent treatment of tests in comprehensions like this is a real menace. I would value some kind of static check that the guards in comprehensions are proper guards. From vasdeveloper Thu Dec 2 04:29:43 2010 From: vasdeveloper (Kannan) Date: Wed, 1 Dec 2010 19:29:43 -0800 Subject: Erlang/OTP on CentOS Message-ID: Hi If you are using, used or tested Erlang/OTP on CentOS in SMP enabled high-end telco-grade platforms, please share your experience on Erlang/OTP compatibility, performance and issues with CentOS. I also need your recommendation for Erlang/OTP on CentOS. If you think some other Linux distribution is more suitable for this purpose, please indicate. We will be using HP server hardware. Appreciate your guidance. Kannan. From ok Thu Dec 2 04:38:41 2010 From: ok (Richard O'Keefe) Date: Thu, 2 Dec 2010 16:38:41 +1300 Subject: [erlang-questions] Improving Erlang! In-Reply-To: <000801cb917e\$1a1f0b20\$4e5d2160\$@co.cu> References: <000801cb917e\$1a1f0b20\$4e5d2160\$@co.cu> Message-ID: <1146395F-6991-41B0-8BE7-94695BCB748B@cs.otago.ac.nz> On 2/12/2010, at 6:34 AM, Gilberio Carmenates Garc?a wrote: > Hi all! > > > > Things like this could be nice in Erlang > > > > start(Type, Args)-> > > ChkArg = fun(Arg)-> > > case lists:keyfind(Arg, 1, StartArgs) of > > {Arg, true}-> > > true; > > _-> > > false > > end > > end, > > if > > ChkArg(install)-> > > ?MODULE:install(); > > ChkArg(debug)-> > > appmon:start(); > > true-> > > %% Starts the application. > > > evo_debug_module:print([{debug, true}], "~n~nApplication: \"~p\" is > starting...~n", [?MODULE]), > > > evo_debug_module:print([{debug, true}], "~nType: ~p StartArgs: ~p~n", > [Type, StartArgs]), > > R = > evo_main_supervisor:start_link(StartArgs), > > > evo_debug_module:print([{debug, true}], "~nApplication: \"~p\" is ready.~n", > [?MODULE]), > > R > > end. > > > > But that is impossible However, start(Type, StartArgs) -> ChkArg = fun (Arg) -> case lists:keyfind(Arg, 1, StartArgs) of {Arg, true} -> true ; _ -> false end end, case ChkArg(install) of true -> ?MODULE:install() ; false -> case ChkArg(debug) of true -> appmod:start() ; false -> evo_debug_module:print([{debug,true}], "~n~nAplication: \"~p\" is starting...~n", [?MODULE]), ... end end. *is* possible. And for some reason, I found it much easier to see that the debugging stuff is done when the debug flag is OFF in this version than in the original, even when laid out neatly. By the way, there is an EEP to allow 'un-nesting' cases like this. It's also possible to write start_type(StartArgs) -> case lists:member({install,true}, StartArgs) of true -> install ; false -> case lists:member({debug,true}, StartArgs) of true -> debug ; false -> start end end. start(Type, StartArgs) -> case start_type(StartArgs) of install -> ?MODULE:install() ; debug -> appmon:start() ; start -> lots of debug output end. Let's generalise a little. first_true_option(Pairs, Flags, Default) returns the first Flag in Flags such that {Flag,true} is in Pairs, or Default is there is no such flag. first_true_option(_, [], Default) -> Default; first_true_option(Pairs, [Flag|Flags], Default) -> case lists:member({Flag,true}, Pairs) of true -> Flag ; false -> first_true_option(Pairs, Flags, Default) end. start(Type, StartArgs) -> case first_true_option(StartArgs, [install,debug], start) of install -> ... ; debug -> ... ; start -> ... end. > since the ?if? clause only work with guards, so since > we can not define our own guards that and many other limitations can come > up. And as we now see, it doesn't matter in the slightest. Using a 'case' form instead of an 'if' means that - the order of the cases doesn't have to matter - it can be easier to see oddities, like debugging output NOT being in the debug case. From ok Thu Dec 2 04:42:08 2010 From: ok (Richard O'Keefe) Date: Thu, 2 Dec 2010 16:42:08 +1300 Subject: [erlang-questions] mailing list "reply to" In-Reply-To: <934FA413-459B-482B-80E6-225A67EED2A4@gmail.com> References: <934FA413-459B-482B-80E6-225A67EED2A4@gmail.com> Message-ID: <9CCA96C0-15E9-44CC-970F-FD0F8CF9B7B6@cs.otago.ac.nz> On 2/12/2010, at 9:20 AM, James Churchman wrote: > Is is deliberate that the erlang mailing list does not set the "reply to" to erlang-questions so that when you click reply in your client it does not reply to the list? > > This seems a strange option and unlike any other mailing list i have come across :-) It should not be. *NO* mailing list is supposed to set Reply-To. See for example http://aperiodic.net/phil/archives/Geekery/list-reply-to.html Reply-To is for message authors to set when they DON'T want replies to go to the list. In "Mail" on a Mac, "Reply" goes to the author, "Reply All" to the list and the author. From andre Thu Dec 2 04:01:17 2010 From: andre (Andre Nathan) Date: Thu, 02 Dec 2010 01:01:17 -0200 Subject: Modifying all entries in a mnesia table Message-ID: <1291258877.2053.12.camel@homesick> Hello I have a mnesia table for a quota system. Quotas are specified as daily values, so the counters should be reset to 0 every 24h. Is there anything more efficient than traversing the table with mnesia:{first/1,next/2} and issuing a write for each record? Thanks Andre From nbowe Thu Dec 2 05:05:29 2010 From: nbowe (Nikolas Bowe) Date: Thu, 02 Dec 2010 15:05:29 +1100 Subject: [erlang-questions] Erlounge Melbourne - Sat 4/12 In-Reply-To: References: <4CF48EAF.5070304@infinite-interactive.com> <201011302000.33706.als@iinet.net.au> Message-ID: <4CF71B09.1000009@infinite-interactive.com> Unfortunately Francesco said he will be flying to Canberra at that time. He did say he will mention the lounge at his talk/tutorial though. We (Infinite Interactive) are sending a couple of people to his talk (if there is space). Unfortunately I cant make his talk. But at least one of the people that is going will come to the Erlounge. The foreign Erlang professionals that I think will be in town are Ulf (Erlang Consulting. "The man that knows everything about Mnesia". Quite a lot of other stuff too), Kresten (Erjang VM implementer), Justin (CTO at Basho. Makers of the Riak NoSQL db. Basho and its employees are also the maintainers of Rebar, Webmachine, and a bunch of other interesting stuff). It would be great to see you guys if you are available. On 12/2/2010 12:36 AM, Edmond Begumisa wrote: > We had put this Erlounge together in "honor" of Erlang consulting > coming to Melbourne for YOW! (the date and time was originally > co-ordinated with Ulf.) It would really be great if Francesco could > make it. Please consider dragging him to Fed. Square :) > > - Edmond - > > On Wed, 01 Dec 2010 09:26:07 +1100, Julian Doherty > wrote: > >> So many tech events happening in Melbourne around YOW this week all >> at once! >> Tricky to fit them all in. Would love to come along on Saturday >> night, but >> not sure if I'll make it or not. >> >> I'm hosting Francesco's talk at Lonely Planet on Saturday, so will >> see a few >> of you there. >> >> Am definitely keen for future events and getting regular meetups >> happening >> with the Erlang crowd in Melbourne. >> >> Cheers >> Julian Doherty >> >> On 30 November 2010 20:00, Anthony Shipman wrote: >> >>> On Tue, 30 Nov 2010 04:42:07 pm Nikolas Bowe wrote: >>> > Hi everyone. >>> > >>> > There will be an Erlounge at Beer DeLuxe from 7pm on Saturday 4th >>> Dec. >>> > This is just a social event. No presentations this time. Maybe >>> next time >>> > depending on what people want. >>> >>> How will we recognise you? >>> -- >>> Anthony Shipman Mamas don't let your babies >>> als grow up to be outsourced. >>> >>> ________________________________________________________________ >>> erlang-questions (at) erlang.org mailing list. >>> See http://www.erlang.org/faq.html >>> To unsubscribe; mailto:erlang-questions-unsubscribe >>> >>> > > This message and its attachments may contain legally privileged or confidential information. This message is intended for the use of the individual or entity to which it is addressed. If you are not the addressee indicated in this message, or the employee or agent responsible for delivering the message to the intended recipient, you may not copy or deliver this message or its attachments to anyone. Rather, you should permanently delete this message and its attachments and kindly notify the sender by reply e-mail. Any content of this message and its attachments, which does not relate to the official business of the sending company must be taken not to have been sent or endorsed by the sending company or any of its related entities. No warranty is made that the e-mail or attachment(s) are free from computer virus or other defect. From bob Thu Dec 2 05:18:52 2010 From: bob (Bob Ippolito) Date: Thu, 2 Dec 2010 11:18:52 +0700 Subject: [erlang-questions] Modifying all entries in a mnesia table In-Reply-To: <1291258877.2053.12.camel@homesick> References: <1291258877.2053.12.camel@homesick> Message-ID: You could store the current date as part of the record and simply treat the value as 0 on read if the date doesn't match the current date. This will save a lot of I/O and probably won't add too much complexity. On Thu, Dec 2, 2010 at 10:01 AM, Andre Nathan wrote: > Hello > > I have a mnesia table for a quota system. Quotas are specified as daily > values, so the counters should be reset to 0 every 24h. Is there > anything more efficient than traversing the table with > mnesia:{first/1,next/2} and issuing a write for each record? > > Thanks > Andre > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From ebegumisa Thu Dec 2 05:22:00 2010 From: ebegumisa (Edmond Begumisa) Date: Thu, 02 Dec 2010 15:22:00 +1100 Subject: [erlang-questions] Erlounge Melbourne - Sat 4/12 In-Reply-To: <4CF71B09.1000009@infinite-interactive.com> References: <4CF48EAF.5070304@infinite-interactive.com> <201011302000.33706.als@iinet.net.au> <4CF71B09.1000009@infinite-interactive.com> Message-ID: On Thu, 02 Dec 2010 15:05:29 +1100, Nikolas Bowe wrote: > Unfortunately Francesco said he will be flying to Canberra at that time. That's too bad :( > He did say he will mention the lounge at his talk/tutorial though. > > We (Infinite Interactive) are sending a couple of people to his talk (if > there is space). > Unfortunately I cant make his talk. But at least one of the people that > is going will come to the Erlounge. > > The foreign Erlang professionals that I think will be in town are Ulf > (Erlang Consulting. "The man that knows everything about Mnesia". Quite > a lot of other stuff too), I've confirmed Ulf is no longer coming BTW. > Kresten (Erjang VM implementer), Justin (CTO at Basho. Makers of the > Riak NoSQL db. Basho and its employees are also the maintainers of > Rebar, Webmachine, and a bunch of other interesting stuff). Great! > It would be great to see you guys if you are available. > I will definitely be at the Erlounge, and will attend to tutorial too (though I might be quite late for the latter.) - Edmond - > > > On 12/2/2010 12:36 AM, Edmond Begumisa wrote: >> We had put this Erlounge together in "honor" of Erlang consulting >> coming to Melbourne for YOW! (the date and time was originally >> co-ordinated with Ulf.) It would really be great if Francesco could >> make it. Please consider dragging him to Fed. Square :) >> >> - Edmond - >> >> On Wed, 01 Dec 2010 09:26:07 +1100, Julian Doherty >> wrote: >> >>> So many tech events happening in Melbourne around YOW this week all at >>> once! >>> Tricky to fit them all in. Would love to come along on Saturday night, >>> but >>> not sure if I'll make it or not. >>> >>> I'm hosting Francesco's talk at Lonely Planet on Saturday, so will see >>> a few >>> of you there. >>> >>> Am definitely keen for future events and getting regular meetups >>> happening >>> with the Erlang crowd in Melbourne. >>> >>> Cheers >>> Julian Doherty >>> >>> On 30 November 2010 20:00, Anthony Shipman wrote: >>> >>>> On Tue, 30 Nov 2010 04:42:07 pm Nikolas Bowe wrote: >>>> > Hi everyone. >>>> > >>>> > There will be an Erlounge at Beer DeLuxe from 7pm on Saturday 4th >>>> Dec. >>>> > This is just a social event. No presentations this time. Maybe next >>>> time >>>> > depending on what people want. >>>> >>>> How will we recognise you? >>>> -- Anthony Shipman Mamas don't let your babies >>>> als grow up to be outsourced. >>>> >>>> ________________________________________________________________ >>>> erlang-questions (at) erlang.org mailing list. >>>> See http://www.erlang.org/faq.html >>>> To unsubscribe; mailto:erlang-questions-unsubscribe >>>> >>>> >> >> > > > This message and its attachments may contain legally privileged or > confidential information. This message is intended for the use of the > individual or entity to which it is addressed. If you are not the > addressee indicated in this message, or the employee or agent > responsible for delivering the message to the intended recipient, you > may not copy or deliver this message or its attachments to anyone. > Rather, you should permanently delete this message and its attachments > and kindly notify the sender by reply e-mail. Any content of this > message and its attachments, which does not relate to the official > business of the sending company must be taken not to have been sent or > endorsed by the sending company or any of its related entities. No > warranty is made that the e-mail or attachment(s) are free from computer > virus or other defect. > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ From sky Thu Dec 2 05:37:15 2010 From: sky (sky) Date: Thu, 02 Dec 2010 12:37:15 +0800 Subject: [erlang-questions] Some problem abount exit signal? In-Reply-To: <20101201190745.GA18643@ecn.lan> References: <1291167971.28478.8.camel@shanghai> <4CF5B2CB.3020206@7road.com> <20101201190745.GA18643@ecn.lan> Message-ID: <4CF7227B.3050709@7road.com> Hi guys, In the Joe's book <>, page 163, there are some description about exit signal : When an exit signal arrives at a process, then a number of different things might happen. What happens depends upon the state of the receiving process and upon the value of the exit signal and is deter- mined by the following table: but when use edemo1:start(true, {die, kill}), the result is: edemo1:start(true, {die,kill}). Process b received {'EXIT',<0.73.0>,kill} process b (<0.72.0>) is alive process c (<0.73.0>) is dead ok Why process b is alive? Cause as the descripion in this book, when the exit signal {'EXIT',<0.73.0>,kill} arrived, the process b will die and broadcast the exit signal killed to the link set. the souce code of edemo1 module as following: %% --- %% Excerpted from "Programming Erlang", %% published by The Pragmatic Bookshelf. %% Copyrights apply to this code. It may not be used to create training material, %% courses, books, articles, and the like. Contact us if you are in doubt. %% We make no guarantees that this code is fit for any purpose. %% Visit http://www.pragmaticprogrammer.com/titles/jaerlang for more book information. %%--- -module(edemo1). -export([start/2]). start(Bool, M) -> A = spawn(fun() -> a() end), B = spawn(fun() -> b(A, Bool) end), C = spawn(fun() -> c(B, M) end), sleep(1000), status(b, B), status(c, C). a() -> process_flag(trap_exit, true), wait(a). b(A, Bool) -> process_flag(trap_exit, Bool), link(A), wait(b). c(B, M) -> link(B), case M of {die, Reason} -> exit(Reason); {divide, N} -> 1/N, wait(c); normal -> true end. wait(Prog) -> receive Any -> io:format("Process ~p received ~p~n",[Prog, Any]), wait(Prog) end. sleep(T) -> receive after T -> true end. status(Name, Pid) -> case erlang:is_process_alive(Pid) of true -> io:format("process ~p (~p) is alive~n", [Name, Pid]); false -> io:format("process ~p (~p) is dead~n", [Name,Pid]) end. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: moz-screenshot.png Type: image/png Size: 21681 bytes Desc: not available URL: From mazen.harake Thu Dec 2 08:01:30 2010 From: mazen.harake (Mazen Harake) Date: Thu, 02 Dec 2010 09:01:30 +0200 Subject: [erlang-questions] mailing list "reply to" In-Reply-To: <9CCA96C0-15E9-44CC-970F-FD0F8CF9B7B6@cs.otago.ac.nz> References: <934FA413-459B-482B-80E6-225A67EED2A4@gmail.com> <9CCA96C0-15E9-44CC-970F-FD0F8CF9B7B6@cs.otago.ac.nz> Message-ID: <4CF7444A.8070404@erlang-solutions.com> On 02/12/2010 05:42, Richard O'Keefe wrote: > Reply-To is for message authors to set when they DON'T want replies to go to > the list. Aren't most replies going to the list? E.g. When replying to you I had to first do Reply All and then remove your name from the To field so that you don't get a personal copy AND a message is sent to the mailing list. Isn't the point of the mailing list to have a forum-like behaviour? If so then the e-mail way of doing it (as you describe below and I agree with) is NOT the right way but rather "Reply" should go to the list. I think OP meant that reply should be list-reply. > In "Mail" on a Mac, "Reply" goes to the author, "Reply All" to the list > and the author. > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > From ulf.wiger Thu Dec 2 08:00:24 2010 From: ulf.wiger (Ulf Wiger) Date: Thu, 2 Dec 2010 08:00:24 +0100 Subject: [erlang-questions] Some problem abount exit signal? In-Reply-To: <4CF7227B.3050709@7road.com> References: <1291167971.28478.8.camel@shanghai> <4CF5B2CB.3020206@7road.com> <20101201190745.GA18643@ecn.lan> <4CF7227B.3050709@7road.com> Message-ID: <7676E6F8-DBDE-43C9-A365-E7C669F4DA7C@erlang-solutions.com> Process C terminates itself with exit(kill). The atom 'kill' is not special in this case, but simply a normal exit reason. A propagated exit signal can never act as a kill signal in the first place, but here, not even the original exit is an untrappable kill. Try: Eshell V5.8.1 (abort with ^G) 1> self(). <0.31.0> 2> catch exit(kill). {'EXIT',kill} 3> self(). <0.31.0> BR, Ulf W On 2 Dec 2010, at 05:37, sky wrote: > Hi guys, > > In the Joe's book <>, page 163, there are some description about exit signal : > > When an exit signal arrives at a process, then a number of different > things might happen. What happens depends upon the state of the > receiving process and upon the value of the exit signal and is deter- > mined by the following table: > > > but when use edemo1:start(true, {die, kill}), the result is: > > edemo1:start(true, {die,kill}). > Process b received {'EXIT',<0.73.0>,kill} > process b (<0.72.0>) is alive > process c (<0.73.0>) is dead > ok > Why process b is alive? Cause as the descripion in this book, when the exit signal > {'EXIT',<0.73.0>,kill} > arrived, the process b will die and broadcast the exit signal killed to the link set. > > the souce code of edemo1 module as following: > > %% --- > %% Excerpted from "Programming Erlang", > %% published by The Pragmatic Bookshelf. > %% Copyrights apply to this code. It may not be used to create training material, > %% courses, books, articles, and the like. Contact us if you are in doubt. > %% We make no guarantees that this code is fit for any purpose. > %% Visit http://www.pragmaticprogrammer.com/titles/jaerlang for more book information. > %%--- > > -module(edemo1). > -export([start/2]). > > start(Bool, M) -> > A = spawn(fun() -> a() end), > B = spawn(fun() -> b(A, Bool) end), > C = spawn(fun() -> c(B, M) end), > sleep(1000), > status(b, B), > status(c, C). > > > a() -> > process_flag(trap_exit, true), > wait(a). > > b(A, Bool) -> > process_flag(trap_exit, Bool), > link(A), > wait(b). > > c(B, M) -> > link(B), > case M of > {die, Reason} -> > exit(Reason); > {divide, N} -> > 1/N, > wait(c); > normal -> > true > end. > > > > wait(Prog) -> > receive > Any -> > io:format("Process ~p received ~p~n",[Prog, Any]), > wait(Prog) > end. > > > > sleep(T) -> > receive > after T -> true > end. > > status(Name, Pid) -> > case erlang:is_process_alive(Pid) of > true -> > io:format("process ~p (~p) is alive~n", [Name, Pid]); > false -> > io:format("process ~p (~p) is dead~n", [Name,Pid]) > end. > > Ulf Wiger, CTO, Erlang Solutions, Ltd. http://erlang-solutions.com From kostis Thu Dec 2 09:08:29 2010 From: kostis (Kostis Sagonas) Date: Thu, 02 Dec 2010 10:08:29 +0200 Subject: [erlang-questions] guard expression restriction In-Reply-To: <1601319670.151711291248444237.JavaMail.root@zimbra> References: <1601319670.151711291248444237.JavaMail.root@zimbra> Message-ID: <4CF753FD.7060808@cs.ntua.gr> Robert Virding wrote: > ----- "Kostis Sagonas" wrote: > >> As others have already mentioned, the rationale for this decision is >> that in Erlang guards are seen as an extension of pattern matching. >> Therefore it's desirable that they are pure functions -- although >> strictly speaking most but not all current guards are pure -- and also >> terminating. >> >> Throughout the years there have been various discussions debating the >> pros and cons of allowing user-defined guards, mostly on this mailing >> list, but very little action in doing something concrete about it. >> >> To me (and perhaps to many others), it was always clear that allowing >> user-defined guards has clear expressiveness benefits in some >> applications and there is no fundamental issue in disallowing them. >> However, it was equally clear that their introduction would need to >> happen cautiously based on program analysis that is able to guarantee >> the side-effect freeness and termination of functions used as guards. >> (On top of that, there are some engineering issues in extending the >> compiler to handle their presence and extending the loader to refuse >> the re-loading of modules that invalidate the analyses' results.) >> Bottomline: this is a far from trivial but probably worthwhile >> addition to the language. >> >> For about a year now, Mihalis Pitidis and I have been working on many >> of the ingredients needed for this change and we already have the >> necessary >> static analyses and a prototype implementation of changes to the >> compiler that allows for the introduction of user-defined guards. But >> often the devil is in the details. We currently have discussions with >> the OTP team about making a proper extension of the compiler to >> support >> user-defined guards. (But changes to the loader are still pending.) >> >> Anyway, our idea is to eventually allow for user-defined guards only >> functions which static analysis can determine as side-effect free and >> terminating. But our analyses are actually quite effective. >> >> So, stay tuned and user-defined guards may find their place in an >> Erlang/OTP release near you. > > Would you allow user guard functions to call code in other modules? Yes, as long as the analysis can determine the properties these functions need to satisfy. > If so how would ensure that they are side-effect free and terminating in the presence of dynamic code loading? I wrote this in my mail: "the loader needs to be extended to refuse the re-loading of modules that invalidate the analyses' results." This means that code reloading that changes properties that the compiler relies upon needs to happen not on a module by module basis, but on a set of modules basis. By the way, to me at least, this seems a more sane thing to do, independently of whether user-guards are present or not. It's high time that something like this happens. Erlang's desing to allow re-loading of individual modules that differ in fundamental ways from their prior versions (e.g. adding arguments to existing functions or removing functions used in other modules of an application) always seemed quite arbitrary, weird, and dangerous to me. IMO, Erlang would be a better language if it provided a construct to reload atomically a *set* of modules. > How are errors in user guard functions handled? Will they generate an exception or just cause the guard to fail as happens now? There is no change in this respect. This is an orthogonal issue. Kostis From kostis Thu Dec 2 09:37:55 2010 From: kostis (Kostis Sagonas) Date: Thu, 02 Dec 2010 10:37:55 +0200 Subject: [erlang-questions] guard expression restriction In-Reply-To: <3ECCCDBC-2EAC-41CB-952D-627991AFC98E@cs.otago.ac.nz> References: <3ECCCDBC-2EAC-41CB-952D-627991AFC98E@cs.otago.ac.nz> Message-ID: <4CF75AE3.4040303@cs.ntua.gr> Richard O'Keefe wrote: > ... > There is of course a fairly elementary transformation by means of > which anyone who *really* needs a function call in a guard finds > out that they don't. > > f(Arguments) when Expression -> Body; > > > => > f(Arguments) -> > case Expression > of true -> Body > ; false -> f'(Arguments) > end; > f(Vars) -> f'(Vars). > > where f' is the rest of f with the name changed. Yes, Erlang is Turing complete as it is (so you can express in it any algorithm you want to) and of course there is that transformation, but do you really claim that the bulky code with the case statement and having to factor the rest of f into a separate function is more expressive and programmer-friendly than the one liner with the guard? Sorry, but I do not see this. > I'm not providing an example, because I've tried four and each of > them was immediately better without trying to do this in guards... Hmmm... In any case, the paper I mentioned in my previous mail contains an example of more clear and succinct code when user-defined guards are allowed. Kostis From ulf.wiger Thu Dec 2 10:34:27 2010 From: ulf.wiger (Ulf Wiger) Date: Thu, 2 Dec 2010 10:34:27 +0100 Subject: [erlang-questions] guard expression restriction In-Reply-To: <4CF75AE3.4040303@cs.ntua.gr> References: <3ECCCDBC-2EAC-41CB-952D-627991AFC98E@cs.otago.ac.nz> <4CF75AE3.4040303@cs.ntua.gr> Message-ID: <50860F48-FC3D-4286-B616-A5F1FFF74BA8@erlang-solutions.com> On 2 Dec 2010, at 09:37, Kostis Sagonas wrote: > > Yes, Erlang is Turing complete as it is (so you can express in it any algorithm you want to) and of course there is that transformation, but do you really claim that the bulky code with the case statement and having to factor the rest of f into a separate function is more expressive and programmer-friendly than the one liner with the guard? Sorry, but I do not see this. I interpreted Richard's point as being that it's a rather simple matter to write your program with user-defined tests that are not guards, even today. I don't think it is as elegant, but it doesn't blow up in your face either. I wrote in a previous mail that tackling abstract patterns, higher-order patterns, and parameterised receive (possibly in one single approach) would have a more revolutionary effect on Erlang programming than user-defined guards, as it would make it possible to do things that are very hard or awkward to do today. Allowing user-defined guards is IMHO probably a good thing, but will serve to make programs just a little bit more concise than today. And as you, Kostis, have pointed out, it is still non-trivial. Hopefully some of that work will also help attack what I see as the more interesting issues. BR, Ulf W Ulf Wiger, CTO, Erlang Solutions, Ltd. http://erlang-solutions.com From hynek Thu Dec 2 11:44:32 2010 From: hynek (Hynek Vychodil) Date: Thu, 2 Dec 2010 11:44:32 +0100 Subject: [erlang-questions] guard expression restriction In-Reply-To: <4CF75AE3.4040303@cs.ntua.gr> References: <3ECCCDBC-2EAC-41CB-952D-627991AFC98E@cs.otago.ac.nz> <4CF75AE3.4040303@cs.ntua.gr> Message-ID: On Thu, Dec 2, 2010 at 9:37 AM, Kostis Sagonas wrote: > Richard O'Keefe wrote: >> >> ... >> There is of course a fairly elementary transformation by means of >> which anyone who *really* needs a function call in a guard finds >> out that they don't. >> >> ? ? ? ?f(Arguments) when Expression -> Body; >> ? ? ? ? >> >> => >> ? ? ? ?f(Arguments) -> >> ? ? ? ? ? ?case Expression >> ? ? ? ? ? ? ?of true -> Body >> ? ? ? ? ? ? ? ; false -> f'(Arguments) >> ? ? ? ? ? ?end; >> ? ? ? ?f(Vars) -> f'(Vars). >> >> where f' is the rest of f with the name changed. > > Yes, Erlang is Turing complete as it is (so you can express in it any > algorithm you want to) and of course there is that transformation, but do > you really claim that the bulky code with the case statement and having to > factor the rest of f into a separate function is more expressive and > programmer-friendly than the one liner with the guard? Sorry, but I do not > see this. > Anyway, this rewritten version doesn't behaves like guards because it should be more like: ? ? ? ?f(Arguments) -> ? ? ? ? ? ?case catch Expression ? ? ? ? ? ? ?of true -> Body ? ? ? ? ? ? ? ; _ -> f'(Arguments) ? ? ? ? ? ?end; ? ? ? ?f(Vars) -> f'(Vars). or even worse ? ? ? ?f(Arguments) -> ? ? ? ? ? ?try Expression ? ? ? ? ? ? ?of true -> Body ? ? ? ? ? ? ? ; _ -> f'(Arguments) catch _:_ -> f'(Arguments) ? ? ? ? ? ?end; ? ? ? ?f(Vars) -> f'(Vars). because soon or late one would write throw(true) inside Expression. >> I'm not providing an example, because I've tried four and each of >> them was immediately better without trying to do this in guards... > > Hmmm... In any case, the paper I mentioned in my previous mail contains an > example of more clear and succinct code when user-defined guards are > allowed. > > Kostis > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > -- --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 paolo.negri Thu Dec 2 11:52:14 2010 From: paolo.negri (Paolo Negri) Date: Thu, 2 Dec 2010 11:52:14 +0100 Subject: crypto:sha_mac correct invcation Message-ID: Hi everyone Sorry for the newbie question, I'm trying to understand how crypto:sha_mac/2 should be invoked Key = "my_key". Data = "GET\n\n\nThu, 02 Dec 2010 10:05:01 GMT\n/". crypto:sha_mac(Key, Data). ** exception error: bad argument in function port_control/3 called as port_control(crypto_drv02,11, [<<0,0,0,6>>, "my_key","GET\n\n\nThu, 02 Dec 2010 10:05:01 GMT\n/"]) This is an extraction from a library I'm trying to use https://github.com/Voker57/s3erl and it breaks because internally it executes such a call to crypto:sha_mac I've tried on Erlang R13B03 (erts-5.7.4) installed with apt-get on ubuntu 10.04 and on Erlang R13B04 (erts-5.7.5) compiled from source always on ubuntu 10.04 I read http://www.erlang.org/doc/man/crypto.html#sha_mac-2 and tried converting the list to binary but I didn't manage to make it work. crypto:sha_mac(list_to_binary("my_key"),list_to_binary("GET\n\n\nThu, 02 Dec 2010 10:05:01 GMT\n/")). ** exception error: bad argument in function port_control/3 called as port_control(crypto_drv02,11, [<<0,0,0,6>>, <<"my_key">>, <<"GET\n\n\nThu, 02 Dec 2010 10:05:01 GMT\n/">>]) Thanks for your help. Paolo From bob Thu Dec 2 11:57:42 2010 From: bob (Bob Ippolito) Date: Thu, 2 Dec 2010 17:57:42 +0700 Subject: [erlang-questions] crypto:sha_mac correct invcation In-Reply-To: References: Message-ID: It should be invoked with the crypto application running. application:start(crypto). On Thu, Dec 2, 2010 at 5:52 PM, Paolo Negri wrote: > Hi everyone > > Sorry for the newbie question, I'm trying to understand how > crypto:sha_mac/2 should be invoked > > Key = "my_key". > Data = "GET\n\n\nThu, 02 Dec 2010 10:05:01 GMT\n/". > > crypto:sha_mac(Key, Data). > ** exception error: bad argument > ? ? in function ?port_control/3 > ? ? ? ?called as port_control(crypto_drv02,11, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [<<0,0,0,6>>, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"my_key","GET\n\n\nThu, 02 Dec 2010 > 10:05:01 GMT\n/"]) > > This is an extraction from a library I'm trying to use > https://github.com/Voker57/s3erl > > and it breaks because internally it executes such a call to crypto:sha_mac > > I've tried on Erlang R13B03 (erts-5.7.4) installed with apt-get on > ubuntu 10.04 and on Erlang R13B04 (erts-5.7.5) compiled from source > always on ubuntu 10.04 > > I read http://www.erlang.org/doc/man/crypto.html#sha_mac-2 and tried > converting the list to binary but I didn't manage to make it work. > > crypto:sha_mac(list_to_binary("my_key"),list_to_binary("GET\n\n\nThu, > 02 Dec 2010 10:05:01 GMT\n/")). > ** exception error: bad argument > ? ? in function ?port_control/3 > ? ? ? ?called as port_control(crypto_drv02,11, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [<<0,0,0,6>>, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?<<"my_key">>, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?<<"GET\n\n\nThu, 02 Dec 2010 10:05:01 > GMT\n/">>]) > > Thanks for your help. > > Paolo > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From kostis Thu Dec 2 12:51:55 2010 From: kostis (Kostis Sagonas) Date: Thu, 02 Dec 2010 13:51:55 +0200 Subject: [erlang-questions] guard expression restriction In-Reply-To: References: <3ECCCDBC-2EAC-41CB-952D-627991AFC98E@cs.otago.ac.nz> <4CF75AE3.4040303@cs.ntua.gr> Message-ID: <4CF7885B.9040303@cs.ntua.gr> Hynek Vychodil wrote: > On Thu, Dec 2, 2010 at 9:37 AM, Kostis Sagonas wrote: >> Richard O'Keefe wrote: >>> ... >>> There is of course a fairly elementary transformation by means of >>> which anyone who *really* needs a function call in a guard finds >>> out that they don't. >>> >>> f(Arguments) when Expression -> Body; >>> >>> >>> => >>> f(Arguments) -> >>> case Expression >>> of true -> Body >>> ; false -> f'(Arguments) >>> end; >>> f(Vars) -> f'(Vars). >>> >>> where f' is the rest of f with the name changed. >> Yes, Erlang is Turing complete as it is (so you can express in it any >> algorithm you want to) and of course there is that transformation, but do >> you really claim that the bulky code with the case statement and having to >> factor the rest of f into a separate function is more expressive and >> programmer-friendly than the one liner with the guard? Sorry, but I do not >> see this. >> > > Anyway, this rewritten version doesn't behaves like guards because it > should be more like: > > f(Arguments) -> > case catch Expression > of true -> Body > ; _ -> f'(Arguments) > end; > f(Vars) -> f'(Vars). > > or even worse > > f(Arguments) -> > try Expression > of true -> Body > ; _ -> f'(Arguments) > catch > _:_ -> f'(Arguments) > end; > f(Vars) -> f'(Vars). > > because soon or late one would write throw(true) inside Expression. Very good point... Thanks for the support Hynek! Kostis From alexey.v.romanov Thu Dec 2 13:53:35 2010 From: alexey.v.romanov (Alexey Romanov) Date: Thu, 2 Dec 2010 15:53:35 +0300 Subject: erl -heart and Out Of Memory Message-ID: I've found some old posts saying that when the VM crashes because of an Out Of Memory error, the entire process group is killed -- including the 'heart' process -- and therefore the VM won't restart even though it's started by 'erl -heart'. 1) Is this still the case in R14B? 2) If yes, is there a good workaround? Yours, Alexey Romanov From kuleshovmail Thu Dec 2 14:23:49 2010 From: kuleshovmail (shk) Date: Thu, 2 Dec 2010 05:23:49 -0800 (PST) Subject: Emacs erlang shell window size Message-ID: <1291296229625-3069321.post@n4.nabble.com> Hello, I use Emacs with erlang-mode from Erlang programming. For compiling and erlang expressions computation i use C-c C-k. When i C-c C-k, in emacs opening new Window with erlang shell. How can i change height of this window? Thank you. -- View this message in context: http://erlang.2086793.n4.nabble.com/Emacs-erlang-shell-window-size-tp3069321p3069321.html Sent from the Erlang Questions mailing list archive at Nabble.com. From stephen.cuzzort Thu Dec 2 14:45:42 2010 From: stephen.cuzzort (Stephen Cuzzort) Date: Thu, 2 Dec 2010 08:45:42 -0500 Subject: [erlang-questions] Emacs erlang shell window size In-Reply-To: <1291296229625-3069321.post@n4.nabble.com> References: <1291296229625-3069321.post@n4.nabble.com> Message-ID: If you want the split window to go away, use Cx-1. There are also several nifty commands mentioned on the emacs wiki < http://www.emacswiki.org/emacs/WindowResize> Steve On Thu, Dec 2, 2010 at 8:23 AM, shk wrote: > > Hello, > > I use Emacs with erlang-mode from Erlang programming. For compiling and > erlang expressions computation > i use C-c C-k. When i C-c C-k, in emacs opening new Window with erlang > shell. How can i change height of this window? > > Thank you. > -- > View this message in context: > http://erlang.2086793.n4.nabble.com/Emacs-erlang-shell-window-size-tp3069321p3069321.html > Sent from the Erlang Questions mailing list archive at Nabble.com. > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From vinoski Thu Dec 2 14:51:01 2010 From: vinoski (Steve Vinoski) Date: Thu, 2 Dec 2010 08:51:01 -0500 Subject: [erlang-questions] erl -heart and Out Of Memory In-Reply-To: References: Message-ID: On Thu, Dec 2, 2010 at 7:53 AM, Alexey Romanov wrote: > I've found some old posts saying that when the VM crashes because of > an Out Of Memory error, the entire process group is killed -- > including the 'heart' process -- and therefore the VM won't restart > even though it's started by 'erl -heart'. 1) Is this still the case in > R14B? 2) If yes, is there a good workaround? I've observed numerous OOM conditions under R13 and R14 on Linux but have never seen heart killed as well. --steve From alexey.v.romanov Thu Dec 2 15:59:15 2010 From: alexey.v.romanov (Alexey Romanov) Date: Thu, 2 Dec 2010 17:59:15 +0300 Subject: Setting TZ variable Message-ID: I've tried to follow the advice given by Ulf Wiger in this old thread: http://www.erlang.org/pipermail/erlang-questions/2006-December/024291.html However, it doesn't work for me: aromanov:~/workspace/gmcontroller\$ erl Erlang R14B (erts-5.8.1) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.8.1 (abort with ^G) 1> os:getenv("TZ"). false 2> time(). {17,49,40} 3> os:putenv("TZ", "GMT"). true 4> os:getenv("TZ"). "GMT" 5> time(). {17,50,8} Am I doing something wrong? Setting TZ in the shell does work (but isn't suitable for my purposes): aromanov:~/workspace/gmcontroller\$ TZ=GMT erl Erlang R14B (erts-5.8.1) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.8.1 (abort with ^G) 1> os:getenv("TZ"). "GMT" 2> time(). {14,50,39} Yours, Alexey Romanov From spawn.think Thu Dec 2 16:17:17 2010 From: spawn.think (Ahmed Omar) Date: Thu, 2 Dec 2010 16:17:17 +0100 Subject: [erlang-questions] Erlang/OTP on CentOS In-Reply-To: References: Message-ID: I didn't use it myself, but i would like to point out that Erlang Solutions now provides a native rpm package for CentOs and Fedora among others. ( http://www.erlang-solutions.com/section/72/packages) As i understand they run tests that would guarantee good level of compatibility https://github.com/downloads/esl/otp/otp_src-R14B-1.noarch.rpm On Thu, Dec 2, 2010 at 4:29 AM, Kannan wrote: > Hi > > > > If you are using, used or tested Erlang/OTP on CentOS in SMP enabled > high-end telco-grade platforms, please share your experience on Erlang/OTP > compatibility, performance and issues with CentOS. I also need your > recommendation for Erlang/OTP on CentOS. If you think some other Linux > distribution is more suitable for this purpose, please indicate. > > > > We will be using HP server hardware. > > > > Appreciate your guidance. > > > > Kannan. > -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think From alexey.v.romanov Thu Dec 2 16:41:09 2010 From: alexey.v.romanov (Alexey Romanov) Date: Thu, 2 Dec 2010 18:41:09 +0300 Subject: [erlang-questions] erl -heart and Out Of Memory In-Reply-To: References: Message-ID: On Thu, Dec 2, 2010 at 4:51 PM, Steve Vinoski wrote: > On Thu, Dec 2, 2010 at 7:53 AM, Alexey Romanov > wrote: >> I've found some old posts saying that when the VM crashes because of >> an Out Of Memory error, the entire process group is killed -- >> including the 'heart' process -- and therefore the VM won't restart >> even though it's started by 'erl -heart'. 1) Is this still the case in >> R14B? 2) If yes, is there a good workaround? > > I've observed numerous OOM conditions under R13 and R14 on Linux but > have never seen heart killed as well. > > --steve > Good to know, thanks! From ulf.wiger Thu Dec 2 16:45:59 2010 From: ulf.wiger (Ulf Wiger) Date: Thu, 2 Dec 2010 16:45:59 +0100 Subject: [erlang-questions] Setting TZ variable In-Reply-To: References: Message-ID: <46BBD1ED-4359-42DC-9AB8-6F381C5BF972@erlang-solutions.com> Hmm? At least it works on my Macbook: uwiger\$ erl Erlang R14B (erts-5.8.1) [source] [64-bit] [smp:4:4] [rq:4] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.8.1 (abort with ^G) 1> os:getenv("TZ"). false 2> time(). {16,42,42} 3> os:putenv("TZ","GMT"). true 4> time(). {15,43,2} 5> os:putenv("TZ","EST"). true 6> time(). {10,43,33} BR, Ulf W On 2 Dec 2010, at 15:59, Alexey Romanov wrote: > I've tried to follow the advice given by Ulf Wiger in this old thread: > http://www.erlang.org/pipermail/erlang-questions/2006-December/024291.html > > However, it doesn't work for me: > > aromanov:~/workspace/gmcontroller\$ erl > Erlang R14B (erts-5.8.1) [source] [smp:2:2] [rq:2] [async-threads:0] > [hipe] [kernel-poll:false] > > Eshell V5.8.1 (abort with ^G) > 1> os:getenv("TZ"). > false > 2> time(). > {17,49,40} > 3> os:putenv("TZ", "GMT"). > true > 4> os:getenv("TZ"). > "GMT" > 5> time(). > {17,50,8} > > Am I doing something wrong? > > Setting TZ in the shell does work (but isn't suitable for my purposes): > > aromanov:~/workspace/gmcontroller\$ TZ=GMT erl > Erlang R14B (erts-5.8.1) [source] [smp:2:2] [rq:2] [async-threads:0] > [hipe] [kernel-poll:false] > > Eshell V5.8.1 (abort with ^G) > 1> os:getenv("TZ"). > "GMT" > 2> time(). > {14,50,39} > > Yours, Alexey Romanov > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > Ulf Wiger, CTO, Erlang Solutions, Ltd. http://erlang-solutions.com From jameschurchman Thu Dec 2 17:08:49 2010 From: jameschurchman (James Churchman) Date: Thu, 2 Dec 2010 16:08:49 +0000 Subject: [erlang-questions] guard expression restriction In-Reply-To: <4CF7885B.9040303@cs.ntua.gr> References: <3ECCCDBC-2EAC-41CB-952D-627991AFC98E@cs.otago.ac.nz> <4CF75AE3.4040303@cs.ntua.gr> <4CF7885B.9040303@cs.ntua.gr> Message-ID: <2E360330-F0BC-447D-8603-1F310114C7AD@gmail.com> I'm not sure this argument holds.. guards should fail silently because they are a simple test, nothing else. Custom guards are a piece of procedural code that could potentially span many modules and hundreds of lines of code. Silently failing all this code goes agents erlang let it crash and will lead to errors going unexposed. There is a difference between the try catch example below and the mythical "custom guard" in that in the code below i have the CHOICE to add a try catch or not and let it crash.. @Richard O'Keefe i was unaware of that subtly to list comprehensions. I was surprised that a match that fails does not throw, but make use of that when choosing list comprehension vs other looping mechanisms as it makes handling user supplied data easier. On 2 Dec 2010, at 11:51, Kostis Sagonas wrote: > Hynek Vychodil wrote: >> On Thu, Dec 2, 2010 at 9:37 AM, Kostis Sagonas wrote: >>> Richard O'Keefe wrote: >>>> ... >>>> There is of course a fairly elementary transformation by means of >>>> which anyone who *really* needs a function call in a guard finds >>>> out that they don't. >>>> >>>> f(Arguments) when Expression -> Body; >>>> >>>> >>>> => >>>> f(Arguments) -> >>>> case Expression >>>> of true -> Body >>>> ; false -> f'(Arguments) >>>> end; >>>> f(Vars) -> f'(Vars). >>>> >>>> where f' is the rest of f with the name changed. >>> Yes, Erlang is Turing complete as it is (so you can express in it any >>> algorithm you want to) and of course there is that transformation, but do >>> you really claim that the bulky code with the case statement and having to >>> factor the rest of f into a separate function is more expressive and >>> programmer-friendly than the one liner with the guard? Sorry, but I do not >>> see this. >>> >> Anyway, this rewritten version doesn't behaves like guards because it >> should be more like: >> f(Arguments) -> >> case catch Expression >> of true -> Body >> ; _ -> f'(Arguments) >> end; >> f(Vars) -> f'(Vars). >> or even worse >> f(Arguments) -> >> try Expression >> of true -> Body >> ; _ -> f'(Arguments) >> catch >> _:_ -> f'(Arguments) >> end; >> f(Vars) -> f'(Vars). >> because soon or late one would write throw(true) inside Expression. > > Very good point... Thanks for the support Hynek! > > Kostis > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > From mevans Thu Dec 2 17:10:27 2010 From: mevans (Evans, Matthew) Date: Thu, 2 Dec 2010 11:10:27 -0500 Subject: [erlang-questions] Modifying all entries in a mnesia table In-Reply-To: <1291258877.2053.12.camel@homesick> References: <1291258877.2053.12.camel@homesick> Message-ID: Have a look at mnesia:transform_table/4 For example: mnesia:transform_table(counter_table, fun(Rec) -> Rec#counter_table{counter = 0} end, record_info(counter_table), counter_table). -----Original Message----- From: erlang-questions [mailto:erlang-questions] On Behalf Of Andre Nathan Sent: Wednesday, December 01, 2010 10:01 PM To: erlang-questions Subject: [erlang-questions] Modifying all entries in a mnesia table Hello I have a mnesia table for a quota system. Quotas are specified as daily values, so the counters should be reset to 0 every 24h. Is there anything more efficient than traversing the table with mnesia:{first/1,next/2} and issuing a write for each record? Thanks Andre ________________________________________________________________ erlang-questions (at) erlang.org mailing list. See http://www.erlang.org/faq.html To unsubscribe; mailto:erlang-questions-unsubscribe From dmitriy.kargapolov Thu Dec 2 18:08:56 2010 From: dmitriy.kargapolov (Dmitriy Kargapolov) Date: Thu, 2 Dec 2010 12:08:56 -0500 Subject: OTP-EVA-MIB Message-ID: Hello, Does anybody know if logging and alarm management based on OTP-EVA-MIB.mib have ever been implemented? I found content of this MIB pretty interesting. It makes me thinking that there could be at least attempt to implement OTP logging and alarm management via SNMP, but I couldn't find any traces of this. Just one file lib/otp_mibs/mibs/OTP-EVA-MIB.mib which by default is not copied into release tarball, and some artefacts: \$ grep -C3 evaLog lib/tv/src/tv_main.hrl -define(MNESIA_TABLES, [alarm, alarmTable, evaLogDiscriminatorTable, eva_snmp_map, eventTable, group, Thanks. From alain.odea Thu Dec 2 18:13:48 2010 From: alain.odea (Alain O'Dea) Date: Thu, 2 Dec 2010 13:43:48 -0330 Subject: [erlang-questions] Setting TZ variable In-Reply-To: References: Message-ID: Out of curiosity, do you need to change the timezone at runtime? Otherwise the shell shook be fine. I use the shell approach to force Zotonic into EST. If you need runtime timezone handling I recommend using GMT and putting in a dispay module to convert to the timezone needed by the current process. Otherwise you could get strange behavior when otwo process change the global timezone and get muddled in context switching. On Thursday, December 2, 2010, Alexey Romanov wrote: > I've tried to follow the advice given by Ulf Wiger in this old thread: > http://www.erlang.org/pipermail/erlang-questions/2006-December/024291.html > > However, it doesn't work for me: > > aromanov:~/workspace/gmcontroller\$ erl > Erlang R14B (erts-5.8.1) [source] [smp:2:2] [rq:2] [async-threads:0] > [hipe] [kernel-poll:false] > > Eshell V5.8.1 ?(abort with ^G) > 1> os:getenv("TZ"). > false > 2> time(). > {17,49,40} > 3> os:putenv("TZ", "GMT"). > true > 4> os:getenv("TZ"). > "GMT" > 5> time(). > {17,50,8} > > Am I doing something wrong? > > Setting TZ in the shell does work (but isn't suitable for my purposes): > > aromanov:~/workspace/gmcontroller\$ TZ=GMT erl > Erlang R14B (erts-5.8.1) [source] [smp:2:2] [rq:2] [async-threads:0] > [hipe] [kernel-poll:false] > > Eshell V5.8.1 ?(abort with ^G) > 1> os:getenv("TZ"). > "GMT" > 2> time(). > {14,50,39} > > Yours, Alexey Romanov > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From andrey.pampukha Thu Dec 2 18:20:34 2010 From: andrey.pampukha (Andrey Pampukha) Date: Thu, 2 Dec 2010 20:20:34 +0300 Subject: [erlang-questions] OTP-EVA-MIB In-Reply-To: References: Message-ID: I've just tried googling for OTP-EVA-MIB, found some interesting links to obsolete Erlang/OTP docs like http://www.erlang.org/documentation/doc-5.2/lib/eva-2.0.3/doc/html/eva_snmp_adaptation.html EVA is Event and Alarm handler, and I guess it has been deprecated and removed from OTP someday, but not fully. I suppose it might be the rudiments of some Ericsson's product written in Erlang like AXD301... 2010/12/2, Dmitriy Kargapolov : > Hello, > > Does anybody know if logging and alarm management based on OTP-EVA-MIB.mib > have ever been implemented? > I found content of this MIB pretty interesting. It makes me thinking that > there could be at least attempt to implement OTP logging and alarm > management via SNMP, but I couldn't find any traces of this. Just one file > lib/otp_mibs/mibs/OTP-EVA-MIB.mib which by default is not copied into > release tarball, and some artefacts: > \$ grep -C3 evaLog lib/tv/src/tv_main.hrl > > -define(MNESIA_TABLES, [alarm, > alarmTable, > evaLogDiscriminatorTable, > eva_snmp_map, > eventTable, > group, > > Thanks. > From andrey.pampukha Thu Dec 2 18:33:56 2010 From: andrey.pampukha (Andrey Pampukha) Date: Thu, 2 Dec 2010 20:33:56 +0300 Subject: [erlang-questions] OTP-EVA-MIB In-Reply-To: References: Message-ID: This is the latest mention of EVA that I've found: http://www.erlang.org/documentation/doc-5.3.6.13/lib/eva-2.0.4/doc/html/ 2010/12/2, Andrey Pampukha : > I've just tried googling for OTP-EVA-MIB, > found some interesting links to obsolete Erlang/OTP docs like > http://www.erlang.org/documentation/doc-5.2/lib/eva-2.0.3/doc/html/eva_snmp_adaptation.html > > EVA is Event and Alarm handler, and I guess it has been deprecated and > removed from OTP someday, but not fully. > I suppose it might be the rudiments of some Ericsson's product written > in Erlang like AXD301... > > 2010/12/2, Dmitriy Kargapolov : >> Hello, >> >> Does anybody know if logging and alarm management based on >> OTP-EVA-MIB.mib >> have ever been implemented? >> I found content of this MIB pretty interesting. It makes me thinking that >> there could be at least attempt to implement OTP logging and alarm >> management via SNMP, but I couldn't find any traces of this. Just one >> file >> lib/otp_mibs/mibs/OTP-EVA-MIB.mib which by default is not copied into >> release tarball, and some artefacts: >> \$ grep -C3 evaLog lib/tv/src/tv_main.hrl >> >> -define(MNESIA_TABLES, [alarm, >> alarmTable, >> evaLogDiscriminatorTable, >> eva_snmp_map, >> eventTable, >> group, >> >> Thanks. >> > From dmitriy.kargapolov Thu Dec 2 18:37:08 2010 From: dmitriy.kargapolov (Dmitriy Kargapolov) Date: Thu, 2 Dec 2010 12:37:08 -0500 Subject: [erlang-questions] OTP-EVA-MIB In-Reply-To: References: Message-ID: Yes.. Per "other releases" docs eva application was buried sometime between Erlang/OTP 5.3.6.13 (R9C Patched) and Erlang/OTP 5.4 (R10B) ... It still would be interesting to hear from original authors why it went that way... On Thu, Dec 2, 2010 at 12:33 PM, Andrey Pampukha wrote: > This is the latest mention of EVA that I've found: > http://www.erlang.org/documentation/doc-5.3.6.13/lib/eva-2.0.4/doc/html/ > > 2010/12/2, Andrey Pampukha : > > I've just tried googling for OTP-EVA-MIB, > > found some interesting links to obsolete Erlang/OTP docs like > > > http://www.erlang.org/documentation/doc-5.2/lib/eva-2.0.3/doc/html/eva_snmp_adaptation.html > > > > EVA is Event and Alarm handler, and I guess it has been deprecated and > > removed from OTP someday, but not fully. > > I suppose it might be the rudiments of some Ericsson's product written > > in Erlang like AXD301... > > > > 2010/12/2, Dmitriy Kargapolov : > >> Hello, > >> > >> Does anybody know if logging and alarm management based on > >> OTP-EVA-MIB.mib > >> have ever been implemented? > >> I found content of this MIB pretty interesting. It makes me thinking > that > >> there could be at least attempt to implement OTP logging and alarm > >> management via SNMP, but I couldn't find any traces of this. Just one > >> file > >> lib/otp_mibs/mibs/OTP-EVA-MIB.mib which by default is not copied into > >> release tarball, and some artefacts: > >> \$ grep -C3 evaLog lib/tv/src/tv_main.hrl > >> > >> -define(MNESIA_TABLES, [alarm, > >> alarmTable, > >> evaLogDiscriminatorTable, > >> eva_snmp_map, > >> eventTable, > >> group, > >> > >> Thanks. > >> > > > From andrey.pampukha Thu Dec 2 18:44:57 2010 From: andrey.pampukha (Andrey Pampukha) Date: Thu, 2 Dec 2010 20:44:57 +0300 Subject: [erlang-questions] OTP-EVA-MIB In-Reply-To: References: Message-ID: +1. Digging deeper into EVA's documentation, I've found very interesting thing: Handle = query [E.generated || E <- table(eventTable), E.name = Name] end Usage of the 'query' keyword in R14B leads to the following output: 1> query [X*2||X<-lists:seq(1,10)] end. * 1: mnemosyne query, missing transformation Googling for "erlang mnemosyne", the following link can be found: http://www.erlang.org/documentation/doc-5.5.5/lib/mnemosyne-1.2.7.1/doc/html/mnemosyne.html It's sayd that mnemosyne is some query language for Mnesia. This application is also can't be found in recent Erlang/OTP releases... 2010/12/2, Dmitriy Kargapolov : > Yes.. Per "other releases" docs eva application was buried sometime between > Erlang/OTP 5.3.6.13 (R9C Patched) and Erlang/OTP 5.4 (R10B) ... It still > would be interesting to hear from original authors why it went that way... > > On Thu, Dec 2, 2010 at 12:33 PM, Andrey Pampukha > wrote: > >> This is the latest mention of EVA that I've found: >> http://www.erlang.org/documentation/doc-5.3.6.13/lib/eva-2.0.4/doc/html/ >> >> 2010/12/2, Andrey Pampukha : >> > I've just tried googling for OTP-EVA-MIB, >> > found some interesting links to obsolete Erlang/OTP docs like >> > >> http://www.erlang.org/documentation/doc-5.2/lib/eva-2.0.3/doc/html/eva_snmp_adaptation.html >> > >> > EVA is Event and Alarm handler, and I guess it has been deprecated and >> > removed from OTP someday, but not fully. >> > I suppose it might be the rudiments of some Ericsson's product written >> > in Erlang like AXD301... >> > >> > 2010/12/2, Dmitriy Kargapolov : >> >> Hello, >> >> >> >> Does anybody know if logging and alarm management based on >> >> OTP-EVA-MIB.mib >> >> have ever been implemented? >> >> I found content of this MIB pretty interesting. It makes me thinking >> that >> >> there could be at least attempt to implement OTP logging and alarm >> >> management via SNMP, but I couldn't find any traces of this. Just one >> >> file >> >> lib/otp_mibs/mibs/OTP-EVA-MIB.mib which by default is not copied into >> >> release tarball, and some artefacts: >> >> \$ grep -C3 evaLog lib/tv/src/tv_main.hrl >> >> >> >> -define(MNESIA_TABLES, [alarm, >> >> alarmTable, >> >> evaLogDiscriminatorTable, >> >> eva_snmp_map, >> >> eventTable, >> >> group, >> >> >> >> Thanks. >> >> >> > >> > From anthonym Thu Dec 2 19:47:02 2010 From: anthonym (Anthony Molinaro) Date: Thu, 2 Dec 2010 10:47:02 -0800 Subject: [erlang-questions] Erlang/OTP on CentOS In-Reply-To: References: Message-ID: <20101202184702.GA92268@alumni.caltech.edu> On Wed, Dec 01, 2010 at 07:29:43PM -0800, Kannan wrote: > If you are using, used or tested Erlang/OTP on CentOS in SMP enabled > high-end telco-grade platforms, please share your experience on Erlang/OTP > compatibility, performance and issues with CentOS. I also need your > recommendation for Erlang/OTP on CentOS. If you think some other Linux > distribution is more suitable for this purpose, please indicate. We've been using centos 5 in production on EC2 and our own hardware for some time with no issues. EPEL has R12 packaged, and I've posted specs and patches to build R14 to this list recently (you should be able to search the archives to find it). I've not seen any issues with compatibility. -Anthony -- ------------------------------------------------------------------------ Anthony Molinaro From vasdeveloper Thu Dec 2 20:10:29 2010 From: vasdeveloper (Kannan) Date: Thu, 2 Dec 2010 11:10:29 -0800 Subject: [erlang-questions] Erlang/OTP on CentOS In-Reply-To: References: Message-ID: Hi Ahmed/Tino, Thank you for sharing your experience. I have couple of more questions about the tests that you may have performed. Which Server *X OS or specific distribution of it gave the best performance with stability? Did you do the tests in SMP environment? Did you do the tests with both x86_32(i386) and x86_64 versions of the OS/HW? Did you tests have heavy Mnesia R/W or File/Network IO? Did you have the configurations and usage for asynchronous threads, epoll/kqueue, HiPE, SMP? Did you do the tests for distributed node setup across hosts? I look forward to hear from you. Regards, Kannan. On Thu, Dec 2, 2010 at 7:32 AM, Tino Breddin wrote: > Hi, > > Hi, > > Yes we ran the complete test suite successfully on CentOS 5, which is used > as a basis for this RPM package Ahmed referred to already. > > I'd be very interested in your experience with it and and thoughts in > regard to the versions of CentOS which are interesting. > > Cheers, > Tino > > On Thu, Dec 2, 2010 at 3:17 PM, Ahmed Omar wrote: > >> I didn't use it myself, but i would like to point out that Erlang >> Solutions >> now provides a native rpm package for CentOs and Fedora among others. ( >> http://www.erlang-solutions.com/section/72/packages) >> As i understand they run tests that would guarantee good level >> of compatibility >> https://github.com/downloads/esl/otp/otp_src-R14B-1.noarch.rpm >> >> >> On Thu, Dec 2, 2010 at 4:29 AM, Kannan wrote: >> >> > Hi >> > >> > >> > >> > If you are using, used or tested Erlang/OTP on CentOS in SMP enabled >> > high-end telco-grade platforms, please share your experience on >> Erlang/OTP >> > compatibility, performance and issues with CentOS. I also need your >> > recommendation for Erlang/OTP on CentOS. If you think some other Linux >> > distribution is more suitable for this purpose, please indicate. >> > >> > >> > >> > We will be using HP server hardware. >> > >> > >> > >> > Appreciate your guidance. >> > >> > >> > >> > Kannan. >> > >> >> >> >> -- >> Best Regards, >> - Ahmed Omar >> http://nl.linkedin.com/in/adiaa >> Follow me on twitter >> @spawn_think >> > > From vasdeveloper Thu Dec 2 20:28:44 2010 From: vasdeveloper (Kannan) Date: Thu, 2 Dec 2010 11:28:44 -0800 Subject: [erlang-questions] Erlang/OTP on CentOS In-Reply-To: <20101202184702.GA92268@alumni.caltech.edu> References: <20101202184702.GA92268@alumni.caltech.edu> Message-ID: Hi Anthony, Thank you for sharing your experience. Since you are using the combination in a production environment without any issues, it is a good reference point for me. Regards, Kannan. On Thu, Dec 2, 2010 at 10:47 AM, Anthony Molinaro < anthonym> wrote: > On Wed, Dec 01, 2010 at 07:29:43PM -0800, Kannan wrote: > > If you are using, used or tested Erlang/OTP on CentOS in SMP enabled > > high-end telco-grade platforms, please share your experience on > Erlang/OTP > > compatibility, performance and issues with CentOS. I also need your > > recommendation for Erlang/OTP on CentOS. If you think some other Linux > > distribution is more suitable for this purpose, please indicate. > > We've been using centos 5 in production on EC2 and our own hardware for > some time with no issues. EPEL has R12 packaged, and I've posted specs > and patches to build R14 to this list recently (you should be able to > search the archives to find it). I've not seen any issues with > compatibility. > > -Anthony > > -- > ------------------------------------------------------------------------ > Anthony Molinaro > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From freza Thu Dec 2 20:46:16 2010 From: freza (Jachym Holecek) Date: Thu, 2 Dec 2010 19:46:16 +0000 Subject: [erlang-questions] Setting TZ variable In-Reply-To: <46BBD1ED-4359-42DC-9AB8-6F381C5BF972@erlang-solutions.com> References: <46BBD1ED-4359-42DC-9AB8-6F381C5BF972@erlang-solutions.com> Message-ID: <20101202194616.GA10925@hanele.lan> # Ulf Wiger 2010-12-02: > Hmm? > > At least it works on my Macbook: [... it works ...] Well, localtime(3) is specified (in POSIX.1) to behave as if it calls tzset(3) every time, but no such promise is made for localtime_r(3). So on some platforms that provide localtime_r(3), the tzset(3) call in erts/emulator/sys/unix/sys.c:erl_sys_init() may be the only time TZ variable is ever taken into consideration. Unfortunately, there doesn't seem to be a standard API for conversions between different timezones in the C library -- it has zoneinfo around and enough functions to process it, but is simply too greedy to export that functionaly. Not that this actually helps anyone, but perhaps it explains different behaviours on different platforms... Regards, -- Jachym From alexey.v.romanov Thu Dec 2 21:29:21 2010 From: alexey.v.romanov (Alexey Romanov) Date: Thu, 2 Dec 2010 23:29:21 +0300 Subject: [erlang-questions] Setting TZ variable In-Reply-To: <20101202194616.GA10925@hanele.lan> References: <46BBD1ED-4359-42DC-9AB8-6F381C5BF972@erlang-solutions.com> <20101202194616.GA10925@hanele.lan> Message-ID: On Thu, Dec 2, 2010 at 10:46 PM, Jachym Holecek wrote: > # Ulf Wiger 2010-12-02: >> Hmm? >> >> At least it works on ?my Macbook: [... it works ...] > > Well, localtime(3) is specified (in POSIX.1) to behave as if it calls > tzset(3) every time, but no such promise is made for localtime_r(3). > So on some platforms that provide localtime_r(3), the tzset(3) call > in erts/emulator/sys/unix/sys.c:erl_sys_init() may be the only time > TZ variable is ever taken into consideration. > > Unfortunately, there doesn't seem to be a standard API for conversions > between different timezones in the C library -- it has zoneinfo around > and enough functions to process it, but is simply too greedy to export > that functionaly. > > Not that this actually helps anyone, but perhaps it explains different > behaviours on different platforms... (Initially sent off the list) Actually, it does: it suggests it should be enough to write a program in C which calls tzset(3) and call it through a port... > Regards, > ? ? ? ?-- Jachym > -- Yours, Alexey Romanov From james.hague Thu Dec 2 21:34:15 2010 From: james.hague (James Hague) Date: Thu, 2 Dec 2010 14:34:15 -0600 Subject: [erlang-questions] guard expression restriction In-Reply-To: <50860F48-FC3D-4286-B616-A5F1FFF74BA8@erlang-solutions.com> References: <3ECCCDBC-2EAC-41CB-952D-627991AFC98E@cs.otago.ac.nz> <4CF75AE3.4040303@cs.ntua.gr> <50860F48-FC3D-4286-B616-A5F1FFF74BA8@erlang-solutions.com> Message-ID: On Thu, Dec 2, 2010 at 3:34 AM, Ulf Wiger wrote: >I wrote in a previous mail that tackling abstract patterns, higher-order >patterns, and parameterised receive (possibly in one single approach) >would have a more revolutionary effect on Erlang programming than >user-defined guards, as it would make it possible to do things that are >very hard or awkward to do today. I agree with this! The issue I have with user defined guards is that there's a major blow to predictability. The compiler does a wonderful job of generating optimal code for pattern matching. (You can break that by putting boolean expressions all over the place, yes.) With user-defined guards, especially if those guards can be arbitrary and involve message sending or calls to other modules, then pattern matching can degenerate into linear sequences of checks, and you've got to start thinking about how to order statements in patterns. But this isn't enough of a reason to say that user defined guards shouldn't be implemented. It does need be weighed against what else we should be shooting for. How much do user defined guards really buy in terms of increasing expressiveness? Abstract patterns would be HUGE in terms of making many problems cleaner and more concise. User-defined guards not nearly so much. James From B.Candler Thu Dec 2 20:49:19 2010 From: B.Candler (Brian Candler) Date: Thu, 2 Dec 2010 19:49:19 +0000 Subject: Getting line number in backtrace? Message-ID: <20101202194919.GA7362@talktalkplc.com> I am picking up Erlang again after a break, now running Erlang R13B3 from Ubuntu 10.04. I was wondering if it's yet possible for backtraces to include the line number where the error occurred? Perhaps some switch needs turning on to enable this behaviour? One can always hope :-) Thanks, Brian. From B.Candler Thu Dec 2 20:59:07 2010 From: B.Candler (Brian Candler) Date: Thu, 2 Dec 2010 19:59:07 +0000 Subject: Getting line number in backtrace? In-Reply-To: <20101202194919.GA7362@talktalkplc.com> References: <20101202194919.GA7362@talktalkplc.com> Message-ID: <20101202195907.GA7878@talktalkplc.com> P.S. I did try git://github.com/thomasl/smart_exceptions.git but couldn't get it to work. Here's my test program: ------------------------------------ -module(my_test). -export([go/0]). go() -> dostuff(), io:format("The end~n"). dostuff() -> A1 = {foo,bar}, io:write(A1), {foo, baz} = A1, io:format("Finished~n"). ------------------------------------ And here's what I got trying to compile it using the 'devel' version of smart_exceptions (under R13B3) \$ erlc +'{parse_transform,smart_exceptions}' -o ebin src/my_test.erl src/my_test.erl:none: error in parse transform 'smart_exceptions': {undef, [{smart_exceptions, parse_transform, [[{attribute,1,file, {"src/my_test.erl",1}}, {attribute,1,module,my_test}, {attribute,2,export, [{go,0}]}, {function,4,go,0, [{clause,4,[],[], [{call,5, {atom,5,dostuff}, []}, {call,6, {remote,6, {atom,6,io}, {atom,6,format}}, [{string,6, "The end~n"}]}]}]}, {function,8,dostuff,0, [{clause,8,[],[], [{match,9, {var,9,'A1'}, {tuple,9, [{atom,9,foo}, {atom,9,bar}]}}, {call,10, {remote,10, {atom,10,io}, {atom,10,write}}, [{var,10,'A1'}]}, {match,11, {tuple,11, [{atom,11,foo}, {atom,11,baz}]}, {var,11,'A1'}}, {call,12, {remote,12, {atom,12,io}, {atom,12,format}}, [{string,12, "Finished~n"}]}]}]}, {eof,13}], [report_warnings, report_errors, {cwd,"/v/git/rfe"}, {outdir,"/v/git/rfe/ebin"}, {parse_transform, smart_exceptions}]]}, {compile, '-foldl_transform/2-anonymous-2-', 2}, {compile,foldl_transform,2}, {compile, '-internal_comp/4-anonymous-1-', 2}, {compile,fold_comp,3}, {compile,internal_comp,4}, {compile,internal,3}]} Regards, Brian. From alexey.v.romanov Thu Dec 2 21:44:58 2010 From: alexey.v.romanov (Alexey Romanov) Date: Thu, 2 Dec 2010 23:44:58 +0300 Subject: [erlang-questions] Setting TZ variable In-Reply-To: References: Message-ID: On Thu, Dec 2, 2010 at 8:13 PM, Alain O'Dea wrote: > Out of curiosity, do you need to change the timezone at runtime? Yes. The requirement probably could be worked around (e.g. by restarting the system when the timezone changes) but it would be better if I can avoid this. > Otherwise the shell shook be fine. ?I use the shell approach to force > Zotonic into EST. > > If you need runtime timezone handling I recommend using GMT and > putting in a dispay module to convert to the timezone needed by the > current process. ?Otherwise you could get strange behavior when otwo > process change the global timezone and get muddled in context > switching. Ah no, I need precisely to handle actual timezone change (the system only finds at runtime what timezone it's in by asking a server...) > On Thursday, December 2, 2010, Alexey Romanov > wrote: >> I've tried to follow the advice given by Ulf Wiger in this old thread: >> http://www.erlang.org/pipermail/erlang-questions/2006-December/024291.html >> >> However, it doesn't work for me: >> >> aromanov:~/workspace/gmcontroller\$ erl >> Erlang R14B (erts-5.8.1) [source] [smp:2:2] [rq:2] [async-threads:0] >> [hipe] [kernel-poll:false] >> >> Eshell V5.8.1 ?(abort with ^G) >> 1> os:getenv("TZ"). >> false >> 2> time(). >> {17,49,40} >> 3> os:putenv("TZ", "GMT"). >> true >> 4> os:getenv("TZ"). >> "GMT" >> 5> time(). >> {17,50,8} >> >> Am I doing something wrong? >> >> Setting TZ in the shell does work (but isn't suitable for my purposes): >> >> aromanov:~/workspace/gmcontroller\$ TZ=GMT erl >> Erlang R14B (erts-5.8.1) [source] [smp:2:2] [rq:2] [async-threads:0] >> [hipe] [kernel-poll:false] >> >> Eshell V5.8.1 ?(abort with ^G) >> 1> os:getenv("TZ"). >> "GMT" >> 2> time(). >> {14,50,39} >> >> Yours, Alexey Romanov >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe >> >> > -- Yours, Alexey Romanov From dmitriy.kargapolov Thu Dec 2 21:52:03 2010 From: dmitriy.kargapolov (Dmitriy Kargapolov) Date: Thu, 2 Dec 2010 15:52:03 -0500 Subject: [erlang-questions] Setting TZ variable In-Reply-To: References: <46BBD1ED-4359-42DC-9AB8-6F381C5BF972@erlang-solutions.com> <20101202194616.GA10925@hanele.lan> Message-ID: On Thu, Dec 2, 2010 at 3:29 PM, Alexey Romanov wrote: > On Thu, Dec 2, 2010 at 10:46 PM, Jachym Holecek wrote: > > # Ulf Wiger 2010-12-02: > >> Hmm? > >> > >> At least it works on my Macbook: [... it works ...] > > > > Well, localtime(3) is specified (in POSIX.1) to behave as if it calls > > tzset(3) every time, but no such promise is made for localtime_r(3). > > So on some platforms that provide localtime_r(3), the tzset(3) call > > in erts/emulator/sys/unix/sys.c:erl_sys_init() may be the only time > > TZ variable is ever taken into consideration. > > > > Unfortunately, there doesn't seem to be a standard API for conversions > > between different timezones in the C library -- it has zoneinfo around > > and enough functions to process it, but is simply too greedy to export > > that functionaly. > > > > Not that this actually helps anyone, but perhaps it explains different > > behaviours on different platforms... > > (Initially sent off the list) Actually, it does: it suggests it should > be enough to write a program in C which calls tzset(3) and call it > through a port... > It's not, really... In general you cannot convert local time to universal time in unambiguous way using POSIX calls... At least twice a year in DST environment :) As mentioned above, timezone info functions are not exported in glibc... > > > Regards, > > -- Jachym > > > > > > -- > Yours, Alexey Romanov > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From retnuh Thu Dec 2 22:14:41 2010 From: retnuh (Hunter Kelly) Date: Thu, 2 Dec 2010 21:14:41 +0000 Subject: Eunit debug macros cause tests to fail? Message-ID: Hi there, I'm pretty new to Erlang and EUnit in particular, but I thought I'd give it a shot. I was writing a small function, using TDD with EUnit to help drive it. Every time I put in the debugging macros, though, I get failures like this: (emacs)88> foo:test(). foo:30: partition_into_test_...*failed* ::error:undef in function eunit:debugVal/1 called as debugVal([1,2,6]) in call from foo:partition_into/2 in call from foo:'-partition_into_test_/0-fun-0-'/1 foo:32: partition_into_test_...*failed* ::error:undef in function eunit:debugVal/1 called as debugVal([1,4,6]) in call from foo:partition_into/2 in call from foo:'-partition_into_test_/0-fun-2-'/1 foo:34: partition_into_test_...*failed* ::error:undef in function eunit:debugVal/1 called as debugVal([2,0,6]) in call from foo:partition_into/2 in call from foo:'-partition_into_test_/0-fun-4-'/1 foo:36: partition_into_test_...*failed* ::error:undef in function eunit:debugVal/1 called as debugVal([2,2,5]) in call from foo:partition_into/2 in call from foo:'-partition_into_test_/0-fun-6-'/1 ======================================================= Failed: 4. Skipped: 0. Passed: 0. error (emacs)89> The tests pass when I remove the debugging macros, though! Since io:format stuff gets swallowed, it was rather difficult figuring out what I needed to do to make the tests pass! Is there some misconfgiguration or something? Erlang version: \$ erl -sname shell Erlang R14A (erts-5.8) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.8 (abort with ^G) (shell)1> I've attached the file causing the problems. Thanks! H -------------- next part -------------- A non-text attachment was scrubbed... Name: foo.erl Type: application/octet-stream Size: 1409 bytes Desc: not available URL: From fernando.benavides Thu Dec 2 22:32:06 2010 From: fernando.benavides (Fernando Benavides) Date: Thu, 02 Dec 2010 18:32:06 -0300 Subject: [erlang-questions] Eunit debug macros cause tests to fail? In-Reply-To: References: Message-ID: <1291325526.2196.2.camel@army-desktop> Hi Hunter, I didn't try your code, but seems like you need to use ?debugVal([1,2,6]) instead of eunit:debugVal([1,2,6]). You should try that :) Cheers! On Thu, 2010-12-02 at 21:14 +0000, Hunter Kelly wrote: > Hi there, I'm pretty new to Erlang and EUnit in particular, but I > thought I'd give it a shot. > > I was writing a small function, using TDD with EUnit to help drive it. > > Every time I put in the debugging macros, though, I get failures like this: > > (emacs)88> foo:test(). > foo:30: partition_into_test_...*failed* > ::error:undef > in function eunit:debugVal/1 > called as debugVal([1,2,6]) > in call from foo:partition_into/2 > in call from foo:'-partition_into_test_/0-fun-0-'/1 > > > foo:32: partition_into_test_...*failed* > ::error:undef > in function eunit:debugVal/1 > called as debugVal([1,4,6]) > in call from foo:partition_into/2 > in call from foo:'-partition_into_test_/0-fun-2-'/1 > > > foo:34: partition_into_test_...*failed* > ::error:undef > in function eunit:debugVal/1 > called as debugVal([2,0,6]) > in call from foo:partition_into/2 > in call from foo:'-partition_into_test_/0-fun-4-'/1 > > > foo:36: partition_into_test_...*failed* > ::error:undef > in function eunit:debugVal/1 > called as debugVal([2,2,5]) > in call from foo:partition_into/2 > in call from foo:'-partition_into_test_/0-fun-6-'/1 > > > ======================================================= > Failed: 4. Skipped: 0. Passed: 0. > error > (emacs)89> > > The tests pass when I remove the debugging macros, though! Since > io:format stuff gets swallowed, it was rather difficult figuring out > what I needed to do to make the tests pass! > > Is there some misconfgiguration or something? > > Erlang version: > > \$ erl -sname shell > Erlang R14A (erts-5.8) [source] [smp:2:2] [rq:2] [async-threads:0] > [hipe] [kernel-poll:false] > > Eshell V5.8 (abort with ^G) > (shell)1> > > I've attached the file causing the problems. > > Thanks! > > H > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe ________________________________________________________________________ Fernando Benavides fernando From retnuh Thu Dec 2 22:33:56 2010 From: retnuh (Hunter Kelly) Date: Thu, 2 Dec 2010 21:33:56 +0000 Subject: [erlang-questions] Eunit debug macros cause tests to fail? In-Reply-To: <1291325526.2196.2.camel@army-desktop> References: <1291325526.2196.2.camel@army-desktop> Message-ID: Yes, that was it, of course! D'oh! H On Thu, Dec 2, 2010 at 9:32 PM, Fernando Benavides < fernando.benavides> wrote: > Hi Hunter, > > I didn't try your code, but seems like you need to use *?debugVal*([1,2,6]) > instead of *eunit:debugVal*([1,2,6]). > You should try that :) > > Cheers! > > > On Thu, 2010-12-02 at 21:14 +0000, Hunter Kelly wrote: > > > Hi there, I'm pretty new to Erlang and EUnit in particular, but I > thought I'd give it a shot. > > I was writing a small function, using TDD with EUnit to help drive it. > > Every time I put in the debugging macros, though, I get failures like this: > > (emacs)88> foo:test(). > foo:30: partition_into_test_...*failed* > ::error:undef > in function eunit:debugVal/1 > called as debugVal([1,2,6]) > in call from foo:partition_into/2 > in call from foo:'-partition_into_test_/0-fun-0-'/1 > > > foo:32: partition_into_test_...*failed* > ::error:undef > in function eunit:debugVal/1 > called as debugVal([1,4,6]) > in call from foo:partition_into/2 > in call from foo:'-partition_into_test_/0-fun-2-'/1 > > > foo:34: partition_into_test_...*failed* > ::error:undef > in function eunit:debugVal/1 > called as debugVal([2,0,6]) > in call from foo:partition_into/2 > in call from foo:'-partition_into_test_/0-fun-4-'/1 > > > foo:36: partition_into_test_...*failed* > ::error:undef > in function eunit:debugVal/1 > called as debugVal([2,2,5]) > in call from foo:partition_into/2 > in call from foo:'-partition_into_test_/0-fun-6-'/1 > > > ======================================================= > Failed: 4. Skipped: 0. Passed: 0. > error > (emacs)89> > > The tests pass when I remove the debugging macros, though! Since > io:format stuff gets swallowed, it was rather difficult figuring out > what I needed to do to make the tests pass! > > Is there some misconfgiguration or something? > > Erlang version: > > \$ erl -sname shell > Erlang R14A (erts-5.8) [source] [smp:2:2] [rq:2] [async-threads:0] > [hipe] [kernel-poll:false] > > Eshell V5.8 (abort with ^G) > (shell > )1> > > I've attached the file causing the problems. > > Thanks! > > H > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > > ------------------------------ > > *Fernando Benavides * > > *fernando* > From ok Thu Dec 2 23:19:31 2010 From: ok (Richard O'Keefe) Date: Fri, 3 Dec 2010 11:19:31 +1300 Subject: [erlang-questions] mailing list "reply to" In-Reply-To: <4CF7444A.8070404@erlang-solutions.com> References: <934FA413-459B-482B-80E6-225A67EED2A4@gmail.com> <9CCA96C0-15E9-44CC-970F-FD0F8CF9B7B6@cs.otago.ac.nz> <4CF7444A.8070404@erlang-solutions.com> Message-ID: On 2/12/2010, at 8:01 PM, Mazen Harake wrote: > On 02/12/2010 05:42, Richard O'Keefe wrote: >> Reply-To is for message authors to set when they DON'T want replies to go to >> the list. > Aren't most replies going to the list? E.g. When replying to you I had to first do Reply All and then remove your name from the To field so that you don't get a personal copy AND a message is sent to the mailing list. Actually, no. Mailing list software is supposed to look at the addresses and NOT send a copy to people on the mailing list who are already on the cc list. So the normal way to reply to everyone on a mailing list is supposed to be "Reply All" and let the mailing list software sort it out. > Isn't the point of the mailing list to have a forum-like behaviour? Yes, which is why mailing list software is supposed to do its job properly. That means - NOT setting Reply-To, which RFC 2822 makes clear is for the use of the author of a message only - NOT sending duplicate messages From ok Thu Dec 2 23:31:01 2010 From: ok (Richard O'Keefe) Date: Fri, 3 Dec 2010 11:31:01 +1300 Subject: [erlang-questions] guard expression restriction In-Reply-To: <4CF75AE3.4040303@cs.ntua.gr> References: <3ECCCDBC-2EAC-41CB-952D-627991AFC98E@cs.otago.ac.nz> <4CF75AE3.4040303@cs.ntua.gr> Message-ID: <54929102-B696-4FA8-85CC-93D6B151FA4F@cs.otago.ac.nz> On 2/12/2010, at 9:37 PM, Kostis Sagonas wrote: > Richard O'Keefe wrote: >> ... >> There is of course a fairly elementary transformation by means of >> which anyone who *really* needs a function call in a guard finds >> out that they don't. >> f(Arguments) when Expression -> Body; >> >> => >> f(Arguments) -> >> case Expression >> of true -> Body >> ; false -> f'(Arguments) >> end; >> f(Vars) -> f'(Vars). >> where f' is the rest of f with the name changed. > > Yes, Erlang is Turing complete as it is (so you can express in it any algorithm you want to) and of course there is that transformation, but do you really claim that the bulky code with the case statement and having to factor the rest of f into a separate function is more expressive and programmer-friendly than the one liner with the guard? Turing completeness is not at issue here. I am not claiming that the currently legal code is MORE expressive or MORE friendly than the currently illegal code. What I claim for it is that as a workaround for what should be a *RARE* problem, it's tolerable. But what I also claim is that most often the best thing to do is to redesign; that in Erlang, wanting a user-defined function in a guard is often an indication that you are doing something wrong. Overall, an little awkwardness occasionally is a small price to pay for keeping unbounded complexity out of guards; things are better for the HUMAN reader if guards can't do arbitrarily complex things. > >> I'm not providing an example, because I've tried four and each of >> them was immediately better without trying to do this in guards... > > Hmmm... In any case, the paper I mentioned in my previous mail contains an example of more clear and succinct code when user-defined guards are allowed. I didn't keep a copy of that; could you mention the paper again? As a happy Haskeller (who would still be a Cleaner if the Clean team would condescend to provide a release for modern Macs) I have nothing against arbitrary code in guards in pure functional languages; where I am wary of this is in * concurrent languages (like Parlog and Strand and Erlang) * impure languages (like Erlang) From nbowe Fri Dec 3 01:58:55 2010 From: nbowe (Nikolas Bowe) Date: Fri, 03 Dec 2010 11:58:55 +1100 Subject: [erlang-questions] Erlounge Melbourne - Sat 4/12 In-Reply-To: <201011302000.33706.als@iinet.net.au> References: <4CF48EAF.5070304@infinite-interactive.com> <201011302000.33706.als@iinet.net.au> Message-ID: <4CF840CF.4000909@infinite-interactive.com> On 11/30/2010 8:00 PM, Anthony Shipman wrote: > On Tue, 30 Nov 2010 04:42:07 pm Nikolas Bowe wrote: >> Hi everyone. >> >> There will be an Erlounge at Beer DeLuxe from 7pm on Saturday 4th Dec. >> This is just a social event. No presentations this time. Maybe next time >> depending on what people want. > How will we recognise you? Look for the small group of people that are talking about Erlang ;) If you have any trouble you can call me on 0422 400 967 or Ed Begumisa on 0423 054 065 If you want a description of what I look like, Ive got long (shoulder length) brown hair. Long hair is pretty rare for guys these days, so I doubt you will have trouble picking me out. This message and its attachments may contain legally privileged or confidential information. This message is intended for the use of the individual or entity to which it is addressed. If you are not the addressee indicated in this message, or the employee or agent responsible for delivering the message to the intended recipient, you may not copy or deliver this message or its attachments to anyone. Rather, you should permanently delete this message and its attachments and kindly notify the sender by reply e-mail. Any content of this message and its attachments, which does not relate to the official business of the sending company must be taken not to have been sent or endorsed by the sending company or any of its related entities. No warranty is made that the e-mail or attachment(s) are free from computer virus or other defect. From jameschurchman Fri Dec 3 02:15:38 2010 From: jameschurchman (James Churchman) Date: Fri, 3 Dec 2010 01:15:38 +0000 Subject: [erlang-questions] mailing list "reply to" In-Reply-To: References: <934FA413-459B-482B-80E6-225A67EED2A4@gmail.com> <9CCA96C0-15E9-44CC-970F-FD0F8CF9B7B6@cs.otago.ac.nz> <4CF7444A.8070404@erlang-solutions.com> Message-ID: <1A2DC9B9-57D2-4AFB-906E-ADE84640C898@gmail.com> I guess this makes some sense that it does not send duplicate messages! Before i was removing the other recipients every time with reply all Tho still it's unintuitive until explained especially as goggle groups, yahoo groups and all the many other malling lists i have still all behave in the opposite fashion with reply to list begin the default. i'd also say sending individual replies should be discourages by default, as everybody gets to learn from the replies to the list.. so even after understanding the reasoning this still feels wrong to me On 2 Dec 2010, at 22:19, Richard O'Keefe wrote: > > On 2/12/2010, at 8:01 PM, Mazen Harake wrote: > >> On 02/12/2010 05:42, Richard O'Keefe wrote: >>> Reply-To is for message authors to set when they DON'T want replies to go to >>> the list. >> Aren't most replies going to the list? E.g. When replying to you I had to first do Reply All and then remove your name from the To field so that you don't get a personal copy AND a message is sent to the mailing list. > > Actually, no. Mailing list software is supposed to look at the addresses and NOT > send a copy to people on the mailing list who are already on the cc list. > So the normal way to reply to everyone on a mailing list is supposed to be > "Reply All" and let the mailing list software sort it out. > >> Isn't the point of the mailing list to have a forum-like behaviour? > > Yes, which is why mailing list software is supposed to do its job properly. > That means > - NOT setting Reply-To, which RFC 2822 makes clear is for the use of the > author of a message only > - NOT sending duplicate messages > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > From ok Fri Dec 3 02:17:35 2010 From: ok (Richard O'Keefe) Date: Fri, 3 Dec 2010 14:17:35 +1300 Subject: [erlang-questions] guard expression restriction In-Reply-To: <50860F48-FC3D-4286-B616-A5F1FFF74BA8@erlang-solutions.com> References: <3ECCCDBC-2EAC-41CB-952D-627991AFC98E@cs.otago.ac.nz> <4CF75AE3.4040303@cs.ntua.gr> <50860F48-FC3D-4286-B616-A5F1FFF74BA8@erlang-solutions.com> Message-ID: <81FFB277-CFC1-447B-B25E-94BDBAABB561@cs.otago.ac.nz> On 2/12/2010, at 10:34 PM, Ulf Wiger wrote: > I interpreted Richard's point as being that it's a rather simple matter > to write your program with user-defined tests that are not guards, > even today. I don't think it is as elegant, but it doesn't blow up in your > face either. That is exactly what I meant. > > I wrote in a previous mail that tackling abstract patterns, higher-order > patterns, and parameterised receive (possibly in one single approach) > would have a more revolutionary effect on Erlang programming than > user-defined guards, as it would make it possible to do things that are > very hard or awkward to do today. I didn't say anything then, but I agree completely. There certainly needs to be a syntax for match specifications that looks more like ordinary Erlang syntax; it is good that match specifications CAN be built as data structures but bad that they HAVE to. I suspect that it may be possible to unify abstract patterns and match specifications in the sense that an abstract pattern could have in addition to its "pattern" and "expression" faces a third "data structure" face. I note once again that abstract patterns solve *most* of the goals that user-defined functions in guards do. Kostis Sagonas proposes safety checks that require extensive analysis; abstract patterns provide a simple, local, syntactic safety check, allowing you to use an abstract pattern from another module *safely* in an abstract pattern, without requiring any "block compilation" mode (but able to exploit it if there is one). From ok Fri Dec 3 02:20:16 2010 From: ok (Richard O'Keefe) Date: Fri, 3 Dec 2010 14:20:16 +1300 Subject: [erlang-questions] guard expression restriction In-Reply-To: References: <3ECCCDBC-2EAC-41CB-952D-627991AFC98E@cs.otago.ac.nz> <4CF75AE3.4040303@cs.ntua.gr> Message-ID: <6338CE55-68D5-4E27-89D7-43E40F4F74B5@cs.otago.ac.nz> On 2/12/2010, at 11:44 PM, Hynek Vychodil wrote: > On Thu, Dec 2, 2010 at 9:37 AM, Kostis Sagonas wrote: >> Richard O'Keefe wrote: >>> >>> ... >>> There is of course a fairly elementary transformation by means of >>> which anyone who *really* needs a function call in a guard finds >>> out that they don't. >>> >>> f(Arguments) when Expression -> Body; >>> >>> >>> => >>> f(Arguments) -> >>> case Expression >>> of true -> Body >>> ; false -> f'(Arguments) >>> end; >>> f(Vars) -> f'(Vars). >>> >>> where f' is the rest of f with the name changed. >> > > Anyway, this rewritten version doesn't behaves like guards It isn't *MEANT* to. That's the point, really. If you are calling user-defined functions you SHOULDN'T be suppressing exceptions. (Haskell and Clean don't...) From yinso.chen Fri Dec 3 03:22:24 2010 From: yinso.chen (YC) Date: Thu, 2 Dec 2010 18:22:24 -0800 Subject: [erlang-questions] mailing list "reply to" In-Reply-To: <1A2DC9B9-57D2-4AFB-906E-ADE84640C898@gmail.com> References: <934FA413-459B-482B-80E6-225A67EED2A4@gmail.com> <9CCA96C0-15E9-44CC-970F-FD0F8CF9B7B6@cs.otago.ac.nz> <4CF7444A.8070404@erlang-solutions.com> <1A2DC9B9-57D2-4AFB-906E-ADE84640C898@gmail.com> Message-ID: Hi James - On Thu, Dec 2, 2010 at 5:15 PM, James Churchman wrote: > I guess this makes some sense that it does not send duplicate messages! > > Before i was removing the other recipients every time with reply all > I can see how you would think mailing list should munge reply-to if you did not know how it works and end up modifying the recipients every time - I quite often wonder why people are in favor of munging, now I know a valid reason. Consider that the frustration felt for people who know how it works and want/need to send private messages when the reply-to is munged. Few things feel worse than having a confidential private message to accidentally end up in a public list. > Tho still it's unintuitive until explained especially as goggle groups, > yahoo groups and all the many other malling lists i have still all behave in > the opposite fashion with reply to list begin the default. Their settings are wrong - and perhaps their admins also are unfamiliar with now mailing lists are supposed to work. > i'd also say sending individual replies should be discourages by default, > as everybody gets to learn from the replies to the list.. so even after > understanding the reasoning this still feels wrong to me The problem with reply-to munging is that it breaks private reply and often causes people to send a completely private message inadvertently to the public. The concept of discouraging private reply for learning is overrated - people private message because they have a reason to. If they pm for no reason they'll learn quickly that for many that's considered poor etiquette, since that effectively obligates the recipient's time when it's all voluntary. My 2 cents. Cheers, yc From jameschurchman Fri Dec 3 03:42:10 2010 From: jameschurchman (James Churchman) Date: Fri, 3 Dec 2010 02:42:10 +0000 Subject: [erlang-questions] mailing list "reply to" In-Reply-To: References: <934FA413-459B-482B-80E6-225A67EED2A4@gmail.com> <9CCA96C0-15E9-44CC-970F-FD0F8CF9B7B6@cs.otago.ac.nz> <4CF7444A.8070404@erlang-solutions.com> <1A2DC9B9-57D2-4AFB-906E-ADE84640C898@gmail.com> Message-ID: <837FA6B4-A21C-4CBD-8B4F-57CE6EC12243@gmail.com> YC : guess the PM is a fair point & for that reason maybe it is better that way then, thanks :-) On 3 Dec 2010, at 02:22, YC wrote: > Hi James - > > On Thu, Dec 2, 2010 at 5:15 PM, James Churchman wrote: > I guess this makes some sense that it does not send duplicate messages! > > Before i was removing the other recipients every time with reply all > > I can see how you would think mailing list should munge reply-to if you did not know how it works and end up modifying the recipients every time - I quite often wonder why people are in favor of munging, now I know a valid reason. > > Consider that the frustration felt for people who know how it works and want/need to send private messages when the reply-to is munged. Few things feel worse than having a confidential private message to accidentally end up in a public list. > > Tho still it's unintuitive until explained especially as goggle groups, yahoo groups and all the many other malling lists i have still all behave in the opposite fashion with reply to list begin the default. > > Their settings are wrong - and perhaps their admins also are unfamiliar with now mailing lists are supposed to work. > > i'd also say sending individual replies should be discourages by default, as everybody gets to learn from the replies to the list.. so even after understanding the reasoning this still feels wrong to me > > The problem with reply-to munging is that it breaks private reply and often causes people to send a completely private message inadvertently to the public. The concept of discouraging private reply for learning is overrated - people private message because they have a reason to. If they pm for no reason they'll learn quickly that for many that's considered poor etiquette, since that effectively obligates the recipient's time when it's all voluntary. > > My 2 cents. Cheers, > yc > From jws Fri Dec 3 03:44:33 2010 From: jws (Jeff Schultz) Date: Fri, 3 Dec 2010 13:44:33 +1100 Subject: [erlang-questions] guard expression restriction In-Reply-To: <4CF75AE3.4040303@cs.ntua.gr> References: <3ECCCDBC-2EAC-41CB-952D-627991AFC98E@cs.otago.ac.nz> <4CF75AE3.4040303@cs.ntua.gr> Message-ID: <20101203024433.GA19059@mulga.csse.unimelb.edu.au> On Thu, Dec 02, 2010 at 10:37:55AM +0200, Kostis Sagonas wrote: > Hmmm... In any case, the paper I mentioned in my previous mail contains an > example of more clear and succinct code when user-defined guards are > allowed. I'm pretty sure I wouldn't write your Figure 7 that way in anything other than short-lived code that I planned to throw away.* Transcribed, it's more or less foo2(Set) when gb_sets:is_set(Set) -> handlegbset(Set); foo2(Set) when sets:is_set(Set) -> handleset(Set); foo2(_) -> error. This puts my code at the mercy of data-representation changes in either referenced module that I have no control over. (In fact, gb_sets:is_set is explicitly "Not Recommended" in its documentation.) I'd be much more likely to write something like -record(agg, {kind=error, set=error}). % Code to generate various kinds of #agg and pack them correctly % into the record . . . . foo3(Agg) when Agg#agg.kind =:= gb_set -> handlegbset(Agg); foo3(Agg) when Agg#agg.kind =:= set -> handleset(Agg); foo3(_) -> error. I can maintain this, and I'm safe from changes in someone else's datastructures that might make one kind of collection look like another. Jeff Schultz ----------------------------------------------------- *Of course, it's often the code you were most certain to throw away that lives the longest :-( From alain.odea Fri Dec 3 05:14:20 2010 From: alain.odea (Alain O'Dea) Date: Fri, 3 Dec 2010 00:44:20 -0330 Subject: [erlang-questions] OTP-EVA-MIB In-Reply-To: References: Message-ID: I'm pretty sure QLC replaced mnemosyne a while ago :) On Thursday, December 2, 2010, Andrey Pampukha wrote: > +1. Digging deeper into EVA's documentation, I've found very interesting thing: > Handle = query [E.generated || E <- table(eventTable), E.name = Name] end > > Usage of the 'query' keyword in R14B leads to the following output: > 1> query [X*2||X<-lists:seq(1,10)] end. > * 1: mnemosyne query, missing transformation > > Googling for "erlang mnemosyne", the following link can be found: > http://www.erlang.org/documentation/doc-5.5.5/lib/mnemosyne-1.2.7.1/doc/html/mnemosyne.html > It's sayd that mnemosyne is some query language for Mnesia. > This application is also can't be found in recent Erlang/OTP releases... > > 2010/12/2, Dmitriy Kargapolov : >> Yes.. Per "other releases" docs eva application was buried sometime between >> Erlang/OTP 5.3.6.13 (R9C Patched) and Erlang/OTP 5.4 (R10B) ... It still >> would be interesting to hear from original authors why it went that way... >> >> On Thu, Dec 2, 2010 at 12:33 PM, Andrey Pampukha >> wrote: >> >>> This is the latest mention of EVA that I've found: >>> http://www.erlang.org/documentation/doc-5.3.6.13/lib/eva-2.0.4/doc/html/ >>> >>> 2010/12/2, Andrey Pampukha : >>> > I've just tried googling for OTP-EVA-MIB, >>> > found some interesting links to obsolete Erlang/OTP docs like >>> > >>> http://www.erlang.org/documentation/doc-5.2/lib/eva-2.0.3/doc/html/eva_snmp_adaptation.html >>> > >>> > EVA is Event and Alarm handler, and I guess it has been deprecated and >>> > removed from OTP someday, but not fully. >>> > I suppose it might be the rudiments of some Ericsson's product written >>> > in Erlang like AXD301... >>> > >>> > 2010/12/2, Dmitriy Kargapolov : >>> >> Hello, >>> >> >>> >> Does anybody know if logging and alarm management based on >>> >> OTP-EVA-MIB.mib >>> >> have ever been implemented? >>> >> I found content of this MIB pretty interesting. It makes me thinking >>> that >>> >> there could be at least attempt to implement OTP logging and alarm >>> >> management via SNMP, but I couldn't find any traces of this. Just one >>> >> file >>> >> lib/otp_mibs/mibs/OTP-EVA-MIB.mib which by default is not copied into >>> >> release tarball, and some artefacts: >>> >> \$ grep -C3 evaLog lib/tv/src/tv_main.hrl >>> >> >>> >> -define(MNESIA_TABLES, [alarm, >>> >> ? ? ? ? ? ? alarmTable, >>> >> ? ? ? ? ? ? evaLogDiscriminatorTable, >>> >> ? ? ? ? ? ? eva_snmp_map, >>> >> ? ? ? ? ? ? eventTable, >>> >> ? ? ? ? ? ? group, >>> >> >>> >> Thanks. >>> >> >>> > >>> >> > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From alain.odea Fri Dec 3 05:19:02 2010 From: alain.odea (Alain O'Dea) Date: Fri, 3 Dec 2010 00:49:02 -0330 Subject: [erlang-questions] Setting TZ variable In-Reply-To: References: Message-ID: On Thursday, December 2, 2010, Alexey Romanov wrote: > On Thu, Dec 2, 2010 at 8:13 PM, Alain O'Dea wrote: >> Out of curiosity, do you need to change the timezone at runtime? > > Yes. The requirement probably could be worked around (e.g. by > restarting the system when the timezone changes) but it would be > better if I can avoid this. > >> Otherwise the shell shook be fine. ?I use the shell approach to force >> Zotonic into EST. >> >> If you need runtime timezone handling I recommend using GMT and >> putting in a dispay module to convert to the timezone needed by the >> current process. ?Otherwise you could get strange behavior when otwo >> process change the global timezone and get muddled in context >> switching. > > Ah no, I need precisely to handle actual timezone change (the system > only finds at runtime what timezone it's in by asking a server...) This sounds like a one-time or synchronized operation so I see no issue with os:setenv("TZ",...) for that :) > >> On Thursday, December 2, 2010, Alexey Romanov >> wrote: >>> I've tried to follow the advice given by Ulf Wiger in this old thread: >>> http://www.erlang.org/pipermail/erlang-questions/2006-December/024291.html >>> >>> However, it doesn't work for me: >>> >>> aromanov:~/workspace/gmcontroller\$ erl >>> Erlang R14B (erts-5.8.1) [source] [smp:2:2] [rq:2] [async-threads:0] >>> [hipe] [kernel-poll:false] >>> >>> Eshell V5.8.1 ?(abort with ^G) >>> 1> os:getenv("TZ"). >>> false >>> 2> time(). >>> {17,49,40} >>> 3> os:putenv("TZ", "GMT"). >>> true >>> 4> os:getenv("TZ"). >>> "GMT" >>> 5> time(). >>> {17,50,8} >>> >>> Am I doing something wrong? >>> >>> Setting TZ in the shell does work (but isn't suitable for my purposes): >>> >>> aromanov:~/workspace/gmcontroller\$ TZ=GMT erl >>> Erlang R14B (erts-5.8.1) [source] [smp:2:2] [rq:2] [async-threads:0] >>> [hipe] [kernel-poll:false] >>> >>> Eshell V5.8.1 ?(abort with ^G) >>> 1> os:getenv("TZ"). >>> "GMT" >>> 2> time(). >>> {14,50,39} >>> >>> Yours, Alexey Romanov >>> >>> ________________________________________________________________ >>> erlang-questions (at) erlang.org mailing list. >>> See http://www.erlang.org/faq.html >>> To unsubscribe; mailto:erlang-questions-unsubscribe >>> >>> >> > > > > -- > Yours, Alexey Romanov > From alexey.v.romanov Fri Dec 3 08:04:04 2010 From: alexey.v.romanov (Alexey Romanov) Date: Fri, 3 Dec 2010 10:04:04 +0300 Subject: driver_alloc Message-ID: "Erlang and OTP in Action" says: > One thing needs to change, now that your code will be running in the memory space of the Erlang VM: you should no longer use the standard library functions malloc and free in C to manage memory. When writing a linked-in driver, you should use the erl_driver library functions driver_alloc() and driver_free() instead. If that's correct, shouldn't it be documented in http://www.erlang.org/doc/tutorial/c_portdriver.html (the example there does use driver_alloc(), but nothing is said about it in the text), the header of http://www.erlang.org/doc/man/erl_driver.html, etc.? Yours, Alexey Romanov From ulf.wiger Fri Dec 3 08:29:19 2010 From: ulf.wiger (Ulf Wiger) Date: Fri, 3 Dec 2010 08:29:19 +0100 Subject: [erlang-questions] Setting TZ variable In-Reply-To: References: Message-ID: <0004061E-6A2D-4A0E-9495-8E22F1778610@erlang-solutions.com> On 3 Dec 2010, at 05:19, Alain O'Dea wrote: > On Thursday, December 2, 2010, Alexey Romanov >> >> Ah no, I need precisely to handle actual timezone change (the system >> only finds at runtime what timezone it's in by asking a server...) > > This sounds like a one-time or synchronized operation so I see no > issue with os:setenv("TZ",...) for that :) So, the original advice came from the AXD 301 days, where we had to deal with timezone and DST issues in a non-stop system. Running on Solaris, at the time, updating the zoneinfo files was an OS patch each time, and there were ca 200 different settings. Timezone is relatively straightforward - at least the AXD 301 tended not to move once brought into service, but DST is really a PITA; some countries decide through parlamentary decision when it's supposed to happen each year, and others have different rules for years with presidential elections? Also, we needed to get the time representation in logs correct (i.e. correct localtime) - not just the time presented in the GUI. Granted, it was early days for OTP, so some of our issues have long-since been fixed. Initially, there was no erlang:universaltime(), and if the OS time changed to DST, this would affect erlang:now() and all timers in the system, so we set the system clock to UST and tweaked the TZ variable from within Erlang. BR, Ulf W Ulf Wiger, CTO, Erlang Solutions, Ltd. http://erlang-solutions.com From ulf.wiger Fri Dec 3 08:50:45 2010 From: ulf.wiger (Ulf Wiger) Date: Fri, 3 Dec 2010 08:50:45 +0100 Subject: [erlang-questions] OTP-EVA-MIB In-Reply-To: References: Message-ID: On 2 Dec 2010, at 18:44, Andrey Pampukha wrote: > +1. Digging deeper into EVA's documentation, I've found very interesting thing: > Handle = query [E.generated || E <- table(eventTable), E.name = Name] end > > Usage of the 'query' keyword in R14B leads to the following output: > 1> query [X*2||X<-lists:seq(1,10)] end. > * 1: mnemosyne query, missing transformation > > Googling for "erlang mnemosyne", the following link can be found: > http://www.erlang.org/documentation/doc-5.5.5/lib/mnemosyne-1.2.7.1/doc/html/mnemosyne.html > It's sayd that mnemosyne is some query language for Mnesia. > This application is also can't be found in recent Erlang/OTP releases? True. Mnemosyne was retired with the introduction of QLC, some years ago. Mnemosyne was a research project running in parallel with Klacke's work on Mnesia. It was an experiment in using list comprehensions for database queries. When the project started, Erlang didn't support list comprehensions, and it happened that two similar, but subtly different, syntaxes evolved in parallel: the query list comprehensions used by Mnemosyne, written by Hans Nilsson, and the list comprehensions in Erlang, written by Robert Virding. Thus, the 'query' keyword. Mnemosyne included fairly ambitious query optimisation code, and maintained metrics about each table in order to select the best strategy. It also paid particular attention to recursive queries, exploring the idea that by delaying the recursive aspects during the optimisation phase, sometimes the recursion could be eliminated - a worthy research task, but ultimately not particularly useful in telecoms switching systems, which is what Erlang was used for. Also, Mnemosyne was never actually productified - it just slipped into the first version of OTP (Hans once told me how surprised he was when he got the first bug reports on his research project). Since Mnemosyne was never meant for production use in the first place, and therefore was not maintainable, it was important to find a replacement. QLC has a different set of requirements too, hopefully more in line with the actual use of Erlang. BR, Ulf W From robert.virding Fri Dec 3 10:36:19 2010 From: robert.virding (Robert Virding) Date: Fri, 3 Dec 2010 09:36:19 +0000 (GMT) Subject: [erlang-questions] guard expression restriction In-Reply-To: <24159915.156391291368908038.JavaMail.root@zimbra> Message-ID: <843895600.156431291368979136.JavaMail.root@zimbra> Yes, doing it that way was definitely a mistake. It seemed like a good idea at the time as you could use it to optimise the tests by converting some of them to guards. Unfortunately, we/I didn't think through the repurcussions enough before releasing it. And then it was too late. I wonder what would happen if it was just silently changed? :-) A general reflection is that one problem with trying to change something in Erlang/OTP is that not only does it have to work properly, it also has to fail properly. It is the failure which is the problem here. Robert ----- "Richard O'Keefe" wrote: > On 2/12/2010, at 7:22 AM, James Churchman wrote: > > > Interestingly list comprehensions offer custom guards, if that it of > use to you. > > And what a disaster THAT is. > Consider > > 1> 1+a > 2. > ** exception error: bad argument in an arithmetic expression > in operator +/2 > called as 1 + a > > In a *guard*, this would be a silent failure. > As an expression (which it should never have been allowed to be), > exceptions are raised and propagated through > . > > 2> [X || X <- lists:seq(1,100), X+a > 2]. > [] > > Here the exception became a silent failure. So the guard is a guard. > > > 3> math:cos(foo) > 1. > ** exception error: bad argument > in function math:cos/1 > called as math:cos(foo) > > 4> [X || X <- lists:seq(1,100), math:cos(foo) > X]. > ** exception error: bad argument > in function math:cos/1 > called as math:cos(foo) > > Here the exception did NOT become a silent failure! > > If the guards in list comprehensions are GUARDS, then *any* > exception inside one should turn into a silent failure, and > query 4 should have the answer [] with no carping. > > If the guards in list comprehensions are EXPRESSIONS, then > every expression inside one should be propagated, and query > 2 should have raised an exception. > > It's even worse. If guards in list comprehensions had been > guards, we'd have been able to use Pattern = Expression to > bind variables locally inside comprehensions, instead of > having to use the kluge Pattern <- [Expression]. > > Inconsistent treatment of tests in comprehensions like this > is a real menace. I would value some kind of static check > that the guards in comprehensions are proper guards. > > > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe From robert.virding Fri Dec 3 10:42:31 2010 From: robert.virding (Robert Virding) Date: Fri, 3 Dec 2010 09:42:31 +0000 (GMT) Subject: [erlang-questions] Re: Getting line number in backtrace? In-Reply-To: <20101202195907.GA7878@talktalkplc.com> Message-ID: <380797412.156521291369351411.JavaMail.root@zimbra> Is the smart_exceptions module compiled and put in a place where erlc can find it? Robert ----- "Brian Candler" wrote: > P.S. I did try git://github.com/thomasl/smart_exceptions.git but > couldn't > get it to work. > > Here's my test program: > > ------------------------------------ > -module(my_test). > -export([go/0]). > > go() -> > dostuff(), > io:format("The end~n"). > > dostuff() -> > A1 = {foo,bar}, > io:write(A1), > {foo, baz} = A1, > io:format("Finished~n"). > ------------------------------------ > > And here's what I got trying to compile it using the 'devel' version > of > smart_exceptions (under R13B3) > > \$ erlc +'{parse_transform,smart_exceptions}' -o ebin src/my_test.erl > src/my_test.erl:none: error in parse transform 'smart_exceptions': > {undef, > [{smart_exceptions, > parse_transform, > [[{attribute,1,file, > > {"src/my_test.erl",1}}, > > {attribute,1,module,my_test}, > > {attribute,2,export, > [{go,0}]}, > {function,4,go,0, > [{clause,4,[],[], > [{call,5, > > {atom,5,dostuff}, > []}, > {call,6, > {remote,6, > {atom,6,io}, > > {atom,6,format}}, > [{string,6, > "The > end~n"}]}]}]}, > > {function,8,dostuff,0, > [{clause,8,[],[], > [{match,9, > {var,9,'A1'}, > {tuple,9, > > [{atom,9,foo}, > > {atom,9,bar}]}}, > {call,10, > {remote,10, > {atom,10,io}, > > {atom,10,write}}, > > [{var,10,'A1'}]}, > {match,11, > {tuple,11, > > [{atom,11,foo}, > > {atom,11,baz}]}, > > {var,11,'A1'}}, > {call,12, > {remote,12, > {atom,12,io}, > > {atom,12,format}}, > [{string,12, > > "Finished~n"}]}]}]}, > {eof,13}], > [report_warnings, > report_errors, > {cwd,"/v/git/rfe"}, > > {outdir,"/v/git/rfe/ebin"}, > {parse_transform, > > smart_exceptions}]]}, > {compile, > > '-foldl_transform/2-anonymous-2-', > 2}, > > {compile,foldl_transform,2}, > {compile, > > '-internal_comp/4-anonymous-1-', > 2}, > {compile,fold_comp,3}, > > {compile,internal_comp,4}, > {compile,internal,3}]} > > Regards, > > Brian. > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe From lukas Fri Dec 3 10:57:03 2010 From: lukas (Lukas Larsson) Date: Fri, 3 Dec 2010 10:57:03 +0100 Subject: [erlang-questions] Getting line number in backtrace? In-Reply-To: <20101202194919.GA7362@talktalkplc.com> References: <20101202194919.GA7362@talktalkplc.com> Message-ID: <1291370225.4890.20.camel@ancalagon.du.uab.ericsson.se> Hi, there is right now no good way to get line numbers from crashes. In common_test suites the code is instrumented using a parse_transform to do this, but that solution works only when used within common_test. There have been many discussions about this before, for one discussion see http://www.erlang.org/pipermail/erlang-questions/2005-August/016477.html Personally I used to see it as a problem, but after a couple of months working with it you get used to it. Also because error messages for cases and if's are the hardest to figure out (imo) I tend to write smaller function which do my conditions which in turn makes the system easier to debug and maintain :) Lukas On Thu, 2010-12-02 at 19:49 +0000, Brian Candler wrote: > I am picking up Erlang again after a break, now running Erlang R13B3 from > Ubuntu 10.04. > > I was wondering if it's yet possible for backtraces to include the line > number where the error occurred? Perhaps some switch needs turning on to > enable this behaviour? One can always hope :-) > > Thanks, > > Brian. > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe From olopierpa Fri Dec 3 11:01:50 2010 From: olopierpa (Pierpaolo Bernardi) Date: Fri, 3 Dec 2010 11:01:50 +0100 Subject: [erlang-questions] mailing list "reply to" In-Reply-To: <1A2DC9B9-57D2-4AFB-906E-ADE84640C898@gmail.com> References: <934FA413-459B-482B-80E6-225A67EED2A4@gmail.com> <9CCA96C0-15E9-44CC-970F-FD0F8CF9B7B6@cs.otago.ac.nz> <4CF7444A.8070404@erlang-solutions.com> <1A2DC9B9-57D2-4AFB-906E-ADE84640C898@gmail.com> Message-ID: On Fri, Dec 3, 2010 at 02:15, James Churchman wrote: > I guess this makes some sense that it does not send duplicate messages! > > Before i was removing the other recipients every time with reply all > > Tho still it's unintuitive until explained especially as goggle groups, yahoo groups and all the many other malling lists i have still all behave in the opposite fashion with reply to list begin the default. Why don't you just hit "reply to all" by default? From hynek Fri Dec 3 11:20:44 2010 From: hynek (Hynek Vychodil) Date: Fri, 3 Dec 2010 11:20:44 +0100 Subject: [erlang-questions] guard expression restriction In-Reply-To: <20101203024433.GA19059@mulga.csse.unimelb.edu.au> References: <3ECCCDBC-2EAC-41CB-952D-627991AFC98E@cs.otago.ac.nz> <4CF75AE3.4040303@cs.ntua.gr> <20101203024433.GA19059@mulga.csse.unimelb.edu.au> Message-ID: On Fri, Dec 3, 2010 at 3:44 AM, Jeff Schultz wrote: > On Thu, Dec 02, 2010 at 10:37:55AM +0200, Kostis Sagonas wrote: >> Hmmm... In any case, the paper I mentioned in my previous mail contains an >> example of more clear and succinct code when user-defined guards are >> allowed. > > I'm pretty sure I wouldn't write your Figure 7 that way in anything > other than short-lived code that I planned to throw away.* > > Transcribed, it's more or less > > ? ?foo2(Set) when gb_sets:is_set(Set) -> > ? ? ? ?handlegbset(Set); > ? ?foo2(Set) when sets:is_set(Set) -> > ? ? ? ?handleset(Set); > ? ?foo2(_) -> > ? ? ? ?error. > > This puts my code at the mercy of data-representation changes in > either referenced module that I have no control over. ?(In fact, > gb_sets:is_set is explicitly "Not Recommended" in its documentation.) > > I'd be much more likely to write something like > > ? ?-record(agg, {kind=error, set=error}). > > ? ?% Code to generate various kinds of #agg and pack them correctly > ? ?% into the record . . . . > > ? ?foo3(Agg) when Agg#agg.kind =:= gb_set -> > ? ? ? ?handlegbset(Agg); > ? ?foo3(Agg) when Agg#agg.kind =:= set -> > ? ? ? ?handleset(Agg); > ? ?foo3(_) -> > ? ? ? ?error. > Even better but point taken foo3(#agg{kind = gb_set } = Agg) -> ? ?handlegbset(Agg); foo3(#agg{kind = set } = Agg) -> ? ? ?handleset(Agg); foo3(_) -> ? ? ?error. > I can maintain this, and I'm safe from changes in someone else's > datastructures that might make one kind of collection look like > another. > > > ? ?Jeff Schultz > > > ----------------------------------------------------- > *Of course, it's often the code you were most certain > to throw away that lives the longest :-( > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > -- --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 jodie.burch Fri Dec 3 11:29:38 2010 From: jodie.burch (Jodie Burch) Date: Fri, 03 Dec 2010 10:29:38 +0000 Subject: Talk Submissions - Erlang Factory SF Bay Area 2011 Message-ID: Hi Everyone We are now taking talk submissions for the Erlang Factory SF Bay Area 2011. The conference will run from the 24th-25th March with the Erlang University from 21st-23rd March. It would be great to hear from anybody interested in giving a talk at the conference. You can find more details and submit your talk proposals here: http://www.erlang-factory.com/conference/SFBay2011 Thanks Jodie From chandrashekhar.mullaparthi Fri Dec 3 12:10:11 2010 From: chandrashekhar.mullaparthi (Chandru) Date: Fri, 3 Dec 2010 11:10:11 +0000 Subject: ordered_bag mnesia tables Message-ID: Hello OTP team, Would it possible to have a new type of mnesia table called 'time_ordered_set'. So the important properties of such a table would be: * Records are always appended to the table (which means when I traverse the table using the many mnesia functions available, the ordering is predictable) * When inserting a record with a key which already exists, the old record is removed before inserting the new record (atomically even for dirty writes) I know this can be achieved using a unique value such as now() for the primary key, but then duplicate management becomes extra work as secondary indices have to be used, and a lookup using the secondary key has to be done before every insert etc. cheers Chandru From chandrashekhar.mullaparthi Fri Dec 3 12:18:56 2010 From: chandrashekhar.mullaparthi (Chandru) Date: Fri, 3 Dec 2010 11:18:56 +0000 Subject: time_ordered_set mnesia table (was: ordered_bag mnesia tables) Message-ID: Sorry, I posted earlier with the wrong subject. ------------------ Hello OTP team, Would it possible to have a new type of mnesia table called 'time_ordered_set'. So the important properties of such a table would be: * Records are always appended to the table (which means when I traverse the table using the many mnesia functions available, the ordering is predictable) * When inserting a record with a key which already exists, the old record is removed before inserting the new record (atomically even for dirty writes) I know this can be achieved using a unique value such as now() for the primary key, but then duplicate management becomes extra work as secondary indices have to be used, and a lookup using the secondary key has to be done before every insert etc. cheers Chandru From B.Candler Fri Dec 3 13:50:17 2010 From: B.Candler (Brian Candler) Date: Fri, 3 Dec 2010 12:50:17 +0000 Subject: [erlang-questions] Getting line number in backtrace? In-Reply-To: <1291370225.4890.20.camel@ancalagon.du.uab.ericsson.se> References: <20101202194919.GA7362@talktalkplc.com> <1291370225.4890.20.camel@ancalagon.du.uab.ericsson.se> Message-ID: <20101203125017.GA3331@talktalkplc.com> On Fri, Dec 03, 2010 at 10:57:03AM +0100, Lukas Larsson wrote: > there is right now no good way to get line numbers from crashes. In > common_test suites the code is instrumented using a parse_transform to > do this, but that solution works only when used within common_test. > > There have been many discussions about this before, for one discussion > see > http://www.erlang.org/pipermail/erlang-questions/2005-August/016477.html Thank you for the update. I found some old discussions, some of which had responses along the lines of "this is a reasonable thing to want, we'll get round to it eventually". Undoubtedly it gets easier with experience, but even with a 5-line function, it would still save me some brain work to be told which of those 5 lines the badmatch error occured on. I notice that the abstract format has the line numbers already, and this is available as a beam chunk when you compile with +debug_info. So a simple way to achieve the desired effect with little chance of breaking anything, would be to have a further beam chunk type, which maps ranges of bytecode offsets to source line numbers. I guess it depends how much shuffling and optimisation of beam code takes palce. Regards, Brian. From jameschurchman Fri Dec 3 14:48:24 2010 From: jameschurchman (James Churchman) Date: Fri, 3 Dec 2010 13:48:24 +0000 Subject: [erlang-questions] guard expression restriction In-Reply-To: <843895600.156431291368979136.JavaMail.root@zimbra> References: <843895600.156431291368979136.JavaMail.root@zimbra> Message-ID: would it have to be "silently changed".. RefactorErl, Wrangler or Dialyzer could be modified to "upgrade" or at least produce warning in all* cases where flipping the functionality would effect the true functionality of it. Also i would guess much code is written with out the knowledge that some LC guards fail silently, some don't :-) *all in this case means "i assume all" On 3 Dec 2010, at 09:36, Robert Virding wrote: > I wonder what would happen if it was just silently changed? :-) From dmitriy.kargapolov Fri Dec 3 15:35:36 2010 From: dmitriy.kargapolov (Dmitriy Kargapolov) Date: Fri, 3 Dec 2010 09:35:36 -0500 Subject: Event and Alarm Handling application, EVA Message-ID: Hello, I forced to open separate thread, since previous one (EVA-OTP-MIB) drifted to discussion about Mnemosyne / QLC.. I'd really want to know what was the reason of stopping development and support of the EVA application about 6 years ago. I'm wondering if there still exist and open to public EVA sources. Thank you. From dmercer Fri Dec 3 15:49:58 2010 From: dmercer (David Mercer) Date: Fri, 3 Dec 2010 08:49:58 -0600 Subject: [erlang-questions] Erlounge Melbourne - Sat 4/12 In-Reply-To: <4CF840CF.4000909@infinite-interactive.com> References: <4CF48EAF.5070304@infinite-interactive.com> <201011302000.33706.als@iinet.net.au> <4CF840CF.4000909@infinite-interactive.com> Message-ID: <001801cb92f9\$5cb21dc0\$16165940\$@com> On Thursday, December 02, 2010, Nikolas Bowe wrote: > If you want a description of what I look like, Ive got long (shoulder > length) brown hair. > Long hair is pretty rare for guys these days, so I doubt you will have > trouble picking me out. Since Erlang is Swedish, I suppose I always imagined the prototypical Erlanger as looking like Bjorn from ABBA. He had shoulder-length brown hair, like you, so I guess my imagination isn't too far from the truth. :-) From B.Candler Fri Dec 3 15:49:52 2010 From: B.Candler (Brian Candler) Date: Fri, 3 Dec 2010 14:49:52 +0000 Subject: Getting line number in backtrace? In-Reply-To: <20101202195907.GA7878@talktalkplc.com> References: <20101202194919.GA7362@talktalkplc.com> <20101202195907.GA7878@talktalkplc.com> Message-ID: <20101203144952.GA5037@talktalkplc.com> Robert Virding wrote: > Is the smart_exceptions module compiled and put in a place where erlc can find it? It was certainly compiled: \$ ls -l ebin/smart_exceptions.beam ebin/mapform0.beam -rw-r--r-- 1 brian brian 1900 2010-12-02 19:51 ebin/mapform0.beam -rw-r--r-- 1 brian brian 18936 2010-12-02 19:51 ebin/smart_exceptions.beam However I hadn't added "-pa ebin" to the erlc command line, so it couldn't find it. Thank you for pointing me in the right direction there. I can now compile code with the smart_exceptions transformation, but the exception output isn't any different: \$ rm ebin/my_test.beam \$ rake (in /v/git/rfe) erlc -pa ebin +'{parse_transform,smart_exceptions}' +debug_info -o ebin src/my_test.erl \$ erl +Bc -pa ebin Erlang R13B03 (erts-5.7.4) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.7.4 (abort with ^G) 1> my_test:go(). {foo,bar}** exception error: no match of right hand side value {foo,bar} in function my_test:dostuff/1 in call from my_test:go/0 2> my_test:dostuff({x,y}). {x,y}** exception error: no match of right hand side value {x,y} in function my_test:dostuff/1 Here's the source: \$ cat src/my_test.erl -module(my_test). -export([go/0,dostuff/1]). go() -> dostuff({foo,bar}), io:format("The end~n"). dostuff(A) -> io:write(A), {foo, baz} = A, io:format("Finished~n"). Cheers, Brian. From jesper.louis.andersen Fri Dec 3 15:54:46 2010 From: jesper.louis.andersen (Jesper Louis Andersen) Date: Fri, 3 Dec 2010 15:54:46 +0100 Subject: [erlang-questions] Event and Alarm Handling application, EVA In-Reply-To: References: Message-ID: On Fri, Dec 3, 2010 at 3:35 PM, Dmitriy Kargapolov wrote: > Hello, > I forced to open separate thread, since previous one (EVA-OTP-MIB) drifted > to discussion about Mnemosyne / QLC.. > > I'd really want to know what was the reason of stopping development and > support of the EVA application about 6 years ago. I'm wondering if there > still exist and open to public EVA sources. My guess would be something else was more important to work on and resources got reallocated. Occams Razor and all that. -- J. From thomasl_erlang Fri Dec 3 16:22:35 2010 From: thomasl_erlang (Thomas Lindgren) Date: Fri, 3 Dec 2010 07:22:35 -0800 (PST) Subject: [erlang-questions] Re: Getting line number in backtrace? In-Reply-To: <20101203144952.GA5037@talktalkplc.com> References: <20101202194919.GA7362@talktalkplc.com> <20101202195907.GA7878@talktalkplc.com> <20101203144952.GA5037@talktalkplc.com> Message-ID: <979485.88089.qm@web111405.mail.gq1.yahoo.com> Hi Brian, I'm afraid this library is semi-abandonware at the moment, in that I can't give it a lot of timely attention. But, I'll give three comments in decreasing order of usefulness. 1. Have you tried using the 'stable' version? I haven't gotten a lot of feedback on the 'devel' version, so it may have problems. The main known problem with 'stable' is that the busy people at OTP _may_ have added new syntax that isn't handled well. 2. If you use "erlc -E", you can see the transformed code. Could perhaps be helpful. Or perhaps not. 3. My own view is that line numbers are hugely helpful. Ideally, I'd want all exceptions to contain that info and the entire call stack decorated. Unfortunately, there are some cases where a parse transform is powerless, so it would need compiler and/or VM support. Best, Thomas ----- Original Message ---- > From: Brian Candler > To: erlang-questions > Sent: Fri, December 3, 2010 3:49:52 PM > Subject: [erlang-questions] Re: Getting line number in backtrace? > > Robert Virding wrote: > > Is the smart_exceptions module compiled and put in a place where erlc can >find it? > > It was certainly compiled: > > \$ ls -l ebin/smart_exceptions.beam ebin/mapform0.beam > -rw-r--r-- 1 brian brian 1900 2010-12-02 19:51 ebin/mapform0.beam > -rw-r--r-- 1 brian brian 18936 2010-12-02 19:51 ebin/smart_exceptions.beam > > However I hadn't added "-pa ebin" to the erlc command line, so it couldn't > find it. Thank you for pointing me in the right direction there. > > I can now compile code with the smart_exceptions transformation, but the > exception output isn't any different: > > \$ rm ebin/my_test.beam > \$ rake > (in /v/git/rfe) > erlc -pa ebin +'{parse_transform,smart_exceptions}' +debug_info -o ebin >src/my_test.erl > \$ erl +Bc -pa ebin > Erlang R13B03 (erts-5.7.4) [source] [64-bit] [smp:2:2] [rq:2] >[async-threads:0] [hipe] [kernel-poll:false] > > Eshell V5.7.4 (abort with ^G) > 1> my_test:go(). > {foo,bar}** exception error: no match of right hand side value {foo,bar} > in function my_test:dostuff/1 > in call from my_test:go/0 > 2> my_test:dostuff({x,y}). > {x,y}** exception error: no match of right hand side value {x,y} > in function my_test:dostuff/1 > > Here's the source: > > \$ cat src/my_test.erl > -module(my_test). > -export([go/0,dostuff/1]). > > go() -> > dostuff({foo,bar}), > io:format("The end~n"). > > dostuff(A) -> > io:write(A), > {foo, baz} = A, > io:format("Finished~n"). > > > Cheers, > > Brian. > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From B.Candler Fri Dec 3 16:48:51 2010 From: B.Candler (Brian Candler) Date: Fri, 3 Dec 2010 15:48:51 +0000 Subject: [erlang-questions] Re: Getting line number in backtrace? In-Reply-To: <979485.88089.qm@web111405.mail.gq1.yahoo.com> References: <20101202194919.GA7362@talktalkplc.com> <20101202195907.GA7878@talktalkplc.com> <20101203144952.GA5037@talktalkplc.com> <979485.88089.qm@web111405.mail.gq1.yahoo.com> Message-ID: <20101203154851.GB5799@talktalkplc.com> On Fri, Dec 03, 2010 at 07:22:35AM -0800, Thomas Lindgren wrote: > 1. Have you tried using the 'stable' version? I haven't gotten a lot of feedback > on the 'devel' version, so it may have problems. I hadn't, because I thought 'stable' was for R8 or similarly early elang. I've just tried building 'stable' but it fails under R13B3: erlc +debug_info -o ebin vendor/smart_exceptions.erl vendor/smart_exceptions.erl:704: illegal guard expression vendor/smart_exceptions.erl:92: Warning: variable 'Opts' is unused vendor/smart_exceptions.erl:119: Warning: variable 'Err' is unused vendor/smart_exceptions.erl:154: Warning: variable 'La' is unused ... rake aborted! Command failed with status (1): [erlc +debug_info -o ebin vendor/smart_exce...] /v/git/rfe/Rakefile:16 That line says: mapform0(F, C) when constant(C) -> C. > 2. If you use "erlc -E", you can see the transformed code. Could perhaps be > helpful. Or perhaps not. With 'devel' the .E file contains: -file("src/my_test.erl", 1). go() -> dostuff({foo,bar}), io:format("The end~n"). dostuff(A) -> io:write(A), {foo,baz} = A, io:format("Finished~n"). module_info() -> erlang:get_module_info(my_test). module_info(X) -> erlang:get_module_info(my_test, X). So it's not transformed very much :-) > 3. My own view is that line numbers are hugely helpful. Ideally, I'd want all > exceptions to contain that info and the entire call stack decorated. > Unfortunately, there are some cases where a parse transform is powerless, so it > would need compiler and/or VM support. We concur. Cheers, Brian. From attila.r.nohl Fri Dec 3 17:40:23 2010 From: attila.r.nohl (Attila Rajmund Nohl) Date: Fri, 3 Dec 2010 17:40:23 +0100 Subject: [erlang-questions] Re: Getting line number in backtrace? In-Reply-To: <20101203154851.GB5799@talktalkplc.com> References: <20101202194919.GA7362@talktalkplc.com> <20101202195907.GA7878@talktalkplc.com> <20101203144952.GA5037@talktalkplc.com> <979485.88089.qm@web111405.mail.gq1.yahoo.com> <20101203154851.GB5799@talktalkplc.com> Message-ID: 2010/12/3, Brian Candler : > On Fri, Dec 03, 2010 at 07:22:35AM -0800, Thomas Lindgren wrote: >> 1. Have you tried using the 'stable' version? I haven't gotten a lot of >> feedback >> on the 'devel' version, so it may have problems. > > I hadn't, because I thought 'stable' was for R8 or similarly early elang. > > I've just tried building 'stable' but it fails under R13B3: > > erlc +debug_info -o ebin vendor/smart_exceptions.erl > vendor/smart_exceptions.erl:704: illegal guard expression > vendor/smart_exceptions.erl:92: Warning: variable 'Opts' is unused > vendor/smart_exceptions.erl:119: Warning: variable 'Err' is unused > vendor/smart_exceptions.erl:154: Warning: variable 'La' is unused > ... > rake aborted! > Command failed with status (1): [erlc +debug_info -o ebin > vendor/smart_exce...] > /v/git/rfe/Rakefile:16 > > That line says: > > mapform0(F, C) when constant(C) -> > C. That constant guard was removed in R13B. From tony.arcieri Fri Dec 3 18:10:03 2010 From: tony.arcieri (Tony Arcieri) Date: Fri, 3 Dec 2010 10:10:03 -0700 Subject: [erlang-questions] Re: Getting line number in backtrace? In-Reply-To: <979485.88089.qm@web111405.mail.gq1.yahoo.com> References: <20101202194919.GA7362@talktalkplc.com> <20101202195907.GA7878@talktalkplc.com> <20101203144952.GA5037@talktalkplc.com> <979485.88089.qm@web111405.mail.gq1.yahoo.com> Message-ID: On Fri, Dec 3, 2010 at 8:22 AM, Thomas Lindgren wrote: > My own view is that line numbers are hugely helpful. Ideally, I'd want all > exceptions to contain that info and the entire call stack decorated. > Unfortunately, there are some cases where a parse transform is powerless, > so it > would need compiler and/or VM support. I strongly agree that VM-level support for this is wonderful, line numbers for the entire callstack would be super awesomesauce, and that you can't do this with a parse transform. At one point I had worked on trying to decorate the entire call stack with line numbers by wrapping every possible call site with try/catch and specifically decorating special "exception" objects/terms. Later I learned that will break tail recursion so I gave up. I don't think there's any solution to decorating exceptions in this manner that could possibly support mutual tail recursion. There are some ways to handle simple tail recursion, i.e. an entry function that has the call sites wrapped that calls a tail recursive version of the same function that doesn't. I'm thinking VM-level support is the only real option. -- Tony Arcieri Medioh! Kudelski From alain.odea Fri Dec 3 18:19:24 2010 From: alain.odea (Alain O'Dea) Date: Fri, 3 Dec 2010 13:49:24 -0330 Subject: [erlang-questions] guard expression restriction In-Reply-To: References: <843895600.156431291368979136.JavaMail.root@zimbra> Message-ID: I think most useful guards expressions can be composed from guards. Using macros you can bundle these and parameterize them to get 'user-defined' guards. You can then put these macros in a header and include them. Macros seem like a practical solution to this problem. Am I missing something? On Friday, December 3, 2010, James Churchman wrote: > would it have to be "silently changed".. RefactorErl, Wrangler or Dialyzer could be modified to "upgrade" or at least produce warning in all* cases where flipping the functionality would effect the true functionality of it. Also i would guess much code is written with out the knowledge that some LC guards fail silently, some don't ?:-) > > *all in this case means "i assume all" > > On 3 Dec 2010, at 09:36, Robert Virding wrote: > >> I wonder what would happen if it was just silently changed? :-) > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From fritchie Fri Dec 3 19:27:44 2010 From: fritchie (Scott Lystig Fritchie) Date: Fri, 03 Dec 2010 12:27:44 -0600 Subject: [erlang-questions] Re: Getting line number in backtrace? In-Reply-To: Message of "Fri, 03 Dec 2010 17:40:23 +0100." Message-ID: <37559.1291400864@snookles.snookles.com> Attila Rajmund Nohl wrote: >> That line says: >> >> mapform0(F, C) when constant(C) -> C. arn> That constant guard was removed in R13B. I'm a smart_exceptions fan. IIRC I just removed that guard: [...] mapform0(F, C) -> C. -Scott From rzezeski Fri Dec 3 19:43:34 2010 From: rzezeski (Ryan Zezeski) Date: Fri, 3 Dec 2010 13:43:34 -0500 Subject: Erlang Intro/Evangelism Presentation Message-ID: I've been tasked with giving an introductory level presentation on Erlang at work. The focus is on why you would use Erlang and what does it look like on the surface level. We have a lot of your standard Java/C#/C developers and this will act as a potential launching pad to introducing Erlang to the company. There is the potential for a large number of people to video conference into this possibly spanning several countries so I really want to knock this out of the park. I'm writing as an inquiry for links to any prior art that I may use for inspiration or even steal and use as my own. Anything that you think might be helpful is appreciated, even input on possible approaches. I'd really like to hear from people who have done this sort of thing before, i.e. pubic speaking on Erlang. Thanks, -Ryan From ntwrkd Fri Dec 3 19:55:42 2010 From: ntwrkd (msacks) Date: Fri, 3 Dec 2010 10:55:42 -0800 Subject: [erlang-questions] Erlang Intro/Evangelism Presentation In-Reply-To: References: Message-ID: Hi Ryan, You can find many videos and slides here on the Erlang Factory Lite LA talk that should help: http://www.thebitsource.com/featured-posts/erlang-factory-lite-la-distribute-and-conquer/ (links embedded in this post). The video quality isn't top-notch, but the content and speakers are. You can also probably find other videos from other Erlang Factories and QCONs that would be good resources. The EF LA videos are great because they were tailored to a room with a 50/50 split of Erlang experience, so you get advanced and beginner topics. HTH, Matthew On Fri, Dec 3, 2010 at 10:43 AM, Ryan Zezeski wrote: > I've been tasked with giving an introductory level presentation on Erlang at > work. ?The focus is on why you would use Erlang and what does it look like > on the surface level. ?We have a lot of your standard Java/C#/C developers > and this will act as a potential launching pad to introducing Erlang to the > company. ?There is the potential for a large number of people to video > conference into this possibly spanning several countries so I really want to > knock this out of the park. > > I'm writing as an inquiry for links to any prior art that I may use for > inspiration or even steal and use as my own. ?Anything that you think might > be helpful is appreciated, even input on possible approaches. ?I'd really > like to hear from people who have done this sort of thing before, i.e. pubic > speaking on Erlang. > > Thanks, > -Ryan > From seancribbs Fri Dec 3 22:33:17 2010 From: seancribbs (Sean Cribbs) Date: Fri, 3 Dec 2010 16:33:17 -0500 Subject: [erlang-questions] Erlang Intro/Evangelism Presentation In-Reply-To: References: Message-ID: This is a presentation I gave last year (geared slightly toward Ruby programmers, but OO users in general): http://www.slideshare.net/seancribbs/erlangotp-for-rubyists Hope that helps! Sean On Fri, Dec 3, 2010 at 1:43 PM, Ryan Zezeski wrote: > I've been tasked with giving an introductory level presentation on Erlang at > work. ?The focus is on why you would use Erlang and what does it look like > on the surface level. ?We have a lot of your standard Java/C#/C developers > and this will act as a potential launching pad to introducing Erlang to the > company. ?There is the potential for a large number of people to video > conference into this possibly spanning several countries so I really want to > knock this out of the park. > > I'm writing as an inquiry for links to any prior art that I may use for > inspiration or even steal and use as my own. ?Anything that you think might > be helpful is appreciated, even input on possible approaches. ?I'd really > like to hear from people who have done this sort of thing before, i.e. pubic > speaking on Erlang. > > Thanks, > -Ryan > From wglozer Sat Dec 4 00:36:03 2010 From: wglozer (Will) Date: Fri, 3 Dec 2010 15:36:03 -0800 Subject: [erlang-questions] [Job] Location Based MMORPG server engineers - Grey Area & Shadow Cities In-Reply-To: <45A0CCFE-CB0B-41F9-BC2A-999DEF6EF164@greyarealabs.com> References: <45A0CCFE-CB0B-41F9-BC2A-999DEF6EF164@greyarealabs.com> Message-ID: Hello Mikko, I'm an experienced Erlang programmer who would love to chat about Gray Area with you! I just saw this email on erlang-questions but saw a reference to the game on twitter earlier this week. Sadly I'm unable to try it because I am in San Francisco, but I'm very excited about the opportunities for games that combine the real world with a virtual reality overlay. I've been doing Erlang development for ~4 years and am the author of epgsql, IMHO the best PostgreSQL driver for Erlang. In addition to that I've implemented all of the popular IM protocols for a (now defunct) mobile IM site, http://twtfiltr.com - a transparent filtering API proxy for twitter, and more. You can check out my homepage and github accounts: http://glozer.net, https://github.com/wg You don't mention anything about location - are you willing to hire someone to work remotely? I'm currently in San Francisco but will be moving to Tokyo next week. -Will 2010/11/29 Mikko H?m?l?inen : > Grey Area is an incredible company building next generation location aware multiplayer worlds. We are turning every city on the planet, including yours, into a game that can be accessed any time through your mobile phone. Think World of Warcraft on city streets. > > The first game world, Shadow Cities (http://www.shadowcities.com) is currently in Beta in Finland. We are going to launch it globally in coming months are are looking for talented individuals to join our server team. The whole game server is implemented in Erlang. > > This is very exciting time as we are building something truly new. We are looking for a highly motivated individuals who are able to work as part of a team but are also able to take ownership of parts of the system and improve the product as a whole. > > Erlang Server Engineers: > > Building the game world server architecture is a challenging task. We use Erlang as our main tool to implement an actor based and highly scalable server that is able handle our concurrent workload. We use MongoDB as our datastore. > > The succesful candidate will have strong Erlang knowledge and experience in designing, implementing and continuing support of large scale server applications. > > Skills and attributes that we?re looking for include: > > - A BSc in Computer Science or Software Engineering or similar experience gained from work. > - Professional experience in writing server side applications. Preferably in Erlang. > - Architectual expertise in designing distributed systems running in a cluster. > - Expertise in Linux operating system. > - Skill and patience for finding and fixing bugs in distributed multimachine systems. > - Experience tuning real-time server systems for performance and reliability > - Interest in building next generation multiplayer game worlds > - And most important of all, you are a nice person to work with and ready to be part of an amazing team > > Please check out: > - http://www.greyarealabs.com/jobs/ > - http://www.shadowcities.com > > You can contact us at jobs > > Best regards, > Mikko H?m?l?inen > Co-Founder, Grey Area From raould Sat Dec 4 01:03:40 2010 From: raould (Raoul Duke) Date: Fri, 3 Dec 2010 16:03:40 -0800 Subject: layers of goo(d)? Message-ID: so has anybody tried reia or lfe on erjang yet? :-) From tony.arcieri Sat Dec 4 01:22:14 2010 From: tony.arcieri (Tony Arcieri) Date: Fri, 3 Dec 2010 17:22:14 -0700 Subject: [erlang-questions] layers of goo(d)? In-Reply-To: References: Message-ID: On Fri, Dec 3, 2010 at 5:03 PM, Raoul Duke wrote: > so has anybody tried reia or lfe on erjang yet? :-) https://github.com/tarcieri/reja :) -- Tony Arcieri Medioh! Kudelski From kenji.rikitake Sat Dec 4 02:40:07 2010 From: kenji.rikitake (Kenji Rikitake) Date: Sat, 4 Dec 2010 10:40:07 +0900 Subject: [erlang-questions] mailing list "reply to" In-Reply-To: <00ce01cb9198\$2dcd5900\$89680b00\$@com> References: <934FA413-459B-482B-80E6-225A67EED2A4@gmail.com> <00ce01cb9198\$2dcd5900\$89680b00\$@com> Message-ID: <20101204014006.GA26216@k2r.org> A reference to the history of Reply-To: header handling: http://woozle.org/~neale/papers/reply-to-still-harmful.html FYI Kenji Rikitake From kenji.rikitake Sat Dec 4 03:06:36 2010 From: kenji.rikitake (Kenji Rikitake) Date: Sat, 4 Dec 2010 11:06:36 +0900 Subject: [erlang-questions] Setting TZ variable In-Reply-To: <0004061E-6A2D-4A0E-9495-8E22F1778610@erlang-solutions.com> References: <0004061E-6A2D-4A0E-9495-8E22F1778610@erlang-solutions.com> Message-ID: <20101204020636.GB26216@k2r.org> And remember we've already got another PITA called the leap seconds. (Note: POSIX intentionally *ignores* the leap seconds at all. Fortunately this has been properly handed in Erlang since R14B.) Kenji Rikitake still running my FreeBSD servers with djb's libtai In the message <0004061E-6A2D-4A0E-9495-8E22F1778610> dated Fri, Dec 03, 2010 at 08:28:55AM +0100, Ulf Wiger writes: > So, the original advice came from the AXD 301 days, where we had to deal > with timezone and DST issues in a non-stop system. Running on Solaris, > at the time, updating the zoneinfo files was an OS patch each time, and there > were ca 200 different settings. Timezone is relatively straightforward - at least > the AXD 301 tended not to move once brought into service, but DST is really > a PITA; some countries decide through parlamentary decision when it's > supposed to happen each year, and others have different rules for years > with presidential elections? > > Also, we needed to get the time representation in logs correct (i.e. correct > localtime) - not just the time presented in the GUI. > > Granted, it was early days for OTP, so some of our issues have long-since > been fixed. Initially, there was no erlang:universaltime(), and if the OS time > changed to DST, this would affect erlang:now() and all timers in the system, > so we set the system clock to UST and tweaked the TZ variable from within Erlang. > > BR, > Ulf W From alain.odea Sat Dec 4 03:16:10 2010 From: alain.odea (Alain O'Dea) Date: Fri, 3 Dec 2010 22:46:10 -0330 Subject: [erlang-questions] mailing list "reply to" In-Reply-To: <20101204014006.GA26216@k2r.org> References: <934FA413-459B-482B-80E6-225A67EED2A4@gmail.com> <00ce01cb9198\$2dcd5900\$89680b00\$@com> <20101204014006.GA26216@k2r.org> Message-ID: I love how this topic resurfaces perennially. I tried to apply the Reply is private Reply All goes to Group to a Google Group I created for my graduating class. They flipped out and I reversed it. Young people these days ;) On Fri, Dec 3, 2010 at 10:10 PM, Kenji Rikitake wrote: > A reference to the history of Reply-To: header handling: > http://woozle.org/~neale/papers/reply-to-still-harmful.html > > FYI > Kenji Rikitake > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From sigmastar Sat Dec 4 04:13:11 2010 From: sigmastar (Jesse Gumm) Date: Fri, 3 Dec 2010 21:13:11 -0600 Subject: [erlang-questions] mailing list "reply to" In-Reply-To: References: <934FA413-459B-482B-80E6-225A67EED2A4@gmail.com> <00ce01cb9198\$2dcd5900\$89680b00\$@com> <20101204014006.GA26216@k2r.org> Message-ID: For me, it makes more sense to mangle the reply-to header since 99% of the time, I'm replying to the mailing list rather than do the individual. It makes more sense to me to make the default behavior be the most common behavior. I view a mailing list as just another way of implementing an online forum, and in that regard, the default action is to reply to the thread, rather than via PM. If I'm in the minority, and most people actually do private replies more frequently than public ones, then that makes sense why it's the default, preferred way. -Jesse On Fri, Dec 3, 2010 at 8:16 PM, Alain O'Dea wrote: > I love how this topic resurfaces perennially. ?I tried to apply the Reply is > private Reply All goes to Group to a Google Group I created for my > graduating class. ?They flipped out and I reversed it. ?Young people these > days ;) > > On Fri, Dec 3, 2010 at 10:10 PM, Kenji Rikitake wrote: > >> A reference to the history of Reply-To: header handling: >> http://woozle.org/~neale/papers/reply-to-still-harmful.html >> >> FYI >> Kenji Rikitake >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe >> >> > -- Jesse Gumm Sigma Star Systems 414.940.4866 gumm http://www.sigma-star.com From tony.arcieri Sat Dec 4 04:15:10 2010 From: tony.arcieri (Tony Arcieri) Date: Fri, 3 Dec 2010 20:15:10 -0700 Subject: [erlang-questions] layers of goo(d)? In-Reply-To: References: Message-ID: I also believe I recall hearing about Robert Virding giving a presentation about LFE where it was running on Erjang. Unfortunately I can't report similar success for Reia (yet) -- Tony Arcieri Medioh! Kudelski From tony.arcieri Sat Dec 4 04:19:10 2010 From: tony.arcieri (Tony Arcieri) Date: Fri, 3 Dec 2010 20:19:10 -0700 Subject: [erlang-questions] layers of goo(d)? In-Reply-To: References: Message-ID: On Fri, Dec 3, 2010 at 8:15 PM, Tony Arcieri wrote: > I also believe I recall hearing about Robert Virding giving a presentation > about LFE where it was running on Erjang. Unfortunately I can't report > similar success for Reia (yet) > For what it's worth, Reia on Erjang is closer to working on this branch of Erjang: https://github.com/eriksoe/erjang -- Tony Arcieri Medioh! Kudelski From yinso.chen Sat Dec 4 05:21:28 2010 From: yinso.chen (YC) Date: Fri, 3 Dec 2010 20:21:28 -0800 Subject: [erlang-questions] mailing list "reply to" In-Reply-To: References: <934FA413-459B-482B-80E6-225A67EED2A4@gmail.com> <00ce01cb9198\$2dcd5900\$89680b00\$@com> <20101204014006.GA26216@k2r.org> Message-ID: Hi Jesse - On Fri, Dec 3, 2010 at 7:13 PM, Jesse Gumm wrote: > For me, it makes more sense to mangle the reply-to header since 99% of > the time, I'm replying to the mailing list rather than do the > individual. It makes more sense to me to make the default behavior be > the most common behavior. I view a mailing list as just another way > of implementing an online forum, and in that regard, the default > action is to reply to the thread, rather than via PM. > Maybe it is easier to picture this way - what if some of the forums you frequent all the sudden change their default behavior to pm'ing instead of replying to forum? Will that perhaps catch you by surprise? That's the same with mailing lists not obeying internet standards - they surprise the heck out of people when all the sudden reply no longer just goes to the sender, unfortunately just when they need to private message. You might think mailing list is the same as forums, but mail clients *are not* forums. Reply means replying to sender, and mailing list munging reply-to are breaking the expected behavior of mail clients. Hopefully you won't ever inadvertently send a private reply to public when your 1% need arise, but if you ever do, you will appreciate why mailing lists should interoperate with the standards instead of breaking them. My last 2 cents on this off-topic thread. Cheers, yc From sigmastar Sat Dec 4 05:48:42 2010 From: sigmastar (Jesse Gumm) Date: Fri, 3 Dec 2010 22:48:42 -0600 Subject: [erlang-questions] mailing list "reply to" In-Reply-To: References: <934FA413-459B-482B-80E6-225A67EED2A4@gmail.com> <00ce01cb9198\$2dcd5900\$89680b00\$@com> <20101204014006.GA26216@k2r.org> Message-ID: Oh totally. I understand the reasoning behind the behavior and I wouldn't expect anyone to change the behavior of things - that would lead to some disasters. To be honest, I never even thought about it before this post, as I've got my gmail configured to reply-all by default. It's more just something that did strike me as odd, but I'm no veteran to mailing lists, and was not aware there even was a mailing list standard. If I were coming to mailing lists the first time, I would expect them to munge the reply-to header, but as it is, I'm not surprised or hampered by the fact that they don't. -Jesse On Fri, Dec 3, 2010 at 10:21 PM, YC wrote: > Hi Jesse - > On Fri, Dec 3, 2010 at 7:13 PM, Jesse Gumm wrote: >> >> For me, it makes more sense to mangle the reply-to header since 99% of >> the time, I'm replying to the mailing list rather than do the >> individual. ?It makes more sense to me to make the default behavior be >> the most common behavior. ?I view a mailing list as just another way >> of implementing an online forum, and in that regard, the default >> action is to reply to the thread, rather than via PM. > > Maybe it is easier to picture this way - what if some of the forums you > frequent all the sudden change their default behavior to pm'ing instead of > replying to forum? ?Will that perhaps catch you by surprise? > That's the same with mailing lists not obeying internet standards - they > surprise the heck out of people when all the sudden reply no longer just > goes to the sender, unfortunately just when they need to private message. > ?You might think mailing list is the same as forums, but mail clients *are > not* forums. ?Reply means replying to sender, and mailing list munging > reply-to are breaking the expected behavior of mail clients. > Hopefully you won't ever inadvertently send a private reply to public when > your 1% need arise, but if you ever do, you will appreciate why mailing > lists should interoperate with the standards instead of breaking them. > My last 2 cents on this off-topic thread. ?Cheers, > yc > > -- Jesse Gumm Sigma Star Systems 414.940.4866 gumm http://www.sigma-star.com From allanwegan Sat Dec 4 10:56:11 2010 From: allanwegan (Allan Wegan) Date: Sat, 04 Dec 2010 10:56:11 +0100 Subject: [erlang-questions] mailing list "reply to" In-Reply-To: <934FA413-459B-482B-80E6-225A67EED2A4@gmail.com> References: <934FA413-459B-482B-80E6-225A67EED2A4@gmail.com> Message-ID: <4CFA103B.3060507@allanwegan.de> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > Is is deliberate that the erlang mailing list does not set the "reply to" to erlang-questions so that when you click reply in your client it does not reply to the list? Here in Thunderbird 3 i get two reply buttons: "reply" really replies to the sender of the message (the individual author). "reply list" replies to the list. It makes sense for me that way. > This seems a strange option and unlike any other mailing list i have come across :-) Yes, it is unlike other lists, where i have to manually copy the email address of the author if i really want to reply to the sender only. There i get two buttons too. But they do the same, because of the faked reply-to header. I don't like that behaviour, that breaks the standard behaviour of email and makes the two buttons with different semantic meanings act the same. I feel it tries to trick me in sending private messages to the list. That is really bad behaviour. Thanks to the list maintainer, for letting the buttons work as expected. - -- Allan Wegan Jabber: allanwegan ICQ: 209459114 Phone: +49 40 6732962 Sch?neberger Stra?e 60, 22149 Hamburg -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (MingW32) iQEcBAEBAgAGBQJM+hA7AAoJENm5axHh7Acx6E4H/2f6CKe6+CWiuf/UA1l2RjGw SAwmaFTSfr6nrQMvkbx6mNQ3PjVVeUTD0fX6bxn0/UFW2UQI9+AgKZV+Ozfi/Gsp BBLVloRK2IfP8dgnVdboMiEH+4i3VlmXVs6iZM4QJf22JWiVdzlKYGvHyu2eLOPo N+e9V5rcTjRNDK5Q/8+P+jsYPk1tnKu67XiKGtuAxit1Ax6LOYvO9H3Z1E/t92wq QGEtt5KVkiU1Z5i+yMlppgJwovDEK/F5zn0axqMYN7G1EvbZkHB3sGDwPSbT9PkU 3jTKYr9Jc7wE86fqG6oIunMjH+84t/w7ycIREg5qdjhAxSGev+MQP7nhzfdrzvY= =Rxn2 -----END PGP SIGNATURE----- From mabrek Sat Dec 4 11:42:25 2010 From: mabrek (mabrek) Date: Sat, 4 Dec 2010 13:42:25 +0300 Subject: how to debug memory leaks? Message-ID: Hello. I've got an erlang process that seems to leak memory. It's heap size increases slowly over time. Are there any tools to examine process heap content in runtime? In Java I can get a heap dump of running JVM and analyze it later with number of tools. It shows full content of application memory. Regards, Anton Lebedevich. From max.lapshin Sat Dec 4 12:11:06 2010 From: max.lapshin (Max Lapshin) Date: Sat, 4 Dec 2010 14:11:06 +0300 Subject: [erlang-questions] how to debug memory leaks? In-Reply-To: References: Message-ID: 1) introspect following metrics: message_queue_len, memory, heap_size 2) add handle_info(dump_state, State) -> io:format("State: ~p~n", [State]), {noreply, State}; From mabrek Sat Dec 4 12:20:27 2010 From: mabrek (mabrek) Date: Sat, 4 Dec 2010 14:20:27 +0300 Subject: [erlang-questions] how to debug memory leaks? In-Reply-To: References: Message-ID: On Sat, Dec 4, 2010 at 2:11 PM, Max Lapshin wrote: > 1) introspect following metrics: ?message_queue_len, memory, heap_size message_queue_len is zero, memory and heap_size grow slowly. > 2) add > handle_info(dump_state, State) -> io:format("State: ~p~n", [State]), > {noreply, State}; It requires runtime code modification in suspected process to be implemented properly. io:format ~p shortens long lists. Is there more general solution to get analyzable heap dump of running process? Regards, Anton Lebedevich. From dgud Sat Dec 4 12:28:39 2010 From: dgud (Dan Gudmundsson) Date: Sat, 4 Dec 2010 12:28:39 +0100 Subject: [erlang-questions] how to debug memory leaks? In-Reply-To: References: Message-ID: Maybe sys:get_status/1 returns the state for gen processes. /Dan On Sat, Dec 4, 2010 at 12:20 PM, mabrek wrote: > > It requires runtime code modification in suspected process to be > implemented properly. io:format ~p shortens long lists. > From max.lapshin Sat Dec 4 12:34:12 2010 From: max.lapshin (Max Lapshin) Date: Sat, 4 Dec 2010 14:34:12 +0300 Subject: [erlang-questions] how to debug memory leaks? In-Reply-To: References: Message-ID: Indeed: use sys:get_status From mabrek Sat Dec 4 12:54:19 2010 From: mabrek (mabrek) Date: Sat, 4 Dec 2010 14:54:19 +0300 Subject: [erlang-questions] how to debug memory leaks? In-Reply-To: References: Message-ID: Great thanks, it works for me. On Sat, Dec 4, 2010 at 2:28 PM, Dan Gudmundsson wrote: > Maybe sys:get_status/1 returns the state for gen processes. > > /Dan > > On Sat, Dec 4, 2010 at 12:20 PM, mabrek wrote: >> >> It requires runtime code modification in suspected process to be >> implemented properly. io:format ~p shortens long lists. >> > From ulf.wiger Sat Dec 4 13:10:47 2010 From: ulf.wiger (Ulf Wiger) Date: Sat, 4 Dec 2010 13:10:47 +0100 Subject: [erlang-questions] layers of goo(d)? In-Reply-To: References: Message-ID: At the Erlang Factory Lite LA, Robert Virding demonstrated an LFE program using OTP's gen_server behaviour, with the client running on an Erjang node and the server on an Erlang node, the two linked together with Distributed Erlang. BR, Ulf W On 4 Dec 2010, at 01:03, Raoul Duke wrote: > so has anybody tried reia or lfe on erjang yet? :-) > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > Ulf Wiger, CTO, Erlang Solutions, Ltd. http://erlang-solutions.com From alexey.v.romanov Sat Dec 4 13:42:29 2010 From: alexey.v.romanov (Alexey Romanov) Date: Sat, 4 Dec 2010 15:42:29 +0300 Subject: [erlang-questions] how to debug memory leaks? In-Reply-To: References: Message-ID: I am also seeing growth in heap size and memory consumption on a couple of processes, but calling garbage_collect(Pid) manually frees most of it. So it may just be that there is enough memory available that it isn't garbage-collecting... On Sat, Dec 4, 2010 at 2:54 PM, mabrek wrote: > Great thanks, it works for me. > > On Sat, Dec 4, 2010 at 2:28 PM, Dan Gudmundsson wrote: >> Maybe sys:get_status/1 returns the state for gen processes. >> >> /Dan >> >> On Sat, Dec 4, 2010 at 12:20 PM, mabrek wrote: >>> >>> It requires runtime code modification in suspected process to be >>> implemented properly. io:format ~p shortens long lists. >>> >> > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > -- Yours, Alexey Romanov From alain.odea Sat Dec 4 15:10:15 2010 From: alain.odea (Alain O'Dea) Date: Sat, 4 Dec 2010 10:40:15 -0330 Subject: [erlang-questions] how to debug memory leaks? In-Reply-To: References: Message-ID: appmon:start() can be used to profile an OTP application and it's constituent processes at runtime. It is normal for the heap to increase over time. AFAIK, Erlang GC occurs rarely unless a process dies or memory is low. This is similar to how Java's GC works. It is not unusual for a JVM to gradually consume more memory as it runs without indicating a memory leak. Gradual memory consumption increases are harmless so long as GC can reclaim them. Testing for this can be tricky. I would create a list big enough to trigger GC in a separate process and see if GC reclaims the memory from the process whose heap I am monitoring. The obvious culprits for memory leaks in Erlang for me have been: - creating atoms dynamically - storing large structures in the process dictionary - behavior state data grows unboundedly (storing a growing list or proplist for example) - large binaries are shared across processes under the hood The obvious fixes for me have been: - avoid dynamically creating atoms (use list_to_existing_atom/1 or binary_to_existing_atom/1) - avoid using the process dictionary (make sure to clear keys you no longer need if you do use it) - avoid growing behaviour state (use a persistence solution like Riak) - avoid large binaries On Saturday, December 4, 2010, mabrek wrote: > Hello. > > I've got an erlang process that seems to leak memory. It's heap size > increases slowly over time. Are there any tools to examine process > heap content in runtime? > > In Java I can get a heap dump of running JVM and analyze it later with > number of tools. It shows full content of application memory. > > Regards, > Anton Lebedevich. > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From ulf.wiger Sat Dec 4 15:28:44 2010 From: ulf.wiger (Ulf Wiger) Date: Sat, 4 Dec 2010 15:28:44 +0100 Subject: [erlang-questions] how to debug memory leaks? In-Reply-To: References: Message-ID: <54D2ABF2-FB98-44D3-B32B-91D9F46D8E5C@erlang-solutions.com> On 4 Dec 2010, at 15:10, Alain O'Dea wrote: > It is normal for the heap to increase over time. AFAIK, Erlang GC > occurs rarely unless a process dies or memory is low. This is similar > to how Java's GC works. It is not unusual for a JVM to gradually > consume more memory as it runs without indicating a memory leak. Actually, GCs happen very frequently in Erlang, as soon as a process heap fills up. The heap size is increased if removing the garbage is not sufficient to allocate the next term on the heap. Among the things suggested so far, I'd also look at the process dictionary. It will be part of the output from sys:get_status/1 or process_info/1, but e.g. erts_debug:flat_size(process_info(Pid, dictionary)) could be a way to monitor it. Another useful technique is to use erlang:system_monitor(MonitorPid, [{large_heap, Limit}]) and having the MonitorPid call process_info/1 on the process in question, any time it receives a large_heap message. BR, Ulf W Ulf Wiger, CTO, Erlang Solutions, Ltd. http://erlang-solutions.com From attila.r.nohl Sat Dec 4 16:40:24 2010 From: attila.r.nohl (Attila Rajmund Nohl) Date: Sat, 4 Dec 2010 16:40:24 +0100 Subject: [erlang-questions] how to debug memory leaks? In-Reply-To: References: Message-ID: Ah, I have a GREAT story about this. We've received TRs that our program was crashing. It turned out that the Linux OOM-killer was killing some of our processes, because the OS ran out of memory. We saw that the process heap of some processes were quite big (tens of MBs), but calling erlang:garbage_collect(Pid) on them decreased it to the KB range - which was really strange. I've added code to run erlang:garbage_collect on the biggest processes time to time, but in the long run it didn't solve the problem, so I've started to check other memory users, including ets. Then the giveaway was that one row in the one table occupied 25% of the whole table size - and that was suspicious. Some background: the Erlang project I'm working on is older than the support for records in Erlang (in fact, it's older than Erlang itself and was rewritten from C++ many moons ago), so we don't use records in ets table, simple key-value pairs are stored where the values are almost always proplists. For a particular piece of data the software developer needed an index by a key in the proplist, so he created an other ets table for the same data, but in this case with a different key. He wrote all the necessary code that updated both etc tables when necessary. For architectural reasons the only the main table is saved when the software is stopped, so the index table itself was stored in the main table (using ets:tab2list). Unfortunately the developer made a mistake (in the very first CVS commit of his index-related code): he deleted the element from the index table with a code like this: Data = ets:lookup(Tab, ...), ets:delete(Tab, Data) Because the ets:delete expects the _key_ of the data, not the whole data, the data wasn't removed from the index table, it grew. Because this table was stored in the main table, the size of that table also grew (and the size of one row in particular grew - eventually providing the decisive clue). There was an Erlang process that read this huge index table from the main table, then wrote it back every time the index was updated, temporary allocating a big chunk of memory. This bug was in our code for 3 years before we've noticed - a strict type checking compiler probably would have caught it at the first compilation attempt. So my advice is to check everything for suspicious behaviour. Too big files, too big tables, too may processes, etc. Check what that process does, does it handle big lists, long strings? Use ets:memory() to get what uses the most memory. 2010/12/4, Alexey Romanov : > I am also seeing growth in heap size and memory consumption on a > couple of processes, but calling garbage_collect(Pid) manually frees > most of it. So it may just be that there is enough memory available > that it isn't garbage-collecting... > > On Sat, Dec 4, 2010 at 2:54 PM, mabrek wrote: >> Great thanks, it works for me. >> >> On Sat, Dec 4, 2010 at 2:28 PM, Dan Gudmundsson wrote: >>> Maybe sys:get_status/1 returns the state for gen processes. >>> >>> /Dan >>> >>> On Sat, Dec 4, 2010 at 12:20 PM, mabrek wrote: >>>> >>>> It requires runtime code modification in suspected process to be >>>> implemented properly. io:format ~p shortens long lists. >>>> >>> >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe >> >> > > > > -- > Yours, Alexey Romanov > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From ulf.wiger Sat Dec 4 16:50:37 2010 From: ulf.wiger (Ulf Wiger) Date: Sat, 4 Dec 2010 16:50:37 +0100 Subject: [erlang-questions] how to debug memory leaks? In-Reply-To: References: Message-ID: <8A400115-8DE5-453E-98A7-DC2E0E3AA8BB@erlang-solutions.com> On 4 Dec 2010, at 16:40, Attila Rajmund Nohl wrote: > Ah, I have a GREAT story about this. We've received TRs that our > program was crashing. It turned out that the Linux OOM-killer was > killing some of our processes, because the OS ran out of memory. We > saw that the process heap of some processes were quite big (tens of > MBs), but calling erlang:garbage_collect(Pid) on them decreased it to > the KB range - which was really strange. The reason why processes can remain large without getting GCed, is that they have probably just increased their heap size dramatically in order to store a very big term - heap size being increased in fibonacci steps, so possibly allocating more space than stricly necessary - and after that, not done enough processing to fill the heap with garbage, triggering another GC. BR, Ulf W Ulf Wiger, CTO, Erlang Solutions, Ltd. http://erlang-solutions.com From gordon Sat Dec 4 21:52:27 2010 From: gordon (Gordon Guthrie) Date: Sat, 4 Dec 2010 20:52:27 +0000 Subject: Dialyzer and throw/catch Message-ID: Folks I am getting a dialyzer error that doesn't seem write. Here is the code: case Value of R when ?is_cellref(R) -> case muin_util:attempt(?MODULE, fetch, [R]) of {ok, blank} -> 0; {error, {aborted, _} = Err} -> exit(Err); {ok, Other} -> Other; {error, ErrVal} -> ErrVal end; It call the function muin_util:attempt/3 which looks like: attempt(Mod, F, Args) -> try apply(Mod, F, Args) of Val -> {ok, Val} catch Error:Reason when Error =:= error orelse Error =:= throw -> error_logger:error_msg({Error, Reason, erlang:get_stacktrace()}), {error, Reason} end. Dialyzer gives the following warning: muin.erl:88: The pattern {'error', Err = {'aborted', _}} can never match the type {'ok',_} muin.erl:90: The pattern {'error', ErrVal} can never match the type {'ok',_} muin.erl:134: The pattern {'error', Err = {'errval', _}} can never match the type {'ok',_} muin.erl:135: The pattern {'error', Err = {'aborted', _}} can never match the type {'ok',_} muin.erl:136: The pattern {'error', _E} can never match the type {'ok',_} The function attempt/3 can return both the {'error', ...} patterns it objects to, from the catch... Am I missing something? Gordon -- Gordon Guthrie CEO hypernumbers http://hypernumbers.com t: hypernumbers +44 7776 251669 From gordon Sat Dec 4 21:53:51 2010 From: gordon (Gordon Guthrie) Date: Sat, 4 Dec 2010 20:53:51 +0000 Subject: Dialyzer and throw/catch In-Reply-To: References: Message-ID: Sorry the dialyzer messages should have read: muin.erl:88: The pattern {'error', Err = {'aborted', _}} can never match the type {'ok',_} muin.erl:90: The pattern {'error', ErrVal} can never match the type {'ok',_} The other ones are from elsewhere in the module G On 4 December 2010 20:52, Gordon Guthrie wrote: > Folks > > I am getting a dialyzer error that doesn't seem write. > > Here is the code: > > case Value of > R when ?is_cellref(R) -> > case muin_util:attempt(?MODULE, fetch, [R]) of > {ok, blank} -> 0; > {error, {aborted, _} = Err} -> exit(Err); > {ok, Other} -> Other; > {error, ErrVal} -> ErrVal > end; > > It call the function muin_util:attempt/3 which looks like: > > attempt(Mod, F, Args) -> > try apply(Mod, F, Args) of > Val -> {ok, Val} > catch > Error:Reason when Error =:= error orelse Error =:= throw -> > error_logger:error_msg({Error, Reason, > erlang:get_stacktrace()}), > {error, Reason} > end. > > Dialyzer gives the following warning: > > muin.erl:88: The pattern {'error', Err = {'aborted', _}} can never match > the type {'ok',_} > muin.erl:90: The pattern {'error', ErrVal} can never match the type > {'ok',_} > muin.erl:134: The pattern {'error', Err = {'errval', _}} can never match > the type {'ok',_} > muin.erl:135: The pattern {'error', Err = {'aborted', _}} can never match > the type {'ok',_} > muin.erl:136: The pattern {'error', _E} can never match the type {'ok',_} > > The function attempt/3 can return both the {'error', ...} patterns it > objects to, from the catch... > > Am I missing something? > > Gordon > > -- > Gordon Guthrie > CEO hypernumbers > > http://hypernumbers.com > t: hypernumbers > +44 7776 251669 > -- Gordon Guthrie CEO hypernumbers http://hypernumbers.com t: hypernumbers +44 7776 251669 From gordon Sat Dec 4 22:16:18 2010 From: gordon (Gordon Guthrie) Date: Sat, 4 Dec 2010 21:16:18 +0000 Subject: Dialyzer and throw/catch In-Reply-To: References: Message-ID: On further investigation is seems the problem might be with the function that is being called. The dialyzer error for it is: muin_util.erl:227: The call error_logger:error_msg({'error',_,[{atom(),atom(),[any()] | byte()}]} | {'throw',_,[{atom(),atom(),[any()] | byte()}]}) will never return since the success typing is (string()) -> 'ok' and the contract is (Format::string()) -> 'ok' There is no spec for muin_util:atttempt/3 so I am not sure where this 'success typing' is coming from.. Gordon On 4 December 2010 20:53, Gordon Guthrie wrote: > Sorry the dialyzer messages should have read: > > > muin.erl:88: The pattern {'error', Err = {'aborted', _}} can never match > the type {'ok',_} > muin.erl:90: The pattern {'error', ErrVal} can never match the type > {'ok',_} > > The other ones are from elsewhere in the module > > G > > > On 4 December 2010 20:52, Gordon Guthrie wrote: > >> Folks >> >> I am getting a dialyzer error that doesn't seem write. >> >> Here is the code: >> >> case Value of >> R when ?is_cellref(R) -> >> case muin_util:attempt(?MODULE, fetch, [R]) of >> {ok, blank} -> 0; >> {error, {aborted, _} = Err} -> exit(Err); >> {ok, Other} -> Other; >> {error, ErrVal} -> ErrVal >> end; >> >> It call the function muin_util:attempt/3 which looks like: >> >> attempt(Mod, F, Args) -> >> try apply(Mod, F, Args) of >> Val -> {ok, Val} >> catch >> Error:Reason when Error =:= error orelse Error =:= throw -> >> error_logger:error_msg({Error, Reason, >> erlang:get_stacktrace()}), >> {error, Reason} >> end. >> >> Dialyzer gives the following warning: >> >> muin.erl:88: The pattern {'error', Err = {'aborted', _}} can never match >> the type {'ok',_} >> muin.erl:90: The pattern {'error', ErrVal} can never match the type >> {'ok',_} >> muin.erl:134: The pattern {'error', Err = {'errval', _}} can never match >> the type {'ok',_} >> muin.erl:135: The pattern {'error', Err = {'aborted', _}} can never match >> the type {'ok',_} >> muin.erl:136: The pattern {'error', _E} can never match the type {'ok',_} >> >> The function attempt/3 can return both the {'error', ...} patterns it >> objects to, from the catch... >> >> Am I missing something? >> >> Gordon >> >> -- >> Gordon Guthrie >> CEO hypernumbers >> >> http://hypernumbers.com >> t: hypernumbers >> +44 7776 251669 >> > > > > -- > Gordon Guthrie > CEO hypernumbers > > http://hypernumbers.com > t: hypernumbers > +44 7776 251669 > -- Gordon Guthrie CEO hypernumbers http://hypernumbers.com t: hypernumbers +44 7776 251669 From freza Sat Dec 4 22:41:10 2010 From: freza (Jachym Holecek) Date: Sat, 4 Dec 2010 21:41:10 +0000 Subject: [erlang-questions] Re: Dialyzer and throw/catch In-Reply-To: References: Message-ID: <20101204214110.GA8086@hanele.lan> # Gordon Guthrie 2010-12-04: > On further investigation is seems the problem might be with the function > that is being called. The dialyzer error for it is: > > muin_util.erl:227: The call > error_logger:error_msg({'error',_,[{atom(),atom(),[any()] | byte()}]} | > {'throw',_,[{atom(),atom(),[any()] | byte()}]}) will never return since the > success typing is (string()) -> 'ok' and the contract is (Format::string()) > -> 'ok' That's right, error_logger:error_msg/1 expects a string argument, but you're giving it a 3-tuple -- so dialyzer knows that call is going to explode and correctly concludes muin_util:attempt/3 can only possibly return {ok, _}. (About time I tried dialyzer more closely, it seems pretty smart ;-) > There is no spec for muin_util:atttempt/3 so I am not sure where this > 'success typing' is coming from.. "Success typing" is the name of the approach dialyzer is using, others will know more details about it. Regards, -- Jachym From wallentin.dahlberg Sun Dec 5 00:21:24 2010 From: wallentin.dahlberg (Wallentin Dahlberg) Date: Sun, 5 Dec 2010 00:21:24 +0100 Subject: [erlang-questions] how to debug memory leaks? In-Reply-To: <8A400115-8DE5-453E-98A7-DC2E0E3AA8BB@erlang-solutions.com> References: <8A400115-8DE5-453E-98A7-DC2E0E3AA8BB@erlang-solutions.com> Message-ID: 2010/12/4 Ulf Wiger > > On 4 Dec 2010, at 16:40, Attila Rajmund Nohl wrote: > > > Ah, I have a GREAT story about this. We've received TRs that our > > program was crashing. It turned out that the Linux OOM-killer was > > killing some of our processes, because the OS ran out of memory. We > > saw that the process heap of some processes were quite big (tens of > > MBs), but calling erlang:garbage_collect(Pid) on them decreased it to > > the KB range - which was really strange. > > > > The reason why processes can remain large without getting GCed, is > that they have probably just increased their heap size dramatically in > order to store a very big term - heap size being increased in fibonacci > steps, so possibly allocating more space than stricly necessary - and > after that, not done enough processing to fill the heap with garbage, > triggering another GC. > Also, another problem that might cause memory not being deallocated is idle processes. Idle processes will not get gc'ed since they do not grow heap. So one can have processes with quite large heaps, for reasons just mentioned by Ulf for instance, that never get gc'ed. Related to this is that processes are not checked for gc when they are scheduled out, a gc check is done at the moment the process gets scheduled in. This is for performance reasons but the flip side of this is the risk of increased memory consumption. Regards, Bj?rn-Egil > > BR, > Ulf W > > Ulf Wiger, CTO, Erlang Solutions, Ltd. > http://erlang-solutions.com > > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From robert.virding Sun Dec 5 01:23:27 2010 From: robert.virding (Robert Virding) Date: Sun, 5 Dec 2010 00:23:27 +0000 (GMT) Subject: [erlang-questions] layers of goo(d)? In-Reply-To: <267083699.160331291508484490.JavaMail.root@zimbra> Message-ID: <189746639.160351291508607771.JavaMail.root@zimbra> Of course I have run LFE on erjang! And it works just as well as the rest of erlang. Ulf mentioned a small demo I gave at EF Lite LA where I ran distributed LFE on the BEAM and erjang, I intend to expand this into a good demo. N.B. It would actually be strange if LFE did not run on erjang as erjang runs off the BEAM code and LFE does not tamper with the machine. Robert ----- "Raoul Duke" wrote: > so has anybody tried reia or lfe on erjang yet? :-) > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe From robert.virding Sun Dec 5 01:32:51 2010 From: robert.virding (Robert Virding) Date: Sun, 5 Dec 2010 00:32:51 +0000 (GMT) Subject: [erlang-questions] how to debug memory leaks? In-Reply-To: <439326092.160381291509133633.JavaMail.root@zimbra> Message-ID: <613847071.160401291509171448.JavaMail.root@zimbra> ----- "Alain O'Dea" wrote: > > The obvious culprits for memory leaks in Erlang for me have been: > - creating atoms dynamically > - storing large structures in the process dictionary > - behavior state data grows unboundedly (storing a growing list or > proplist for example) > - large binaries are shared across processes under the hood > > The obvious fixes for me have been: > - avoid dynamically creating atoms (use list_to_existing_atom/1 or > binary_to_existing_atom/1) > - avoid using the process dictionary (make sure to clear keys you no > longer need if you do use it) This advice is equally valid for dict's, gb_trees and ets tables as well. Continually creating new keys without removing old unused ones will eventually do you. > - avoid growing behaviour state (use a persistence solution like > Riak) > - avoid large binaries Large binaries are tricky in that sometimes they are just solution you need to get your app to work properly, and sometimes they will ruin your memory usage. Robert From robert.virding Sun Dec 5 02:36:02 2010 From: robert.virding (Robert Virding) Date: Sun, 5 Dec 2010 01:36:02 +0000 (GMT) Subject: [erlang-questions] Some problem abount exit signal? In-Reply-To: <221232064.160551291512723274.JavaMail.root@zimbra> Message-ID: <1961267518.160571291512962518.JavaMail.root@zimbra> Yes, this is how it works, but I definitely consider this to be a bug. To elaborate with a simple example: 1> self(). <0.31.0> 2> spawn_link(fun () -> exit(kill) end). ** exception exit: killed 3> self(). <0.35.0> Here I have received 'kill' signal and died as I should. Now I trap exits: 4> process_flag(trap_exit, true). false 5> spawn_link(fun () -> exit(kill) end). <0.39.0> 6> flush(). Shell got {'EXIT',<0.39.0>,kill} ok This time I received a trappable 'kill' signal. Finally I explicitly send the 'kill' signal to me: 7> Self = self(). <0.35.0> 8> process_flag(trap_exit, true). %Just to be explicit true 9> spawn_link(fun () -> exit(Self, kill) end). ** exception exit: killed 10> self(). <0.45.0> And this time I received an untrappable 'kill' signal. This means that there are two different types of 'kill' signals, trappable and untrappable, in the systems depending on how they were sent. This is illogical and unclear as there should not be two different signals with the same name which behave differently. It is definitely a bug which should be fixed. I see two (three) different solutions: 1. Make it so that a process which does exit(kill) sends a real, untrappable kill signal to its link set (which then in turn transmit 'killed'). 2. Make it so that a process which does exit(kill) behaves as if it were killed and so transmits 'killed' to its link set. 3. Leave it as it is and create a 'properly_behaving_really_untrappable_kill' signal which behaves sensibly. I think the first option is the best. Robert P.S. Now to copy all this to erlang-bugs. P.P.S. I have just noticed that doing exit(self(), normal) kills me while some other process doing exit(Me, normal) doesn't. Sigh, so normal isn't normal. ----- "Ulf Wiger" wrote: > Process C terminates itself with exit(kill). The atom 'kill' > is not special in this case, but simply a normal exit reason. > > A propagated exit signal can never act as a kill signal in the > first place, but here, not even the original exit is an untrappable > kill. > > Try: > > Eshell V5.8.1 (abort with ^G) > 1> self(). > <0.31.0> > 2> catch exit(kill). > {'EXIT',kill} > 3> self(). > <0.31.0> > > BR, > Ulf W > > On 2 Dec 2010, at 05:37, sky wrote: > > > Hi guys, > > > > In the Joe's book <>, page 163, there are some > description about exit signal : > > > > When an exit signal arrives at a process, then a number of > different > > things might happen. What happens depends upon the state of the > > receiving process and upon the value of the exit signal and is > deter- > > mined by the following table: > > > > > > but when use edemo1:start(true, {die, kill}), the result is: > > > > edemo1:start(true, {die,kill}). > > Process b received {'EXIT',<0.73.0>,kill} > > process b (<0.72.0>) is alive > > process c (<0.73.0>) is dead > > ok > > Why process b is alive? Cause as the descripion in this book, when > the exit signal > > {'EXIT',<0.73.0>,kill} > > arrived, the process b will die and broadcast the exit signal killed > to the link set. > > > > the souce code of edemo1 module as following: > > > > %% --- > > %% Excerpted from "Programming Erlang", > > %% published by The Pragmatic Bookshelf. > > %% Copyrights apply to this code. It may not be used to create > training material, > > %% courses, books, articles, and the like. Contact us if you are in > doubt. > > %% We make no guarantees that this code is fit for any purpose. > > %% Visit http://www.pragmaticprogrammer.com/titles/jaerlang for > more book information. > > %%--- > > > > -module(edemo1). > > -export([start/2]). > > > > start(Bool, M) -> > > A = spawn(fun() -> a() end), > > B = spawn(fun() -> b(A, Bool) end), > > C = spawn(fun() -> c(B, M) end), > > sleep(1000), > > status(b, B), > > status(c, C). > > > > > > a() -> > > process_flag(trap_exit, true), > > wait(a). > > > > b(A, Bool) -> > > process_flag(trap_exit, Bool), > > link(A), > > wait(b). > > > > c(B, M) -> > > link(B), > > case M of > > {die, Reason} -> > > exit(Reason); > > {divide, N} -> > > 1/N, > > wait(c); > > normal -> > > true > > end. > > > > > > > > wait(Prog) -> > > receive > > Any -> > > io:format("Process ~p received ~p~n",[Prog, Any]), > > wait(Prog) > > end. > > > > > > > > sleep(T) -> > > receive > > after T -> true > > end. > > > > status(Name, Pid) -> > > case erlang:is_process_alive(Pid) of > > true -> > > io:format("process ~p (~p) is alive~n", [Name, Pid]); > > false -> > > io:format("process ~p (~p) is dead~n", [Name,Pid]) > > end. > > > > > > Ulf Wiger, CTO, Erlang Solutions, Ltd. > http://erlang-solutions.com From kagato Sun Dec 5 03:50:06 2010 From: kagato (Jayson Vantuyl) Date: Sat, 4 Dec 2010 18:50:06 -0800 Subject: ErlCtl-0.3 Released Message-ID: <0A795C65-8289-405E-9DE8-7C10213AF72C@souja.net> Hey everybody, Just released ErlCtl-0.3. Mostly bugfixes related to working decently in DNS-impared environments, a verbose logging mode to debug networking problems, and some additional error insulation that makes certain errors more useful. Enjoy! Blog: http://bit.ly/eBn630 Github: https://github.com/jvantuyl/erlctl/tree/erlctl-0.3 -- Jayson Vantuyl 417-207-6962 (mobile) kagato From fred.hebert Sun Dec 5 04:02:11 2010 From: fred.hebert (=?iso-8859-1?Q?Fr=E9d=E9ric_Trottier-H=E9bert?=) Date: Sat, 4 Dec 2010 22:02:11 -0500 Subject: [erlang-questions] Some problem abount exit signal? In-Reply-To: <1961267518.160571291512962518.JavaMail.root@zimbra> References: <1961267518.160571291512962518.JavaMail.root@zimbra> Message-ID: -- Fred H?bert http://www.erlang-solutions.com On 2010-12-04, at 20:36 PM, Robert Virding wrote: > Yes, this is how it works, but I definitely consider this to be a bug. To elaborate with a simple example: > > 1> self(). > <0.31.0> > 2> spawn_link(fun () -> exit(kill) end). > ** exception exit: killed > 3> self(). > <0.35.0> > > Here I have received 'kill' signal and died as I should. Now I trap exits: > > 4> process_flag(trap_exit, true). > false > 5> spawn_link(fun () -> exit(kill) end). > <0.39.0> > 6> flush(). > Shell got {'EXIT',<0.39.0>,kill} > ok > > This time I received a trappable 'kill' signal. Finally I explicitly send the 'kill' signal to me: > > 7> Self = self(). > <0.35.0> > 8> process_flag(trap_exit, true). %Just to be explicit > true > 9> spawn_link(fun () -> exit(Self, kill) end). > ** exception exit: killed > 10> self(). > <0.45.0> > > And this time I received an untrappable 'kill' signal. > > This means that there are two different types of 'kill' signals, trappable and untrappable, in the systems depending on how they were sent. This is illogical and unclear as there should not be two different signals with the same name which behave differently. It is definitely a bug which should be fixed. I see two (three) different solutions: > > 1. Make it so that a process which does exit(kill) sends a real, untrappable kill signal to its link set (which then in turn transmit 'killed'). > > 2. Make it so that a process which does exit(kill) behaves as if it were killed and so transmits 'killed' to its link set. > > 3. Leave it as it is and create a 'properly_behaving_really_untrappable_kill' signal which behaves sensibly. > > I think the first option is the best. > > Robert > > P.S. Now to copy all this to erlang-bugs. I'm not sure this can entirely be a bug. See the following: 1> catch exit(hah). {'EXIT',hah} 2> catch exit(self(), hah). ** exception exit: hah In this case, exit/1 is trappable, while exit/2 is not. They already behave differently depending on whether they are 'internal' (exit/1) or 'external' (exit/2). I don't see it as too extravagant to have one kind of kill behaving differently than the other in that context. > > P.P.S. I have just noticed that doing exit(self(), normal) kills me while some other process doing exit(Me, normal) doesn't. Sigh, so normal isn't normal. > That one I would definitely consider a bug though. From mazen.harake Sun Dec 5 08:36:34 2010 From: mazen.harake (Mazen Harake) Date: Sun, 05 Dec 2010 09:36:34 +0200 Subject: [erlang-questions] how to debug memory leaks? In-Reply-To: References: Message-ID: <4CFB4102.4080907@erlang-solutions.com> Even if it is not a direct answer to your question I would like to recommend entop which helps you monitor these things. Check it out here: https://github.com/mazenharake/entop If it has short comings then you can read about how to customize it here: http://mazenharake.wordpress.com/2010/09/15/hacking-entop/ /M On 04/12/2010 12:42, mabrek wrote: > Hello. > > I've got an erlang process that seems to leak memory. It's heap size > increases slowly over time. Are there any tools to examine process > heap content in runtime? > > In Java I can get a heap dump of running JVM and analyze it later with > number of tools. It shows full content of application memory. > > Regards, > Anton Lebedevich. > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > From ulf.wiger Sun Dec 5 11:31:30 2010 From: ulf.wiger (Ulf Wiger) Date: Sun, 5 Dec 2010 11:31:30 +0100 Subject: [erlang-questions] Some problem abount exit signal? In-Reply-To: References: <1961267518.160571291512962518.JavaMail.root@zimbra> Message-ID: On 5 Dec 2010, at 04:02, Fr?d?ric Trottier-H?bert wrote: > > I'm not sure this can entirely be a bug. See the following: > > 1> catch exit(hah). > {'EXIT',hah} > 2> catch exit(self(), hah). > ** exception exit: hah > > In this case, exit/1 is trappable, while exit/2 is not. They already behave differently depending on whether they are 'internal' (exit/1) or 'external' (exit/2). I don't see it as too extravagant to have one kind of kill behaving differently than the other in that context. Bug or not, I think the difference between exit/1 and exit/2 should be documented. Specifically, I guess the interpretation is that the atom 'kill' is _only_ special when used as second argument to exit/2. BR, Ulf W Ulf Wiger, CTO, Erlang Solutions, Ltd. http://erlang-solutions.com From gordon Sun Dec 5 12:32:09 2010 From: gordon (Gordon Guthrie) Date: Sun, 5 Dec 2010 11:32:09 +0000 Subject: [erlang-questions] Re: Dialyzer and throw/catch In-Reply-To: <20101204214110.GA8086@hanele.lan> References: <20101204214110.GA8086@hanele.lan> Message-ID: Jachyem Of course you are right. > success typing is (string()) -> 'ok' and the contract is (Format::string()) I had convinced my self that this was what dialyzer through muin_util:attempt should be returning but on looking at what I pasted in with fresh eyes this morning it is obvious that I am but a fool... > (About time I tried dialyzer more closely, it seems pretty smart ;-) Oh it is. We used to run it as part of our continuous integration - but on one upgrade of Erlang it fell into desuetude. So brining out code back to pristine tip-top form means wading through a lot of dialyser warnings :( Gordon On 4 December 2010 21:41, Jachym Holecek wrote: > # Gordon Guthrie 2010-12-04: > > On further investigation is seems the problem might be with the function > > that is being called. The dialyzer error for it is: > > > > muin_util.erl:227: The call > > error_logger:error_msg({'error',_,[{atom(),atom(),[any()] | byte()}]} | > > {'throw',_,[{atom(),atom(),[any()] | byte()}]}) will never return since > the > > success typing is (string()) -> 'ok' and the contract is > (Format::string()) > > -> 'ok' > > That's right, error_logger:error_msg/1 expects a string argument, but > you're giving it a 3-tuple -- so dialyzer knows that call is going to > explode and correctly concludes muin_util:attempt/3 can only possibly > return {ok, _}. (About time I tried dialyzer more closely, it seems > pretty smart ;-) > > > There is no spec for muin_util:atttempt/3 so I am not sure where this > > 'success typing' is coming from.. > > "Success typing" is the name of the approach dialyzer is using, others > will know more details about it. > > Regards, > -- Jachym > -- Gordon Guthrie CEO hypernumbers http://hypernumbers.com t: hypernumbers +44 7776 251669 From robert.virding Sun Dec 5 18:50:20 2010 From: robert.virding (Robert Virding) Date: Sun, 5 Dec 2010 17:50:20 +0000 (GMT) Subject: [erlang-questions] Some problem abount exit signal? In-Reply-To: <1861830506.160701291571298306.JavaMail.root@zimbra> Message-ID: <42452695.160721291571420413.JavaMail.root@zimbra> ----- "Ulf Wiger" wrote: > On 5 Dec 2010, at 04:02, Fr?d?ric Trottier-H?bert wrote: > > > > > I'm not sure this can entirely be a bug. See the following: > > > > 1> catch exit(hah). > > {'EXIT',hah} > > 2> catch exit(self(), hah). > > ** exception exit: hah > > > > In this case, exit/1 is trappable, while exit/2 is not. They already > behave differently depending on whether they are 'internal' (exit/1) > or 'external' (exit/2). I don't see it as too extravagant to have one > kind of kill behaving differently than the other in that context. > > > Bug or not, I think the difference between exit/1 and exit/2 should be > documented. > > Specifically, I guess the interpretation is that the atom 'kill' is > _only_ > special when used as second argument to exit/2. Originally exit/2 was described as sending a signal to a process *as if* the calling process had died and they were linked. That being the case there should be no difference. It is not described like that in the current documentation. I just find it confusing and illogical that it is significant HOW the signal is sent. It means that actually there are two signals with the same name. I don't know what happens over distribution. Robert -- Robert Virding, Erlang Solutions Ltd. From rvirding Sun Dec 5 19:49:56 2010 From: rvirding (Robert Virding) Date: Sun, 5 Dec 2010 19:49:56 +0100 Subject: [erlang-questions] Some problem abount exit signal? In-Reply-To: References: <1961267518.160571291512962518.JavaMail.root@zimbra> Message-ID: 2010/12/5 Fr?d?ric Trottier-H?bert : > > I'm not sure this can entirely be a bug. See the following: > > 1> catch exit(hah). > {'EXIT',hah} > 2> catch exit(self(), hah). > ** exception exit: hah > > In this case, exit/1 is trappable, while exit/2 is not. They already behave differently depending on whether they are 'internal' (exit/1) or 'external' (exit/2). I don't see it as too extravagant to have one kind of kill behaving differently than the other in that context. That they behave differently here for me who caused it is completely logical, exit/1 terminates me directly while exit/2 sends a signal to myself. That they are caught by different means, try/catch versus trap_exit, is therefore also logical. We had a long discussion about this long ago and decided that they should behave differently. Though I imagine we failed to write anything down about this. :-( Sigh! I was thinking more about the effect I have on *other* processes when I send them a 'kill' signal. The effect depends on *how* I send them signal and not on the signal: if I kill myself with 'kill' it is trappable and affects them as any other non-'normal' signal while if I send it to them with an exit/2 it is untrappable. I think other processes should be affected in the same way if they get a 'kill' signal irrespective of how I sent it to them. Robert From ulf.wiger Sun Dec 5 21:32:42 2010 From: ulf.wiger (Ulf Wiger) Date: Sun, 5 Dec 2010 21:32:42 +0100 Subject: [erlang-questions] Some problem abount exit signal? In-Reply-To: References: <1961267518.160571291512962518.JavaMail.root@zimbra> Message-ID: On 5 Dec 2010, at 19:49, Robert Virding wrote: > I was thinking more about the effect I have on *other* processes when > I send them a 'kill' signal. The effect depends on *how* I send them > signal and not on the signal: if I kill myself with 'kill' it is > trappable and affects them as any other non-'normal' signal while if I > send it to them with an exit/2 it is untrappable. I think other > processes should be affected in the same way if they get a 'kill' > signal irrespective of how I sent it to them. ?but a supervisor must be able to trap an EXIT propagated to it from a process terminated with a kill signal. Otherwise, killing a supervised process in an application supervision tree would inevitably lead to the termination of the whole node. BR, Ulf W Ulf Wiger, CTO, Erlang Solutions, Ltd. http://erlang-solutions.com From ok Mon Dec 6 00:50:41 2010 From: ok (Richard O'Keefe) Date: Mon, 6 Dec 2010 12:50:41 +1300 Subject: [erlang-questions] mailing list "reply to" In-Reply-To: References: <934FA413-459B-482B-80E6-225A67EED2A4@gmail.com> <00ce01cb9198\$2dcd5900\$89680b00\$@com> <20101204014006.GA26216@k2r.org> Message-ID: <4DD74E30-AABB-41D8-B1C8-3B85BDF3A84C@cs.otago.ac.nz> On 4/12/2010, at 4:13 PM, Jesse Gumm wrote: > For me, it makes more sense to mangle the reply-to header since 99% of > the time, I'm replying to the mailing list rather than do the > individual. In that case, Reply All does *everything* you need with no need to harm other people by mangling the Reply-To field. > It makes more sense to me to make the default behavior be > the most common behavior. I see the following buttons: Delete,Junk; Reply,Reply All,Forward; New Message; Note,To Do. There isn't isn't any such animal as default behaviour. If I want a private reply (which I often do), I click on Reply. Mangling Reply-to would BREAK that, as well as violating RFC 2822. If I want a public reply (which I often do), I click on Reply All. *NEITHER* of these is a default. Why do you want to take easy choice away from me? What did I ever do to harm you? From allanwegan Mon Dec 6 02:51:56 2010 From: allanwegan (Allan Wegan) Date: Mon, 06 Dec 2010 02:51:56 +0100 Subject: [erlang-questions] Some problem abount exit signal? In-Reply-To: References: <1961267518.160571291512962518.JavaMail.root@zimbra> Message-ID: <4CFC41BC.6080709@allanwegan.de> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > ?but a supervisor must be able to trap an EXIT propagated to it > from a process terminated with a kill signal. Otherwise, killing a > supervised process in an application supervision tree would > inevitably lead to the termination of the whole node. A possible solution would be to not linking the supervised process to its supervisor. Just monitor it from there and react to the down message. - -- Allan Wegan Jabber: allanwegan ICQ: 209459114 Phone: +49 40 6732962 Sch?neberger Stra?e 60, 22149 Hamburg, Germany -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (MingW32) iQEcBAEBAgAGBQJM/EG8AAoJENm5axHh7AcxHnsH/j6NqXB0Br3MYTLOSKORELvz fmsCR3i9Oh9e4A3wICF5FcAGCY8PYES0s4rdHaEGS+lulTDlD11jTCvW+Oz52tp5 AxM2GUDZLHc9L4Q4En/qhLqZTALNvcZxiWuCgzQCmgPP74AMsszENKIVt2lhz4VV JbkfguyYhejNRzPhAm0Nouoc/qrpOrU1wyANsJeXPEWlAXsZdLZ9xC0wzG0brTfo E17/IhF/O8eE6G2B0EfDoo2k56XDdiVMZ9EJZUelI7bFtzJtikY9rauh2vDpBDAw jA2D4gVmdwsanlG1tJTpmQxJMxR4HkW0v79A54coQ9tJg4jYdDF/i5vCvJYriLU= =YIrl -----END PGP SIGNATURE----- From kostis Mon Dec 6 08:56:43 2010 From: kostis (Kostis Sagonas) Date: Mon, 06 Dec 2010 09:56:43 +0200 Subject: [erlang-questions] Re: Dialyzer and throw/catch In-Reply-To: References: <20101204214110.GA8086@hanele.lan> Message-ID: <4CFC973B.1020203@cs.ntua.gr> Gordon Guthrie wrote: > Jachyem > > Of course you are right. > >> success typing is (string()) -> 'ok' and the contract is > (Format::string()) > > I had convinced my self that this was what dialyzer through > muin_util:attempt should be returning but on looking at what I pasted in > with fresh eyes this morning it is obvious that I am but a fool... > >> (About time I tried dialyzer more closely, it seems > pretty smart ;-) > > Oh it is. We used to run it as part of our continuous integration - but on > one upgrade of Erlang it fell into desuetude. So brining out code back to > pristine tip-top form means wading through a lot of dialyser warnings :( Yes. As you see, dialyzer is not only smart but is also quite sensitive! If it ever feels neglected for too long, it has a very effective way of letting you know that you should never do that again ;-) Cheers, Kostis From mk Mon Dec 6 09:08:04 2010 From: mk (Morten Krogh) Date: Mon, 6 Dec 2010 09:08:04 +0100 Subject: [erlang-questions] mailing list "reply to" Message-ID: Hi No standards are broken if the list is a robot, that receives mail and ,based on some logic, takes an action. Any member of the list just gets a mail from the list robot, never from an individual member. "Reply to" can then obviously only go to the list. The list should be seen as a robot with an email address, not as a relay or an alias. The robot could then perform arbitrarily complex logic. For instance if I wanted all mails in the thread " mailing list "reply to" " I could send the robot an email with "search" or "filter" in the subject line and a body which could be an erlang expression. In this case thread == "maling list \"reply to\"" A more complicated example could involve dates, authors, and even regular expressions on the content. You want to find all posts about the function ets:delete in the last year. Just send the robot a mail. The robot could rather easily handle all of this. The only loss by having the list be a robort with an email address instead of an alias to all members is that you will never see the private email addresses of the others. But that is not only bad. A list is not made to make it easy to send private mails, but instead to encourage sharing knowledge. Also, empricially we can say that it doesn't work well today because too many MUAs don't do it right. I often get two copies of the mails right after I post myself indicating that lots of members of this list have MUAs without a "reply to list" button, bit only a reply-all that duplicates the mails to the previous sender. We also often see interrupted threads where you can deduce that we missed a part of the conversation. That is presumably because people just hit reply-to. I agree that munging is bad, but that is something else. Cheers, Morten. From raimo+erlang-questions Mon Dec 6 11:59:13 2010 From: raimo+erlang-questions (Raimo Niskanen) Date: Mon, 6 Dec 2010 11:59:13 +0100 Subject: [erlang-questions] mailing list "reply to" In-Reply-To: References: <934FA413-459B-482B-80E6-225A67EED2A4@gmail.com> <00ce01cb9198\$2dcd5900\$89680b00\$@com> <20101204014006.GA26216@k2r.org> Message-ID: <20101206105913.GA9859@erix.ericsson.se> On Fri, Dec 03, 2010 at 09:13:11PM -0600, Jesse Gumm wrote: > For me, it makes more sense to mangle the reply-to header since 99% of > the time, I'm replying to the mailing list rather than do the > individual. It makes more sense to me to make the default behavior be > the most common behavior. I view a mailing list as just another way > of implementing an online forum, and in that regard, the default > action is to reply to the thread, rather than via PM. > > If I'm in the minority, and most people actually do private replies > more frequently than public ones, then that makes sense why it's the > default, preferred way. > > -Jesse > Hi. I am currently the list maintainer of all mailing lists @erlang.org, and have been so for some years now. This discussion surfaces a few times per year and it always homes in on the same conclusion: Changing the setting of not munging the Reply-To: header would cause more harm to many enough users to not motivate the benefit other users would get. And of course break existing standards and practices for _mailing lists_. Read the article supplied below by Kenji Rikitake: http://woozle.org/~neale/papers/reply-to-still-harmful.html and why not the old debate referenced by that article: http://www.unicom.com/pw/reply-to-harmful.html http://www.metasystema.net/essays/reply-to.mhtml Here is the summary from the freshest article: Summary Some people want to munge Reply-To header fields. They believe it makes reply-to-list easier, and it encourages more list traffic. It really does neither, and not only is it a poor idea but it's forbidden by Internet standards. The IETF has spoken, and if you violate their standard and munge your Reply-To header fields you're just creating problems for everybody. I still see no new reasons to change the current standarized behaviour. / Raimo Niskanen > On Fri, Dec 3, 2010 at 8:16 PM, Alain O'Dea wrote: > > I love how this topic resurfaces perennially. ?I tried to apply the Reply is > > private Reply All goes to Group to a Google Group I created for my > > graduating class. ?They flipped out and I reversed it. ?Young people these > > days ;) > > > > On Fri, Dec 3, 2010 at 10:10 PM, Kenji Rikitake wrote: > > > >> A reference to the history of Reply-To: header handling: > >> http://woozle.org/~neale/papers/reply-to-still-harmful.html > >> > >> FYI > >> Kenji Rikitake > >> > >> ________________________________________________________________ > >> erlang-questions (at) erlang.org mailing list. > >> See http://www.erlang.org/faq.html > >> To unsubscribe; mailto:erlang-questions-unsubscribe > >> > >> > > > > > > -- > Jesse Gumm > Sigma Star Systems > 414.940.4866 > gumm > http://www.sigma-star.com > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From ebegumisa Mon Dec 6 12:02:53 2010 From: ebegumisa (Edmond Begumisa) Date: Mon, 06 Dec 2010 22:02:53 +1100 Subject: [erlang-questions] Erlounge Melbourne - Sat 4/12 In-Reply-To: <001801cb92f9\$5cb21dc0\$16165940\$@com> References: <4CF48EAF.5070304@infinite-interactive.com> <201011302000.33706.als@iinet.net.au> <4CF840CF.4000909@infinite-interactive.com> <001801cb92f9\$5cb21dc0\$16165940\$@com> Message-ID: It's interesting (or rather sad) that nobody had trouble identifying the group! Apparently, a table of people discussing concurrency, fault-tolerance and scalable databases in a bar on a Saturday night isn't that difficult to identify :( On a serious note, the Erlounge was great. I met a lot of interesting people with interesting ideas and experiences. Nik, we should take up Francesco's suggestion on creating that mailing list. Thank you Francesco and Julian for the excellent tutorial. - Edmond - On Sat, 04 Dec 2010 01:49:58 +1100, David Mercer wrote: > On Thursday, December 02, 2010, Nikolas Bowe wrote: > >> If you want a description of what I look like, Ive got long (shoulder >> length) brown hair. >> Long hair is pretty rare for guys these days, so I doubt you will have >> trouble picking me out. > > Since Erlang is Swedish, I suppose I always imagined the prototypical > Erlanger as looking like Bjorn from ABBA. He had shoulder-length brown > hair, like you, so I guess my imagination isn't too far from the truth. > :-) > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ From ebegumisa Mon Dec 6 12:13:46 2010 From: ebegumisa (Edmond Begumisa) Date: Mon, 06 Dec 2010 22:13:46 +1100 Subject: [erlang-questions] Erlounge Melbourne - Sat 4/12 In-Reply-To: References: <4CF48EAF.5070304@infinite-interactive.com> <201011302000.33706.als@iinet.net.au> <4CF840CF.4000909@infinite-interactive.com> <001801cb92f9\$5cb21dc0\$16165940\$@com> Message-ID: Thanks also to Justin & Co for taking time out to drop by and answer all our questions. Personally, it's always encouraging to meet someone running a startup that's actually making money :) - Edmond - On Mon, 06 Dec 2010 22:02:53 +1100, Edmond Begumisa wrote: > It's interesting (or rather sad) that nobody had trouble identifying the > group! Apparently, a table of people discussing concurrency, > fault-tolerance and scalable databases in a bar on a Saturday night > isn't that difficult to identify :( > > On a serious note, the Erlounge was great. I met a lot of interesting > people with interesting ideas and experiences. Nik, we should take up > Francesco's suggestion on creating that mailing list. > > Thank you Francesco and Julian for the excellent tutorial. > > - Edmond - > > > On Sat, 04 Dec 2010 01:49:58 +1100, David Mercer > wrote: > >> On Thursday, December 02, 2010, Nikolas Bowe wrote: >> >>> If you want a description of what I look like, Ive got long (shoulder >>> length) brown hair. >>> Long hair is pretty rare for guys these days, so I doubt you will have >>> trouble picking me out. >> >> Since Erlang is Swedish, I suppose I always imagined the prototypical >> Erlanger as looking like Bjorn from ABBA. He had shoulder-length brown >> hair, like you, so I guess my imagination isn't too far from the truth. >> :-) >> >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe >> > > -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ From allanwegan Mon Dec 6 12:18:34 2010 From: allanwegan (Allan Wegan) Date: Mon, 06 Dec 2010 12:18:34 +0100 Subject: [erlang-questions] mailing list "reply to" In-Reply-To: References: Message-ID: <4CFCC68A.4010102@allanwegan.de> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > The list should be seen as a robot with an email address, not as a relay or an alias. Every server is in fact sort of a robot. That includes regular mail servers. > Also, empricially we can say that it doesn't work well today because too many MUAs don't do it right. I often get two copies of the mails right after I post myself indicating that lots of members of this list have > MUAs without a "reply to list" button, bit only a reply-all that duplicates the mails to the previous sender. > > We also often see interrupted threads where you can deduce that we missed a part of the conversation. That is presumably because people just hit reply-to. Much worse are the people using email clients that do not send proper in-reply-to headers and therefore break the tree view for users using more advanced clients! > I agree that munging is bad, but that is something else. I agree that munging is bad. - -- Allan Wegan Jabber: allanwegan ICQ: 209459114 Phone: +49 40 6732962 Sch?neberger Stra?e 60, 22149 Hamburg, Germany -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (MingW32) iQEcBAEBAgAGBQJM/MaKAAoJENm5axHh7AcxXlgIALl41wJbfFna0O+mH44MDhvQ g7RyRlF1MVot0cIXPZls/EMnoTme0EwMn1LODtSxun1MzvhOvBUgsqMRigwyevBk Jbp9eFPQ2Fhbo2/55iDPjxP8nm1n2S28chRdtbArI5wUo2mr22UstrVXoKGSFJcS ZokbeTPu1co064P1poqBn7OX3oMcgLqJssQxaKSwt1uqFZBzX3fEcXGJh1WIEqEE oQtZl3QroYhO50tfuiUW/FLnivSYfhNPKy6ygKsXZY4jVxCaMUgmTyoYBnkSAeBg QlcgOBGAR4fAyj3NjSIcdHMOAbDPKRafmCM/HFYC8QvpGc/3zUSPs0pauhKccZ8= =HDRY -----END PGP SIGNATURE----- From mk Mon Dec 6 12:52:16 2010 From: mk (Morten Krogh) Date: Mon, 06 Dec 2010 12:52:16 +0100 Subject: [erlang-questions] mailing list "reply to" In-Reply-To: <4CFCC68A.4010102@allanwegan.de> References: <4CFCC68A.4010102@allanwegan.de> Message-ID: <4CFCCE70.2040802@amberbio.com> Hi Sure, you can call a mail server a robot. Let me rephrase it. The mailing list can either be seen as an alias or as an entity (robot, person?) with an email address. The mail serves themselves are just glue for now, like ip routers etc. Suppose A sends a mail to the list and B gets the mail. Did B then get an email from A or from the list? It makes a lot of sense to claim that the mail came from the list. See the list as a person that forwards mails if you want to. Then reply-to should go to the list. Internet standards do not exclude any of these uses. Of course, we are allowed to let all communication go through the "person" "list", who then forwards it. That is not munging, it is just an email from "list", the person "list". There are two perspectives. 1. We all receive a lot of private mails sent to a lot of people. 2. We all communicate with one robot, and each of us should only see the mail address of the robot and nothing more. Private mail addresses can be included somewhere if necessary, but they are a side show. 1. makes private replies easy. 2. makes list replies easy. I think 2 is preferable. I think the argument of sending private mails is very weak. It is people, who want to send privately, that should go out of their way. Cheers, Morten. On 12/6/10 12:18 PM, Allan Wegan wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > >> The list should be seen as a robot with an email address, not as a > relay or an alias. > > Every server is in fact sort of a robot. That includes regular mail servers. > > >> Also, empricially we can say that it doesn't work well today because > too many MUAs don't do it right. I often get two copies of the mails > right after I post myself indicating that lots of members of this list have >> MUAs without a "reply to list" button, bit only a reply-all that > duplicates the mails to the previous sender. >> We also often see interrupted threads where you can deduce that we > missed a part of the conversation. That is presumably because people > just hit reply-to. > > Much worse are the people using email clients that do not send proper > in-reply-to headers and therefore break the tree view for users using > more advanced clients! > > >> I agree that munging is bad, but that is something else. > I agree that munging is bad. > > > > - -- > Allan Wegan > Jabber: allanwegan > ICQ: 209459114 > Phone: +49 40 6732962 > Sch?neberger Stra?e 60, 22149 Hamburg, Germany > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2.0.14 (MingW32) > > iQEcBAEBAgAGBQJM/MaKAAoJENm5axHh7AcxXlgIALl41wJbfFna0O+mH44MDhvQ > g7RyRlF1MVot0cIXPZls/EMnoTme0EwMn1LODtSxun1MzvhOvBUgsqMRigwyevBk > Jbp9eFPQ2Fhbo2/55iDPjxP8nm1n2S28chRdtbArI5wUo2mr22UstrVXoKGSFJcS > ZokbeTPu1co064P1poqBn7OX3oMcgLqJssQxaKSwt1uqFZBzX3fEcXGJh1WIEqEE > oQtZl3QroYhO50tfuiUW/FLnivSYfhNPKy6ygKsXZY4jVxCaMUgmTyoYBnkSAeBg > QlcgOBGAR4fAyj3NjSIcdHMOAbDPKRafmCM/HFYC8QvpGc/3zUSPs0pauhKccZ8= > =HDRY > -----END PGP SIGNATURE----- > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > From matthias Mon Dec 6 14:11:03 2010 From: matthias (Matthias Lang) Date: Mon, 6 Dec 2010 14:11:03 +0100 Subject: [erlang-questions] Implementation of ports In-Reply-To: <4CF5A284.9030803@eonblast.com> References: <4CF5A284.9030803@eonblast.com> Message-ID: <20101206131103.GA26557@corelatus.se> On Wednesday, December 01, Henning Diedrich wrote: > Hi all, > > are ports implemented using sockets underneath? No. > Are messages being sent between [erlang] processes usually use sockets? No. Distributed Erlang usually uses sockets, though. Matt From B.Candler Mon Dec 6 14:57:47 2010 From: B.Candler (Brian Candler) Date: Mon, 6 Dec 2010 13:57:47 +0000 Subject: Small macro doco bug? Message-ID: <20101206135747.GA7161@talktalkplc.com> [I'm not sure whether documentation corrections should go to erlang-bugs or not - so I'm sending it here for now] At http://www.erlang.org/doc/reference_manual/macros.html ---------------------------------------------------------------------------- Example: -define(TESTCALL(Call), io:format("Call ~s: ~w~n", [??Call, Call])). ?TESTCALL(myfunction(1,2)), ?TESTCALL(you:function(2,1)). results in io:format("Call ~s: ~w~n",["myfunction ( 1 , 2 )",m:myfunction(1,2)]), io:format("Call ~s: ~w~n",["you : function ( 2 , 1 )",you:function(2,1)]). ---------------------------------------------------------------------------- I think the "m:" is spurious in front of myfunction(1,2). I have tested this using erl_pp to convert the abstract form back to erlang, and I get: testfunc() -> io:format("Call ~s: ~w~n", ["myfunction ( 1 , 2 )",myfunction(1, 2)]), io:format("Call ~s: ~w~n", ["you : function ( 2 , 1 )",you:function(2, 1)]). Regards, Brian. From B.Candler Mon Dec 6 14:23:15 2010 From: B.Candler (Brian Candler) Date: Mon, 6 Dec 2010 13:23:15 +0000 Subject: [erlang-questions] Re: Getting line number in backtrace? In-Reply-To: <37559.1291400864@snookles.snookles.com> References: <37559.1291400864@snookles.snookles.com> Message-ID: <20101206132315.GA6339@talktalkplc.com> On Fri, Dec 03, 2010 at 12:27:44PM -0600, Scott Lystig Fritchie wrote: > I'm a smart_exceptions fan. IIRC I just removed that guard: > > [...] > mapform0(F, C) -> > C. I see git has been updated to remove that guard. Now it compiles fine, and also tells me the line number of the error, yay :-) \$ erlc -pa . +debug_info +'{parse_transform, smart_exceptions}' my_test.erl \$ erl +Bc Erlang R13B03 (erts-5.7.4) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.7.4 (abort with ^G) 1> my_test:go(). {foo,bar}** exception exit: {{my_test,dostuff,1},{line,10},match,[{foo,bar}]} in function my_test:dostuff/1 in call from my_test:go/0 It doesn't give me the line numbers of the outer calls, but it's definitely an improvement. (And yes, I realise that tail calls won't appear in the backtrace at all; I'm fine with that) Cheers, Brian. From francisstephens Mon Dec 6 15:31:02 2010 From: francisstephens (Francis Stephens) Date: Mon, 6 Dec 2010 14:31:02 +0000 Subject: Jinterface hanging on send Message-ID: I have a number of Jinterface nodes running on separate JVMs. With fair regularity () they are blocking on calls to OtpMbox.send(OtpPid,OtpErlangObject). Debugging has shown that each of them is blocking on a call to SocketInputStream.read(byte, int, int). It often appears that the hanging processes are trying to send a message to each other at the same time. Often killing one of the JVMs that is blocked on a send will release the other one. I am running Erlang version 5.8.1.1 with jinterface 1.5.3.1 running on windows. Has anyone seen this behaviour before? Is it expected behaviour, I was expecting to be able to run several communicating JVMs concurrently. Right-ho, off to read up on socket programming. From paolo.negri Mon Dec 6 16:00:32 2010 From: paolo.negri (Paolo Negri) Date: Mon, 6 Dec 2010 16:00:32 +0100 Subject: [Job] Social games server engineer - Berlin Message-ID: Hi Everyone, Wooga is a European startup based in Berlin operating in the social game business, since when the company launched the growth has been very strong and steady, we're looking to build up our technical team. We currently have 2 published games with more than one million daily users each and we're working hard to launch a few more. Our competitors are big American companies like Zynga, Playdom, or Playfish. We have very interesting technical challenges to solve, some numbers from our live systems are 5 millions SQL + NoSQL queries per minute, 5000 http requests per second and a read/write balance close to 50/50. We're looking for backend engineers to help build our actor based server, you'll be working on the team pioneering erlang in the company so you must feel comfortable explaining others what you're doing. Specifically we're looking for someone who already has experience in building from the ground up OTP applications and has previous experience in running distributed erlang systems. Each game is made in a small multidisciplinary team with typically 2 to 3 backend developers, we have a strict no nonsense policy, we believe in good test coverage and we have the freedom to decide how to host, deploy and operate our systems. We are currently evaluating candidates for both contracting or permanent positions, telecommute is not an option so you'll need to work in our nice office in the city center of Berlin. Check us out on http://www.wooga.com and send your application either directly to me paolo.negri or follow the instructions on http://www.wooga.com/jobs Kind Regards Paolo Negri -- Engineering http://www.wooga.com | phone +49-30-8962 5058? | fax +49-30-8964 9064 wooga GmbH | Saarbruecker Str. 38 | 10405 Berlin | Germany Sitz der Gesellschaft: Berlin; HRB 117846 B Registergericht Berlin-Charlottenburg Geschaeftsfuehrung: Jens Begemann, Philipp Moeser From alain.odea Mon Dec 6 16:44:50 2010 From: alain.odea (Alain O'Dea) Date: Mon, 6 Dec 2010 12:14:50 -0330 Subject: [erlang-questions] Jinterface hanging on send In-Reply-To: References: Message-ID: On Monday, December 6, 2010, Francis Stephens wrote: > I have a number of Jinterface nodes running on separate JVMs. ?With fair > regularity () they are blocking on calls to > OtpMbox.send(OtpPid,OtpErlangObject). > > > Debugging has shown that each of them is blocking on a call to > SocketInputStream.read(byte, int, int). I'm trying to imagine why OtpMbox.send(OtpPid,OtpErlangObject) would ever need to read a socket. Perhaps it needs to consult EPMB to find where lookup the receiver for the OtpPid you are sending to. Interesting problem. I have been considering Java/Erlang interop for several years on and off. I am very I interested to learn the cause of the problem you are seeing and how to solve it. > > > It often appears that the hanging processes are trying to send a message to > each other at the same time. ?Often killing one of the JVMs that is blocked > on a send will release the other one. > > > I am running Erlang version 5.8.1.1 with jinterface 1.5.3.1 running on > windows. > > > Has anyone seen this behaviour before? ?Is it expected behaviour, I was > expecting to be able to run several communicating JVMs concurrently. > Right-ho, off to read up on socket programming. > From alexey.v.romanov Mon Dec 6 17:13:41 2010 From: alexey.v.romanov (Alexey Romanov) Date: Mon, 6 Dec 2010 19:13:41 +0300 Subject: Should erl_ddll:load/2 return 'ok' when loading a permanent driver? Message-ID: The documentation says: > If more than one process tries to load an already loaded driver withe the same Path, or if the same process tries to load it several times, the function will return ok. The emulator will keep track of the load/2 calls, so that a corresponding number of unload/2 calls will have to be done from the same process before the driver will actually get unloaded. It is therefore safe for an application to load a driver that is shared between processes or applications when needed. However, if a _permanent_ driver is already loaded, this doesn't happen; instead {error, permanent} is returned. If trying to use the function as documented, I shouldn't even pattern match on it in this way: case erl_ddll:load(PrivDir, atom_to_list(?DRIVER_NAME)) of ok -> Port = open_port({spawn, create_port_cmd(DbFile)}, [binary]), {ok, #state{port = Port, ops = Options}}; {error, permanent} -> %% already loaded! Port = open_port({spawn, create_port_cmd(DbFile)}, [binary]), {ok, #state{port = Port, ops = Options}}; {error, Error} -> Msg = io_lib:format("Error loading ~p: ~s", [?DRIVER_NAME, erl_ddll:format_error(Error)]), {stop, lists:flatten(Msg)} end. because > On failure, the return value is {error,ErrorDesc}, where ErrorDesc is an opaque term to be translated into human readable form by the format_error/1 function. What is the correct thing to do here? The driver can't be made non-permanent because of http://www.erlang.org/pipermail/erlang-questions/2008-April/034168.html Should either documentation or behavior of OTP be changed? Yours, Alexey Romanov From matthias Mon Dec 6 23:58:08 2010 From: matthias (Matthias Lang) Date: Mon, 6 Dec 2010 23:58:08 +0100 Subject: how do I do the equivalent of ets:tab2list(timer_tab) for BIF timers In-Reply-To: <20101123070909.GA2263@corelatus.se> References: <20101123070909.GA2263@corelatus.se> Message-ID: <20101206225808.GA22459@corelatus.se> Hi, In short: A bug in the linux kernel on Au1000 MIPS CPUs causes Erlang's timers and timeouts to go haywire, sometimes. Most likely, nobody but me is affected. Erlang is not the problem. Longer version follows as a reply to my own post. It's only of interest to the curious. On Tuesday, November 23, Matthias Lang wrote: > How can I see a list of timers started by erlang:send_after/3 and > 'receive ... after' constructs? > > The timer module "lets" me peek at timers fairly easily, but that only > works for timers started through the timer module, i.e.: Answer: "recompile with debug enabled and call p_slpq()". Michal Zajda suggested looking at the "nbif_timer" parameter in the binary returned by erlang:system_info(info). That doesn't do what I want, the "bif_timer" parameter only tells me how much memory is allocated for timers, nothing more. Erlang "bif timers", i.e. 'receive...after' timers and 'erlang:send_after' timers, are stored in a structure controlled by erts/emulator/beam/time.c. The debug-only function 'p_slpq()' does roughly what I wanted. The actual problem I was chasing was caused by calls to clock_gettime(CLOCK_MONOTONIC, &ts) and gettimeofday() sometimes, rarely, jumping several days into the future, only to jump back again. This makes Erlang's timers go haywire, e.g. a 5s timeout suddenly becomes a multi-day timeout, which makes any Erlang processes waiting for a timeout seem frozen. The root cause was a concurrency/locking problem: a missing lock in an interrupt routine which meant that a call to clock_gettime() at the "wrong" moment could read junk. Matt From robert.virding Tue Dec 7 00:23:22 2010 From: robert.virding (Robert Virding) Date: Mon, 6 Dec 2010 23:23:22 +0000 (GMT) Subject: [erlang-questions] Some problem abount exit signal? In-Reply-To: <1896576145.166691291677673408.JavaMail.root@zimbra> Message-ID: <101110366.166711291677802290.JavaMail.root@zimbra> ----- "Ulf Wiger" wrote: > On 5 Dec 2010, at 19:49, Robert Virding wrote: > > > I was thinking more about the effect I have on *other* processes > when > > I send them a 'kill' signal. The effect depends on *how* I send > them > > signal and not on the signal: if I kill myself with 'kill' it is > > trappable and affects them as any other non-'normal' signal while if > I > > send it to them with an exit/2 it is untrappable. I think other > > processes should be affected in the same way if they get a 'kill' > > signal irrespective of how I sent it to them. > > ?but a supervisor must be able to trap an EXIT propagated to it > from a process terminated with a kill signal. Otherwise, killing a > supervised process in an application supervision tree would > inevitably lead to the termination of the whole node. I am not saying that a process who gets killed with a 'kill' signal should resignal 'kill', that would never work. I should signal 'killed' as it does now. All I am saying is that when a process *receives* a 'kill' signal there should be only ONE behaviour, it should untrappably die and signal 'killed' to its link set. Now it may or may not be able to trap the signal depending on how it was generated. In effect, there are two different signals with the same name. Robert -- Robert Virding, Erlang Solutions Ltd. From nbowe Tue Dec 7 04:26:49 2010 From: nbowe (Nikolas Bowe) Date: Tue, 07 Dec 2010 14:26:49 +1100 Subject: [erlang-questions] Erlounge Melbourne - Sat 4/12 In-Reply-To: References: <4CF48EAF.5070304@infinite-interactive.com> <201011302000.33706.als@iinet.net.au> <4CF840CF.4000909@infinite-interactive.com> <001801cb92f9\$5cb21dc0\$16165940\$@com> Message-ID: <4CFDA979.3080405@infinite-interactive.com> Thanks to everyone that came. Its always good to see the different approaches people take on different software. Thanks especially to Justin and Kresten. Justin; your enthusiasm is contagious. A lot of the attendees (especially the ones that arent actively using Erlang) mentioned how impressed they were. Who knows... maybe soon we will see a bunch of startups springing up following the basho model. ha @ david's comment. Im afraid I cannot sing though. Anytime I try to imagine what a stereotypical hacker for a certain language looks like I meet someone that blows my idea out of the water. Edmond, we will definitely need to do that. Ill send you an email off list later about it. Cheers Nikolas Bowe On 12/6/2010 10:13 PM, Edmond Begumisa wrote: > Thanks also to Justin & Co for taking time out to drop by and answer > all our questions. Personally, it's always encouraging to meet someone > running a startup that's actually making money :) > > - Edmond - > > > On Mon, 06 Dec 2010 22:02:53 +1100, Edmond Begumisa > wrote: > >> It's interesting (or rather sad) that nobody had trouble identifying >> the group! Apparently, a table of people discussing concurrency, >> fault-tolerance and scalable databases in a bar on a Saturday night >> isn't that difficult to identify :( >> >> On a serious note, the Erlounge was great. I met a lot of interesting >> people with interesting ideas and experiences. Nik, we should take up >> Francesco's suggestion on creating that mailing list. >> >> Thank you Francesco and Julian for the excellent tutorial. >> >> - Edmond - >> >> >> On Sat, 04 Dec 2010 01:49:58 +1100, David Mercer >> wrote: >> >>> On Thursday, December 02, 2010, Nikolas Bowe wrote: >>> >>>> If you want a description of what I look like, Ive got long (shoulder >>>> length) brown hair. >>>> Long hair is pretty rare for guys these days, so I doubt you will have >>>> trouble picking me out. >>> >>> Since Erlang is Swedish, I suppose I always imagined the prototypical >>> Erlanger as looking like Bjorn from ABBA. He had shoulder-length brown >>> hair, like you, so I guess my imagination isn't too far from the >>> truth. :-) >>> >>> >>> ________________________________________________________________ >>> erlang-questions (at) erlang.org mailing list. >>> See http://www.erlang.org/faq.html >>> To unsubscribe; mailto:erlang-questions-unsubscribe >>> >> >> > > This message and its attachments may contain legally privileged or confidential information. This message is intended for the use of the individual or entity to which it is addressed. If you are not the addressee indicated in this message, or the employee or agent responsible for delivering the message to the intended recipient, you may not copy or deliver this message or its attachments to anyone. Rather, you should permanently delete this message and its attachments and kindly notify the sender by reply e-mail. Any content of this message and its attachments, which does not relate to the official business of the sending company must be taken not to have been sent or endorsed by the sending company or any of its related entities. No warranty is made that the e-mail or attachment(s) are free from computer virus or other defect. From josh Tue Dec 7 04:33:13 2010 From: josh (Josh Johnston) Date: Tue, 7 Dec 2010 14:33:13 +1100 Subject: [erlang-questions] Erlounge Melbourne - Sat 4/12 In-Reply-To: <4CFDA979.3080405@infinite-interactive.com> References: <4CF48EAF.5070304@infinite-interactive.com> <201011302000.33706.als@iinet.net.au> <4CF840CF.4000909@infinite-interactive.com> <001801cb92f9\$5cb21dc0\$16165940\$@com> <4CFDA979.3080405@infinite-interactive.com> Message-ID: <0FA0DB78-CA08-4DC4-A2B9-7DAB6D973AB7@x-team.com> Hi all, I wasn't able to make it to the meetup but definitely interested in erlang-happenings around Melbourne. I don't know what this mailing list is that you mention but now I'm intrigued :) Josh. On 07/12/2010, at 2:26 PM, Nikolas Bowe wrote: > Thanks to everyone that came. > Its always good to see the different approaches people take on different software. > Thanks especially to Justin and Kresten. > Justin; your enthusiasm is contagious. A lot of the attendees (especially the ones that arent actively using Erlang) mentioned how impressed they were. > Who knows... maybe soon we will see a bunch of startups springing up following the basho model. > > ha @ david's comment. Im afraid I cannot sing though. > Anytime I try to imagine what a stereotypical hacker for a certain language looks like I meet someone that blows my idea out of the water. > > Edmond, we will definitely need to do that. Ill send you an email off list later about it. > > Cheers > Nikolas Bowe > > > > On 12/6/2010 10:13 PM, Edmond Begumisa wrote: >> Thanks also to Justin & Co for taking time out to drop by and answer all our questions. Personally, it's always encouraging to meet someone running a startup that's actually making money :) >> >> - Edmond - >> >> >> On Mon, 06 Dec 2010 22:02:53 +1100, Edmond Begumisa wrote: >> >>> It's interesting (or rather sad) that nobody had trouble identifying the group! Apparently, a table of people discussing concurrency, fault-tolerance and scalable databases in a bar on a Saturday night isn't that difficult to identify :( >>> >>> On a serious note, the Erlounge was great. I met a lot of interesting people with interesting ideas and experiences. Nik, we should take up Francesco's suggestion on creating that mailing list. >>> >>> Thank you Francesco and Julian for the excellent tutorial. >>> >>> - Edmond - >>> >>> >>> On Sat, 04 Dec 2010 01:49:58 +1100, David Mercer wrote: >>> >>>> On Thursday, December 02, 2010, Nikolas Bowe wrote: >>>> >>>>> If you want a description of what I look like, Ive got long (shoulder >>>>> length) brown hair. >>>>> Long hair is pretty rare for guys these days, so I doubt you will have >>>>> trouble picking me out. >>>> >>>> Since Erlang is Swedish, I suppose I always imagined the prototypical >>>> Erlanger as looking like Bjorn from ABBA. He had shoulder-length brown >>>> hair, like you, so I guess my imagination isn't too far from the truth. :-) >>>> >>>> >>>> ________________________________________________________________ >>>> erlang-questions (at) erlang.org mailing list. >>>> See http://www.erlang.org/faq.html >>>> To unsubscribe; mailto:erlang-questions-unsubscribe >>>> >>> >>> >> >> > > > This message and its attachments may contain legally privileged or confidential information. This message is intended for the use of the individual or entity to which it is addressed. If you are not the addressee indicated in this message, or the employee or agent responsible for delivering the message to the intended recipient, you may not copy or deliver this message or its attachments to anyone. Rather, you should permanently delete this message and its attachments and kindly notify the sender by reply e-mail. Any content of this message and its attachments, which does not relate to the official business of the sending company must be taken not to have been sent or endorsed by the sending company or any of its related entities. No warranty is made that the e-mail or attachment(s) are free from computer virus or other defect. > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > From julian.doherty.ml Tue Dec 7 05:14:07 2010 From: julian.doherty.ml (Julian Doherty) Date: Tue, 7 Dec 2010 15:14:07 +1100 Subject: [erlang-questions] Erlounge Melbourne - Sat 4/12 In-Reply-To: <0FA0DB78-CA08-4DC4-A2B9-7DAB6D973AB7@x-team.com> References: <4CF48EAF.5070304@infinite-interactive.com> <201011302000.33706.als@iinet.net.au> <4CF840CF.4000909@infinite-interactive.com> <001801cb92f9\$5cb21dc0\$16165940\$@com> <4CFDA979.3080405@infinite-interactive.com> <0FA0DB78-CA08-4DC4-A2B9-7DAB6D973AB7@x-team.com> Message-ID: Wanted to attend on Saturday night, but is tricky with a 2-month old (especially after having a few drinks after YOW most nights during the week ;) Would definitely be keen to attend any future Erlounge meetups. Was great having everyone at LP during the day for the tut session with Francesco as well. Cheers Julian On 7 December 2010 14:33, Josh Johnston wrote: > Hi all, I wasn't able to make it to the meetup but definitely interested in > erlang-happenings around Melbourne. I don't know what this mailing list is > that you mention but now I'm intrigued :) > > Josh. > > On 07/12/2010, at 2:26 PM, Nikolas Bowe wrote: > > > Thanks to everyone that came. > > Its always good to see the different approaches people take on different > software. > > Thanks especially to Justin and Kresten. > > Justin; your enthusiasm is contagious. A lot of the attendees (especially > the ones that arent actively using Erlang) mentioned how impressed they > were. > > Who knows... maybe soon we will see a bunch of startups springing up > following the basho model. > > > > ha @ david's comment. Im afraid I cannot sing though. > > Anytime I try to imagine what a stereotypical hacker for a certain > language looks like I meet someone that blows my idea out of the water. > > > > Edmond, we will definitely need to do that. Ill send you an email off > list later about it. > > > > Cheers > > Nikolas Bowe > > > > > > > > On 12/6/2010 10:13 PM, Edmond Begumisa wrote: > >> Thanks also to Justin & Co for taking time out to drop by and answer all > our questions. Personally, it's always encouraging to meet someone running a > startup that's actually making money :) > >> > >> - Edmond - > >> > >> > >> On Mon, 06 Dec 2010 22:02:53 +1100, Edmond Begumisa < > ebegumisa> wrote: > >> > >>> It's interesting (or rather sad) that nobody had trouble identifying > the group! Apparently, a table of people discussing concurrency, > fault-tolerance and scalable databases in a bar on a Saturday night isn't > that difficult to identify :( > >>> > >>> On a serious note, the Erlounge was great. I met a lot of interesting > people with interesting ideas and experiences. Nik, we should take up > Francesco's suggestion on creating that mailing list. > >>> > >>> Thank you Francesco and Julian for the excellent tutorial. > >>> > >>> - Edmond - > >>> > >>> > >>> On Sat, 04 Dec 2010 01:49:58 +1100, David Mercer > wrote: > >>> > >>>> On Thursday, December 02, 2010, Nikolas Bowe wrote: > >>>> > >>>>> If you want a description of what I look like, Ive got long (shoulder > >>>>> length) brown hair. > >>>>> Long hair is pretty rare for guys these days, so I doubt you will > have > >>>>> trouble picking me out. > >>>> > >>>> Since Erlang is Swedish, I suppose I always imagined the prototypical > >>>> Erlanger as looking like Bjorn from ABBA. He had shoulder-length > brown > >>>> hair, like you, so I guess my imagination isn't too far from the > truth. :-) > >>>> > >>>> > >>>> ________________________________________________________________ > >>>> erlang-questions (at) erlang.org mailing list. > >>>> See http://www.erlang.org/faq.html > >>>> To unsubscribe; mailto:erlang-questions-unsubscribe > >>>> > >>> > >>> > >> > >> > > > > > > This message and its attachments may contain legally privileged or > confidential information. This message is intended for the use of the > individual or entity to which it is addressed. If you are not the addressee > indicated in this message, or the employee or agent responsible for > delivering the message to the intended recipient, you may not copy or > deliver this message or its attachments to anyone. Rather, you should > permanently delete this message and its attachments and kindly notify the > sender by reply e-mail. Any content of this message and its attachments, > which does not relate to the official business of the sending company must > be taken not to have been sent or endorsed by the sending company or any of > its related entities. No warranty is made that the e-mail or attachment(s) > are free from computer virus or other defect. > > > > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > See http://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscribe > > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From allanwegan Tue Dec 7 08:01:54 2010 From: allanwegan (Allan Wegan) Date: Tue, 07 Dec 2010 08:01:54 +0100 Subject: [erlang-questions] mailing list "reply to" In-Reply-To: <4CFCCE70.2040802@amberbio.com> References: <4CFCC68A.4010102@allanwegan.de> <4CFCCE70.2040802@amberbio.com> Message-ID: <4CFDDBE2.9090705@allanwegan.de> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > 1. We all receive a lot of private mails sent to a lot of people. > > 2. We all communicate with one robot, and each of us should only see the > mail address of the robot and nothing more. Private mail addresses can > be included somewhere if necessary, but > they are a side show. > > 1. makes private replies easy. > 2. makes list replies easy. As it works now, i have two buttons on my mail client: "reply" and "reply to list". For me, both things are easy. I can just click to reply privately and i can just click to reply to the list as a whole. And now you effectively want to remove one of the two functions. Why?! - -- Allan Wegan Jabber: allanwegan ICQ: 209459114 Phone: +49 40 6732962 Sch?neberger Stra?e 60, 22149 Hamburg, Germany -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (MingW32) iQEcBAEBAgAGBQJM/dviAAoJENm5axHh7AcxO+0H/jdsj3yWZkcUOrWUacGGRFld CxX1tyTyG1elEZ7lFnRun8uaRVn6a0L2UgZGCCsS4A5lCXKl/wz7Fp5mnNY4U2SJ /3op2X/K0Zr+rzX2ND5MZX8uWpjpbGNjUlk7DTKqZgGSLr9PKIWDrGd7U7gIUP7t 62KCDBCuyWqKFpWfPUJH0Plpematup7m98I8Pr7ZWISKXNbVJX+qkhFw9/zxg2DW ClSHKtybiFh8KbHoBKKQT31KGn/YsofTgDR3QOm//qULO3ZuWOM3tPo6DQi7T4ub zZ0uvkpX9pXPaPABbshyMqfUd+8R2d3HAj0VmMhHbl7DXSORQWInrsj7ZiN8lEU= =wm/F -----END PGP SIGNATURE----- From mk Tue Dec 7 09:10:58 2010 From: mk (Morten Krogh) Date: Tue, 07 Dec 2010 09:10:58 +0100 Subject: [erlang-questions] mailing list "reply to" In-Reply-To: <4CFDDBE2.9090705@allanwegan.de> References: <4CFCC68A.4010102@allanwegan.de> <4CFCCE70.2040802@amberbio.com> <4CFDDBE2.9090705@allanwegan.de> Message-ID: <4CFDEC12.40508@amberbio.com> Allan, It is not so important to me. Don't change it. But the problem is, of course, that not all MUAs work like yours. There is no reply to list, which means that one must copy/ paste addresses around. Also, why are private replies important at all in a mailing list? Morten. On 12/7/10 8:01 AM, Allan Wegan wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > >> 1. We all receive a lot of private mails sent to a lot of people. >> >> 2. We all communicate with one robot, and each of us should only see the >> mail address of the robot and nothing more. Private mail addresses can >> be included somewhere if necessary, but >> they are a side show. >> >> 1. makes private replies easy. >> 2. makes list replies easy. > As it works now, i have two buttons on my mail client: "reply" and > "reply to list". For me, both things are easy. I can just click to reply > privately and i can just click to reply to the list as a whole. > And now you effectively want to remove one of the two functions. > > Why?! > > > > - -- > Allan Wegan > Jabber: allanwegan > ICQ: 209459114 > Phone: +49 40 6732962 > Sch?neberger Stra?e 60, 22149 Hamburg, Germany > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2.0.14 (MingW32) > > iQEcBAEBAgAGBQJM/dviAAoJENm5axHh7AcxO+0H/jdsj3yWZkcUOrWUacGGRFld > CxX1tyTyG1elEZ7lFnRun8uaRVn6a0L2UgZGCCsS4A5lCXKl/wz7Fp5mnNY4U2SJ > /3op2X/K0Zr+rzX2ND5MZX8uWpjpbGNjUlk7DTKqZgGSLr9PKIWDrGd7U7gIUP7t > 62KCDBCuyWqKFpWfPUJH0Plpematup7m98I8Pr7ZWISKXNbVJX+qkhFw9/zxg2DW > ClSHKtybiFh8KbHoBKKQT31KGn/YsofTgDR3QOm//qULO3ZuWOM3tPo6DQi7T4ub > zZ0uvkpX9pXPaPABbshyMqfUd+8R2d3HAj0VmMhHbl7DXSORQWInrsj7ZiN8lEU= > =wm/F > -----END PGP SIGNATURE----- > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > From co7eb Tue Dec 7 07:31:59 2010 From: co7eb (=?iso-8859-1?Q?Gilberio_Carmenates_Garc=EDa?=) Date: Tue, 7 Dec 2010 03:31:59 -0300 Subject: [erlang-questions] mailing list "reply to" In-Reply-To: <4CFDDBE2.9090705@allanwegan.de> References: <4CFCC68A.4010102@allanwegan.de> <4CFCCE70.2040802@amberbio.com> <4CFDDBE2.9090705@allanwegan.de> Message-ID: <000a01cb95d8\$756e0450\$604a0cf0\$@co.cu> Hi Allan, It's so easy to type the 'e' key in the cc box and erlang-questions appears happily, simple as you reply to someone and type 'e' in the cc box, so your reply will be sent to the erlang-questions mail list as well Best, Ivan. -----Mensaje original----- De: erlang-questions [mailto:erlang-questions] En nombre de Allan Wegan Enviado el: Martes, 07 de Diciembre de 2010 4:02 Para: erlang-questions Asunto: Re: [erlang-questions] mailing list "reply to" -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > 1. We all receive a lot of private mails sent to a lot of people. > > 2. We all communicate with one robot, and each of us should only see the > mail address of the robot and nothing more. Private mail addresses can > be included somewhere if necessary, but > they are a side show. > > 1. makes private replies easy. > 2. makes list replies easy. As it works now, i have two buttons on my mail client: "reply" and "reply to list". For me, both things are easy. I can just click to reply privately and i can just click to reply to the list as a whole. And now you effectively want to remove one of the two functions. Why?! - -- Allan Wegan Jabber: allanwegan ICQ: 209459114 Phone: +49 40 6732962 Sch?neberger Stra?e 60, 22149 Hamburg, Germany -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (MingW32) iQEcBAEBAgAGBQJM/dviAAoJENm5axHh7AcxO+0H/jdsj3yWZkcUOrWUacGGRFld CxX1tyTyG1elEZ7lFnRun8uaRVn6a0L2UgZGCCsS4A5lCXKl/wz7Fp5mnNY4U2SJ /3op2X/K0Zr+rzX2ND5MZX8uWpjpbGNjUlk7DTKqZgGSLr9PKIWDrGd7U7gIUP7t 62KCDBCuyWqKFpWfPUJH0Plpematup7m98I8Pr7ZWISKXNbVJX+qkhFw9/zxg2DW ClSHKtybiFh8KbHoBKKQT31KGn/YsofTgDR3QOm//qULO3ZuWOM3tPo6DQi7T4ub zZ0uvkpX9pXPaPABbshyMqfUd+8R2d3HAj0VmMhHbl7DXSORQWInrsj7ZiN8lEU= =wm/F -----END PGP SIGNATURE----- ________________________________________________________________ erlang-questions (at) erlang.org mailing list. See http://www.erlang.org/faq.html To unsubscribe; mailto:erlang-questions-unsubscribe ======================================================================= Este mensaje ha sido enviado mediante el servicio de correo electr?nico que ofrece la Federaci?n de Radioaficionados de Cuba a sus miembros para respaldar el cumplimiento de los objetivos de la organizaci?n y su pol?tica informativa. La persona que env?a este correo asume el compromiso de usar el servicio a tales fines y cumplir con las regulaciones establecidas. From chaitanya.chalasani Tue Dec 7 10:29:36 2010 From: chaitanya.chalasani (CHAITANYA CHALASANI) Date: Tue, 7 Dec 2010 14:59:36 +0530 Subject: beam.smp crashed my mac Message-ID: I was running yaws 1.89 in a terminal and I had accidentally clicked on the close button of the terminal and my mac showed a black transparent screen asking me to restart the system by using the power key. I was running yaws with normal user privileges. Why did it crash my machine? The attached is the crash report generated by mac to be reported. -- Chaitanya Chalasani -------------- next part -------------- Interval Since Last Panic Report: 560997 sec Panics Since Last Report: 1 Anonymous UUID: 8D331464-4F33-4C1A-ACA5-7AB85E4EE54B Tue Dec 7 14:49:23 2010 panic(cpu 1 caller 0x2aab55): Kernel trap at 0x004a073c, type 14=page fault, registers: CR0: 0x8001003b, CR2: 0x00000000, CR3: 0x00100000, CR4: 0x00000660 EAX: 0x00000000, EBX: 0x0a4c8f30, ECX: 0x0a4c8f30, EDX: 0x14111c04 CR2: 0x00000000, EBP: 0x011fbd28, ESI: 0x0a4c8f30, EDI: 0x09880f50 EFL: 0x00010246, EIP: 0x004a073c, CS: 0x00000008, DS: 0x00290010 Error code: 0x00000000 Backtrace (CPU 1), Frame : Return Address (4 potential args on stack) 0x11fbb38 : 0x21b50c (0x5d42fc 0x11fbb6c 0x223974 0x0) 0x11fbb88 : 0x2aab55 (0x59616c 0x4a073c 0xe 0x596336) 0x11fbc68 : 0x2a09a8 (0x11fbc80 0x0 0x11fbd28 0x4a073c) 0x11fbc78 : 0x4a073c (0xe 0x48 0x10 0x11f0010) 0x11fbd28 : 0x4723eb (0xa4c8f30 0x8bfdfc0 0x11fbd68 0x87c17b0) 0x11fbd78 : 0x472507 (0x86d8b40 0x246 0x11fbe08 0x233bdd) 0x11fbd98 : 0x46ce50 (0xa0d0138 0x11fbde8 0x86d8b40 0x0) 0x11fbe08 : 0x46e246 (0x8c30870 0xa0d0138 0x9731540 0x47fc5c) 0x11fbe48 : 0x47a259 (0x9731540 0x8 0x0 0xbf57000) 0x11fbeb8 : 0x22e7fa (0x9731540 0x1 0x9731540 0x29f54e) 0x11fbee8 : 0x22ec26 (0xbf572c0 0x1464e000 0x11fbf68 0x1) 0x11fbf28 : 0x22f631 (0xbf572e0 0xbf57000 0x11fbf68 0x489090) 0x11fbf68 : 0x219114 (0xbf57000 0xffffff7f 0x11fbf88 0x15280a20) 0x11fbfa8 : 0x2a9a9a (0xffffffff 0x1 0x11fbfc8 0x84baa0) 0x11fbfc8 : 0x2a08a6 (0x0 0x2 0x10 0x9c01a64) BSD process name corresponding to current thread: beam.smp Mac OS version: 10H574 Kernel version: Darwin Kernel Version 10.5.0: Fri Nov 5 23:20:39 PDT 2010; root:xnu-1504.9.17~1/RELEASE_I386 System model name: MacBookPro5,5 (Mac-F2268AC8) System uptime in nanoseconds: 110646866055052 unloaded kexts: com.apple.filesystems.cd9660 1.4.1 (addr 0xf66000, size 0x36864) - last unloaded 88140507626670 loaded kexts: com.nvidia.CUDA 1.1.0 - last loaded 87832940837674 com.parallels.kext.prl_vnic 6.0 11828.615184 com.parallels.kext.prl_netbridge 6.0 11828.615184 com.parallels.kext.prl_usb_connect 6.0 11828.615184 com.parallels.kext.prl_hid_hook 6.0 11828.615184 com.parallels.kext.prl_hypervisor 6.0 11828.615184 com.apple.driver.AppleHWSensor 1.9.3d0 com.apple.driver.AGPM 100.12.19 com.apple.filesystems.autofs 2.1.0 com.apple.driver.AppleUpstreamUserClient 3.4.5 com.apple.driver.AppleMCCSControl 1.0.17 com.apple.driver.AppleHDA 1.9.9f12 com.apple.driver.AppleMikeyHIDDriver 1.2.0 com.apple.driver.AudioAUUC 1.13 com.apple.driver.AppleMikeyDriver 1.9.9f12 com.apple.driver.AppleLPC 1.4.12 com.apple.driver.AppleBacklight 170.0.34 com.apple.driver.SMCMotionSensor 3.0.0d4 com.apple.kext.AppleSMCLMU 1.5.0d3 com.apple.Dont_Steal_Mac_OS_X 7.0.0 com.apple.iokit.CHUDUtils 364 com.apple.iokit.CHUDProf 364 com.apple.driver.AudioIPCDriver 1.1.6 com.apple.driver.AppleIntelPenrynProfile 17.1 com.apple.driver.ACPI_SMC_PlatformPlugin 4.5.0d5 com.apple.GeForce 6.2.4 com.apple.driver.AppleUSBTCButtons 200.3.2 com.apple.driver.AppleUSBTCKeyboard 200.3.2 com.apple.driver.AppleIRController 303.8 com.apple.driver.AppleUSBCardReader 2.5.8 com.apple.iokit.SCSITaskUserClient 2.6.5 com.apple.iokit.IOAHCIBlockStorage 1.6.3 com.apple.BootCache 31 com.apple.AppleFSCompression.AppleFSCompressionTypeZlib 1.0.0d1 com.apple.driver.AppleFWOHCI 4.7.1 com.apple.nvenet 2.0.15 com.apple.driver.AppleSmartBatteryManager 160.0.0 com.apple.driver.AirPortBrcm43224 426.36.1 com.apple.driver.AppleUSBHub 4.1.7 com.apple.driver.AppleAHCIPort 2.1.5 com.apple.driver.AppleUSBEHCI 4.1.7 com.apple.driver.AppleUSBOHCI 4.1.5 com.apple.driver.AppleEFINVRAM 1.4.0 com.apple.driver.AppleRTC 1.3.1 com.apple.driver.AppleHPET 1.5 com.apple.driver.AppleACPIButtons 1.3.5 com.apple.driver.AppleSMBIOS 1.6 com.apple.driver.AppleACPIEC 1.3.5 com.apple.driver.AppleAPIC 1.4 com.apple.driver.AppleIntelCPUPowerManagementClient 105.13.0 com.apple.security.sandbox 1 com.apple.security.quarantine 0 com.apple.nke.applicationfirewall 2.1.11 com.apple.driver.AppleIntelCPUPowerManagement 105.13.0 com.apple.driver.DspFuncLib 1.9.9f12 com.apple.driver.AppleProfileReadCounterAction 17 com.apple.driver.AppleProfileTimestampAction 10 com.apple.driver.AppleProfileThreadInfoAction 14 com.apple.driver.AppleProfileRegisterStateAction 10 com.apple.driver.AppleProfileKEventAction 10 com.apple.driver.AppleProfileCallstackAction 20 com.apple.nvidia.nv50hal 6.2.4 com.apple.iokit.IOFireWireIP 2.0.3 com.apple.iokit.IOSurface 74.2 com.apple.iokit.IOBluetoothSerialManager 2.3.8f7 com.apple.iokit.IOSerialFamily 10.0.3 com.apple.iokit.CHUDKernLib 365 com.apple.iokit.IOAudioFamily 1.7.9fc4 com.apple.kext.OSvKernDSPLib 1.3 com.apple.driver.AppleHDAController 1.9.9f12 com.apple.iokit.IOHDAFamily 1.9.9f12 com.apple.driver.AppleSMBusController 1.0.8d0 com.apple.iokit.AppleProfileFamily 41.4 com.apple.driver.AppleSMC 3.1.0d3 com.apple.driver.IOPlatformPluginFamily 4.5.0d5 com.apple.NVDAResman 6.2.4 com.apple.iokit.IONDRVSupport 2.2 com.apple.iokit.IOGraphicsFamily 2.2 com.apple.driver.AppleSMBusPCI 1.0.8d0 com.apple.driver.BroadcomUSBBluetoothHCIController 2.3.8f7 com.apple.driver.AppleUSBBluetoothHCIController 2.3.8f7 com.apple.iokit.IOBluetoothFamily 2.3.8f7 com.apple.driver.AppleUSBMultitouch 206.6 com.apple.iokit.IOUSBHIDDriver 4.1.5 com.apple.iokit.IOSCSIBlockCommandsDevice 2.6.5 com.apple.iokit.IOUSBMassStorageClass 2.6.5 com.apple.iokit.IOSCSIMultimediaCommandsDevice 2.6.5 com.apple.iokit.IOBDStorageFamily 1.6 com.apple.iokit.IODVDStorageFamily 1.6 com.apple.iokit.IOCDStorageFamily 1.6 com.apple.driver.AppleUSBMergeNub 4.1.5 com.apple.driver.AppleUSBComposite 3.9.0 com.apple.driver.XsanFilter 402.1 com.apple.iokit.IOAHCISerialATAPI 1.2.5 com.apple.iokit.IOSCSIArchitectureModelFamily 2.6.5 com.apple.iokit.IOFireWireFamily 4.2.6 com.apple.iokit.IO80211Family 312 com.apple.iokit.IONetworkingFamily 1.9 com.apple.iokit.IOUSBUserClient 4.1.5 com.apple.iokit.IOAHCIFamily 2.0.4 com.apple.iokit.IOUSBFamily 4.1.7 com.apple.driver.NVSMU 2.2.7 com.apple.driver.AppleEFIRuntime 1.4.0 com.apple.iokit.IOHIDFamily 1.6.5 com.apple.iokit.IOSMBusFamily 1.1 com.apple.kext.AppleMatch 1.0.0d1 com.apple.security.TMSafetyNet 6 com.apple.driver.DiskImages 289 com.apple.iokit.IOStorageFamily 1.6.2 com.apple.driver.AppleACPIPlatform 1.3.5 com.apple.iokit.IOPCIFamily 2.6 com.apple.iokit.IOACPIFamily 1.3.0 Model: MacBookPro5,5, BootROM MBP55.00AC.B03, 2 processors, Intel Core 2 Duo, 2.26 GHz, 4 GB, SMC 1.47f2 Graphics: NVIDIA GeForce 9400M, NVIDIA GeForce 9400M, PCI, 256 MB Memory Module: global_name AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x8D), Broadcom BCM43xx 1.0 (5.10.131.36.1) Bluetooth: Version 2.3.8f7, 2 service, 12 devices, 1 incoming serial ports Network Service: Ethernet, Ethernet, en0 Serial ATA Device: ST9500325AS, 465.76 GB Serial ATA Device: HL-DT-ST DVDRW GS23N USB Device: Internal Memory Card Reader, 0x05ac (Apple Inc.), 0x8403, 0x26500000 USB Device: Built-in iSight, 0x05ac (Apple Inc.), 0x8507, 0x24400000 USB Device: Apple Internal Keyboard / Trackpad, 0x05ac (Apple Inc.), 0x0236, 0x04600000 USB Device: IR Receiver, 0x05ac (Apple Inc.), 0x8242, 0x04500000 USB Device: BRCM2046 Hub, 0x0a5c (Broadcom Corp.), 0x4500, 0x06100000 USB Device: Bluetooth USB Host Controller, 0x05ac (Apple Inc.), 0x8213, 0x06110000 From paul.a.johnston Tue Dec 7 10:22:37 2010 From: paul.a.johnston (Paul Johnston) Date: Tue, 7 Dec 2010 09:22:37 -0000 Subject: [erlang-questions] Erlounge Melbourne - Sat 4/12 In-Reply-To: References: <4CF48EAF.5070304@infinite-interactive.com><201011302000.33706.als@iinet.net.au><4CF840CF.4000909@infinite-interactive.com><001801cb92f9\$5cb21dc0\$16165940\$@com><4CFDA979.3080405@infinite-interactive.com><0FA0DB78-CA08-4DC4-A2B9-7DAB6D973AB7@x-team.com> Message-ID: I would have loved to come but what with the cricket result I may not have been welcome :-) Regards Paul -----Original Message----- From: erlang-questions [mailto:erlang-questions] On Behalf Of Julian Doherty Sent: 07 December 2010 04:14 To: erlang-questions Subject: Re: [erlang-questions] Erlounge Melbourne - Sat 4/12 Wanted to attend on Saturday night, but is tricky with a 2-month old (especially after having a few drinks after YOW most nights during the week ;) Would definitely be keen to attend any future Erlounge meetups. Was great having everyone at LP during the day for the tut session with Francesco as well. Cheers Julian On 7 December 2010 14:33, Josh Johnston wrote: > Hi all, I wasn't able to make it to the meetup but definitely interested in > erlang-happenings around Melbourne. I don't know what this mailing list is > that you mention but now I'm intrigued :) > > Josh. > > On 07/12/2010, at 2:26 PM, Nikolas Bowe wrote: > > > Thanks to everyone that came. > > Its always good to see the different approaches people take on different > software. > > Thanks especially to Justin and Kresten. > > Justin; your enthusiasm is contagious. A lot of the attendees (especially > the ones that arent actively using Erlang) mentioned how impressed they > were. > > Who knows... maybe soon we will see a bunch of startups springing up > following the basho model. > > > > ha @ david's comment. Im afraid I cannot sing though. > > Anytime I try to imagine what a stereotypical hacker for a certain > language looks like I meet someone that blows my idea out of the water. > > > > Edmond, we will definitely need to do that. Ill send you an email off > list later about it. > > > > Cheers > > Nikolas Bowe > > > > > > > > On 12/6/2010 10:13 PM, Edmond Begumisa wrote: > >> Thanks also to Justin & Co for taking time out to drop by and answer all > our questions. Personally, it's always encouraging to meet someone running a > startup that's actually making money :) > >> > >> - Edmond - > >> > >> > >> On Mon, 06 Dec 2010 22:02:53 +1100, Edmond Begumisa < > ebegumisa> wrote: > >> > >>> It's interesting (or rather sad) that nobody had trouble identifying > the group! Apparently, a table of people discussing concurrency, > fault-tolerance and scalable databases in a bar on a Saturday night isn't > that difficult to identify :( > >>> > >>> On a serious note, the Erlounge was great. I met a lot of interesting > people with interesting ideas and experiences. Nik, we should take up > Francesco's suggestion on creating that mailing list. > >>> > >>> Thank you Francesco and Julian for the excellent tutorial. > >>> > >>> - Edmond - > >>> > >>> > >>> On Sat, 04 Dec 2010 01:49:58 +1100, David Mercer > wrote: > >>> > >>>> On Thursday, December 02, 2010, Nikolas Bowe wrote: > >>>> > >>>>> If you want a description of what I look like, Ive got long (shoulder > >>>>> length) brown hair. > >>>>> Long hair is pretty rare for guys these days, so I doubt you will > have > >>>>> trouble picking me out. > >>>> > >>>> Since Erlang is Swedish, I suppose I always imagined the prototypical > >>>> Erlanger as looking like Bjorn from ABBA. He had shoulder-length > brown > >>>> hair, like you, so I guess my imagination isn't too far from the > truth. :-) > >>>> > >>>> > >>>> ________________________________________________________________ > >>>> erlang-questions (at) erlang.org mailing list. > >>>> See http://www.erlang.org/faq.html > >>>> To unsubscribe; mailto:erlang-questions-unsubscribe > >>>> > >>> > >>> > >> > >> > > > > > > This message and its attachments may contain legally privileged or > confidential information. This message is intended for the use of the > individual or entity to which it is addressed. If you are not the addressee > indicated in this message, or the employee or agent responsible for > delivering the message to the intended recipient, you may not copy or > deliver this message or its attachments to anyone. Rather, you should > permanently delete this message and its attachments and kindly notify the > sender by reply e-mail. Any content of this message and its attachments, > which does not relate to the official business of the sending company must > be taken not to have been sent or endorsed by the sending company or any of > its related entities. No warranty is made that the e-mail or attachment(s) > are free from computer virus or other defect. > > > > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > See http://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscribe > > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From max.lapshin Tue Dec 7 11:12:06 2010 From: max.lapshin (Max Lapshin) Date: Tue, 7 Dec 2010 13:12:06 +0300 Subject: [erlang-questions] beam.smp crashed my mac In-Reply-To: References: Message-ID: On Tue, Dec 7, 2010 at 12:29 PM, CHAITANYA CHALASANI wrote: > I was running yaws 1.89 in a terminal and I had accidentally clicked > on the close button of the terminal and my mac showed a black > transparent screen asking me to restart the system by using the power > key. > =)))) It is well known problem. When module crypto is started, closing erlang crashes Mac. It is not problem of erlang, it is problem of OS X and Apple programmers, that can't fix it for more than a year. From max.lapshin Tue Dec 7 11:12:06 2010 From: max.lapshin (Max Lapshin) Date: Tue, 7 Dec 2010 13:12:06 +0300 Subject: [erlang-questions] beam.smp crashed my mac In-Reply-To: References: Message-ID: On Tue, Dec 7, 2010 at 12:29 PM, CHAITANYA CHALASANI wrote: > I was running yaws 1.89 in a terminal and I had accidentally clicked > on the close button of the terminal and my mac showed a black > transparent screen asking me to restart the system by using the power > key. > =)))) It is well known problem. When module crypto is started, closing erlang crashes Mac. It is not problem of erlang, it is problem of OS X and Apple programmers, that can't fix it for more than a year. From chaitanya.chalasani Tue Dec 7 11:19:50 2010 From: chaitanya.chalasani (CHAITANYA CHALASANI) Date: Tue, 7 Dec 2010 15:49:50 +0530 Subject: [erlang-questions] beam.smp crashed my mac In-Reply-To: References: Message-ID: Thanks a lot. I would take care to avoid this for now. On Tue, Dec 7, 2010 at 3:42 PM, Max Lapshin wrote: > On Tue, Dec 7, 2010 at 12:29 PM, CHAITANYA CHALASANI > wrote: >> I was running yaws 1.89 in a terminal and I had accidentally clicked >> on the close button of the terminal and my mac showed a black >> transparent screen asking me to restart the system by using the power >> key. >> > > > =)))) > > It is well known problem. When module crypto is started, closing > erlang crashes Mac. > It is not problem of erlang, it is problem of OS X and Apple > programmers, that can't fix it for more than a year. > -- Chaitanya Chalasani Linux User: 410931 From jimenezrick Tue Dec 7 12:51:10 2010 From: jimenezrick (Ricardo Catalinas =?iso-8859-1?Q?Jim=E9nez?=) Date: Tue, 7 Dec 2010 12:51:10 +0100 Subject: Using systools:make_script() raises "*WARNING* inets: Source code not found" Message-ID: <20101207115110.GA65800@macbook.server01.org> Hi, With R14B release when I run from my app project directory: systools:make_script("myapp-rel", [local, {path, ["ebin"]}, {outdir, "ebin"}]) Given that my app depends on `inets', creating the script raises the next warnings: *WARNING* inets: Source code not found: inets.erl *WARNING* inets: Source code not found: inets_sup.erl *WARNING* inets: Source code not found: inets_app.erl ... ... Missing all sources from `inets' ... It seems that the `src' directory of `inets' is populated with several subdirectories where the actual code is located: \$ERL_ROOT/lib/inets-5.5/src/ |ftp/ |http_client/ |http_lib/ |http_server/ |inets_app/ \tftp/ Using `strace' under Linux shows that `make_script()' is not able to look into that subdirectories. Is there any sane way to make able `make_script()' to find the sources? By the way, the option `no_module_tests' suppress the warning by disabling that check: systools:make_script("myapp-rel", [local, {path, ["ebin"]}, {outdir, "ebin"}], no_module_tests) Thanks in advance. -- Ricardo From allanwegan Tue Dec 7 12:46:43 2010 From: allanwegan (Allan Wegan) Date: Tue, 07 Dec 2010 12:46:43 +0100 Subject: [erlang-questions] mailing list "reply to" In-Reply-To: <000a01cb95d8\$756e0450\$604a0cf0\$@co.cu> References: <4CFCC68A.4010102@allanwegan.de> <4CFCCE70.2040802@amberbio.com> <4CFDDBE2.9090705@allanwegan.de> <000a01cb95d8\$756e0450\$604a0cf0\$@co.cu> Message-ID: <4CFE1EA3.4050702@allanwegan.de> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > It's so easy to type the 'e' key in the cc box and > erlang-questions appears happily, simple as you reply to someone > and type 'e' in the cc box, so your reply will be sent to the > erlang-questions mail list as well Thanks, but the buttons work well for me. And they do not double post... - -- Allan Wegan Jabber: allanwegan ICQ: 209459114 Phone: +49 40 6732962 Sch?neberger Stra?e 60, 22149 Hamburg, Germany -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (MingW32) iQEcBAEBAgAGBQJM/h6jAAoJENm5axHh7Acx7RsH/irhdOImEDUE9lDrlKsuxUJP Ab8iqqFPi7jdISVxLs1TtobEcgp/mjO8JwIbEA38N3kClwLJ47FgqTOd5sKiQqfQ 755IyvXAUukaHzmSJX3v4ahP7MhHGdoChjktXOxhZ87Y3B7dFVDrSXsdOtW9/6Od gqQurh9wpZbjpyx0oCZj8RNL9Fdmwas1rR3MoF/PZlkqOcYq2kpT8Vvkk0QJP/Bt bccbyEtdurRUVsUoNVjt8+0e2QvOyoP6NSXY1vVC4OgGGDt0+4U8FiQ/ycZ3z6LQ cNk+Kf2c2ErZqDDyHSmagMSGg88pdesuUPQWiJICLY1ZvbYET+QyjyriLSRRgY8= =DnXw -----END PGP SIGNATURE----- From chad Tue Dec 7 12:53:59 2010 From: chad (Chad DePue) Date: Tue, 7 Dec 2010 08:53:59 -0300 Subject: inaka is available for hire Message-ID: Folks, we're a small team of Erlang devs in Buenos Aires, Argentina. Two of us are free right now, myself and our Erlang Solutions-certified lead developer. We're keeping the Erlang flame alive in the southern cone. We're available for Erlang projects, our rates are very competitive, and we are very experienced at working remotely. Chad DePue skype: cdepue inakanetworks.com - Erlang, Ruby, and iOS Consulting +1 206.866.5707 forwards to mobile +54 9.11.6940.7097 mobile From allanwegan Tue Dec 7 13:01:13 2010 From: allanwegan (Allan Wegan) Date: Tue, 07 Dec 2010 13:01:13 +0100 Subject: [erlang-questions] mailing list "reply to" In-Reply-To: <4CFDEC12.40508@amberbio.com> References: <4CFCC68A.4010102@allanwegan.de> <4CFCCE70.2040802@amberbio.com> <4CFDDBE2.9090705@allanwegan.de> <4CFDEC12.40508@amberbio.com> Message-ID: <4CFE2209.8070108@allanwegan.de> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > But the problem is, of course, that not all MUAs work like yours. > There is no reply to list, which means that one must copy/ paste > addresses around. Just use the right tool. Thunderbird is available free of charge for multiple platforms including Windows, Linux, and Mac OS X. There should be other capable clients out there too. But tht's the one i use. > Also, why are private replies important at all in a mailing list? They are not really important for me. It's just a nice to have, that comes without a price and is already there. - -- Allan Wegan Jabber: allanwegan ICQ: 209459114 Phone: +49 40 6732962 Sch?neberger Stra?e 60, 22149 Hamburg, Germany -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (MingW32) iQEcBAEBAgAGBQJM/iIJAAoJENm5axHh7AcxIMEIAMBUOoDSnzTboukP/lid8Qkf f6rjnaxAD96sN0h6PGsarBELQZpvo4k9tV4rDnJDtoA0+NnXWISvg/DEudLfRylS dSC+lpZKz4XxzMpWFYz5oWMehtzuYJ4zu6B2j6xwxyUXisMFsVUc3TX1eVd0jstc xdg9Sk3xG7I+le0RjiNclooz4XUhcn0DTD4N2fvHlefsPzuWlfkNcBxwxVLt78VE E7tU40610hZQwBTSnAh3nSxQKVfL5PayK35TT0IyNnvGvlcRUW5Vw4jrCy9gSLnX N4SEPhuesFHPOiP1tmNzpr08ew0N01QIFIRSOk7hTk+NT3GWsBJJ5Pd1boGlJSE= =XGCc -----END PGP SIGNATURE----- From setori88 Tue Dec 7 15:42:25 2010 From: setori88 (stewart) Date: Tue, 7 Dec 2010 06:42:25 -0800 (PST) Subject: reltool to include a module Message-ID: <94be08f7-3b99-4ad8-980e-5aead1976bd0@t8g2000prh.googlegroups.com> Hi I really need to get an erlang module available in the Erlang shell. What am I doing wrong? git clone git://github.com/sjmackenzie/phoebus cd phoebus make rel ./rel/phoebus/bin/phoebus console then at the console phoebus_algos_ (auto-complete) should list all available modules. I need all the phoebus/deps/phoebus_algos/ebin/* modules. thanks so much Stewart From andrey.pampukha Tue Dec 7 15:59:06 2010 From: andrey.pampukha (Andrey Pampukha) Date: Tue, 7 Dec 2010 17:59:06 +0300 Subject: [erlang-questions] reltool to include a module In-Reply-To: <94be08f7-3b99-4ad8-980e-5aead1976bd0@t8g2000prh.googlegroups.com> References: <94be08f7-3b99-4ad8-980e-5aead1976bd0@t8g2000prh.googlegroups.com> Message-ID: Stewart, All application's beamfiles are to be pre-loaded into the memory at application startup, to have their names known by shell. If I'm not mistaken, you can just list all modules into the 'modules' section of the .app file. But I'm not sure that it's enough. You also need to start the system in embedded mode to autoload all listed modules. Andrey. 2010/12/7, stewart : > Hi > > I really need to get an erlang module available in the Erlang shell. > > What am I doing wrong? > > git clone git://github.com/sjmackenzie/phoebus > cd phoebus > make rel > ./rel/phoebus/bin/phoebus console > > then at the console phoebus_algos_ (auto-complete) should list > all available modules. > > I need all the phoebus/deps/phoebus_algos/ebin/* modules. > > thanks so much > > Stewart > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From max.lapshin Tue Dec 7 16:08:32 2010 From: max.lapshin (Max Lapshin) Date: Tue, 7 Dec 2010 18:08:32 +0300 Subject: OpenOffice UNO (urp) support? Message-ID: Is there implementation of http://wiki.services.openoffice.org/wiki/Uno/Remote/Specifications/Uno_Remote_Protocol ? Or I will need to create it myself? From robert.virding Tue Dec 7 16:28:44 2010 From: robert.virding (Robert Virding) Date: Tue, 7 Dec 2010 15:28:44 +0000 (GMT) Subject: [erlang-questions] reltool to include a module In-Reply-To: <12373230.171401291735721735.JavaMail.root@zimbra> Message-ID: <1433638060.171421291735724888.JavaMail.root@zimbra> Yes, the shell can only list modules which are loaded into the system. Robert ----- "Andrey Pampukha" wrote: > Stewart, > > All application's beamfiles are to be pre-loaded into the memory at > application startup, to have their names known by shell. > If I'm not mistaken, you can just list all modules into the 'modules' > section of the .app file. > But I'm not sure that it's enough. You also need to start the system > in embedded mode to autoload all listed modules. > > Andrey. > > > 2010/12/7, stewart : > > Hi > > > > I really need to get an erlang module available in the Erlang > shell. > > > > What am I doing wrong? > > > > git clone git://github.com/sjmackenzie/phoebus > > cd phoebus > > make rel > > ./rel/phoebus/bin/phoebus console > > > > then at the console phoebus_algos_ (auto-complete) should > list > > all available modules. > > > > I need all the phoebus/deps/phoebus_algos/ebin/* modules. > > > > thanks so much > > > > Stewart > > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > See http://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscribe > > > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe From zvi.avraham Tue Dec 7 16:32:00 2010 From: zvi.avraham (Zvi) Date: Tue, 7 Dec 2010 07:32:00 -0800 (PST) Subject: Multi-line comments in Erlang Message-ID: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> Hi, Matlab/Octave has single line comments, like Erlang (i.e. starting with '%' sign). But it also have multi-line comments, like for example: %{ this is example of multi-line comments in Matlab %} which is equivalent to: %this is example %of multi-line %comments in Matlab How difficult is to add comments like this to Erlang? Thanks, Zvi From per Tue Dec 7 15:23:57 2010 From: per (Per Hedeland) Date: Tue, 7 Dec 2010 15:23:57 +0100 (CET) Subject: [erlang-questions] Re: how do I do the equivalent of ets:tab2list(timer_tab) for BIF timers In-Reply-To: <20101206225808.GA22459@corelatus.se> Message-ID: <201012071423.oB7ENvJu062475@pluto.hedeland.org> Matthias Lang wrote: > >In short: A bug in the linux kernel on Au1000 MIPS CPUs causes > Erlang's timers and timeouts to go haywire, sometimes. > Most likely, nobody but me is affected. Erlang is not the problem. > >Longer version follows as a reply to my own post. It's only of >interest to the curious. Hm, we actually recently had a report that the VM (R13B03) aborted on startup with "Unexpected behaviour from operating system high resolution timer" - this is from erl_time_sup.c, and (on Linux) the only reason I can see is that clock_gettime(CLOCK_MONOTONIC) went backwards (which should *never* happen, of course). >The root cause was a concurrency/locking problem: a missing lock in an >interrupt routine which meant that a call to clock_gettime() at the >"wrong" moment could read junk. So was this specific to the above CPU? I believe the system where the abort happened was x86_64 (running CentOS 5.3). --Per Hedeland From jensli Tue Dec 7 17:07:19 2010 From: jensli (jensli) Date: Tue, 7 Dec 2010 11:07:19 -0500 (EST) Subject: Ordering of mnesia events In-Reply-To: <201012071423.oB7ENvJu062475@pluto.hedeland.org> References: <201012071423.oB7ENvJu062475@pluto.hedeland.org> Message-ID: <5899.194.237.142.6.1291738039.squirrel@lavabit.com> Hi, We?re developing an application where multiple processes on different nodes in a distributed system subscribe to mnesia events. The table is written to from one single process on one of the nodes. However uncertainty has arose about if we can be sure to receive the events in the same order as operations on the table. E.g: mnesia:delete(tab1, SomeRec), mnesia:write(tab1, SomeOtherRec) If we sometimes get the delete event after the write event our design would not work and we would have to create some other kind of notification mechanism. Also, what about operations on different tables (from the same process)? mnesia:write(tab1, SomeRec), mnesia:write(tab2, SomeOtherRec) Can we be sure to always get the event from tab1 before the one from tab2? On all processes and all nodes? Thanks, JL From matthias Tue Dec 7 17:18:24 2010 From: matthias (Matthias Lang) Date: Tue, 7 Dec 2010 17:18:24 +0100 Subject: [erlang-questions] Re: how do I do the equivalent of ets:tab2list(timer_tab) for BIF timers In-Reply-To: <201012071423.oB7ENvJu062475@pluto.hedeland.org> References: <20101206225808.GA22459@corelatus.se> <201012071423.oB7ENvJu062475@pluto.hedeland.org> Message-ID: <20101207161824.GA25437@corelatus.se> Matt> >In short: A bug in the linux kernel on Au1000 MIPS CPUs causes Matt> > Erlang's timers and timeouts to go haywire, sometimes. Matt> > Most likely, nobody but me is affected. Erlang is not the problem. Per> Hm, we actually recently had a report that the VM (R13B03) aborted on Per> startup with "Unexpected behaviour from operating system high resolution Per> timer" - this is from erl_time_sup.c, and (on Linux) the only reason I Per> can see is that clock_gettime(CLOCK_MONOTONIC) went backwards (which Per> should *never* happen, of course). I agree that it should never happen. In my case, the clock_gettime() timestamp temporarily jumped forwards by hours and then jumped backwards by about the same amount. That won't trigger the message you mention, the "unexpected..." message only pops up if the time jumps backwards further than it was when Erlang started. I considered adding code to erl_time_sup.c to detect _any_ case of time going backwards so that it would be easier to detect similar problems. I decided not to because (a) I didn't want to complicate Erlang with code to check for buggy OS behaviour and (b) CLOCK_MONOTONIC is a linux-ism, I'm not sure if the same "always goes forwards" guarantees apply to other sorts of high-resolution timers. It probably does. > >The root cause was a concurrency/locking problem: a missing lock in an > >interrupt routine which meant that a call to clock_gettime() at the > >"wrong" moment could read junk. > So was this specific to the above CPU? I believe the system where the > abort happened was x86_64 (running CentOS 5.3). The fix is specific to the MIPS Au1000 CPU. See the patch below. It's possible that other CPUs have the same problem, but not very likely. The timer code is very CPU-specific, but, then again it might have been cut from some other architecture and then hacked. I didn't see the bug anywhere else when I took a quick look at other MIPS variants yesterday. I didn't look at x86 at all. I have a 20 line C test program which always fails immediately on the broken MIPS kernel. It never fails on my x86_64 (2.6.32-5). If you want the test program, mail me. Matthias ====================================================================== diff --git a/arch/mips/au1000/common/time.c b/arch/mips/au1000/common/time.c index 1a11aff..e5ec03a 100644 --- a/arch/mips/au1000/common/time.c +++ b/arch/mips/au1000/common/time.c @@ -148,11 +148,14 @@ irqreturn_t counter0_irq(int irq, void *dev_id) static int jiffie_drift = 0; irq_enter(); + write_seqlock(&xtime_lock); + ack_rise_edge_irq(irq); // Do this early so we do not miss next one if (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20) { /* should never happen! */ printk(KERN_WARNING "counter 0 w status error\n"); + write_sequnlock(&xtime_lock); irq_exit(); return IRQ_NONE; } @@ -221,6 +224,7 @@ irqreturn_t counter0_irq(int irq, void *dev_id) } #endif + write_sequnlock(&xtime_lock); irq_exit(); return IRQ_HANDLED; } From jameschurchman Tue Dec 7 17:25:36 2010 From: jameschurchman (James Churchman) Date: Tue, 7 Dec 2010 16:25:36 +0000 Subject: [erlang-questions] Multi-line comments in Erlang In-Reply-To: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> Message-ID: not posible in erlang, but many editors (eg i use textmate) will comment and uncomment multiple lines with % on each line.. On 7 Dec 2010, at 15:32, Zvi wrote: > Hi, > > Matlab/Octave has single line comments, like Erlang (i.e. starting > with '%' sign). But it also have multi-line comments, like for > example: > > %{ > this is example > of multi-line > comments in Matlab > %} > > which is equivalent to: > > %this is example > %of multi-line > %comments in Matlab > > How difficult is to add comments like this to Erlang? > > Thanks, > Zvi > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > From zvi.avraham Tue Dec 7 17:49:37 2010 From: zvi.avraham (Zvi .) Date: Tue, 7 Dec 2010 18:49:37 +0200 Subject: [erlang-questions] Multi-line comments in Erlang In-Reply-To: References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> Message-ID: Why do you think it's not possible? It's just simple change to Erlang source code parser. Probably this should be submitted as EEP, so OTP team will consider it. On Tue, Dec 7, 2010 at 6:25 PM, James Churchman wrote: > not posible in erlang, but many editors (eg i use textmate) will comment > and uncomment multiple lines with % on each line.. > On 7 Dec 2010, at 15:32, Zvi wrote: > > > Hi, > > > > Matlab/Octave has single line comments, like Erlang (i.e. starting > > with '%' sign). But it also have multi-line comments, like for > > example: > > > > %{ > > this is example > > of multi-line > > comments in Matlab > > %} > > > > which is equivalent to: > > > > %this is example > > %of multi-line > > %comments in Matlab > > > > How difficult is to add comments like this to Erlang? > > > > Thanks, > > Zvi > > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > See http://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscribe > > > > From hm Tue Dec 7 17:53:12 2010 From: hm (=?ISO-8859-1?Q?H=E5kan_Mattsson?=) Date: Tue, 7 Dec 2010 17:53:12 +0100 Subject: [erlang-questions] Ordering of mnesia events In-Reply-To: <5899.194.237.142.6.1291738039.squirrel@lavabit.com> References: <201012071423.oB7ENvJu062475@pluto.hedeland.org> <5899.194.237.142.6.1291738039.squirrel@lavabit.com> Message-ID: /H?kan On Tue, Dec 7, 2010 at 5:07 PM, wrote: > Hi, > > We?re developing an application where multiple processes on different > nodes in a distributed system subscribe to mnesia events. The table is > written to from one single process on one of the nodes. > > However uncertainty has arose about if we can be sure to receive the > events in the same order as operations on the table. > > E.g: > mnesia:delete(tab1, SomeRec), > mnesia:write(tab1, SomeOtherRec) The order of these events are undefined. In fact it is worse than that as not all updates do result in an event. If you for example perform two consecutive writes in the same transaction mnesia:write(tab1, SomeOtherRec) mnesia:write(tab1, YetSomeOtherRec) they may result in one or two events depending on table type and the primary key of the record. If the table is a set and two records have the same key, only one event will be sent (the last write). > If we sometimes get the delete event after the write event our design > would not work and we would have to create some other kind of notification > mechanism. > > Also, what about operations on different tables (from the same process)? > > mnesia:write(tab1, SomeRec), > mnesia:write(tab2, SomeOtherRec) > > Can we be sure to always get the event from tab1 before the one from tab2? > On all processes and all nodes? No. /H?kan From info Tue Dec 7 18:50:15 2010 From: info (info) Date: Tue, 7 Dec 2010 18:50:15 +0100 Subject: gen_server and the run-time errors Message-ID: <201012071850152349765@its3.ch> Hello, I have a run-time error in the init part of a gen_server. - Init begin by process_flag(trap_exit,true) - gen_server is part of a supervision tree I try to print the reason in the terminate module but it seems to exit elsewhere. - why terminate is not called ? The application stops with shutdown as reason. - How and where to catch the run-time error ? J-Ph. Constantin ITS3 Gen?ve www.its3.ch From rapsey Tue Dec 7 19:20:40 2010 From: rapsey (Rapsey) Date: Tue, 7 Dec 2010 19:20:40 +0100 Subject: [erlang-questions] Multi-line comments in Erlang In-Reply-To: References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> Message-ID: Is it that important? Any proper programming editor can comment/uncomment multiple lines. Sergej On Tue, Dec 7, 2010 at 5:49 PM, Zvi . wrote: > Why do you think it's not possible? > It's just simple change to Erlang source code parser. > Probably this should be submitted as EEP, so OTP team will consider it. > > On Tue, Dec 7, 2010 at 6:25 PM, James Churchman >wrote: > > > not posible in erlang, but many editors (eg i use textmate) will comment > > and uncomment multiple lines with % on each line.. > > On 7 Dec 2010, at 15:32, Zvi wrote: > > > > > Hi, > > > > > > Matlab/Octave has single line comments, like Erlang (i.e. starting > > > with '%' sign). But it also have multi-line comments, like for > > > example: > > > > > > %{ > > > this is example > > > of multi-line > > > comments in Matlab > > > %} > > > > > > which is equivalent to: > > > > > > %this is example > > > %of multi-line > > > %comments in Matlab > > > > > > How difficult is to add comments like this to Erlang? > > > > > > Thanks, > > > Zvi > > > > > > ________________________________________________________________ > > > erlang-questions (at) erlang.org mailing list. > > > See http://www.erlang.org/faq.html > > > To unsubscribe; mailto:erlang-questions-unsubscribe > > > > > > > > From jameschurchman Tue Dec 7 19:37:49 2010 From: jameschurchman (James Churchman) Date: Tue, 7 Dec 2010 18:37:49 +0000 Subject: [erlang-questions] Multi-line comments in Erlang In-Reply-To: References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> Message-ID: <6944DFC1-D77D-41E0-A0A7-92811B704ECB@gmail.com> oh ok, i get what you mean. Well it can not be done with a Parse Transform (something i have played with a lot) unless the syntax you use is still valid erlang, as it wont initially parse. i imagine that the erlang parser itself could be very easily modified with only a few lines & writing your own pre-parser thing would be even easier ( <5 LOC ? ) . Im sure this must have been mentioned a million times b4 & i guess it's left out as erlang is deliberately small & lean, any editor can handle doing multiple lines in one go & using ifdef(macro) or ifndef(macro) are a better way to deactivate code if thats what your looking for. maybe things like this inspired the language to stay lean. python : http://www.flickr.com/photos/nicksieger/281055485/ java : http://www.flickr.com/photos/nicksieger/280662707/in/photostream/ :-) On 7 Dec 2010, at 18:20, Rapsey wrote: > Is it that important? Any proper programming editor can comment/uncomment > multiple lines. > > > Sergej > > On Tue, Dec 7, 2010 at 5:49 PM, Zvi . wrote: > >> Why do you think it's not possible? >> It's just simple change to Erlang source code parser. >> Probably this should be submitted as EEP, so OTP team will consider it. >> >> On Tue, Dec 7, 2010 at 6:25 PM, James Churchman >> wrote: >> >>> not posible in erlang, but many editors (eg i use textmate) will comment >>> and uncomment multiple lines with % on each line.. >>> On 7 Dec 2010, at 15:32, Zvi wrote: >>> >>>> Hi, >>>> >>>> Matlab/Octave has single line comments, like Erlang (i.e. starting >>>> with '%' sign). But it also have multi-line comments, like for >>>> example: >>>> >>>> %{ >>>> this is example >>>> of multi-line >>>> comments in Matlab >>>> %} >>>> >>>> which is equivalent to: >>>> >>>> %this is example >>>> %of multi-line >>>> %comments in Matlab >>>> >>>> How difficult is to add comments like this to Erlang? >>>> >>>> Thanks, >>>> Zvi >>>> >>>> ________________________________________________________________ >>>> erlang-questions (at) erlang.org mailing list. >>>> See http://www.erlang.org/faq.html >>>> To unsubscribe; mailto:erlang-questions-unsubscribe >>>> >>> >>> >> From andrey.pampukha Tue Dec 7 19:57:34 2010 From: andrey.pampukha (Andrey Pampukha) Date: Tue, 7 Dec 2010 21:57:34 +0300 Subject: [erlang-questions] Ordering of mnesia events In-Reply-To: References: <201012071423.oB7ENvJu062475@pluto.hedeland.org> <5899.194.237.142.6.1291738039.squirrel@lavabit.com> Message-ID: Hi H?kan, 2010/12/7, H?kan Mattsson : > > The order of these events are undefined. In fact it is worse than that > as not all updates do result in an event. If you for example perform > two consecutive writes in the same transaction > > mnesia:write(tab1, SomeOtherRec) > mnesia:write(tab1, YetSomeOtherRec) > > they may result in one or two events depending on table type and the > primary key of the record. If the table is a set and two records have the > same key, only one event will be sent (the last write). Is it really a bug? We've executed a transaction where exactly one object has been changed, and as the result got exactly one notification from Mnesia. I see no problem here. It might be the problem if there were two notifications which arrived _before_ the transation is committed. Also the bug is here if table type is bag and we observe such behaviour... I think, the situation when notification is being sent before the transaction is actually commited, is worse. I'm not sure if this problem does still exist, please correct me if it does not. I've faced it couple of times before. regards, Andrey. From mpalmer Tue Dec 7 20:12:32 2010 From: mpalmer (Matthew Palmer) Date: Wed, 8 Dec 2010 06:12:32 +1100 Subject: mailing list "reply to" In-Reply-To: <4CFDEC12.40508@amberbio.com> References: <4CFCC68A.4010102@allanwegan.de> <4CFCCE70.2040802@amberbio.com> <4CFDDBE2.9090705@allanwegan.de> <4CFDEC12.40508@amberbio.com> Message-ID: <20101207191232.GD4783@hezmatt.org> On Tue, Dec 07, 2010 at 09:10:58AM +0100, Morten Krogh wrote: > It is not so important to me. Don't change it. > But the problem is, of course, that not all MUAs work like yours. > There is no reply to list, which means that one must copy/ paste > addresses around. So fix your MUA. If you choose to use an MUA lacking that feature, then that's your choice. Nobody is forcing you to do more work. On the other hand, if Reply-To is mangled, then people wishing to make private replies *are* forced to do more work. > Also, why are private replies important at all in a mailing list? I think that: Message-ID: is a fairly good demonstration of why they're important. (If that msgid is mangled, as I suspect it is, then blame Google's craptastic mangling algorithm, combined with "ez"mlm's inability to provide a raw view of a mail message) - Matt From robert.virding Tue Dec 7 21:09:07 2010 From: robert.virding (Robert Virding) Date: Tue, 7 Dec 2010 20:09:07 +0000 (GMT) Subject: [erlang-questions] Multi-line comments in Erlang In-Reply-To: <772626376.173381291752322851.JavaMail.root@zimbra> Message-ID: <1047780227.173401291752547889.JavaMail.root@zimbra> This issue comes up occasionally, but so far there has not been enough interest in it to warrant implementing it. It is not really difficult but there are some tricky issues which need solving and it is more difficult to use safely than you would imagine. I personally see no need. Robert ----- "James Churchman" wrote: > oh ok, i get what you mean. Well it can not be done with a Parse > Transform (something i have played with a lot) unless the syntax you > use is still valid erlang, as it wont initially parse. i imagine that > the erlang parser itself could be very easily modified with only a few > lines & writing your own pre-parser thing would be even easier ( <5 > LOC ? ) . Im sure this must have been mentioned a million times b4 & i > guess it's left out as erlang is deliberately small & lean, any editor > can handle doing multiple lines in one go & using ifdef(macro) or > ifndef(macro) are a better way to deactivate code if thats what your > looking for. maybe things like this inspired the language to stay > lean. python : http://www.flickr.com/photos/nicksieger/281055485/ java > : http://www.flickr.com/photos/nicksieger/280662707/in/photostream/ > :-) > > > > On 7 Dec 2010, at 18:20, Rapsey wrote: > > > Is it that important? Any proper programming editor can > comment/uncomment > > multiple lines. > > > > > > Sergej > > > > On Tue, Dec 7, 2010 at 5:49 PM, Zvi . > wrote: > > > >> Why do you think it's not possible? > >> It's just simple change to Erlang source code parser. > >> Probably this should be submitted as EEP, so OTP team will consider > it. > >> > >> On Tue, Dec 7, 2010 at 6:25 PM, James Churchman > >>> wrote: > >> > >>> not posible in erlang, but many editors (eg i use textmate) will > comment > >>> and uncomment multiple lines with % on each line.. > >>> On 7 Dec 2010, at 15:32, Zvi wrote: > >>> > >>>> Hi, > >>>> > >>>> Matlab/Octave has single line comments, like Erlang (i.e. > starting > >>>> with '%' sign). But it also have multi-line comments, like for > >>>> example: > >>>> > >>>> %{ > >>>> this is example > >>>> of multi-line > >>>> comments in Matlab > >>>> %} > >>>> > >>>> which is equivalent to: > >>>> > >>>> %this is example > >>>> %of multi-line > >>>> %comments in Matlab > >>>> > >>>> How difficult is to add comments like this to Erlang? > >>>> > >>>> Thanks, > >>>> Zvi > >>>> > >>>> ________________________________________________________________ > >>>> erlang-questions (at) erlang.org mailing list. > >>>> See http://www.erlang.org/faq.html > >>>> To unsubscribe; mailto:erlang-questions-unsubscribe > >>>> > >>> > >>> > >> -- Robert Virding, Erlang Solutions Ltd. From robert.virding Tue Dec 7 21:13:11 2010 From: robert.virding (Robert Virding) Date: Tue, 7 Dec 2010 20:13:11 +0000 (GMT) Subject: [erlang-questions] Multi-line comments in Erlang In-Reply-To: <6944DFC1-D77D-41E0-A0A7-92811B704ECB@gmail.com> Message-ID: <178058410.173441291752791263.JavaMail.root@zimbra> This issue comes up occasionally, but so far there has not been enough interest in it to warrant implementing it. It is not really difficult but there are some tricky issues which need solving and it is more difficult to use safely than you would imagine. I personally see no need. Robert ----- "James Churchman" wrote: > oh ok, i get what you mean. Well it can not be done with a Parse > Transform (something i have played with a lot) unless the syntax you > use is still valid erlang, as it wont initially parse. i imagine that > the erlang parser itself could be very easily modified with only a few > lines & writing your own pre-parser thing would be even easier ( <5 > LOC ? ) . Im sure this must have been mentioned a million times b4 & i > guess it's left out as erlang is deliberately small & lean, any editor > can handle doing multiple lines in one go & using ifdef(macro) or > ifndef(macro) are a better way to deactivate code if thats what your > looking for. maybe things like this inspired the language to stay > lean. python : http://www.flickr.com/photos/nicksieger/281055485/ java > : http://www.flickr.com/photos/nicksieger/280662707/in/photostream/ > :-) > > > > On 7 Dec 2010, at 18:20, Rapsey wrote: > > > Is it that important? Any proper programming editor can > comment/uncomment > > multiple lines. > > > > > > Sergej > > > > On Tue, Dec 7, 2010 at 5:49 PM, Zvi . > wrote: > > > >> Why do you think it's not possible? > >> It's just simple change to Erlang source code parser. > >> Probably this should be submitted as EEP, so OTP team will consider > it. > >> > >> On Tue, Dec 7, 2010 at 6:25 PM, James Churchman > >>> wrote: > >> > >>> not posible in erlang, but many editors (eg i use textmate) will > comment > >>> and uncomment multiple lines with % on each line.. > >>> On 7 Dec 2010, at 15:32, Zvi wrote: > >>> > >>>> Hi, > >>>> > >>>> Matlab/Octave has single line comments, like Erlang (i.e. > starting > >>>> with '%' sign). But it also have multi-line comments, like for > >>>> example: > >>>> > >>>> %{ > >>>> this is example > >>>> of multi-line > >>>> comments in Matlab > >>>> %} > >>>> > >>>> which is equivalent to: > >>>> > >>>> %this is example > >>>> %of multi-line > >>>> %comments in Matlab > >>>> > >>>> How difficult is to add comments like this to Erlang? > >>>> > >>>> Thanks, > >>>> Zvi > >>>> > >>>> ________________________________________________________________ > >>>> erlang-questions (at) erlang.org mailing list. > >>>> See http://www.erlang.org/faq.html > >>>> To unsubscribe; mailto:erlang-questions-unsubscribe > >>>> > >>> > >>> > >> From dmercer Tue Dec 7 21:19:11 2010 From: dmercer (David Mercer) Date: Tue, 7 Dec 2010 14:19:11 -0600 Subject: [erlang-questions] Re: mailing list "reply to" In-Reply-To: <20101207191232.GD4783@hezmatt.org> References: <4CFCC68A.4010102@allanwegan.de> <4CFCCE70.2040802@amberbio.com> <4CFDDBE2.9090705@allanwegan.de> <4CFDEC12.40508@amberbio.com> <20101207191232.GD4783@hezmatt.org> Message-ID: <008101cb964c\$04a1bae0\$0de530a0\$@com> On Tuesday, December 07, 2010, Matthew Palmer wrote: > On Tue, Dec 07, 2010 at 09:10:58AM +0100, Morten Krogh wrote: > > It is not so important to me. Don't change it. > > But the problem is, of course, that not all MUAs work like yours. > > There is no reply to list, which means that one must copy/ paste > > addresses around. > > So fix your MUA I'd give a thumbs-up to anyone who wrote a new one in Erlang. :-) From per Tue Dec 7 22:03:34 2010 From: per (Per Hedeland) Date: Tue, 7 Dec 2010 22:03:34 +0100 (CET) Subject: [erlang-questions] Re: how do I do the equivalent of ets:tab2list(timer_tab) for BIF timers In-Reply-To: <20101207161824.GA25437@corelatus.se> Message-ID: <201012072103.oB7L3YEa070380@pluto.hedeland.org> Matthias Lang wrote: > >Matt> >In short: A bug in the linux kernel on Au1000 MIPS CPUs causes >Matt> > Erlang's timers and timeouts to go haywire, sometimes. >Matt> > Most likely, nobody but me is affected. Erlang is not the problem. > >Per> Hm, we actually recently had a report that the VM (R13B03) aborted on >Per> startup with "Unexpected behaviour from operating system high resolution >Per> timer" - this is from erl_time_sup.c, and (on Linux) the only reason I >Per> can see is that clock_gettime(CLOCK_MONOTONIC) went backwards (which >Per> should *never* happen, of course). > >I agree that it should never happen. > >In my case, the clock_gettime() timestamp temporarily jumped forwards >by hours and then jumped backwards by about the same amount. That >won't trigger the message you mention, the "unexpected..." message >only pops up if the time jumps backwards further than it was when >Erlang started. Hm yes, I guess it's very unlikely to be the same problem - the abort was "on startup", i.e. within seconds of the hr_init_time setting, so if that setting had been done while the time "was forward-jumped", the subsequent backward-jump would trigger it, but... The reporter can semi-reproduce it, said it happened twice in ten startup attempts - but "never" when running under strace. >I considered adding code to erl_time_sup.c to detect _any_ case of >time going backwards so that it would be easier to detect similar >problems. I decided not to because (a) I didn't want to complicate >Erlang with code to check for buggy OS behaviour and Agreed. > (b) CLOCK_MONOTONIC is a linux-ism, Well, only as far as Erlang VM usage goes - the timer is specified by POSIX.1 and is AFAIK the closest thing to a portable way to get "always goes forwards" time there is - except when it doesn't.:-( See also http://www.erlang.org/cgi-bin/ezmlm-cgi/3/342 which I still haven't done the proper git thing for - it's now working fine in R14B on at least {Free,Net}BSD and QNX. --Per From ok Tue Dec 7 22:56:56 2010 From: ok (Richard O'Keefe) Date: Wed, 8 Dec 2010 10:56:56 +1300 Subject: [erlang-questions] mailing list "reply to" In-Reply-To: <4CFDEC12.40508@amberbio.com> References: <4CFCC68A.4010102@allanwegan.de> <4CFCCE70.2040802@amberbio.com> <4CFDDBE2.9090705@allanwegan.de> <4CFDEC12.40508@amberbio.com> Message-ID: <823A8D49-93D9-4C37-8EEF-87C0352A89F2@cs.otago.ac.nz> On 7/12/2010, at 9:10 PM, Morten Krogh wrote: > Allan, > > It is not so important to me. Don't change it. > But the problem is, of course, that not all MUAs work like yours. I've never seen a mail user agent since mailx that didn't have both 'replysender' and 'replyall'. Heck, even the crude web mail system my wife uses has Reply|all and Reply|sender. > There is no reply to list, Which mail program are you using that does not have this? > which means that one must copy/ paste addresses around. > Also, why are private replies important at all in a mailing list? I send and receive a couple every day. From ok Tue Dec 7 23:14:33 2010 From: ok (Richard O'Keefe) Date: Wed, 8 Dec 2010 11:14:33 +1300 Subject: [erlang-questions] Multi-line comments in Erlang In-Reply-To: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> Message-ID: <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz> On 8/12/2010, at 4:32 AM, Zvi wrote: > Hi, > > Matlab/Octave has single line comments, like Erlang (i.e. starting > with '%' sign). But it also have multi-line comments, like for > example: > > %{ > this is example > of multi-line > comments in Matlab > %} > > which is equivalent to: > > %this is example > %of multi-line > %comments in Matlab > > How difficult is to add comments like this to Erlang? It's worth remembering that Erlang syntax is based on Prolog syntax, and Prolog has always had PL/I-style /*...*/ comments. Somewhere on the way to Erlang, such comments were deliberately *removed* from the language. /* ... */ comments have no known advantages over % comments; with adequate editing tools it is equally easy to "comment out" or "comment in" a region either way and they are equally easy to type or reformat. However, /* ... */ comments come with several risks, which can be ameliorated by syntax colouring to be sure, but not all programmers can see. From alessandro.sivieri Tue Dec 7 23:58:29 2010 From: alessandro.sivieri (Alessandro Sivieri) Date: Tue, 7 Dec 2010 23:58:29 +0100 Subject: Generic server and state recovery Message-ID: Hi all, I was wondering if there is any "standard" way to recover the state of a generic server, or if anyone has ever implemented some recovery method... -- Sivieri Alessandro alessandro.sivieri http://www.chimera-bellerofonte.eu/ http://www.poul.org/ From vances Wed Dec 8 00:20:09 2010 From: vances (Vance Shipley) Date: Tue, 7 Dec 2010 18:20:09 -0500 Subject: [erlang-questions] Generic server and state recovery In-Reply-To: References: Message-ID: <20101207232009.GA62602@h216-235-12-169.host.egate.net> This function will retrieve the status for you: sys:get_status/1 http://erlang.org/doc/man/sys.html#get_status-1 If you implement a format_status/2 callback in your gen_server you can have it pretty print the status data or otherwise dress it up. gen_server:format_status/2 http://erlang.org/doc/man/gen_server.html#format_status-2 On Tue, Dec 07, 2010 at 11:58:29PM +0100, Alessandro Sivieri wrote: } I was wondering if there is any "standard" way to recover the state of a } generic server, or if anyone has ever implemented some recovery method... -- -Vance From jesper.louis.andersen Wed Dec 8 00:41:15 2010 From: jesper.louis.andersen (Jesper Louis Andersen) Date: Wed, 8 Dec 2010 00:41:15 +0100 Subject: [erlang-questions] Multi-line comments in Erlang In-Reply-To: <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz> References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz> Message-ID: On Tue, Dec 7, 2010 at 11:14 PM, Richard O'Keefe wrote: > > /* ... */ comments have no known advantages over % comments; > with adequate editing tools it is equally easy to "comment out" > or "comment in" a region either way and they are equally easy > to type or reformat. Is it, in Prolog acceptable to nest layers of /* .. */ ? It tend to be that case which is hard to implement. Today, I see little need for them. Most editors are fully capable of handling comment sections spanning multiple lines with ease and the vicious idea of commenting out code as a kind of revision control was luckily abolished with the introduction of proper rev. control. -- J. From ok Wed Dec 8 01:06:11 2010 From: ok (Richard O'Keefe) Date: Wed, 8 Dec 2010 13:06:11 +1300 Subject: [erlang-questions] Multi-line comments in Erlang In-Reply-To: References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz> Message-ID: <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> On 8/12/2010, at 12:41 PM, Jesper Louis Andersen wrote: > On Tue, Dec 7, 2010 at 11:14 PM, Richard O'Keefe wrote: >> >> /* ... */ comments have no known advantages over % comments; >> with adequate editing tools it is equally easy to "comment out" >> or "comment in" a region either way and they are equally easy >> to type or reformat. > > Is it, in Prolog acceptable to nest layers of /* .. */ ? No, most definitely NOT. I did say they were PL/I-style comments, which do not nest. Nesting comments are one of those clever ideas that turn out to be really dumb, because they don't actually work. > It tend to be > that case which is hard to implement. As it happens, my Prolog tidier has code to convert plain bracketed comments to standard form *and* nesting bracketed comments to standard form. As you can see, there is not a great deal of difference. static void com2plain(FILE * card, FILE *line, int astcom, int endcom) { int c; int state; enter_comment for (state = 1; (c = getc(card)) >= 0; ) { if (c == endcom && state != 0) break; state = c == astcom; copy_comment(c); } leave_ast_comment if (c < 0) SyntaxError(eofinrem); } static void com2nest(FILE * card, FILE *line, int begcom, int astcom, int endcom) { int c; int state; int level; enter_comment for (state = 1, level = 1; (c = getc(card)) >= 0; ) { if (c == endcom && state == 1) { if (--level == 0) break; } else if (c == astcom && state == 2) { level++; } state = c == astcom ? 1 : c == begcom ? 2 : 0; copy_comment(c); } leave_ast_comment if (c < 0) SyntaxError(eofinrem); } Today I'd do that a bit differently, of course. > Today, I see little need for them. From erlang Wed Dec 8 01:26:06 2010 From: erlang (Stefan Marr) Date: Wed, 8 Dec 2010 01:26:06 +0100 Subject: [erlang-questions] Multi-line comments in Erlang In-Reply-To: <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz> References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz> Message-ID: <2DAEE552-A7F6-4BC8-9C3C-28239100DBA4@stefan-marr.de> Hi: On 07 Dec 2010, at 23:14, Richard O'Keefe wrote: > /* ... */ comments have no known advantages over % comments; > with adequate editing tools it is equally easy to "comment out" > or "comment in" a region either way and they are equally easy > to type or reformat. Very general statement, very specific response: Yes they do! At least for me they are extremely helpful to document parts where I need to work around different compilers in C/C++. Inline comments with /**/ to annotate these things is the only way to keep track of all those nasty things... However, that is neither related to the original question nor related to its usefulness in Erlang... Best Regards Stefan From hm Wed Dec 8 02:24:56 2010 From: hm (=?ISO-8859-1?Q?H=E5kan_Mattsson?=) Date: Wed, 8 Dec 2010 02:24:56 +0100 Subject: [erlang-questions] Ordering of mnesia events In-Reply-To: References: <201012071423.oB7ENvJu062475@pluto.hedeland.org> <5899.194.237.142.6.1291738039.squirrel@lavabit.com> Message-ID: 2010/12/7 Andrey Pampukha : > Hi H?kan, > > 2010/12/7, H?kan Mattsson : >> >> The order of these events are undefined. In fact it is worse than that >> as not all updates do result in an event. If you for example perform >> two consecutive writes in the same transaction >> >> ? mnesia:write(tab1, SomeOtherRec) >> ? mnesia:write(tab1, YetSomeOtherRec) >> >> they may result in one or two events depending on table type and the >> primary key of the record. If the table is a set and two records have the >> same key, only one event will be sent (the last write). > > Is it really a bug? No there is no bug. The behavior is intentional. > I think, the situation when notification is being sent before the > transaction is actually commited, is worse. I'm not sure if this > problem does still exist, please correct me if it does not. I've > faced it couple of times before. I think that your observation is wrong, The table related events has always been sent AFTER Mnesia has decided to commit the transaction. /H?kan From co7eb Wed Dec 8 01:14:12 2010 From: co7eb (=?iso-8859-1?Q?Gilberio_Carmenates_Garc=EDa?=) Date: Tue, 7 Dec 2010 21:14:12 -0300 Subject: [erlang-questions] gen_server and the run-time errors Message-ID: <000001cb966c\$db494e80\$91dbeb80\$@co.cu> Hi! Info, The terminate function isn't called possibility because the gen_server never started, Your problem could be I'm close sure because the init() need to be ended with a {ok, Pid}, Pid could be self(). If you end the init() function with other thing, the same error you saw is threw. Good Example: init(Args)-> process_flag(trap_exit,true), evo_db_module:start(Args), {ok, self()}. Bad Example: init(Args)-> process_flag(trap_exit,true), evo_db_module:start(Args), some_fun_that_not_returns_ok_pid(). =INFO REPORT==== 7-Dec-2010::20:37:58 === application: evo exited: {shutdown,{evo,start,[normal,[{...}]]}} type: temporary Best, Ivan. -----Mensaje original----- De: erlang-questions [mailto:erlang-questions] En nombre de info Enviado el: Martes, 07 de Diciembre de 2010 14:50 Para: erlang-questions Asunto: [erlang-questions] gen_server and the run-time errors Hello, I have a run-time error in the init part of a gen_server. - Init begin by process_flag(trap_exit,true) - gen_server is part of a supervision tree I try to print the reason in the terminate module but it seems to exit elsewhere. - why terminate is not called ? The application stops with shutdown as reason. - How and where to catch the run-time error ? J-Ph. Constantin ITS3 Genhve www.its3.ch ======================================================================= Este mensaje ha sido enviado mediante el servicio de correo electr?nico que ofrece la Federaci?n de Radioaficionados de Cuba a sus miembros para respaldar el cumplimiento de los objetivos de la organizaci?n y su pol?tica informativa. La persona que env?a este correo asume el compromiso de usar el servicio a tales fines y cumplir con las regulaciones establecidas. From ebegumisa Wed Dec 8 07:13:50 2010 From: ebegumisa (Edmond Begumisa) Date: Wed, 08 Dec 2010 17:13:50 +1100 Subject: [erlang-questions] Generic server and state recovery In-Reply-To: References: Message-ID: By "recover", do you mean after an abnormal exit? - Edmond - On Wed, 08 Dec 2010 09:58:29 +1100, Alessandro Sivieri wrote: > Hi all, > > I was wondering if there is any "standard" way to recover the state of a > generic server, or if anyone has ever implemented some recovery method... > -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ From abdoo.mahran Wed Dec 8 07:34:13 2010 From: abdoo.mahran (Abdul Fattah Mahran) Date: Wed, 8 Dec 2010 08:34:13 +0200 Subject: [erlang-questions] Using systools:make_script() raises "*WARNING* inets: Source code not found" In-Reply-To: <20101207115110.GA65800@macbook.server01.org> References: <20101207115110.GA65800@macbook.server01.org> Message-ID: Hello, Ricardo Do not worry about this warning, inets applications will be included in the release. Thanks, Abdul-Fattah On Tue, Dec 7, 2010 at 1:51 PM, Ricardo Catalinas Jim?nez < jimenezrick> wrote: > Hi, > > With R14B release when I run from my app project directory: > > systools:make_script("myapp-rel", [local, {path, ["ebin"]}, {outdir, > "ebin"}]) > > Given that my app depends on `inets', creating the script raises the next > warnings: > > *WARNING* inets: Source code not found: inets.erl > *WARNING* inets: Source code not found: inets_sup.erl > *WARNING* inets: Source code not found: inets_app.erl > ... > ... Missing all sources from `inets' > ... > > It seems that the `src' directory of `inets' is populated with several > subdirectories where the actual code is located: > > \$ERL_ROOT/lib/inets-5.5/src/ > |ftp/ > |http_client/ > |http_lib/ > |http_server/ > |inets_app/ > \tftp/ > > Using `strace' under Linux shows that `make_script()' is not able to > look into that subdirectories. > > > Is there any sane way to make able `make_script()' to find the sources? > > > By the way, the option `no_module_tests' suppress the warning by > disabling that check: > > systools:make_script("myapp-rel", [local, {path, ["ebin"]}, {outdir, > "ebin"}], no_module_tests) > > > Thanks in advance. > -- > Ricardo > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > -- Thanks Best Regards, Abd El-Fattah Mahran Software Developer Customer Adaptation Center, RMEA Ericsson Egypt Ltd, From ebegumisa Wed Dec 8 08:40:25 2010 From: ebegumisa (Edmond Begumisa) Date: Wed, 08 Dec 2010 18:40:25 +1100 Subject: [erlang-questions] Convincing industry to use Erlang In-Reply-To: <20101126195838.M17562@dei.isep.ipp.pt> References: <20101126195838.M17562@dei.isep.ipp.pt> Message-ID: See "Convincing Management To Let Us Continue" http://www.jetcafe.org/~npc/doc/euc00-sendmail.html This is old, but still interesting, and the story sounds relevant. - Edmond - On Sat, 27 Nov 2010 06:59:59 +1100, Paulo Alexandre Ferreira wrote: > > > You better not try to sell Erlang, or any language to managers. > > > You should try selling a reliable, robust, fault-tolerant, code > verified system. > You will do code upgrades without stopping the system. > You can offer proofs the system is correct. > > > They don't want Erlang. They don't care about Erlang. > > You will use Erlang to build the system they want. > > The advantages of language X,Y or Z are the stuff programmers care about. > Managers care about different things like costs, down-time, > reliability. > Focus on that. > > > My apologies if I sound a little bit grumpy. > > Paulo Ferreira > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ From jensli Wed Dec 8 09:12:20 2010 From: jensli (jensli) Date: Wed, 8 Dec 2010 03:12:20 -0500 (EST) Subject: [erlang-questions] Ordering of mnesia events In-Reply-To: References: <201012071423.oB7ENvJu062475@pluto.hedeland.org> <5899.194.237.142.6.1291738039.squirrel@lavabit.com> Message-ID: <29530.194.237.142.20.1291795940.squirrel@lavabit.com> Thanks for your answer. Ok, so when operations happen in a transactions we cant be sure about much, only that all the operations in the transaction are considered to happen at once with no defined order, and we can only expect events that reflect the final result of the transaction. But what about dirty operations? Same table: mnesia:dirty_delete(tab1, SomeRec), mnesia:dirty_write(tab1, SomeOtherRec) Different tables: mnesia:dirty_write(tab1, SomeRec), mnesia:dirty_write(tab2, SomeOtherRec), Obviously, they will happen in a defined order. But does that also hold for the events? On all nodes? /JL > > The order of these events are undefined. In fact it is worse than that > as not all updates do result in an event. If you for example perform > two consecutive writes in the same transaction > > mnesia:write(tab1, SomeOtherRec) > mnesia:write(tab1, YetSomeOtherRec) > /H?kan > On Tue, Dec 7, 2010 at 5:07 PM, wrote: >> Hi, >> >> We?re developing an application where multiple processes on different >> nodes in a distributed system subscribe to mnesia events. The table is >> written to from one single process on one of the nodes. >> >> However uncertainty has arose about if we can be sure to receive the >> events in the same order as operations on the table. >> >> E.g: >> mnesia:delete(tab1, SomeRec), >> mnesia:write(tab1, SomeOtherRec) > > The order of these events are undefined. In fact it is worse than that > as not all updates do result in an event. If you for example perform > two consecutive writes in the same transaction > > mnesia:write(tab1, SomeOtherRec) > mnesia:write(tab1, YetSomeOtherRec) > > they may result in one or two events depending on table type and the > primary key of the record. If the table is a set and two records have the > same key, only one event will be sent (the last write). > >> If we sometimes get the delete event after the write event our design >> would not work and we would have to create some other kind of >> notification >> mechanism. >> >> Also, what about operations on different tables (from the same process)? >> >> mnesia:write(tab1, SomeRec), >> mnesia:write(tab2, SomeOtherRec) >> >> Can we be sure to always get the event from tab1 before the one from >> tab2? >> On all processes and all nodes? > > No. > > /H?kan > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From robert.virding Wed Dec 8 10:24:08 2010 From: robert.virding (Robert Virding) Date: Wed, 8 Dec 2010 09:24:08 +0000 (GMT) Subject: [erlang-questions] gen_server and the run-time errors In-Reply-To: <1199949214.173901291799945558.JavaMail.root@zimbra> Message-ID: <1964671475.173951291800248928.JavaMail.root@zimbra> IIRC it is so, terminate/1 is not called if there is an error in init/1. I remember having read about it somewhere but can't find it now. The closest I could come up with is in http://erlang.org/doc/man/gen_server.html#start_link-3 where it says: "If Module:init/1 fails with Reason, the function returns {error,Reason}. If Module:init/1 returns {stop,Reason} or ignore, the process is terminated and the function returns {error,Reason} or ignore, respectively." Also the documentation explicitly mentions how to return a value from other callback functions which causes the server to call terminate/1 and then terminate, but no mention of terminate is made in the docs for init/1. The logic is I suppose that if you haven't completed initialisation then there is nothing to clean-up after. Robert ----- "Gilberio Carmenates Garc?a" wrote: > Hi! Info, > > The terminate function isn't called possibility because the gen_server > never > started, > Your problem could be I'm close sure because the init() need to be > ended > with a {ok, Pid}, Pid could be self(). If you end the init() function > with > other thing, the same error you saw is threw. > > > Good Example: > > init(Args)-> > process_flag(trap_exit,true), > evo_db_module:start(Args), > {ok, self()}. > > > Bad Example: > > init(Args)-> > process_flag(trap_exit,true), > evo_db_module:start(Args), > some_fun_that_not_returns_ok_pid(). > > > =INFO REPORT==== 7-Dec-2010::20:37:58 === > application: evo > exited: {shutdown,{evo,start,[normal,[{...}]]}} > type: temporary > > Best, > > Ivan. > > > -----Mensaje original----- > De: erlang-questions [mailto:erlang-questions] > En > nombre de info > Enviado el: Martes, 07 de Diciembre de 2010 14:50 > Para: erlang-questions > Asunto: [erlang-questions] gen_server and the run-time errors > > Hello, > I have a run-time error in the init part of a gen_server. > - Init begin by process_flag(trap_exit,true) > - gen_server is part of a supervision tree > I try to print the reason in the terminate module but it seems to > exit > elsewhere. > - why terminate is not called ? > The application stops with shutdown as reason. > - How and where to catch the run-time error ? > > J-Ph. Constantin > ITS3 Genhve > www.its3.ch > > > ======================================================================= > Este mensaje ha sido enviado mediante el servicio de correo > electr?nico que ofrece la Federaci?n de Radioaficionados de Cuba a sus > miembros para respaldar el cumplimiento de los objetivos de la > organizaci?n y su pol?tica informativa. La persona que env?a este > correo asume el compromiso de usar el servicio a tales fines y > cumplir con las regulaciones establecidas. > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe From hynek Wed Dec 8 11:00:14 2010 From: hynek (Hynek Vychodil) Date: Wed, 8 Dec 2010 11:00:14 +0100 Subject: [erlang-questions] Some problem abount exit signal? In-Reply-To: <1961267518.160571291512962518.JavaMail.root@zimbra> References: <221232064.160551291512723274.JavaMail.root@zimbra> <1961267518.160571291512962518.JavaMail.root@zimbra> Message-ID: I few moment I think there is the bug but after some experiments I have to say it is pretty clear here. exit/1 doesn't sends any signal. It is simple "local exception" - termination which is catchable in catch and try. When it is not catch process terminates as usual and sends exit message to linked processes with reason. 'kill' reason is send as any other reason. There is not special meaning except 'normal' ... exit/2 sends message and only when there is 'kill' reason it makes "untrappable" kill and is translated to 'killed' exit message to linked processes. exit/2 sends message which doesn't have "local" behavior even I send it to myself because it is just like any other message. I.e. it is uncatchable by catch or try. When exit signal is not trapped i.e. it is untrappable (only direct exit/2 'kill') or is not 'normal' and exit signals are not trapped then process dies and exit signal is resend to linked processes with reason translation to 'killed' just only for untrappable 'kill'. It makes perfect sense for me and I can't see there any bug or misconception. Maybe documentation should be more explicit there. On Sun, Dec 5, 2010 at 2:36 AM, Robert Virding wrote: > Yes, this is how it works, but I definitely consider this to be a bug. To elaborate with a simple example: > > 1> self(). > <0.31.0> > 2> spawn_link(fun () -> exit(kill) end). > ** exception exit: killed > 3> self(). > <0.35.0> > > Here I have received 'kill' signal and died as I should. Now I trap exits: > > 4> process_flag(trap_exit, true). > false > 5> spawn_link(fun () -> exit(kill) end). > <0.39.0> > 6> flush(). > Shell got {'EXIT',<0.39.0>,kill} > ok > > This time I received a trappable 'kill' signal. Finally I explicitly send the 'kill' signal to me: > > 7> Self = self(). > <0.35.0> > 8> process_flag(trap_exit, true). ? ? ? ? ?%Just to be explicit > true > 9> spawn_link(fun () -> exit(Self, kill) end). > ** exception exit: killed > 10> self(). > <0.45.0> > > And this time I received an untrappable 'kill' signal. > > This means that there are two different types of 'kill' signals, trappable and untrappable, in the systems depending on how they were sent. This is illogical and unclear as there should not be two different signals with the same name which behave differently. It is definitely a bug which should be fixed. I see two (three) different solutions: > > 1. Make it so that a process which does exit(kill) sends a real, untrappable kill signal to its link set (which then in turn transmit 'killed'). > > 2. Make it so that a process which does exit(kill) behaves as if it were killed and so transmits 'killed' to its link set. > > 3. Leave it as it is and create a 'properly_behaving_really_untrappable_kill' signal which behaves sensibly. > > I think the first option is the best. > > Robert > > P.S. Now to copy all this to erlang-bugs. > > P.P.S. I have just noticed that doing exit(self(), normal) kills me while some other process doing exit(Me, normal) doesn't. Sigh, so normal isn't normal. > > > ----- "Ulf Wiger" wrote: > >> Process C terminates itself with exit(kill). The atom 'kill' >> is not special in this case, but simply a normal exit reason. >> >> A propagated exit signal can never act as a kill signal in the >> first place, but here, not even the original exit is an untrappable >> kill. >> >> Try: >> >> Eshell V5.8.1 ?(abort with ^G) >> 1> self(). >> <0.31.0> >> 2> catch exit(kill). >> {'EXIT',kill} >> 3> self(). >> <0.31.0> >> >> BR, >> Ulf W >> >> On 2 Dec 2010, at 05:37, sky wrote: >> >> > Hi guys, >> > >> > In the Joe's book <>, page 163, there are some >> description about exit signal : >> > >> > When an exit signal arrives at a process, then a number of >> different >> > things might happen. What happens depends upon the state of the >> > receiving process and upon the value of the exit signal and is >> deter- >> > mined by the following table: >> > >> > >> > but when use edemo1:start(true, {die, kill}), the result is: >> > >> > edemo1:start(true, {die,kill}). >> > Process b received {'EXIT',<0.73.0>,kill} >> > process b (<0.72.0>) is alive >> > process c (<0.73.0>) is dead >> > ok >> > Why process b is alive? Cause as the descripion in this book, ?when >> the exit signal >> > {'EXIT',<0.73.0>,kill} >> > arrived, the process b will die and broadcast the exit signal killed >> to the link set. >> > >> > the souce code of edemo1 module as following: >> > >> > %% --- >> > %% ?Excerpted from "Programming Erlang", >> > %% ?published by The Pragmatic Bookshelf. >> > %% ?Copyrights apply to this code. It may not be used to create >> training material, >> > %% ?courses, books, articles, and the like. Contact us if you are in >> doubt. >> > %% ?We make no guarantees that this code is fit for any purpose. >> > %% ?Visit http://www.pragmaticprogrammer.com/titles/jaerlang for >> more book information. >> > %%--- >> > >> > -module(edemo1). >> > -export([start/2]). >> > >> > start(Bool, M) -> >> > ? ? A = spawn(fun() -> a() end), >> > ? ? B = spawn(fun() -> b(A, Bool) end), >> > ? ? C = spawn(fun() -> c(B, M) end), >> > ? ? sleep(1000), >> > ? ? status(b, B), >> > ? ? status(c, C). >> > >> > >> > a() -> >> > ? ? process_flag(trap_exit, true), >> > ? ? wait(a). >> > >> > b(A, Bool) -> >> > ? ? process_flag(trap_exit, Bool), >> > ? ? link(A), >> > ? ? wait(b). >> > >> > c(B, M) -> >> > ? ? link(B), >> > ? ? case M of >> > ? ? {die, Reason} -> >> > ? ? ? ? exit(Reason); >> > ? ? {divide, N} -> >> > ? ? ? ? 1/N, >> > ? ? ? ? wait(c); >> > ? ? normal -> >> > ? ? ? ? true >> > ? ? end. >> > >> > >> > >> > wait(Prog) -> >> > ? ? receive >> > ? ? Any -> >> > ? ? ? ? io:format("Process ~p received ~p~n",[Prog, Any]), >> > ? ? ? ? wait(Prog) >> > ? ? end. >> > >> > >> > >> > sleep(T) -> >> > ? ? receive >> > ? ? after T -> true >> > ? ? end. >> > >> > status(Name, Pid) -> >> > ? ? case erlang:is_process_alive(Pid) of >> > ? ? true -> >> > ? ? ? ? io:format("process ~p (~p) is alive~n", [Name, Pid]); >> > ? ? false -> >> > ? ? ? ? io:format("process ~p (~p) is dead~n", [Name,Pid]) >> > ? ? end. >> > >> > >> >> Ulf Wiger, CTO, Erlang Solutions, Ltd. >> http://erlang-solutions.com > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > -- --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 spawn.think Wed Dec 8 11:11:32 2010 From: spawn.think (Ahmed Omar) Date: Wed, 8 Dec 2010 11:11:32 +0100 Subject: [erlang-questions] gen_server and the run-time errors In-Reply-To: <1964671475.173951291800248928.JavaMail.root@zimbra> References: <1199949214.173901291799945558.JavaMail.root@zimbra> <1964671475.173951291800248928.JavaMail.root@zimbra> Message-ID: For the last question, it will be useful to start sasl before starting your application. Ivan, init in gen_server should return {ok, State} not {ok, pid()} http://www.erlang.org/doc/man/gen_server.html#Module:init-1 2010/12/8 Robert Virding > IIRC it is so, terminate/1 is not called if there is an error in init/1. I > remember having read about it somewhere but can't find it now. The closest I > could come up with is in > http://erlang.org/doc/man/gen_server.html#start_link-3 where it says: > > "If Module:init/1 fails with Reason, the function returns {error,Reason}. > If Module:init/1 returns {stop,Reason} or ignore, the process is terminated > and the function returns {error,Reason} or ignore, respectively." > > Also the documentation explicitly mentions how to return a value from other > callback functions which causes the server to call terminate/1 and then > terminate, but no mention of terminate is made in the docs for init/1. > > The logic is I suppose that if you haven't completed initialisation then > there is nothing to clean-up after. > > Robert > > ----- "Gilberio Carmenates Garc?a" wrote: > > > Hi! Info, > > > > The terminate function isn't called possibility because the gen_server > > never > > started, > > Your problem could be I'm close sure because the init() need to be > > ended > > with a {ok, Pid}, Pid could be self(). If you end the init() function > > with > > other thing, the same error you saw is threw. > > > > > > Good Example: > > > > init(Args)-> > > process_flag(trap_exit,true), > > evo_db_module:start(Args), > > {ok, self()}. > > > > > > Bad Example: > > > > init(Args)-> > > process_flag(trap_exit,true), > > evo_db_module:start(Args), > > some_fun_that_not_returns_ok_pid(). > > > > > > =INFO REPORT==== 7-Dec-2010::20:37:58 === > > application: evo > > exited: {shutdown,{evo,start,[normal,[{...}]]}} > > type: temporary > > > > Best, > > > > Ivan. > > > > > > -----Mensaje original----- > > De: erlang-questions [mailto:erlang-questions] > > En > > nombre de info > > Enviado el: Martes, 07 de Diciembre de 2010 14:50 > > Para: erlang-questions > > Asunto: [erlang-questions] gen_server and the run-time errors > > > > Hello, > > I have a run-time error in the init part of a gen_server. > > - Init begin by process_flag(trap_exit,true) > > - gen_server is part of a supervision tree > > I try to print the reason in the terminate module but it seems to > > exit > > elsewhere. > > - why terminate is not called ? > > The application stops with shutdown as reason. > > - How and where to catch the run-time error ? > > > > J-Ph. Constantin > > ITS3 Genhve > > www.its3.ch > > > > > > ======================================================================= > > Este mensaje ha sido enviado mediante el servicio de correo > > electr?nico que ofrece la Federaci?n de Radioaficionados de Cuba a sus > > miembros para respaldar el cumplimiento de los objetivos de la > > organizaci?n y su pol?tica informativa. La persona que env?a este > > correo asume el compromiso de usar el servicio a tales fines y > > cumplir con las regulaciones establecidas. > > > > > > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > See http://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscribe > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think From hm Wed Dec 8 11:17:47 2010 From: hm (=?ISO-8859-1?Q?H=E5kan_Mattsson?=) Date: Wed, 8 Dec 2010 11:17:47 +0100 Subject: [erlang-questions] Ordering of mnesia events In-Reply-To: <29530.194.237.142.20.1291795940.squirrel@lavabit.com> References: <201012071423.oB7ENvJu062475@pluto.hedeland.org> <5899.194.237.142.6.1291738039.squirrel@lavabit.com> <29530.194.237.142.20.1291795940.squirrel@lavabit.com> Message-ID: 2010/12/8 : > Thanks for your answer. > > Ok, so when operations happen in a transactions we cant be sure about > much, only that all the operations in the transaction are considered to > happen at once with no defined order, and we can only expect events that > reflect the final result of the transaction. > > But what about dirty operations? > > Same table: > mnesia:dirty_delete(tab1, SomeRec), > mnesia:dirty_write(tab1, SomeOtherRec) > > Different tables: > mnesia:dirty_write(tab1, SomeRec), > mnesia:dirty_write(tab2, SomeOtherRec), > > Obviously, they will happen in a defined order. But does that also hold > for the events? If it is the same process that performs all these dirty calls and the involved tables resides on the local node, the events will be delivered in the same order as they are performed to subscribers on the local node. This is the current behavior and it is very unlikely to be changed. But as it not is explicitly stated in the documentation you should not rely on the current behavior. > On all nodes? There is no global ordering in the sense that event #1 will be delivered to subscribers on all nodes before event #2 is delivered. But the events will occur in the same order on all nodes which have a replica of the table if it is the dirty updates originates from the same process. But as this is not documented... /H?kan From avtobiff Wed Dec 8 12:00:27 2010 From: avtobiff (Per Andersson) Date: Wed, 8 Dec 2010 12:00:27 +0100 Subject: TCP port sends EXIT message Message-ID: Hi there! I have followed the non-blocking TCP server tutorial [0] and now, on a specific message, I want the acceptor fsm to use my connection manager and hand over the socket to another gen_fsm. When this is done the gen_fsm that should take control over the socket crashes because the TCP socket sends a message {'EXIT', #Port<0.1024>, normal} which it does not handle. Also, the socket is closed. Basically in some short code ACCEPTOR receive {tcp, Socket, <<"CONTROL MESSAGE">>} -> Best, Per From avtobiff Wed Dec 8 12:22:18 2010 From: avtobiff (Per Andersson) Date: Wed, 8 Dec 2010 12:22:18 +0100 Subject: TCP port sends EXIT message In-Reply-To: References: Message-ID: Hi again! I slipped on the keyboard, sorry for the noise. Continuing inline. On Wed, Dec 8, 2010 at 12:00 PM, Per Andersson wrote: > Hi there! > > I have followed the non-blocking TCP server tutorial [0] and now, on a specific > message, I want the acceptor fsm to use my connection manager and hand over the > socket to another gen_fsm. ?When this is done the gen_fsm that should take > control over the socket crashes because the TCP socket sends a message > {'EXIT', #Port<0.1024>, normal} which it does not handle. Also, the socket is > closed. > > Basically in some short code TCP options user are [binary, {packet, raw}, {active, false}, {reuseaddr, true}, {keepalive, true}, {backlog, 30}]). ACCEPTOR (is a gen_fsm) ... receive {tcp, Socket, <<"CTRL MSG">>} -> {ok, Pid} = manager:hand_over(Socket), ok = gen_tcp:controlling_process(Socket, Pid) end MANAGER (is a gen_server but this is basically what is handled) hand_over(Socket) -> Pid = find_other_fsm(), gen_fsm:send_event(Pid, {hand_over, Socket}), {ok, Pid}. OTHER_FSM (is a gen_fsm, states 'WAIT_FOR_SOCKET' and 'DO') handle_info({tcp, Socket, Bin}, StateName, StateData = [{socket, Socket}]) -> ok = inet:setopts(Socket, [{active, once}]), ?MODULE:StateName({do, Bin}, StateData). 'WAIT_FOR_SOCKET'({hand_over, Socket}, _StateData) -> StateData = [{socket, Socket}], {next_state, 'DO', StateData, 60000}. 'DO'({do, Bin}, StateData = [{socket, Socket}]) -> %% do something... {next_state, 'DO', StateData, 60000}. What I want to achieve is to connect to the acceptor, send the control message and then let the OTHER_FSM continue handling the socket. I found an old unanswered question [1] in the archive but no response to it. Thankful for all help and pointers! [0] http://www.trapexit.org/Building_a_Non-blocking_TCP_server_using_OTP_principles [1] http://www.erlang.org/cgi-bin/ezmlm-cgi/4/3230 Best, Per From alessandro.sivieri Wed Dec 8 12:29:40 2010 From: alessandro.sivieri (Alessandro Sivieri) Date: Wed, 8 Dec 2010 12:29:40 +0100 Subject: [erlang-questions] Generic server and state recovery In-Reply-To: References: Message-ID: 2010/12/8 Edmond Begumisa > By "recover", do you mean after an abnormal exit? > > Yes, for example after a crash, when the supervisor restarts the process... -- Sivieri Alessandro alessandro.sivieri http://www.chimera-bellerofonte.eu/ http://www.poul.org/ From ebegumisa Wed Dec 8 14:24:28 2010 From: ebegumisa (Edmond Begumisa) Date: Thu, 09 Dec 2010 00:24:28 +1100 Subject: [erlang-questions] Generic server and state recovery In-Reply-To: References: Message-ID: You could implement this functionality in to your gen_server (that is trapping exits) using the terminate callback, persisting the state for recovery later or sending it to another process just before the gen_server process itself exits... init() -> process_flag(trap_exit, true), ... terminate(normal, State) -> ignore; terminate(_Crash, State) -> ok = save_crashing_state(State), ignore. save_crashing_state(State) -> % do something with State ... - Edmond - On Wed, 08 Dec 2010 22:29:40 +1100, Alessandro Sivieri wrote: > 2010/12/8 Edmond Begumisa > >> By "recover", do you mean after an abnormal exit? >> >> > Yes, for example after a crash, when the supervisor restarts the > process... > -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ From ebegumisa Wed Dec 8 14:30:36 2010 From: ebegumisa (Edmond Begumisa) Date: Thu, 09 Dec 2010 00:30:36 +1100 Subject: [erlang-questions] Generic server and state recovery In-Reply-To: References: Message-ID: Oops, forgot a few clauses in that terminate function... terminate(normal, State) -> ignore; terminate(shutdown, State) -> ignore; terminate({shutdown,_}, State) -> ignore; terminate(_Crash, State) -> ok = save_crashing_state(State), ignore. - Edmond - On Thu, 09 Dec 2010 00:24:28 +1100, Edmond Begumisa wrote: > You could implement this functionality in to your gen_server (that is > trapping exits) using the terminate callback, persisting the state for > recovery later or sending it to another process just before the > gen_server process itself exits... > > init() -> > process_flag(trap_exit, true), > ... > > terminate(normal, State) -> > ignore; > terminate(_Crash, State) -> > ok = save_crashing_state(State), > ignore. > > save_crashing_state(State) -> > % do something with State > ... > > - Edmond - > > > On Wed, 08 Dec 2010 22:29:40 +1100, Alessandro Sivieri > wrote: > >> 2010/12/8 Edmond Begumisa >> >>> By "recover", do you mean after an abnormal exit? >>> >>> >> Yes, for example after a crash, when the supervisor restarts the >> process... >> > > -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ From dmercer Wed Dec 8 15:39:42 2010 From: dmercer (David Mercer) Date: Wed, 8 Dec 2010 08:39:42 -0600 Subject: [erlang-questions] Multi-line comments in Erlang In-Reply-To: <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz> <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> Message-ID: <00a601cb96e5\$c12d74d0\$43885e70\$@com> On Tuesday, December 07, 2010, Richard O'Keefe wrote: > Nesting comments are one of those clever ideas > that turn out to be really dumb, because they don't actually work. I'll bite, mainly because I've sometimes thought nesting comments would be helpful, for instance, when commenting out large blocks of code, but it is rare that I get to work with a language that supports them. Since you're almost always right about such things, why do you say that they don't actually work? Cheers, David From kenneth.lundin Wed Dec 8 15:49:20 2010 From: kenneth.lundin (Kenneth Lundin) Date: Wed, 8 Dec 2010 15:49:20 +0100 Subject: Erlang/OTP R14B01 has been released Message-ID: Erlang/OTP R14B01 has been released. This release is mainly a stabilization of the R14B01 release (but there are some new functionality as well). You can find the README file for the release at http://www.erlang.org/download/otp_src_R14B01.readme The source distribution and binary distribution for Windows can be downloaded from http://www.erlang.org/download/otp_src_R14B01.tar.gz http://www.erlang.org/download/otp_win32_R14B01.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_R14B01.tar.gz.torrent http://www.erlang.org/download/otp_win32_R14B01.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_R14B01.tar.gz http://www.erlang.org/download/otp_doc_man_R14B01.tar.gz We also want to thank those that sent us patches, suggestions and bug reports, The Erlang/OTP Team Kenneth Lundin, Erlang/OTP, Ericsson AB From kenneth.lundin Wed Dec 8 15:49:20 2010 From: kenneth.lundin (Kenneth Lundin) Date: Wed, 8 Dec 2010 15:49:20 +0100 Subject: Erlang/OTP R14B01 has been released Message-ID: Erlang/OTP R14B01 has been released. This release is mainly a stabilization of the R14B01 release (but there are some new functionality as well). You can find the README file for the release at http://www.erlang.org/download/otp_src_R14B01.readme The source distribution and binary distribution for Windows can be downloaded from http://www.erlang.org/download/otp_src_R14B01.tar.gz http://www.erlang.org/download/otp_win32_R14B01.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_R14B01.tar.gz.torrent http://www.erlang.org/download/otp_win32_R14B01.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_R14B01.tar.gz http://www.erlang.org/download/otp_doc_man_R14B01.tar.gz We also want to thank those that sent us patches, suggestions and bug reports, The Erlang/OTP Team Kenneth Lundin, Erlang/OTP, Ericsson AB From ebegumisa Wed Dec 8 16:15:14 2010 From: ebegumisa (Edmond Begumisa) Date: Thu, 09 Dec 2010 02:15:14 +1100 Subject: Speaking of comments In-Reply-To: <00a601cb96e5\$c12d74d0\$43885e70\$@com> References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz> <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> <00a601cb96e5\$c12d74d0\$43885e70\$@com> Message-ID: I've thought -- now and then, in the back of my mind -- about removing comments from actual source all-together (for all languages) and instead, putting them in companion files that the editor lines up side-by-side. More like annotating than just traditional commenting. Has this sort of thing been done before? Is there a particular editor that can give me this out of the box? (I admittedly haven't explored a large number of editors) Using Erlang as an example, I've secretly wanted something like... foo.erl foo.cts Then an editor that could give me two panes while keeping the two files in sync... foo -> | This function does... blah | This part is buggy... balh | Also, in the right pane, I've wanted nestable trees with flexible levels of detail. Heck, why not even rich text? "FIX ME" in bold red. Take it further: login-name awareness, source-control/bug-tracker integration (this programmer said this, that programmer said that.) It seems a shame that in 2010, it's still so limiting what we can do with comments in our source code! - Edmond - On Thu, 09 Dec 2010 01:39:42 +1100, David Mercer wrote: > On Tuesday, December 07, 2010, Richard O'Keefe wrote: > >> Nesting comments are one of those clever ideas >> that turn out to be really dumb, because they don't actually work. > > I'll bite, mainly because I've sometimes thought nesting comments would > be > helpful, for instance, when commenting out large blocks of code, but it > is > rare that I get to work with a language that supports them. Since you're > almost always right about such things, why do you say that they don't > actually work? > > Cheers, > > David > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ From bengt.kleberg Wed Dec 8 16:27:38 2010 From: bengt.kleberg (Bengt Kleberg) Date: Wed, 8 Dec 2010 16:27:38 +0100 Subject: [erlang-questions] Multi-line comments in Erlang In-Reply-To: <00a601cb96e5\$c12d74d0\$43885e70\$@com> References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz> <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> <00a601cb96e5\$c12d74d0\$43885e70\$@com> Message-ID: <1291822058.4924.25.camel@seasc1137> Greetings, For commenting out code, it is possible to use: -ifdef(never_defined). ...code -endif(). bengt On Wed, 2010-12-08 at 15:39 +0100, David Mercer wrote: > On Tuesday, December 07, 2010, Richard O'Keefe wrote: > > > Nesting comments are one of those clever ideas > > that turn out to be really dumb, because they don't actually work. > > I'll bite, mainly because I've sometimes thought nesting comments would be > helpful, for instance, when commenting out large blocks of code, but it is > rare that I get to work with a language that supports them. Since you're > almost always right about such things, why do you say that they don't > actually work? > > Cheers, > > David > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > From fred.hebert Wed Dec 8 16:33:28 2010 From: fred.hebert (=?iso-8859-1?Q?Fr=E9d=E9ric_Trottier-H=E9bert?=) Date: Wed, 8 Dec 2010 10:33:28 -0500 Subject: [erlang-questions] Multi-line comments in Erlang In-Reply-To: <1291822058.4924.25.camel@seasc1137> References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz> <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> <00a601cb96e5\$c12d74d0\$43885e70\$@com> <1291822058.4924.25.camel@seasc1137> Message-ID: This will only work around a form (function definition, module attribute), and not within it. You won't be able to comment out only a branch of a case, or part of a function definition. Only the whole thing. This makes it less useful when wanting to comment out clauses of an OTP module. I've found the lack of multiline comments annoying in the past, but most of the time, having the editor (vim in my case) handle it for me has been fine most of the time. It fails at commenting only part of a line when doing very specific tests and debugging, but that's about it. -- Fred H?bert http://www.erlang-solutions.com On 2010-12-08, at 10:27 AM, Bengt Kleberg wrote: > Greetings, > > For commenting out code, it is possible to use: > > -ifdef(never_defined). > ...code > -endif(). > > > bengt > > On Wed, 2010-12-08 at 15:39 +0100, David Mercer wrote: >> On Tuesday, December 07, 2010, Richard O'Keefe wrote: >> >>> Nesting comments are one of those clever ideas >>> that turn out to be really dumb, because they don't actually work. >> >> I'll bite, mainly because I've sometimes thought nesting comments would be >> helpful, for instance, when commenting out large blocks of code, but it is >> rare that I get to work with a language that supports them. Since you're >> almost always right about such things, why do you say that they don't >> actually work? >> >> Cheers, >> >> David >> >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe >> > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > From spawn.think Wed Dec 8 17:06:27 2010 From: spawn.think (Ahmed Omar) Date: Wed, 8 Dec 2010 17:06:27 +0100 Subject: [erlang-questions] How to change the node to mnesia In-Reply-To: <000001cb917e\$138b1560\$3aa14020\$@co.cu> References: <000001cb917e\$138b1560\$3aa14020\$@co.cu> Message-ID: http://www.erlang.org/doc/apps/mnesia/Mnesia_chap7.html#id76583 2010/12/1 Gilberio Carmenates Garc?a > Hi all! > > > > I have a little problem with my system EVO, > > e.g. If I have already created a mnesia database and it creates a folder > Mnesia.node_name > > so if I want to change the node name without reinstalling the database > using > mnesia:create in the new node > > because I want to pass the information that I already had in the old node > to > this new one and create a new folder > > Mnesia.new_node_name > > > > Exists any external tool to do that without entering in Erlang code to > checkpoints or replicates the database. > > > > I mean, there are any external tool to migrate the database to other nodes. > > > > > > Regards, > > > > Ivan. > > > > > > > > ======================================================================= > Este mensaje ha sido enviado mediante el servicio de correo electr?nico que > ofrece la Federaci?n de Radioaficionados de Cuba a sus miembros para > respaldar el cumplimiento de los objetivos de la organizaci?n y su pol?tica > informativa. La persona que env?a este correo asume el compromiso de usar > el servicio a tales fines y cumplir con las regulaciones establecidas. > -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think From info Wed Dec 8 17:51:13 2010 From: info (info) Date: Wed, 8 Dec 2010 17:51:13 +0100 Subject: [erlang-questions] gen_server and the run-time errors References: <000001cb966c\$db494e80\$91dbeb80\$@co.cu> Message-ID: <201012081751113289712@its3.ch> Hi, I have this ok ! init()-> process_flag(trap_exit,true), handle_A(), {ok,0}. handle_A()-> Pid=proc_lib:spawn_link(...), ets:insert(?MODULE,{Pid,0}), <<<< this line provokes the shutdown ok. I know my error but I would like to see on the screen the "Reason" and not "shutdown": I lost information somewhere ! J-Ph. Constantin ITS3 Gen?ve www.its3.ch From vances Wed Dec 8 17:51:01 2010 From: vances (Vance Shipley) Date: Wed, 8 Dec 2010 11:51:01 -0500 Subject: [erlang-questions] How to change the node to mnesia In-Reply-To: References: <000001cb917e\$138b1560\$3aa14020\$@co.cu> Message-ID: <20101208165054.GC97702@h216-235-12-173.host.egate.net> On Wed, Dec 08, 2010 at 05:06:27PM +0100, Ahmed Omar wrote: } http://www.erlang.org/doc/apps/mnesia/Mnesia_chap7.html#id76583 ... except that was a problem with that method which I uncovered and detailed here: http://www.erlang.org/cgi-bin/ezmlm-cgi?4:msp:53900:neclcneoonabdcaolmlh ... and lo and behold today's R14B01 release fixes it!: OTP-8960 Sometimes a 'log_header' record was added to tables when invoking mnesia:restore/2 with the option 'recreate_tables'. Thanks Dan! -- -Vance From info Wed Dec 8 17:56:22 2010 From: info (=?utf-8?B?aW5mbw==?=) Date: Wed, 8 Dec 2010 17:56:22 +0100 Subject: =?utf-8?B?UmU6IFJlOiBbZXJsYW5nLXF1ZXN0aW9uc10gZ2VuX3NlcnZlciBhbmQgdGhlIHJ1bi10aW1lIGVycm9ycw==?= References: <1964671475.173951291800248928.JavaMail.root@zimbra> Message-ID: <201012081756214685508@its3.ch> yes and no ... My supervisor print the Reason in case of {error,Reason} ! And, in my case, it doesn't print ! J-Ph. Constantin ITS3 Gen?ve www.its3.ch From vances Wed Dec 8 18:01:41 2010 From: vances (Vance Shipley) Date: Wed, 8 Dec 2010 12:01:41 -0500 Subject: Happy Duodecennial! Message-ID: <20101208170141.GD97702@h216-235-12-173.host.egate.net> To our esteemed colleagues, past and present, of the OTP group; happy twelfth anniversary of the opensource release! http://web.archive.org/web/19991009002753/www.erlang.se/onlinenews/ErlangOTPos.shtml Thank you, thank you, thank you. -- -Vance From co7eb Wed Dec 8 20:30:04 2010 From: co7eb (Gilberto Carmenate =?iso-8859-1?Q?Garc=EDa?=) Date: Wed, 08 Dec 2010 14:30:04 -0500 Subject: [erlang-questions] gen_server and the run-time errors In-Reply-To: References: <1199949214.173901291799945558.JavaMail.root@zimbra> <1964671475.173951291800248928.JavaMail.root@zimbra> Message-ID: Hi, yes a little mistake since I've been a while that I don't touch that kind of things lol Best, Ivan. -----Original Message----- From: Ahmed Omar To: info Cc: erlang-questions Date: Wed, 8 Dec 2010 11:11:32 +0100 Subject: Re: [erlang-questions] gen_server and the run-time errors > For the last question, it will be useful to start sasl before starting > your > application. > > Ivan, > init in gen_server should return {ok, State} not {ok, pid()} > http://www.erlang.org/doc/man/gen_server.html#Module:init-1 > > > 2010/12/8 Robert Virding > > > IIRC it is so, terminate/1 is not called if there is an error in > init/1. I > > remember having read about it somewhere but can't find it now. The > closest I > > could come up with is in > > http://erlang.org/doc/man/gen_server.html#start_link-3 where it says: > > > > "If Module:init/1 fails with Reason, the function returns > {error,Reason}. > > If Module:init/1 returns {stop,Reason} or ignore, the process is > terminated > > and the function returns {error,Reason} or ignore, respectively." > > > > Also the documentation explicitly mentions how to return a value from > other > > callback functions which causes the server to call terminate/1 and > then > > terminate, but no mention of terminate is made in the docs for > init/1. > > > > The logic is I suppose that if you haven't completed initialisation > then > > there is nothing to clean-up after. > > > > Robert > > > > ----- "Gilberio Carmenates Garc?a" wrote: > > > > > Hi! Info, > > > > > > The terminate function isn't called possibility because the > gen_server > > > never > > > started, > > > Your problem could be I'm close sure because the init() need to be > > > ended > > > with a {ok, Pid}, Pid could be self(). If you end the init() > function > > > with > > > other thing, the same error you saw is threw. > > > > > > > > > Good Example: > > > > > > init(Args)-> > > > process_flag(trap_exit,true), > > > evo_db_module:start(Args), > > > {ok, self()}. > > > > > > > > > Bad Example: > > > > > > init(Args)-> > > > process_flag(trap_exit,true), > > > evo_db_module:start(Args), > > > some_fun_that_not_returns_ok_pid(). > > > > > > > > > =INFO REPORT==== 7-Dec-2010::20:37:58 === > > > application: evo > > > exited: {shutdown,{evo,start,[normal,[{...}]]}} > > > type: temporary > > > > > > Best, > > > > > > Ivan. > > > > > > > > > -----Mensaje original----- > > > De: erlang-questions > [mailto:erlang-questions] > > > En > > > nombre de info > > > Enviado el: Martes, 07 de Diciembre de 2010 14:50 > > > Para: erlang-questions > > > Asunto: [erlang-questions] gen_server and the run-time errors > > > > > > Hello, > > > I have a run-time error in the init part of a gen_server. > > > - Init begin by process_flag(trap_exit,true) > > > - gen_server is part of a supervision tree > > > I try to print the reason in the terminate module but it seems to > > > exit > > > elsewhere. > > > - why terminate is not called ? > > > The application stops with shutdown as reason. > > > - How and where to catch the run-time error ? > > > > > > J-Ph. Constantin > > > ITS3 Genhve > > > www.its3.ch > > > > > > > > > > ======================================================================= > > > Este mensaje ha sido enviado mediante el servicio de correo > > > electr?nico que ofrece la Federaci?n de Radioaficionados de Cuba > a sus > > > miembros para respaldar el cumplimiento de los objetivos de la > > > organizaci?n y su pol?tica informativa. La persona que env?a > este > > > correo asume el compromiso de usar el servicio a tales fines y > > > cumplir con las regulaciones establecidas. > > > > > > > > > > > > ________________________________________________________________ > > > erlang-questions (at) erlang.org mailing list. > > > See http://www.erlang.org/faq.html > > > To unsubscribe; mailto:erlang-questions-unsubscribe > > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > See http://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscribe > > > > > > > -- > Best Regards, > - Ahmed Omar > http://nl.linkedin.com/in/adiaa > Follow me on twitter > @spawn_think ======================================================================= Este mensaje ha sido enviado mediante el servicio de correo electr?nico que ofrece la Federaci?n de Radioaficionados de Cuba a sus miembros para respaldar el cumplimiento de los objetivos de la organizaci?n y su pol?tica informativa. La persona que env?a este correo asume el compromiso de usar el servicio a tales fines y cumplir con las regulaciones establecidas. From co7eb Wed Dec 8 20:42:49 2010 From: co7eb (Gilberto Carmenate =?iso-8859-1?Q?Garc=EDa?=) Date: Wed, 08 Dec 2010 14:42:49 -0500 Subject: [erlang-questions] gen_server and the run-time errors In-Reply-To: <201012081751113289712@its3.ch> References: <000001cb966c\$db494e80\$91dbeb80\$@co.cu> <201012081751113289712@its3.ch> Message-ID: Hi, info well, try to try catch the line ets:insert(?MODULE,{Pid,0}), <<<< this line provokes the shutdown or simple catch you got shutdown reason at the end because for the supervisor the only matter is the gen_server final state so, and its state was shutdown because any error was threw under its initialization, so to know and print what error was try the try..catch clause try ets:insert(?MODULE,{Pid,0}), <<<< this line provokes the shutdown of catch Error:Reason-> io:format("Error: ~p Reason: ~p", [Error, Reason]) end. or something like that. Best, Ivan. -----Original Message----- From: "info" To: "Gilberio_Carmenates_Garc?a" Cc: "erlang-questions" Date: Wed, 8 Dec 2010 17:51:13 +0100 Subject: Re: RE: [erlang-questions] gen_server and the run-time errors > Hi, > I have this ok ! > > init()-> > process_flag(trap_exit,true), > handle_A(), > {ok,0}. > handle_A()-> > Pid=proc_lib:spawn_link(...), > ets:insert(?MODULE,{Pid,0}), <<<< this line provokes the shutdown > ok. > > I know my error but I would like to see on the screen the "Reason" and > not "shutdown": I lost information somewhere ! > > J-Ph. Constantin > ITS3 Gen?ve > www.its3.ch ======================================================================= Este mensaje ha sido enviado mediante el servicio de correo electr?nico que ofrece la Federaci?n de Radioaficionados de Cuba a sus miembros para respaldar el cumplimiento de los objetivos de la organizaci?n y su pol?tica informativa. La persona que env?a este correo asume el compromiso de usar el servicio a tales fines y cumplir con las regulaciones establecidas. From boris.muehmer Wed Dec 8 21:05:07 2010 From: boris.muehmer (Boris =?ISO-8859-1?Q?M=FChmer?=) Date: Wed, 08 Dec 2010 21:05:07 +0100 Subject: [erlang-questions] Erlang/OTP R14B01 has been released In-Reply-To: References: Message-ID: <1291838707.2664.36.camel@yang> Am Mittwoch, den 08.12.2010, 15:49 +0100 schrieb Kenneth Lundin: > Erlang/OTP R14B01 has been released. > [...] Great news! But I ran into some troubles installing it: my final step (using a script) is to call "sudo make install-docs". But this time it failed with the following error: ERL_TOP=/home/bsmr/Source/Erlang/System/otp_src_R14B01 INSTALLROOT=/opt/otp-R14B01/lib/erlang PATH=/home/bsmr/Source/Erlang/System/otp_src_R14B01/bootstrap/bin: \${PATH} \ make RELEASE_ROOT=/opt/otp-R14B01/lib/erlang release_docs make[1]: Entering directory `/home/bsmr/Source/Erlang/System/otp_src_R14B01' /home/bsmr/Source/Erlang/System/otp_src_R14B01/lib/erl_docgen/priv/bin/xref_mod_app.escript -topdir /home/bsmr/Source/Erlang/System/otp_src_R14B01 -outfile /home/bsmr/Source/Erlang/System/otp_src_R14B01/make/x86_64-unknown-linux-gnu/mod2app.xml /home/bsmr/Source/Erlang/System/otp_src_R14B01/lib/erl_docgen/priv/bin/xref_mod_app.escript:89: can't find include lib "xmerl/include/xmerl.hrl" escript: There were compilation errors. make[1]: *** [mod2app] Error 127 make[1]: Leaving directory `/home/bsmr/Source/Erlang/System/otp_src_R14B01' make: *** [install-docs] Error 2 I never saw this before "R14B01". After some messing around a bit, I changed the shebang of otp_src_R14B01/lib/erl_docgen/priv/bin/xref_mod_app.escript from "#!/usr/bin/env escript" to "#!/opt/otp-R14B01/bin/escript" and the "sudo make install-docs" worked. It looks like I have to check the man page of sudo again, because it looks like it ignores some "parts" (like PATH) of my (development) environment. To check this behaviour, I made a small escript: #!/usr/bin/env escript main(_Args) -> Info = code:lib_dir(xmerl), io:format("xmerl lib dir: ~p~n", [Info]). % EOF The output is the following: \$ ./test.escript xmerl lib dir: "/opt/otp-R14B01/lib/erlang/lib/xmerl-1.2.7" \$ sudo ./test.escript xmerl lib dir: "/usr/lib/erlang/lib/xmerl-1.2.3" Well, I am just glad it works now... and about to "man sudo"... - boris From max.lapshin Wed Dec 8 21:11:08 2010 From: max.lapshin (Max Lapshin) Date: Wed, 8 Dec 2010 23:11:08 +0300 Subject: [erlang-questions] how to debug memory leaks? In-Reply-To: <4CFB4102.4080907@erlang-solutions.com> References: <4CFB4102.4080907@erlang-solutions.com> Message-ID: I have a bit different situation: (ems)19> lists:sum([element(2,process_info(P,memory)) || {_, P, _, _} <- supervisor:which_children(ems_media_sup)]). 4196568120 (ems)20> [garbage_collect(P) || {_, P, _, _} <- supervisor:which_children(ems_media_sup)]. [true,true,true,true,true,true,true,true,true,true,true, true,true,true,true,true,true,true,true,true,true,true,true, true,true,true,true,true,true|...] (ems)11> lists:sum([element(2,process_info(P,memory)) || {_, P, _, _} <- supervisor:which_children(ems_media_sup)]). 41555744 Garbage collection cleans 99% of process memory and top utility shows me, that all these gigabytes are freed. How should I interpret this information? I suppose, that server is working not very fast because of high memory consumption and I want to lower it. Should I call garbage_collect manually or better setup some options like fullsweep_after ? From francisstephens Wed Dec 8 23:20:40 2010 From: francisstephens (Francis Stephens) Date: Wed, 8 Dec 2010 22:20:40 +0000 Subject: [erlang-questions] Jinterface hanging on send In-Reply-To: References: Message-ID: Alright, I have reproduced it on linux. It seems that I am probably making inappropriate use of the sockets jinterface uses to communicate with epmd. But I am surprised that having multiple JVMs running on one machine breaks it like that. Keep digging. On Mon, Dec 6, 2010 at 3:44 PM, Alain O'Dea wrote: > On Monday, December 6, 2010, Francis Stephens > wrote: > > I have a number of Jinterface nodes running on separate JVMs. With fair > > regularity () they are blocking on calls to > > OtpMbox.send(OtpPid,OtpErlangObject). > > > > > > Debugging has shown that each of them is blocking on a call to > > SocketInputStream.read(byte, int, int). > > I'm trying to imagine why OtpMbox.send(OtpPid,OtpErlangObject) would > ever need to read a socket. Perhaps it needs to consult EPMB to find > where lookup the receiver for the OtpPid you are sending to. > > Interesting problem. I have been considering Java/Erlang interop for > several years on and off. I am very I interested to learn the cause of > the problem you are seeing and how to solve it. > > > > > > > It often appears that the hanging processes are trying to send a message > to > > each other at the same time. Often killing one of the JVMs that is > blocked > > on a send will release the other one. > > > > > > I am running Erlang version 5.8.1.1 with jinterface 1.5.3.1 running on > > windows. > > > > > > Has anyone seen this behaviour before? Is it expected behaviour, I was > > expecting to be able to run several communicating JVMs concurrently. > > Right-ho, off to read up on socket programming. > > > From alain.odea Thu Dec 9 00:56:32 2010 From: alain.odea (Alain O'Dea) Date: Wed, 8 Dec 2010 20:26:32 -0330 Subject: [erlang-questions] Happy Duodecennial! In-Reply-To: <20101208170141.GD97702@h216-235-12-173.host.egate.net> References: <20101208170141.GD97702@h216-235-12-173.host.egate.net> Message-ID: On Wed, Dec 8, 2010 at 1:31 PM, Vance Shipley wrote: > To our esteemed colleagues, past and present, of the OTP group; > happy twelfth anniversary of the opensource release! > > > http://web.archive.org/web/19991009002753/www.erlang.se/onlinenews/ErlangOTPos.shtml > > Thank you, thank you, thank you. > > -- > -Vance > In celebration I am reading Erlang and OTP in Action with even greater enthusiasm :) Cool piece of history. Thank you for the link Vance. From robert.virding Thu Dec 9 01:03:18 2010 From: robert.virding (Robert Virding) Date: Thu, 9 Dec 2010 00:03:18 +0000 (GMT) Subject: [erlang-questions] Some problem abount exit signal? In-Reply-To: <517915924.179401291852970966.JavaMail.root@zimbra> Message-ID: <358077851.179421291852994443.JavaMail.root@zimbra> Yes, the problem is not with the "sender" of the signal. exit/1 and exit/2 are different: exit/1 ends the process which results in exit reason being sent as a signal to the processes in the link set; while exit/2 fakes a signal to the receiving process *as if* the process had died. The problem occurs in the "receiving" process. If it receives a 'kill' signal it will behave differently depending on how the signal was sent. There should not be two different behaviours attached to one signal, kill, depending on how it was sent. A 'kill' should always be a 'kill' in the same way as a 'normal' is always a 'normal'. It is really not different if the signal 'normal' caused a process to terminate when sent with exit/2 but be ignored if the sending process dies with exit(normal). Or writing a server where a request message means different things depending on who sent them. Different behaviours should be caused by things with different names. Robert ----- "Hynek Vychodil" wrote: > I few moment I think there is the bug but after some experiments I > have to say it is pretty clear here. > > exit/1 doesn't sends any signal. It is simple "local exception" - > termination which is catchable in catch and try. When it is not catch > process terminates as usual and sends exit message to linked > processes > with reason. 'kill' reason is send as any other reason. There is not > special meaning except 'normal' ... > > exit/2 sends message and only when there is 'kill' reason it makes > "untrappable" kill and is translated to 'killed' exit message to > linked processes. exit/2 sends message which doesn't have "local" > behavior even I send it to myself because it is just like any other > message. I.e. it is uncatchable by catch or try. When exit signal is > not trapped i.e. it is untrappable (only direct exit/2 'kill') or is > not 'normal' and exit signals are not trapped then process dies and > exit signal is resend to linked processes with reason translation to > 'killed' just only for untrappable 'kill'. > > It makes perfect sense for me and I can't see there any bug or > misconception. Maybe documentation should be more explicit there. > > On Sun, Dec 5, 2010 at 2:36 AM, Robert Virding > wrote: > > Yes, this is how it works, but I definitely consider this to be a > bug. To elaborate with a simple example: > > > > 1> self(). > > <0.31.0> > > 2> spawn_link(fun () -> exit(kill) end). > > ** exception exit: killed > > 3> self(). > > <0.35.0> > > > > Here I have received 'kill' signal and died as I should. Now I trap > exits: > > > > 4> process_flag(trap_exit, true). > > false > > 5> spawn_link(fun () -> exit(kill) end). > > <0.39.0> > > 6> flush(). > > Shell got {'EXIT',<0.39.0>,kill} > > ok > > > > This time I received a trappable 'kill' signal. Finally I explicitly > send the 'kill' signal to me: > > > > 7> Self = self(). > > <0.35.0> > > 8> process_flag(trap_exit, true). ? ? ? ? ?%Just to be explicit > > true > > 9> spawn_link(fun () -> exit(Self, kill) end). > > ** exception exit: killed > > 10> self(). > > <0.45.0> > > > > And this time I received an untrappable 'kill' signal. > > > > This means that there are two different types of 'kill' signals, > trappable and untrappable, in the systems depending on how they were > sent. This is illogical and unclear as there should not be two > different signals with the same name which behave differently. It is > definitely a bug which should be fixed. I see two (three) different > solutions: > > > > 1. Make it so that a process which does exit(kill) sends a real, > untrappable kill signal to its link set (which then in turn transmit > 'killed'). > > > > 2. Make it so that a process which does exit(kill) behaves as if it > were killed and so transmits 'killed' to its link set. > > > > 3. Leave it as it is and create a > 'properly_behaving_really_untrappable_kill' signal which behaves > sensibly. > > > > I think the first option is the best. > > > > Robert > > > > P.S. Now to copy all this to erlang-bugs. > > > > P.P.S. I have just noticed that doing exit(self(), normal) kills me > while some other process doing exit(Me, normal) doesn't. Sigh, so > normal isn't normal. > > > > > > ----- "Ulf Wiger" wrote: > > > >> Process C terminates itself with exit(kill). The atom 'kill' > >> is not special in this case, but simply a normal exit reason. > >> > >> A propagated exit signal can never act as a kill signal in the > >> first place, but here, not even the original exit is an > untrappable > >> kill. > >> > >> Try: > >> > >> Eshell V5.8.1 ?(abort with ^G) > >> 1> self(). > >> <0.31.0> > >> 2> catch exit(kill). > >> {'EXIT',kill} > >> 3> self(). > >> <0.31.0> > >> > >> BR, > >> Ulf W > >> > >> On 2 Dec 2010, at 05:37, sky wrote: > >> > >> > Hi guys, > >> > > >> > In the Joe's book <>, page 163, there are > some > >> description about exit signal : > >> > > >> > When an exit signal arrives at a process, then a number of > >> different > >> > things might happen. What happens depends upon the state of the > >> > receiving process and upon the value of the exit signal and is > >> deter- > >> > mined by the following table: > >> > > >> > > >> > but when use edemo1:start(true, {die, kill}), the result is: > >> > > >> > edemo1:start(true, {die,kill}). > >> > Process b received {'EXIT',<0.73.0>,kill} > >> > process b (<0.72.0>) is alive > >> > process c (<0.73.0>) is dead > >> > ok > >> > Why process b is alive? Cause as the descripion in this book, > ?when > >> the exit signal > >> > {'EXIT',<0.73.0>,kill} > >> > arrived, the process b will die and broadcast the exit signal > killed > >> to the link set. > >> > > >> > the souce code of edemo1 module as following: > >> > > >> > %% --- > >> > %% ?Excerpted from "Programming Erlang", > >> > %% ?published by The Pragmatic Bookshelf. > >> > %% ?Copyrights apply to this code. It may not be used to create > >> training material, > >> > %% ?courses, books, articles, and the like. Contact us if you are > in > >> doubt. > >> > %% ?We make no guarantees that this code is fit for any purpose. > >> > %% ?Visit http://www.pragmaticprogrammer.com/titles/jaerlang for > >> more book information. > >> > %%--- > >> > > >> > -module(edemo1). > >> > -export([start/2]). > >> > > >> > start(Bool, M) -> > >> > ? ? A = spawn(fun() -> a() end), > >> > ? ? B = spawn(fun() -> b(A, Bool) end), > >> > ? ? C = spawn(fun() -> c(B, M) end), > >> > ? ? sleep(1000), > >> > ? ? status(b, B), > >> > ? ? status(c, C). > >> > > >> > > >> > a() -> > >> > ? ? process_flag(trap_exit, true), > >> > ? ? wait(a). > >> > > >> > b(A, Bool) -> > >> > ? ? process_flag(trap_exit, Bool), > >> > ? ? link(A), > >> > ? ? wait(b). > >> > > >> > c(B, M) -> > >> > ? ? link(B), > >> > ? ? case M of > >> > ? ? {die, Reason} -> > >> > ? ? ? ? exit(Reason); > >> > ? ? {divide, N} -> > >> > ? ? ? ? 1/N, > >> > ? ? ? ? wait(c); > >> > ? ? normal -> > >> > ? ? ? ? true > >> > ? ? end. > >> > > >> > > >> > > >> > wait(Prog) -> > >> > ? ? receive > >> > ? ? Any -> > >> > ? ? ? ? io:format("Process ~p received ~p~n",[Prog, Any]), > >> > ? ? ? ? wait(Prog) > >> > ? ? end. > >> > > >> > > >> > > >> > sleep(T) -> > >> > ? ? receive > >> > ? ? after T -> true > >> > ? ? end. > >> > > >> > status(Name, Pid) -> > >> > ? ? case erlang:is_process_alive(Pid) of > >> > ? ? true -> > >> > ? ? ? ? io:format("process ~p (~p) is alive~n", [Name, Pid]); > >> > ? ? false -> > >> > ? ? ? ? io:format("process ~p (~p) is dead~n", [Name,Pid]) > >> > ? ? end. > >> > > >> > > >> > >> Ulf Wiger, CTO, Erlang Solutions, Ltd. > >> http://erlang-solutions.com > > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > See http://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscribe > > > > > > > > -- > --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 robert.virding Thu Dec 9 01:07:50 2010 From: robert.virding (Robert Virding) Date: Thu, 9 Dec 2010 00:07:50 +0000 (GMT) Subject: [erlang-questions] Happy Duodecennial! In-Reply-To: <20101208170141.GD97702@h216-235-12-173.host.egate.net> Message-ID: <556044512.179451291853270118.JavaMail.root@zimbra> It took quite a bit of work on Jane's part to actually convince them to make Erlang become Open Source. They didn't really see the benefit of doing it. Robert ----- "Vance Shipley" wrote: > To our esteemed colleagues, past and present, of the OTP group; > happy twelfth anniversary of the opensource release! > > > http://web.archive.org/web/19991009002753/www.erlang.se/onlinenews/ErlangOTPos.shtml > > Thank you, thank you, thank you. > > -- > -Vance > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe From jesper.louis.andersen Thu Dec 9 01:50:04 2010 From: jesper.louis.andersen (Jesper Louis Andersen) Date: Thu, 9 Dec 2010 01:50:04 +0100 Subject: [erlang-questions] how to debug memory leaks? In-Reply-To: References: <4CFB4102.4080907@erlang-solutions.com> Message-ID: On Wed, Dec 8, 2010 at 9:11 PM, Max Lapshin wrote: > I have a bit different situation: > > Garbage collection cleans 99% of process memory and top utility shows > me, that all these gigabytes are freed. > > How should I interpret this information? I suppose, that server is > working not very fast because of high memory consumption and I want to > lower it. > We had this problem in some new io code in etorrent which Magnus Klaar wrote. There, you could run memory() in a shell and see a very large binary usage. The problem is that we had a lot of processes which usually does very little work. They just sit with data. Now, if they hold references to binaries, these will never be collected, so we sit with a quite large RSS usage. To fix it, we did two things: {fullsweep_after, 0} so we nail the whole heap every time. And an internal timer which triggers after some small idle time (5 seconds currently). This awakens the process and calls garbage_collect/1. hinbernation is another option for long-waiting processes. > Should I call garbage_collect manually or better setup some options > like fullsweep_after ? The alternative is to force GC with what you did, but I think it is a more clunky solution to be honest. -- J. From ok Thu Dec 9 02:04:18 2010 From: ok (Richard O'Keefe) Date: Thu, 9 Dec 2010 14:04:18 +1300 Subject: [erlang-questions] Multi-line comments in Erlang In-Reply-To: <2DAEE552-A7F6-4BC8-9C3C-28239100DBA4@stefan-marr.de> References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz> <2DAEE552-A7F6-4BC8-9C3C-28239100DBA4@stefan-marr.de> Message-ID: <588DBDF7-6AB5-4C53-A3DF-FF8975C559EC@cs.otago.ac.nz> On 8/12/2010, at 1:26 PM, Stefan Marr wrote: > Hi: > > On 07 Dec 2010, at 23:14, Richard O'Keefe wrote: >> /* ... */ comments have no known advantages over % comments; >> with adequate editing tools it is equally easy to "comment out" >> or "comment in" a region either way and they are equally easy >> to type or reformat. > Very general statement, very specific response: Yes they do! > At least for me they are extremely helpful to document parts where I need to work around different compilers in C/C++. You can do that equally well with // comments. > Inline comments with /**/ to annotate these things is the only way to keep track of all those nasty things... On the contrary, the very first time I ever saw such annotation comments was in Burroughs Algol, using % comments. Prolog programmers often use %FIXME% or something like that. From ok Thu Dec 9 02:19:38 2010 From: ok (Richard O'Keefe) Date: Thu, 9 Dec 2010 14:19:38 +1300 Subject: [erlang-questions] Multi-line comments in Erlang In-Reply-To: <00a601cb96e5\$c12d74d0\$43885e70\$@com> References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz> <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> <00a601cb96e5\$c12d74d0\$43885e70\$@com> Message-ID: <2C53ECED-1A4B-43C8-82FE-38C81E1E72C6@cs.otago.ac.nz> On 9/12/2010, at 3:39 AM, David Mercer wrote: > On Tuesday, December 07, 2010, Richard O'Keefe wrote: > >> Nesting comments are one of those clever ideas >> that turn out to be really dumb, because they don't actually work. > > I'll bite, mainly because I've sometimes thought nesting comments would be > helpful, for instance, when commenting out large blocks of code, but it is > rare that I get to work with a language that supports them. Since you're > almost always right about such things, why do you say that they don't > actually work? Here is a Haskell example. Something very like this actually bit me. comment_close = "-}" Comment that out: {- comment_close = "-}" -} OOPS! The comment ends at the first -}, not the second. Before you say "but the first -} is in a quoted string", recall that nesting comments are completely general, they are NOT limited to escaping valid syntax in the programming language in question. I define "work" in this context as "you can comment out an arbitrary chunk of text without having to worry about what is inside it". My text editor has a "comment out region" command that handles comments of the form LX ... XR. What it does is to add extra spaces around Xs, so that this example would be treated as {- comment_close = " - }" -} and the "comment in region" command deletes single spaces on either side of an X. This *does* work, because it guarantees that LX or XR brackets will never be found inside the comment. But that means it doesn't *need* nesting comments at all. From nrapesh09 Thu Dec 9 09:19:00 2010 From: nrapesh09 (Nrapesh Khamesra) Date: Thu, 9 Dec 2010 13:49:00 +0530 Subject: Reg tcpserver in erlang In-Reply-To: References: Message-ID: I implemented a simple parallel tcp server to calculate factorial,the code for which is as follows -module(tcpserver). -export([start_server/0]). start_server()-> spawn(fun()-> start_server(4001) end). start_server(Port)-> {ok,Listen}=gen_tcp:listen(Port,[binary,{packet,4},{reuseaddr,true},{active,true}]), seq_loop(Listen). seq_loop(Listen)-> {ok,Socket}=gen_tcp:accept(Listen), spawn(fun()-> seq_loop(Listen) end), loop(Socket), gen_tcp:close(Socket). loop(Socket)-> receive {tcp,Socket,Bin}-> io:format("Server Received Binary ~p ~n",[Bin]), Number=binary_to_term(Bin), Factorial=factorial(Number), gen_tcp:send(Socket,term_to_binary(Factorial)), loop(Socket); {tcp_closed,Socket}-> io:format("Result Returned to client~n",[]) end. factorial(1)->1; factorial(N)->N*factorial(N-1). The client code is as follows -module(tcpclient). -export([factorial/1]). factorial(Number)-> {ok,Socket}=gen_tcp:connect("localhost",4001,[binary , {packet,4}]), ok=gen_tcp:send(Socket,term_to_binary(Number)), receive {tcp,Socket,Bin}-> io:format("Client recieved Binary ~p ~n",[Bin]), Val=binary_to_term(Bin), io:format("Result ~p ~n ",[Val]), gen_tcp:close(Socket) end. When i first time I use tcpclient:factorial(N) it gives answer but the server side crashes after that giving the error 1> tcpserver:start_server(). <0.34.0> Server Received Binary <<131,97,5>> Result Returned to client 2> =ERROR REPORT==== 8-Dec-2010::23:15:01 === Error in process <0.36.0> with exit value: {{badmatch,{error,closed}},[{tcpserver,seq_loop,1}]} Can someone tell me the mistake in my code. From hm Thu Dec 9 09:41:09 2010 From: hm (=?ISO-8859-1?Q?H=E5kan_Mattsson?=) Date: Thu, 9 Dec 2010 09:41:09 +0100 Subject: [erlang-questions] Erlang/OTP R14B01 has been released In-Reply-To: References: Message-ID: On Wed, Dec 8, 2010 at 3:49 PM, Kenneth Lundin wrote: > 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_R14B01.tar.gz.torrent > http://www.erlang.org/download/otp_win32_R14B01.exe.torrent These links are broken.The torrent files are located in the http://www.erlang.org/download/torrents directory: http://www.erlang.org/download/torrents/otp_src_R14B01.tar.gz.torrent http://www.erlang.org/download/torrents/otp_win32_R14B01.exe.torrent /H?kan From spawn.think Thu Dec 9 10:45:52 2010 From: spawn.think (Ahmed Omar) Date: Thu, 9 Dec 2010 10:45:52 +0100 Subject: [erlang-questions] Reg tcpserver in erlang In-Reply-To: References: Message-ID: The first time your code will go well cause the process owning/controlling the socket is alive and it's the one accepting. But then you spawn a new process to accept new connections , which will not work cause your main process (the socket owner) died (because it has no more code to execute) , and socket was closed. That's when the new spawned process crashes with a bad match cause gen_tcp:accept will return {error, closed} while you expect {ok, Socket} On Thu, Dec 9, 2010 at 9:19 AM, Nrapesh Khamesra wrote: > I implemented a simple parallel tcp server to calculate factorial,the > code for which is as follows > > -module(tcpserver). > -export([start_server/0]). > > > start_server()-> > spawn(fun()-> start_server(4001) end). > > start_server(Port)-> > > > {ok,Listen}=gen_tcp:listen(Port,[binary,{packet,4},{reuseaddr,true},{active,true}]), > seq_loop(Listen). > > > > seq_loop(Listen)-> > {ok,Socket}=gen_tcp:accept(Listen), > spawn(fun()-> seq_loop(Listen) end), > loop(Socket), > gen_tcp:close(Socket). > > loop(Socket)-> > receive > {tcp,Socket,Bin}-> > io:format("Server Received Binary ~p ~n",[Bin]), > Number=binary_to_term(Bin), > Factorial=factorial(Number), > gen_tcp:send(Socket,term_to_binary(Factorial)), > loop(Socket); > {tcp_closed,Socket}-> > io:format("Result Returned to client~n",[]) > end. > > factorial(1)->1; > factorial(N)->N*factorial(N-1). > > > The client code is as follows > -module(tcpclient). > -export([factorial/1]). > > factorial(Number)-> > {ok,Socket}=gen_tcp:connect("localhost",4001,[binary , {packet,4}]), > ok=gen_tcp:send(Socket,term_to_binary(Number)), > receive > {tcp,Socket,Bin}-> > io:format("Client recieved Binary ~p ~n",[Bin]), > Val=binary_to_term(Bin), > io:format("Result ~p ~n ",[Val]), > gen_tcp:close(Socket) > end. > > When i first time I use tcpclient:factorial(N) it gives answer but the > server side crashes after that giving the error > 1> tcpserver:start_server(). > <0.34.0> > Server Received Binary <<131,97,5>> > Result Returned to client > 2> > =ERROR REPORT==== 8-Dec-2010::23:15:01 === > Error in process <0.36.0> with exit value: > {{badmatch,{error,closed}},[{tcpserver,seq_loop,1}]} > > Can someone tell me the mistake in my code. > -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think From zvi.avraham Thu Dec 9 10:48:45 2010 From: zvi.avraham (Zvi .) Date: Thu, 9 Dec 2010 11:48:45 +0200 Subject: [erlang-questions] Multi-line comments in Erlang In-Reply-To: References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> Message-ID: 1. The beauty of dynamic languages is that you don't need tools and IDEs! And even if you do use tools, many times you work not on your machine or on target headless environments, with only basic editor available, or with editor that you know poorly or which didn't configured with your macros, etc. 2. Comments are essentially Natural language (let's say US English) document, embedded into Programming language (Erlang) document. Therefore, embedded document should be left intact. Ideally I would like comments to be something, like HEREDOC. 3. Free format is the king! Language designers shouldn't dictate programmers how to format and ident their code. How differnt is starting comment line from '%' in Erlang, from putting 'C' or '*' in the first column in FORTRAN? 4. In other languages, that doesn't have multiline comments I often use ifdef(false) macro, or outright if(false) to "comment out" parts of code. I think it's uglier, than proper multiline comments, but still better than comment every single line. Zvi On Tue, Dec 7, 2010 at 8:20 PM, Rapsey wrote: > Is it that important? Any proper programming editor can comment/uncomment > multiple lines. > > > Sergej > > > On Tue, Dec 7, 2010 at 5:49 PM, Zvi . wrote: > >> Why do you think it's not possible? >> It's just simple change to Erlang source code parser. >> Probably this should be submitted as EEP, so OTP team will consider it. >> >> On Tue, Dec 7, 2010 at 6:25 PM, James Churchman > >wrote: >> >> > not posible in erlang, but many editors (eg i use textmate) will comment >> > and uncomment multiple lines with % on each line.. >> > On 7 Dec 2010, at 15:32, Zvi wrote: >> > >> > > Hi, >> > > >> > > Matlab/Octave has single line comments, like Erlang (i.e. starting >> > > with '%' sign). But it also have multi-line comments, like for >> > > example: >> > > >> > > %{ >> > > this is example >> > > of multi-line >> > > comments in Matlab >> > > %} >> > > >> > > which is equivalent to: >> > > >> > > %this is example >> > > %of multi-line >> > > %comments in Matlab >> > > >> > > How difficult is to add comments like this to Erlang? >> > > >> > > Thanks, >> > > Zvi >> > > >> > > ________________________________________________________________ >> > > erlang-questions (at) erlang.org mailing list. >> > > See http://www.erlang.org/faq.html >> > > To unsubscribe; mailto:erlang-questions-unsubscribe >> > > >> > >> > >> > > From jensli Thu Dec 9 13:23:42 2010 From: jensli (jensli) Date: Thu, 9 Dec 2010 07:23:42 -0500 (EST) Subject: [erlang-questions] Ordering of mnesia events In-Reply-To: References: <201012071423.oB7ENvJu062475@pluto.hedeland.org> <5899.194.237.142.6.1291738039.squirrel@lavabit.com> <29530.194.237.142.20.1291795940.squirrel@lavabit.com> Message-ID: <56510.194.237.142.7.1291897422.squirrel@lavabit.com> Ok. Great to have that sorted out. There are one last case that I can think of that could be of interest: If you have two transactions: Trans1 = fun() -> ... end, Trans2 = fun() -> ... end, mnesia:transaction(Trans1), mnesia:transaction(Trans2), Can subscribers be sure to get all the events that are caused by Trans1 before any of the events from Trans2? On all nodes? I mean under the current implementation, not that it is documented behaviour. >But as it not is explicitly stated in the documentation Maybe it would be relevant for OTP to state that there are no guarantees about the ordering of events in the documentation? Thanks for your help! /Jens Lidestr?m > 2010/12/8 : >> Thanks for your answer. >> >> Ok, so when operations happen in a transactions we cant be sure about >> much, only that all the operations in the transaction are considered to >> happen at once with no defined order, and we can only expect events that >> reflect the final result of the transaction. >> >> But what about dirty operations? >> >> Same table: >> mnesia:dirty_delete(tab1, SomeRec), >> mnesia:dirty_write(tab1, SomeOtherRec) >> >> Different tables: >> mnesia:dirty_write(tab1, SomeRec), >> mnesia:dirty_write(tab2, SomeOtherRec), >> >> Obviously, they will happen in a defined order. But does that also hold >> for the events? > > If it is the same process that performs all these dirty calls and the > involved > tables resides on the local node, the events will be delivered in the same > order as they are performed to subscribers on the local node. This is the > current behavior and it is very unlikely to be changed. But as it not is > explicitly stated in the documentation you should not rely on the current > behavior. > >> On all nodes? > > There is no global ordering in the sense that event #1 will be delivered > to subscribers on all nodes before event #2 is delivered. But the events > will occur in the same order on all nodes which have a replica of the > table if it is the dirty updates originates from the same process. But > as this is not documented... > > /H?kan > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From icfp.publicity Thu Dec 9 13:23:50 2010 From: icfp.publicity (Wouter Swierstra) Date: Thu, 9 Dec 2010 13:23:50 +0100 Subject: ICFP 2011: Call for papers Message-ID: ===================================================================== Call for Papers ICFP 2011: International Conference on Functional Programming Tokyo, Japan, Monday 19 -- Wednesday 21 September 2011 http://www.icfpconference.org/icfp2011 ===================================================================== Important Dates ~~~~~~~~~~~~~~~ Titles, abstracts & keywords due: Thursday 17 March 2011 at 14:00 UTC Submissions due: Thursday 24 March 2011 at 14:00 UTC Author response: Tuesday & Wednesday 17-18 May Notification: Monday 30 May 2011 Final copy due: Friday 01 July 2011 Conference: Monday-Wednesday 19-21 September 2011 Scope ~~~~~ ICFP 2011 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, and 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, concurrency, or parallelism. Particular topics of interest include * Language Design: type systems; concurrency and distribution; modules; components and composition; metaprogramming; relations to imperative, object-oriented, or logic programming; interoperability * Implementation: abstract machines; virtual machines; interpretation; 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; mathematical logic; monads; continuations; delimited continuations; global, delimited, or local effects * Transformation and Analysis: abstract interpretation; partial evaluation; program transformation; program calculation; program proofs; normalization by evaluation * 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 * Experience Reports: 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 17 March 2011, 14:00 UTC, submit a title, an abstract of at most 300 words, and keywords. * By 24 March 2011, 14:00 UTC, submit a full paper of at most 12 pages (6 pages for a Functional Pearl and for an Experience Report), including bibliography and figures. The deadlines 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. * Each submission must adhere to SIGPLAN's republication policy, as explained on the web at http://www.acm.org/sigplan/republicationpolicy.htm In addition, authors of resubmitted (but previously rejected) papers have the option to attach an annotated copy of the reviews of their previous submission(s), explaining how they have addressed these previous reviews in the present submission. If a reviewer identifies him/herself as a reviewer of this previous submission and wishes to see how his/her comments have been addressed, the program chair will communicate to this reviewer the annotated copy of his/her previous review. Otherwise, no rewiewer will read the annotated copies of the previous reviews. Overall, 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. 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 Tuesday 17 May 2010, to read reviews and respond to them. Special Journal Issue: There will be a special issue of the Journal of Functional Programming with papers from ICFP 2011. The program committee will invite the authors of select accepted papers to submit a journal version to this issue. Conference Chairs: Manuel M T Chakravarty, University of New South Wales, Australia Zhenjiang Hu, National Institute of Informatics (NII), Japan Program Chair: Olivier Danvy, Aarhus University, Denmark Program Committee: Kenichi Asai, Ochanomizu University, Japan Josh Berdine, Microsoft Research, UK Adam Chlipala, Harvard University, USA William Cook, University of Texas at Austin, USA Maribel Fernandez, King's College London, UK Ronald Garcia, Carnegie Mellon University, USA Neal Glew, Intel Labs, USA Jacques Garrigue, Nagoya University, Japan Suresh Jagannathan, Purdue University, USA Sam Lindley, University of Edinburgh, UK Frank Pfenning, Carnegie Mellon University, USA Paola Quaglia, University of Trento, Italy Alexis Saurin, University of Paris VII, France Mike Spivey, Oxford University, UK Kristian Stoevring, University of Copenhagen, Denmark Doaitse Swierstra, Utrecht University, The Netherlands David Van Horn, Northeastern University, USA Rene Vestergaard, JAIST, Japan Edwin Westbrook, Rice University, USA From dgud Thu Dec 9 13:53:54 2010 From: dgud (Dan Gudmundsson) Date: Thu, 9 Dec 2010 13:53:54 +0100 Subject: [erlang-questions] Ordering of mnesia events In-Reply-To: <56510.194.237.142.7.1291897422.squirrel@lavabit.com> References: <201012071423.oB7ENvJu062475@pluto.hedeland.org> <5899.194.237.142.6.1291738039.squirrel@lavabit.com> <29530.194.237.142.20.1291795940.squirrel@lavabit.com> <56510.194.237.142.7.1291897422.squirrel@lavabit.com> Message-ID: The transaction can happen in parallel if they access different objects, so there is no order guarantee. /Dan 2010/12/9 : > Ok. Great to have that sorted out. > > There are one last case that I can think of that could be of interest: > > If you have two transactions: > > Trans1 = fun() -> ... end, > Trans2 = fun() -> ... end, > > mnesia:transaction(Trans1), > mnesia:transaction(Trans2), > > Can subscribers be sure to get all the events that are caused by Trans1 > before any of the events from Trans2? On all nodes? > > I mean under the current implementation, not that it is documented behaviour. > >>But as it not is explicitly stated in the documentation > > Maybe it would be relevant for OTP to state that there are no guarantees > about the ordering of events in the documentation? > > > Thanks for your help! > > /Jens Lidestr?m > >> 2010/12/8 ?: >>> Thanks for your answer. >>> >>> Ok, so when operations happen in a transactions we cant be sure about >>> much, only that all the operations in the transaction are considered to >>> happen at once with no defined order, and we can only expect events that >>> reflect the final result of the transaction. >>> >>> But what about dirty operations? >>> >>> Same table: >>> mnesia:dirty_delete(tab1, SomeRec), >>> mnesia:dirty_write(tab1, SomeOtherRec) >>> >>> Different tables: >>> mnesia:dirty_write(tab1, SomeRec), >>> mnesia:dirty_write(tab2, SomeOtherRec), >>> >>> Obviously, they will happen in a defined order. But does that also hold >>> for the events? >> >> If it is the same process that performs all these dirty calls and the >> involved >> tables resides on the local node, the events will be delivered in the same >> order as they are performed to subscribers on the local node. This is the >> current behavior and it is very unlikely to be changed. But as it not is >> explicitly stated in the documentation you should not rely on the current >> behavior. >> >>> On all nodes? >> >> There is no global ordering in the sense that event #1 will be delivered >> to subscribers on all nodes before event #2 is delivered. But the events >> will occur in the same order on all nodes which have a replica of the >> table if it is the dirty updates originates from the same process. But >> as this is not documented... >> >> /H?kan >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe >> >> > > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From ulf.wiger Thu Dec 9 15:26:10 2010 From: ulf.wiger (Ulf Wiger) Date: Thu, 9 Dec 2010 15:26:10 +0100 Subject: RFC: mnesia majority checking Message-ID: git fetch git://github.com/uwiger/otp mnesia-majority https://github.com/uwiger/otp/commit/d97ae7d4329d9342e576f3cdd893de6865449e42 This is a first stab at a function that I believe could be useful in high-availability applications using mnesia. At this stage, I'd love to have some comments, and suggestions, if someone thinks of a better way to do it. From the commit message: "Add {majority, boolean()} per-table option. With {majority, true} set for a table, write transactions will abort if they cannot commit to a majority of the nodes that have a copy of the table. Currently, the implementation hooks into the prepare_commit, and forces an asymmetric transaction if the commit set affects any table with the majority flag set. In the commit itself, the transaction will abort if it cannot satisfy the majority requirement for all tables involved in the thransaction. A future optimization might be to abort already when a write lock is attempted on such a table (/-object) and the lock cannot be set on enough nodes. This functionality introduces the possibility to automatically "fence off" a table in the presence of failures. This is a first implementation. Only basic tests have been performed." One particular use of this functionality would be to have a "global resource pool" in one table with {majority, true}, and periodically check out resources into a local buffer. If there is a failure condition, you can use the local buffer, but not check out more resources, unless you happen to still be in contact with more than half of the replicas. This should allow for a well-defined merge after a network split. BR, Ulf W Ulf Wiger, CTO, Erlang Solutions, Ltd. http://erlang-solutions.com From setori88 Thu Dec 9 15:34:59 2010 From: setori88 (stewart mackenzie) Date: Thu, 9 Dec 2010 22:34:59 +0800 Subject: [erlang-questions] reltool to include a module In-Reply-To: <1433638060.171421291735724888.JavaMail.root@zimbra> References: <12373230.171401291735721735.JavaMail.root@zimbra> <1433638060.171421291735724888.JavaMail.root@zimbra> Message-ID: Hello there, Well I do understand that the shell can only list modules that are loaded into the system. I have used the *code *module and it does not load. I have included {mod_cond,all}in my reltool.config file I have included the module names in the app file of the pheobus dependency. I have even included the below, but to no avail. {app, phoebus_algos, [{mod,phoebus_core_path_find,[]}, {mod,phoebus_core_shortest_path,[]} ]}, I have also made sure the system is configured to be embedded in the reltool,config file. {profile, embedded}, Please can someone help me to get these modules loaded into the system. The source is available easy to build and investigate and the steps are made available. >> > git clone git://github.com/sjmackenzie/phoebus >> > cd phoebus >> > make rel >> > ./rel/phoebus/bin/phoebus console I would love assistance - and a most gracious thank you. Regards Stewart On Tue, Dec 7, 2010 at 11:28 PM, Robert Virding < robert.virding> wrote: > Yes, the shell can only list modules which are loaded into the system. > > Robert > > ----- "Andrey Pampukha" wrote: > >> Stewart, >> >> All application's beamfiles are to be pre-loaded into the memory at >> application startup, to have their names known by shell. >> If I'm not mistaken, you can just list all modules into the 'modules' >> section of the .app file. >> But I'm not sure that it's enough. You also need to start the system >> in embedded mode to autoload all listed modules. >> >> Andrey. >> >> >> 2010/12/7, stewart : >> > Hi >> > >> > I really need to get an erlang module available in the Erlang >> shell. >> > >> > What am I doing wrong? >> > >> > git clone git://github.com/sjmackenzie/phoebus >> > cd phoebus >> > make rel >> > ./rel/phoebus/bin/phoebus console >> > >> > then at the console phoebus_algos_ (auto-complete) should >> list >> > all available modules. >> > >> > I need all the phoebus/deps/phoebus_algos/ebin/* modules. >> > >> > thanks so much >> > >> > Stewart >> > >> > ________________________________________________________________ >> > erlang-questions (at) erlang.org mailing list. >> > See http://www.erlang.org/faq.html >> > To unsubscribe; mailto:erlang-questions-unsubscribe >> > >> > >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe > From daniel.goertzen Thu Dec 9 16:58:05 2010 From: daniel.goertzen (Daniel Goertzen) Date: Thu, 9 Dec 2010 09:58:05 -0600 Subject: [erlang-questions] Multi-line comments in Erlang In-Reply-To: References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> Message-ID: Thank you for reminding me about HEREDOCs. In Python, I often use triple quoted strings for multiline comments. It works well, but they are exposed to the interpreter which smells a bit. What if erlang had HEREDOCs *plus* a way to mark any string as a comment. Some illustrations, using Python's triple quoting as HEREDOC format. X=""" This is a multiline heredoc """, ... %""" This is a multiline comment """ myfun(X, Y %"An inline comment", Z) -> ... So comment and string delimiting uses the exact same logic, but you stick a % in front to mark it as a comment instead of a string. Dan. On Thu, Dec 9, 2010 at 3:48 AM, Zvi . wrote: > 1. The beauty of dynamic languages is that you don't need tools and IDEs! > And even if you do use tools, many times you work not on your machine or on > target headless environments, with only basic editor available, or with > editor that you know poorly or which didn't configured with your macros, > etc. > > 2. Comments are essentially Natural language (let's say US English) > document, embedded into Programming language (Erlang) document. > Therefore, embedded document should be left intact. Ideally I would like > comments to be something, like HEREDOC. > > 3. Free format is the king! Language designers shouldn't dictate > programmers > how to format and ident their code. > How differnt is starting comment line from '%' in Erlang, from putting 'C' > or '*' in the first column in FORTRAN? > > 4. In other languages, that doesn't have multiline comments I often use > ifdef(false) macro, or outright if(false) to "comment out" parts of code. I > think it's uglier, than proper multiline comments, but still better than > comment every single line. > > Zvi > > On Tue, Dec 7, 2010 at 8:20 PM, Rapsey wrote: > > > Is it that important? Any proper programming editor can comment/uncomment > > multiple lines. > > > > > > Sergej > > > > > > On Tue, Dec 7, 2010 at 5:49 PM, Zvi . wrote: > > > >> Why do you think it's not possible? > >> It's just simple change to Erlang source code parser. > >> Probably this should be submitted as EEP, so OTP team will consider it. > >> > >> On Tue, Dec 7, 2010 at 6:25 PM, James Churchman < > jameschurchman > >> >wrote: > >> > >> > not posible in erlang, but many editors (eg i use textmate) will > comment > >> > and uncomment multiple lines with % on each line.. > >> > On 7 Dec 2010, at 15:32, Zvi wrote: > >> > > >> > > Hi, > >> > > > >> > > Matlab/Octave has single line comments, like Erlang (i.e. starting > >> > > with '%' sign). But it also have multi-line comments, like for > >> > > example: > >> > > > >> > > %{ > >> > > this is example > >> > > of multi-line > >> > > comments in Matlab > >> > > %} > >> > > > >> > > which is equivalent to: > >> > > > >> > > %this is example > >> > > %of multi-line > >> > > %comments in Matlab > >> > > > >> > > How difficult is to add comments like this to Erlang? > >> > > > >> > > Thanks, > >> > > Zvi > >> > > > >> > > ________________________________________________________________ > >> > > erlang-questions (at) erlang.org mailing list. > >> > > See http://www.erlang.org/faq.html > >> > > To unsubscribe; mailto:erlang-questions-unsubscribe > >> > > > >> > > >> > > >> > > > > > From rtrlists Thu Dec 9 17:01:00 2010 From: rtrlists (Robert Raschke) Date: Thu, 9 Dec 2010 16:01:00 +0000 Subject: Handling TICK in a C Node running longish jobs Message-ID: Hiya, I've got a C program that acts as a Node using the nice EI interface libs. The C program is single threaded. And it now turns out I sometimes want it to do something that might actually take a few minutes. This in turn leads to TICK messages not getting acknowledged in time and the Erlang Node removing the timed out connection. I'm looking for some thoughts on how best to approach this. A couple of thoughts come to mind: 1. Make the C program multi-threaded. 2. Somehow lengthen the TICK interval for this connection. The first one makes me cringe. And the second one I don't know how to do. Any other ideas or pointers are most welcome, Robby From jack Thu Dec 9 17:09:59 2010 From: jack (Jack Moffitt) Date: Thu, 9 Dec 2010 09:09:59 -0700 Subject: [erlang-questions] Handling TICK in a C Node running longish jobs In-Reply-To: References: Message-ID: > 1. Make the C program multi-threaded. > 2. Somehow lengthen the TICK interval for this connection. > > The first one makes me cringe. And the second one I don't know how to do. Instead of multi-threaded, just spawn a child process. It's far simpler, and it's a pattern you already know from Erlang. jack. From hynek Thu Dec 9 17:21:57 2010 From: hynek (Hynek Vychodil) Date: Thu, 9 Dec 2010 17:21:57 +0100 Subject: [erlang-questions] Some problem abount exit signal? In-Reply-To: <358077851.179421291852994443.JavaMail.root@zimbra> References: <517915924.179401291852970966.JavaMail.root@zimbra> <358077851.179421291852994443.JavaMail.root@zimbra> Message-ID: On Thu, Dec 9, 2010 at 1:03 AM, Robert Virding wrote: > Yes, the problem is not with the "sender" of the signal. exit/1 and exit/2 are different: exit/1 ends the process which results in exit reason being sent as a signal to the processes in the link set; while exit/2 fakes a signal to the receiving process *as if* the process had died. > > The problem occurs in the "receiving" process. If it receives a 'kill' signal it will behave differently depending on how the signal was sent. There should not be two different behaviours attached to one signal, kill, depending on how it was sent. A 'kill' should always be a 'kill' in the same way as a 'normal' is always a 'normal'. It is really not different if the signal 'normal' caused a process to terminate when sent with exit/2 but be ignored if the sending process dies with exit(normal). > > Or writing a server where a request message means different things depending on who sent them. > > Different behaviours should be caused by things with different names. > > Robert > >From point of receiver view if I receive signal {'EXIT', self(), kill} I can be sure it is not produced by exit/2 kill because it is untrappable so I can be sure it is fake. If I receive {'EXIT', PID, kill} when PID =/= self() I can be sure this PID was not killed by exit/2 kill because it would be translated to killed. So I can't be confused, simply when I receive {'EXIT', _, kill} I'm sure it is not produced by exit/2 kill message. From point of receiver view only {'EXIT', _, Reason} when Reason =:= killed; Reason =:= normal has special meanings. I'm pretty happy with it. Untrappable 'kill' even doesn't have to have {'EXIT', _, kill} format because I can't ever see it. It happen behind the scene, if it is not observable I can't say there is any inconsistency. Only news for me from this discussion is that exit/1 is catchable and exit/2 isn't which I didn't realize before. It is little bit annoying they have same name even they do something absolutely different. One raises exception and other sends message. There is nothing wrong with 'kill' but with exit/1 and exit/2. > > ----- "Hynek Vychodil" wrote: > >> I few moment I think there is the bug but after some experiments I >> have to say it is pretty clear here. >> >> exit/1 doesn't sends any signal. It is simple "local exception" - >> termination which is catchable in catch and try. When it is not catch >> process terminates as usual and sends exit message to linked >> processes >> with reason. 'kill' reason is send as any other reason. There is not >> special meaning except 'normal' ... >> >> exit/2 sends message and only when there is 'kill' reason it makes >> "untrappable" kill and is translated to 'killed' exit message to >> linked processes. exit/2 sends message which doesn't have "local" >> behavior even I send it to myself because it is just like any other >> message. I.e. it is uncatchable by catch or try. When exit signal is >> not trapped i.e. it is untrappable (only direct exit/2 'kill') or is >> not 'normal' and exit signals are not trapped then process dies and >> exit signal is resend to linked processes with reason translation to >> 'killed' just only for untrappable 'kill'. >> >> It makes perfect sense for me and I can't see there any bug or >> misconception. Maybe documentation should be more explicit there. >> >> On Sun, Dec 5, 2010 at 2:36 AM, Robert Virding >> wrote: >> > Yes, this is how it works, but I definitely consider this to be a >> bug. To elaborate with a simple example: >> > >> > 1> self(). >> > <0.31.0> >> > 2> spawn_link(fun () -> exit(kill) end). >> > ** exception exit: killed >> > 3> self(). >> > <0.35.0> >> > >> > Here I have received 'kill' signal and died as I should. Now I trap >> exits: >> > >> > 4> process_flag(trap_exit, true). >> > false >> > 5> spawn_link(fun () -> exit(kill) end). >> > <0.39.0> >> > 6> flush(). >> > Shell got {'EXIT',<0.39.0>,kill} >> > ok >> > >> > This time I received a trappable 'kill' signal. Finally I explicitly >> send the 'kill' signal to me: >> > >> > 7> Self = self(). >> > <0.35.0> >> > 8> process_flag(trap_exit, true). ? ? ? ? ?%Just to be explicit >> > true >> > 9> spawn_link(fun () -> exit(Self, kill) end). >> > ** exception exit: killed >> > 10> self(). >> > <0.45.0> >> > >> > And this time I received an untrappable 'kill' signal. >> > >> > This means that there are two different types of 'kill' signals, >> trappable and untrappable, in the systems depending on how they were >> sent. This is illogical and unclear as there should not be two >> different signals with the same name which behave differently. It is >> definitely a bug which should be fixed. I see two (three) different >> solutions: >> > >> > 1. Make it so that a process which does exit(kill) sends a real, >> untrappable kill signal to its link set (which then in turn transmit >> 'killed'). >> > >> > 2. Make it so that a process which does exit(kill) behaves as if it >> were killed and so transmits 'killed' to its link set. >> > >> > 3. Leave it as it is and create a >> 'properly_behaving_really_untrappable_kill' signal which behaves >> sensibly. >> > >> > I think the first option is the best. >> > >> > Robert >> > >> > P.S. Now to copy all this to erlang-bugs. >> > >> > P.P.S. I have just noticed that doing exit(self(), normal) kills me >> while some other process doing exit(Me, normal) doesn't. Sigh, so >> normal isn't normal. >> > >> > >> > ----- "Ulf Wiger" wrote: >> > >> >> Process C terminates itself with exit(kill). The atom 'kill' >> >> is not special in this case, but simply a normal exit reason. >> >> >> >> A propagated exit signal can never act as a kill signal in the >> >> first place, but here, not even the original exit is an >> untrappable >> >> kill. >> >> >> >> Try: >> >> >> >> Eshell V5.8.1 ?(abort with ^G) >> >> 1> self(). >> >> <0.31.0> >> >> 2> catch exit(kill). >> >> {'EXIT',kill} >> >> 3> self(). >> >> <0.31.0> >> >> >> >> BR, >> >> Ulf W >> >> >> >> On 2 Dec 2010, at 05:37, sky wrote: >> >> >> >> > Hi guys, >> >> > >> >> > In the Joe's book <>, page 163, there are >> some >> >> description about exit signal : >> >> > >> >> > When an exit signal arrives at a process, then a number of >> >> different >> >> > things might happen. What happens depends upon the state of the >> >> > receiving process and upon the value of the exit signal and is >> >> deter- >> >> > mined by the following table: >> >> > >> >> > >> >> > but when use edemo1:start(true, {die, kill}), the result is: >> >> > >> >> > edemo1:start(true, {die,kill}). >> >> > Process b received {'EXIT',<0.73.0>,kill} >> >> > process b (<0.72.0>) is alive >> >> > process c (<0.73.0>) is dead >> >> > ok >> >> > Why process b is alive? Cause as the descripion in this book, >> ?when >> >> the exit signal >> >> > {'EXIT',<0.73.0>,kill} >> >> > arrived, the process b will die and broadcast the exit signal >> killed >> >> to the link set. >> >> > >> >> > the souce code of edemo1 module as following: >> >> > >> >> > %% --- >> >> > %% ?Excerpted from "Programming Erlang", >> >> > %% ?published by The Pragmatic Bookshelf. >> >> > %% ?Copyrights apply to this code. It may not be used to create >> >> training material, >> >> > %% ?courses, books, articles, and the like. Contact us if you are >> in >> >> doubt. >> >> > %% ?We make no guarantees that this code is fit for any purpose. >> >> > %% ?Visit http://www.pragmaticprogrammer.com/titles/jaerlang for >> >> more book information. >> >> > %%--- >> >> > >> >> > -module(edemo1). >> >> > -export([start/2]). >> >> > >> >> > start(Bool, M) -> >> >> > ? ? A = spawn(fun() -> a() end), >> >> > ? ? B = spawn(fun() -> b(A, Bool) end), >> >> > ? ? C = spawn(fun() -> c(B, M) end), >> >> > ? ? sleep(1000), >> >> > ? ? status(b, B), >> >> > ? ? status(c, C). >> >> > >> >> > >> >> > a() -> >> >> > ? ? process_flag(trap_exit, true), >> >> > ? ? wait(a). >> >> > >> >> > b(A, Bool) -> >> >> > ? ? process_flag(trap_exit, Bool), >> >> > ? ? link(A), >> >> > ? ? wait(b). >> >> > >> >> > c(B, M) -> >> >> > ? ? link(B), >> >> > ? ? case M of >> >> > ? ? {die, Reason} -> >> >> > ? ? ? ? exit(Reason); >> >> > ? ? {divide, N} -> >> >> > ? ? ? ? 1/N, >> >> > ? ? ? ? wait(c); >> >> > ? ? normal -> >> >> > ? ? ? ? true >> >> > ? ? end. >> >> > >> >> > >> >> > >> >> > wait(Prog) -> >> >> > ? ? receive >> >> > ? ? Any -> >> >> > ? ? ? ? io:format("Process ~p received ~p~n",[Prog, Any]), >> >> > ? ? ? ? wait(Prog) >> >> > ? ? end. >> >> > >> >> > >> >> > >> >> > sleep(T) -> >> >> > ? ? receive >> >> > ? ? after T -> true >> >> > ? ? end. >> >> > >> >> > status(Name, Pid) -> >> >> > ? ? case erlang:is_process_alive(Pid) of >> >> > ? ? true -> >> >> > ? ? ? ? io:format("process ~p (~p) is alive~n", [Name, Pid]); >> >> > ? ? false -> >> >> > ? ? ? ? io:format("process ~p (~p) is dead~n", [Name,Pid]) >> >> > ? ? end. >> >> > >> >> > >> >> >> >> Ulf Wiger, CTO, Erlang Solutions, Ltd. >> >> http://erlang-solutions.com >> > >> > ________________________________________________________________ >> > erlang-questions (at) erlang.org mailing list. >> > See http://www.erlang.org/faq.html >> > To unsubscribe; mailto:erlang-questions-unsubscribe >> > >> > >> >> >> >> -- >> --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 > -- --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 Thu Dec 9 18:25:23 2010 From: ulf.wiger (Ulf Wiger) Date: Thu, 9 Dec 2010 18:25:23 +0100 Subject: [erlang-questions] RFC: mnesia majority checking In-Reply-To: References: Message-ID: <4E9EB37B-17C2-48A3-AFA3-CF1B256E4615@erlang-solutions.com> I added majority checking in the mnesia_locker as well. The main reason for doing so (except aborting earlier), was to enable majority checking on reads. The way it works now is that majority checking is done on reads that use a write lock (e.g. mnesia:wread/1). A normal read, with a read lock, will succeed even in a minority. This is probably a pretty good thing. https://github.com/uwiger/otp/commit/650f8e30d205bc1130f37c819f920f901358b937 Comments still most welcome. Monologues are fun too, but I can follow Dan North's advice and get a rubber duck for that. If you are unsure whether this is at all needed, please chime in. It's is most definitely not a stupid question. BR, Ulf W On 9 Dec 2010, at 15:26, Ulf Wiger wrote: > > git fetch git://github.com/uwiger/otp mnesia-majority > > https://github.com/uwiger/otp/commit/d97ae7d4329d9342e576f3cdd893de6865449e42 > > This is a first stab at a function that I believe could be useful in > high-availability applications using mnesia. > > At this stage, I'd love to have some comments, and suggestions, > if someone thinks of a better way to do it. > > From the commit message: > > "Add {majority, boolean()} per-table option. > > With {majority, true} set for a table, write transactions will > abort if they cannot commit to a majority of the nodes that > have a copy of the table. Currently, the implementation hooks > into the prepare_commit, and forces an asymmetric transaction > if the commit set affects any table with the majority flag set. > In the commit itself, the transaction will abort if it cannot > satisfy the majority requirement for all tables involved in the > thransaction. > > A future optimization might be to abort already when a write > lock is attempted on such a table (/-object) and the lock cannot > be set on enough nodes. > > This functionality introduces the possibility to automatically > "fence off" a table in the presence of failures. > > This is a first implementation. Only basic tests have been > performed." > > One particular use of this functionality would be to have a "global > resource pool" in one table with {majority, true}, and periodically > check out resources into a local buffer. If there is a failure condition, > you can use the local buffer, but not check out more resources, unless > you happen to still be in contact with more than half of the replicas. > > This should allow for a well-defined merge after a network split. > > BR, > Ulf W > > Ulf Wiger, CTO, Erlang Solutions, Ltd. > http://erlang-solutions.com > > > Ulf Wiger, CTO, Erlang Solutions, Ltd. http://erlang-solutions.com From alessandro.sivieri Thu Dec 9 18:34:44 2010 From: alessandro.sivieri (Alessandro Sivieri) Date: Thu, 9 Dec 2010 18:34:44 +0100 Subject: Server load tests on Linux Message-ID: Hi all, I'm trying to perform some load tests on a Web server, so I have created a little script performing parallel connections to the server and getting the responses, all this using httpc, but when this number gets large this message starts to pop out: =ERROR REPORT==== 9-Dec-2010::18:30:14 === HTTPC-MANAGER handler (<0.297.0>) successfully started for unknown request #Ref<0.0.0.651> => canceling Is there a limit in the number httpc is able to treat? Or maybe I have to change something in my OS (Ubuntu 10.10)? -- Sivieri Alessandro alessandro.sivieri http://www.chimera-bellerofonte.eu/ http://www.poul.org/ From alessandro.sivieri Thu Dec 9 18:35:43 2010 From: alessandro.sivieri (Alessandro Sivieri) Date: Thu, 9 Dec 2010 18:35:43 +0100 Subject: [erlang-questions] Generic server and state recovery In-Reply-To: References: Message-ID: Many thanks! I haven't thought about trapping exits, that's exactly what I was looking for. -- Sivieri Alessandro alessandro.sivieri http://www.chimera-bellerofonte.eu/ http://www.poul.org/ From zvi.avraham Thu Dec 9 18:50:45 2010 From: zvi.avraham (Zvi) Date: Thu, 9 Dec 2010 09:50:45 -0800 (PST) Subject: Multi-line comments in Erlang In-Reply-To: References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> Message-ID: <6c56af86-dab3-4fc9-83c2-4c0b5a44b68b@p11g2000vbn.googlegroups.com> I think Python using '#' for comments. On Dec 9, 5:58?pm, Daniel Goertzen wrote: > Thank you for reminding me about HEREDOCs. ?In Python, I often use triple > quoted strings for multiline comments. ?It works well, but they are exposed > to the interpreter which smells a bit. ?What if erlang had HEREDOCs *plus* a > way to mark any string as a comment. ?Some illustrations, using Python's > triple quoting as HEREDOC format. > > X=""" > This is > a multiline heredoc > """, > ... > > %""" > This is > a multiline comment > """ > > myfun(X, Y %"An inline comment", Z) -> ... > > So comment and string delimiting uses the exact same logic, but you stick a > % in front to mark it as a comment instead of a string. > > Dan. > > On Thu, Dec 9, 2010 at 3:48 AM, Zvi . wrote: > > 1. The beauty of dynamic languages is that you don't need tools and IDEs! > > And even if you do use tools, many times you work not on your machine or on > > target headless environments, with only basic editor available, or with > > editor that you know poorly or which didn't configured with your macros, > > etc. > > > 2. Comments are essentially Natural language (let's say US English) > > document, embedded into Programming language (Erlang) document. > > Therefore, embedded document should be left intact. Ideally I would like > > comments to be something, like HEREDOC. > > > 3. Free format is the king! Language designers shouldn't dictate > > programmers > > how to format and ident their code. > > How differnt is starting comment line from '%' in Erlang, from putting 'C' > > or '*' in the first column in FORTRAN? > > > 4. In other languages, that doesn't have multiline comments I often use > > ifdef(false) macro, or outright if(false) to "comment out" parts of code. I > > think it's uglier, than proper multiline comments, but still better than > > comment every single line. > > > Zvi > > > On Tue, Dec 7, 2010 at 8:20 PM, Rapsey wrote: > > > > Is it that important? Any proper programming editor can comment/uncomment > > > multiple lines. > > > > Sergej > > > > On Tue, Dec 7, 2010 at 5:49 PM, Zvi . wrote: > > > >> Why do you think it's not possible? > > >> It's just simple change to Erlang source code parser. > > >> Probably this should be submitted as EEP, so OTP team will consider it. > > > >> On Tue, Dec 7, 2010 at 6:25 PM, James Churchman < > > jameschurch... > > >> >wrote: > > > >> > not posible in erlang, but many editors (eg i use textmate) will > > comment > > >> > and uncomment multiple lines with % on each line.. > > >> > On 7 Dec 2010, at 15:32, Zvi wrote: > > > >> > > Hi, > > > >> > > Matlab/Octave has single line comments, like Erlang (i.e. starting > > >> > > with '%' sign). But it also have multi-line comments, like for > > >> > > example: > > > >> > > %{ > > >> > > this is example > > >> > > of multi-line > > >> > > comments in Matlab > > >> > > %} > > > >> > > which is equivalent to: > > > >> > > %this is example > > >> > > %of multi-line > > >> > > %comments in Matlab > > > >> > > How difficult is to add comments like this to Erlang? > > > >> > > Thanks, > > >> > > Zvi > > > >> > > ________________________________________________________________ > > >> > > erlang-questions (at) erlang.org mailing list. > > >> > > Seehttp://www.erlang.org/faq.html > > >> > > To unsubscribe; mailto:erlang-questions-unsubscr... > > From banibrata.dutta Thu Dec 9 18:55:36 2010 From: banibrata.dutta (Banibrata Dutta) Date: Thu, 9 Dec 2010 23:25:36 +0530 Subject: [erlang-questions] Re: Multi-line comments in Erlang In-Reply-To: <6c56af86-dab3-4fc9-83c2-4c0b5a44b68b@p11g2000vbn.googlegroups.com> References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <6c56af86-dab3-4fc9-83c2-4c0b5a44b68b@p11g2000vbn.googlegroups.com> Message-ID: On Thu, Dec 9, 2010 at 11:20 PM, Zvi wrote: > I think Python using '#' for comments. > Single line comments start with '#', but multi-line is done using """...""" > > On Dec 9, 5:58 pm, Daniel Goertzen wrote: > > Thank you for reminding me about HEREDOCs. In Python, I often use triple > > quoted strings for multiline comments. It works well, but they are > exposed > > to the interpreter which smells a bit. What if erlang had HEREDOCs > *plus* a > > way to mark any string as a comment. Some illustrations, using Python's > > triple quoting as HEREDOC format. > > > > X=""" > > This is > > a multiline heredoc > > """, > > ... > > > > %""" > > This is > > a multiline comment > > """ > > > > myfun(X, Y %"An inline comment", Z) -> ... > > > > So comment and string delimiting uses the exact same logic, but you stick > a > > % in front to mark it as a comment instead of a string. > > > > Dan. > > > > > From mk Thu Dec 9 19:04:11 2010 From: mk (Morten Krogh) Date: Thu, 09 Dec 2010 19:04:11 +0100 Subject: [erlang-questions] Handling TICK in a C Node running longish jobs In-Reply-To: References: Message-ID: <4D011A1B.7010209@amberbio.com> What aboutnet_kernel:set_net_ticktime(NetTicktime). But you have to make the change for all nodes in your network, I think. Morten. On 12/9/10 5:01 PM, Robert Raschke wrote: > Hiya, > > I've got a C program that acts as a Node using the nice EI interface libs. > > The C program is single threaded. And it now turns out I sometimes want it > to do something that might actually take a few minutes. > > This in turn leads to TICK messages not getting acknowledged in time and the > Erlang Node removing the timed out connection. > > I'm looking for some thoughts on how best to approach this. A couple of > thoughts come to mind: > > 1. Make the C program multi-threaded. > 2. Somehow lengthen the TICK interval for this connection. > > The first one makes me cringe. And the second one I don't know how to do. > > Any other ideas or pointers are most welcome, > Robby > From jesper.louis.andersen Thu Dec 9 19:04:10 2010 From: jesper.louis.andersen (Jesper Louis Andersen) Date: Thu, 9 Dec 2010 19:04:10 +0100 Subject: [erlang-questions] Generic server and state recovery In-Reply-To: References: Message-ID: On Thu, Dec 9, 2010 at 6:35 PM, Alessandro Sivieri wrote: > Many thanks! I haven't thought about trapping exits, that's exactly what I > was looking for. I like to have other processes be responsible for data in the situation. The problem with "saving" data by a hail-mary exit trap is that the data may be quite corrupt it this point in time. So your system should be able to cope with any lack of sanitizing. -- J. From alessandro.sivieri Thu Dec 9 19:09:14 2010 From: alessandro.sivieri (Alessandro Sivieri) Date: Thu, 9 Dec 2010 19:09:14 +0100 Subject: [erlang-questions] Generic server and state recovery In-Reply-To: References: Message-ID: 2010/12/9 Jesper Louis Andersen > I like to have other processes be responsible for data in the > situation. The problem with "saving" data by a hail-mary exit trap is > that the data may be quite corrupt it this point in time. So your > system should be able to cope with any lack of sanitizing. > > Well, my server process maintains a list of other processes associated with unique keys in a dictionary, and I have found out that if the server process itself crashes, I am able to recover process pids and keys directly from the supervisor (I have a secondary dedicated supervisor for those processes); for now I am not trapping exists, but it may become useful later... I may also save that data in some persistent locus, if needed. -- Sivieri Alessandro alessandro.sivieri http://www.chimera-bellerofonte.eu/ http://www.poul.org/ From mk Thu Dec 9 19:11:27 2010 From: mk (Morten Krogh) Date: Thu, 09 Dec 2010 19:11:27 +0100 Subject: [erlang-questions] RFC: mnesia majority checking In-Reply-To: <4E9EB37B-17C2-48A3-AFA3-CF1B256E4615@erlang-solutions.com> References: <4E9EB37B-17C2-48A3-AFA3-CF1B256E4615@erlang-solutions.com> Message-ID: <4D011BCF.1030605@amberbio.com> Hi Ulf Did you consider using the Paxos algorithm? How do you cope with node failure after the commit process has decided to commit but before the messages have arrived at the other nodes. Morten. On 12/9/10 6:25 PM, Ulf Wiger wrote: > I added majority checking in the mnesia_locker as well. > The main reason for doing so (except aborting earlier), > was to enable majority checking on reads. > > The way it works now is that majority checking is done on > reads that use a write lock (e.g. mnesia:wread/1). > A normal read, with a read lock, will succeed even in a > minority. This is probably a pretty good thing. > > https://github.com/uwiger/otp/commit/650f8e30d205bc1130f37c819f920f901358b937 > > Comments still most welcome. Monologues are fun too, but > I can follow Dan North's advice and get a rubber duck for that. > > If you are unsure whether this is at all needed, please chime in. > It's is most definitely not a stupid question. > > BR, > Ulf W > > On 9 Dec 2010, at 15:26, Ulf Wiger wrote: > >> git fetch git://github.com/uwiger/otp mnesia-majority >> >> https://github.com/uwiger/otp/commit/d97ae7d4329d9342e576f3cdd893de6865449e42 >> >> This is a first stab at a function that I believe could be useful in >> high-availability applications using mnesia. >> >> At this stage, I'd love to have some comments, and suggestions, >> if someone thinks of a better way to do it. >> >> From the commit message: >> >> "Add {majority, boolean()} per-table option. >> >> With {majority, true} set for a table, write transactions will >> abort if they cannot commit to a majority of the nodes that >> have a copy of the table. Currently, the implementation hooks >> into the prepare_commit, and forces an asymmetric transaction >> if the commit set affects any table with the majority flag set. >> In the commit itself, the transaction will abort if it cannot >> satisfy the majority requirement for all tables involved in the >> thransaction. >> >> A future optimization might be to abort already when a write >> lock is attempted on such a table (/-object) and the lock cannot >> be set on enough nodes. >> >> This functionality introduces the possibility to automatically >> "fence off" a table in the presence of failures. >> >> This is a first implementation. Only basic tests have been >> performed." >> >> One particular use of this functionality would be to have a "global >> resource pool" in one table with {majority, true}, and periodically >> check out resources into a local buffer. If there is a failure condition, >> you can use the local buffer, but not check out more resources, unless >> you happen to still be in contact with more than half of the replicas. >> >> This should allow for a well-defined merge after a network split. >> >> BR, >> Ulf W >> >> Ulf Wiger, CTO, Erlang Solutions, Ltd. >> http://erlang-solutions.com >> >> >> > Ulf Wiger, CTO, Erlang Solutions, Ltd. > http://erlang-solutions.com > > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > From jesper.louis.andersen Thu Dec 9 19:11:12 2010 From: jesper.louis.andersen (Jesper Louis Andersen) Date: Thu, 9 Dec 2010 19:11:12 +0100 Subject: [erlang-questions] Generic server and state recovery In-Reply-To: References: Message-ID: On Thu, Dec 9, 2010 at 7:09 PM, Alessandro Sivieri wrote: > Well, my server process maintains a list of other processes associated with > unique keys in a dictionary, and I have found out that if the server process > itself crashes, I am able to recover process pids and keys directly from the > supervisor (I have a secondary dedicated supervisor for those processes); > for now I am not trapping exists, but it may become useful later... > I may also save that data in some persistent locus, if needed. Don't underestimate the power of using monitors for this task. -- J. From alessandro.sivieri Thu Dec 9 19:15:02 2010 From: alessandro.sivieri (Alessandro Sivieri) Date: Thu, 9 Dec 2010 19:15:02 +0100 Subject: [erlang-questions] Generic server and state recovery In-Reply-To: References: Message-ID: 2010/12/9 Jesper Louis Andersen > Don't underestimate the power of using monitors for this task. > > Yes, but I already have a supervisor supervising that process, isn't a monitor process a kind of repetition of the same (or similar) task? -- Sivieri Alessandro alessandro.sivieri http://www.chimera-bellerofonte.eu/ http://www.poul.org/ From jesper.louis.andersen Thu Dec 9 19:20:06 2010 From: jesper.louis.andersen (Jesper Louis Andersen) Date: Thu, 9 Dec 2010 19:20:06 +0100 Subject: [erlang-questions] Generic server and state recovery In-Reply-To: References: Message-ID: On Thu, Dec 9, 2010 at 7:15 PM, Alessandro Sivieri wrote: > > Yes, but I already have a supervisor supervising that process, isn't a > monitor process a kind of repetition of the same (or similar) task? > I don't think so. The supervisor has the responsibility of restarting fallen processes. The monitoring process (in etorrent at least) is often the governor of an ETS table. It maintains serialization on the table when needed and it cleans up the table through receiving a 'DOWN' message. I.e., the monitoring process is responsible for keeping and maintaining certain kind of state on behalf of the working process. You don't want to muddle these two responsibilities into one, I think. -- J. From ulf.wiger Thu Dec 9 19:47:15 2010 From: ulf.wiger (Ulf Wiger) Date: Thu, 9 Dec 2010 19:47:15 +0100 Subject: [erlang-questions] RFC: mnesia majority checking In-Reply-To: <4D011BCF.1030605@amberbio.com> References: <4E9EB37B-17C2-48A3-AFA3-CF1B256E4615@erlang-solutions.com> <4D011BCF.1030605@amberbio.com> Message-ID: On 9 Dec 2010, at 19:11, Morten Krogh wrote: > Hi Ulf > > Did you consider using the Paxos algorithm? My intention for now was not to do any major surgery to the mnesia transaction handler, but rather extend the existing semantics with something useful. So as a first step, I wanted to add the 'majority' option, since I thought that would be a simple way to add quorum-style safety and fencing in mnesia. > How do you cope with node failure after the commit process has decided to commit but before the messages have arrived at the other nodes. Actually, the asym_trans commit protocol in mnesia does this already. This protocol is used whenever the transaction contains schema updates or asymmetric replication patterns, It is more heavyweight than the 'sym_trans' protocol precisely because it deals with failures in the commit phase. Specifically, the way it deals with failures in the commit phase is that it rolls back the transaction. BR, Ulf W > > Morten. > > > On 12/9/10 6:25 PM, Ulf Wiger wrote: >> I added majority checking in the mnesia_locker as well. >> The main reason for doing so (except aborting earlier), >> was to enable majority checking on reads. >> >> The way it works now is that majority checking is done on >> reads that use a write lock (e.g. mnesia:wread/1). >> A normal read, with a read lock, will succeed even in a >> minority. This is probably a pretty good thing. >> >> https://github.com/uwiger/otp/commit/650f8e30d205bc1130f37c819f920f901358b937 >> >> Comments still most welcome. Monologues are fun too, but >> I can follow Dan North's advice and get a rubber duck for that. >> >> If you are unsure whether this is at all needed, please chime in. >> It's is most definitely not a stupid question. >> >> BR, >> Ulf W >> >> On 9 Dec 2010, at 15:26, Ulf Wiger wrote: >> >>> git fetch git://github.com/uwiger/otp mnesia-majority >>> >>> https://github.com/uwiger/otp/commit/d97ae7d4329d9342e576f3cdd893de6865449e42 >>> >>> This is a first stab at a function that I believe could be useful in >>> high-availability applications using mnesia. >>> >>> At this stage, I'd love to have some comments, and suggestions, >>> if someone thinks of a better way to do it. >>> >>> From the commit message: >>> >>> "Add {majority, boolean()} per-table option. >>> >>> With {majority, true} set for a table, write transactions will >>> abort if they cannot commit to a majority of the nodes that >>> have a copy of the table. Currently, the implementation hooks >>> into the prepare_commit, and forces an asymmetric transaction >>> if the commit set affects any table with the majority flag set. >>> In the commit itself, the transaction will abort if it cannot >>> satisfy the majority requirement for all tables involved in the >>> thransaction. >>> >>> A future optimization might be to abort already when a write >>> lock is attempted on such a table (/-object) and the lock cannot >>> be set on enough nodes. >>> >>> This functionality introduces the possibility to automatically >>> "fence off" a table in the presence of failures. >>> >>> This is a first implementation. Only basic tests have been >>> performed." >>> >>> One particular use of this functionality would be to have a "global >>> resource pool" in one table with {majority, true}, and periodically >>> check out resources into a local buffer. If there is a failure condition, >>> you can use the local buffer, but not check out more resources, unless >>> you happen to still be in contact with more than half of the replicas. >>> >>> This should allow for a well-defined merge after a network split. >>> >>> BR, >>> Ulf W >>> >>> Ulf Wiger, CTO, Erlang Solutions, Ltd. >>> http://erlang-solutions.com >>> >>> >>> >> Ulf Wiger, CTO, Erlang Solutions, Ltd. >> http://erlang-solutions.com >> >> >> >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe >> > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > Ulf Wiger, CTO, Erlang Solutions, Ltd. http://erlang-solutions.com From djk121 Thu Dec 9 19:52:17 2010 From: djk121 (Dan Kelley) Date: Thu, 9 Dec 2010 13:52:17 -0500 Subject: [erlang-questions] Server load tests on Linux In-Reply-To: References: Message-ID: On Thu, Dec 9, 2010 at 12:34 PM, Alessandro Sivieri < alessandro.sivieri> wrote: > Hi all, > > I'm trying to perform some load tests on a Web server, so I have created a > little script performing parallel connections to the server and getting the > responses, all this using httpc, but when this number gets large this > message starts to pop out: > > =ERROR REPORT==== 9-Dec-2010::18:30:14 === > HTTPC-MANAGER handler (<0.297.0>) successfully started for > unknown request #Ref<0.0.0.651> => canceling > > I ran into what sounds like the same thing a while back, see here: http://groups.google.com/group/erlang-programming/browse_thread/thread/ef41c4f044521ee0/eb1dab49ee589d54?lnk=gst&q=kelley#eb1dab49ee589d54 I ended up switching to ibrowse. After doing that, I was able to get many more simultaneous connections before hitting a bug in that software. (Supposedly that bug has been fixed by the maintainer in the latest version, but I haven't had the opportunity to re-test.) Dan From mk Thu Dec 9 20:38:16 2010 From: mk (Morten Krogh) Date: Thu, 9 Dec 2010 20:38:16 +0100 Subject: [erlang-questions] RFC: mnesia majority checking In-Reply-To: References: <4E9EB37B-17C2-48A3-AFA3-CF1B256E4615@erlang-solutions.com> <4D011BCF.1030605@amberbio.com> Message-ID: <73B551E2-71B4-4243-909E-F4AE23207203@amberbio.com> Okay, but without Paxos or something similar, there will be some failure modes where the system becomes inconsistent. When do you roll back? After the commit? I was talking about a failure after the commit decision. Rollback after commit doesn't make sense?? Cheers, Morten. On Dec 9, 2010, at 7:47 PM, Ulf Wiger wrote: > > On 9 Dec 2010, at 19:11, Morten Krogh wrote: > >> Hi Ulf >> >> Did you consider using the Paxos algorithm? > > My intention for now was not to do any major surgery to > the mnesia transaction handler, but rather extend the existing > semantics with something useful. > > So as a first step, I wanted to add the 'majority' option, since > I thought that would be a simple way to add quorum-style > safety and fencing in mnesia. > >> How do you cope with node failure after the commit process has decided to commit but before the messages have arrived at the other nodes. > > Actually, the asym_trans commit protocol in mnesia does > this already. This protocol is used whenever the transaction > contains schema updates or asymmetric replication patterns, > It is more heavyweight than the 'sym_trans' protocol precisely > because it deals with failures in the commit phase. > > Specifically, the way it deals with failures in the commit phase > is that it rolls back the transaction. > > BR, > Ulf W > > >> >> Morten. >> >> >> On 12/9/10 6:25 PM, Ulf Wiger wrote: >>> I added majority checking in the mnesia_locker as well. >>> The main reason for doing so (except aborting earlier), >>> was to enable majority checking on reads. >>> >>> The way it works now is that majority checking is done on >>> reads that use a write lock (e.g. mnesia:wread/1). >>> A normal read, with a read lock, will succeed even in a >>> minority. This is probably a pretty good thing. >>> >>> https://github.com/uwiger/otp/commit/650f8e30d205bc1130f37c819f920f901358b937 >>> >>> Comments still most welcome. Monologues are fun too, but >>> I can follow Dan North's advice and get a rubber duck for that. >>> >>> If you are unsure whether this is at all needed, please chime in. >>> It's is most definitely not a stupid question. >>> >>> BR, >>> Ulf W >>> >>> On 9 Dec 2010, at 15:26, Ulf Wiger wrote: >>> >>>> git fetch git://github.com/uwiger/otp mnesia-majority >>>> >>>> https://github.com/uwiger/otp/commit/d97ae7d4329d9342e576f3cdd893de6865449e42 >>>> >>>> This is a first stab at a function that I believe could be useful in >>>> high-availability applications using mnesia. >>>> >>>> At this stage, I'd love to have some comments, and suggestions, >>>> if someone thinks of a better way to do it. >>>> >>>> From the commit message: >>>> >>>> "Add {majority, boolean()} per-table option. >>>> >>>> With {majority, true} set for a table, write transactions will >>>> abort if they cannot commit to a majority of the nodes that >>>> have a copy of the table. Currently, the implementation hooks >>>> into the prepare_commit, and forces an asymmetric transaction >>>> if the commit set affects any table with the majority flag set. >>>> In the commit itself, the transaction will abort if it cannot >>>> satisfy the majority requirement for all tables involved in the >>>> thransaction. >>>> >>>> A future optimization might be to abort already when a write >>>> lock is attempted on such a table (/-object) and the lock cannot >>>> be set on enough nodes. >>>> >>>> This functionality introduces the possibility to automatically >>>> "fence off" a table in the presence of failures. >>>> >>>> This is a first implementation. Only basic tests have been >>>> performed." >>>> >>>> One particular use of this functionality would be to have a "global >>>> resource pool" in one table with {majority, true}, and periodically >>>> check out resources into a local buffer. If there is a failure condition, >>>> you can use the local buffer, but not check out more resources, unless >>>> you happen to still be in contact with more than half of the replicas. >>>> >>>> This should allow for a well-defined merge after a network split. >>>> >>>> BR, >>>> Ulf W >>>> >>>> Ulf Wiger, CTO, Erlang Solutions, Ltd. >>>> http://erlang-solutions.com >>>> >>>> >>>> >>> Ulf Wiger, CTO, Erlang Solutions, Ltd. >>> http://erlang-solutions.com >>> >>> >>> >>> >>> ________________________________________________________________ >>> erlang-questions (at) erlang.org mailing list. >>> See http://www.erlang.org/faq.html >>> To unsubscribe; mailto:erlang-questions-unsubscribe >>> >> >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe >> > > Ulf Wiger, CTO, Erlang Solutions, Ltd. > http://erlang-solutions.com > > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > From ok Thu Dec 9 21:58:21 2010 From: ok (Richard O'Keefe) Date: Fri, 10 Dec 2010 09:58:21 +1300 Subject: [erlang-questions] Multi-line comments in Erlang In-Reply-To: References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> Message-ID: <8E38D38D-8191-4C7C-8427-4B2BCDEFD3D3@cs.otago.ac.nz> On 9/12/2010, at 10:48 PM, Zvi . wrote: > 1. The beauty of dynamic languages is that you don't need tools and IDEs! What has this to do with >dynamic< languages? The only language I use an IDE for is Smalltalk (which is dynamic). Erlang/OTP comes with lots of tools. As for editors, excluding help files, the editor I use is 13100 lines, 6770 SLOC, 381 kiB in size and originally ran on PDP-11s and used to run on MS-DOS. > 2. Comments are essentially Natural language (let's say US English) > document, embedded into Programming language (Erlang) document. People who ask for multiline and nesting comments often want them to contain program text. > Therefore, embedded document should be left intact. This is not a valid conclusion. People who use Javadoc, Haddock (for Haskell), PlDoc (for Prolog), or ErlDoc (for Erlang) *want* their natural language text to be marked up in various ways and transformed for display. There has long been a fashion in C for writing /* long comments * with stars at the * beginning of every line * and a lopside end */ which I have always found ugly. But the existence of that fashion shows that there are many people who find value in their commentary being explicitly marked. > Ideally I would like comments to be something, like HEREDOC. Other people want a clear and unambiguous separation between what is commentary and what is not, so that you can look at _any_ line in a file and instantly tell what you are looking at. > > 3. Free format is the king! A non-sequitur. Ada is free format, but it has only -- end of line comments. Fortran 95 is free format, but it has only ! end of line comments. > Language designers shouldn't dictate programmers > how to format and ident their code. Somebody forgot to tell Larry Wall and Guido van Rossum that; they also forgot to tell the Haskell designers and the Occam designers. > How differnt is starting comment line from '%' in Erlang, from putting 'C' > or '*' in the first column in FORTRAN? Very different. % in Erlang is like ! in Fortran: you can put it in any column you choose. > > 4. In other languages, that doesn't have multiline comments I often use > ifdef(false) macro, or outright if(false) to "comment out" parts of code. This contradicts your earlier statement that the contents of multiline comments are natural language text. > I > think it's uglier, than proper multiline comments, but still better than > comment every single line. Erlang also has -if. From woody.peterson Thu Dec 9 22:52:43 2010 From: woody.peterson (Woody Peterson) Date: Thu, 9 Dec 2010 13:52:43 -0800 Subject: [erlang-questions] Multi-line comments in Erlang In-Reply-To: <8E38D38D-8191-4C7C-8427-4B2BCDEFD3D3@cs.otago.ac.nz> References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8E38D38D-8191-4C7C-8427-4B2BCDEFD3D3@cs.otago.ac.nz> Message-ID: On Dec 9, 2010, at 12:58 PM, Richard O'Keefe wrote: > People who ask for multiline and nesting comments often want them to > contain program text. Furthermore, people who want lots of commented program text often want it for "historical" purposes. Lean on your SCM and just delete it outright. From rzezeski Fri Dec 10 00:21:56 2010 From: rzezeski (Ryan Zezeski) Date: Thu, 9 Dec 2010 18:21:56 -0500 Subject: [erlang-questions] Multi-line comments in Erlang In-Reply-To: References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> Message-ID: <92F762DE-4E1A-4E76-B419-F139E393DEA3@gmail.com> On Dec 9, 2010, at 4:48 AM, "Zvi ." wrote: > > > 3. Free format is the king! Language designers shouldn't dictate programmers > how to format and ident their code. > How differnt is starting comment line from '%' in Erlang, from putting 'C' > or '*' in the first column in FORTRAN? > > Zvi > Really? If free format is king then why does every lang have common code conventions? For example, I hate CamelCase but that doesn't mean I'm going to start naming my variables camel_case in Java because my coworkers would take me out back and beat me. There should always be a middle ground between extremes but without some type of common conventions our code would be a tower of babel, more so than it already is. People make certain assumptions, and when you break those assumptions confusion, contempt, and even bugs can ensue. I don't see the need for multiline comments as described in this thread. Any reputable editor can handle it. I know I have no problems in Emacs or Vim. I also know in the past multiline comments in C++ has bitten me because I nested them in order to comment out code. As has been said, good SCM takes care of this for you, git stash and branch come to mind. -Ryan From alain.odea Fri Dec 10 03:44:57 2010 From: alain.odea (Alain O'Dea) Date: Thu, 9 Dec 2010 23:14:57 -0330 Subject: [erlang-questions] RFC: mnesia majority checking In-Reply-To: <4E9EB37B-17C2-48A3-AFA3-CF1B256E4615@erlang-solutions.com> References: <4E9EB37B-17C2-48A3-AFA3-CF1B256E4615@erlang-solutions.com> Message-ID: The guys at Basho probably have some excellent material on partition tolerance related to Riak. It is worth a chat with Justin Sheehy or Andy Gross to see what insight they have. On Thu, Dec 9, 2010 at 1:55 PM, Ulf Wiger wrote: > > I added majority checking in the mnesia_locker as well. > The main reason for doing so (except aborting earlier), > was to enable majority checking on reads. > > The way it works now is that majority checking is done on > reads that use a write lock (e.g. mnesia:wread/1). > A normal read, with a read lock, will succeed even in a > minority. This is probably a pretty good thing. > > > https://github.com/uwiger/otp/commit/650f8e30d205bc1130f37c819f920f901358b937 > > Comments still most welcome. Monologues are fun too, but > I can follow Dan North's advice and get a rubber duck for that. > > If you are unsure whether this is at all needed, please chime in. > It's is most definitely not a stupid question. > > BR, > Ulf W > > On 9 Dec 2010, at 15:26, Ulf Wiger wrote: > > > > > git fetch git://github.com/uwiger/otp mnesia-majority > > > > > https://github.com/uwiger/otp/commit/d97ae7d4329d9342e576f3cdd893de6865449e42 > > > > This is a first stab at a function that I believe could be useful in > > high-availability applications using mnesia. > > > > At this stage, I'd love to have some comments, and suggestions, > > if someone thinks of a better way to do it. > > > > From the commit message: > > > > "Add {majority, boolean()} per-table option. > > > > With {majority, true} set for a table, write transactions will > > abort if they cannot commit to a majority of the nodes that > > have a copy of the table. Currently, the implementation hooks > > into the prepare_commit, and forces an asymmetric transaction > > if the commit set affects any table with the majority flag set. > > In the commit itself, the transaction will abort if it cannot > > satisfy the majority requirement for all tables involved in the > > thransaction. > > > > A future optimization might be to abort already when a write > > lock is attempted on such a table (/-object) and the lock cannot > > be set on enough nodes. > > > > This functionality introduces the possibility to automatically > > "fence off" a table in the presence of failures. > > > > This is a first implementation. Only basic tests have been > > performed." > > > > One particular use of this functionality would be to have a "global > > resource pool" in one table with {majority, true}, and periodically > > check out resources into a local buffer. If there is a failure condition, > > you can use the local buffer, but not check out more resources, unless > > you happen to still be in contact with more than half of the replicas. > > > > This should allow for a well-defined merge after a network split. > > > > BR, > > Ulf W > > > > Ulf Wiger, CTO, Erlang Solutions, Ltd. > > http://erlang-solutions.com > > > > > > > > Ulf Wiger, CTO, Erlang Solutions, Ltd. > http://erlang-solutions.com > > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From xiaopong.tran Fri Dec 10 07:52:02 2010 From: xiaopong.tran (Xiaopong Tran) Date: Fri, 10 Dec 2010 14:52:02 +0800 Subject: PPA for ubuntu? Message-ID: <1291963922.13124.1.camel@shanghai> Is there a PPA repository of the latest erlang release for Ubuntu? Thanks Xiaopong From ulf.wiger Fri Dec 10 08:44:28 2010 From: ulf.wiger (Ulf Wiger) Date: Fri, 10 Dec 2010 08:44:28 +0100 Subject: [erlang-questions] RFC: mnesia majority checking In-Reply-To: <73B551E2-71B4-4243-909E-F4AE23207203@amberbio.com> References: <4E9EB37B-17C2-48A3-AFA3-CF1B256E4615@erlang-solutions.com> <4D011BCF.1030605@amberbio.com> <73B551E2-71B4-4243-909E-F4AE23207203@amberbio.com> Message-ID: <31818D23-57A6-4CAF-9B49-CE49E07107D7@erlang-solutions.com> On 9 Dec 2010, at 20:38, Morten Krogh wrote: > Okay, but without Paxos or something similar, there will be some failure modes where the system becomes inconsistent. The failure mode where mnesia becomes inconsistent is split brain. Mnesia doesn't bring any table copies online before having synchronised them fully with the online copies. Currently, that is done by simply copying the entire table from one of the active nodes. After a split-brain, mnesia will detect the condition and refuse to sync the tables. There are ways to reconcile, and this was the purpose of my 'unsplit' library (http://github.com/esl/unsplit). The main method I have used so far with unsplit is to compare vector clocks. This works best for asserting that there is no inconsistency, or merging the objects where it's clear from the vector clocks which is the newer object. It doesn't address the problem where reconciliation cannot be automatic. The idea with majority is obviously to allow for a more controlled merging, instructing mnesia not to allow updates under circumstances where subsequent split-brain merging could become undecided. > When do you roll back? After the commit? I was talking about a failure after the commit decision. Rollback after commit doesn't make sense?? The rollback is done if there is any failure during the 'prepare' phase of the commit. If all participants respond favourably to the prepare request, this means that they have logged all data needed to complete the commit and are standing by to hear if they should. The underlying assumption is that failures just after commit in mnesia will not be partial. If a node fails, it needs to come back online by way of comparing decision logs and synchronising tables. Really, I didn't invent this protocol, and I've taken great care not to alter it, as I've assumed it is robust. It's been in mnesia for years. It's the same protocol that's used for schema updates in mnesia, more heavyweight and pessimistic than the 'normal' commit protocol. If you wish to dissect the asym_trans protocol looking for nasty corner cases, I think it's great, but then perhaps one of the mnesia maintainers, Dan and H?kan (still counting H?kan as such) should join the discussion. What I've done is make the commits even more pessimistic in the presence of the 'majority' flag by inserting a precondition. BR, Ulf W > > > Cheers, > > Morten. > > > > > On Dec 9, 2010, at 7:47 PM, Ulf Wiger wrote: > >> >> On 9 Dec 2010, at 19:11, Morten Krogh wrote: >> >>> Hi Ulf >>> >>> Did you consider using the Paxos algorithm? >> >> My intention for now was not to do any major surgery to >> the mnesia transaction handler, but rather extend the existing >> semantics with something useful. >> >> So as a first step, I wanted to add the 'majority' option, since >> I thought that would be a simple way to add quorum-style >> safety and fencing in mnesia. >> >>> How do you cope with node failure after the commit process has decided to commit but before the messages have arrived at the other nodes. >> >> Actually, the asym_trans commit protocol in mnesia does >> this already. This protocol is used whenever the transaction >> contains schema updates or asymmetric replication patterns, >> It is more heavyweight than the 'sym_trans' protocol precisely >> because it deals with failures in the commit phase. >> >> Specifically, the way it deals with failures in the commit phase >> is that it rolls back the transaction. >> >> BR, >> Ulf W >> >> >>> >>> Morten. >>> >>> >>> On 12/9/10 6:25 PM, Ulf Wiger wrote: >>>> I added majority checking in the mnesia_locker as well. >>>> The main reason for doing so (except aborting earlier), >>>> was to enable majority checking on reads. >>>> >>>> The way it works now is that majority checking is done on >>>> reads that use a write lock (e.g. mnesia:wread/1). >>>> A normal read, with a read lock, will succeed even in a >>>> minority. This is probably a pretty good thing. >>>> >>>> https://github.com/uwiger/otp/commit/650f8e30d205bc1130f37c819f920f901358b937 >>>> >>>> Comments still most welcome. Monologues are fun too, but >>>> I can follow Dan North's advice and get a rubber duck for that. >>>> >>>> If you are unsure whether this is at all needed, please chime in. >>>> It's is most definitely not a stupid question. >>>> >>>> BR, >>>> Ulf W >>>> >>>> On 9 Dec 2010, at 15:26, Ulf Wiger wrote: >>>> >>>>> git fetch git://github.com/uwiger/otp mnesia-majority >>>>> >>>>> https://github.com/uwiger/otp/commit/d97ae7d4329d9342e576f3cdd893de6865449e42 >>>>> >>>>> This is a first stab at a function that I believe could be useful in >>>>> high-availability applications using mnesia. >>>>> >>>>> At this stage, I'd love to have some comments, and suggestions, >>>>> if someone thinks of a better way to do it. >>>>> >>>>> From the commit message: >>>>> >>>>> "Add {majority, boolean()} per-table option. >>>>> >>>>> With {majority, true} set for a table, write transactions will >>>>> abort if they cannot commit to a majority of the nodes that >>>>> have a copy of the table. Currently, the implementation hooks >>>>> into the prepare_commit, and forces an asymmetric transaction >>>>> if the commit set affects any table with the majority flag set. >>>>> In the commit itself, the transaction will abort if it cannot >>>>> satisfy the majority requirement for all tables involved in the >>>>> thransaction. >>>>> >>>>> A future optimization might be to abort already when a write >>>>> lock is attempted on such a table (/-object) and the lock cannot >>>>> be set on enough nodes. >>>>> >>>>> This functionality introduces the possibility to automatically >>>>> "fence off" a table in the presence of failures. >>>>> >>>>> This is a first implementation. Only basic tests have been >>>>> performed." >>>>> >>>>> One particular use of this functionality would be to have a "global >>>>> resource pool" in one table with {majority, true}, and periodically >>>>> check out resources into a local buffer. If there is a failure condition, >>>>> you can use the local buffer, but not check out more resources, unless >>>>> you happen to still be in contact with more than half of the replicas. >>>>> >>>>> This should allow for a well-defined merge after a network split. >>>>> >>>>> BR, >>>>> Ulf W >>>>> >>>>> Ulf Wiger, CTO, Erlang Solutions, Ltd. >>>>> http://erlang-solutions.com >>>>> >>>>> >>>>> >>>> Ulf Wiger, CTO, Erlang Solutions, Ltd. >>>> http://erlang-solutions.com >>>> >>>> >>>> >>>> >>>> ________________________________________________________________ >>>> erlang-questions (at) erlang.org mailing list. >>>> See http://www.erlang.org/faq.html >>>> To unsubscribe; mailto:erlang-questions-unsubscribe >>>> >>> >>> >>> ________________________________________________________________ >>> erlang-questions (at) erlang.org mailing list. >>> See http://www.erlang.org/faq.html >>> To unsubscribe; mailto:erlang-questions-unsubscribe >>> >> >> Ulf Wiger, CTO, Erlang Solutions, Ltd. >> http://erlang-solutions.com >> >> >> >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe >> > Ulf Wiger, CTO, Erlang Solutions, Ltd. http://erlang-solutions.com From bengt.kleberg Fri Dec 10 08:54:45 2010 From: bengt.kleberg (Bengt Kleberg) Date: Fri, 10 Dec 2010 08:54:45 +0100 Subject: [erlang-questions] Multi-line comments in Erlang In-Reply-To: <92F762DE-4E1A-4E76-B419-F139E393DEA3@gmail.com> References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <92F762DE-4E1A-4E76-B419-F139E393DEA3@gmail.com> Message-ID: <1291967686.5424.6.camel@seasc1137> Greetings, A variable with _ in it is easier to read than one without. Why would your co-workers harm you for making their life easier? bengt On Fri, 2010-12-10 at 00:21 +0100, Ryan Zezeski wrote: > > On Dec 9, 2010, at 4:48 AM, "Zvi ." wrote: > > > > > > 3. Free format is the king! Language designers shouldn't dictate programmers > > how to format and ident their code. > > How differnt is starting comment line from '%' in Erlang, from putting 'C' > > or '*' in the first column in FORTRAN? > > > > Zvi > > > > Really? If free format is king then why does every lang have common code conventions? For example, I hate CamelCase but that doesn't mean I'm going to start naming my variables camel_case in Java because my coworkers would take me out back and beat me. > > There should always be a middle ground between extremes but without some type of common conventions our code would be a tower of babel, more so than it already is. People make certain assumptions, and when you break those assumptions confusion, contempt, and even bugs can ensue. > > I don't see the need for multiline comments as described in this thread. Any reputable editor can handle it. I know I have no problems in Emacs or Vim. > > I also know in the past multiline comments in C++ has bitten me because I nested them in order to comment out code. As has been said, good SCM takes care of this for you, git stash and branch come to mind. > > -Ryan From ulf.wiger Fri Dec 10 09:08:24 2010 From: ulf.wiger (Ulf Wiger) Date: Fri, 10 Dec 2010 09:08:24 +0100 Subject: [erlang-questions] RFC: mnesia majority checking In-Reply-To: References: <4E9EB37B-17C2-48A3-AFA3-CF1B256E4615@erlang-solutions.com> Message-ID: <1101BF18-41DE-4B4F-90E5-D300ED1EB1C3@erlang-solutions.com> On 10 Dec 2010, at 03:44, Alain O'Dea wrote: > The guys at Basho probably have some excellent material on partition > tolerance related to Riak. It is worth a chat with Justin Sheehy or Andy Gross to see what insight they have. You're absolutely right, and I know most of the Basho guys are on this list, and I'm never one to pass up an opportunity to chat with them. I'm grateful to Dizzy (Dave Smith) for being a sounding board helping me sort out some thoughts about how to handle read transactions. Also, Uwe Dauernheim at Klarna, who has been doing thesis work with Scalaris, has taken part in many helpful discussions. My colleagues Tino Breddin and Hans Nilsson are also excellent discussion partners. The thing that is special about mnesia is its insistence on transaction consistency. It is not an Eventual Consistency system - it's ACID, and am not looking to subvert its consistency properties, but rather strengthen them. This includes consistency across tables. On the CAP scale, this change would amount to allowing you to sacrifice Availability for the sake of Consistency and Partition tolerance. An example of where this might be useful is when multiple agents are drawing from a global resource pool, and you'd rather deny service than consume the same resource twice. In order to apply quorum logic and fencing, it is important to make mnesia aware of it, so that you can make it respect vital preconditions. One thing I'd especially like feedback on is if the 'majority' flag is a reasonable (and sufficiently powerful) extension. BR, Ulf W > > On Thu, Dec 9, 2010 at 1:55 PM, Ulf Wiger wrote: > > I added majority checking in the mnesia_locker as well. > The main reason for doing so (except aborting earlier), > was to enable majority checking on reads. > > The way it works now is that majority checking is done on > reads that use a write lock (e.g. mnesia:wread/1). > A normal read, with a read lock, will succeed even in a > minority. This is probably a pretty good thing. > > https://github.com/uwiger/otp/commit/650f8e30d205bc1130f37c819f920f901358b937 > > Comments still most welcome. Monologues are fun too, but > I can follow Dan North's advice and get a rubber duck for that. > > If you are unsure whether this is at all needed, please chime in. > It's is most definitely not a stupid question. > > BR, > Ulf W > > On 9 Dec 2010, at 15:26, Ulf Wiger wrote: > > > > > git fetch git://github.com/uwiger/otp mnesia-majority > > > > https://github.com/uwiger/otp/commit/d97ae7d4329d9342e576f3cdd893de6865449e42 > > > > This is a first stab at a function that I believe could be useful in > > high-availability applications using mnesia. > > > > At this stage, I'd love to have some comments, and suggestions, > > if someone thinks of a better way to do it. > > > > From the commit message: > > > > "Add {majority, boolean()} per-table option. > > > > With {majority, true} set for a table, write transactions will > > abort if they cannot commit to a majority of the nodes that > > have a copy of the table. Currently, the implementation hooks > > into the prepare_commit, and forces an asymmetric transaction > > if the commit set affects any table with the majority flag set. > > In the commit itself, the transaction will abort if it cannot > > satisfy the majority requirement for all tables involved in the > > thransaction. > > > > A future optimization might be to abort already when a write > > lock is attempted on such a table (/-object) and the lock cannot > > be set on enough nodes. > > > > This functionality introduces the possibility to automatically > > "fence off" a table in the presence of failures. > > > > This is a first implementation. Only basic tests have been > > performed." > > > > One particular use of this functionality would be to have a "global > > resource pool" in one table with {majority, true}, and periodically > > check out resources into a local buffer. If there is a failure condition, > > you can use the local buffer, but not check out more resources, unless > > you happen to still be in contact with more than half of the replicas. > > > > This should allow for a well-defined merge after a network split. > > > > BR, > > Ulf W > > > > Ulf Wiger, CTO, Erlang Solutions, Ltd. > > http://erlang-solutions.com > > > > > > > > Ulf Wiger, CTO, Erlang Solutions, Ltd. > http://erlang-solutions.com > > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > Ulf Wiger, CTO, Erlang Solutions, Ltd. http://erlang-solutions.com From rtrlists Fri Dec 10 10:22:20 2010 From: rtrlists (Robert Raschke) Date: Fri, 10 Dec 2010 09:22:20 +0000 Subject: [erlang-questions] Handling TICK in a C Node running longish jobs In-Reply-To: <4D011A1B.7010209@amberbio.com> References: <4D011A1B.7010209@amberbio.com> Message-ID: On Thu, Dec 9, 2010 at 6:04 PM, Morten Krogh wrote: > What aboutnet_kernel:set_net_ticktime(NetTicktime). > > But you have to make the change for all nodes in your network, I think. > > > Morten. > > > On 12/9/10 5:01 PM, Robert Raschke wrote: > >> Hiya, >> >> I've got a C program that acts as a Node using the nice EI interface libs. >> >> The C program is single threaded. And it now turns out I sometimes want it >> to do something that might actually take a few minutes. >> >> This in turn leads to TICK messages not getting acknowledged in time and >> the >> Erlang Node removing the timed out connection. >> >> I'm looking for some thoughts on how best to approach this. A couple of >> thoughts come to mind: >> >> 1. Make the C program multi-threaded. >> 2. Somehow lengthen the TICK interval for this connection. >> >> The first one makes me cringe. And the second one I don't know how to do. >> >> Any other ideas or pointers are most welcome, >> Robby >> >> > Aha, I think this get's me to a quick workaround (I only have one Erlang and multiple C Nodes). I can set the kernel net_ticktime config setting. I think that will allow me to progress in the shot term. I'd never investigated these setting in any detail; time to learn more. Obviously, I will still have to figure out how to properly deal with a C Node that wants to work for an extended period of time. But at least the pressure is off. :-) Robby From boris.muehmer Fri Dec 10 10:58:37 2010 From: boris.muehmer (Boris =?ISO-8859-1?Q?M=FChmer?=) Date: Fri, 10 Dec 2010 10:58:37 +0100 Subject: Possible enhancement for Makefile.in of R14B01 Message-ID: <1291975117.3298.55.camel@yang> After still having problems with installing the R14B01 release from source using _my_ scripts (1st I thought it is "sudo", than "make" and at last "env"), I made the following patch to "Makefile.in": The output of "diff otp_src_R14B01/Makefile.in otp_src_R14B01-1/Makefile.in" is: 412c412 < \$(ERL_TOP)/lib/erl_docgen/priv/bin/xref_mod_app.escript -topdir \$(ERL_TOP) -outfile \$(ERL_TOP)/make/\$(TARGET)/mod2app.xml --- > \$(ERL_TOP)/bin/escript \$(ERL_TOP)/lib/erl_docgen/priv/bin/xref_mod_app.escript -topdir \$(ERL_TOP) -outfile \$(ERL_TOP)/make/\$(TARGET)/mod2app.xml It basically only adds "\$(ERL_TOP)/bin/escript" to the call of "xref_mod_app.escript" and thus forces the system to use the escript from the source directory, because "env" may fall back to an old "escript" (if it can find one at all!) which fails to locate/include the file "xmerl/include/xmerl.hrl". I am not sure if this modification should be included in the official distribution... and what the proper way is... (About to check the FAQs). - boris From alessandro.sivieri Fri Dec 10 11:14:03 2010 From: alessandro.sivieri (Alessandro Sivieri) Date: Fri, 10 Dec 2010 11:14:03 +0100 Subject: [erlang-questions] PPA for ubuntu? In-Reply-To: <1291963922.13124.1.camel@shanghai> References: <1291963922.13124.1.camel@shanghai> Message-ID: 2010/12/10 Xiaopong Tran > Is there a PPA repository of the latest erlang release for Ubuntu? > > https://launchpad.net/~scattino/+archive/ppa I have backported directly from Debian experimental, without any modifications. -- Sivieri Alessandro alessandro.sivieri http://www.chimera-bellerofonte.eu/ http://www.poul.org/ From xiaopong.tran Fri Dec 10 12:19:24 2010 From: xiaopong.tran (Xiaopong Tran) Date: Fri, 10 Dec 2010 19:19:24 +0800 Subject: [erlang-questions] PPA for ubuntu? In-Reply-To: References: <1291963922.13124.1.camel@shanghai> Message-ID: <1291979964.29857.0.camel@shanghai> Thanks, great stuff, just installed it and ran a couple of tests. Xiaopong On Fri, 2010-12-10 at 11:14 +0100, Alessandro Sivieri wrote: > 2010/12/10 Xiaopong Tran > Is there a PPA repository of the latest erlang release for > Ubuntu? > > > > https://launchpad.net/~scattino/+archive/ppa > > > I have backported directly from Debian experimental, without any > modifications. > > -- > Sivieri Alessandro > alessandro.sivieri > http://www.chimera-bellerofonte.eu/ > http://www.poul.org/ > From rbhat Fri Dec 10 14:47:53 2010 From: rbhat (Rajesh Bhat) Date: Fri, 10 Dec 2010 07:47:53 -0600 Subject: Mnesia read timeout Message-ID: Hi, I ran into an issue where Mnesia read operation timed out during a test. Following code is called from a gen_server call with a time out of 30 seconds. During test, the call timed out one time. It has not happened since. However would like to understand under what scenario Mnesia read can time out. Reviewing the system report for any unusual activity (i/o, memory etc). has not yielded any clues Following is the code snippet called from gen_server get_state(Key) -> F = fun() -> mnesia:read({key_val_tab, Key}) end, case mnesia:transaction(F) of {atomic, [S]} -> S; _Else -> not_found end. Any thoughts? Regards --Rajesh ______________________________________________ See http://www.peak6.com/email_disclaimer.php for terms and conditions related to this email From torben.lehoff Fri Dec 10 14:53:20 2010 From: torben.lehoff (Torben Hoffmann) Date: Fri, 10 Dec 2010 14:53:20 +0100 Subject: [erlang-questions] Erlang Intro/Evangelism Presentation In-Reply-To: References: Message-ID: Hi Ryan, Sorry to add to the thread so late, but work got in the way ;-) Anyway, I have had the pleasure to get management to accept Erlang so I have some ideas about what should be said about Erlang so that people get an idea of what it is good for. Erlang was introduced with a specific purpose in mind - see http://reid.citizendium.org/wiki/Erlang%27s_original_domain If you look at Bjarne's requirements you realise that Erlang can fit into a lot of places and not just do well for telecom, but you knew that already ;-) Some of the things I would stress about Erlang is that Erlang/OTP is what one should be using. It brings about some very insightful things that you really have to use. E.g., the gen_fsm behaviour is - in the sense of Martin Fowler's terminology from his book on Domain Specific Languages - a computational model that is extremely well suited for implementation of protocols. Not a big surprise since OTP was created for telecom, but you get a framework that helps you deal with a non-trivial problem with extreme elegance. This elegance and ease comes from the nice combination of the gen_fsm behaviour and pattern matching. You pattern match incoming messages, send some messages here and there, update the state of the process and figure out what state to go to next. All declarative and easy to read. I have implemented the Q.SIG protocol and the SDL diagrams match up almost 1:1 with my code, i.e., message sending/receiving blocks are one function call and the next state is, well, the {next_state,...} clause at the end of the function clause. Try to compare this with how you have to deal with state machines in C... Pattern matching also makes dealing with the encoding and decoding of protocols something you can do without loosing sanity since it allows you to deal with the PDUs in a way that is very close to how they are specified in most standards. The overarching theme here is that the semantic gap between the domain you are in (Bjarne's requirements) and what the Erlang/OTP technology offers you is very small and that means that you have to do fewer lines of code to get the same thing done. Here I will allow myself to do some self-promotion: http://www.erlang-factory.com/upload/presentations/290/EUC2010_MissionCritical_1.2.pdf Be careful with this since putting 3x over Java in front of a bunch of Java programmers is probably not as well received as putting it in front of Erlangers at the EUC ;-) I could add more, but I think you have enough for starters! Cheers, Torben On Fri, Dec 3, 2010 at 19:43, Ryan Zezeski wrote: > I've been tasked with giving an introductory level presentation on Erlang > at > work. The focus is on why you would use Erlang and what does it look like > on the surface level. We have a lot of your standard Java/C#/C developers > and this will act as a potential launching pad to introducing Erlang to the > company. There is the potential for a large number of people to video > conference into this possibly spanning several countries so I really want > to > knock this out of the park. > > I'm writing as an inquiry for links to any prior art that I may use for > inspiration or even steal and use as my own. Anything that you think might > be helpful is appreciated, even input on possible approaches. I'd really > like to hear from people who have done this sort of thing before, i.e. > pubic > speaking on Erlang. > > Thanks, > -Ryan > -- http://www.linkedin.com/in/torbenhoffmann From alain.odea Fri Dec 10 15:06:47 2010 From: alain.odea (Alain O'Dea) Date: Fri, 10 Dec 2010 10:36:47 -0330 Subject: [erlang-questions] Possible enhancement for Makefile.in of R14B01 In-Reply-To: <1291975117.3298.55.camel@yang> References: <1291975117.3298.55.camel@yang> Message-ID: I like this fix. If you are comfortable using Git, I suggest sending this as a Pull Request to http://github.com/erlang/otp as it will make integration easier :) On Friday, December 10, 2010, Boris M?hmer wrote: > After still having problems with installing the R14B01 release from > source using _my_ scripts (1st I thought it is "sudo", than "make" and > at last "env"), I made the following patch to "Makefile.in": > > The output of "diff otp_src_R14B01/Makefile.in > otp_src_R14B01-1/Makefile.in" is: > > 412c412 > < ? ? ? \$(ERL_TOP)/lib/erl_docgen/priv/bin/xref_mod_app.escript -topdir > \$(ERL_TOP) -outfile \$(ERL_TOP)/make/\$(TARGET)/mod2app.xml > --- >> ? ? ? \$(ERL_TOP)/bin/escript > \$(ERL_TOP)/lib/erl_docgen/priv/bin/xref_mod_app.escript -topdir > \$(ERL_TOP) -outfile \$(ERL_TOP)/make/\$(TARGET)/mod2app.xml > > It basically only adds "\$(ERL_TOP)/bin/escript" to the call of > "xref_mod_app.escript" and thus forces the system to use the escript > from the source directory, because "env" may fall back to an old > "escript" (if it can find one at all!) which fails to locate/include the > file "xmerl/include/xmerl.hrl". > > I am not sure if this modification should be included in the official > distribution... and what the proper way is... (About to check the FAQs). > > > ?- boris > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From alain.odea Fri Dec 10 15:08:57 2010 From: alain.odea (Alain O'Dea) Date: Fri, 10 Dec 2010 10:38:57 -0330 Subject: [erlang-questions] PPA for ubuntu? In-Reply-To: <1291979964.29857.0.camel@shanghai> References: <1291963922.13124.1.camel@shanghai> <1291979964.29857.0.camel@shanghai> Message-ID: http://www.erlang-solutions.com/section/72/packages has Erlang Solutions tested binaries for Erlang/OTP. I would consider them to be more reliable than PPA packages. On Friday, December 10, 2010, Xiaopong Tran wrote: > Thanks, great stuff, just installed it and ran a couple of > tests. > > Xiaopong > > On Fri, 2010-12-10 at 11:14 +0100, Alessandro Sivieri wrote: >> 2010/12/10 Xiaopong Tran >> ? ? ? ? Is there a PPA repository of the latest erlang release for >> ? ? ? ? Ubuntu? >> >> >> >> https://launchpad.net/~scattino/+archive/ppa >> >> >> I have backported directly from Debian experimental, without any >> modifications. >> >> -- >> Sivieri Alessandro >> alessandro.sivieri >> http://www.chimera-bellerofonte.eu/ >> http://www.poul.org/ >> > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From hm Fri Dec 10 15:22:42 2010 From: hm (=?ISO-8859-1?Q?H=E5kan_Mattsson?=) Date: Fri, 10 Dec 2010 15:22:42 +0100 Subject: [erlang-questions] Mnesia read timeout In-Reply-To: References: Message-ID: On Fri, Dec 10, 2010 at 2:47 PM, Rajesh Bhat wrote: > Hi, > > I ran into an issue where Mnesia read operation timed out during a test. Following code is called from a gen_server call with a time out of 30 seconds. During test, the call timed out one time. ?It has not happened since. However would like to understand under what scenario Mnesia read can time out. Reviewing the system report for any unusual activity (i/o, memory etc). has not yielded any clues > > Following is the code snippet called from gen_server > > get_state(Key) -> > ? ? ? ? ? ? ? ?F = fun() -> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? mnesia:read({key_val_tab, Key}) > ? ? ? ? ? ? ? ? ? end, > ? ? ? ? ? ? ? ?case mnesia:transaction(F) of > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?{atomic, [S]} -> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?S; > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?_Else -> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?not_found > ? ? ? ? ? ? ? ?end. > > Any thoughts? I suppose that it was your own gen_server call that timed out, as mnesia:read/1 never times out. It look likes you have encountered a long lasting lock conflict somewhere in your code. Perhaps you have another transaction that first grabbed a write lock on the same record and then performed a gen_server call that did not return. If you have side effect free transactions, you should never encounter lock conflicts that lasts for such a long time. /H?kan From dmercer Fri Dec 10 15:26:09 2010 From: dmercer (David Mercer) Date: Fri, 10 Dec 2010 08:26:09 -0600 Subject: [erlang-questions] Multi-line comments in Erlang In-Reply-To: References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8E38D38D-8191-4C7C-8427-4B2BCDEFD3D3@cs.otago.ac.nz> Message-ID: <014c01cb9876\$31492070\$93db6150\$@com> On Thursday, December 09, 2010, Woody Peterson wrote: > Furthermore, people who want lots of commented program text often want > it for "historical" purposes. Lean on your SCM and just delete it > outright. I can't speak for anyone else, but I usually want to comment out chunks of source code during a debugging process. From alessandro.sivieri Fri Dec 10 15:45:37 2010 From: alessandro.sivieri (Alessandro Sivieri) Date: Fri, 10 Dec 2010 15:45:37 +0100 Subject: [erlang-questions] PPA for ubuntu? In-Reply-To: References: <1291963922.13124.1.camel@shanghai> <1291979964.29857.0.camel@shanghai> Message-ID: 2010/12/10 Alain O'Dea > http://www.erlang-solutions.com/section/72/packages has Erlang > Solutions tested binaries for Erlang/OTP. I would consider them to be > more reliable than PPA packages. > > Well, I'm relying on the debian packagers, updating my PPA when they update their versions... it depends if you want to trust them or not :) -- Sivieri Alessandro alessandro.sivieri http://www.chimera-bellerofonte.eu/ http://www.poul.org/ From alessandro.sivieri Fri Dec 10 15:46:06 2010 From: alessandro.sivieri (Alessandro Sivieri) Date: Fri, 10 Dec 2010 15:46:06 +0100 Subject: [erlang-questions] PPA for ubuntu? In-Reply-To: References: <1291963922.13124.1.camel@shanghai> <1291979964.29857.0.camel@shanghai> Message-ID: ... or if you prefer split packages or not. -- Sivieri Alessandro alessandro.sivieri http://www.chimera-bellerofonte.eu/ http://www.poul.org/ From boris.muehmer Fri Dec 10 15:47:15 2010 From: boris.muehmer (Boris =?ISO-8859-1?Q?M=FChmer?=) Date: Fri, 10 Dec 2010 15:47:15 +0100 Subject: [erlang-questions] Possible enhancement for Makefile.in of R14B01 In-Reply-To: References: <1291975117.3298.55.camel@yang> Message-ID: <1291992435.3298.57.camel@yang> I just completed my "Pull Request"... Hopefully I did it right! - boris Am Freitag, den 10.12.2010, 10:36 -0330 schrieb Alain O'Dea: > I like this fix. If you are comfortable using Git, I suggest sending > this as a Pull Request to http://github.com/erlang/otp as it will make > integration easier :) > > On Friday, December 10, 2010, Boris M?hmer wrote: > > After still having problems with installing the R14B01 release from > > source using _my_ scripts (1st I thought it is "sudo", than "make" and > > at last "env"), I made the following patch to "Makefile.in": > > > > The output of "diff otp_src_R14B01/Makefile.in > > otp_src_R14B01-1/Makefile.in" is: > > > > 412c412 > > < \$(ERL_TOP)/lib/erl_docgen/priv/bin/xref_mod_app.escript -topdir > > \$(ERL_TOP) -outfile \$(ERL_TOP)/make/\$(TARGET)/mod2app.xml > > --- > >> \$(ERL_TOP)/bin/escript > > \$(ERL_TOP)/lib/erl_docgen/priv/bin/xref_mod_app.escript -topdir > > \$(ERL_TOP) -outfile \$(ERL_TOP)/make/\$(TARGET)/mod2app.xml > > > > It basically only adds "\$(ERL_TOP)/bin/escript" to the call of > > "xref_mod_app.escript" and thus forces the system to use the escript > > from the source directory, because "env" may fall back to an old > > "escript" (if it can find one at all!) which fails to locate/include the > > file "xmerl/include/xmerl.hrl". > > > > I am not sure if this modification should be included in the official > > distribution... and what the proper way is... (About to check the FAQs). > > > > > > - boris > > > > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > See http://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscribe > > > > From masklinn Fri Dec 10 15:49:02 2010 From: masklinn (Masklinn) Date: Fri, 10 Dec 2010 15:49:02 +0100 Subject: [erlang-questions] Multi-line comments in Erlang In-Reply-To: References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> Message-ID: On 2010-12-09, at 16:58 , Daniel Goertzen wrote: > Thank you for reminding me about HEREDOCs. In Python, I often use triple > quoted strings for multiline comments. It works well, but they are exposed > to the interpreter which smells a bit. I believe they're discarded long before that unless they're bound to a variable or they're docstrings. But even if that weren't the case, *nothing* guarantees comments aren't bubbled to the runtime. XML comments are part of its DOM, Haskell's comments are used to provide options to the interpreter or compiler, ? From burbas Fri Dec 10 16:04:14 2010 From: burbas (Niclas Axelsson) Date: Fri, 10 Dec 2010 16:04:14 +0100 Subject: [erlang-questions] Possible enhancement for Makefile.in of R14B01 In-Reply-To: <1291992435.3298.57.camel@yang> References: <1291975117.3298.55.camel@yang> <1291992435.3298.57.camel@yang> Message-ID: <4D02416E.9080105@erlang.org> On 12/10/2010 03:47 PM, Boris M?hmer wrote: > I just completed my "Pull Request"... Hopefully I did it right! > > > - boris > > > Am Freitag, den 10.12.2010, 10:36 -0330 schrieb Alain O'Dea: > >> I like this fix. If you are comfortable using Git, I suggest sending >> this as a Pull Request to http://github.com/erlang/otp as it will make >> integration easier :) >> >> On Friday, December 10, 2010, Boris M?hmer wrote: >> >>> After still having problems with installing the R14B01 release from >>> source using _my_ scripts (1st I thought it is "sudo", than "make" and >>> at last "env"), I made the following patch to "Makefile.in": >>> >>> The output of "diff otp_src_R14B01/Makefile.in >>> otp_src_R14B01-1/Makefile.in" is: >>> >>> 412c412 >>> < \$(ERL_TOP)/lib/erl_docgen/priv/bin/xref_mod_app.escript -topdir >>> \$(ERL_TOP) -outfile \$(ERL_TOP)/make/\$(TARGET)/mod2app.xml >>> --- >>> >>>> \$(ERL_TOP)/bin/escript >>>> >>> \$(ERL_TOP)/lib/erl_docgen/priv/bin/xref_mod_app.escript -topdir >>> \$(ERL_TOP) -outfile \$(ERL_TOP)/make/\$(TARGET)/mod2app.xml >>> >>> It basically only adds "\$(ERL_TOP)/bin/escript" to the call of >>> "xref_mod_app.escript" and thus forces the system to use the escript >>> from the source directory, because "env" may fall back to an old >>> "escript" (if it can find one at all!) which fails to locate/include the >>> file "xmerl/include/xmerl.hrl". >>> >>> I am not sure if this modification should be included in the official >>> distribution... and what the proper way is... (About to check the FAQs). >>> >>> >>> - boris >>> >>> >>> ________________________________________________________________ >>> erlang-questions (at) erlang.org mailing list. >>> See http://www.erlang.org/faq.html >>> To unsubscribe; mailto:erlang-questions-unsubscribe >>> >>> >>> > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > Hi Boris, It's great that you want to submit patches, but please do not use pull request to submit it. Instead you should follow the instructions on https://github.com/erlang/otp/wiki/Submitting-patches. Regards, Niclas Axelsson, Erlang/OTP From rbhat Fri Dec 10 16:19:55 2010 From: rbhat (Rajesh Bhat) Date: Fri, 10 Dec 2010 09:19:55 -0600 Subject: [erlang-questions] Mnesia read timeout In-Reply-To: References: Message-ID: Thanks. Yes it was gen_server call that timed out. I meant to ask what would cause mnesia:read to take that long. Yes read and update events can be requested from separate processes on the same record. Given that scenario, is it possible the write operation took long time? Thanks -- Rajesh -----Original Message----- From: hawk.mattsson [mailto:hawk.mattsson] On Behalf Of H?kan Mattsson Sent: Friday, December 10, 2010 8:23 AM To: Rajesh Bhat Cc: erlang-questions Subject: Re: [erlang-questions] Mnesia read timeout On Fri, Dec 10, 2010 at 2:47 PM, Rajesh Bhat wrote: > Hi, > > I ran into an issue where Mnesia read operation timed out during a test. Following code is called from a gen_server call with a time out of 30 seconds. During test, the call timed out one time. ?It has not happened since. However would like to understand under what scenario Mnesia read can time out. Reviewing the system report for any unusual activity (i/o, memory etc). has not yielded any clues > > Following is the code snippet called from gen_server > > get_state(Key) -> > ? ? ? ? ? ? ? ?F = fun() -> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? mnesia:read({key_val_tab, Key}) > ? ? ? ? ? ? ? ? ? end, > ? ? ? ? ? ? ? ?case mnesia:transaction(F) of > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?{atomic, [S]} -> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?S; > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?_Else -> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?not_found > ? ? ? ? ? ? ? ?end. > > Any thoughts? I suppose that it was your own gen_server call that timed out, as mnesia:read/1 never times out. It look likes you have encountered a long lasting lock conflict somewhere in your code. Perhaps you have another transaction that first grabbed a write lock on the same record and then performed a gen_server call that did not return. If you have side effect free transactions, you should never encounter lock conflicts that lasts for such a long time. /H?kan ______________________________________________ See http://www.peak6.com/email_disclaimer.php for terms and conditions related to this email From boris.muehmer Fri Dec 10 16:36:51 2010 From: boris.muehmer (Boris =?ISO-8859-1?Q?M=FChmer?=) Date: Fri, 10 Dec 2010 16:36:51 +0100 Subject: [erlang-questions] Possible enhancement for Makefile.in of R14B01 In-Reply-To: <4D02416E.9080105@erlang.org> References: <1291975117.3298.55.camel@yang> <1291992435.3298.57.camel@yang> <4D02416E.9080105@erlang.org> Message-ID: <1291995411.3298.87.camel@yang> > It's great that you want to submit patches, but please do not use pull > request to submit it. > Instead you should follow the instructions on > https://github.com/erlang/otp/wiki/Submitting-patches. > > Regards, > Niclas Axelsson, Erlang/OTP Sorry... I already did that... :-( I also wrote a notification to "erlang-patches"... Should I remove this "Pull Request" (if this is possible at all)? - boris From hm Fri Dec 10 16:40:33 2010 From: hm (=?ISO-8859-1?Q?H=E5kan_Mattsson?=) Date: Fri, 10 Dec 2010 16:40:33 +0100 Subject: [erlang-questions] Mnesia read timeout In-Reply-To: References: Message-ID: 2010/12/10 Rajesh Bhat : > Thanks. Yes it was gen_server call that timed out. I meant to ask what would cause > mnesia:read to take that long. Yes read and update events can be requested from > separate processes on the same record. Given that scenario, is it possible the write > operation took long time? Not the write operation itself. But if your transaction first perform the write operation (implying a write lock) and then do some side effects, such as gen_server calls, that particular transaction can hang arbitrary long depending on how long the call takes. If other transactions are trying to access the same record/table, they will hang until the first transaction is ended. If you encounter lock problems again you can use mnesia:system_info(held_locks) to investigate which processes that are holding locks. /H?kan From burbas Fri Dec 10 16:40:53 2010 From: burbas (Niclas Axelsson) Date: Fri, 10 Dec 2010 16:40:53 +0100 Subject: [erlang-questions] Possible enhancement for Makefile.in of R14B01 In-Reply-To: <1291995411.3298.87.camel@yang> References: <1291975117.3298.55.camel@yang> <1291992435.3298.57.camel@yang> <4D02416E.9080105@erlang.org> <1291995411.3298.87.camel@yang> Message-ID: <4D024A05.3060204@erlang.org> On 12/10/2010 04:36 PM, Boris M?hmer wrote: >> It's great that you want to submit patches, but please do not use pull >> request to submit it. >> Instead you should follow the instructions on >> https://github.com/erlang/otp/wiki/Submitting-patches. >> >> Regards, >> Niclas Axelsson, Erlang/OTP >> > Sorry... I already did that... :-( > > I also wrote a notification to "erlang-patches"... > > Should I remove this "Pull Request" (if this is possible at all)? > > > - boris > Hi again, Boris. We can close the pull request, so no need to worry :). I will include your patch into 'pu'. Regards, Niclas Axelsson, Erlang/OTP From woody.peterson Fri Dec 10 21:30:38 2010 From: woody.peterson (Woody Peterson) Date: Fri, 10 Dec 2010 12:30:38 -0800 Subject: typical project structures / sanity check Message-ID: <6C08A28F-7164-42C9-9091-528C70150C5A@gmail.com> Hi all, The short question is: are the project used for a first target system and a standard OTP app mutually exclusive? In other words, can a project used to generate a first target system also be the source for an application, or must that application necessarily be a subdirectory somewhere, for example /lib/myproject? I started a project (let's call it 'myproject') using the OTP structure like so: myproject - src - ebin - priv - include Now it's time to deploy, and I want to use rebar/reltool. The problem is that I have to tell reltool where the 'myproject' application is. Well, in my case, it's in ~/erlang, but so is a lot of other stuff, so I don't want to declare that in the reltool.config lib_dirs. I asked around on the rebar mailing list, and it seems that the best solution is to move /src to /apps/myproject/src and put /apps in lib_dirs. Well, now my main app doesn't follow the OTP conventions anymore :( Erlang/OTP in Action / sinan (written by the same people) use the following project directory structure: myproject - _build.cfg - lib -- myapp --- doc --- ebin --- include --- src This clearly separates the 'project' from the component application, but I haven't yet heard it explicitly said that these need to be separated in order to deploy in a standard manner. So: do you always structure projects like this, or is there a way I can deploy my single OTP app using reltool (w/o breaking it's current OTP structure)? Thanks, -Woody From woody.peterson Sat Dec 11 00:54:57 2010 From: woody.peterson (Woody Peterson) Date: Fri, 10 Dec 2010 15:54:57 -0800 Subject: [erlang-questions] typical project structures / sanity check In-Reply-To: References: <6C08A28F-7164-42C9-9091-528C70150C5A@gmail.com> Message-ID: Forwarding this to the list, accidental PM'ing On Dec 10, 2010, at 12:38 PM, Heinz N. Gies wrote: > having the standard data structure causes trouble with reltool not > finding your application I guess this is turning into a feature request :) Would it make sense for reltool to be able to find your application without following a strict directory naming convention? Perhaps an {app_dirs, [{myproject, "../"}]} option or the like? Seems like a lot of people start off trying to use reltool from within the OTP structure. Then again, once I started thinking of things in terms of projects and apps, I realized I already have a case that could be made for wrapping my app in a project. Specifically, I've included an mnesia monitoring project as a dependency of the app I want to deploy, when really it's a dependency of the deployed production system (not the app logic itself). If anyone argues that the current structure encourages modularity and the above 'feature request' therefore doesn't make sense, the next question is how to get the word out about how to start a deployment- capable project in erlang. A lot of people seem to expect to be able to deploy the app they just made as a target system. -Woody On Dec 10, 2010, at 12:38 PM, Heinz N. Gies wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > With my limited experience (which is mainly limited to 1 hoby > project :P): > > having the standard data structure causes trouble with reltool not > finding your application unless you include the parent folder of > myproject (myproject/../), having all the ebin stuff in a subfolder > you can include exactly that subfolder and don't run into the > posible problem of having more then one copy of myproject in > myproject/../. > > then again I might be totally wrong ;) > > Regards, > Heinz > On Dec 10, 2010, at 21:30 , Woody Peterson wrote: > >> Hi all, >> >> The short question is: are the project used for a first target >> system and a standard OTP app mutually exclusive? In other words, >> can a project used to generate a first target system also be the >> source for an application, or must that application necessarily be >> a subdirectory somewhere, for example /lib/myproject? >> >> I started a project (let's call it 'myproject') using the OTP >> structure like so: >> >> myproject >> - src >> - ebin >> - priv >> - include >> >> Now it's time to deploy, and I want to use rebar/reltool. The >> problem is that I have to tell reltool where the 'myproject' >> application is. Well, in my case, it's in ~/erlang, but so is a lot >> of other stuff, so I don't want to declare that in the >> reltool.config lib_dirs. I asked around on the rebar mailing list, >> and it seems that the best solution is to move /src to /apps/ >> myproject/src and put /apps in lib_dirs. Well, now my main app >> doesn't follow the OTP conventions anymore :( >> >> Erlang/OTP in Action / sinan (written by the same people) use the >> following project directory structure: >> >> myproject >> - _build.cfg >> - lib >> -- myapp >> --- doc >> --- ebin >> --- include >> --- src >> >> This clearly separates the 'project' from the component >> application, but I haven't yet heard it explicitly said that these >> need to be separated in order to deploy in a standard manner. >> >> So: do you always structure projects like this, or is there a way I >> can deploy my single OTP app using reltool (w/o breaking it's >> current OTP structure)? >> >> Thanks, >> >> -Woody >> >> ________________________________________________________________ >> erlang-questions (at) erlang.org mailing list. >> See http://www.erlang.org/faq.html >> To unsubscribe; mailto:erlang-questions-unsubscribe >> > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (Darwin) > > iEYEARECAAYFAk0Cj60ACgkQHwrnTfuX/fUGFwCfUoiUEY309KB4/N4RuxAy9x5r > u64AoJN4qyefXOvBp/W/QSHy+C5DebOu > =us+k > -----END PGP SIGNATURE----- From woody.peterson Sat Dec 11 00:56:37 2010 From: woody.peterson (Woody Peterson) Date: Fri, 10 Dec 2010 15:56:37 -0800 Subject: [erlang-questions] typical project structures / sanity check In-Reply-To: References: <6C08A28F-7164-42C9-9091-528C70150C5A@gmail.com> <43B336C7-06BE-4A7D-9A82-B51CB9646462@gmail.com> Message-ID: <4601935D-2C6A-4C92-A6C9-0FF7E1829AAF@gmail.com> Forwarding to the list due to PM'ing (last one) On Dec 10, 2010, at 3:33 PM, Heinz N. Gies wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > On Dec 10, 2010, at 22:34 , Woody Peterson wrote: > >> >> On Dec 10, 2010, at 12:38 PM, Heinz N. Gies wrote: >> >>> having the standard data structure causes trouble with reltool not >>> finding your application >> >> I guess this is turning into a feature request :) Would it make >> sense for reltool to be able to find your application without >> following a strict directory naming convention? Perhaps an >> {app_dirs, [{myproject, "../"}]} option or the like? Seems like a >> lot of people start off trying to use reltool from within the OTP >> structure. > > I personally would love to see that you can just give the app dir as > you show above instead of the parent of the app dir. Then again I > think this whole thing has to do with looking for apps that are > installed. > >> Then again, once I started thinking of things in terms of projects >> and apps, I realized I already have a case that could be made for >> wrapping my app in a project. Specifically, I've included an mnesia >> monitoring project as a dependency of the app I want to deploy, >> when really it's a dependency of the deployed production system >> (not the app logic itself). > I agree the way to look at erlang systems is quite differently then > into others, I am still not sure if a deployment should equal a > application / project or might better be an entire different thing. >> >> If anyone argues that the current structure encourages modularity >> and the above 'feature request' therefore doesn't make sense, the >> next question is how to get the word out about how to start a >> deployment-capable project in erlang. A lot of people seem to >> expect to be able to deploy the app they just made as a target >> system. > Yap again, totally agree my structure right now is horrible bad, I > just moved 3 subprojects/apps into a big one since I had a horrible > time to keep track of stuff :P > > Regards, > Heinz > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (Darwin) > > iEYEARECAAYFAk0CuLkACgkQHwrnTfuX/fX5MgCdFqBgPK/05ohMLxTObEohxAD/ > ZnUAnjbOJ+Joz4X1g/g9/5eLonRBMeLr > =A3aC > -----END PGP SIGNATURE----- From corticalcomputer Sat Dec 11 01:30:09 2010 From: corticalcomputer (G.S.) Date: Fri, 10 Dec 2010 19:30:09 -0500 Subject: Is there an Erlang based Graphiz-like program. Message-ID: Hello, Does anyone know of an Erlang based Graphiz-like program, and if not, what is the best/easiest way to interface an Erlang program with Graphiz? Regards, -Gene From alain.odea Sat Dec 11 03:08:15 2010 From: alain.odea (Alain O'Dea) Date: Fri, 10 Dec 2010 22:38:15 -0330 Subject: [erlang-questions] Is there an Erlang based Graphiz-like program. In-Reply-To: References: Message-ID: On Friday, December 10, 2010, G.S. wrote: > Hello, > > Does anyone know of an Erlang based Graphiz-like program, and if not, what > is the best/easiest way to interface an Erlang program with Graphiz? > > Regards, > -Gene > I was unable to find any direct support application for GraphViz. Ulf Wiger posted about this back in '08: http://www.erlang.org/cgi-bin/ezmlm-cgi/4/32863 His post talks about generating GraphViz DOT files from Erlang Xref output. You may also find graph_draw useful: http://cean.process-one.net/packages/index.yaws?action=detail&name=graph_draw An alternative I recommend is to use JInterface to communicate with a Java process that uses http://www.loria.fr/~szathmar/off/projects/java/GraphVizAPI/index.php (Java GraphViz API). See http://concise-software.blogspot.com/2009/08/concise-howtos-message-from-java-to.html and http://concise-software.blogspot.com/2009/08/concise-howtos-message-from-erlang-to.html for starting points on integrating Java and Erlang/OTP :) From jameschurchman Sat Dec 11 03:21:52 2010 From: jameschurchman (James Churchman) Date: Sat, 11 Dec 2010 02:21:52 +0000 Subject: [erlang-questions] Is there an Erlang based Graphiz-like program. In-Reply-To: References: Message-ID: <9AE77415-7618-4664-8BDE-7075526C3928@gmail.com> might be wrong but i think refacterl can export erlang source as GraphViz On 11 Dec 2010, at 02:08, Alain O'Dea wrote: > On Friday, December 10, 2010, G.S. wrote: >> Hello, >> >> Does anyone know of an Erlang based Graphiz-like program, and if not, what >> is the best/easiest way to interface an Erlang program with Graphiz? >> >> Regards, >> -Gene >> > > I was unable to find any direct support application for GraphViz. > > Ulf Wiger posted about this back in '08: > http://www.erlang.org/cgi-bin/ezmlm-cgi/4/32863 > > His post talks about generating GraphViz DOT files from Erlang Xref output. > > You may also find graph_draw useful: > http://cean.process-one.net/packages/index.yaws?action=detail&name=graph_draw > > An alternative I recommend is to use JInterface to communicate with a > Java process that uses > http://www.loria.fr/~szathmar/off/projects/java/GraphVizAPI/index.php > (Java GraphViz API). > > See http://concise-software.blogspot.com/2009/08/concise-howtos-message-from-java-to.html > and http://concise-software.blogspot.com/2009/08/concise-howtos-message-from-erlang-to.html > for starting points on integrating Java and Erlang/OTP :) > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > From alain.odea Sat Dec 11 03:55:22 2010 From: alain.odea (Alain O'Dea) Date: Fri, 10 Dec 2010 23:25:22 -0330 Subject: [erlang-questions] Possible enhancement for Makefile.in of R14B01 In-Reply-To: <4D024A05.3060204@erlang.org> References: <1291975117.3298.55.camel@yang> <1291992435.3298.57.camel@yang> <4D02416E.9080105@erlang.org> <1291995411.3298.87.camel@yang> <4D024A05.3060204@erlang.org> Message-ID: My sincerest apologies Boris. I made an incorrect assumption. My apologies also to the OTP team. Pull Requests do include a conversational aspect and tie the conversation to the patch submission, but I now realize this is not the preferred mechanism for Erlang/OTP. I will in future refer people to https://github.com/erlang/otp/wiki/Submitting-patches. Thank you, Alain On Friday, December 10, 2010, Niclas Axelsson wrote: > On 12/10/2010 04:36 PM, Boris M?hmer wrote: > > It's great that you want to submit patches, but please do not use pull > request to submit it. > Instead you should follow the instructions on > https://github.com/erlang/otp/wiki/Submitting-patches. > > Regards, > Niclas Axelsson, Erlang/OTP > > > Sorry... I already did that... :-( > > I also wrote a notification to "erlang-patches"... > > Should I remove this "Pull Request" (if this is possible at all)? > > > ? - boris > > > Hi again, Boris. > > We can close the pull request, so no need to worry :). I will include your patch into 'pu'. > > Regards, > Niclas Axelsson, Erlang/OTP > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From alain.odea Sat Dec 11 04:15:28 2010 From: alain.odea (Alain O'Dea) Date: Fri, 10 Dec 2010 23:45:28 -0330 Subject: [erlang-questions] PPA for ubuntu? In-Reply-To: References: <1291963922.13124.1.camel@shanghai> <1291979964.29857.0.camel@shanghai> Message-ID: PPAs are not maintained by the Debian packagers. They are Personal Package Archives uploaded by individuals in the Ubuntu community. Debian's release process does not govern them. I consider PPAs to be "use at own risk". If you feel the risk is manageable, then take it, but I do not recommend using PPAs for production systems. The risks include things like malware/spyware payloads in the PPA. More disussion of the risks of PPAs at http://jeffhoogland.blogspot.com/2010/11/ubuntu-ppa-problem-reason-for-concern.html Bear in mind with a hosted service you are putting your customers information at risk. In an intranet service you are putting your corporate IP assets at risk. Please consider not using an Erlang PPA. On Friday, December 10, 2010, Alessandro Sivieri wrote: > 2010/12/10 Alain O'Dea > > > http://www.erlang-solutions.com/section/72/packages has Erlang > Solutions tested binaries for Erlang/OTP. ?I would consider them to be > more reliable than PPA packages. > > > Well, I'm relying on the debian packagers, updating my PPA when they update their versions... it depends if you want to trust them or not :) > > > -- > Sivieri Alessandro > alessandro.sivieri > http://www.chimera-bellerofonte.eu/ > http://www.poul.org/ > From robert.virding Sat Dec 11 04:39:35 2010 From: robert.virding (Robert Virding) Date: Sat, 11 Dec 2010 03:39:35 +0000 (GMT) Subject: [erlang-questions] Is there an Erlang based Graphiz-like program. In-Reply-To: <139693025.188851292038590140.JavaMail.root@zimbra> Message-ID: <2044269362.188871292038775082.JavaMail.root@zimbra> If you look in leex.erl you will find some code at the end of the file in out_dfa_graph/3 some code which outputs the internal DFA to a .dot file which can be viewed by Graphviz. It is not general code but specific for leex. It is quite interesting to see the DFA which has been built up. Robert ----- "James Churchman" wrote: > might be wrong but i think refacterl can export erlang source as > GraphViz > On 11 Dec 2010, at 02:08, Alain O'Dea wrote: > > > On Friday, December 10, 2010, G.S. > wrote: > >> Hello, > >> > >> Does anyone know of an Erlang based Graphiz-like program, and if > not, what > >> is the best/easiest way to interface an Erlang program with > Graphiz? > >> > >> Regards, > >> -Gene > >> > > > > I was unable to find any direct support application for GraphViz. > > > > Ulf Wiger posted about this back in '08: > > http://www.erlang.org/cgi-bin/ezmlm-cgi/4/32863 > > > > His post talks about generating GraphViz DOT files from Erlang Xref > output. > > > > You may also find graph_draw useful: > > > http://cean.process-one.net/packages/index.yaws?action=detail&name=graph_draw > > > > An alternative I recommend is to use JInterface to communicate with > a > > Java process that uses > > > http://www.loria.fr/~szathmar/off/projects/java/GraphVizAPI/index.php > > (Java GraphViz API). > > > > See > http://concise-software.blogspot.com/2009/08/concise-howtos-message-from-java-to.html > > and > http://concise-software.blogspot.com/2009/08/concise-howtos-message-from-erlang-to.html > > for starting points on integrating Java and Erlang/OTP :) > > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > See http://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscribe > > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe From xiaopong.tran Sat Dec 11 07:24:00 2010 From: xiaopong.tran (Xiaopong Tran) Date: Sat, 11 Dec 2010 14:24:00 +0800 Subject: [erlang-questions] PPA for ubuntu? In-Reply-To: References: <1291963922.13124.1.camel@shanghai> <1291979964.29857.0.camel@shanghai> Message-ID: <1292048640.1892.8.camel@shanghai> It's true, that's why it would great if there is an official build for different Linux distros, like the binary for Windows. People can certainly build from source, I do it too when I want to try out new features but the new version has not been packaged into the distro yet. But it's always good to have pre-built packages. Xiaopong On Fri, 2010-12-10 at 23:45 -0330, Alain O'Dea wrote: > PPAs are not maintained by the Debian packagers. They are Personal > Package Archives uploaded by individuals in the Ubuntu community. > Debian's release process does not govern them. > > I consider PPAs to be "use at own risk". If you feel the risk is > manageable, then take it, but I do not recommend using PPAs for > production systems. > > The risks include things like malware/spyware payloads in the PPA. > > More disussion of the risks of PPAs at > http://jeffhoogland.blogspot.com/2010/11/ubuntu-ppa-problem-reason-for-concern.html > > Bear in mind with a hosted service you are putting your customers > information at risk. In an intranet service you are putting your > corporate IP assets at risk. > > Please consider not using an Erlang PPA. > From alessandro.sivieri Sat Dec 11 10:33:11 2010 From: alessandro.sivieri (Alessandro Sivieri) Date: Sat, 11 Dec 2010 10:33:11 +0100 Subject: [erlang-questions] PPA for ubuntu? In-Reply-To: References: <1291963922.13124.1.camel@shanghai> <1291979964.29857.0.camel@shanghai> Message-ID: 2010/12/11 Alain O'Dea > The risks include things like malware/spyware payloads in the PPA. > > You are absolutely right; the only thing that I can say here is that, because the above PPA is mine, I can tell you that I am not adding any malware or spyware, I just take the Debian packages and build them for Ubuntu. Of course, this is only my word... > Please consider not using an Erlang PPA. > > Well, I made this PPA for easily upgrading Erlang on Ubuntu, so in some way I did it for me; if anyone finds it useful, feel free to use it. That's it. :) -- Sivieri Alessandro alessandro.sivieri http://www.chimera-bellerofonte.eu/ http://www.poul.org/ From garazdawi Sat Dec 11 11:05:07 2010 From: garazdawi (Lukas Larsson) Date: Sat, 11 Dec 2010 11:05:07 +0100 Subject: [erlang-questions] Is there an Erlang based Graphiz-like program. In-Reply-To: <9AE77415-7618-4664-8BDE-7075526C3928@gmail.com> References: <9AE77415-7618-4664-8BDE-7075526C3928@gmail.com> Message-ID: If you are interested in exporting erlang source to dot files, https://github.com/eproxus/grapherl is a lightweight program which can do it. On Sat, Dec 11, 2010 at 3:21 AM, James Churchman wrote: > might be wrong but i think refacterl can export erlang source as GraphViz > On 11 Dec 2010, at 02:08, Alain O'Dea wrote: > > > On Friday, December 10, 2010, G.S. wrote: > >> Hello, > >> > >> Does anyone know of an Erlang based Graphiz-like program, and if not, > what > >> is the best/easiest way to interface an Erlang program with Graphiz? > >> > >> Regards, > >> -Gene > >> > > > > I was unable to find any direct support application for GraphViz. > > > > Ulf Wiger posted about this back in '08: > > http://www.erlang.org/cgi-bin/ezmlm-cgi/4/32863 > > > > His post talks about generating GraphViz DOT files from Erlang Xref > output. > > > > You may also find graph_draw useful: > > > http://cean.process-one.net/packages/index.yaws?action=detail&name=graph_draw > > > > An alternative I recommend is to use JInterface to communicate with a > > Java process that uses > > http://www.loria.fr/~szathmar/off/projects/java/GraphVizAPI/index.php > > (Java GraphViz API). > > > > See > http://concise-software.blogspot.com/2009/08/concise-howtos-message-from-java-to.html > > and > http://concise-software.blogspot.com/2009/08/concise-howtos-message-from-erlang-to.html > > for starting points on integrating Java and Erlang/OTP :) > > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > See http://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscribe > > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From als Sat Dec 11 11:38:54 2010 From: als (Anthony Shipman) Date: Sat, 11 Dec 2010 21:38:54 +1100 Subject: [erlang-questions] Multi-line comments in Erlang In-Reply-To: <8E38D38D-8191-4C7C-8427-4B2BCDEFD3D3@cs.otago.ac.nz> References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8E38D38D-8191-4C7C-8427-4B2BCDEFD3D3@cs.otago.ac.nz> Message-ID: <201012112138.54512.als@iinet.net.au> On Fri, 10 Dec 2010 07:58:21 am Richard O'Keefe wrote: > for display. ?There has long been a fashion in C for writing > ????????/* long comments > ? ? ? ? ?* with stars at the > ???????? * beginning of every line > ???????? * and a lopside end > ???????? */ > which I have always found ugly. ?But the existence of that fashion > shows that there are many people who find value in their commentary > being explicitly marked. I believe that it was Rob Pike who recommended the stars to make comment blocks stand out. This was way back in the '80s when it was common to print out code on 132 column paper and pore over it off-line. Nowadays we have syntax colouring and the stars can be abandoned. -- Anthony Shipman Mamas don't let your babies als grow up to be outsourced. From ulf.wiger Sat Dec 11 12:26:38 2010 From: ulf.wiger (Ulf Wiger) Date: Sat, 11 Dec 2010 12:26:38 +0100 Subject: [erlang-questions] RFC: mnesia majority checking In-Reply-To: <7F8259DB-13AD-428A-BE20-07D56D864EF7@lovely.email.ne.jp> References: <4E9EB37B-17C2-48A3-AFA3-CF1B256E4615@erlang-solutions.com> <4D011BCF.1030605@amberbio.com> <73B551E2-71B4-4243-909E-F4AE23207203@amberbio.com> <31818D23-57A6-4CAF-9B49-CE49E07107D7@erlang-solutions.com> <7F8259DB-13AD-428A-BE20-07D56D864EF7@lovely.email.ne.jp> Message-ID: Hi Joe, I don't know why it wasn't present from the start. I'd imagine it wasn't a conscious decision. Regarding schema operations, all the _affected_ schema nodes must be up, I believe. For example, if you create a table with copies on N1 and N2, both N1 and N2 must be available during the schema operation. OTOH, this worked: - start mnesia on N1 with a disk schema - start N2 with {extra_db_nodes,[N1]} - run mnesia:change_table_copy_type(schema,N2,disc_copies) - start N3 the same way - kill N1 - change N3's schema to disc_copies And after this, I was able to add a replica for a table on N3, even though it had a replica on N1 and N1 was down. So it is not entirely clear under which conditions mnesia decides to be conservative about schema changes, and why. (BTW, once I started N1 again, mnesia dumped core due to a combine error, so it would seem as if some conservatism is well warranted. :) I can't say I know what issues would arise if one would introduce a majority condition for the schema. It doesn't quite play by the same rules as user-defined tables. BR, Ulf On 11 Dec 2010, at 11:32, Joseph Wayne Norton wrote: > Ulf - > > I think this majority checking feature is a good feature for Mnesia. Are you aware of any reasons why this feature wasn't present from Mnesia's beginning? > > I'd also like to confirm my understanding of your comment below. For schema updates, my understanding is that all nodes having a copy of the table definition must be available. Would it be possible and/or desirable to support a majority checking feature for schema updates too? > > thanks, > > On 2010/12/10, at 16:44, Ulf Wiger wrote: > >> Really, I didn't invent this protocol, and I've taken great care not >> to alter it, as I've assumed it is robust. It's been in mnesia for years. >> It's the same protocol that's used for schema updates in mnesia, >> more heavyweight and pessimistic than the 'normal' commit >> protocol. If you wish to dissect the asym_trans protocol looking for >> nasty corner cases, I think it's great, but then perhaps one of the >> mnesia maintainers, Dan and H?kan (still counting H?kan as such) >> should join the discussion. > > Joseph Wayne Norton > norton > > > Ulf Wiger, CTO, Erlang Solutions, Ltd. http://erlang-solutions.com From ulf.wiger Sat Dec 11 12:38:56 2010 From: ulf.wiger (Ulf Wiger) Date: Sat, 11 Dec 2010 12:38:56 +0100 Subject: [erlang-questions] RFC: mnesia majority checking In-Reply-To: References: <4E9EB37B-17C2-48A3-AFA3-CF1B256E4615@erlang-solutions.com> <4D011BCF.1030605@amberbio.com> <73B551E2-71B4-4243-909E-F4AE23207203@amberbio.com> <31818D23-57A6-4CAF-9B49-CE49E07107D7@erlang-solutions.com> <7F8259DB-13AD-428A-BE20-07D56D864EF7@lovely.email.ne.jp> Message-ID: On 11 Dec 2010, at 12:26, Ulf Wiger wrote: > OTOH, this worked: > - start mnesia on N1 with a disk schema > - start N2 with {extra_db_nodes,[N1]} > - run mnesia:change_table_copy_type(schema,N2,disc_copies) > - start N3 the same way > - kill N1 > - change N3's schema to disc_copies > > And after this, I was able to add a replica for a table on N3, even > though it had a replica on N1 and N1 was down. So it is not > entirely clear under which conditions mnesia decides to be conservative > about schema changes, and why. > > (BTW, once I started N1 again, mnesia dumped core due to a combine > error, so it would seem as if some conservatism is well warranted. :) Oh, I forgot to mention that after having added the (ram_copies) replica on N3, I started N1 again, then stopped N1, then went in on N3 and changed its copy to disc_copies. I believe this is what caused the problem, because the schema merge effectively instructed N1 to create both a ram copy and a disc copy for N3 on the same table - and this is not allowed. I guess it's possible to spin this into an argument for majority checking on mnesia ops and subsequent merges. :) BR, Ulf Ulf Wiger, CTO, Erlang Solutions, Ltd. http://erlang-solutions.com From ulf.wiger Sat Dec 11 14:34:00 2010 From: ulf.wiger (Ulf Wiger) Date: Sat, 11 Dec 2010 14:34:00 +0100 Subject: [erlang-questions] RFC: mnesia majority checking In-Reply-To: References: <4E9EB37B-17C2-48A3-AFA3-CF1B256E4615@erlang-solutions.com> <4D011BCF.1030605@amberbio.com> <73B551E2-71B4-4243-909E-F4AE23207203@amberbio.com> <31818D23-57A6-4CAF-9B49-CE49E07107D7@erlang-solutions.com> <7F8259DB-13AD-428A-BE20-07D56D864EF7@lovely.email.ne.jp> Message-ID: On 11 Dec 2010, at 14:20, Joseph Wayne Norton wrote: > One last question for now. How does this new majority checking feature treat tables having less than three replicas? Well, a table with only one replica is always in majority. :) For a table with two replicas, both must be up for the condition to be met. This makes sense if the idea is to avoid disaster if the network is split. We cannot tell whether a nodedown is due to a partitioned network or the other node crashing. If we want to be safe in such a situation, we must avoid writing to the table. This really can't be done safely on top of mnesia, since it will be a race. BR, Ulf W Ulf Wiger, CTO, Erlang Solutions, Ltd. http://erlang-solutions.com From jarrod Sat Dec 11 16:08:31 2010 From: jarrod (Jarrod Roberson) Date: Sat, 11 Dec 2010 10:08:31 -0500 Subject: Be careful what you copy at work! Message-ID: http://www.wired.com/threatlevel/2010/12/aleynikov-guilty/ -- Jarrod Roberson 678.551.2852 From kaiduanx Sat Dec 11 16:48:19 2010 From: kaiduanx (Kaiduan Xie) Date: Sat, 11 Dec 2010 10:48:19 -0500 Subject: How to determine the size of pool of gen_tcp acceptor processes? Message-ID: Hi, all, >From the manual of gen_tcp, "It is worth noting that the accept call does not have to be issued from the socket owner process. Using version 5.5.3 and higher of the emulator, multiple simultaneous accept calls can be issued from different processes, which allows for a pool of acceptor processes handling incoming connections." What are the factors to be considered when setting the size of the pool? Does it have any connection with the number of CPU cores? I am running a test SSL server with pool size of 1, and 10, however there is no noticeable difference from the connection establishment rate point of view when running on a one-core box. Any comments are welcome. Best regards, /Kaiduan From hasan.veldstra Sat Dec 11 19:38:09 2010 From: hasan.veldstra (Hassy Veldstra) Date: Sat, 11 Dec 2010 18:38:09 +0000 Subject: [erlang-questions] Erlang Intro/Evangelism Presentation In-Reply-To: References: Message-ID: Ryan, feel free to use anything from here: http://veldstra.org/whyerlang/ On Fri, Dec 3, 2010 at 6:43 PM, Ryan Zezeski wrote: > I've been tasked with giving an introductory level presentation on Erlang at > work. ?The focus is on why you would use Erlang and what does it look like > on the surface level. ?We have a lot of your standard Java/C#/C developers > and this will act as a potential launching pad to introducing Erlang to the > company. ?There is the potential for a large number of people to video > conference into this possibly spanning several countries so I really want to > knock this out of the park. > > I'm writing as an inquiry for links to any prior art that I may use for > inspiration or even steal and use as my own. ?Anything that you think might > be helpful is appreciated, even input on possible approaches. ?I'd really > like to hear from people who have done this sort of thing before, i.e. pubic > speaking on Erlang. > > Thanks, > -Ryan > From alexey.v.romanov Sat Dec 11 21:39:54 2010 From: alexey.v.romanov (Alexey Romanov) Date: Sat, 11 Dec 2010 23:39:54 +0300 Subject: Reason for "The specified module could not be found." Message-ID: When trying to port a linked-in driver to Windows, I've managed to compile it (thanks to https://github.com/davide/erl_interface-examples/tree/master/doc), but run into a problem: 1> ls("priv"). sqlite3.dll sqlite3_drv.dll sqlite3_drv.exp sqlite3_drv.lib 2> erl_ddll:load("priv", sqlite3_drv). {error,{open_error,-136}} 3> erl_ddll:format_error({open_error,-136}). "The specified module could not be found." What might be the reason for inability to find a file which exists? Or is "the specified module" not the driver, but something else? Yours, Alexey Romanov From jesper.louis.andersen Sat Dec 11 23:17:32 2010 From: jesper.louis.andersen (Jesper Louis Andersen) Date: Sat, 11 Dec 2010 23:17:32 +0100 Subject: [ANN] Release of etorrent v1.2.0 Message-ID: Hi all, I am happy to announce the release of Etorrent version 1.2.0 to the world. For those who do not know the project, here is an erlang term describing it: [{name, "Etorrent"}, {version, "v1.2.0"}, {maintainer, "Jesper Louis Andersen "}, {synopsis, "Etorrent is a bittorrent client implementation in Erlang" "focusing on fault-tolerance"}, {homepage, "http://github.com/jlouis/etorrent"}, {build_system, rebar}, {license, bsd2, "COPYING"}, {stability, stable}, {tested, [otp_r14b, otp_r14b01, otp_r13b04]}, {repository, [{release, {etorrent, ".*", {git, "git://github.com/jlouis/etorrent.git", "v1.2.0"}}}, {development, {etorrent, ".*", {git, "git://github.com/jlouis/etorrent.git", "master"}}}]} ]. For INSTALLATION instructions, read the README.md file provided with the repository (it is also on the homepage mentioned in the Erlang term above). This release welcomes an additional developer, Magnus Klaar, who has written a new IO backend and has provided Etorrent with a working Distributed Hash Table implementation. In addition, Magnus has sparked testing in Etorrent. We now test many more functions than we did earlier. We do this by a combination of EUnit and Erlang Quickcheck mini (thanks, Quviq). In addition to Magnus work, we now support more BitTorrent Protocol Extensions (BEPs) and our UI code has been improved so we are better at serving information to the user. Finally, we have replaced SASL with riak_err (from Basho tech.) to battle problems with SASL eating up all memory on errors. Also from Basho, we have adapted rebar as a build system. As a result, we now have even better configuration file support. NEWS follows: Version 1.2.0: This version sees a number of new highlights: Highlights: * (Magnus Klaar) A complete DHT implementation. This is outstanding work. Note that it should be disabled if you use private trackers. We don't heed the private-flag yet (BEP-27) * (Magnus Klaar) A completely new disk IO layer which is more parallel than the old one. Needless to say, it is much faster. * Further work via rebars release handler now lets us build proper releases, for production and/or development (See the README.md file for instructions). * Support for BEP-15: Udp tracker protocol * Support for BEP-12: Multitracker protocol * Numerous improvement to the webUI. * Etorrent now persists the amount of upload and download over sessions. This fixes correct ratios even across stops/starts of etorrent. * Use the riak_err error handler. This plugs a bug where death of many processes would make SASL use too much memory. Fixes: * Remove mnesia from the code base. The new system is running entirely on ETS. * Performance improvements in hot parts of the code. * Begin adding tests to the code, EUnit and Erlang QuickCheck mini. * Add profiling via eprof as a tunable knob. * Fix an outstanding bug in the choker code. Etorrent is now much better at giving back. * Fix a race condition on the gproc table. * Improve supervisor tree shutdown * Change the bcoding module to be less defensive and more erlang-like * Change from uwiger/gproc to esl/gproc. * Numerous fixes to robustness regarding slow disks. Version 1.1.2: Build system restructuring, * This version adds support for a new build system. The README has been updated with the information about how to build the software now. Compared to earlier, we can now build a release which is a stand-alone version of Erlang/OTP and etorrent bundled up nicely. * Locations of log files has been vastly improved. * Magnus Klaars work on DHT has been included. It is not prime-time ready yet, but it is a start. Version 1.1.1: Small quick bugfix release, * Include etorrent.erl, which was not tracked by the repository. Enjoy! -- J. From sgolovan Sun Dec 12 00:29:29 2010 From: sgolovan (Sergei Golovan) Date: Sun, 12 Dec 2010 02:29:29 +0300 Subject: [erlang-questions] PPA for ubuntu? In-Reply-To: References: <1291963922.13124.1.camel@shanghai> <1291979964.29857.0.camel@shanghai> Message-ID: On Fri, Dec 10, 2010 at 5:08 PM, Alain O'Dea wrote: > http://www.erlang-solutions.com/section/72/packages has Erlang > Solutions tested binaries for Erlang/OTP. ?I would consider them to be > more reliable than PPA packages. Given that their package doesn't contain crypto, jinterface, odbc, ssl, ssh applications at all and binary driver for wx app (and who knows which parts are also missing) it would be pretty useless for me. Cheers! -- Sergei Golovan From alain.odea Sun Dec 12 00:37:07 2010 From: alain.odea (Alain O'Dea) Date: Sat, 11 Dec 2010 20:07:07 -0330 Subject: [erlang-questions] [ANN] Release of etorrent v1.2.0 In-Reply-To: References: Message-ID: Cool! I've been following your work on etorrent since sometime in 2008. It is a really cool project and you've derived some great wisdom from it on your blog :) On Saturday, December 11, 2010, Jesper Louis Andersen wrote: > Hi all, > > I am happy to announce the release of Etorrent version 1.2.0 to the > world. For those who do not know the project, here is an erlang term > describing it: > > [{name, "Etorrent"}, > ?{version, "v1.2.0"}, > ?{maintainer, "Jesper Louis Andersen "}, > ?{synopsis, > ?"Etorrent is a bittorrent client implementation in Erlang" > ?"focusing on fault-tolerance"}, > ?{homepage, "http://github.com/jlouis/etorrent"}, > ?{build_system, rebar}, > ?{license, bsd2, "COPYING"}, > ?{stability, stable}, > ?{tested, [otp_r14b, otp_r14b01, otp_r13b04]}, > ?{repository, > ? [{release, > ? ? {etorrent, ".*", {git, "git://github.com/jlouis/etorrent.git", "v1.2.0"}}}, > ? ?{development, > ? ? {etorrent, ".*", {git, "git://github.com/jlouis/etorrent.git", > "master"}}}]} > ]. > > For INSTALLATION instructions, read the README.md file provided with > the repository (it is also on the homepage mentioned in the Erlang > term above). > > This release welcomes an additional developer, Magnus Klaar, who has > written a new IO backend and has provided Etorrent with a working > Distributed Hash Table implementation. In addition, Magnus has sparked > testing in Etorrent. We now test many more functions than we did > earlier. We do this by a combination of EUnit and Erlang Quickcheck > mini (thanks, Quviq). > > In addition to Magnus work, we now support more BitTorrent Protocol > Extensions (BEPs) and our UI code has been improved so we are better > at serving information to the user. Finally, we have replaced SASL > with riak_err (from Basho tech.) to battle problems with SASL eating > up all memory on errors. Also from Basho, we have adapted rebar as a > build system. As a result, we now have even better configuration file > support. > > NEWS follows: > > Version 1.2.0: > > This version sees a number of new highlights: > > ?Highlights: > ? * (Magnus Klaar) A complete DHT implementation. This is outstanding > ? ? work. Note that it should be disabled if you use private > ? ? trackers. We don't heed the private-flag yet (BEP-27) > ? * (Magnus Klaar) A completely new disk IO layer which is more parallel > ? ? than the old one. Needless to say, it is much faster. > ? * Further work via rebars release handler now lets us build proper releases, > ? ? for production and/or development (See the README.md file for > ? ? instructions). > ? * Support for BEP-15: Udp tracker protocol > ? * Support for BEP-12: Multitracker protocol > ? * Numerous improvement to the webUI. > ? * Etorrent now persists the amount of upload and download over sessions. > ? ? This fixes correct ratios even across stops/starts of etorrent. > ? * Use the riak_err error handler. This plugs a bug where death of many > ? ? processes would make SASL use too much memory. > > ?Fixes: > ? * Remove mnesia from the code base. The new system is running entirely on > ? ? ETS. > ? * Performance improvements in hot parts of the code. > ? * Begin adding tests to the code, EUnit and Erlang QuickCheck mini. > ? * Add profiling via eprof as a tunable knob. > ? * Fix an outstanding bug in the choker code. Etorrent is now much better > ? ? at giving back. > ? * Fix a race condition on the gproc table. > ? * Improve supervisor tree shutdown > ? * Change the bcoding module to be less defensive and more erlang-like > ? * Change from uwiger/gproc to esl/gproc. > ? * Numerous fixes to robustness regarding slow disks. > > > Version 1.1.2: > > Build system restructuring, > > ?* This version adds support for a new build system. The README has > ? ?been updated with the information about how to build the software > ? ?now. Compared to earlier, we can now build a release which is a > ? ?stand-alone version of Erlang/OTP and etorrent bundled up nicely. > ?* Locations of log files has been vastly improved. > ?* Magnus Klaars work on DHT has been included. It is not prime-time > ? ?ready yet, but it is a start. > > Version 1.1.1: > > Small quick bugfix release, > > ?* Include etorrent.erl, which was not tracked by the repository. > > > Enjoy! > > -- > J. > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From kenji.rikitake Sun Dec 12 12:35:50 2010 From: kenji.rikitake (Kenji Rikitake) Date: Sun, 12 Dec 2010 20:35:50 +0900 Subject: R14B01 FreeBSD unofficial port Message-ID: <20101212113550.GA7456@k2r.org> The following tar.gz archive includes an unofficial port of Erlang R14B01 for FreeBSD (erlang-r14b01,1). Note 1: R14B01 official port has not yet been announced. This is my preliminary port. YMMV. Note 2: Java functionality untested. Note 3: Compilation/installation tested on FreeBSD 7.3-RELEASE i386. http://www.ne.jp/asahi/bdx/info/software/erlang-r14b01-beta-20101212.tar.gz Regards, Kenji Rikitake From alessandro.sivieri Sun Dec 12 12:39:51 2010 From: alessandro.sivieri (Alessandro Sivieri) Date: Sun, 12 Dec 2010 12:39:51 +0100 Subject: [erlang-questions] PPA for ubuntu? In-Reply-To: References: <1291963922.13124.1.camel@shanghai> <1291979964.29857.0.camel@shanghai> Message-ID: I have just updated the PPA with R14B01, taken again from Debian Experimental, if anyone is interested. -- Sivieri Alessandro alessandro.sivieri http://www.chimera-bellerofonte.eu/ http://www.poul.org/ From alain.odea Sun Dec 12 15:05:27 2010 From: alain.odea (Alain O'Dea) Date: Sun, 12 Dec 2010 10:35:27 -0330 Subject: [erlang-questions] PPA for ubuntu? In-Reply-To: References: <1291963922.13124.1.camel@shanghai> <1291979964.29857.0.camel@shanghai> Message-ID: Hi Alessandro: Thank you for maintaining an Erlang PPA. It makes it much easier to try out the latest version. The risks of PPAs exist, but are significantly reduced in the presence of trust. I trust your PPAs for my own machine and I now benefit from having the latest release as a result. Thank you again :) Best regards, Alain On Sunday, December 12, 2010, Alessandro Sivieri wrote: > I have just updated the PPA with R14B01, taken again from Debian > Experimental, if anyone is interested. > > -- > Sivieri Alessandro > alessandro.sivieri > http://www.chimera-bellerofonte.eu/ > http://www.poul.org/ > From zvi.avraham Sun Dec 12 18:32:33 2010 From: zvi.avraham (Zvi) Date: Sun, 12 Dec 2010 09:32:33 -0800 (PST) Subject: Erlang/OTP R14B01 has been released In-Reply-To: References: Message-ID: Hi, running new inet:getifaddrs/0 on my Ubuntu machine results in segfault: [~]\$ erl Erlang R14B01 (erts-5.8.2) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.8.2 (abort with ^G) 1> 1> inet:getifaddrs(). Segmentation fault [~]\$ [~]\$ uname -a Linux XXXXXXX 2.6.32-26-generic-pae #48-Ubuntu SMP Wed Nov 24 10:31:20 UTC 2010 i686 GNU/Linux Zvi On Dec 8, 4:49?pm, Kenneth Lundin wrote: > Erlang/OTP R14B01 has been released. > > This release is mainly a stabilization of the R14B01 release (but there are > some new functionality as well). > > You can find the README file for the release at > > http://www.erlang.org/download/otp_src_R14B01.readme > > The source distribution and binary distribution for Windows can be > downloaded from > > http://www.erlang.org/download/otp_src_R14B01.tar.gzhttp://www.erlang.org/download/otp_win32_R14B01.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_R14B01.tar.gz.torrenthttp://www.erlang.org/download/otp_win32_R14B01.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_R14B01.tar.gzhttp://www.erlang.org/download/otp_doc_man_R14B01.tar.gz > > We also want to thank those that sent us patches, suggestions and bug > reports, > > The Erlang/OTP Team > Kenneth Lundin, Erlang/OTP, Ericsson AB > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > Seehttp://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscr... From zerthurd Sun Dec 12 18:43:14 2010 From: zerthurd (Maxim Treskin) Date: Sun, 12 Dec 2010 23:43:14 +0600 Subject: [erlang-questions] Re: Erlang/OTP R14B01 has been released In-Reply-To: References: Message-ID: Have the same on Gentoo # uname -a Linux zert 2.6.36-sabayon #1 SMP Wed Nov 17 18:15:21 UTC 2010 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 4200+ AuthenticAMD GNU/Linux On 12 December 2010 23:32, Zvi wrote: > Hi, > > running new inet:getifaddrs/0 on my Ubuntu machine results in > segfault: > > [~]\$ erl > Erlang R14B01 (erts-5.8.2) [source] [smp:2:2] [rq:2] [async-threads:0] > [hipe] [kernel-poll:false] > > Eshell V5.8.2 (abort with ^G) > 1> > 1> inet:getifaddrs(). > Segmentation fault > [~]\$ > > [~]\$ uname -a > Linux XXXXXXX 2.6.32-26-generic-pae #48-Ubuntu SMP Wed Nov 24 10:31:20 > UTC 2010 i686 GNU/Linux > > Zvi > > On Dec 8, 4:49 pm, Kenneth Lundin wrote: > > Erlang/OTP R14B01 has been released. > > > > This release is mainly a stabilization of the R14B01 release (but there > are > > some new functionality as well). > > > > You can find the README file for the release at > > > > http://www.erlang.org/download/otp_src_R14B01.readme > > > > The source distribution and binary distribution for Windows can be > > downloaded from > > > > > http://www.erlang.org/download/otp_src_R14B01.tar.gzhttp://www.erlang.org/download/otp_win32_R14B01.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_R14B01.tar.gz.torrenthttp://www.erlang.org/download/otp_win32_R14B01.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_R14B01.tar.gzhttp://www.erlang.org/download/otp_doc_man_R14B01.tar.gz > > > > We also want to thank those that sent us patches, suggestions and bug > > reports, > > > > The Erlang/OTP Team > > Kenneth Lundin, Erlang/OTP, Ericsson AB > > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > Seehttp://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscr... > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > -- Maxim Treskin From zvi.avraham Sun Dec 12 18:51:02 2010 From: zvi.avraham (Zvi) Date: Sun, 12 Dec 2010 09:51:02 -0800 (PST) Subject: Erlang/OTP R14B01 has been released In-Reply-To: References: Message-ID: <32cbd8bc-12ea-49aa-b263-29dc8857ad7b@p1g2000yqm.googlegroups.com> RE: OTP-8865 Code such as foo(A) -> <> would crash the compiler. It seems that compiler will totally ignore type of A in this case: Eshell V5.8.2 (abort with ^G) 1> F = fun(A) -> <> end. #Fun 2> 2> F(0). <<>> 3> F(1). <<>> 4> F(10000). <<>> 5> F(1.4). <<>> 6> F(add). <<>> 7> F(kuku). <<>> 8> 8> F("adfd"). <<>> 9> 9> F({1,2}). <<>> 10> same for: Eshell V5.8.2 (abort with ^G) 1> 1> 1> A = 0. 0 2> <>. <<>> 3> 3> <<({1,2,3}):0>>. <<>> 4> <<([1,2,3]):0>>. <<>> 5> <<"hello":0>>. ** exception error: bad argument 6> <<("hello"):0>>. ** exception error: bad argument 7> <<1.6:0>>. <<>> 8> <<(fun()-> ok end):0>>. <<>> 9> <<(self()):0>>. <<>> 1 Zvi On Dec 8, 4:49?pm, Kenneth Lundin wrote: > Erlang/OTP R14B01 has been released. > > This release is mainly a stabilization of the R14B01 release (but there are > some new functionality as well). > > You can find the README file for the release at > > http://www.erlang.org/download/otp_src_R14B01.readme > > The source distribution and binary distribution for Windows can be > downloaded from > > http://www.erlang.org/download/otp_src_R14B01.tar.gzhttp://www.erlang.org/download/otp_win32_R14B01.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_R14B01.tar.gz.torrenthttp://www.erlang.org/download/otp_win32_R14B01.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_R14B01.tar.gzhttp://www.erlang.org/download/otp_doc_man_R14B01.tar.gz > > We also want to thank those that sent us patches, suggestions and bug > reports, > > The Erlang/OTP Team > Kenneth Lundin, Erlang/OTP, Ericsson AB > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > Seehttp://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscr... From zvi.avraham Sun Dec 12 19:31:04 2010 From: zvi.avraham (Zvi) Date: Sun, 12 Dec 2010 10:31:04 -0800 (PST) Subject: Server load tests on Linux In-Reply-To: References: Message-ID: <5ccc6f0f-c9f1-4d78-86a1-82d7919c9775@k25g2000vbl.googlegroups.com> Just try something like this (spawn a process per HTTP request): http_get(Path, IP, Port) -> case gen_tcp:connect(IP, Port, [binary]) of {ok, Sock} -> HttpReq = iolist_to_binary(io_lib:format("GET ~s\r\n" "Host: ~s\r\n" "\r\n", [Path, IP])), ok = gen_tcp:send(Sock, HttpReq), do_recv(Sock), case (catch gen_tcp:close(Sock)) of {'EXIT',_} -> error; _ -> ok end, {error, Reason} -> io:format("Error ~p connecting outbound socket: ~s:~b~n", [Reason,IP,Port]) end. do_recv(Sock)-> case gen_tcp:recv(Sock, 0) of {ok, Data} -> io:format("Recvd ~s~n", [Data]); {error, closed} -> closed; _Other -> io:format("Other ~p~n", [_Other]) end. Zvi On Dec 9, 7:34?pm, Alessandro Sivieri wrote: > Hi all, > > I'm trying to perform some load tests on a Web server, so I have created a > little script performing parallel connections to the server and getting the > responses, all this using httpc, but when this number gets large this > message starts to pop out: > > =ERROR REPORT==== 9-Dec-2010::18:30:14 === > HTTPC-MANAGER handler (<0.297.0>) successfully started for > unknown request #Ref<0.0.0.651> => canceling > > Is there a limit in the number httpc is able to treat? Or maybe I have to > change something in my OS (Ubuntu 10.10)? > > -- > Sivieri Alessandro > alessandro.sivi...://www.chimera-bellerofonte.eu/http://www.poul.org/ From alessandro.sivieri Sun Dec 12 19:34:04 2010 From: alessandro.sivieri (Alessandro Sivieri) Date: Sun, 12 Dec 2010 19:34:04 +0100 Subject: [erlang-questions] Re: Server load tests on Linux In-Reply-To: <5ccc6f0f-c9f1-4d78-86a1-82d7919c9775@k25g2000vbl.googlegroups.com> References: <5ccc6f0f-c9f1-4d78-86a1-82d7919c9775@k25g2000vbl.googlegroups.com> Message-ID: Thanks for the answers; I'm using Tsung for now, it seems a very good tool. -- Sivieri Alessandro alessandro.sivieri http://www.chimera-bellerofonte.eu/ http://www.poul.org/ From zvi.avraham Sun Dec 12 19:43:09 2010 From: zvi.avraham (Zvi) Date: Sun, 12 Dec 2010 10:43:09 -0800 (PST) Subject: Server load tests on Linux In-Reply-To: References: <5ccc6f0f-c9f1-4d78-86a1-82d7919c9775@k25g2000vbl.googlegroups.com> Message-ID: I used tsung to test ejabberd, but didn't figured out how to use it for long-lived HTTP comet connections. On Dec 12, 8:34?pm, Alessandro Sivieri wrote: > Thanks for the answers; I'm using Tsung for now, it seems a very good tool. > > -- > Sivieri Alessandro > alessandro.sivi...://www.chimera-bellerofonte.eu/http://www.poul.org/ From xiaopong.tran Mon Dec 13 01:38:38 2010 From: xiaopong.tran (Xiaopong Tran) Date: Mon, 13 Dec 2010 08:38:38 +0800 Subject: [erlang-questions] PPA for ubuntu? In-Reply-To: References: <1291963922.13124.1.camel@shanghai> <1291979964.29857.0.camel@shanghai> Message-ID: <1292200718.3687.0.camel@shanghai> Thanks a lot for the hard work. Please make an announcement when you release an update in the future :) Best regards, Xiaopong On Sun, 2010-12-12 at 12:39 +0100, Alessandro Sivieri wrote: > I have just updated the PPA with R14B01, taken again from Debian > Experimental, if anyone is interested. > From ebegumisa Mon Dec 13 08:19:01 2010 From: ebegumisa (Edmond Begumisa) Date: Mon, 13 Dec 2010 18:19:01 +1100 Subject: [erlang-questions] Speaking of comments In-Reply-To: References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz> <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> <00a601cb96e5\$c12d74d0\$43885e70\$@com> Message-ID: Interesting article. I don't know about using non-ASCII for actual source-code as the author suggests. I'm not a language designer so I have no opinion this (though in relation to this, I've sometimes wondered about alternatives to programing languages revolving around English -- it must really irritate non-English speakers, especially those coming from languages using non-latin alphabets.) What I would love is very rich and flexible ways of attaching annotations or "running commentary" to source code. I would think this could be done without changing the language in question. Probably more of an Editor/IDE feature than a language feature. One can envisage some sort of open file format (maybe mark-up based) that accompanies source code which various editors/IDEs could start reading+writing to and render next to the actual source code. That would probably be more acceptable to people and less disruptive. - Edmond - On Thu, 09 Dec 2010 02:46:46 +1100, Toby Thain wrote: > On 08/12/10 10:15 AM, Edmond Begumisa wrote: >> I've thought -- now and then, in the back of my mind -- about removing >> comments from actual source all-together ... >> Also, in the right pane, I've wanted nestable trees with flexible levels >> of detail. Heck, why not even rich text? "FIX ME" in bold red. > > I wonder if you have seen this: > http://developers.slashdot.org/article.pl?sid=10/10/31/2127201 > > --Toby > > >> Take it >> further: login-name awareness, source-control/bug-tracker integration >> (this programmer said this, that programmer said that.) >> >> It seems a shame that in 2010, it's still so limiting what we can do >> with comments in our source code! >> >> - Edmond - >> >> On Thu, 09 Dec 2010 01:39:42 +1100, David Mercer >> wrote: >> >>> On Tuesday, December 07, 2010, Richard O'Keefe wrote: >>> >>>> Nesting comments are one of those clever ideas >>>> that turn out to be really dumb, because they don't actually work. >>> -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ From banibrata.dutta Mon Dec 13 09:34:36 2010 From: banibrata.dutta (Banibrata Dutta) Date: Mon, 13 Dec 2010 14:04:36 +0530 Subject: [erlang-questions] Speaking of comments In-Reply-To: References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz> <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> <00a601cb96e5\$c12d74d0\$43885e70\$@com> Message-ID: On Wed, Dec 8, 2010 at 8:45 PM, Edmond Begumisa wrote: > I've thought -- now and then, in the back of my mind -- about removing > comments from actual source all-together (for all languages) and instead, > putting them in companion files that the editor lines up side-by-side. More > like annotating than just traditional commenting. > > It's an interesting thought, as it removes clutter -- especially so for a programmer who is already well versed with the code. Most modern editors have features allowing the view to show all comments collapsed, expanded, and some even done so selectively. > Has this sort of thing been done before? Is there a particular editor that > can give me this out of the box? (I admittedly haven't explored a large > number of editors) > > Using Erlang as an example, I've secretly wanted something like... > > foo.erl > foo.cts > Challenge would be to ensure 100% (fail-proof) lock-step update of the .erl and .cts files in VCS... ideally triggered from a single command. > Then an editor that could give me two panes while keeping the two files in > sync... > > foo -> | This function does... > blah | This part is buggy... > balh | > > Also, in the right pane, I've wanted nestable trees with flexible levels of > detail. Heck, why not even rich text? "FIX ME" in bold red. Take it further: > login-name awareness, source-control/bug-tracker integration (this > programmer said this, that programmer said that.) > > It seems a shame that in 2010, it's still so limiting what we can do with > comments in our source code! > > - Edmond - > > On Thu, 09 Dec 2010 01:39:42 +1100, David Mercer > wrote: > > On Tuesday, December 07, 2010, Richard O'Keefe wrote: >> >> Nesting comments are one of those clever ideas >>> that turn out to be really dumb, because they don't actually work. >>> >> >> I'll bite, mainly because I've sometimes thought nesting comments would be >> helpful, for instance, when commenting out large blocks of code, but it is >> rare that I get to work with a language that supports them. Since you're >> almost always right about such things, why do you say that they don't >> actually work? >> >> Cheers, >> >> David >> >> >> From zvi.avraham Mon Dec 13 10:40:55 2010 From: zvi.avraham (Zvi) Date: Mon, 13 Dec 2010 01:40:55 -0800 (PST) Subject: Multi-line comments in Erlang In-Reply-To: <92F762DE-4E1A-4E76-B419-F139E393DEA3@gmail.com> References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <92F762DE-4E1A-4E76-B419-F139E393DEA3@gmail.com> Message-ID: <56a21d44-81c4-4f8c-bac0-9a4a6a482533@39g2000yqa.googlegroups.com> Please, no need to turn this into religious war and no need to imply that your process or software engineering practices are better than mine. If majority of people doesn't like multiline/HEREDOC comments - so be it. I have no idea, why people imply, that I should use emacs/vim or that I use multiline comments to comment executable code or that I don't use git or ClearCase. Language design usually doesn't have anything to do with editors, IDEs, DVCS or your organization coding conventions. Unless it's some kind of exotic language fused into IDE/executable environment. The reason I posted this is because I found out, that Matlab/Octave supports this style of comment (%{ ... %}), even that it's IDE has perfect support for commenting and uncommenting entire sections of source files with end of line comments (... % COMMENT). Now Matlab is not the best example of programming language, but I think in this particular feature they did it right. Zvi On Dec 10, 1:21?am, Ryan Zezeski wrote: > On Dec 9, 2010, at 4:48 AM, "Zvi ." wrote: > > > > > 3. Free format is the king! Language designers shouldn't dictate programmers > > how to format and ident their code. > > How differnt is starting comment line from '%' in Erlang, from putting 'C' > > or '*' in the first column in FORTRAN? > > > Zvi > > Really? ?If free format is king then why does every lang have common code conventions? ?For example, I hate CamelCase but that doesn't mean I'm going to start naming my variables camel_case in Java because my coworkers would take me out back and beat me. > > There should always be a middle ground between extremes but without some type of common conventions our code would be a tower of babel, more so than it already is. ?People make certain assumptions, and when you break those assumptions confusion, contempt, and even bugs can ensue. > > I don't see the need for multiline comments as described in this thread. ?Any reputable editor can handle it. ?I know I have no problems in Emacs or Vim. > > I also know in the past multiline comments in C++ has bitten me because I nested them in order to comment out code. ?As has been said, good SCM takes care of this for you, git stash and branch come to mind. > > -Ryan From robert.virding Mon Dec 13 11:24:43 2010 From: robert.virding (Robert Virding) Date: Mon, 13 Dec 2010 10:24:43 +0000 (GMT) Subject: [erlang-questions] Re: Erlang/OTP R14B01 has been released In-Reply-To: <32cbd8bc-12ea-49aa-b263-29dc8857ad7b@p1g2000yqm.googlegroups.com> Message-ID: <46038455.189971292235883108.JavaMail.root@zimbra> In neither case are you running the compiler, both are handled by the interpreter, erl_eval, so they should behave in the same way. I would class this as a bug. Robert ----- "Zvi" wrote: > RE: OTP-8865 Code such as foo(A) -> <> would crash the > compiler. > > It seems that compiler will totally ignore type of A in this case: > > Eshell V5.8.2 (abort with ^G) > 1> F = fun(A) -> <> end. > #Fun > 2> > 2> F(0). > <<>> > 3> F(1). > <<>> > 4> F(10000). > <<>> > 5> F(1.4). > <<>> > 6> F(add). > <<>> > 7> F(kuku). > <<>> > 8> > 8> F("adfd"). > <<>> > 9> > 9> F({1,2}). > <<>> > 10> > > same for: > > Eshell V5.8.2 (abort with ^G) > 1> > 1> > 1> A = 0. > 0 > 2> <>. > <<>> > 3> > 3> <<({1,2,3}):0>>. > <<>> > 4> <<([1,2,3]):0>>. > <<>> > 5> <<"hello":0>>. > ** exception error: bad argument > 6> <<("hello"):0>>. > ** exception error: bad argument > 7> <<1.6:0>>. > <<>> > 8> <<(fun()-> ok end):0>>. > <<>> > 9> <<(self()):0>>. > <<>> > 1 > > Zvi > On Dec 8, 4:49?pm, Kenneth Lundin wrote: > > Erlang/OTP R14B01 has been released. > > > > This release is mainly a stabilization of the R14B01 release (but > there are > > some new functionality as well). > > > > You can find the README file for the release at > > > > http://www.erlang.org/download/otp_src_R14B01.readme > > > > The source distribution and binary distribution for Windows can be > > downloaded from > > > > > http://www.erlang.org/download/otp_src_R14B01.tar.gzhttp://www.erlang.org/download/otp_win32_R14B01.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_R14B01.tar.gz.torrenthttp://www.erlang.org/download/otp_win32_R14B01.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_R14B01.tar.gzhttp://www.erlang.org/download/otp_doc_man_R14B01.tar.gz > > > > We also want to thank those that sent us patches, suggestions and > bug > > reports, > > > > The Erlang/OTP Team > > Kenneth Lundin, Erlang/OTP, Ericsson AB > > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > Seehttp://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscr... > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe From paolo.negri Mon Dec 13 11:35:00 2010 From: paolo.negri (Paolo Negri) Date: Mon, 13 Dec 2010 11:35:00 +0100 Subject: gen_leader official repository Message-ID: Dear list, I'm evaluating a global process registry solution, searching in the list archive it seems that gproc + gen_leader would be a good candidate. I'm trying to understand which one is the "best" version of gen_leader to use. The most official source http://ulf.wiger.net/weblog/my-erlang-projects points to http://www.cs.chalmers.se/~hanssv/leader_election/ which is no longer available. The most updated repository I could find on github is https://github.com/abecciu/gen_leader_revival Is there any better version or a kind of official repository? Kind Regards, Paolo Negri From raimo+erlang-questions Mon Dec 13 11:38:18 2010 From: raimo+erlang-questions (Raimo Niskanen) Date: Mon, 13 Dec 2010 11:38:18 +0100 Subject: [erlang-questions] Re: Erlang/OTP R14B01 has been released In-Reply-To: References: Message-ID: <20101213103818.GA11931@erix.ericsson.se> On Sun, Dec 12, 2010 at 09:32:33AM -0800, Zvi wrote: > Hi, > > running new inet:getifaddrs/0 on my Ubuntu machine results in > segfault: Which Ubuntu is it, and what configure flags did you use? > > [~]\$ erl > Erlang R14B01 (erts-5.8.2) [source] [smp:2:2] [rq:2] [async-threads:0] > [hipe] [kernel-poll:false] > > Eshell V5.8.2 (abort with ^G) > 1> > 1> inet:getifaddrs(). > Segmentation fault > [~]\$ > > [~]\$ uname -a > Linux XXXXXXX 2.6.32-26-generic-pae #48-Ubuntu SMP Wed Nov 24 10:31:20 > UTC 2010 i686 GNU/Linux > > Zvi > > On Dec 8, 4:49?pm, Kenneth Lundin wrote: > > Erlang/OTP R14B01 has been released. > > > > This release is mainly a stabilization of the R14B01 release (but there are > > some new functionality as well). > > > > You can find the README file for the release at > > > > http://www.erlang.org/download/otp_src_R14B01.readme > > > > The source distribution and binary distribution for Windows can be > > downloaded from > > > > http://www.erlang.org/download/otp_src_R14B01.tar.gzhttp://www.erlang.org/download/otp_win32_R14B01.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_R14B01.tar.gz.torrenthttp://www.erlang.org/download/otp_win32_R14B01.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_R14B01.tar.gzhttp://www.erlang.org/download/otp_doc_man_R14B01.tar.gz > > > > We also want to thank those that sent us patches, suggestions and bug > > reports, > > > > The Erlang/OTP Team > > Kenneth Lundin, Erlang/OTP, Ericsson AB > > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > Seehttp://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscr... > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From ulf.wiger Mon Dec 13 11:41:05 2010 From: ulf.wiger (Ulf Wiger) Date: Mon, 13 Dec 2010 11:41:05 +0100 Subject: [erlang-questions] gen_leader official repository In-Reply-To: References: Message-ID: <0048A802-5D6D-4E31-AC2F-F7C167B249E6@erlang-solutions.com> I think abecciu's gen_leader seems a pretty safe bet. It is also packaged as an OTP application and rebar:ified. I really need to update that blog page... BR, Ulf W On 13 Dec 2010, at 11:35, Paolo Negri wrote: > Dear list, > > I'm evaluating a global process registry solution, searching in the > list archive it seems that gproc + gen_leader would be a good > candidate. > I'm trying to understand which one is the "best" version of gen_leader to use. > > The most official source > http://ulf.wiger.net/weblog/my-erlang-projects points to > http://www.cs.chalmers.se/~hanssv/leader_election/ which is no longer > available. > > The most updated repository I could find on github is > https://github.com/abecciu/gen_leader_revival > > Is there any better version or a kind of official repository? > > Kind Regards, > > Paolo Negri > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > Ulf Wiger, CTO, Erlang Solutions, Ltd. http://erlang-solutions.com From ebegumisa Mon Dec 13 12:09:08 2010 From: ebegumisa (Edmond Begumisa) Date: Mon, 13 Dec 2010 22:09:08 +1100 Subject: [erlang-questions] Speaking of comments In-Reply-To: References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz> <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> <00a601cb96e5\$c12d74d0\$43885e70\$@com> Message-ID: On Mon, 13 Dec 2010 19:34:36 +1100, Banibrata Dutta wrote: > On Wed, Dec 8, 2010 at 8:45 PM, Edmond Begumisa > > wrote: > >> I've thought -- now and then, in the back of my mind -- about removing >> comments from actual source all-together (for all languages) and >> instead, >> putting them in companion files that the editor lines up side-by-side. >> More >> like annotating than just traditional commenting. >> >> > It's an interesting thought, as it removes clutter -- especially so for a > programmer who is already well versed with the code. I agree. I've frequently wanted to add more running commentary on a piece of code then stopped myself because of the verboseness it would introduce. It would be nice to be able to add comments "on the side" without affecting the readability/compactness of a function, especially for a language as terse as Erlang. It would also be nice to be able to do this with headings-body, nesting/depths and user-name tags (like comments on a blog) plus richness of content (e.g. many times I've wished I could stick a PNG diagram from some spec into a comment.) Treating annotations and source-code as two different (but related) things might be the answer. > Most modern editors have features allowing the view to show all comments > collapsed, expanded, and some even done so selectively. > Exactly! This is the concept I would like to see expanded on. Collapsible annotation. But as pointed out in that article Toby posted, were not making much use of the space to the right of our editors. That seems like the perfect place to display comments (of the commentary variety), and offers potential for some flexibility (e.g. more than one comment could be placed next to a single line or chunk of code like next to the function name - hovering the mouse over each heading could then show the detail.) I also don't like that many editors force me to think about wrapping when writing English comments (writing English is not the same as writing code). With the editor split into two panes, code on one side, rich English/Swedish/Hindi/Chinese/Arabic on the other, different wrapping + rtl/ltr could be used. > >> Has this sort of thing been done before? Is there a particular editor >> that >> can give me this out of the box? (I admittedly haven't explored a large >> number of editors) >> >> Using Erlang as an example, I've secretly wanted something like... >> >> foo.erl >> foo.cts >> > > Challenge would be to ensure 100% (fail-proof) lock-step update of the > .erl > and .cts files in VCS... ideally triggered from a single command. > True. As a VCS user, you'd generally have start thinking of each file as two files. > >> Then an editor that could give me two panes while keeping the two files >> in >> sync... >> >> foo -> | This function does... >> blah | This part is buggy... >> balh | >> >> Also, in the right pane, I've wanted nestable trees with flexible >> levels of >> detail. Heck, why not even rich text? "FIX ME" in bold red. Take it >> further: >> login-name awareness, source-control/bug-tracker integration (this >> programmer said this, that programmer said that.) >> >> It seems a shame that in 2010, it's still so limiting what we can do >> with >> comments in our source code! >> >> - Edmond - >> >> On Thu, 09 Dec 2010 01:39:42 +1100, David Mercer >> wrote: >> >> On Tuesday, December 07, 2010, Richard O'Keefe wrote: >>> >>> Nesting comments are one of those clever ideas >>>> that turn out to be really dumb, because they don't actually work. >>>> >>> >>> I'll bite, mainly because I've sometimes thought nesting comments >>> would be >>> helpful, for instance, when commenting out large blocks of code, but >>> it is >>> rare that I get to work with a language that supports them. Since >>> you're >>> almost always right about such things, why do you say that they don't >>> actually work? >>> >>> Cheers, >>> >>> David >>> >>> >>> -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ From matthias Mon Dec 13 12:49:47 2010 From: matthias (Matthias Lang) Date: Mon, 13 Dec 2010 12:49:47 +0100 Subject: is the SMALL_MEMORY define deprecated? (no) Why is it only used for VxWorks? Message-ID: <20101213114947.GA8847@corelatus.se> Hi, I noticed the 'SMALL_MEMORY' define in the emulator source. It's only ever enabled for vxworks, in sys/vxworks/erl_vxworks_sys.h. Question 1: is SMALL_MEMORY deprecated? (it's not documented anywhere) Question 2: is there a known problem using it for non-VxWorks targets? Question 3: is anyone else using that define on a non-VxWorks system? I tried it out on my target hardware, a 32-bit MIPS linux system. It passes my whole test suite and cuts memory use from about 9M to about 8M. Not bad for no effort on my part. I haven't measured performance. Going through the code, it has these effects: - Disables all (?) of the optional memory allocators. Similar (same?) effect can be achieved with +Mea min (erl_alloc.c) - Sets lower sizes/thresholds for block sizes and parameters in memory allocators, often half or a quarter. (erl_alloc.c, erl_alloc_util.h) - Cuts the timer hash table to 1/3 size. (erl_bif_timer.c) - Cuts the timing wheel from 256k to 32k (time.c) - Makes processes more "GC happy". (erl_process.h) none of that seems scary. Have I missed anything? Matt From zvi.avraham Mon Dec 13 13:17:14 2010 From: zvi.avraham (Zvi .) Date: Mon, 13 Dec 2010 14:17:14 +0200 Subject: [erlang-questions] Re: Erlang/OTP R14B01 has been released In-Reply-To: <20101213103818.GA11931@erix.ericsson.se> References: <20101213103818.GA11931@erix.ericsson.se> Message-ID: On Mon, Dec 13, 2010 at 12:38 PM, Raimo Niskanen < raimo+erlang-questions > wrote: > On Sun, Dec 12, 2010 at 09:32:33AM -0800, Zvi wrote: > > Hi, > > > > running new inet:getifaddrs/0 on my Ubuntu machine results in > > segfault: > > Which Ubuntu is it, and what configure flags did you use? Ubuntu 10.04 just: ./configure make sudo make install From zvi.avraham Mon Dec 13 13:23:31 2010 From: zvi.avraham (Zvi .) Date: Mon, 13 Dec 2010 14:23:31 +0200 Subject: [erlang-questions] Re: Erlang/OTP R14B01 has been released In-Reply-To: <46038455.189971292235883108.JavaMail.root@zimbra> References: <32cbd8bc-12ea-49aa-b263-29dc8857ad7b@p1g2000yqm.googlegroups.com> <46038455.189971292235883108.JavaMail.root@zimbra> Message-ID: On Mon, Dec 13, 2010 at 12:24 PM, Robert Virding < robert.virding> wrote: > In neither case are you running the compiler, both are handled by the > interpreter, erl_eval, so they should behave in the same way. I would class > this as a bug. > > Robert > yes, I was lazy to write a real module, so I just played from REPL. I guess this is yet another reason, when people will blame for not using emacs ;) So what, it's not possible to write modules from shell? It's easy with decent editor like emacs ;) Zvi From lemenkov Mon Dec 13 14:02:27 2010 From: lemenkov (Peter Lemenkov) Date: Mon, 13 Dec 2010 16:02:27 +0300 Subject: [erlang-questions] Erlang/OTP R14B01 has been released In-Reply-To: References: Message-ID: Hello All! 2010/12/8 Kenneth Lundin : > Erlang/OTP R14B01 has been released. I also encountered severe issue while compiling: === Entering application hipe make[3]: Entering directory `/builddir/build/BUILD/erlang-otp-c49e644/lib/hipe/misc' erlc -W +debug_info +warn_exported_vars +warn_missing_spec +warn_untyped_record -o../ebin hipe_consttab.erl *** buffer overflow detected ***: /builddir/build/BUILD/erlang-otp-c49e644/bin/i386-redhat-linux-gnu/beam.smp terminated ======= Backtrace: ========= /lib/libc.so.6(__fortify_fail+0x4d)[0xc6380d] /lib/libc.so.6(+0xf482a)[0xc6182a] /lib/libc.so.6(__strcpy_chk+0x3f)[0xc60adf] /builddir/build/BUILD/erlang-otp-c49e644/bin/i386-redhat-linux-gnu/beam.smp[0x8194473] /builddir/build/BUILD/erlang-otp-c49e644/bin/i386-redhat-linux-gnu/beam.smp(erts_write_to_port+0x969)[0x80c3e49] /builddir/build/BUILD/erlang-otp-c49e644/bin/i386-redhat-linux-gnu/beam.smp[0x8135ad0] /builddir/build/BUILD/erlang-otp-c49e644/bin/i386-redhat-linux-gnu/beam.smp(process_main+0x67e2)[0x8164c82] /builddir/build/BUILD/erlang-otp-c49e644/bin/i386-redhat-linux-gnu/beam.smp[0x80d06cc] /builddir/build/BUILD/erlang-otp-c49e644/bin/i386-redhat-linux-gnu/beam.smp[0x81bd866] /lib/libpthread.so.0(+0x5f19)[0x812f19] /lib/libc.so.6(clone+0x5e)[0xc49c5e] ======= Memory map: ======== See link above for full log. I'm using snapshot from github instead of ones available at erlang.org. -- With best regards, Peter Lemenkov. From lemenkov Mon Dec 13 14:16:01 2010 From: lemenkov (Peter Lemenkov) Date: Mon, 13 Dec 2010 16:16:01 +0300 Subject: [erlang-questions] Erlang/OTP R14B01 has been released In-Reply-To: References: Message-ID: 2010/12/13 Peter Lemenkov : > Hello All! > > 2010/12/8 Kenneth Lundin : >> Erlang/OTP R14B01 has been released. > > I also encountered severe issue while compiling: ... > See link above for full log. I'm using snapshot from github instead of > ones available at erlang.org. Well. I forgot to provide a link to the build log. Here it is: http://koji.fedoraproject.org/koji/getfile?taskID=2661008&name=build.log -- With best regards, Peter Lemenkov. From erlang Mon Dec 13 14:37:20 2010 From: erlang (Joe Armstrong) Date: Mon, 13 Dec 2010 14:37:20 +0100 Subject: best practice for calling C from Erlang Message-ID: What is "best practice for calling C from Erlang" I have a C library I want to call from Erlang - nothing complicated. Mostly the C functions are called with simple types, integers, strings etc. and the return value is uninteresting. In the case where the return value is interesting I mostly require an opaque return value - ie all I might ever want to do is re-use it in a subsequent call to a different C routine, so the actual return value need never cross the C/Erlang boundary, but could be passed back and forth as a reference. What is the best (and easiest) way to call this from Erlang. Is there any program that takes a file containing C type declarations (either in ANSI C, or as a erlang terms) and automatically builds the C and Erlang sides of the interface? The problem here is not the complexity of an individual call, but the fact there are a large number of simple and rather boring functions than must be called. I know all about the ports interface linked-in drivers etc. My question is more to do with the automatic generation of an interface from some kind of specification. /Joe From matthias Mon Dec 13 14:40:14 2010 From: matthias (Matthias Lang) Date: Mon, 13 Dec 2010 14:40:14 +0100 Subject: [erlang-questions] Re: Erlang/OTP R14B01 has been released In-Reply-To: <46038455.189971292235883108.JavaMail.root@zimbra> References: <32cbd8bc-12ea-49aa-b263-29dc8857ad7b@p1g2000yqm.googlegroups.com> <46038455.189971292235883108.JavaMail.root@zimbra> Message-ID: <20101213134014.GA10055@corelatus.se> On Monday, December 13, Robert Virding wrote: > In neither case are you running the compiler, both are handled by > the interpreter, erl_eval, so they should behave in the same way. I > would class this as a bug. Interesting! Did you really try on R14B01? I get the same results for the interpreter and compiler, and I think they're both wrong in the same way. Eshell V5.8.2 (abort with ^G) 1> c(virding). {ok,virding} 2> virding:f(kuku). <<>> ~ >cat virding.erl -module(virding). -export([f/1]). f(A) -> <>. Matt > ----- "Zvi" wrote: > > > RE: OTP-8865 Code such as foo(A) -> <> would crash the > > compiler. > > > > It seems that compiler will totally ignore type of A in this case: > > > > Eshell V5.8.2 (abort with ^G) > > 1> F = fun(A) -> <> end. > > #Fun > > 2> > > 2> F(0). > > <<>> > > 3> F(1). > > <<>> > > 4> F(10000). > > <<>> > > 5> F(1.4). > > <<>> > > 6> F(add). > > <<>> > > 7> F(kuku). > > <<>> > > 8> > > 8> F("adfd"). > > <<>> > > 9> > > 9> F({1,2}). > > <<>> > > 10> > > > > same for: > > > > Eshell V5.8.2 (abort with ^G) > > 1> > > 1> > > 1> A = 0. > > 0 > > 2> <>. > > <<>> > > 3> > > 3> <<({1,2,3}):0>>. > > <<>> > > 4> <<([1,2,3]):0>>. > > <<>> > > 5> <<"hello":0>>. > > ** exception error: bad argument > > 6> <<("hello"):0>>. > > ** exception error: bad argument > > 7> <<1.6:0>>. > > <<>> > > 8> <<(fun()-> ok end):0>>. > > <<>> > > 9> <<(self()):0>>. > > <<>> > > 1 > > > > Zvi > > On Dec 8, 4:49?pm, Kenneth Lundin wrote: > > > Erlang/OTP R14B01 has been released. > > > > > > This release is mainly a stabilization of the R14B01 release (but > > there are > > > some new functionality as well). > > > > > > You can find the README file for the release at > > > > > > http://www.erlang.org/download/otp_src_R14B01.readme > > > > > > The source distribution and binary distribution for Windows can be > > > downloaded from > > > > > > > > http://www.erlang.org/download/otp_src_R14B01.tar.gzhttp://www.erlang.org/download/otp_win32_R14B01.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_R14B01.tar.gz.torrenthttp://www.erlang.org/download/otp_win32_R14B01.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_R14B01.tar.gzhttp://www.erlang.org/download/otp_doc_man_R14B01.tar.gz > > > > > > We also want to thank those that sent us patches, suggestions and > > bug > > > reports, > > > > > > The Erlang/OTP Team > > > Kenneth Lundin, Erlang/OTP, Ericsson AB > > > > > > ________________________________________________________________ > > > erlang-questions (at) erlang.org mailing list. > > > Seehttp://www.erlang.org/faq.html > > > To unsubscribe; mailto:erlang-questions-unsubscr... > > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > See http://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscribe > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > From jesper.louis.andersen Mon Dec 13 14:58:28 2010 From: jesper.louis.andersen (Jesper Louis Andersen) Date: Mon, 13 Dec 2010 14:58:28 +0100 Subject: [erlang-questions] Re: Erlang/OTP R14B01 has been released In-Reply-To: References: <20101213103818.GA11931@erix.ericsson.se> Message-ID: On Mon, Dec 13, 2010 at 1:17 PM, Zvi . wrote: > On Mon, Dec 13, 2010 at 12:38 PM, Raimo Niskanen < > raimo+erlang-questions >> wrote: > >> On Sun, Dec 12, 2010 at 09:32:33AM -0800, Zvi wrote: >> > Hi, >> > >> > running new inet:getifaddrs/0 on my Ubuntu machine results in >> > segfault: >> >> Which Ubuntu is it, and what configure flags did you use? > > > Ubuntu 10.04 For what its worth, Ubuntu 10.10, Linux illithid 2.6.35-23-generic #41-Ubuntu SMP Wed Nov 24 11:55:36 UTC 2010 x86_64 GNU/Linux does not. -- J. From timo.lindemann Mon Dec 13 15:46:35 2010 From: timo.lindemann (Timo Lindemann) Date: Mon, 13 Dec 2010 15:46:35 +0100 Subject: [erlang-questions] best practice for calling C from Erlang In-Reply-To: References: Message-ID: Hi, I have made good experiences with the new NIF interface, having hacked an interface to libtidy in one afternoon, and I didn't even know what NIFs were until that morning, so I can definitely say that this is a very easy interface for crossing the boundary quickly. Automatic generation of an interface I don't know much about, I just wanted to chime in to say that NIFs are easy to do, and the wrapper is so thin you might not need to autogenerate it, there's very little boilerplate left to autogenerate. Of course if a NIF gets a SEGV it all crashes (learned that first thing :-) ). It's really straightforward to do if you need it to work quickly. Mine got the job done, but wasn't the best possible implementation, but it was sort of an one-shot thing. Best regards -T. 2010/12/13 Joe Armstrong > What is "best practice for calling C from Erlang" > > I have a C library I want to call from Erlang - nothing complicated. > Mostly the C functions are called with simple types, integers, strings etc. > and the return value is uninteresting. In the case where the return value > is > interesting I mostly require an opaque return value - ie all I might > ever want to do > is re-use it in a subsequent call to a different C routine, so the actual > return > value need never cross the C/Erlang boundary, but could be passed back > and forth > as a reference. > > What is the best (and easiest) way to call this from Erlang. > Is there any program that takes a file containing C type declarations > (either in ANSI C, or as a erlang terms) and automatically builds > the C and Erlang sides of the interface? > > The problem here is not the complexity of an individual > call, but the fact there are a large number of simple and rather > boring functions than must be called. > > I know all about the ports > interface linked-in drivers etc. My question is more to do with > the automatic generation of an interface from some kind of specification. > > /Joe > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > -- Timo Lindemann Software Systems Engineer +49 (0) 160 99 13 06 23 Mon-Thu 0900 - 1700 (GMT +1) SOL VENETUS Software GmbH Seb.-Kneipp-Str. 2, 86482 Aystetten Telefon: +49 (0) 170 77 62 48 0 Telefax: +49 (0) 821 48 65 78 6 Gesch?ftsf?hrer: Benjamin Hilbig Amtsgericht Augsburg, HRB 24559 USt.-IdNr.: DE267014985 From attila.r.nohl Mon Dec 13 15:53:39 2010 From: attila.r.nohl (Attila Rajmund Nohl) Date: Mon, 13 Dec 2010 15:53:39 +0100 Subject: [erlang-questions] best practice for calling C from Erlang In-Reply-To: References: Message-ID: 2010/12/13, Timo Lindemann : > Hi, > > I have made good experiences with the new NIF interface, having hacked an > interface to libtidy in one afternoon, and I didn't even know what NIFs were > until that morning, so I can definitely say that this is a very easy > interface for crossing the boundary quickly. Automatic generation of an > interface I don't know much about, I just wanted to chime in to say that > NIFs are easy to do, and the wrapper is so thin you might not need to > autogenerate it, there's very little boilerplate left to autogenerate. Surely it's not much for one function. But for 125 functions it worth considering generating code... From raimo+erlang-questions Mon Dec 13 15:56:24 2010 From: raimo+erlang-questions (Raimo Niskanen) Date: Mon, 13 Dec 2010 15:56:24 +0100 Subject: [erlang-questions] Speaking of comments In-Reply-To: References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz> <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> <00a601cb96e5\$c12d74d0\$43885e70\$@com> Message-ID: <20101213145624.GA17922@erix.ericsson.se> On Mon, Dec 13, 2010 at 02:04:36PM +0530, Banibrata Dutta wrote: > On Wed, Dec 8, 2010 at 8:45 PM, Edmond Begumisa > wrote: > > > I've thought -- now and then, in the back of my mind -- about removing > > comments from actual source all-together (for all languages) and instead, > > putting them in companion files that the editor lines up side-by-side. More > > like annotating than just traditional commenting. > > > > > It's an interesting thought, as it removes clutter -- especially so for a > programmer who is already well versed with the code. > Most modern editors have features allowing the view to show all comments > collapsed, expanded, and some even done so selectively. > > > > Has this sort of thing been done before? Is there a particular editor that > > can give me this out of the box? (I admittedly haven't explored a large > > number of editors) > > > > Using Erlang as an example, I've secretly wanted something like... > > > > foo.erl > > foo.cts > > Many moons ago at Ericsson there was a hiearchical editor named Exco used. Its concept was that you write your code as a specification where each heading could be expanded into sub-headings, and at the leaf level was the source code. Then you pre-processed your Exco document to extract the leaf level, to compile. While editing you expanded/compressed headlines (highlited) with simple keystrokes. This was in the 24x80 VAX and early Unix days, so side-by-side panels would have been futile, and color coding was green only. It would nevertheless be another possibility for your editor suggestion. Preprocess the readable document to get the source code. You could even use a specialized comment style in .erl files to get a .erl file that displays fine in your special editor yet is readable by itself. > > Challenge would be to ensure 100% (fail-proof) lock-step update of the .erl > and .cts files in VCS... ideally triggered from a single command. > > > > Then an editor that could give me two panes while keeping the two files in > > sync... > > > > foo -> | This function does... > > blah | This part is buggy... > > balh | > > > > Also, in the right pane, I've wanted nestable trees with flexible levels of > > detail. Heck, why not even rich text? "FIX ME" in bold red. Take it further: > > login-name awareness, source-control/bug-tracker integration (this > > programmer said this, that programmer said that.) > > > > It seems a shame that in 2010, it's still so limiting what we can do with > > comments in our source code! > > > > - Edmond - > > > > On Thu, 09 Dec 2010 01:39:42 +1100, David Mercer > > wrote: > > > > On Tuesday, December 07, 2010, Richard O'Keefe wrote: > >> > >> Nesting comments are one of those clever ideas > >>> that turn out to be really dumb, because they don't actually work. > >>> > >> > >> I'll bite, mainly because I've sometimes thought nesting comments would be > >> helpful, for instance, when commenting out large blocks of code, but it is > >> rare that I get to work with a language that supports them. Since you're > >> almost always right about such things, why do you say that they don't > >> actually work? > >> > >> Cheers, > >> > >> David > >> > >> > >> -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From igarai Mon Dec 13 16:08:03 2010 From: igarai (=?UTF-8?B?ScOxYWtpIEdhcmF5?=) Date: Mon, 13 Dec 2010 12:08:03 -0300 Subject: [erlang-questions] Speaking of comments In-Reply-To: <20101213145624.GA17922@erix.ericsson.se> References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz> <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> <00a601cb96e5\$c12d74d0\$43885e70\$@com> <20101213145624.GA17922@erix.ericsson.se> Message-ID: >> On Wed, Dec 8, 2010 at 8:45 PM, Edmond Begumisa > > wrote: >> >> > I've thought -- now and then, in the back of my mind -- about removing >> > comments from actual source all-together (for all languages) and instead, >> > putting them in companion files that the editor lines up side-by-side. More >> > like annotating than just traditional commenting. It was my understanding that this is called literate programming, as envisioned by Knuth, although he includes the comment markup in the same file as the code, and uses a preprocessor to extract either the documentation or the code. Knuth's original program was for C and is called CWEB. A search for 'erlang literate programming' revealed that Joe Armstrong has looked into this at some time [0], but I don't know if it's still active. [0] http://www.sics.se/~joe/ericsson/literate/literate.html cheers, I?aki Garay. From jesper.louis.andersen Mon Dec 13 16:19:05 2010 From: jesper.louis.andersen (Jesper Louis Andersen) Date: Mon, 13 Dec 2010 16:19:05 +0100 Subject: [erlang-questions] Speaking of comments In-Reply-To: References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz> <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> <00a601cb96e5\$c12d74d0\$43885e70\$@com> Message-ID: On Mon, Dec 13, 2010 at 8:19 AM, Edmond Begumisa wrote: > I don't know about using non-ASCII for actual source-code as the author > suggests. I'm not a language designer so I have no opinion this (though in > relation to this, I've sometimes wondered about alternatives to programing > languages revolving around English -- it must really irritate non-English > speakers, especially those coming from languages using non-latin alphabets.) If anyone is serious about moving from a ASCII/UTF8 text representation of programs to something else, *now* is the time to act. One reason I hate Java with a passion is that the language is outright impossible to write in Vim or Emacs. You need IDE integration which severely limits your options. In other words, you are not free to pick your weapon of choice, but must choose something utterly inferior like bent spoon or broken stick. Succinctness is power before it gives you freedom to choose the weapon. However, most of the weapons we use, be it vim or emacs, are rather old and this hampers the format by which they can accept code. The only way to break that problem is the appearance of a disruptive technology which shuns the norm for something new. In this technology you can write a collaborative text editor on the web and hopefully make it as powerful, or more powerful, than emacs or vim. And only then will there be a new weapon to wield - breaking the text-stream input norm of programming languages. And somehow, even with the emerging new devices and systems, I doubt there is a chance it will happen despite. -- J. From masklinn Mon Dec 13 16:32:02 2010 From: masklinn (Masklinn) Date: Mon, 13 Dec 2010 16:32:02 +0100 Subject: [erlang-questions] Speaking of comments In-Reply-To: References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz> <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> <00a601cb96e5\$c12d74d0\$43885e70\$@com> <20101213145624.GA17922@erix.ericsson.se> Message-ID: <2BFD8069-41A9-4688-8CF4-A8938A89F53E@masklinn.net> On 2010-12-13, at 16:08 , I?aki Garay wrote: >>> On Wed, Dec 8, 2010 at 8:45 PM, Edmond Begumisa >>> wrote: >>> >>>> I've thought -- now and then, in the back of my mind -- about removing >>>> comments from actual source all-together (for all languages) and instead, >>>> putting them in companion files that the editor lines up side-by-side. More >>>> like annotating than just traditional commenting. > It was my understanding that this is called literate programming, as > envisioned by Knuth, although he includes the comment markup in the > same file as the code, and uses a preprocessor to extract either the > documentation or the code. > Knuth's original program was for C and is called CWEB. That's exactly the reverse of literate programming: literate programming puts prose first and code second (so instead of marking up the comments, you mark up the code). Knuth's own WEB (and CWEB) is extremely complex (out-of-order with macro expansions and hypertext references) and rather unlike usual program writing, a simpler literate idea can be found in Literate Haskell (lhs) where lines of code are prefixed (with `> `) and everything else is comment, yielding rather interesting executable documents. Python also has something similar (though extremely reduced in scope) in its "doctests": code lines are prefixed with 4 spaces and sequentially executed, everything else is non-executable text. Doctests can be used either in docstrings (documentary comments, providing executable examples in the APIDoc) or as free-standing documents (documentation, papers, etc?). The core idea stays the same: the core idea of literate programming is that the modules are first and foremost used to communicate with humans via prose, and the code is the second-class citizen. As to edmond's idea of having code and comments side-by-side, he might be rather interested in Pycco [0] which produces literate-style documentation. Though it's a generator (it extracts and formats comments within the source file) it does produce something similar to what was described, and it seems to be erlang-compatible. [0] http://fitzgen.github.com/pycco/ From raimo+erlang-questions Mon Dec 13 16:38:07 2010 From: raimo+erlang-questions (Raimo Niskanen) Date: Mon, 13 Dec 2010 16:38:07 +0100 Subject: [erlang-questions] Re: Erlang/OTP R14B01 has been released In-Reply-To: References: <20101213103818.GA11931@erix.ericsson.se> Message-ID: <20101213153807.GB17922@erix.ericsson.se> On Mon, Dec 13, 2010 at 02:17:14PM +0200, Zvi . wrote: > On Mon, Dec 13, 2010 at 12:38 PM, Raimo Niskanen < > raimo+erlang-questions > > wrote: > > > On Sun, Dec 12, 2010 at 09:32:33AM -0800, Zvi wrote: > > > Hi, > > > > > > running new inet:getifaddrs/0 on my Ubuntu machine results in > > > segfault: > > > > Which Ubuntu is it, and what configure flags did you use? > > > Ubuntu 10.04 > > just: > > ./configure > make > sudo make install Interesting... The 10.04 LTS in our lab does not dump core for inet:getifaddrs(). What does this produce for you (mine below, obscured): 1> inet:getiflist(). {ok,["lo","eth0"]} 2> [{If,element(2,inet:ifget(If, [flags,hwaddr,addr,netmask,broadaddr]))}||If<-element(2,inet:getiflist())]. [{"lo", [{flags,[up,loopback,running]}, {hwaddr,[0,0,0,0,0,0]}, {addr,{127,0,0,1}}, {netmask,{255,0,0,0}}, {broadaddr,{0,0,0,0}}]}, {"eth0", [{flags,[up,broadcast,running,multicast]}, {hwaddr,[11,11,11,11,11,11]}, {addr,{111,111,111,111}}, {netmask,{255,255,255,0}}, {broadaddr,{111,111,111,255}}]}] And this (mine below, obscured): \$ ifconfig -a eth0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx inet addr:xxx.xxx.xxx.xxx Bcast:xxx.xxx.xxx.xxx Mask:255.255.255.0 inet6 addr: fec0::xxx:xxxx:xxxx:xxxx/64 Scope:Site inet6 addr: fe80::xxx:xxxx:xxxx:xxxx/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:14963366 errors:0 dropped:0 overruns:0 frame:0 TX packets:9774540 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:7565200376 (7.5 GB) TX bytes:2829650336 (2.8 GB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:791285307 errors:0 dropped:0 overruns:0 frame:0 TX packets:791285307 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:142265685102 (142.2 GB) TX bytes:142265685102 (142.2 GB) \$ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=10.04 DISTRIB_CODENAME=lucid DISTRIB_DESCRIPTION="Ubuntu 10.04 LTS" \$ uname -a # Allthough this was in one of your previous mails Linux halfling 2.6.32-21-generic #32-Ubuntu SMP Fri Apr 16 08:09:38 UTC 2010 x86_64 GNU/Linux -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From wallentin.dahlberg Mon Dec 13 16:52:00 2010 From: wallentin.dahlberg (Wallentin Dahlberg) Date: Mon, 13 Dec 2010 16:52:00 +0100 Subject: [erlang-questions] Re: Erlang/OTP R14B01 has been released In-Reply-To: <20101213153807.GB17922@erix.ericsson.se> References: <20101213103818.GA11931@erix.ericsson.se> <20101213153807.GB17922@erix.ericsson.se> Message-ID: I cannot reproduce this on my gentoo or ubuntu machines either. (Not surprising since that would have halted the daily tests). Zvi (or anyone else that can reproduce this), could you send a stacktrace or a core-file of said segfault? Bj?rn-Egil Erlang/OTP 2010/12/13 Raimo Niskanen > > On Mon, Dec 13, 2010 at 02:17:14PM +0200, Zvi . wrote: > > On Mon, Dec 13, 2010 at 12:38 PM, Raimo Niskanen < > > raimo+erlang-questions > > > > > > wrote: > > > > > On Sun, Dec 12, 2010 at 09:32:33AM -0800, Zvi wrote: > > > > Hi, > > > > > > > > running new inet:getifaddrs/0 on my Ubuntu machine results in > > > > segfault: > > > > > > Which Ubuntu is it, and what configure flags did you use? > > > > > > Ubuntu 10.04 > > > > just: > > > > ./configure > > make > > sudo make install > > Interesting... > The 10.04 LTS in our lab does not dump core for inet:getifaddrs(). > What does this produce for you (mine below, obscured): > 1> inet:getiflist(). > {ok,["lo","eth0"]} > 2> [{If,element(2,inet:ifget(If, > [flags,hwaddr,addr,netmask,broadaddr]))}||If<-element(2,inet:getiflist())]. > [{"lo", > [{flags,[up,loopback,running]}, > {hwaddr,[0,0,0,0,0,0]}, > {addr,{127,0,0,1}}, > {netmask,{255,0,0,0}}, > {broadaddr,{0,0,0,0}}]}, > {"eth0", > [{flags,[up,broadcast,running,multicast]}, > {hwaddr,[11,11,11,11,11,11]}, > {addr,{111,111,111,111}}, > {netmask,{255,255,255,0}}, > {broadaddr,{111,111,111,255}}]}] > > And this (mine below, obscured): > \$ ifconfig -a > eth0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx > inet addr:xxx.xxx.xxx.xxx Bcast:xxx.xxx.xxx.xxx > Mask:255.255.255.0 > inet6 addr: fec0::xxx:xxxx:xxxx:xxxx/64 Scope:Site > inet6 addr: fe80::xxx:xxxx:xxxx:xxxx/64 Scope:Link > UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 > RX packets:14963366 errors:0 dropped:0 overruns:0 frame:0 > TX packets:9774540 errors:0 dropped:0 overruns:0 carrier:0 > collisions:0 txqueuelen:1000 > RX bytes:7565200376 (7.5 GB) TX bytes:2829650336 (2.8 GB) > > lo Link encap:Local Loopback > inet addr:127.0.0.1 Mask:255.0.0.0 > inet6 addr: ::1/128 Scope:Host > UP LOOPBACK RUNNING MTU:16436 Metric:1 > RX packets:791285307 errors:0 dropped:0 overruns:0 frame:0 > TX packets:791285307 errors:0 dropped:0 overruns:0 carrier:0 > collisions:0 txqueuelen:0 > RX bytes:142265685102 (142.2 GB) TX bytes:142265685102 (142.2 GB) > > \$ cat /etc/lsb-release > DISTRIB_ID=Ubuntu > DISTRIB_RELEASE=10.04 > DISTRIB_CODENAME=lucid > DISTRIB_DESCRIPTION="Ubuntu 10.04 LTS" > > \$ uname -a # Allthough this was in one of your previous mails > Linux halfling 2.6.32-21-generic #32-Ubuntu SMP Fri Apr 16 08:09:38 UTC > 2010 x86_64 GNU/Linux > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From robert.virding Mon Dec 13 17:00:41 2010 From: robert.virding (Robert Virding) Date: Mon, 13 Dec 2010 16:00:41 +0000 (GMT) Subject: [erlang-questions] Re: Erlang/OTP R14B01 has been released In-Reply-To: <1648912681.192951292255967162.JavaMail.root@zimbra> Message-ID: <829571504.192971292256041592.JavaMail.root@zimbra> *I* haven't tried them, I was just commenting that both of the examples Zvi showed, inside a fun and directly in the shell, were in fact run in the Erlang interpreter and should give the same results. Robert ----- "Matthias Lang" wrote: > On Monday, December 13, Robert Virding wrote: > > > In neither case are you running the compiler, both are handled by > > the interpreter, erl_eval, so they should behave in the same way. I > > would class this as a bug. > > Interesting! Did you really try on R14B01? I get the same results for > the interpreter and compiler, and I think they're both wrong in the > same way. > > Eshell V5.8.2 (abort with ^G) > 1> c(virding). > {ok,virding} > 2> virding:f(kuku). > <<>> > > ~ >cat virding.erl > -module(virding). > -export([f/1]). > > f(A) -> <>. > > Matt > > > ----- "Zvi" wrote: > > > > > RE: OTP-8865 Code such as foo(A) -> <> would crash the > > > compiler. > > > > > > It seems that compiler will totally ignore type of A in this > case: > > > > > > Eshell V5.8.2 (abort with ^G) > > > 1> F = fun(A) -> <> end. > > > #Fun > > > 2> > > > 2> F(0). > > > <<>> > > > 3> F(1). > > > <<>> > > > 4> F(10000). > > > <<>> > > > 5> F(1.4). > > > <<>> > > > 6> F(add). > > > <<>> > > > 7> F(kuku). > > > <<>> > > > 8> > > > 8> F("adfd"). > > > <<>> > > > 9> > > > 9> F({1,2}). > > > <<>> > > > 10> > > > > > > same for: > > > > > > Eshell V5.8.2 (abort with ^G) > > > 1> > > > 1> > > > 1> A = 0. > > > 0 > > > 2> <>. > > > <<>> > > > 3> > > > 3> <<({1,2,3}):0>>. > > > <<>> > > > 4> <<([1,2,3]):0>>. > > > <<>> > > > 5> <<"hello":0>>. > > > ** exception error: bad argument > > > 6> <<("hello"):0>>. > > > ** exception error: bad argument > > > 7> <<1.6:0>>. > > > <<>> > > > 8> <<(fun()-> ok end):0>>. > > > <<>> > > > 9> <<(self()):0>>. > > > <<>> > > > 1 > > > > > > Zvi > > > On Dec 8, 4:49?pm, Kenneth Lundin > wrote: > > > > Erlang/OTP R14B01 has been released. > > > > > > > > This release is mainly a stabilization of the R14B01 release > (but > > > there are > > > > some new functionality as well). > > > > > > > > You can find the README file for the release at > > > > > > > > http://www.erlang.org/download/otp_src_R14B01.readme > > > > > > > > The source distribution and binary distribution for Windows can > be > > > > downloaded from > > > > > > > > > > > > http://www.erlang.org/download/otp_src_R14B01.tar.gzhttp://www.erlang.org/download/otp_win32_R14B01.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_R14B01.tar.gz.torrenthttp://www.erlang.org/download/otp_win32_R14B01.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_R14B01.tar.gzhttp://www.erlang.org/download/otp_doc_man_R14B01.tar.gz > > > > > > > > We also want to thank those that sent us patches, suggestions > and > > > bug > > > > reports, > > > > > > > > The Erlang/OTP Team > > > > Kenneth Lundin, Erlang/OTP, Ericsson AB > > > > > > > > > ________________________________________________________________ > > > > erlang-questions (at) erlang.org mailing list. > > > > Seehttp://www.erlang.org/faq.html > > > > To unsubscribe; mailto:erlang-questions-unsubscr... > > > > > > ________________________________________________________________ > > > erlang-questions (at) erlang.org mailing list. > > > See http://www.erlang.org/faq.html > > > To unsubscribe; mailto:erlang-questions-unsubscribe > > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > See http://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscribe > > From alexey.v.romanov Mon Dec 13 17:07:54 2010 From: alexey.v.romanov (Alexey Romanov) Date: Mon, 13 Dec 2010 19:07:54 +0300 Subject: [erlang-questions] best practice for calling C from Erlang In-Reply-To: References: Message-ID: Erlang Driver Toolkit (http://www.snookles.com/erlang/edtk/) seems like it should fit the bill, but 1) it accepts bindings description in XML; 2) I don't think it is maintained anymore (though I could be wrong); 3) I haven't used it personally. Yours, Alexey Romanov On Mon, Dec 13, 2010 at 4:37 PM, Joe Armstrong wrote: > What is "best practice for calling C from Erlang" > > I have a C library I want to call from Erlang - nothing complicated. > Mostly the C functions are called with simple types, integers, strings etc. > and the return value is uninteresting. In the case where the return value is > interesting I mostly require an opaque return value - ie all I might > ever want to do > is re-use it in a subsequent call to a different C routine, so the actual return > value need never cross the C/Erlang boundary, but could be passed back > and forth > as a reference. > > What is the best (and easiest) way to call this from Erlang. > Is there any program that takes a file containing C type declarations > (either in ANSI C, or as a erlang terms) and automatically builds > the C and Erlang sides of the interface? > > The problem here is not the complexity of an individual > call, but the fact there are a large number of simple and rather > boring functions than must be called. > > I know all about the ports > interface linked-in drivers etc. My question is more to do with > the automatic generation of an interface from some kind of specification. > > /Joe > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From boris.muehmer Mon Dec 13 17:12:37 2010 From: boris.muehmer (Boris =?ISO-8859-1?Q?M=FChmer?=) Date: Mon, 13 Dec 2010 17:12:37 +0100 Subject: [erlang-questions] Re: Erlang/OTP R14B01 has been released In-Reply-To: References: Message-ID: <1292256757.3178.9.camel@yang> Am Sonntag, den 12.12.2010, 09:32 -0800 schrieb Zvi: > running new inet:getifaddrs/0 on my Ubuntu machine results in > segfault: > > [~]\$ erl > Erlang R14B01 (erts-5.8.2) [source] [smp:2:2] [rq:2] [async-threads:0] > [hipe] [kernel-poll:false] > > Eshell V5.8.2 (abort with ^G) > 1> > 1> inet:getifaddrs(). > Segmentation fault > [~]\$ I am getting this as well. \$ uname -a Linux yang 2.6.35-23-generic #41-Ubuntu SMP Wed Nov 24 11:55:36 UTC 2010 x86_64 GNU/Linux \$ lsb_release -a LSB Version: core-2.0-amd64:core-2.0-noarch:core-3.0-amd64:core-3.0-noarch:core-3.1-amd64:core-3.1-noarch:core-3.2-amd64:core-3.2-noarch:core-4.0-amd64:core-4.0-noarch Distributor ID: Ubuntu Description: Ubuntu 10.10 Release: 10.10 Codename: maverick The output of ifconfig is at the end. It is sort of long. The bridge is used because of KVM. Also I have OpenVPN running (currently only connected to one system, but sometimes I have up to three connections). I don't have any other releases installed. Is this of interest to check this with an older Erlang release or other Ubuntu version as well? - boris === ifconfig output: start === br0 Link encap:Ethernet Hardware Adresse XX:XX:XX:XX:XX:XX inet Adresse:192.168.XXX.XXX Bcast:192.168.XXX.XXX Maske:255.255.255.0 inet6-Adresse: 2001:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX/64 G?ltigkeitsbereich:Global inet6-Adresse: fe80:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX/64 G?ltigkeitsbereich:Verbindung UP BROADCAST RUNNING MULTICAST MTU:1500 Metrik:1 RX packets:2050378 errors:0 dropped:0 overruns:0 frame:0 TX packets:4301295 errors:0 dropped:0 overruns:0 carrier:0 Kollisionen:0 Sendewarteschlangenl?nge:0 RX bytes:1514643982 (1.5 GB) TX bytes:5292048144 (5.2 GB) eth0 Link encap:Ethernet Hardware Adresse XX:XX:XX:XX:XX:XX inet6-Adresse: fe80:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX/64 G?ltigkeitsbereich:Verbindung UP BROADCAST RUNNING MULTICAST MTU:1500 Metrik:1 RX packets:2060182 errors:0 dropped:0 overruns:0 frame:0 TX packets:4301322 errors:0 dropped:0 overruns:0 carrier:0 Kollisionen:0 Sendewarteschlangenl?nge:1000 RX bytes:1544309845 (1.5 GB) TX bytes:5292052727 (5.2 GB) Interrupt:21 Basisadresse:0x2000 lo Link encap:Lokale Schleife inet Adresse:127.0.0.1 Maske:255.0.0.0 inet6-Adresse: ::1/128 G?ltigkeitsbereich:Maschine UP LOOPBACK RUNNING MTU:16436 Metrik:1 RX packets:73 errors:0 dropped:0 overruns:0 frame:0 TX packets:73 errors:0 dropped:0 overruns:0 carrier:0 Kollisionen:0 Sendewarteschlangenl?nge:0 RX bytes:6256 (6.2 KB) TX bytes:6256 (6.2 KB) tun0 Link encap:UNSPEC Hardware Adresse 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 inet Adresse:192.168.XXX.XXX P-z-P:192.168.XXX.XXX Maske:255.255.255.255 UP PUNKTZUPUNKT RUNNING NOARP MULTICAST MTU:1500 Metrik:1 RX packets:2809 errors:0 dropped:0 overruns:0 frame:0 TX packets:2291 errors:0 dropped:0 overruns:0 carrier:0 Kollisionen:0 Sendewarteschlangenl?nge:100 RX bytes:1565968 (1.5 MB) TX bytes:198414 (198.4 KB) virbr0 Link encap:Ethernet Hardware Adresse XX:XX:XX:XX:XX:XX inet Adresse:192.168.XXX.XXX Bcast:192.168.XXX.XXX Maske:255.255.255.0 inet6-Adresse: fe80:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX/64 G?ltigkeitsbereich:Verbindung UP BROADCAST RUNNING MULTICAST MTU:1500 Metrik:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:302 errors:0 dropped:0 overruns:0 carrier:0 Kollisionen:0 Sendewarteschlangenl?nge:0 RX bytes:0 (0.0 B) TX bytes:19529 (19.5 KB) === ifconfig output: end === From ulf.wiger Mon Dec 13 17:20:06 2010 From: ulf.wiger (Ulf Wiger) Date: Mon, 13 Dec 2010 17:20:06 +0100 Subject: [erlang-questions] Speaking of comments In-Reply-To: <2BFD8069-41A9-4688-8CF4-A8938A89F53E@masklinn.net> References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz> <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> <00a601cb96e5\$c12d74d0\$43885e70\$@com> <20101213145624.GA17922@erix.ericsson.se> <2BFD8069-41A9-4688-8CF4-A8938A89F53E@masklinn.net> Message-ID: <3EA0B90D-7320-42C7-823C-BF82EF31EAF2@erlang-solutions.com> On 13 Dec 2010, at 16:32, Masklinn wrote: > Knuth's own WEB (and CWEB) is extremely complex (out-of-order with macro expansions and hypertext references) and rather unlike usual program writing, a simpler literate idea can be found in Literate Haskell (lhs) where lines of code are prefixed (with `> `) and everything else is comment, yielding rather interesting executable documents. > > Python also has something similar (though extremely reduced in scope) in its "doctests": code lines are prefixed with 4 spaces and sequentially executed, everything else is non-executable text. Doctests can be used either in docstrings (documentary comments, providing executable examples in the APIDoc) or as free-standing documents (documentation, papers, etc?). http://github.com/uwiger/erl2latex was inspired by a script John Hughes used to convert erlang source to PDF via LaTEX. Some form of documentation, eating my own dog food, can be found in: https://github.com/uwiger/erl2latex/raw/master/doc/erl2latex.pdf It got a bit more complex than I had originally intended, since I wanted it to do a fair job on legacy code. This introduced all sorts of escaping issues. It was really interesting to work with this, since I noticed that it changes the way you look at your code - the code really becomes (part of) the documentation. I'm not going to claim that the above document illustrates that. I quit working on the code at some point, as I got distracted by other things. But I remember the feeling, and I've been missing it since then. If I may quote Joe, he wrote this after trying it: "I like it *very much* It's strange, I've tried edoc (didn't like it - the output is ugly) - I wrote my own literate programming system (never used it much - the code is weirdly ordered) Used a full book markup system (for the prag book) - overkill for module documentation. Somehow erl2latex strikes the right balance between effort and result - small effort nice result. (edoc = big effort, no benefit) (book production system, big effort, big benefit) ? ... Actually I like this so much I think I'll be using it a lot ?" I don't know if he actually did, but it was a nice thing to say. :) BR, Ulf W Ulf Wiger, CTO, Erlang Solutions, Ltd. http://erlang-solutions.com From tony.arcieri Mon Dec 13 17:31:47 2010 From: tony.arcieri (Tony Arcieri) Date: Mon, 13 Dec 2010 09:31:47 -0700 Subject: [erlang-questions] Speaking of comments In-Reply-To: References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz> <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> <00a601cb96e5\$c12d74d0\$43885e70\$@com> Message-ID: On Wed, Dec 8, 2010 at 8:15 AM, Edmond Begumisa wrote: > I've thought -- now and then, in the back of my mind -- about removing > comments from actual source all-together (for all languages) and instead, > putting them in companion files that the editor lines up side-by-side. More > like annotating than just traditional commenting. You mean like this? http://jashkenas.github.com/docco/ -- Tony Arcieri Medioh! Kudelski From alessandro.sivieri Mon Dec 13 17:32:45 2010 From: alessandro.sivieri (Alessandro Sivieri) Date: Mon, 13 Dec 2010 17:32:45 +0100 Subject: Dict performances Message-ID: Hi all, I'm using a dictionary for saving some values, using UUID (string format) as key and process id as value; I was wondering how are the dict performances in lookup when it contains thousands of values, especially using a string as key. I have searched for the same topic, but the results are quite old... -- Sivieri Alessandro alessandro.sivieri http://www.chimera-bellerofonte.eu/ http://www.poul.org/ From raimo+erlang-questions Mon Dec 13 17:40:26 2010 From: raimo+erlang-questions (Raimo Niskanen) Date: Mon, 13 Dec 2010 17:40:26 +0100 Subject: [erlang-questions] Re: Erlang/OTP R14B01 has been released In-Reply-To: <1292256757.3178.9.camel@yang> References: <1292256757.3178.9.camel@yang> Message-ID: <20101213164026.GA20533@erix.ericsson.se> On Mon, Dec 13, 2010 at 05:12:37PM +0100, Boris M?hmer wrote: > Am Sonntag, den 12.12.2010, 09:32 -0800 schrieb Zvi: > > running new inet:getifaddrs/0 on my Ubuntu machine results in > > segfault: > > > > [~]\$ erl > > Erlang R14B01 (erts-5.8.2) [source] [smp:2:2] [rq:2] [async-threads:0] > > [hipe] [kernel-poll:false] > > > > Eshell V5.8.2 (abort with ^G) > > 1> > > 1> inet:getifaddrs(). > > Segmentation fault > > [~]\$ > > I am getting this as well. > > \$ uname -a > Linux yang 2.6.35-23-generic #41-Ubuntu SMP Wed Nov 24 11:55:36 UTC 2010 > x86_64 GNU/Linux > > \$ lsb_release -a > LSB Version: > core-2.0-amd64:core-2.0-noarch:core-3.0-amd64:core-3.0-noarch:core-3.1-amd64:core-3.1-noarch:core-3.2-amd64:core-3.2-noarch:core-4.0-amd64:core-4.0-noarch > Distributor ID: Ubuntu > Description: Ubuntu 10.10 > Release: 10.10 > Codename: maverick > > The output of ifconfig is at the end. It is sort of long. > The bridge is used because of KVM. Also I have OpenVPN > running (currently only connected to one system, but > sometimes I have up to three connections). > > I don't have any other releases installed. Is this of interest > to check this with an older Erlang release or other Ubuntu > version as well? The main suspect right now is that the code in inet_drv.c parsing the return data from getifaddrs() gets lost in some peculiar data. Can you get us a stack backtrace something like this (ulimit -c before, gdb Pgm core after, use gdb command "bt"): [~]\$ ulimit -c unlimited [~]\$ erl Erlang R14B01 (erts-5.8.2) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.8.2 (abort with ^G) 1> 1> inet:getifaddrs(). Segmentation fault [~]\$ gdb lib/erlang/erts-5.8.2/bin/beam.smp core GNU gdb (GDB) 7.1-ubuntu Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". For bug reporting instructions, please see: ... Reading symbols from /ldisk/daily_build/r14b02_opu_o.2010-12-12_20/otp/lib/erlang/erts-5.8.3/bin/beam.smp...done. : : : Core was generated by `/ldisk/daily_build/r14b02_opu_o.2010-12-12_20/otp/lib/erlang/erts-5.8.3/bin/bea'. Program terminated with signal 11, Segmentation fault. #0 heap_dump (to=3, to_arg=0x0, x=2956610204) at beam/erl_process_dump.c:393 (gdb) bt #0 heap_dump (to=3, to_arg=0x0, x=2956610204) at beam/erl_process_dump.c:393 #1 0x00000000004f859a in dump_process_info (to=3, to_arg=0x0) at beam/erl_process_dump.c:125 #2 erts_deep_process_dump (to=3, to_arg=0x0) at beam/erl_process_dump.c:73 #3 0x00000000004e2adf in erl_crash_dump_v (file=0x40000
, line=0, fmt=0x400
, args=0x7f49b03a5be0) at beam/break.c:712 #4 0x0000000000444fa2 in erl_exit (n=127, fmt=0x584434 "%s\n") at beam/erl_init.c:1594 #5 0x0000000000472ce9 in halt_1 (A__p=0x1837cc0, A_1=21029029) at beam/bif.c:3423 #6 0x000000000051dedc in process_main () at beam/beam_emu.c:3351 #7 0x0000000000491fac in sched_thread_func (vesdp=) at beam/erl_process.c:3566 #8 0x000000000057d83a in thr_wrapper (vtwd=) at pthread/ethread.c:106 #9 0x00007f49b19399ca in start_thread () from /lib/libpthread.so.0 #10 0x00007f49b148f69d in clone () from /lib/libc.so.6 #11 0x0000000000000000 in ?? () And then, for the most suspicious stack frame: (gdb) fr 1 #1 0x00000000004f859a in dump_process_info (to=3, to_arg=0x0) at beam/erl_process_dump.c:125 125 heap_dump(to, to_arg, term); (gdb) l 120 erts_print(to, to_arg, "=proc_heap:%T\n", p->id); 121 for (sp = p->stop; sp < STACK_START(p); sp++) { 122 Eterm term = *sp; 123 124 if (!is_catch(term) && !is_CP(term)) { 125 heap_dump(to, to_arg, term); 126 } 127 } 128 for (mp = p->msg.first; mp != NULL; mp = mp->next) { 129 Eterm mesg = ERL_MESSAGE_TERM(mp); (gdb) p to \$1 = (gdb) p to_arg \$2 = (gdb) p term \$3 = 0 Variable "term" is NULL, that is suspicious. > > > - boris > > > === ifconfig output: start === > br0 Link encap:Ethernet Hardware Adresse XX:XX:XX:XX:XX:XX > inet Adresse:192.168.XXX.XXX Bcast:192.168.XXX.XXX Maske:255.255.255.0 > inet6-Adresse: 2001:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX/64 G?ltigkeitsbereich:Global > inet6-Adresse: fe80:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX/64 G?ltigkeitsbereich:Verbindung > UP BROADCAST RUNNING MULTICAST MTU:1500 Metrik:1 > RX packets:2050378 errors:0 dropped:0 overruns:0 frame:0 > TX packets:4301295 errors:0 dropped:0 overruns:0 carrier:0 > Kollisionen:0 Sendewarteschlangenl?nge:0 > RX bytes:1514643982 (1.5 GB) TX bytes:5292048144 (5.2 GB) > > eth0 Link encap:Ethernet Hardware Adresse XX:XX:XX:XX:XX:XX > inet6-Adresse: fe80:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX/64 G?ltigkeitsbereich:Verbindung > UP BROADCAST RUNNING MULTICAST MTU:1500 Metrik:1 > RX packets:2060182 errors:0 dropped:0 overruns:0 frame:0 > TX packets:4301322 errors:0 dropped:0 overruns:0 carrier:0 > Kollisionen:0 Sendewarteschlangenl?nge:1000 > RX bytes:1544309845 (1.5 GB) TX bytes:5292052727 (5.2 GB) > Interrupt:21 Basisadresse:0x2000 > > lo Link encap:Lokale Schleife > inet Adresse:127.0.0.1 Maske:255.0.0.0 > inet6-Adresse: ::1/128 G?ltigkeitsbereich:Maschine > UP LOOPBACK RUNNING MTU:16436 Metrik:1 > RX packets:73 errors:0 dropped:0 overruns:0 frame:0 > TX packets:73 errors:0 dropped:0 overruns:0 carrier:0 > Kollisionen:0 Sendewarteschlangenl?nge:0 > RX bytes:6256 (6.2 KB) TX bytes:6256 (6.2 KB) > > tun0 Link encap:UNSPEC Hardware Adresse 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 > inet Adresse:192.168.XXX.XXX P-z-P:192.168.XXX.XXX Maske:255.255.255.255 > UP PUNKTZUPUNKT RUNNING NOARP MULTICAST MTU:1500 Metrik:1 > RX packets:2809 errors:0 dropped:0 overruns:0 frame:0 > TX packets:2291 errors:0 dropped:0 overruns:0 carrier:0 > Kollisionen:0 Sendewarteschlangenl?nge:100 > RX bytes:1565968 (1.5 MB) TX bytes:198414 (198.4 KB) > > virbr0 Link encap:Ethernet Hardware Adresse XX:XX:XX:XX:XX:XX > inet Adresse:192.168.XXX.XXX Bcast:192.168.XXX.XXX Maske:255.255.255.0 > inet6-Adresse: fe80:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX/64 G?ltigkeitsbereich:Verbindung > UP BROADCAST RUNNING MULTICAST MTU:1500 Metrik:1 > RX packets:0 errors:0 dropped:0 overruns:0 frame:0 > TX packets:302 errors:0 dropped:0 overruns:0 carrier:0 > Kollisionen:0 Sendewarteschlangenl?nge:0 > RX bytes:0 (0.0 B) TX bytes:19529 (19.5 KB) > === ifconfig output: end === > > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From ngreco Mon Dec 13 18:56:33 2010 From: ngreco (Nahuel Greco) Date: Mon, 13 Dec 2010 14:56:33 -0300 Subject: [erlang-questions] Speaking of comments In-Reply-To: References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz> <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> <00a601cb96e5\$c12d74d0\$43885e70\$@com> Message-ID: You guys need to take a look to the image-based Smalltalk philosophy. On 12/13/10, Tony Arcieri wrote: > On Wed, Dec 8, 2010 at 8:15 AM, Edmond Begumisa > wrote: > >> I've thought -- now and then, in the back of my mind -- about removing >> comments from actual source all-together (for all languages) and instead, >> putting them in companion files that the editor lines up side-by-side. >> More >> like annotating than just traditional commenting. > > > You mean like this? > > http://jashkenas.github.com/docco/ > > -- > Tony Arcieri > Medioh! Kudelski > -- Sent from my mobile device Saludos, Nahuel Greco. From boris.muehmer Mon Dec 13 19:49:20 2010 From: boris.muehmer (Boris =?ISO-8859-1?Q?M=FChmer?=) Date: Mon, 13 Dec 2010 19:49:20 +0100 Subject: [erlang-questions] Re: Erlang/OTP R14B01 has been released In-Reply-To: <20101213164026.GA20533@erix.ericsson.se> References: <1292256757.3178.9.camel@yang> <20101213164026.GA20533@erix.ericsson.se> Message-ID: <1292266160.2504.94.camel@yang> Here is my output from the gdb session (after "inet:getifaddrs()."): \$ gdb /opt/erlang-otp/lib/erlang/erts-5.8.2/bin/beam.smp core GNU gdb (GDB) 7.2-ubuntu Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". For bug reporting instructions, please see: ... Reading symbols from /opt/Erlang-Dists/otp_R14B01/lib/erlang/erts-5.8.2/bin/beam.smp...done. [New Thread 2705] [New Thread 2697] [New Thread 2702] [New Thread 2703] [New Thread 2701] [New Thread 2704] [New Thread 2706] warning: Can't read pathname for load map: Input/output error. Reading symbols from /lib/libutil.so.1...(no debugging symbols found)...done. Loaded symbols for /lib/libutil.so.1 Reading symbols from /lib/libdl.so.2...(no debugging symbols found)...done. Loaded symbols for /lib/libdl.so.2 Reading symbols from /lib/libm.so.6...(no debugging symbols found)...done. Loaded symbols for /lib/libm.so.6 Reading symbols from /lib/libncurses.so.5...(no debugging symbols found)...done. Loaded symbols for /lib/libncurses.so.5 Reading symbols from /lib/libpthread.so.0...(no debugging symbols found)...done. Loaded symbols for /lib/libpthread.so.0 Reading symbols from /lib/librt.so.1...(no debugging symbols found)...done. Loaded symbols for /lib/librt.so.1 Reading symbols from /lib/libc.so.6...(no debugging symbols found)...done. Loaded symbols for /lib/libc.so.6 Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done. Loaded symbols for /lib64/ld-linux-x86-64.so.2 Core was generated by `/opt/erlang-otp/lib/erlang/erts-5.8.2/bin/beam.smp -- -root /opt/erlang-otp/lib'. Program terminated with signal 11, Segmentation fault. #0 0x0000000000577ba2 in inet_ctl_getifaddrs (desc=, cmd=, buf=, len=0, rbuf=, rsize=) at drivers/common/inet_drv.c:4948 4948 if (ifa_p->ifa_addr->sa_family == AF_INET (gdb) bt #0 0x0000000000577ba2 in inet_ctl_getifaddrs (desc=, cmd=, buf=, len=0, rbuf=, rsize=) at drivers/common/inet_drv.c:4948 #1 inet_ctl (desc=, cmd=, buf=, len=0, rbuf=, rsize=) at drivers/common/inet_drv.c:7272 #2 0x0000000000579539 in packet_inet_ctl (e=0x15faa80, cmd=1, buf=0x0, len=0, rbuf=0x7fb7cdc27c58, rsize=16) at drivers/common/inet_drv.c:9741 #3 0x000000000048dda2 in erts_port_control (p=0x7fb7cdc9e810, prt=0x7fb7cdc69958, command=, iolist=) at beam/io.c:2219 #4 0x00000000004fe7e3 in port_control_3 (A__p=0x7fb7cdc9e810, A_1=, A_2=, A_3=18446744073709551611) at beam/erl_bif_port.c:455 #5 0x000000000052a853 in process_main () at beam/beam_emu.c:2277 #6 0x000000000049da93 in sched_thread_func (vesdp=) at beam/erl_process.c:3566 #7 0x00000000005a465a in thr_wrapper (vtwd=) at pthread/ethread.c:106 #8 0x00007fb7cf4bf971 in start_thread () from /lib/libpthread.so.0 #9 0x00007fb7cf01394d in clone () from /lib/libc.so.6 #10 0x0000000000000000 in ?? () (gdb) fr 1 #1 inet_ctl (desc=, cmd=, buf=, len=0, rbuf=, rsize=) at drivers/common/inet_drv.c:7272 7272 return inet_ctl_getifaddrs(desc, rbuf, rsize); (gdb) l 7267 7268 case INET_REQ_GETIFADDRS: { 7269 DEBUGF(("inet_ctl(%ld): GETIFADDRS\r\n", (long)desc->port)); 7270 if (!IS_OPEN(desc)) 7271 return ctl_xerror(EXBADPORT, rbuf, rsize); 7272 return inet_ctl_getifaddrs(desc, rbuf, rsize); 7273 } 7274 7275 case INET_REQ_IFGET: { 7276 DEBUGF(("inet_ctl(%ld): IFGET\r\n", (long)desc->port)); (gdb) p desc \$1 = (gdb) p cmd \$2 = (gdb) p buf \$3 = (gdb) p len \$4 = 0 (gdb) p rbuf \$5 = (gdb) p rsize \$6 = Anything else I could do? - boris From zvi.avraham Mon Dec 13 19:55:54 2010 From: zvi.avraham (Zvi .) Date: Mon, 13 Dec 2010 20:55:54 +0200 Subject: [erlang-questions] Re: Erlang/OTP R14B01 has been released In-Reply-To: <20101213103818.GA11931@erix.ericsson.se> References: <20101213103818.GA11931@erix.ericsson.se> Message-ID: When I'm offline it works: [~]\$ erl Erlang R14B01 (erts-5.8.2) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.8.2 (abort with ^G) 1> inet:getifaddrs(). {ok,[{"lo", [{flags,[up,loopback,running]}, {hwaddr,[0,0,0,0,0,0]}, {addr,{127,0,0,1}}, {netmask,{255,0,0,0}}, {addr,{0,0,0,0,0,0,0,1}}, {netmask,{65535,65535,65535,65535,65535,65535,65535, 65535}}]}, {"eth1", [{flags,[up,broadcast,running,multicast]}, {hwaddr,[0,36,XX,XX,XX,XX]}]}, {"wlan1", [{flags,[broadcast,multicast]}, {hwaddr,[0,33,XX,XX,XX,XX]}]}]} 2> [~]\$ ifconfig eth1 Link encap:Ethernet HWaddr 00:24:XX:XX:XX:XX UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) Memory:f6fe0000-f7000000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:3718 errors:0 dropped:0 overruns:0 frame:0 TX packets:3718 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:282439 (282.4 KB) TX bytes:282439 (282.4 KB) It only happens when I'm online with wireless modem on my laptop: [~]\$ erl Erlang R14B01 (erts-5.8.2) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.8.2 (abort with ^G) 1> inet:getifaddrs(). Segmentation fault [~]\$ [~]\$ ifconfig eth1 Link encap:Ethernet HWaddr 00:24:XX:XX:XX:XX UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) Memory:f6fe0000-f7000000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:4336 errors:0 dropped:0 overruns:0 frame:0 TX packets:4336 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:330061 (330.0 KB) TX bytes:330061 (330.0 KB) ppp0 Link encap:Point-to-Point Protocol inet addr:95.XX.XXX.XXX P-t-P:10.64.64.64 Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1 RX packets:18 errors:2 dropped:0 overruns:0 frame:0 TX packets:23 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:3 RX bytes:3705 (3.7 KB) TX bytes:5864 (5.8 KB) Hope this helps, Zvi On Mon, Dec 13, 2010 at 12:38 PM, Raimo Niskanen < raimo+erlang-questions > wrote: > On Sun, Dec 12, 2010 at 09:32:33AM -0800, Zvi wrote: > > Hi, > > > > running new inet:getifaddrs/0 on my Ubuntu machine results in > > segfault: > > Which Ubuntu is it, and what configure flags did you use? > > > > > [~]\$ erl > > Erlang R14B01 (erts-5.8.2) [source] [smp:2:2] [rq:2] [async-threads:0] > > [hipe] [kernel-poll:false] > > > > Eshell V5.8.2 (abort with ^G) > > 1> > > 1> inet:getifaddrs(). > > Segmentation fault > > [~]\$ > > > > [~]\$ uname -a > > Linux XXXXXXX 2.6.32-26-generic-pae #48-Ubuntu SMP Wed Nov 24 10:31:20 > > UTC 2010 i686 GNU/Linux > > > > Zvi > > > > On Dec 8, 4:49 pm, Kenneth Lundin wrote: > > > Erlang/OTP R14B01 has been released. > > > > > > This release is mainly a stabilization of the R14B01 release (but there > are > > > some new functionality as well). > > > > > > You can find the README file for the release at > > > > > > http://www.erlang.org/download/otp_src_R14B01.readme > > > > > > The source distribution and binary distribution for Windows can be > > > downloaded from > > > > > > > http://www.erlang.org/download/otp_src_R14B01.tar.gzhttp://www.erlang.org/download/otp_win32_R14B01.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_R14B01.tar.gz.torrenthttp://www.erlang.org/download/otp_win32_R14B01.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_R14B01.tar.gzhttp://www.erlang.org/download/otp_doc_man_R14B01.tar.gz > > > > > > We also want to thank those that sent us patches, suggestions and bug > > > reports, > > > > > > The Erlang/OTP Team > > > Kenneth Lundin, Erlang/OTP, Ericsson AB > > > > > > ________________________________________________________________ > > > erlang-questions (at) erlang.org mailing list. > > > Seehttp://www.erlang.org/faq.html > > > To unsubscribe; mailto:erlang-questions-unsubscr... > > > > ________________________________________________________________ > > erlang-questions (at) erlang.org mailing list. > > See http://www.erlang.org/faq.html > > To unsubscribe; mailto:erlang-questions-unsubscribe > > > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > From vances Mon Dec 13 20:47:27 2010 From: vances (Vance Shipley) Date: Mon, 13 Dec 2010 14:47:27 -0500 Subject: Erlang Start-Up File (.erlang) Message-ID: <20101213194727.GB41563@h216-235-12-173.host.egate.net> I have looked high and low but can no longer find anywhere where the start-up file .erlang is documented. It used to be in the Getting Started with Erlang User's Guide but does not seem to be there now. -- -Vance From erlang Mon Dec 13 20:56:47 2010 From: erlang (Joe Armstrong) Date: Mon, 13 Dec 2010 20:56:47 +0100 Subject: [erlang-questions] Speaking of comments In-Reply-To: <3EA0B90D-7320-42C7-823C-BF82EF31EAF2@erlang-solutions.com> References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz> <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> <00a601cb96e5\$c12d74d0\$43885e70\$@com> <20101213145624.GA17922@erix.ericsson.se> <2BFD8069-41A9-4688-8CF4-A8938A89F53E@masklinn.net> <3EA0B90D-7320-42C7-823C-BF82EF31EAF2@erlang-solutions.com> Message-ID: 2010/12/13 Ulf Wiger : > > On 13 Dec 2010, at 16:32, Masklinn wrote: > >> Knuth's own WEB (and CWEB) is extremely complex (out-of-order with macro expansions and hypertext references) and rather unlike usual program writing, a simpler literate idea can be found in Literate Haskell (lhs) where lines of code are prefixed (with `> `) and everything else is comment, yielding rather interesting executable documents. >> >> Python also has something similar (though extremely reduced in scope) in its "doctests": code lines are prefixed with 4 spaces and sequentially executed, everything else is non-executable text. Doctests can be used either in docstrings (documentary comments, providing executable examples in the APIDoc) or as free-standing documents (documentation, papers, etc?). > > > http://github.com/uwiger/erl2latex was inspired by a script John Hughes > used to convert erlang source to PDF via LaTEX. > > Some form of documentation, eating my own dog food, can be found in: > https://github.com/uwiger/erl2latex/raw/master/doc/erl2latex.pdf > > It got a bit more complex than I had originally intended, since I wanted it > to do a fair job on legacy code. This introduced all sorts of escaping issues. > > It was really interesting to work with this, since I noticed that it changes the > way you look at your code - the code really becomes (part of) the documentation. > > I'm not going to claim that the above document illustrates that. I quit working > on the code at some point, as I got distracted by other things. But I remember > the feeling, and I've been missing it since then. > > If I may quote Joe, he wrote this after trying it: > > "I like it *very much* It's strange, I've tried edoc (didn't like it - the output > is ugly) - I wrote my own literate programming system (never used it much - > the code is weirdly ordered) > > Used a full book markup system (for the prag book) - overkill for module > documentation. > > Somehow erl2latex strikes the right balance between effort and result - > small effort nice result. (edoc = big effort, no benefit) (book production > system, big effort, big benefit) ? > ... > Actually I like this so much I think I'll be using it a lot ?" > > I don't know if he actually did, but it was a nice thing to say. :) I've changed my mind (again) - what I currently like best is to invent a specific xml markup for each documentation task then convert the xml to PDF using apache fop, or html using xslt. Wiki text/edoc etc. are just toooo simplistic. I now like xslt-fo more than LaTeX (since the input has a proper parser tree and can be transformed) - apache fop has a few warts though - time to hack on erlguten a bit more :-) /Joe > > BR, > Ulf W > > Ulf Wiger, CTO, Erlang Solutions, Ltd. > http://erlang-solutions.com > > > > From masklinn Mon Dec 13 21:07:02 2010 From: masklinn (Masklinn) Date: Mon, 13 Dec 2010 21:07:02 +0100 Subject: [erlang-questions] Speaking of comments In-Reply-To: References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz> <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> <00a601cb96e5\$c12d74d0\$43885e70\$@com> <20101213145624.GA17922@erix.ericsson.se> <2BFD8069-41A9-4688-8CF4-A8938A89F53E@masklinn.net> <3EA0B90D-7320-42C7-823C-BF82EF31EAF2@erlang-solutions.com> Message-ID: On 2010-12-13, at 20:56 , Joe Armstrong wrote: > > Wiki text/edoc etc. are just toooo simplistic. I now like xslt-fo more > than LaTeX Have you ever looked at Python's ReStructuredText, and Sphinx? XML markup and transformers tends to have far too much noise for my tastes, and the un-transformed source code is pretty much unreadable. I find that RST strikes a pretty good balance between readability and writability on one hand (it's a lightweight markup language akin to Markdown) and extensibility on the other hand (via custom directives). From boris.muehmer Mon Dec 13 21:38:14 2010 From: boris.muehmer (Boris =?ISO-8859-1?Q?M=FChmer?=) Date: Mon, 13 Dec 2010 21:38:14 +0100 Subject: [erlang-questions] Re: Erlang/OTP R14B01 has been released In-Reply-To: <1292266160.2504.94.camel@yang> References: <1292256757.3178.9.camel@yang> <20101213164026.GA20533@erix.ericsson.se> <1292266160.2504.94.camel@yang> Message-ID: <1292272694.2504.154.camel@yang> Am Montag, den 13.12.2010, 19:49 +0100 schrieb Boris M?hmer: > Core was generated by `/opt/erlang-otp/lib/erlang/erts-5.8.2/bin/beam.smp -- -root /opt/erlang-otp/lib'. > Program terminated with signal 11, Segmentation fault. > #0 0x0000000000577ba2 in inet_ctl_getifaddrs (desc=, cmd=, > buf=, len=0, rbuf=, rsize=) > at drivers/common/inet_drv.c:4948 > 4948 if (ifa_p->ifa_addr->sa_family == AF_INET I checked one more thing: (gdb) l 4943 utf8_encode(ifa_p->ifa_name, -1, buf_p); 4944 buf_p += len; 4945 *buf_p++ = '\0'; 4946 *buf_p++ = INET_IFOPT_FLAGS; 4947 put_int32(IFGET_FLAGS(ifa_p->ifa_flags), buf_p); buf_p += 4; 4948 if (ifa_p->ifa_addr->sa_family == AF_INET 4949 #if defined(AF_INET6) 4950 || ifa_p->ifa_addr->sa_family == AF_INET6 4951 #endif 4952 ) { (gdb) p ifa_p \$1 = (struct ifaddrs *) 0x2853d20 (gdb) p ifa_p->ifa_addr \$2 = (struct sockaddr *) 0x0 Hmmm... well, then statement if (ifa_p->ifa_addr->sa_family == AF_INET will "of course" fail. The "offending" device is: (gdb) p ifa_p->ifa_name \$7 = 0x2853dc4 "tun0" The "OpenVPN" device. - boris From freza Mon Dec 13 22:16:33 2010 From: freza (Jachym Holecek) Date: Mon, 13 Dec 2010 21:16:33 +0000 Subject: [erlang-questions] best practice for calling C from Erlang In-Reply-To: References: Message-ID: <20101213211633.GA1635@hanele.lan> # Attila Rajmund Nohl 2010-12-13: > 2010/12/13, Timo Lindemann : > > Hi, > > > > I have made good experiences with the new NIF interface, having hacked an > > interface to libtidy in one afternoon, and I didn't even know what NIFs were > > until that morning, so I can definitely say that this is a very easy > > interface for crossing the boundary quickly. Automatic generation of an > > interface I don't know much about, I just wanted to chime in to say that > > NIFs are easy to do, and the wrapper is so thin you might not need to > > autogenerate it, there's very little boilerplate left to autogenerate. > > Surely it's not much for one function. But for 125 functions it worth > considering generating code... BTW In complex cases, 'clang -fsyntax-only -Xclang -ast-print-xml -o a.xml a.c' comes in handy -- gives you straightforward XML description[*] of C APIs... Regards, -- Jachym [*] I mean straightforward after erlsom:simple_form/1 of course. From mbj Mon Dec 13 22:19:16 2010 From: mbj (Martin Bjorklund) Date: Mon, 13 Dec 2010 22:19:16 +0100 (CET) Subject: [erlang-questions] is the SMALL_MEMORY define deprecated? (no) Why is it only used for VxWorks? In-Reply-To: <20101213114947.GA8847@corelatus.se> References: <20101213114947.GA8847@corelatus.se> Message-ID: <20101213.221916.125360453.mbj@tail-f.com> Hi, Matthias Lang wrote: > I noticed the 'SMALL_MEMORY' define in the emulator source. It's only > ever enabled for vxworks, in sys/vxworks/erl_vxworks_sys.h. > > Question 1: is SMALL_MEMORY deprecated? (it's not documented anywhere) I don't think it has ever been documented. > Question 3: is anyone else using that define on a non-VxWorks system? Yes, we have been using it for the last 5 years on R10, R13, and now on R14. IIRC it was actually you who mentioned it to me... /martin From alain.odea Mon Dec 13 22:37:18 2010 From: alain.odea (Alain O'Dea) Date: Mon, 13 Dec 2010 18:07:18 -0330 Subject: [erlang-questions] Dict performances In-Reply-To: References: Message-ID: http://www.erlang.org/pipermail/erlang-questions/2000-December/002344.html On Monday, December 13, 2010, Alessandro Sivieri wrote: > Hi all, > > I'm using a dictionary for saving some values, using UUID (string format) as > key and process id as value; I was wondering how are the dict performances > in lookup when it contains thousands of values, especially using a string as > key. I have searched for the same topic, but the results are quite old... > > -- > Sivieri Alessandro > alessandro.sivieri > http://www.chimera-bellerofonte.eu/ > http://www.poul.org/ > From alain.odea Mon Dec 13 22:49:40 2010 From: alain.odea (Alain O'Dea) Date: Mon, 13 Dec 2010 18:19:40 -0330 Subject: [erlang-questions] Dict performances In-Reply-To: References: Message-ID: It's unlikely to have changed much. You'd need to cross-reference the history of dict.erl: https://github.com/erlang/otp/commits/dev/lib/stdlib/src/dict.erl It hasn't changed since OTP was put on GitHub, but that was pretty recent and it would interesting to see changes prior to that. I suggest benchmarking your usage against ets and gb_trees. timer:tc is good for this: http://www.erlang.org/doc/man/timer.html A possibly awful example of using timer:tc for logarithmic benchmarking: http://concise-software.blogspot.com/2010/03/is-this-stupid-drop-last-element-of.html On Monday, December 13, 2010, Alain O'Dea wrote: > http://www.erlang.org/pipermail/erlang-questions/2000-December/002344.html > > On Monday, December 13, 2010, Alessandro Sivieri > wrote: >> Hi all, >> >> I'm using a dictionary for saving some values, using UUID (string format) as >> key and process id as value; I was wondering how are the dict performances >> in lookup when it contains thousands of values, especially using a string as >> key. I have searched for the same topic, but the results are quite old... >> >> -- >> Sivieri Alessandro >> alessandro.sivieri >> http://www.chimera-bellerofonte.eu/ >> http://www.poul.org/ >> > From alain.odea Mon Dec 13 22:54:54 2010 From: alain.odea (Alain O'Dea) Date: Mon, 13 Dec 2010 18:24:54 -0330 Subject: [erlang-questions] Speaking of comments In-Reply-To: References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz> <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> <00a601cb96e5\$c12d74d0\$43885e70\$@com> <20101213145624.GA17922@erix.ericsson.se> <2BFD8069-41A9-4688-8CF4-A8938A89F53E@masklinn.net> <3EA0B90D-7320-42C7-823C-BF82EF31EAF2@erlang-solutions.com> Message-ID: GitHub die this beautifully without any language specific requirements. Check out https://github.com/AlainODea/simple_cache/commit/0a85f413a85ea589d612c2ab0853ac932626f3a1 to see how I used Otto annotate the interesting bits of a commit I made. If these GitHub annotations are available in the REST API it would make for a powerful editor/IDE enhancement. On Monday, December 13, 2010, Masklinn wrote: > On 2010-12-13, at 20:56 , Joe Armstrong wrote: >> >> Wiki text/edoc etc. are just toooo simplistic. I now like xslt-fo more >> than LaTeX > Have you ever looked at Python's ReStructuredText, and Sphinx? XML markup and transformers tends to have far too much noise for my tastes, and the un-transformed source code is pretty much unreadable. I find that RST strikes a pretty good balance between readability and writability on one hand (it's a lightweight markup language akin to Markdown) and extensibility on the other hand (via custom directives). > > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > > From ok Mon Dec 13 23:45:18 2010 From: ok (Richard O'Keefe) Date: Tue, 14 Dec 2010 11:45:18 +1300 Subject: Speaking of comments In-Reply-To: References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz> <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> <00a601cb96e5\$c12d74d0\$43885e70\$@com> Message-ID: On 9/12/2010, at 4:15 AM, Edmond Begumisa wrote: > I've thought -- now and then, in the back of my mind -- about removing comments from actual source all-together (for all languages) and instead, putting them in companion files that the editor lines up side-by-side. More like annotating than just traditional commenting. > > Has this sort of thing been done before? Is there a particular editor that can give me this out of the box? (I admittedly haven't explored a large number of editors) http://www.xemacs.org/Documentation/beta/html/lispref_52.html I believe Eclipse and NetBeans also have some kind of annotation support. For XML documents, Amaya supports the Annotea protocol. > > It seems a shame that in 2010, it's still so limiting what we can do with comments in our source code! _We_, kimosabe? My strictures against nesting comments do NOT apply to annotated annotations. From jameschurchman Tue Dec 14 00:41:53 2010 From: jameschurchman (James Churchman) Date: Mon, 13 Dec 2010 23:41:53 +0000 Subject: [erlang-questions] best practice for calling C from Erlang In-Reply-To: <20101213211633.GA1635@hanele.lan> References: <20101213211633.GA1635@hanele.lan> Message-ID: <460FB9ED-46AC-4E26-9AF7-9DFF35A5D6EC@gmail.com> been wondering myself what the best way to interface D 2.0 is to erlang?. most of the usual C ones should would as you can call C (some C++) from D2.0 i am not sure what the best communication / serialisation mechanism is, but given a suitable one.. for auto generating if you don't already have a list of all function names then you could use ctags (available in macports etc? ) the "etags" (eg " etags my_c_file.c ") command will give you just the function names and return values, but no arity.. this might be ok as you could autoproduce a lookup table of function pointers in c, and assume the arity is given correct from the erlang code (eg from the length of an input array, tuple etc..) and call the function pointer with the arty of the supplied message from erlang just using a case for aritys upto say 10, otherwise ctags (eg " ctags my_c_file.c ") will give a much more verbose output and could be used to produce the exact code without function pointers, or even auto produce thrift / avro etc.. mappings . i know that ctags this is used by text editors and plugins to allow the browsing of source.. so hopefully will give suitable quality output On 13 Dec 2010, at 21:16, Jachym Holecek wrote: > # Attila Rajmund Nohl 2010-12-13: >> 2010/12/13, Timo Lindemann : >>> Hi, >>> >>> I have made good experiences with the new NIF interface, having hacked an >>> interface to libtidy in one afternoon, and I didn't even know what NIFs were >>> until that morning, so I can definitely say that this is a very easy >>> interface for crossing the boundary quickly. Automatic generation of an >>> interface I don't know much about, I just wanted to chime in to say that >>> NIFs are easy to do, and the wrapper is so thin you might not need to >>> autogenerate it, there's very little boilerplate left to autogenerate. >> >> Surely it's not much for one function. But for 125 functions it worth >> considering generating code... > > BTW In complex cases, 'clang -fsyntax-only -Xclang -ast-print-xml -o a.xml a.c' > comes in handy -- gives you straightforward XML description[*] of C APIs... > > Regards, > -- Jachym > > [*] I mean straightforward after erlsom:simple_form/1 of course. > > ________________________________________________________________ > erlang-questions (at) erlang.org mailing list. > See http://www.erlang.org/faq.html > To unsubscribe; mailto:erlang-questions-unsubscribe > From ok Tue Dec 14 00:52:57 2010 From: ok (Richard O'Keefe) Date: Tue, 14 Dec 2010 12:52:57 +1300 Subject: [erlang-questions] Speaking of comments In-Reply-To: References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz> <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> <00a601cb96e5\$c12d74d0\$43885e70\$@com> Message-ID: On 13/12/2010, at 8:19 PM, Edmond Begumisa wrote: > Interesting article. > > I don't know about using non-ASCII for actual source-code as the author suggests. I'm not a language designer so I have no opinion this (though in relation to this, I've sometimes wondered about alternatives to programing languages revolving around English -- it must really irritate non-English speakers, especially those coming from languages using non-latin alphabets.) MADCAP used a non-ASCII character set, including 2d structures. APL used (and uses) a non-ASCII character set. It has no keywords. I have seen Algol 60 programs written in French and Chinese. I've also read Pascal in French (including French keywords) and seen Simula 67 in Danish. IBM mainframe compilers have for a long time allowed DBCS (double byte character sets). Algol 60 was a comparatively straightforward case. Technically, keywords in that language are single characters, and their rendering as boldface or underlined English words is just one of many possible hardware representations. > > What I would love is very rich and flexible ways of attaching annotations or "running commentary" to source code. Well, you _could_ use NuWeb, or NoWeb, or FunnelWeb, and add whatever annotations you like. > I would think this could be done without changing the language in question. Has very often been done. People have even written programs with commentary in Microsoft Word and used a VBA macro to strip out and save separately the text with the 'Program' style. I have my own very simple program for extracting
``` sections, possibly restricted to a
particular class, from HTML so that
html4.0 foo.htm | pre >foo.erl
can let you extract code from commentary.  How simple?

#include
#include "dvm2.h"

int main(int argc, char **argv) {
char *wanted = argc > 1 ? argv[1] : (char*)0;
xml   e0 = load_esis_through(stdin, 0);
int   last_was_nl;

for_each_named_descendant(e0, "pre", e1)
if (wanted != 0 && !has_value(e1, "class", wanted)) continue;
last_was_nl = 1;
for_each_text_descendant(e1, e2)
fwrite(text_of(e2), 1, x_size(e2), stdout);
if (x_size(e2) != 0)
last_was_nl = text_of(e2)[x_size(e2)-1] == '\n';
end_each_text_descendant
if (!last_was_nl) putc('\n', stdout);
end_each_named_descendant
return 0;
}

That simple.  Doing the same kind of thing using xmerl would be very little harder.

Now you could handle parallel comments in HTML using

code
comments

The limit has been our ingenuity, not our tools.\

From ok  Tue Dec 14 01:10:33 2010
From: ok (Richard O'Keefe)
Date: Tue, 14 Dec 2010 13:10:33 +1300
Subject: [erlang-questions] Re: Multi-line comments in Erlang
In-Reply-To: <56a21d44-81c4-4f8c-bac0-9a4a6a482533@39g2000yqa.googlegroups.com>
References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com>     <92F762DE-4E1A-4E76-B419-F139E393DEA3@gmail.com> <56a21d44-81c4-4f8c-bac0-9a4a6a482533@39g2000yqa.googlegroups.com>
Message-ID: <441F71FE-C593-4CCF-866D-8E98E8C0F955@cs.otago.ac.nz>

On 13/12/2010, at 10:40 PM, Zvi wrote:
> The reason I posted this is because I found out, that Matlab/Octave
> supports this style of comment (%{ ... %}), even that it's IDE has
> perfect support for commenting and uncommenting entire sections of
> source files with end of line comments (... % COMMENT).
> Now Matlab is not the best example of programming language, but I
> think in this particular feature they did it right.

Interestingly, they did it DIFFERENTLY from Modula-2, Lisp, Haskell,
SML, and other languages I know that have nesting comments.
From the MatLab manual:

Block Comments.

To write comments that require more than one line, use the block comment operators, %{ and %}:

%{
This next block of code checks the number of inputs
passed in, makes sure that each input is a valid data
type, and then branches to start processing the data.
%}

Note

The %{ and %} operators must appear alone on the lines that immediately precede and follow
the block of help text.  Do not include any other text on these lines.

White space is apparently allowed, but
x = x {% +1 %};
is not legal, and as for
{%
s = '%}';
%}
well, the manual does not make it clear whether this is an error (because there is
other text on the first %} line, or whether the first '%}' line simply is not recognised
as an end-of-comment line.

This is an interesting variation, but it means that these comments are useless
for commenting out subexpressions.

Of course, like every other nesting comment proposal I've ever seen,
this one IS still broken.

Theorem: There exists a valid block of MatLab code such that
adding a '%{' line at the beginning and a '%}' line at the end
does not result in a valid block comment.  Further, there exists
such a block that contains no string literals or line continuations.
Proof:
x = 1;
%}
y = 2;
The second line here is a valid end-of-line comment.

As Zvi says, the MatLab IDE *will* comment/uncomment blocks correctly using
end-of-line comments.

From steven.payne  Tue Dec 14 01:13:35 2010
From: steven.payne (Steve Payne)
Date: Mon, 13 Dec 2010 19:13:35 -0500
Subject: SASL won't write to my error_logs file
Message-ID: <1292285615.2425.2.camel@steve-desktop>

Hi I am having trouble with SASL.  I have tried everything to get the
error logger to work but it still won't write to my error_logs file.
Here is what I have:

elog3.config

%% rotating log and minimal tty
[{sasl, [
{sasl_error_logger, false},
%% define the parameters of the rotating log
%% the log file directory
{error_logger_mf_dir, "/home/steve/error_logs"},
%% bytes per logfile
{error_logger_mf_maxbytes, 10485760}, % 10 MB
%% maximum number of logfiles
{error_logger_mf_maxfiles, 10}
]}].

Home directory:
elog3.config
error_logs

Then in the shell

steve:~\$ erl -boot start_sasl -config elog3
Erlang R13B03 (erts-5.7.4) [source] [64-bit] [smp:3:3] [rq:3]
[async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.7.4  (abort with ^G)
1> error_logger:error_msg("This is an error\n").

=ERROR REPORT==== 11-Dec-2010::20:24:53 ===
This is an error
ok

Then when I check the error_logs file there is nothing in it.  Why?  Am
I missing something?

From freza  Tue Dec 14 01:27:11 2010
From: freza (Jachym Holecek)
Date: Tue, 14 Dec 2010 00:27:11 +0000
Subject: [erlang-questions] best practice for calling C from Erlang
In-Reply-To: <460FB9ED-46AC-4E26-9AF7-9DFF35A5D6EC@gmail.com>
References:    <20101213211633.GA1635@hanele.lan> <460FB9ED-46AC-4E26-9AF7-9DFF35A5D6EC@gmail.com>
Message-ID: <20101214002711.GA3528@hanele.lan>

# James Churchman 2010-12-13:
> been wondering myself what the best way to interface D 2.0 is to erlang?. most of the
> usual C ones should would as you can call C (some C++) from D2.0
>
> i am not sure what the best communication / serialisation mechanism is,
> but given a suitable one..

I don't know D, but BERT format is what other Erlang interfaces use (Java,
Python, erl_interface for C) -- it's pretty simple and convenient, if you're
OK with talking to Erlang node over sockets/pipes.

If you can call D from C too, you could probably wrap you D code into
a builtin port driver or a NIF -- but personally I wouldn't bother unless
someone beat me with a benchmark. The BERT + pipes solution is easy to
debug and keeps things nicely isolated.

> for auto generating if you don't already have a list of all function
> names then you could use ctags (available in macports etc? ) the
> "etags" (eg " etags my_c_file.c ") command will give you just the
> function names and return values, but no arity..
>
> this might be ok as you could autoproduce a lookup table of function
> pointers in c, and assume the arity is given correct from the erlang
> code (eg from the length of an input array, tuple etc..) and call the
> function pointer with the arty of the supplied message from erlang
> just using a case for aritys upto say 10, otherwise ctags (eg " ctags
> my_c_file.c ") will give a much more verbose output and could be used
> to produce the exact code without function pointers, or even auto
> produce thrift / avro etc.. mappings .
>
> i know that ctags this is used by text editors and plugins to allow
> the browsing of source.. so hopefully will give suitable quality
> output

Yep, for just a list of function names ctags/etags would probably work fine,
but for both static interface and a more dynamic one like you describe
(function calls built at runtime based on user-supplied specs, presumably
using libffi as backend [*]) you really need full function signature -- and
not just that, sometimes you'd like to dissect nested/chained C structures
and unions, so you'd need to supply specs for that too (but more likely hand
written glue code).

Clang output gives you all that information for free, with the slight caveat
that type aliases that were done with C macros will be visible to you only
in their expanded form (and I think some simple typedefs disappeared that
way too, but I might be wrong on that, it's late night ;-). So autogenerated
code will still be type-correct, but may end up ugly and possibly specific
to some version of C code you're interfacing to.

HTH,
-- Jachym

[*] There used to be an EEP (along with implementation) that work this way...

From jameschurchman  Tue Dec 14 01:58:05 2010
From: jameschurchman (James Churchman)
Date: Tue, 14 Dec 2010 00:58:05 +0000
Subject: [erlang-questions] best practice for calling C from Erlang
In-Reply-To: <20101214002711.GA3528@hanele.lan>
References:    <20101213211633.GA1635@hanele.lan> <460FB9ED-46AC-4E26-9AF7-9DFF35A5D6EC@gmail.com> <20101214002711.GA3528@hanele.lan>
Message-ID: <982A590C-079F-45E2-B0D9-60C7D3276687@gmail.com>

Yeah il look into the BERT format, erlang Port Program was what i was thinking (and yes,.. should have mentioned you can do the reverse call D 2.0 from c :-)
The reason is that i need to apply potentially thousands of diffs per sec and im not sure erlang will be quick enough to process all of them even with hipe.. but il benchmark a bit before converting that module to D 2.0 (its about 300 lines of erlang code) and see just at what rate erlang starts to not be quick enough..

having looked into nifs a bit, i really cant get the thinking behind them, they allow mutation of erlang data types, don't copy messages but pass the memory directly, can crash the entire VM, block unrelated processes, change the realtime nature of erlang etc?. the only sensible use of nifs, unless you trust the reliability of the c code very highly, seems to be to run them on a separate erlang VM and message that. Would erlang not better have a c interface that allows direct C/++ function calls with a nice way of dealign with erlagn types like Nifs but copies memory & spawns separate OS thread pool for the code? that sounds more useful to me

yeah was thinking that it should be possible to dynamically get the type form the serration format used, but maybes it is best to get the full spec and not do it dynamically.. highly nested types sounds like it could get tricky so il take you word on it :-)

On 14 Dec 2010, at 00:27, Jachym Holecek wrote:

> # James Churchman 2010-12-13:
>> been wondering myself what the best way to interface D 2.0 is to erlang?. most of the
>> usual C ones should would as you can call C (some C++) from D2.0
>>
>> i am not sure what the best communication / serialisation mechanism is,
>> but given a suitable one..
>
> I don't know D, but BERT format is what other Erlang interfaces use (Java,
> Python, erl_interface for C) -- it's pretty simple and convenient, if you're
> OK with talking to Erlang node over sockets/pipes.
>
> If you can call D from C too, you could probably wrap you D code into
> a builtin port driver or a NIF -- but personally I wouldn't bother unless
> someone beat me with a benchmark. The BERT + pipes solution is easy to
> debug and keeps things nicely isolated.
>
>> for auto generating if you don't already have a list of all function
>> names then you could use ctags (available in macports etc? ) the
>> "etags" (eg " etags my_c_file.c ") command will give you just the
>> function names and return values, but no arity..
>>
>> this might be ok as you could autoproduce a lookup table of function
>> pointers in c, and assume the arity is given correct from the erlang
>> code (eg from the length of an input array, tuple etc..) and call the
>> function pointer with the arty of the supplied message from erlang
>> just using a case for aritys upto say 10, otherwise ctags (eg " ctags
>> my_c_file.c ") will give a much more verbose output and could be used
>> to produce the exact code without function pointers, or even auto
>> produce thrift / avro etc.. mappings .
>>
>> i know that ctags this is used by text editors and plugins to allow
>> the browsing of source.. so hopefully will give suitable quality
>> output
>
> Yep, for just a list of function names ctags/etags would probably work fine,
> but for both static interface and a more dynamic one like you describe
> (function calls built at runtime based on user-supplied specs, presumably
> using libffi as backend [*]) you really need full function signature -- and
> not just that, sometimes you'd like to dissect nested/chained C structures
> and unions, so you'd need to supply specs for that too (but more likely hand
> written glue code).
>
> Clang output gives you all that information for free, with the slight caveat
> that type aliases that were done with C macros will be visible to you only
> in their expanded form (and I think some simple typedefs disappeared that
> way too, but I might be wrong on that, it's late night ;-). So autogenerated
> code will still be type-correct, but may end up ugly and possibly specific
> to some version of C code you're interfacing to.
>
> HTH,
> 	-- Jachym
>
> [*] There used to be an EEP (along with implementation) that work this way...

From jameschurchman  Tue Dec 14 02:49:11 2010
From: jameschurchman (James Churchman)
Date: Tue, 14 Dec 2010 01:49:11 +0000
Subject: [erlang-questions] best practice for calling C from Erlang
In-Reply-To: <982A590C-079F-45E2-B0D9-60C7D3276687@gmail.com>
References:    <20101213211633.GA1635@hanele.lan> <460FB9ED-46AC-4E26-9AF7-9DFF35A5D6EC@gmail.com> <20101214002711.GA3528@hanele.lan> <982A590C-079F-45E2-B0D9-60C7D3276687@gmail.com>
Message-ID: <18F2A92C-30EE-4600-9D0E-750B1C023B56@gmail.com>

(also maybe auto generating thrift (or avro) interfaces could work.. tho i have never used the C++ thrift bindings or even built a thrift interface, just used it to talk to nosql systems..)
On 14 Dec 2010, at 00:58, James Churchman wrote:

> Yeah il look into the BERT format, erlang Port Program was what i was thinking (and yes,.. should have mentioned you can do the reverse call D 2.0 from c :-)
> The reason is that i need to apply potentially thousands of diffs per sec and im not sure erlang will be quick enough to process all of them even with hipe.. but il benchmark a bit before converting that module to D 2.0 (its about 300 lines of erlang code) and see just at what rate erlang starts to not be quick enough..
>
> having looked into nifs a bit, i really cant get the thinking behind them, they allow mutation of erlang data types, don't copy messages but pass the memory directly, can crash the entire VM, block unrelated processes, change the realtime nature of erlang etc?. the only sensible use of nifs, unless you trust the reliability of the c code very highly, seems to be to run them on a separate erlang VM and message that. Would erlang not better have a c interface that allows direct C/++ function calls with a nice way of dealign with erlagn types like Nifs but copies memory & spawns separate OS thread pool for the code? that sounds more useful to me
>
> yeah was thinking that it should be possible to dynamically get the type form the serration format used, but maybes it is best to get the full spec and not do it dynamically.. highly nested types sounds like it could get tricky so il take you word on it :-)
>
> On 14 Dec 2010, at 00:27, Jachym Holecek wrote:
>
>> # James Churchman 2010-12-13:
>>> been wondering myself what the best way to interface D 2.0 is to erlang?. most of the
>>> usual C ones should would as you can call C (some C++) from D2.0
>>>
>>> i am not sure what the best communication / serialisation mechanism is,
>>> but given a suitable one..
>>
>> I don't know D, but BERT format is what other Erlang interfaces use (Java,
>> Python, erl_interface for C) -- it's pretty simple and convenient, if you're
>> OK with talking to Erlang node over sockets/pipes.
>>
>> If you can call D from C too, you could probably wrap you D code into
>> a builtin port driver or a NIF -- but personally I wouldn't bother unless
>> someone beat me with a benchmark. The BERT + pipes solution is easy to
>> debug and keeps things nicely isolated.
>>
>>> for auto generating if you don't already have a list of all function
>>> names then you could use ctags (available in macports etc? ) the
>>> "etags" (eg " etags my_c_file.c ") command will give you just the
>>> function names and return values, but no arity..
>>>
>>> this might be ok as you could autoproduce a lookup table of function
>>> pointers in c, and assume the arity is given correct from the erlang
>>> code (eg from the length of an input array, tuple etc..) and call the
>>> function pointer with the arty of the supplied message from erlang
>>> just using a case for aritys upto say 10, otherwise ctags (eg " ctags
>>> my_c_file.c ") will give a much more verbose output and could be used
>>> to produce the exact code without function pointers, or even auto
>>> produce thrift / avro etc.. mappings .
>>>
>>> i know that ctags this is used by text editors and plugins to allow
>>> the browsing of source.. so hopefully will give suitable quality
>>> output
>>
>> Yep, for just a list of function names ctags/etags would probably work fine,
>> but for both static interface and a more dynamic one like you describe
>> (function calls built at runtime based on user-supplied specs, presumably
>> using libffi as backend [*]) you really need full function signature -- and
>> not just that, sometimes you'd like to dissect nested/chained C structures
>> and unions, so you'd need to supply specs for that too (but more likely hand
>> written glue code).
>>
>> Clang output gives you all that information for free, with the slight caveat
>> that type aliases that were done with C macros will be visible to you only
>> in their expanded form (and I think some simple typedefs disappeared that
>> way too, but I might be wrong on that, it's late night ;-). So autogenerated
>> code will still be type-correct, but may end up ugly and possibly specific
>> to some version of C code you're interfacing to.
>>
>> HTH,
>> 	-- Jachym
>>
>> [*] There used to be an EEP (along with implementation) that work this way...
>

From tony.arcieri  Tue Dec 14 03:37:13 2010
From: tony.arcieri (Tony Arcieri)
Date: Mon, 13 Dec 2010 19:37:13 -0700
Subject: [erlang-questions] Speaking of comments
In-Reply-To:
References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com>
<8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz>
<227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> <00a601cb96e5\$c12d74d0\$43885e70\$@com>

Message-ID:

On Mon, Dec 13, 2010 at 10:56 AM, Nahuel Greco  wrote:

> You guys need to take a look to the image-based Smalltalk philosophy.

Smalltalk philosophy is great, but docco is a tool that can generate exactly
this sort of "literate programming" style side-by-side documentation today
from the codebase of many existing languages, including Erlang. Just pump
your Erlang source code through docco and it will spit out documentation
with comments and source code side-by-side.

docco's web site itself is an example of the output docco generates:

http://jashkenas.github.com/docco/

--
Tony Arcieri
Medioh! Kudelski

From raimo+erlang-questions  Tue Dec 14 09:44:08 2010
From: raimo+erlang-questions (Raimo Niskanen)
Date: Tue, 14 Dec 2010 09:44:08 +0100
Subject: [erlang-questions] Re: Erlang/OTP R14B01 has been released
In-Reply-To: <1292272694.2504.154.camel@yang>
References:   <1292256757.3178.9.camel@yang> <20101213164026.GA20533@erix.ericsson.se> <1292266160.2504.94.camel@yang> <1292272694.2504.154.camel@yang>
Message-ID: <20101214084408.GA28039@erix.ericsson.se>

On Mon, Dec 13, 2010 at 09:38:14PM +0100, Boris M?hmer wrote:
> Am Montag, den 13.12.2010, 19:49 +0100 schrieb Boris M?hmer:
> > Core was generated by `/opt/erlang-otp/lib/erlang/erts-5.8.2/bin/beam.smp -- -root /opt/erlang-otp/lib'.
> > Program terminated with signal 11, Segmentation fault.
> > #0  0x0000000000577ba2 in inet_ctl_getifaddrs (desc=, cmd=,
> >     buf=, len=0, rbuf=, rsize=)
> >     at drivers/common/inet_drv.c:4948
> > 4948		if (ifa_p->ifa_addr->sa_family == AF_INET
>
> I checked one more thing:
>
> (gdb) l
> 4943		utf8_encode(ifa_p->ifa_name, -1, buf_p);
> 4944		buf_p += len;
> 4945		*buf_p++ = '\0';
> 4946		*buf_p++ = INET_IFOPT_FLAGS;
> 4947		put_int32(IFGET_FLAGS(ifa_p->ifa_flags), buf_p); buf_p += 4;
> 4948		if (ifa_p->ifa_addr->sa_family == AF_INET
> 4949	#if defined(AF_INET6)
> 4950		    || ifa_p->ifa_addr->sa_family == AF_INET6
> 4951	#endif
> 4952		    ) {
> (gdb) p ifa_p
> \$1 = (struct ifaddrs *) 0x2853d20
> (gdb) p ifa_p->ifa_addr
> \$2 = (struct sockaddr *) 0x0
>
> Hmmm... well, then statement
>
> if (ifa_p->ifa_addr->sa_family == AF_INET
>
> will "of course" fail.
>
> The "offending" device is:
>
> (gdb) p ifa_p->ifa_name
> \$7 = 0x2853dc4 "tun0"
>
> The "OpenVPN" device.

Good hunting!

The man page for getifaddrs() says:
The ifa_addr field references either the address of the interface or
the link level address of the interface, if one exists, otherwise it
is NULL.  (The sa_family field of the ifa_addr field should be
consulted to determine the format of the ifa_addr address.)

And I missed the fact that the address could be NULL entirely...
Silly me. The same goes for many other fields too.
Can you test the attached patch to see if it is this problem
only or more. It is really just a 6-line change, but whitespace
differences makes it ugly.

>
>
>   - boris
>

--

/ Raimo Niskanen, Erlang/OTP, Ericsson AB
-------------- next part --------------
A non-text attachment was scrubbed...
Name: getifaddrs.diff
Type: text/x-patch
Size: 2336 bytes
Desc: not available
URL:

From boris.muehmer  Tue Dec 14 10:26:45 2010
From: boris.muehmer (Boris =?ISO-8859-1?Q?M=FChmer?=)
Date: Tue, 14 Dec 2010 10:26:45 +0100
Subject: [erlang-questions] Re: Erlang/OTP R14B01 has been released
In-Reply-To: <20101214084408.GA28039@erix.ericsson.se>
References:

<1292256757.3178.9.camel@yang> <20101213164026.GA20533@erix.ericsson.se>
<1292266160.2504.94.camel@yang> <1292272694.2504.154.camel@yang>
<20101214084408.GA28039@erix.ericsson.se>
Message-ID: <1292318805.2945.21.camel@yang>

Am Dienstag, den 14.12.2010, 09:44 +0100 schrieb Raimo Niskanen:
> And I missed the fact that the address could be NULL entirely...
> Silly me. The same goes for many other fields too.

I wasn't sure if that field (ifa_p->ifa_addr) could be NULL, but the
output of "ip addr list" made me suspicious! For "tun0" the result was:

5: tun0:  mtu 1500 qdisc
pfifo_fast state UNKNOWN qlen 100
link/none
inet 192.168.XXX.XXX peer 192.168.XXX.XXX/32 scope global tun0

Because of "link/none" I started to dig a bit deeper.

> Can you test the attached patch to see if it is this problem
> only or more. It is really just a 6-line change, but whitespace
> differences makes it ugly.

The patch works on my system.

- boris

From dkoch  Tue Dec 14 11:11:38 2010
From: dkoch (dkoch)
Date: Tue, 14 Dec 2010 11:11:38 +0100 (CET)
Subject: REF: Erlang doc index.html (NON URGENT)
Message-ID: <28867555.10541292321498381.JavaMail.www@wsfrf1216>

The left pane doesn't opens/shows correctly in the Opera browser. In fact only the last items ("System Documentation" always and sometimes "Miscellaneous") do. Could you please check this for the next iteration ? Thanks...
David "Kochise" KOCH

From alain.odea  Tue Dec 14 11:32:47 2010
From: alain.odea (Alain O'Dea)
Date: Tue, 14 Dec 2010 07:02:47 -0330
Subject: [erlang-questions] REF: Erlang doc index.html (NON URGENT)
In-Reply-To: <28867555.10541292321498381.JavaMail.www@wsfrf1216>
References: <28867555.10541292321498381.JavaMail.www@wsfrf1216>
Message-ID:

This is worth reporting to Opera's team.  It works in Safari, Chrome,
Firefox and Internet Exwhich suggests

On Tuesday, December 14, 2010,   wrote:
> The left pane doesn't opens/shows correctly in the Opera browser. In fact only the last items ("System Documentation" always and sometimes "Miscellaneous") do. Could you please check this for the next iteration ? Thanks...
> David "Kochise" KOCH

From alain.odea  Tue Dec 14 11:36:43 2010
From: alain.odea (Alain O'Dea)
Date: Tue, 14 Dec 2010 07:06:43 -0330
Subject: [erlang-questions] REF: Erlang doc index.html (NON URGENT)
In-Reply-To:
References: <28867555.10541292321498381.JavaMail.www@wsfrf1216>

Message-ID:

Sorry about that.  My iPhone is haunted.  I wasn't ready to send that.
I was in the middle of typing.

What I was saying is that this issue is very likely a bug in Opera or
a configuration issue in your settings.  Have you reproduced the issue
on a fresh Opera install or on Opera on another machine?

If nothing else the Opera team may come back with what makes the page
break in Opera.  That would make fixing this way easier :)

Thank you,
Alain

On Tuesday, December 14, 2010, Alain O'Dea  wrote:
> This is worth reporting to Opera's team. ?It works in Safari, Chrome,
> Firefox and Internet Exwhich suggests
>
> On Tuesday, December 14, 2010, ? wrote:
>> The left pane doesn't opens/shows correctly in the Opera browser. In fact only the last items ("System Documentation" always and sometimes "Miscellaneous") do. Could you please check this for the next iteration ? Thanks...
>> David "Kochise" KOCH
>

From raimo+erlang-questions  Tue Dec 14 11:38:54 2010
From: raimo+erlang-questions (Raimo Niskanen)
Date: Tue, 14 Dec 2010 11:38:54 +0100
Subject: [erlang-questions] Re: Erlang/OTP R14B01 has been released
In-Reply-To: <1292318805.2945.21.camel@yang>
References:   <1292256757.3178.9.camel@yang> <20101213164026.GA20533@erix.ericsson.se> <1292266160.2504.94.camel@yang> <1292272694.2504.154.camel@yang> <20101214084408.GA28039@erix.ericsson.se> <1292318805.2945.21.camel@yang>
Message-ID: <20101214103854.GB30851@erix.ericsson.se>

On Tue, Dec 14, 2010 at 10:26:45AM +0100, Boris M?hmer wrote:
> Am Dienstag, den 14.12.2010, 09:44 +0100 schrieb Raimo Niskanen:
> > And I missed the fact that the address could be NULL entirely...
> > Silly me. The same goes for many other fields too.
>
> I wasn't sure if that field (ifa_p->ifa_addr) could be NULL, but the
> output of "ip addr list" made me suspicious! For "tun0" the result was:
>
> 5: tun0:  mtu 1500 qdisc
> pfifo_fast state UNKNOWN qlen 100
>     link/none
>     inet 192.168.XXX.XXX peer 192.168.XXX.XXX/32 scope global tun0
>
> Because of "link/none" I started to dig a bit deeper.
>
> > Can you test the attached patch to see if it is this problem
> > only or more. It is really just a 6-line change, but whitespace
> > differences makes it ugly.
>
> The patch works on my system.

Great! Now I would like to get a positive confirmation
from Zvi that it works for him too...

>
>
>   - boris
>

--

/ Raimo Niskanen, Erlang/OTP, Ericsson AB

From dkoch  Tue Dec 14 13:35:32 2010
From: dkoch (dkoch)
Date: Tue, 14 Dec 2010 13:35:32 +0100 (CET)
Subject: [erlang-questions] REF: Erlang doc index.html (NON URGENT)
In-Reply-To:
References: <28867555.10541292321498381.JavaMail.www@wsfrf1216>

Message-ID: <32076292.37781292330132157.JavaMail.www@wsfrf1135>

Thanks alot Alain. This behavior happens on a fressh Opera 10.63 installation, as well as a previciously installed Opera 10.63 install. It might be a bug, perhaps. However is this 'feature' (paning) really necessary ? A plain ol' html tree ain't enough ?
If the plan is to keep the documentation around a tree-based model (which is a good one) one might consider using a real javascript-based tree that also works under Opera (just tested) like these :
http://www.destroydrop.com/javascripts/tree/
http://www.treemenu.org/ (sourceforge)
http://www.javascriptkit.com/script/treeview/index.shtml
It would then be more easy to dive into the documentation's depth, that would render it almost MSDN-alike :)
David

========================================

Message du : 14/12/2010
De : "Alain O 'Dea "
A : "dkoch"
Copie ? : erlang-questions
Sujet : Re: [erlang-questions] REF: Erlang doc index.html (NON URGENT)

Sorry about that. My iPhone is haunted. I wasn't ready to send that.
I was in the middle of typing.

What I was saying is that this issue is very likely a bug in Opera or
a configuration issue in your settings. Have you reproduced the issue
on a fresh Opera install or on Opera on another machine?

If nothing else the Opera team may come back with what makes the page
break in Opera. That would make fixing this way easier :)

Thank you,
Alain

On Tuesday, December 14, 2010, Alain O'Dea wrote:
> This is worth reporting to Opera's team.  It works in Safari, Chrome,
> Firefox and Internet Exwhich suggests
>
> On Tuesday, December 14, 2010,   wrote:
>> The left pane doesn't opens/shows correctly in the Opera browser. In fact only the last items ("System Documentation" always and sometimes "Miscellaneous") do. Could you please check this for the next iteration ? Thanks...
>> David "Kochise" KOCH
>

________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-questions-unsubscribe

From zvi.avraham  Tue Dec 14 13:39:29 2010
From: zvi.avraham (Zvi)
Date: Tue, 14 Dec 2010 04:39:29 -0800 (PST)
Subject: Erlang/OTP R14B01 has been released
In-Reply-To: <20101214103854.GB30851@erix.ericsson.se>
References:

<1292256757.3178.9.camel@yang> <20101213164026.GA20533@erix.ericsson.se>
<1292266160.2504.94.camel@yang> <1292272694.2504.154.camel@yang>
<20101214084408.GA28039@erix.ericsson.se> <1292318805.2945.21.camel@yang> <20101214103854.GB30851@erix.ericsson.se>
Message-ID: <95b6be79-55b1-428e-87f1-402e03233727@b25g2000vbz.googlegroups.com>

Hi Raimo,
I applied the patch, now it works for both online and offline.
thanks,
Zvi

[~]\$ erl
Erlang R14B01 (erts-5.8.2) [source] [smp:2:2] [rq:2] [async-threads:0]
[hipe] [kernel-poll:false]

Eshell V5.8.2  (abort with ^G)
1> inet:getifaddrs().
{ok,[{"lo",
[{flags,[up,loopback,running]},
{hwaddr,[0,0,0,0,0,0]},
{addr,{127,0,0,1}},
{netmask,{255,0,0,0}},
{addr,{0,0,0,0,0,0,0,1}},
{netmask,{65535,65535,65535,65535,65535,65535,65535,
65535}}]},
{"eth1",
[{flags,[up,broadcast,running,multicast]},
{hwaddr,[0,36,XX,XX,XX,XX]}]},
{"wlan1",
[{flags,[broadcast,multicast]},
{hwaddr,[0,33,XX,XX,XX,XX]}]},
{"ppp0",
[{flags,[up,pointtopoint,running,multicast]},
{addr,{XXX,XXX,XXX,XXX}},
{netmask,{255,255,255,255}},
{dstaddr,{10,64,64,64}}]}]}

[~]\$ erl
Erlang R14B01 (erts-5.8.2) [source] [smp:2:2] [rq:2] [async-threads:0]
[hipe] [kernel-poll:false]

Eshell V5.8.2  (abort with ^G)
1> inet:getifaddrs().
{ok,[{"lo",
[{flags,[up,loopback,running]},
{hwaddr,[0,0,0,0,0,0]},
{addr,{127,0,0,1}},
{netmask,{255,0,0,0}},
{addr,{0,0,0,0,0,0,0,1}},
{netmask,{65535,65535,65535,65535,65535,65535,65535,
65535}}]},
{"eth1",
[{flags,[up,broadcast,running,multicast]},
{hwaddr,[0,36,XX,XX,XX,XX]}]},
{"wlan1",
[{flags,[broadcast,multicast]},
{hwaddr,[0,33,XX,XX,XX,XX]}]}]}

On Dec 14, 12:38?pm, Raimo Niskanen  wrote:
> On Tue, Dec 14, 2010 at 10:26:45AM +0100, Boris M?hmer wrote:
> > Am Dienstag, den 14.12.2010, 09:44 +0100 schrieb Raimo Niskanen:
> > > And I missed the fact that the address could be NULL entirely...
> > > Silly me. The same goes for many other fields too.
>
> > I wasn't sure if that field (ifa_p->ifa_addr) could be NULL, but the
> > output of "ip addr list" made me suspicious! For "tun0" the result was:
>
> > 5: tun0:  mtu 1500 qdisc
> > pfifo_fast state UNKNOWN qlen 100
> > ? ? link/none
> > ? ? inet 192.168.XXX.XXX peer 192.168.XXX.XXX/32 scope global tun0
>
> > Because of "link/none" I started to dig a bit deeper.
>
> > > Can you test the attached patch to see if it is this problem
> > > only or more. It is really just a 6-line change, but whitespace
> > > differences makes it ugly.
>
> > The patch works on my system.
>
> Great! Now I would like to get a positive confirmation
> from Zvi that it works for him too...
>
>
>
> > ? - boris
>
> --
>
> / Raimo Niskanen, Erlang/OTP, Ericsson AB
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> Seehttp://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscr...

From rtrlists  Tue Dec 14 14:59:19 2010
From: rtrlists (Robert Raschke)
Date: Tue, 14 Dec 2010 13:59:19 +0000
Subject: [erlang-questions] best practice for calling C from Erlang
In-Reply-To:
References:
Message-ID:

On Mon, Dec 13, 2010 at 1:37 PM, Joe Armstrong  wrote:

> What is "best practice for calling C from Erlang"
>
> I have a C library I want to call from Erlang - nothing complicated.
> Mostly the C functions are called with simple types, integers, strings etc.
> and the return value is uninteresting. In the case where the return value
> is
> interesting I mostly require an opaque return value - ie all I might
> ever want to do
> is re-use it in a subsequent call to a different C routine, so the actual
> return
> value need never cross the C/Erlang boundary, but could be passed back
> and forth
> as a reference.
>
> What is the best (and easiest) way to call this from Erlang.
> Is there any program that takes a file containing C type declarations
> (either in ANSI C, or as a erlang terms) and automatically builds
> the C and Erlang sides of the interface?
>
> The problem here is not the complexity of an individual
> call, but the fact there are a large number of simple and rather
> boring functions than must be called.
>
> I know all about the ports
> interface linked-in drivers etc. My question is more to do with
> the automatic generation of an interface from some kind of specification.
>
> /Joe
>
>
>
In every project I have worked on where an automatic generation of stub code
based on some kind of interface spec was used, it got replaced by
handwritten shims after about 12 - 18 months.

This was always due to the mismatch of levels of abstraction. This leads to
the generator getting adapted, and adapted, and adapted ...

My approach has since then changed to always design an interface layer that
allows for a smooth transition between the levels of abstraction on each
side.

Especially going from Erlang to C (or the other way round) you will quite
likely require some kind of layer that translates between your Erlang API
idioms and those of C. You are probably thinking that doing this completely
on the Erlang side (from some automatically generated C level interface) is
preferred to doing it in C. But you will find that some translations of data
structures is better done at a lower level, whereas others may be easier at
a higher level. Once you have the code generator for your interface, you
will start spending an enormous amount of time tweaking that code generator
to accommodate your translation routines.

If you are in the business of writing such a generator, fine.
If you just want to use some C library, then, usually, not fine.

Robby

From bgustavsson  Tue Dec 14 15:32:37 2010
From: bgustavsson (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=)
Date: Tue, 14 Dec 2010 15:32:37 +0100
Subject: [erlang-questions] Re: Erlang/OTP R14B01 has been released
In-Reply-To: <32cbd8bc-12ea-49aa-b263-29dc8857ad7b@p1g2000yqm.googlegroups.com>
References:
<32cbd8bc-12ea-49aa-b263-29dc8857ad7b@p1g2000yqm.googlegroups.com>
Message-ID:

On Sun, Dec 12, 2010 at 6:51 PM, Zvi  wrote:
> RE: OTP-8865  Code such as foo(A) -> <> would crash the compiler.
>
> It seems that compiler will totally ignore type of A in this case:
>
> Eshell V5.8.2  (abort with ^G)
> 1> F = fun(A) -> <> end.
> #Fun
> 2>
> 2> F(0).
> <<>>
> 3> F(1).
> <<>>
> 4> F(10000).
> <<>>
> 5> F(1.4).
> <<>>
> 6> F(add).
> <<>>
> 7> F(kuku).
> <<>>
> 8>
> 8> F("adfd").
> <<>>
> 9>
> 9> F({1,2}).
> <<>>
> 10>
>

We will fix this bug in R14B02.

By the way, the bug is in the run-time system, not in the compiler.
The compiler emits the correct instruction, but that instruction
does not bother to check the type if the width is zero.

--
Bj?rn Gustavsson, Erlang/OTP, Ericsson AB

From adam  Tue Dec 14 17:50:30 2010
From: adam (Adam Lindberg)
Date: Tue, 14 Dec 2010 17:50:30 +0100
Subject: wxWidgets and 64-bit Erlang under OS X
Message-ID: <82861E07-F4DB-41D4-93D5-CDFEBAE5B9F1@erlang-solutions.com>

Hi,

Currently it is impossible to build wxWidgets 2.8 for OS X with 64-bit support. That means that if you're running 64-bit Erlang you can't use wxErlang.

What's the plan for supporting wxWidgets 2.9 and above (as these will include 64-bit support)?

Cheers,
Adam

From erlang  Tue Dec 14 18:36:56 2010
From: erlang (Martijn Rijkeboer)
Date: Tue, 14 Dec 2010 18:36:56 +0100
Subject: Problem compiling R14B01 on OpenBSD amd64
Message-ID:

Hello,

I'm having trouble compiling Erlang R14B01 on OpenBSD 4.8 AMD64. I'm using
the following configure:

./configure --prefix=/usr/local/stow/otp-R14B01 \
--disable-jinterface \
--disable-odbc \
--enable-threads \
--enable-kernel-poll \
--disable-hipe \
--disable-smp-support

When running gmake I'm getting the following error:

cd lib && \
ERL_TOP=/home/compile.git/workdir/otp_src_R14B01
PATH=/home/compile.git/workdir/otp_src_R14B01/bootstrap/bin:\${PATH} \
gmake opt SECONDARY_BOOTSTRAP=true
gmake[1]: Entering directory `/home/compile.git/workdir/otp_src_R14B01/lib'
gmake[2]: Entering directory
`/home/compile.git/workdir/otp_src_R14B01/lib/hipe'
=== Entering application hipe
gmake[3]: Entering directory
`/home/compile.git/workdir/otp_src_R14B01/lib/hipe/misc'
erlc -W  +debug_info +warn_exported_vars +warn_missing_spec
+warn_untyped_record -o../ebin hipe_consttab.erl
gmake[3]: *** [../ebin/hipe_consttab.beam] Bad system call (core dumped)
gmake[3]: Leaving directory
`/home/compile.git/workdir/otp_src_R14B01/lib/hipe/misc'
gmake[2]: *** [opt] Error 2
gmake[2]: Leaving directory
`/home/compile.git/workdir/otp_src_R14B01/lib/hipe'
gmake[1]: *** [opt] Error 2
gmake[1]: Leaving directory `/home/compile.git/workdir/otp_src_R14B01/lib'
gmake: *** [secondary_bootstrap_build] Error 2

Any ideas on what I'm doing wrong?

Kind regards,

Martijn Rijkeboer

From dgud  Tue Dec 14 20:32:23 2010
From: dgud (Dan Gudmundsson)
Date: Tue, 14 Dec 2010 20:32:23 +0100
Subject: [erlang-questions] wxWidgets and 64-bit Erlang under OS X
In-Reply-To: <82861E07-F4DB-41D4-93D5-CDFEBAE5B9F1@erlang-solutions.com>
References: <82861E07-F4DB-41D4-93D5-CDFEBAE5B9F1@erlang-solutions.com>
Message-ID:

I havn't intended to support 2.9 which is a non-stable/developer release.
My thoughts have been to wait until 3.0 begins to appear in linux releases.

If I have time and it isn't to much work.

/Dan

On Tue, Dec 14, 2010 at 5:50 PM, Adam Lindberg
wrote:
> t

From co7eb  Wed Dec 15 17:59:07 2010
From: co7eb (=?iso-8859-1?Q?Gilberio_Carmenates_Garc=EDa?=)
Date: Wed, 15 Dec 2010 13:59:07 -0300
Subject: Erlang IDE to develop GUIs
Message-ID: <000f01cb9c79\$64a482f0\$2ded88d0\$@co.cu>

Hi, all

There are out there any Erlang IDE that allow us to use de GS module like
NetBeans uses Swing

I mean, that we can develop GUIs in Erlang using GS or another graphical
system of visual way,

Dropping components to the form and doing double clicks to write the action?

Regards,

Ivan.

----------------------------------------------------------------------------
---------------------------------

Ing: Ivan Carmenates Garc?a

Current project: ExtendedVisualOtp and Erlang Book: "Erlang Avanzado para
principiantes"

Ivanco Software Company in association with SPI Team

spi_red32LogoSPI

=======================================================================
Este mensaje ha sido enviado mediante el servicio de correo electr?nico que ofrece la Federaci?n de Radioaficionados de Cuba a sus miembros para respaldar el cumplimiento de los objetivos de la organizaci?n y su pol?tica informativa. La persona que env?a este correo asume el compromiso de  usar el servicio a tales fines y cumplir con las regulaciones establecidas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:

From dkoch  Tue Dec 14 23:19:03 2010
From: dkoch (David KOCH)
Date: Tue, 14 Dec 2010 23:19:03 +0100
Subject: [erlang-questions] Erlang IDE to develop GUIs
In-Reply-To: <000f01cb9c79\$64a482f0\$2ded88d0\$@co.cu>
References: <000f01cb9c79\$64a482f0\$2ded88d0\$@co.cu>
Message-ID:

To my knowledge, nothing of that sort have presently been set up. You
might consider the now integrated wxWidget binding of the OTP
distrubution, yet you still have to develop everything all by yourself,
there is no such framework available.

Le Wed, 15 Dec 2010 17:59:07 +0100, Gilberio Carmenates Garc?a
a ?crit:

> Hi, all
> There are out there any Erlang IDE that allow us to use de GS module like
> NetBeans uses Swing
> I mean, that we can develop GUIs in Erlang using GS or another graphical
> system of visual way,
> Dropping components to the form and doing double clicks to write the
> action?
> Regards,
> Ivan.

From marcel.meyer  Wed Dec 15 00:36:41 2010
From: marcel.meyer (Marcel Meyer)
Date: Tue, 14 Dec 2010 18:36:41 -0500
Subject: gen_event streamer
Message-ID:

Hi there,

I would like to request your guidance in the following scenario where I want
to follow OTP conventions:
I want to mount a process on a directory that fires an event when files get
added or deleted.  I thought the API should look like this:

fs_watcher:add_handler("/User/marcel/downloads/", pid).
fs_watcher:add_handler("/User/john/downloads/", pid).

Now I'm thinking that there should be 1 supervisor that keeps a process for
each folder alive and sends a message to pid every time something happens in
that folder, so in my example above, there would be 2 processes being kept
alive.

Am I talking about the server/streamer part of the gen_event?
Or do I need to roll my own by stitching an app/sup together that manage the
spawned directory processes?

Regards,
Marcel

From b.nicholson  Wed Dec 15 00:50:37 2010
From: b.nicholson (Barry Nicholson)
Date: Tue, 14 Dec 2010 17:50:37 -0600
Subject: [erlang-questions] gen_event streamer
In-Reply-To:
References:
Message-ID: <4D0802CD.3090604@niceng.com>

Marcel:

Some further information would be helpful.  Are you going to be doing
this on unix/linux/windows?  What OS?   There are different mechanisms
available for the different OSes.   It might change the design.

Also, what's the timing requirements?   Do you want to know when the
files get added immediately or can you wait a few seconds, a few
minutes, or a few hours.   This could also change the design.

Barry Nicholson

On 12/14/10 5:36 PM, Marcel Meyer wrote:
> Hi there,
>
> I would like to request your guidance in the following scenario where I want
> to follow OTP conventions:
> I want to mount a process on a directory that fires an event when files get
> added or deleted.  I thought the API should look like this:
>
> fs_watcher:add_handler("/User/marcel/downloads/", pid).
> fs_watcher:add_handler("/User/john/downloads/", pid).
>
> Now I'm thinking that there should be 1 supervisor that keeps a process for
> each folder alive and sends a message to pid every time something happens in
> that folder, so in my example above, there would be 2 processes being kept
> alive.
>
> Am I talking about the server/streamer part of the gen_event?
> Or do I need to roll my own by stitching an app/sup together that manage the
> spawned directory processes?
>
> Regards,
> Marcel
>

From anders.nygren  Wed Dec 15 02:29:26 2010
From: anders.nygren (Anders Nygren)
Date: Tue, 14 Dec 2010 19:29:26 -0600
Subject: [erlang-questions] gen_event streamer
In-Reply-To:
References:
Message-ID:

If You are planning on using linux take a look at
https://github.com/massemanet/inotify
an erlang interface to inotify.

/Anders

On Tue, Dec 14, 2010 at 5:36 PM, Marcel Meyer  wrote:
> Hi there,
>
> I would like to request your guidance in the following scenario where I want
> to follow OTP conventions:
> I want to mount a process on a directory that fires an event when files get
> added or deleted. ?I thought the API should look like this:
>
> fs_watcher:add_handler("/User/marcel/downloads/", pid).
> fs_watcher:add_handler("/User/john/downloads/", pid).
>
> Now I'm thinking that there should be 1 supervisor that keeps a process for
> each folder alive and sends a message to pid every time something happens in
> that folder, so in my example above, there would be 2 processes being kept
> alive.
>
> Am I talking about the server/streamer part of the gen_event?
> Or do I need to roll my own by stitching an app/sup together that manage the
> spawned directory processes?
>
> Regards,
> Marcel
>

From rzezeski  Wed Dec 15 02:39:33 2010
From: rzezeski (Ryan Zezeski)
Date: Tue, 14 Dec 2010 20:39:33 -0500
Subject: [erlang-questions] Erlang Start-Up File (.erlang)
In-Reply-To: <20101213194727.GB41563@h216-235-12-173.host.egate.net>
References: <20101213194727.GB41563@h216-235-12-173.host.egate.net>
Message-ID:

On Mon, Dec 13, 2010 at 2:47 PM, Vance Shipley  wrote:

> I have looked high and low but can no longer find anywhere
> where the start-up file .erlang is documented.  It used to
> be in the Getting Started with Erlang User's Guide but does
> not seem to be there now.
>
> --
>        -Vance
>

I found it in some old documentation via Google, but I couldn't locate it in
the current docs.

http://www.erlang.org/documentation/doc-5.2/doc/getting_started/getting_started.html

It's mentioned under section 1.7.1.  It worked for me on R14B.

-Ryan

From rzezeski  Wed Dec 15 05:06:44 2010
From: rzezeski (Ryan Zezeski)
Date: Tue, 14 Dec 2010 23:06:44 -0500
Subject: [erlang-questions] SASL won't write to my error_logs file
In-Reply-To: <1292285615.2425.2.camel@steve-desktop>
References: <1292285615.2425.2.camel@steve-desktop>
Message-ID:

On Mon, Dec 13, 2010 at 7:13 PM, Steve Payne wrote:

> Hi I am having trouble with SASL.  I have tried everything to get the
> error logger to work but it still won't write to my error_logs file.
> Here is what I have:
>
>
> elog3.config
>
> %% rotating log and minimal tty
> [{sasl, [
> {sasl_error_logger, false},
> %% define the parameters of the rotating log
> %% the log file directory
> {error_logger_mf_dir, "/home/steve/error_logs"},
> %% bytes per logfile
> {error_logger_mf_maxbytes, 10485760}, % 10 MB
> %% maximum number of logfiles
> {error_logger_mf_maxfiles, 10}
> ]}].
>
> Home directory:
> elog3.config
> error_logs
>
> Then in the shell
>
> steve:~\$ erl -boot start_sasl -config elog3
> Erlang R13B03 (erts-5.7.4) [source] [64-bit] [smp:3:3] [rq:3]
> [async-threads:0] [hipe] [kernel-poll:false]
>
> Eshell V5.7.4  (abort with ^G)
> 1> error_logger:error_msg("This is an error\n").
>
> =ERROR REPORT==== 11-Dec-2010::20:24:53 ===
> This is an error
> ok
>
> Then when I check the error_logs file there is nothing in it.  Why?  Am
> I missing something?
>

I can't tell if you mean to say that 1) there are no files under the
error_logs dir or that 2) you see a file but it is empty.

1) Make sure your path is correct.  Check the output of
sys:get_status(error_logger).  You should see log_mf_h under the installed
handlers.

2) There should be two files: 1 and index.  These files are in binary (at
least, 1 should be).  In order to read them you use the report browser tool
(rb).

-Ryan

From bernie  Wed Dec 15 06:35:56 2010
From: bernie (Bernard Duggan)
Date: Wed, 15 Dec 2010 16:35:56 +1100
Subject: Dialyzer "no local return" warning for anonymous functions
Message-ID: <4D0853BC.1020503@m5net.com>

Hi all,

We have a bit of code that looks something like this:

validate(A, B) ->
try
mnesia:transaction(fun() ->
some_test_db_operations(A, B),
mnesia:abort(all_valid)
end),
catch
exit:{aborted, all_valid} -> ok;
exit:{aborted, Error} -> {error, Error}
end.

The purpose is to "try out" some mnesia operations on un-validated data
to ensure that they'll all work.  It's kind of a neat trick (though no
doubt falling fairly far from "best practise" in terms of use of
exceptions), but it annoys dialyzer in a way that I can't figure out how
to avoid.

Dialyzer (as of R14B01, at least) quite correctly reports that the
anonymous function in the transaction has no local return.  For normal
functions, I'd work around this by simply giving it a -spec with
no_return() as the return type, and everyone is happy.  As far as I
know, though, there's no way to -spec an anonymous function, nor is
there any obvious way to make that particular function not anonymous.

Any suggestions are welcome :)

Cheers,

Bernard

From mapandfold  Wed Dec 15 09:00:07 2010
From: mapandfold (MapAndFold)
Date: Wed, 15 Dec 2010 16:00:07 +0800
Subject: [erlang-questions] REF: Erlang doc index.html (NON URGENT)
In-Reply-To: <28867555.10541292321498381.JavaMail.www@wsfrf1216>
References: <28867555.10541292321498381.JavaMail.www@wsfrf1216>
Message-ID:

I have written a user script to fix this.

To use this, remember to update @include to your local directory.

// ==UserScript==
// @name             fix erlang doc
// @author           Mapandfold
// @include          file://localhost/E:/Program%20Files/erl*/*
// ==/UserScript==

window.opera.defineMagicFunction(
'setscrollpos',
function ()
{
var objf = document.getElementById('loadscrollpos');
if (objf)
document.getElementById("leftnav").scrollTop =
objf.offsetTop - getWinHeight()/2;
else
initFlip();
}
);

// end of file

On Tue, Dec 14, 2010 at 6:11 PM,   wrote:
> The left pane doesn't opens/shows correctly in the Opera browser. In fact only the last items ("System Documentation" always and sometimes "Miscellaneous") do. Could you please check this for the next iteration ? Thanks...
> David "Kochise" KOCH

--
http://hi.baidu.com/mapandfold

From Mike.French  Wed Dec 15 09:45:20 2010
From: Mike.French (French, Mike)
Date: Wed, 15 Dec 2010 08:45:20 -0000
Subject: Erlang for 2011
Message-ID: <3F8EEA01CF53D74DB4A9EC314D82B4F3024E2AEA@wells154924>

Erlang makes 'Top 5 Programming Languages for 2011'

http://bostinnovation.com/2010/12/14/top-5-programming-languages-for-2011/

The other interesting mention is R, a lazy functional language for
stats'n'graphics.
Although clojure is not in the list, the Incanter platform, inspired by R,
is probably the largest application domain for clojure at the moment:

http://incanter.org/

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 kostis  Wed Dec 15 10:08:52 2010
From: kostis (Kostis Sagonas)
Date: Wed, 15 Dec 2010 11:08:52 +0200
Subject: [erlang-questions] Dialyzer "no local return" warning for anonymous
functions
In-Reply-To: <4D0853BC.1020503@m5net.com>
References: <4D0853BC.1020503@m5net.com>
Message-ID: <4D0885A4.3000402@cs.ntua.gr>

Bernard Duggan wrote:
> Hi all,
>
> We have a bit of code that looks something like this:
>
> validate(A, B) ->
>     try
>         mnesia:transaction(fun() ->
>             some_test_db_operations(A, B),
>             mnesia:abort(all_valid)
>         end),
>     catch
>         exit:{aborted, all_valid} -> ok;
>         exit:{aborted, Error} -> {error, Error}
>     end.
>
> The purpose is to "try out" some mnesia operations on un-validated data
> to ensure that they'll all work.  It's kind of a neat trick (though no
> doubt falling fairly far from "best practise" in terms of use of
> exceptions), but it annoys dialyzer in a way that I can't figure out how
> to avoid.
>
> Dialyzer (as of R14B01, at least) quite correctly reports that the
> anonymous function in the transaction has no local return.  For normal
> functions, I'd work around this by simply giving it a -spec with
> no_return() as the return type, and everyone is happy.  As far as I
> know, though, there's no way to -spec an anonymous function, nor is
> there any obvious way to make that particular function not anonymous.

It's too early in the morning for me, but doesn't the following do it?
(Warning: untested -- I also think the parentheses aroung the fun object
are not really needed, but perhaps the code is clearer with them)

validate(A, B) ->
try
mnesia:transaction((fun my_funky_mnesia_test/2)(A,B))
catch
exit:{aborted, all_valid} -> ok;
exit:{aborted, Error} -> {error, Error}
end.

-spec my_funky_mnesia_test(some_t(), another_t()) -> no_return().

my_funky_mnesia_test(A, B) ->
some_test_db_operations(A, B),
mnesia:abort(all_valid).

Cheers,
Kostis

From minaev  Wed Dec 15 12:00:50 2010
From: minaev (Dmitri Minaev)
Date: Wed, 15 Dec 2010 14:00:50 +0300
Subject: Cannot unload module from remote shell
Message-ID:

Hello,

I learn Erlang with a modest goal of finding out what causes troubles with
our installation of RabbitMQ.

Quite naturally, I learn by playing with Rabbit. I began by writing a module
with a trivial function that displays a list of queues in Rabbit. I attached
to the remote node, compiled the file and loaded it using code:load_abs.

So, I loaded my functions into a running instance of RabbitMQ. Of course, my
module is still there when I detach and reattach to  the same node. But why
the module is still loaded when I restart Erlang?

I tried to move the files I compiled and loaded to another directory, so
Rabbit would not reload them from the old place. It looks like Erlang saves
its image before exiting and reloads it when starting again (a behavior one
might expect from a Lisp system), but I am not certain if this functionality
is even available in Erlang.

Thank you.

--
With best regards,
Dmitri Minaev

From marcel.meyer  Wed Dec 15 13:13:12 2010
From: marcel.meyer (Marcel Meyer)
Date: Wed, 15 Dec 2010 07:13:12 -0500
Subject: [erlang-questions] gen_event streamer
In-Reply-To: <4D0802CD.3090604@niceng.com>
References:
<4D0802CD.3090604@niceng.com>
Message-ID:

Hi Barry,

It should be able to run on Windows and Linux and the maximum resolution
should be 1 sec.
I have a prototype (non OTP) version that polls the directory with
file:list_dir(Dir). It should also be mentioned that for the most part, the
directory being watch will also be emptied as events get processed, so I
shouldn't run into an issue where there might be millions of files in a
folder which will slow down the polling.

What do you think?

Regards,
Marcel

On Tue, Dec 14, 2010 at 6:50 PM, Barry Nicholson wrote:

> Marcel:
>
> Some further information would be helpful.  Are you going to be doing
> this on unix/linux/windows?  What OS?   There are different mechanisms
> available for the different OSes.   It might change the design.
>
> Also, what's the timing requirements?   Do you want to know when the
> files get added immediately or can you wait a few seconds, a few
> minutes, or a few hours.   This could also change the design.
>
> Barry Nicholson
>
>
> On 12/14/10 5:36 PM, Marcel Meyer wrote:
> > Hi there,
> >
> > I would like to request your guidance in the following scenario where I
> want
> > to follow OTP conventions:
> > I want to mount a process on a directory that fires an event when files
> get
> > added or deleted.  I thought the API should look like this:
> >
> > fs_watcher:add_handler("/User/marcel/downloads/", pid).
> > fs_watcher:add_handler("/User/john/downloads/", pid).
> >
> > Now I'm thinking that there should be 1 supervisor that keeps a process
> for
> > each folder alive and sends a message to pid every time something happens
> in
> > that folder, so in my example above, there would be 2 processes being
> kept
> > alive.
> >
> > Am I talking about the server/streamer part of the gen_event?
> > Or do I need to roll my own by stitching an app/sup together that manage
> the
> > spawned directory processes?
> >
> > Regards,
> > Marcel
> >
>
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe
>
>

From marcel.meyer  Wed Dec 15 13:17:40 2010
From: marcel.meyer (Marcel Meyer)
Date: Wed, 15 Dec 2010 07:17:40 -0500
Subject: [erlang-questions] gen_event streamer
In-Reply-To: <4D0802CD.3090604@niceng.com>
References:
<4D0802CD.3090604@niceng.com>
Message-ID:

Hi Barry,

It should be able to run on Windows and Linux and the maximum resolution
should be 1 sec.
I have a prototype (non OTP) version that polls the directory with
file:list_dir(Dir). It should also be mentioned that for the most part, the
directory being watch will also be emptied as events get processed, so I
shouldn't run into an issue where there might be millions of files in a
folder which will slow down the polling.

What do you think?

Regards,
Marcel

On Tue, Dec 14, 2010 at 6:50 PM, Barry Nicholson wrote:

> Marcel:
>
> Some further information would be helpful.  Are you going to be doing
> this on unix/linux/windows?  What OS?   There are different mechanisms
> available for the different OSes.   It might change the design.
>
> Also, what's the timing requirements?   Do you want to know when the
> files get added immediately or can you wait a few seconds, a few
> minutes, or a few hours.   This could also change the design.
>
> Barry Nicholson
>
>
> On 12/14/10 5:36 PM, Marcel Meyer wrote:
> > Hi there,
> >
> > I would like to request your guidance in the following scenario where I
> want
> > to follow OTP conventions:
> > I want to mount a process on a directory that fires an event when files
> get
> > added or deleted.  I thought the API should look like this:
> >
> > fs_watcher:add_handler("/User/marcel/downloads/", pid).
> > fs_watcher:add_handler("/User/john/downloads/", pid).
> >
> > Now I'm thinking that there should be 1 supervisor that keeps a process
> for
> > each folder alive and sends a message to pid every time something happens
> in
> > that folder, so in my example above, there would be 2 processes being
> kept
> > alive.
> >
> > Am I talking about the server/streamer part of the gen_event?
> > Or do I need to roll my own by stitching an app/sup together that manage
> the
> > spawned directory processes?
> >
> > Regards,
> > Marcel
> >
>
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe
>
>

From avtobiff  Wed Dec 15 15:15:52 2010
From: avtobiff (Per Andersson)
Date: Wed, 15 Dec 2010 15:15:52 +0100
Subject: TCP port sends EXIT message
In-Reply-To:
References:

Message-ID:

Hello!

On Wed, Dec 8, 2010 at 12:22 PM, Per Andersson  wrote:
> What I want to achieve is to connect to the acceptor, send the control message
> and then let the OTHER_FSM continue handling the socket.

I realized that this happened because the acceptor is shutdown after it
calls controlling_process. I, erroneously, thought that controlling_process
would actually transfer all control and ownership of the socket to a new
process. This does not seem to be the case, the docs state only that the
new owner will receive messages.

So, on to my next question then. Is it possible to transfer a socket
between processes, keeping it alive if the previous owner dies?

Best,
Per

From seb  Wed Dec 15 15:29:16 2010
From: seb (Sebastian Strollo)
Date: Wed, 15 Dec 2010 15:29:16 +0100
Subject: Dialyzer success type question
Message-ID: <4D08D0BC.9040703@tail-f.com>

Hi

Apologizes for quoting Kostis out of context,

On 12/6/10 8:56 , Kostis Sagonas wrote:
...
> Yes. As you see, dialyzer is not only smart but is also quite sensitive!
> If it ever feels neglected for too long, it has a very effective way of
> letting you know that you should never do that again ;-)

Not only that, it seems to suffer from mood swings between releases :-)

We offer up our code to Dialyzers scrutiny several times a day, and are
happy to do so. However when upgrading to R14B01 we ran into a bit of
problem with Dialyzers concept of success typing, as it seems to have
changed in R14B01?

Here is a minimal example of my problem, with two modules, first:

-module(m1).
-export([do_something/0]).
do_something() ->
io:format("doing something...\n", []),
m2:fail(true, "Failed: ...\n", []).

and the other module:

-module(m2).
-export([fail/3]).
fail(HaltP, Fmt, Args) ->
io:format(standard_error, Fmt, Args),
case HaltP of
true ->
erlang:halt(1);
false ->
ok
end.

Now, if I kindly ask dialyzer to analyze this I get:

m1.erl:3: Function do_something/0 has no local return

Which I expect, and I can turn it off if I wish by using -Wno_return (or
spec:ing that I know it doesn't return). However, I also get:

m1.erl:5: The call m2:fail('true',"Failed: ...\n",[]) will never
return since it differs in the 1st argument from the success typing
arguments: ('false',atom() | binary() | [any()],[any()])

Which is a problem, since there is no way for me to turn it off, also it
seems a bit inconsistent, if I change the case clause in fail/3 to:

case HaltP of
true ->
erlang:halt(1);
_ ->
ok
end.

I do not get the above message (even though I guess dialyzer could
figure out that the "success typing" is "anything *but* true:-). It
doesn't seem to help to spec me out of this, even if I spec my intent by:

-spec fail(boolean(), string(), [any()]) -> 'ok' | no_return().

I still get the complaint (as long as I have 'false' in the case clause).

Any hints on how I can appease dialyzer and let it know that I don't
expect my fail function to return when I tell it not to?

Thanks,

/Sebastian

--
Sebastian Strollo / seb
Tail-f Systems   / www.tail-f.com

From kostis  Wed Dec 15 16:47:28 2010
From: kostis (Kostis Sagonas)
Date: Wed, 15 Dec 2010 17:47:28 +0200
Subject: [erlang-questions] Dialyzer success type question
In-Reply-To: <4D08D0BC.9040703@tail-f.com>
References: <4D08D0BC.9040703@tail-f.com>
Message-ID: <4D08E310.107@cs.ntua.gr>

Sebastian Strollo wrote:
> Hi
>
> Apologizes for quoting Kostis out of context,

No problem! First of all, for a researcher it's always nice to be cited,
but independently of this, your post is very interesting. Hence the
long reply.

> On 12/6/10 8:56 , Kostis Sagonas wrote:
> ...
>  > Yes. As you see, dialyzer is not only smart but is also quite sensitive!
>  > If it ever feels neglected for too long, it has a very effective way of
>  > letting you know that you should never do that again ;-)
>
> Not only that, it seems to suffer from mood swings between releases :-)

Well, what can I say? dialyzer has a mind of its own and it's certainly
possible that such mood swings can happen, but that's not what's
happening here. Instead, it's just that dialyzer is getting smarter ;-)

Seriously, what's happening is the following. For a long time now we are
aware that dialyzer is occasionally failing to report some warnings.
More specifically, in some cases dialyzer reports that a certain
function has no local return (meaning some call will fail/halt/exit
within its body) but does not report the culprit. When these are calls
to functions that do not have a success typing (i.e., all their paths
are throws, errors, etc.) it's obviously very easy to see the problem,
but in cases where functions return something in some control flow paths
and not in others it can be extremely frustrating to spot the reason for
the no return. We are slowly identifying/fixing these cases so that
warnings are reported in these cases.

Please, do send me cases where no local return warnings are reported
without an obvious reason.

> We offer up our code to Dialyzers scrutiny several times a day, and are
> happy to do so. However when upgrading to R14B01 we ran into a bit of
> problem with Dialyzers concept of success typing, as it seems to have
> changed in R14B01?
>
> Here is a minimal example of my problem, with two modules, first:
>
>   -module(m1).
>   -export([do_something/0]).
>   do_something() ->
>       io:format("doing something...\n", []),
>       m2:fail(true, "Failed: ...\n", []).
>
> and the other module:
>
>   -module(m2).
>   -export([fail/3]).
>   fail(HaltP, Fmt, Args) ->
>       io:format(standard_error, Fmt, Args),
>       case HaltP of
>           true ->
>               erlang:halt(1);
>           false ->
>               ok
>       end.
>
> Now, if I kindly ask dialyzer to analyze this I get:
>
>   m1.erl:3: Function do_something/0 has no local return
>
> Which I expect, and I can turn it off if I wish by using -Wno_return (or
> spec:ing that I know it doesn't return). However, I also get:
>
>   m1.erl:5: The call m2:fail('true',"Failed: ...\n",[]) will never
> return since it differs in the 1st argument from the success typing
> arguments: ('false',atom() | binary() | [any()],[any()])
>
> Which is a problem, since there is no way for me to turn it off, also it
> seems a bit inconsistent, if I change the case clause in fail/3 to:
>
>     case HaltP of
>         true ->
>             erlang:halt(1);
>         _ ->
>             ok
>     end.
>
> I do not get the above message (even though I guess dialyzer could
> figure out that the "success typing" is "anything *but* true:-).

Aside: you are very much right in this, but dialyzer does not have a
notion of "negative types", at least not yet.

> It doesn't seem to help to spec me out of this, even if I spec my intent by:
>
> -spec fail(boolean(), string(), [any()]) -> 'ok' | no_return().
>
> I still get the complaint (as long as I have 'false' in the case clause).
>
> Any hints on how I can appease dialyzer and let it know that I don't
> expect my fail function to return when I tell it not to?

Before I answer your question, allow me one more comment regarding the
spec. The return type 'ok' | no_return() does not make much sense. (It
is anyway equivalent to 'ok'.) Also, as you can see, in this case
dialyzer *knows* that this function will only return given 'false' in
its first argument, so putting boolean() in the spec will not fool dialyzer.

Here is what you can do. Of course I do not know the big picture of your
application, but to me it does not make much sense to have a hard-coded
'true' in the first argument of the call to this function.

I would instead create these two functions:

fail_and_halt(Fmt, Args) ->
io:format(standard_error, Fmt, Args),
erlang:halt(1).

fail_no_halt(Fmt, Args) ->
io:format(standard_error, Fmt, Args),
ok.

in the m2 module and change the call m2:fail(true, "Failed: ...\n", [])
to read m2:fail_and_halt("Failed: ...\n", []) instead. Now there is no
call to a function that sometimes returns (i.e. has a success typing)
and sometimes doesn't.

Kostis

From attila.r.nohl  Wed Dec 15 17:06:54 2010
From: attila.r.nohl (Attila Rajmund Nohl)
Date: Wed, 15 Dec 2010 17:06:54 +0100
Subject: To name a function
Message-ID:

Hello!

I've found at least places in my code where I'd need a function which
decides if all, some or none members of a list have a particular
property (the list always has at least one element). How to name this
function? The code is something like this:

f(_F, []) ->
erlang:error({badarg, []});

f(F, L) ->
{Has, Not} =
lists:foldr(
fun(E, {H, N}) ->
case f(E) of
true -> {H+1, N};
false -> {H, N+1}
end
end, {0,0}, L),
case {Has, Not} of
{0, _} -> none;
{_, 0} -> all;
_ -> some
end.

From gordon  Wed Dec 15 17:12:57 2010
From: gordon (Gordon Guthrie)
Date: Wed, 15 Dec 2010 16:12:57 +0000
Subject: [erlang-questions] Dialyzer success type question
In-Reply-To: <4D08E310.107@cs.ntua.gr>
References: <4D08D0BC.9040703@tail-f.com>
<4D08E310.107@cs.ntua.gr>
Message-ID:

Kostis

I am wrestling with dialyzer warnings at the moment.

> specifically, in some cases dialyzer reports that a certain function has no
> local return (meaning some call will fail/halt/exit within its body) but
> does not report the culprit.

With this warning Dialyzer 'seems' to be telling me that some function
calls will always fail, but when I run the actual code it passes...

> When these are calls to functions that do not
> have a success typing (i.e., all their paths are throws, errors, etc.)

Part of the problem is that I don't know what a 'sucess typing' is...

> but in cases where functions return
> something in some control flow paths and not in others it can be extremely
> frustrating to spot the reason for the no return. We are slowly
> identifying/fixing these cases so that warnings are reported in these cases.

> Please, do send me cases where no local return warnings are reported without
> an obvious reason.

I have tried tracking down a couple of these but it tends to get deep
in stack traces...

How much context would you need?

Gordon

On 15 December 2010 15:47, Kostis Sagonas  wrote:
> Sebastian Strollo wrote:
>>
>> Hi
>>
>> Apologizes for quoting Kostis out of context,
>
> No problem! First of all, for a researcher it's always nice to be cited,
> ?but independently of this, your post is very interesting. Hence the long
> reply.
>
>> On 12/6/10 8:56 , Kostis Sagonas wrote:
>> ...
>> ?> Yes. As you see, dialyzer is not only smart but is also quite
>> sensitive!
>> ?> If it ever feels neglected for too long, it has a very effective way of
>> ?> letting you know that you should never do that again ;-)
>>
>> Not only that, it seems to suffer from mood swings between releases :-)
>
> Well, what can I say? dialyzer has a mind of its own and it's certainly
> possible that such mood swings can happen, but that's not what's happening
> here. Instead, it's just that dialyzer is getting smarter ;-)
>
> Seriously, what's happening is the following. For a long time now we are
> aware that dialyzer is occasionally failing to report some warnings. More
> specifically, in some cases dialyzer reports that a certain function has no
> local return (meaning some call will fail/halt/exit within its body) but
> does not report the culprit. When these are calls to functions that do not
> have a success typing (i.e., all their paths are throws, errors, etc.) it's
> obviously very easy to see the problem, but in cases where functions return
> something in some control flow paths and not in others it can be extremely
> frustrating to spot the reason for the no return. We are slowly
> identifying/fixing these cases so that warnings are reported in these cases.
>
> Please, do send me cases where no local return warnings are reported without
> an obvious reason.
>
>> We offer up our code to Dialyzers scrutiny several times a day, and are
>> happy to do so. However when upgrading to R14B01 we ran into a bit of
>> problem with Dialyzers concept of success typing, as it seems to have
>> changed in R14B01?
>>
>> Here is a minimal example of my problem, with two modules, first:
>>
>> ?-module(m1).
>> ?-export([do_something/0]).
>> ?do_something() ->
>> ? ? ?io:format("doing something...\n", []),
>> ? ? ?m2:fail(true, "Failed: ...\n", []).
>>
>> and the other module:
>>
>> ?-module(m2).
>> ?-export([fail/3]).
>> ?fail(HaltP, Fmt, Args) ->
>> ? ? ?io:format(standard_error, Fmt, Args),
>> ? ? ?case HaltP of
>> ? ? ? ? ?true ->
>> ? ? ? ? ? ? ?erlang:halt(1);
>> ? ? ? ? ?false ->
>> ? ? ? ? ? ? ?ok
>> ? ? ?end.
>>
>> Now, if I kindly ask dialyzer to analyze this I get:
>>
>> ?m1.erl:3: Function do_something/0 has no local return
>>
>> Which I expect, and I can turn it off if I wish by using -Wno_return (or
>> spec:ing that I know it doesn't return). However, I also get:
>>
>> ?m1.erl:5: The call m2:fail('true',"Failed: ...\n",[]) will never return
>> since it differs in the 1st argument from the success typing arguments:
>> ('false',atom() | binary() | [any()],[any()])
>>
>> Which is a problem, since there is no way for me to turn it off, also it
>> seems a bit inconsistent, if I change the case clause in fail/3 to:
>>
>> ? ?case HaltP of
>> ? ? ? ?true ->
>> ? ? ? ? ? ?erlang:halt(1);
>> ? ? ? ?_ ->
>> ? ? ? ? ? ?ok
>> ? ?end.
>>
>> I do not get the above message (even though I guess dialyzer could figure
>> out that the "success typing" is "anything *but* true:-).
>
> Aside: you are very much right in this, but dialyzer does not have a notion
> of "negative types", at least not yet.
>
>> It doesn't seem to help to spec me out of this, even if I spec my intent
>> by:
>>
>> -spec fail(boolean(), string(), [any()]) -> 'ok' | no_return().
>>
>> I still get the complaint (as long as I have 'false' in the case clause).
>>
>> Any hints on how I can appease dialyzer and let it know that I don't
>> expect my fail function to return when I tell it not to?
>
> Before I answer your question, allow me one more comment regarding the spec.
> The return type 'ok' | no_return() does not make much sense. (It is anyway
> equivalent to 'ok'.) Also, as you can see, in this case dialyzer *knows*
> that this function will only return given 'false' in its first argument, so
> putting boolean() in the spec will not fool dialyzer.
>
>
> Here is what you can do. Of course I do not know the big picture of your
> application, but to me it does not make much sense to have a hard-coded
> 'true' in the first argument of the call to this function.
>
> I would instead create these two functions:
>
> ?fail_and_halt(Fmt, Args) ->
> ? ? ?io:format(standard_error, Fmt, Args),
> ? ? ?erlang:halt(1).
>
> ?fail_no_halt(Fmt, Args) ->
> ? ? ?io:format(standard_error, Fmt, Args),
> ? ? ?ok.
>
> in the m2 module and change the call m2:fail(true, "Failed: ...\n", []) to
> read m2:fail_and_halt("Failed: ...\n", []) instead. Now there is no call to
> a function that sometimes returns (i.e. has a success typing) and sometimes
> doesn't.
>
>
> Kostis
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe
>
>

--
Gordon Guthrie
CEO hypernumbers

http://hypernumbers.com
t: hypernumbers
+44 7776 251669

From rzezeski  Wed Dec 15 17:54:17 2010
From: rzezeski (Ryan Zezeski)
Date: Wed, 15 Dec 2010 11:54:17 -0500
Subject: [erlang-questions] To name a function
In-Reply-To:
References:
Message-ID:

On Wed, Dec 15, 2010 at 11:06 AM, Attila Rajmund Nohl <
attila.r.nohl> wrote:

> Hello!
>
> I've found at least places in my code where I'd need a function which
> decides if all, some or none members of a list have a particular
> property (the list always has at least one element). How to name this
> function? The code is something like this:
>
> f(_F, []) ->
>  erlang:error({badarg, []});
>
> f(F, L) ->
>  {Has, Not} =
>    lists:foldr(
>      fun(E, {H, N}) ->
>        case f(E) of
>          true -> {H+1, N};
>          false -> {H, N+1}
>        end
>      end, {0,0}, L),
>  case {Has, Not} of
>    {0, _} -> none;
>    {_, 0} -> all;
>    _ -> some
>  end.
>
>
Well, I wouldn't give it any style points but I came up with all_some_none.
Also, instead of using fold you could make use of lists:all/2 and
lists:filter/2.

%% BEGIN CODE
-module(funs).

-compile(export_all).

all_some_none(F, L) when length(L) > 0 ->
case lists:all(F, L) of
true ->
all;
false ->
case lists:filter(F, L) of
[] ->
none;
_ ->
some
end
end.

even(N) ->
N rem 2 =:= 0.

one(1) ->
true;
one(_) ->
false.

odd(N) ->
N rem 2 =:= 1.
%%END CODE

1> c(funs).
{ok,funs}
2> L = [1,1,1,1].
[1,1,1,1]
3> funs:all_some_none(fun funs:even/1, L).
none
4> funs:all_some_none(fun funs:odd/1, L).
all
5> funs:all_some_none(fun funs:one/1, L).
all
6> L2 = [1,2,3,4].
[1,2,3,4]
7> funs:all_some_none(fun funs:even/1, L2).
some
8> funs:all_some_none(fun funs:odd/1, L2).
some
9> funs:all_some_none(fun funs:one/1, L2).
some

-Ryan

From attila.r.nohl  Wed Dec 15 18:13:29 2010
From: attila.r.nohl (Attila Rajmund Nohl)
Date: Wed, 15 Dec 2010 18:13:29 +0100
Subject: [erlang-questions] To name a function
In-Reply-To:
References:

Message-ID:

2010/12/15, Ryan Zezeski :
> On Wed, Dec 15, 2010 at 11:06 AM, Attila Rajmund Nohl <
> attila.r.nohl> wrote:
>
>> Hello!
>>
>> I've found at least places in my code where I'd need a function which
>> decides if all, some or none members of a list have a particular
>> property (the list always has at least one element). How to name this
>> function? The code is something like this:
>>
>> f(_F, []) ->
>>  erlang:error({badarg, []});
>>
>> f(F, L) ->
>>  {Has, Not} =
>>    lists:foldr(
>>      fun(E, {H, N}) ->
>>        case f(E) of
>>          true -> {H+1, N};
>>          false -> {H, N+1}
>>        end
>>      end, {0,0}, L),
>>  case {Has, Not} of
>>    {0, _} -> none;
>>    {_, 0} -> all;
>>    _ -> some
>>  end.
>>
>>
> Well, I wouldn't give it any style points but I came up with all_some_none.
>  Also, instead of using fold you could make use of lists:all/2 and
> lists:filter/2.

I could, but that would traverse the list twice (with the length()
guard three times). I don't expect the lists I'm using this function
on to have more than 2000 elements, so on contemporary hardware this
difference is probably not noticeable.

From matthias  Wed Dec 15 21:00:15 2010
From: matthias (Matthias Lang)
Date: Wed, 15 Dec 2010 21:00:15 +0100
Subject: [erlang-questions] Re: TCP port sends EXIT message
In-Reply-To:
References:

Message-ID: <20101215200015.GA2777@corelatus.se>

On Wednesday, December 15, Per Andersson wrote:

> I realized that this happened because the acceptor is shutdown after it
> calls controlling_process. I, erroneously, thought that controlling_process
> would actually transfer all control and ownership of the socket to a new
> process. This does not seem to be the case, the docs state only that the
> new owner will receive messages.

gen_tcp:controlling_process() transfers both "control" (who receives
messages) and "ownership" (which process is linked to the port).

I took a guess at what you were trying to do and wrote a minimal,
self-contained example that compiles. The socket does not die
when the process which originally owned it died:

-module(per_a).
-export([go/0]).

go() ->
erlang:process_flag(trap_exit, true),
{ok, L} = gen_tcp:listen(5555, [{active, false}, {reuseaddr, true}]),
spawn(fun connect/0),
Self = self(),
Acceptor_pid = spawn_link(fun() -> acceptor(L, Self) end),
receive
{Acceptor_pid, Socket} ->
exit(Acceptor_pid, kill),
receive
{'EXIT', Acceptor_pid, _} -> ok
end,
io:fwrite("This process is ~p\n", [self()]),
io:fwrite("The acceptor pid, ~p is now dead (process_info=~p)\n",
[Acceptor_pid, erlang:process_info(Acceptor_pid)]),
io:fwrite("The socket is still alive (port_info=~p)\n",
[erlang:port_info(Socket)]),
{ok, Data} = gen_tcp:recv(Socket, 0),
io:fwrite("Here's some freshly received socket data: ~p\n", [Data]),
gen_tcp:close(Socket),
gen_tcp:close(L)
end.

connect() ->
{ok, S} = gen_tcp:connect(localhost, 5555, []),
ok = gen_tcp:send(S, "hello world\n"),
Ref = make_ref(), receive Ref -> done end. % hang forever

acceptor(L, Parent) ->
{ok, S} = gen_tcp:accept(L),
ok = gen_tcp:controlling_process(S, Parent),
Parent ! {self(), S},
Ref = make_ref(), receive Ref -> done end. % hang forever

--------------------
Here's the output:

| 2> per_a:go().
| This process is <0.31.0>
| The acceptor pid, <0.39.0> is now dead (process_info=undefined)
| The socket is still alive (port_info=[{name,"tcp_inet"},
|                                       {links,[<0.31.0>]},
|                                       {id,2046},
|                                       {connected,<0.31.0>},
|                                       {input,0},
|                                       {output,0}])
| Here's some freshly received socket data: "hello world\n"
|

The question now is: what are you doing differently?  Can you post a
minimal, self-contained example which compiles, runs and demonstrates
the socket dying unexpectedly?

Matt

From bernie  Wed Dec 15 23:53:29 2010
From: bernie (Bernard Duggan)
Date: Thu, 16 Dec 2010 09:53:29 +1100
Subject: [erlang-questions] Dialyzer "no local return" warning for anonymous
functions
In-Reply-To: <4D0885A4.3000402@cs.ntua.gr>
References: <4D0853BC.1020503@m5net.com> <4D0885A4.3000402@cs.ntua.gr>
Message-ID: <4D0946E9.5080804@m5net.com>

On 15/12/10 20:08, Kostis Sagonas wrote:
> Bernard Duggan wrote:
>> As far as I
>> know, though, there's no way to -spec an anonymous function, nor is
>> there any obvious way to make that particular function not anonymous.
> It's too early in the morning for me, but doesn't the following do it?
> (Warning: untested -- I also think the parentheses aroung the fun object
> are not really needed, but perhaps the code is clearer with them)
>
>     validate(A, B) ->
>         try
>             mnesia:transaction((fun my_funky_mnesia_test/2)(A,B))
>         catch
>             exit:{aborted, all_valid} ->  ok;
>             exit:{aborted, Error} ->  {error, Error}
>         end.
>
>     -spec my_funky_mnesia_test(some_t(), another_t()) ->  no_return().
>
>     my_funky_mnesia_test(A, B) ->
>         some_test_db_operations(A, B),
>         mnesia:abort(all_valid).
Indeed that does do it - thank you very much.  It had never occurred to
me that you could call fun objects directly like that.  Of course in
hindsight it's obvious, but then hindsight usually is :)

Cheers,

Beranrd

From ok  Thu Dec 16 00:34:21 2010
From: ok (Richard O'Keefe)
Date: Thu, 16 Dec 2010 12:34:21 +1300
Subject: [erlang-questions] To name a function
In-Reply-To:
References:
Message-ID: <48CE9B76-0007-4866-B4A5-8E77771E64C7@cs.otago.ac.nz>

f(Fun, List) distinguishes four cases:
- the List is Empty
- the List is not empty and Fun(X) is true  for all X in List
- the List is not empty and Fun(X) is false for all X in List
- the list is not empty and Fun(X) is sometimes true and sometimes
false.

My first reaction is that there are two *separate* things going on
here:  counting the trues and falses, and reacting to them.

My second reaction is that I'm used to having something called "count"
that tells me how many elements have a property.

My third reaction is that empty lists are normal.

Put these together, and the first step is to write a function that
accepts a list of _any_ length and returns the counts.  This function
is more generally useful than the one originally shown.

count_true_false(Fun, List)
when is_function(Fun, 1), is_list(List) ->
count_true_false(Fun, List, 0, 0).

count_true_false(_, [], Y, N) ->
{Y, N};
count_true_false(F, [X|Xs], Y, N) ->
case F(X)
of true  -> count_true_false(F, Xs, Y+1, N)
; false -> count_true_false(F, Xs, Y, N+1)
end.

The next step is to classify a count pair.  (The count pair might
have come from something other than walking over a list.)

mixture_class(0, 0) -> empty;
mixture_class(0, _) -> none;
mixture_class(_, 0) -> all;
mixture_class(_, _) -> some.

Now we can get the original function by putting these together.

nonempty_count_class(Fun, List) ->
case mixture_class(count_true_false(Fun, List)
of empty -> erlang:error({badarg,List})
; Other -> Other
end.

The result?  One rather peculiar function and two reusable ones.
Done in one pass with the only memory allocation being one
2-element tuple.

From hynek  Thu Dec 16 00:42:41 2010
From: hynek (Hynek Vychodil)
Date: Thu, 16 Dec 2010 00:42:41 +0100
Subject: [erlang-questions] Dialyzer "no local return" warning for
anonymous functions
In-Reply-To: <4D0946E9.5080804@m5net.com>
References: <4D0853BC.1020503@m5net.com>
<4D0885A4.3000402@cs.ntua.gr>
<4D0946E9.5080804@m5net.com>
Message-ID:

I'm afraid it is not what you are looking for.

-module(funky).

-export([my_funky_mnesia_test/2, test/2, transaction/1]).

test(A, B) ->
try
?MODULE:transaction((fun my_funky_mnesia_test/2)(A,B))
catch
exit:{aborted, all_valid} ->  ok;
exit:{aborted, Error} ->  {error, Error}
end.

transaction(T) ->
io:format("Start transaction.~n", []),
T(),
io:format("End transaction.~n", []).

my_funky_mnesia_test(A, B) ->
io:format("Inside Transaction (~p,~p)~n", [A, B]),
mnesia:abort(all_valid).

---8<-------------------->8---

1> c(funky).
{ok,funky}
2> funky:test(foo, bar).
Inside Transaction (foo,bar)
ok

What happen? Execution not even reach calling ?MODULE:transaction/1
because exception is raised when evaluating ?MODULE:transaction/1
parameter. (fun my_funky_mnesia_test/2)(A,B) calls
my_funky_mnesia_test/2 and don't return fun/0 which should be passed
into ?MODULE:transaction/1
Unfortunately correct fun() -> (fun my_funky_mnesia_test/2)(A,B) end
is same as fun() -> my_funky_mnesia_test(A,B) end which obviously
doesn't make Dialyzer happy again. You have to make something like

-spec my_funky_mnesia_test_maker(some_t(), another_t()) ->  fun(()->
no_return()).

my_funky_mnesia_test_maker(A,B) ->
fun() -> my_funky_mnesia_test(A,B) end.

On Wed, Dec 15, 2010 at 11:53 PM, Bernard Duggan  wrote:
> On 15/12/10 20:08, Kostis Sagonas wrote:
>>
>> Bernard Duggan wrote:
>>>
>>> As far as I
>>> know, though, there's no way to -spec an anonymous function, nor is
>>> there any obvious way to make that particular function not anonymous.
>>
>> It's too early in the morning for me, but doesn't the following do it?
>> (Warning: untested -- I also think the parentheses aroung the fun object
>> are not really needed, but perhaps the code is clearer with them)
>>
>> ? ?validate(A, B) ->
>> ? ? ? ?try
>> ? ? ? ? ? ?mnesia:transaction((fun my_funky_mnesia_test/2)(A,B))
>> ? ? ? ?catch
>> ? ? ? ? ? ?exit:{aborted, all_valid} -> ?ok;
>> ? ? ? ? ? ?exit:{aborted, Error} -> ?{error, Error}
>> ? ? ? ?end.
>>
>> ? ?-spec my_funky_mnesia_test(some_t(), another_t()) -> ?no_return().
>>
>> ? ?my_funky_mnesia_test(A, B) ->
>> ? ? ? ?some_test_db_operations(A, B),
>> ? ? ? ?mnesia:abort(all_valid).
>
> Indeed that does do it - thank you very much. ?It had never occurred to me
> that you could call fun objects directly like that. ?Of course in hindsight
> it's obvious, but then hindsight usually is :)
>
> Cheers,
>
> Beranrd
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe
>
>

--
--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 lata  Wed Dec 15 23:43:00 2010
From: lata (=?UTF-8?Q?=41=74=61=6C=20=53=68=61=72=67=6F=72=6F=64=73=6B=79?=)
Date: Thu, 16 Dec 2010 00:43:00 +0200
Subject: =?UTF-8?Q?=52=65=3A=20=52=65=3A=20=5B=65=72=6C=61=6E=67=2D=71=75=65=73=74=69=6F=6E=73=5D=20=54=6F=20=6E=61=6D=65=20=61=20=66=75=6E=63=74=69=6F=6E?=
Message-ID: <1292452980.354000-55192390-14600@walla.com>

An HTML attachment was scrubbed...
URL:

From mk  Thu Dec 16 09:44:29 2010
From: mk (Morten Krogh)
Date: Thu, 16 Dec 2010 09:44:29 +0100
Subject: [erlang-questions] To name a function
In-Reply-To:
References:
Message-ID: <4D09D16D.20900@amberbio.com>

Hi

As soon as you have seen both an element that satisfies the condition
and one that doesn't, you can return "some", making a full list
traversal overkill for many inputs.

Morten.

On 12/15/10 6:13 PM, Attila Rajmund Nohl wrote:
> 2010/12/15, Ryan Zezeski:
>> On Wed, Dec 15, 2010 at 11:06 AM, Attila Rajmund Nohl<
>> attila.r.nohl>  wrote:
>>
>>> Hello!
>>>
>>> I've found at least places in my code where I'd need a function which
>>> decides if all, some or none members of a list have a particular
>>> property (the list always has at least one element). How to name this
>>> function? The code is something like this:
>>>
>>> f(_F, []) ->
>>>   erlang:error({badarg, []});
>>>
>>> f(F, L) ->
>>>   {Has, Not} =
>>>     lists:foldr(
>>>       fun(E, {H, N}) ->
>>>         case f(E) of
>>>           true ->  {H+1, N};
>>>           false ->  {H, N+1}
>>>         end
>>>       end, {0,0}, L),
>>>   case {Has, Not} of
>>>     {0, _} ->  none;
>>>     {_, 0} ->  all;
>>>     _ ->  some
>>>   end.
>>>
>>>
>> Well, I wouldn't give it any style points but I came up with all_some_none.
>>   Also, instead of using fold you could make use of lists:all/2 and
>> lists:filter/2.
> I could, but that would traverse the list twice (with the length()
> guard three times). I don't expect the lists I'm using this function
> on to have more than 2000 elements, so on contemporary hardware this
> difference is probably not noticeable.
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe
>

From raimo+erlang-questions  Thu Dec 16 10:29:55 2010
From: raimo+erlang-questions (Raimo Niskanen)
Date: Thu, 16 Dec 2010 10:29:55 +0100
Subject: [erlang-questions] To name a function
In-Reply-To: <4D09D16D.20900@amberbio.com>
References:    <4D09D16D.20900@amberbio.com>
Message-ID: <20101216092955.GA8921@erix.ericsson.se>

On Thu, Dec 16, 2010 at 09:44:29AM +0100, Morten Krogh wrote:
> Hi
>
> As soon as you have seen both an element that satisfies the condition
> and one that doesn't, you can return "some", making a full list
> traversal overkill for many inputs.

To support that idea (regardless of what this thread is about,
I am just throwing in an observation), if you have to traverse
a list once - you have linear speed complexity; O(N).

If you instead do it twice this does not change, you just
get a constant factor speed degradation.

If you (sub- ?) optimize by traversing the list once but do
more work by building intermediate results of which most
are uninteresting - you stress the garbage collector
which makes the speed complexity harder to determine.
You probably get anything from a large constant factor speed
degradation to even O(N*log(N)) .. O(N*N).

Therefore it is often a good idea to first traverse the list
without building garbage to decide if you can skip the term building
traversal entirely, unless it is obvious this rarely happens.

>
> Morten.
>
> On 12/15/10 6:13 PM, Attila Rajmund Nohl wrote:
> >2010/12/15, Ryan Zezeski:
> >>On Wed, Dec 15, 2010 at 11:06 AM, Attila Rajmund Nohl<
> >>attila.r.nohl>  wrote:
> >>
> >>>Hello!
> >>>
> >>>I've found at least places in my code where I'd need a function which
> >>>decides if all, some or none members of a list have a particular
> >>>property (the list always has at least one element). How to name this
> >>>function? The code is something like this:
> >>>
> >>>f(_F, []) ->
> >>>  erlang:error({badarg, []});
> >>>
> >>>f(F, L) ->
> >>>  {Has, Not} =
> >>>    lists:foldr(
> >>>      fun(E, {H, N}) ->
> >>>        case f(E) of
> >>>          true ->  {H+1, N};
> >>>          false ->  {H, N+1}
> >>>        end
> >>>      end, {0,0}, L),
> >>>  case {Has, Not} of
> >>>    {0, _} ->  none;
> >>>    {_, 0} ->  all;
> >>>    _ ->  some
> >>>  end.
> >>>
> >>>
> >>Well, I wouldn't give it any style points but I came up with
> >>all_some_none.
> >>  Also, instead of using fold you could make use of lists:all/2 and
> >>lists:filter/2.
> >I could, but that would traverse the list twice (with the length()
> >guard three times). I don't expect the lists I'm using this function
> >on to have more than 2000 elements, so on contemporary hardware this
> >difference is probably not noticeable.
> >
> >________________________________________________________________
> >erlang-questions (at) erlang.org mailing list.
> >See http://www.erlang.org/faq.html
> >To unsubscribe; mailto:erlang-questions-unsubscribe
> >
>
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe

--

/ Raimo Niskanen, Erlang/OTP, Ericsson AB

From jakobce  Thu Dec 16 11:12:10 2010
From: jakobce (Jakob Cederlund)
Date: Thu, 16 Dec 2010 11:12:10 +0100
Subject: [erlang-questions] To name a function
In-Reply-To: <20101216092955.GA8921@erix.ericsson.se>
References:

<4D09D16D.20900@amberbio.com>
<20101216092955.GA8921@erix.ericsson.se>
Message-ID:

categorize(L, F) when is_list(L), is_function(F, 1) ->

categorize(L, F, empty).

categorize([], _F, V) ->

V;

categorize([E | Rest], F, empty) ->

categorize(Rest, F, F(E));

categorize([E | Rest], F, V) ->

case F(E) of

V -> categorize(Rest, F, V);

_ -> some

end.

O(N), no building, no double traversing, quite readable too...

2010/12/16 Raimo Niskanen

>

> On Thu, Dec 16, 2010 at 09:44:29AM +0100, Morten Krogh wrote:
> > Hi
> >
> > As soon as you have seen both an element that satisfies the condition
> > and one that doesn't, you can return "some", making a full list
> > traversal overkill for many inputs.
>
> To support that idea (regardless of what this thread is about,
> I am just throwing in an observation), if you have to traverse
> a list once - you have linear speed complexity; O(N).
>
> If you instead do it twice this does not change, you just
> get a constant factor speed degradation.
>
> If you (sub- ?) optimize by traversing the list once but do
> more work by building intermediate results of which most
> are uninteresting - you stress the garbage collector
> which makes the speed complexity harder to determine.
> You probably get anything from a large constant factor speed
> degradation to even O(N*log(N)) .. O(N*N).
>
> Therefore it is often a good idea to first traverse the list
> without building garbage to decide if you can skip the term building
> traversal entirely, unless it is obvious this rarely happens.
>
> >
> > Morten.
> >
> > On 12/15/10 6:13 PM, Attila Rajmund Nohl wrote:
> > >2010/12/15, Ryan Zezeski:
> > >>On Wed, Dec 15, 2010 at 11:06 AM, Attila Rajmund Nohl<
> > >>attila.r.nohl>  wrote:
> > >>
> > >>>Hello!
> > >>>
> > >>>I've found at least places in my code where I'd need a function which
> > >>>decides if all, some or none members of a list have a particular
> > >>>property (the list always has at least one element). How to name this
> > >>>function? The code is something like this:
> > >>>
> > >>>f(_F, []) ->
> > >>>  erlang:error({badarg, []});
> > >>>
> > >>>f(F, L) ->
> > >>>  {Has, Not} =
> > >>>    lists:foldr(
> > >>>      fun(E, {H, N}) ->
> > >>>        case f(E) of
> > >>>          true ->  {H+1, N};
> > >>>          false ->  {H, N+1}
> > >>>        end
> > >>>      end, {0,0}, L),
> > >>>  case {Has, Not} of
> > >>>    {0, _} ->  none;
> > >>>    {_, 0} ->  all;
> > >>>    _ ->  some
> > >>>  end.
> > >>>
> > >>>
> > >>Well, I wouldn't give it any style points but I came up with
> > >>all_some_none.
> > >>  Also, instead of using fold you could make use of lists:all/2 and
> > >>lists:filter/2.
> > >I could, but that would traverse the list twice (with the length()
> > >guard three times). I don't expect the lists I'm using this function
> > >on to have more than 2000 elements, so on contemporary hardware this
> > >difference is probably not noticeable.
> > >
> > >________________________________________________________________
> > >erlang-questions (at) erlang.org mailing list.
> > >See http://www.erlang.org/faq.html
> > >To unsubscribe; mailto:erlang-questions-unsubscribe
> > >
> >
> >
> > ________________________________________________________________
> > erlang-questions (at) erlang.org mailing list.
> > See http://www.erlang.org/faq.html
> > To unsubscribe; mailto:erlang-questions-unsubscribe
>
> --
>
> / Raimo Niskanen, Erlang/OTP, Ericsson AB
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe
>
>

From attila.r.nohl  Thu Dec 16 11:28:32 2010
From: attila.r.nohl (Attila Rajmund Nohl)
Date: Thu, 16 Dec 2010 11:28:32 +0100
Subject: [erlang-questions] To name a function
In-Reply-To: <20101216092955.GA8921@erix.ericsson.se>
References:

<4D09D16D.20900@amberbio.com>
<20101216092955.GA8921@erix.ericsson.se>
Message-ID:

2010/12/16, Raimo Niskanen :
> On Thu, Dec 16, 2010 at 09:44:29AM +0100, Morten Krogh wrote:
>> Hi
>>
>> As soon as you have seen both an element that satisfies the condition
>> and one that doesn't, you can return "some", making a full list
>> traversal overkill for many inputs.
>
> To support that idea (regardless of what this thread is about,
> I am just throwing in an observation), if you have to traverse
> a list once - you have linear speed complexity; O(N).
>
> If you instead do it twice this does not change, you just
> get a constant factor speed degradation.
>
> If you (sub- ?) optimize by traversing the list once but do
> more work by building intermediate results of which most
> are uninteresting - you stress the garbage collector
> which makes the speed complexity harder to determine.
> You probably get anything from a large constant factor speed
> degradation to even O(N*log(N)) .. O(N*N).
>
> Therefore it is often a good idea to first traverse the list
> without building garbage to decide if you can skip the term building
> traversal entirely, unless it is obvious this rarely happens.

That probably explains why was the "traverse the list 3 times" faster
for smaller lists than the "traverse the list only once"...

From attila.r.nohl  Thu Dec 16 11:31:06 2010
From: attila.r.nohl (Attila Rajmund Nohl)
Date: Thu, 16 Dec 2010 11:31:06 +0100
Subject: [erlang-questions] To name a function
In-Reply-To: <4D09D16D.20900@amberbio.com>
References:

<4D09D16D.20900@amberbio.com>
Message-ID:

2010/12/16, Morten Krogh :
> Hi
>
> As soon as you have seen both an element that satisfies the condition
> and one that doesn't, you can return "some", making a full list
> traversal overkill for many inputs.

Now that's a good idea:

has_property(Fun, [E | Rest]) ->
has_property(Fun, Fun(E), Rest).

has_property(_Fun, Prev, []) ->
case Prev of
true -> all;
false -> none
end;

has_property(Fun, Prev, [E | Rest]) ->
Curr = Fun(E),
case Curr of
Prev -> has_property(Fun, Prev, Rest);
_ -> some
end.

From joelr1  Thu Dec 16 11:43:41 2010
From: joelr1 (Joel Reymont)
Date: Thu, 16 Dec 2010 10:43:41 +0000
Subject: append to a memory-mapped file
Message-ID: <79FE94A2-2429-4A95-932B-2A2BEBE0A3C2@gmail.com>

Is there a way to append to a mmap-ed file such that appended data is available in the memory mapping?

Yes, I plan to make the memory-mapped region available as a binary.

I understand that I can just open and mmap the file again but that seems rather wasteful when appending 8 bytes at a time which is what I'll be doing.

Thanks, Joel

---
http://twitter.com/wagerlabs

From max.lapshin  Thu Dec 16 11:50:24 2010
From: max.lapshin (Max Lapshin)
Date: Thu, 16 Dec 2010 13:50:24 +0300
Subject: [erlang-questions] append to a memory-mapped file
In-Reply-To: <79FE94A2-2429-4A95-932B-2A2BEBE0A3C2@gmail.com>
References: <79FE94A2-2429-4A95-932B-2A2BEBE0A3C2@gmail.com>
Message-ID:

On Thu, Dec 16, 2010 at 1:43 PM, Joel Reymont  wrote:
> Is there a way to append to a mmap-ed file such that appended data is available in the memory mapping?
>
> Yes, I plan to make the memory-mapped region available as a binary.
>
> I understand that I can just open and mmap the file again but that seems rather wasteful when appending 8 bytes at a time which is what I'll be doing.
>

Add proper nif functions that will not only create you mmaped file but
also write to it.

From olopierpa  Thu Dec 16 11:57:10 2010
From: olopierpa (Pierpaolo Bernardi)
Date: Thu, 16 Dec 2010 11:57:10 +0100
Subject: [erlang-questions] To name a function
In-Reply-To:
References:

<4D09D16D.20900@amberbio.com>

Message-ID:

Here's my try (not tested).
It scans the list once, stops early, and all the hard work is made by
library functions!

categorize(P, [X|Xs]) ->
case P(X) of
true ->
case lists:all(P, Xs) of
true -> all
false -> some
end
false ->
case lists:any(P, Xs) of
true -> some
false -> none
end
end.

Cheers
P.

From joelr1  Thu Dec 16 12:06:55 2010
From: joelr1 (Joel Reymont)
Date: Thu, 16 Dec 2010 11:06:55 +0000
Subject: [erlang-questions] append to a memory-mapped file
In-Reply-To:
References: <79FE94A2-2429-4A95-932B-2A2BEBE0A3C2@gmail.com>
Message-ID: <312AE4A8-2C70-4099-A7AC-9D1556C0F789@gmail.com>

Max,

On Dec 16, 2010, at 10:50 AM, Max Lapshin wrote:

> On Thu, Dec 16, 2010 at 1:43 PM, Joel Reymont  wrote:
>> Is there a way to append to a mmap-ed file such that appended data is available in the memory mapping?
>
> Add proper nif functions that will not only create you mmaped file but
> also write to it.

That's not my question.

---
http://twitter.com/wagerlabs

From max.lapshin  Thu Dec 16 12:24:49 2010
From: max.lapshin (Max Lapshin)
Date: Thu, 16 Dec 2010 14:24:49 +0300
Subject: [erlang-questions] append to a memory-mapped file
In-Reply-To: <312AE4A8-2C70-4099-A7AC-9D1556C0F789@gmail.com>
References: <79FE94A2-2429-4A95-932B-2A2BEBE0A3C2@gmail.com>

<312AE4A8-2C70-4099-A7AC-9D1556C0F789@gmail.com>
Message-ID:

On Thu, Dec 16, 2010 at 2:06 PM, Joel Reymont  wrote:

>
> That's not my question.
>

Why?

You must mmap more data, file will be larged and you can write there.

From joelr1  Thu Dec 16 12:26:53 2010
From: joelr1 (Joel Reymont)
Date: Thu, 16 Dec 2010 11:26:53 +0000
Subject: [erlang-questions] append to a memory-mapped file
In-Reply-To:
References: <79FE94A2-2429-4A95-932B-2A2BEBE0A3C2@gmail.com>  <312AE4A8-2C70-4099-A7AC-9D1556C0F789@gmail.com>
Message-ID: <043A4373-4769-4A1B-82DE-9FE4ACAE44E0@gmail.com>

On Dec 16, 2010, at 11:24 AM, Max Lapshin wrote:

> You must mmap more data, file will be larged and you can write there.

I'll rephrase my original question then:

What is the most efficient way to extend the memory mapping to include data appended to the same file?

Alternatively, what's the most efficient way to make newly appended data available as part of the memory mapping?

Thanks, Joel

---
http://twitter.com/wagerlabs

From mk  Thu Dec 16 12:31:54 2010
From: mk (Morten Krogh)
Date: Thu, 16 Dec 2010 12:31:54 +0100
Subject: [erlang-questions] append to a memory-mapped file
In-Reply-To: <79FE94A2-2429-4A95-932B-2A2BEBE0A3C2@gmail.com>
References: <79FE94A2-2429-4A95-932B-2A2BEBE0A3C2@gmail.com>
Message-ID: <4D09F8AA.7090509@amberbio.com>

Hi

What about keeping variables with the file size, the size of your data,
and then when you want to append beyond the end of the file,
you ftruncate and mmap again. The ftruncate should be with much more
than 8 bytes of course. It is like mallocing much more than you need,
such that most
append operations are cheap. The file will then have the wrong size in
the file system. So when your process finishes, you should ftruncate
again to the final size.
If it crashes before that, then ??
You could use a marker in the file (zero byte?) to indicate the end and
use for crash recovery.

Morten.

On 12/16/10 11:43 AM, Joel Reymont wrote:
> Is there a way to append to a mmap-ed file such that appended data is available in the memory mapping?
>
> Yes, I plan to make the memory-mapped region available as a binary.
>
> I understand that I can just open and mmap the file again but that seems rather wasteful when appending 8 bytes at a time which is what I'll be doing.
>
> 	Thanks, Joel
>
> ---
> http://twitter.com/wagerlabs
>
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe
>

From joelr1  Thu Dec 16 12:36:35 2010
From: joelr1 (Joel Reymont)
Date: Thu, 16 Dec 2010 11:36:35 +0000
Subject: [erlang-questions] append to a memory-mapped file
In-Reply-To: <4D09F8AA.7090509@amberbio.com>
References: <79FE94A2-2429-4A95-932B-2A2BEBE0A3C2@gmail.com> <4D09F8AA.7090509@amberbio.com>
Message-ID:

Morten,

On Dec 16, 2010, at 11:31 AM, Morten Krogh wrote:

> What about keeping variables with the file size, the size of your data, and then when you want to append beyond the end of the file, you ftruncate and mmap again. The ftruncate should be with much more than 8 bytes of course.

You are suggesting pre-allocating a file and writing to a specific position rather than appending to the end, correct?

Thanks, Joel

---
http://twitter.com/wagerlabs

From max.lapshin  Thu Dec 16 12:55:53 2010
From: max.lapshin (Max Lapshin)
Date: Thu, 16 Dec 2010 14:55:53 +0300
Subject: [erlang-questions] append to a memory-mapped file
In-Reply-To:
References: <79FE94A2-2429-4A95-932B-2A2BEBE0A3C2@gmail.com>
<4D09F8AA.7090509@amberbio.com>

Message-ID:

Maybe syscall mremap will help you to enlarge mmaped file?

From joelr1  Thu Dec 16 12:57:39 2010
From: joelr1 (Joel Reymont)
Date: Thu, 16 Dec 2010 11:57:39 +0000
Subject: [erlang-questions] append to a memory-mapped file
In-Reply-To:
References: <79FE94A2-2429-4A95-932B-2A2BEBE0A3C2@gmail.com> <4D09F8AA.7090509@amberbio.com>
Message-ID:

On Dec 16, 2010, at 11:55 AM, Max Lapshin wrote:

> Maybe syscall mremap will help you to enlarge mmaped file?

I'll look into it. There's no mremap on Mac OSX, though.

---
http://twitter.com/wagerlabs

From max.lapshin  Thu Dec 16 12:59:53 2010
From: max.lapshin (Max Lapshin)
Date: Thu, 16 Dec 2010 14:59:53 +0300
Subject: [erlang-questions] append to a memory-mapped file
In-Reply-To:
References: <79FE94A2-2429-4A95-932B-2A2BEBE0A3C2@gmail.com>
<4D09F8AA.7090509@amberbio.com>

Message-ID:

On Thu, Dec 16, 2010 at 2:57 PM, Joel Reymont  wrote:
>
> On Dec 16, 2010, at 11:55 AM, Max Lapshin wrote:
>
>> Maybe syscall mremap will help you to enlarge mmaped file?
>
> I'll look into it. There's no mremap on Mac OSX, though.
>

So, mmap + munmap (exactly this sequence not to loose memory).

From david.almroth  Thu Dec 16 13:28:51 2010
From: david.almroth (David Almroth)
Date: Thu, 16 Dec 2010 13:28:51 +0100
Subject: Do I need sasl to log crashes in the gen_server init function ?
Message-ID:

My problem, for a while, has been to be able to detect crashes in the init
functions in my gen_servers.
If my erlang code crashes in the init function the error (the stacktrace)
has been invisible unless I have started sasl.

Is it true that starting sasl is the only way to catch the crasches?

And if sasl is the only solution, should I use it in my production
environment?
Is there any arguments against using sasl in a production environment?

/David
+46 - 70 - 417 46 10
Skype: david.almroth

From max.lapshin  Thu Dec 16 13:33:52 2010
From: max.lapshin (Max Lapshin)
Date: Thu, 16 Dec 2010 15:33:52 +0300
Subject: [erlang-questions] Do I need sasl to log crashes in the
gen_server init function ?
In-Reply-To:
References:
Message-ID:

On Thu, Dec 16, 2010 at 3:28 PM, David Almroth
wrote:
> And if sasl is the only solution, should I use it in my production
> environment?
> Is there any arguments against using sasl in a production environment?

You should use it.
The only thing I want to add that if you have gen_servers with really
large state, default logger may kill your system.

From andy.kriger  Thu Dec 16 13:44:15 2010
From: andy.kriger (Andy Kriger)
Date: Thu, 16 Dec 2010 07:44:15 -0500
Subject: starting OTP applications?
Message-ID:

There appear to be many ways to start applications used by an OTP
application....
* From the supervisor, setup child processes (Webmachine's does this
in the template it creates for a new WM app).
* From the application, call application:start on related applications
via some kind of ensure_started function
* Reltool, which I don't even partially grok, appears to setup scripts
based on a config file and is responsible for starting related
applications (?)
* Have I missed any?

Is there a preferred way to do this that applies to both applications
& releases equally?

(I say equally, because I ran into problems getting my application
which runs locally from a start script to work as a release - it
appeared that the application's start or start_link function that I
use to setup my database was never called, meaning the tables were not
automagically craeted on first run - mind you, we're talking PEBCAK
here because I'm still learning how all this works and undoubtably
don't understand fully the order of things in the script that reltool
created).

--
Be well,
andy

Welcome to http://householder-yogi.net
On family, NYC, and practicing yoga.

From david.almroth  Thu Dec 16 14:06:03 2010
From: david.almroth (David Almroth)
Date: Thu, 16 Dec 2010 14:06:03 +0100
Subject: [erlang-questions] Do I need sasl to log crashes in the
gen_server init function ?
In-Reply-To:
References:

Message-ID:

Ok.

And thank you for the warning. My states are very small, so there is no
danger.

/David
+46 - 70 - 417 46 10
Skype: david.almroth

2010/12/16 Max Lapshin

> On Thu, Dec 16, 2010 at 3:28 PM, David Almroth
>  wrote:
> > And if sasl is the only solution, should I use it in my production
> > environment?
> > Is there any arguments against using sasl in a production environment?
>
> You should use it.
> The only thing I want to add that if you have gen_servers with really
> large state, default logger may kill your system.
>

From spawn.think  Thu Dec 16 14:24:12 2010
From: spawn.think (Ahmed Omar)
Date: Thu, 16 Dec 2010 14:24:12 +0100
Subject: [erlang-questions] Do I need sasl to log crashes in the
gen_server init function ?
In-Reply-To:
References:

Message-ID:

Another way to see the actual exception in shell , is to start your
gen_server directly from there.
But in production, you will probably start it the proper way under a
supervision tree, and using the application controller so you better have
sasl running.

2> application:start(myapp).
{error,{shutdown,{myapp_app,start,[normal,[]]}}}
3>
=INFO REPORT==== 16-Dec-2010::14:21:55 ===
application: myapp
exited: {shutdown,{myapp_app,start,[normal,[]]}}
type: temporary

3> test:start_link().
** exception exit: {badmatch,false}
in function  test:init/1
in call from gen_server:init_it/6
in call from proc_lib:init_p_do_apply/3

On Thu, Dec 16, 2010 at 2:06 PM, David Almroth
wrote:

> Ok.
>
> And thank you for the warning. My states are very small, so there is no
> danger.
>
>
> /David
> +46 - 70 - 417 46 10
> Skype: david.almroth
>
>
>
> 2010/12/16 Max Lapshin
>
> > On Thu, Dec 16, 2010 at 3:28 PM, David Almroth
> >  wrote:
> > > And if sasl is the only solution, should I use it in my production
> > > environment?
> > > Is there any arguments against using sasl in a production environment?
> >
> > You should use it.
> > The only thing I want to add that if you have gen_servers with really
> > large state, default logger may kill your system.
> >
>

--
Best Regards,
- Ahmed Omar
http://nl.linkedin.com/in/adiaa
Follow me on twitter
@spawn_think

From minaev  Thu Dec 16 14:31:55 2010
From: minaev (Dmitri Minaev)
Date: Thu, 16 Dec 2010 16:31:55 +0300
Subject: Cannot unload module from remote shell
In-Reply-To:
References:
Message-ID:

On Wed, Dec 15, 2010 at 2:00 PM, Dmitri Minaev  wrote:

>
> So, I loaded my functions into a running instance of RabbitMQ. Of course,
> my module is still there when I detach and reattach to  the same node. But
> why the module is still loaded when I restart Erlang?
>

For what it's worth, killing epmd and removing /var/lib/rabbitmq/mnesia/*
changed nothing. The module is still available. However, purging and
reinstalling rabbitmq, did the trick :)

code:delete/1 unloads the module (is_loaded returns false), but any call of
the functions from that module results in it being loaded again. So, does
Erlang cache the content of the loaded modules?  How does it get reloaded
when the files are removed?

--
With best regards,
Dmitri Minaev

From B.Candler  Thu Dec 16 15:01:26 2010
From: B.Candler (Brian Candler)
Date: Thu, 16 Dec 2010 14:01:26 +0000
Subject: Dialyzer "no local return" warning for anonymous functions
Message-ID: <20101216140126.GA8910@talktalkplc.com>

I'm no expert and don't have R14B01 around to test it, but would something
like this would work?

-spec no_return(fun()) -> fun(()->no_return()).
no_return(F) ->
fun() -> F() end.

test(A, B) ->
try
?MODULE:transaction(no_return(fun () -> my_funky_mnesia_test(A,B) end))
catch
exit:{aborted, all_valid} ->  ok;
exit:{aborted, Error} ->  {error, Error}
end.

(and maybe you could macro it out in production?)

From hynek  Thu Dec 16 15:06:24 2010
From: hynek (Hynek Vychodil)
Date: Thu, 16 Dec 2010 15:06:24 +0100
Subject: [erlang-questions] Re: Cannot unload module from remote shell
In-Reply-To:
References:

Message-ID:

Are you sure you are restarted Erlang? I'm not sure but I think
RabbitMQ using one Erlang node for server and another for
administration. You probably restarted administration node but not
server.

On Thu, Dec 16, 2010 at 2:31 PM, Dmitri Minaev  wrote:
> On Wed, Dec 15, 2010 at 2:00 PM, Dmitri Minaev  wrote:
>
>>
>> So, I loaded my functions into a running instance of RabbitMQ. Of course,
>> my module is still there when I detach and reattach to ?the same node. But
>> why the module is still loaded when I restart Erlang?
>>
>
> For what it's worth, killing epmd and removing /var/lib/rabbitmq/mnesia/*
> changed nothing. The module is still available. However, purging and
> reinstalling rabbitmq, did the trick :)
>
> code:delete/1 unloads the module (is_loaded returns false), but any call of
> the functions from that module results in it being loaded again. So, does
> Erlang cache the content of the loaded modules? ?How does it get reloaded
> when the files are removed?
>
> --
> With best regards,
> Dmitri Minaev
>

--
--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 B.Candler  Thu Dec 16 15:50:24 2010
From: B.Candler (Brian Candler)
Date: Thu, 16 Dec 2010 14:50:24 +0000
Subject: Dialyzer "no local return" warning for anonymous functions
In-Reply-To: <20101216140126.GA8910@talktalkplc.com>
References: <20101216140126.GA8910@talktalkplc.com>
Message-ID: <20101216145024.GA9307@talktalkplc.com>

Or even this??

-spec no_return(fun()) -> fun(()->no_return()).
no_return(F) -> F.

...
?MODULE:transaction(no_return(fun () -> my_funky_mnesia_test(A,B) end))

(Sorry, again untested. I'm only now discovering that dialyzer doesn't work
in Ubuntu because they stripped the debug_info out...)

From dmercer  Thu Dec 16 16:06:46 2010
From: dmercer (David Mercer)
Date: Thu, 16 Dec 2010 09:06:46 -0600
Subject: [erlang-questions] To name a function
In-Reply-To:
References:    <4D09D16D.20900@amberbio.com>
Message-ID: <001101cb9d32\$dc6c45c0\$9544d140\$@com>

On Thursday, December 16, 2010, Attila Rajmund Nohl wrote:

> 2010/12/16, Morten Krogh :
> > As soon as you have seen both an element that satisfies the condition
> > and one that doesn't, you can return "some", making a full list
> > traversal overkill for many inputs.
>
> Now that's a good idea:
>
> has_property(Fun, [E | Rest]) ->
>     has_property(Fun, Fun(E), Rest).
>
> has_property(_Fun, Prev, []) ->
>     case Prev of
> 	true -> all;
> 	false -> none
>     end;
>
> has_property(Fun, Prev, [E | Rest]) ->
>     Curr = Fun(E),
>     case Curr of
> 	Prev -> has_property(Fun, Prev, Rest);
> 	_ -> some
>     end.

I was thinking a throw would be appropriate for the early-out:

has_property(F, L) ->
catch lists:foldl(fun(X, Stat) -> case {F(X), Stat} of
{true, empty} -> all;
{true, all} -> all;
{true, none} -> throw(some);
{false, empty} -> none;
{false, all} -> throw(some);
{false, none} -> none
end
end,
empty, L).

From demeshchuk  Thu Dec 16 17:02:24 2010
From: demeshchuk (Dmitry Demeshchuk)
Date: Thu, 16 Dec 2010 19:02:24 +0300
Subject: Where's ssl_base64?
Message-ID:

Looks like it's removed from the new ssl which is a bit upsetting. Is
it done on a purpose or it's considered deprecated now? Are there any
new alternatives for it?

AFAIK, we were using it only in our unit tests but I at least need to
know if I should use some other library for it or just move
ssl_base64.erl to our sources.

Thank you.

--
Best regards,
Dmitry Demeshchuk

From matthias  Thu Dec 16 17:18:07 2010
From: matthias (Matthias Lang)
Date: Thu, 16 Dec 2010 17:18:07 +0100
Subject: [erlang-questions] Re: Cannot unload module from remote shell
In-Reply-To:
References:

Message-ID: <20101216161807.GA6300@corelatus.se>

On Thursday, December 16, Dmitri Minaev wrote:

> code:delete/1 unloads the module (is_loaded returns false), but any call of
> the functions from that module results in it being loaded again. So, does
> Erlang cache the content of the loaded modules?

No, it doesn't.

> How does it get reloaded when the files are removed?

It shouldn't. This is unexpected. Either something strange is going on
or you've made a mistake.

> It looks like Erlang saves its image before exiting and reloads it
> when starting again (a behavior one might expect from a Lisp
> system), but I am not certain if this functionality is even
> available in Erlang.

Erlang doesn't have an "image" of the sort you describe.

You can investigate the problem a bit by using the 'code' module. In
particular, try calling

code:which(dmitrys_module)

and see what is says (you need to replace 'dmitrys_module' with
whatever your module is really called) . Then you might also want to
look at

code:get_path()

says. After doing that, you should have a pretty good idea of
where the code is coming from.

About the only wildcard in all of this is that rabbitmq might be doing
something weird and unexpected. If that were the case, I would have hoped
that the rabbitmq people would have piped up and said something by now ;-)

Matt

From ingela.andin  Thu Dec 16 17:18:54 2010
From: ingela.andin (Ingela Andin)
Date: Thu, 16 Dec 2010 17:18:54 +0100
Subject: [erlang-questions] Where's ssl_base64?
In-Reply-To:
References:
Message-ID:

Hi!

Lots of our applications had their own bas64-encoders, so we decided
so time back now to
put base64-encoding where it should have been in the first place in stdlib.

So use the module base64 in stdlib.

Regards Ingela Erlang/OTP team - Ericsson AB

2010/12/16 Dmitry Demeshchuk :
> Looks like it's removed from the new ssl which is a bit upsetting. Is
> it done on a purpose or it's considered deprecated now? Are there any
> new alternatives for it?
>
> AFAIK, we were using it only in our unit tests but I at least need to
> know if I should use some other library for it or just move
> ssl_base64.erl to our sources.
>
> Thank you.
>
> --
> Best regards,
> Dmitry Demeshchuk
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe
>
>

From raimo+erlang-questions  Thu Dec 16 17:50:28 2010
From: raimo+erlang-questions (Raimo Niskanen)
Date: Thu, 16 Dec 2010 17:50:28 +0100
Subject: [erlang-questions] To name a function
In-Reply-To: <001101cb9d32\$dc6c45c0\$9544d140\$@com>
References:    <4D09D16D.20900@amberbio.com>  <001101cb9d32\$dc6c45c0\$9544d140\$@com>
Message-ID: <20101216165028.GA20980@erix.ericsson.se>

On Thu, Dec 16, 2010 at 09:06:46AM -0600, David Mercer wrote:
> On Thursday, December 16, 2010, Attila Rajmund Nohl wrote:
>
> > 2010/12/16, Morten Krogh :
> > > As soon as you have seen both an element that satisfies the condition
> > > and one that doesn't, you can return "some", making a full list
> > > traversal overkill for many inputs.
> >
> > Now that's a good idea:
> >
> > has_property(Fun, [E | Rest]) ->
> >     has_property(Fun, Fun(E), Rest).
> >
> > has_property(_Fun, Prev, []) ->
> >     case Prev of
> > 	true -> all;
> > 	false -> none
> >     end;
> >
> > has_property(Fun, Prev, [E | Rest]) ->
> >     Curr = Fun(E),
> >     case Curr of
> > 	Prev -> has_property(Fun, Prev, Rest);
> > 	_ -> some
> >     end.
>
> I was thinking a throw would be appropriate for the early-out:
>
> has_property(F, L) ->
> 	catch lists:foldl(fun(X, Stat) -> case {F(X), Stat} of
> 	                                  	{true, empty} -> all;
> 	                                  	{true, all} -> all;
> 	                                  	{true, none} -> throw(some);
> 	                                  	{false, empty} -> none;
> 	                                  	{false, all} -> throw(some);
> 	                                  	{false, none} -> none
> 	                                  end
> 	                  end,
> 	                  empty, L).

Preparing a catch and cleaning up is more expensive than just returning a
value. Here is a shorter variant (also not tested) of Pierpaolo Bernardi's
suggestion, returning true | false | ambivalent.

categorize(P, []) when is_function(P, 1) ->
ambivalent;
categorize(P, [X|Xs]) ->
case P(X) of
true ->
lists:all(P, Xs) orelse ambivalent;
false ->
lists:any(P, Xs) andalso ambivalent;
end.

With these return values Attila Rajmund Nohl's suggestion also gets shorter:

categorize(P, []) when is_function(P, 1) ->
ambivalent;
categorize(P, [X|Xs]) ->
case P(X) of
Bool when is_boolean(Bool) ->
categorize(P, Xs, P(X))
end.

categorize(P, [], Bool) ->
Bool;
categorize(P, [X|Xs], Bool) ->
case P(X) of
Bool ->
categorize(P, Xs, Bool);
Other when is_boolean(Other) ->
ambivalent
end.

Also not tested.

>
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe

--

/ Raimo Niskanen, Erlang/OTP, Ericsson AB

From comptekki  Thu Dec 16 20:08:20 2010
From: comptekki (Wes James)
Date: Thu, 16 Dec 2010 12:08:20 -0700
Subject: print \t (tab) to stdout
Message-ID:

I was looking at

http://www.erlang.org/doc/man/io.html#format-1

to see if there is a way to output a \t or tab to stdout.  How is this
done?  When I put it in like this:

[io:format("#\tif i==~w:~n",[Value]) || Value <- lists:seq(2501,70100,2500)].

it puts 7 spaces in for the \t on the console.

thx,

-wes

From jesper.louis.andersen  Thu Dec 16 20:13:35 2010
From: jesper.louis.andersen (Jesper Louis Andersen)
Date: Thu, 16 Dec 2010 20:13:35 +0100
Subject: [erlang-questions] print \t (tab) to stdout
In-Reply-To:
References:
Message-ID:

On Thu, Dec 16, 2010 at 20:08, Wes James  wrote:
> I was looking at
>
> http://www.erlang.org/doc/man/io.html#format-1
>
> to see if there is a way to output a \t or tab to stdout. ?How is this
> done? ?When I put it in like this:
>
> [io:format("#\tif i==~w:~n",[Value]) || Value <- lists:seq(2501,70100,2500)].
>
> it puts 7 spaces in for the \t on the console.

See the ~c parameter and 'man ascii'.

--
J.

From joel.meyer  Thu Dec 16 23:20:28 2010
From: joel.meyer (Joel Meyer)
Date: Thu, 16 Dec 2010 14:20:28 -0800
Subject: [erlang-questions] append to a memory-mapped file
In-Reply-To:
References: <79FE94A2-2429-4A95-932B-2A2BEBE0A3C2@gmail.com>
<4D09F8AA.7090509@amberbio.com>

Message-ID:

On Thu, Dec 16, 2010 at 3:36 AM, Joel Reymont  wrote:

> Morten,
>
> On Dec 16, 2010, at 11:31 AM, Morten Krogh wrote:
>
> > What about keeping variables with the file size, the size of your data,
> and then when you want to append beyond the end of the file, you ftruncate
> and mmap again. The ftruncate should be with much more than 8 bytes of
> course.
>
> You are suggesting pre-allocating a file and writing to a specific position
> rather than appending to the end, correct?
>

I'm using this strategy for a simple time-series data DB written in C (with
port driver for access from Erlang). It works well enough. I've also
considered having each additional pre-allocated slab be in its own mmap'ed
region* so I don't have to munmap and mmap the entire region every time I
grow. So far pre-allocating works well enough that the occasional
lock/ftruncate/munmap/mmap/unlock hiccup doesn't really affect performance.

Joel

*The mmap region will most likely not line-up exactly with your
pre-allocated (via ftruncate) file chunks since you may want to write M
bytes at index K when only C are available - in this case you'd ftruncate a
large chunk and mmap at index K so you don't have to stitch together a read
from two different mmap'ed regions. Reads may no longer be constant time
since you may have to look at meta-data for N mmap regions to determine
which you should read from.

>        Thanks, Joel
>
> ---
> http://twitter.com/wagerlabs
>
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe
>
>

From joel.meyer  Thu Dec 16 23:27:31 2010
From: joel.meyer (Joel Meyer)
Date: Thu, 16 Dec 2010 14:27:31 -0800
Subject: [erlang-questions] append to a memory-mapped file
In-Reply-To:
References: <79FE94A2-2429-4A95-932B-2A2BEBE0A3C2@gmail.com>
<4D09F8AA.7090509@amberbio.com>

Message-ID:

On Thu, Dec 16, 2010 at 3:59 AM, Max Lapshin  wrote:

> On Thu, Dec 16, 2010 at 2:57 PM, Joel Reymont  wrote:
> >
> > On Dec 16, 2010, at 11:55 AM, Max Lapshin wrote:
> >
> >> Maybe syscall mremap will help you to enlarge mmaped file?
> >
> > I'll look into it. There's no mremap on Mac OSX, though.
> >
>
> So, mmap + munmap (exactly this sequence not to loose memory).

That assumes you're only reading from the mmap'ed region and don't need to
worry about running out of available address space for mmap'ing (not sure
how much the OS makes available for this). in my case I typically: lock +
msync + mmunmap + mmap + unlock to guarantee that the data is consistent and
release the address space that was in use before requesting another (larger)
region.

> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe
>
>

From igorrs  Fri Dec 17 01:42:15 2010
From: igorrs (Igor Ribeiro Sucupira)
Date: Thu, 16 Dec 2010 22:42:15 -0200
Subject: Changing the cookie in a running system
Message-ID:

Hi.

I am planning to change the cookie on a running Erlang pool (by
calling erlang:set_cookie/2 via RPC on all nodes).
Does that procedure create any communication problems between the
nodes, while the cookie is being changed?

I believe the cookie is only used when the nodes connect to each other
for the first time, so that changing it later should be safe. Am I
correct?

Thanks!
Igor.

P.S.: I'm not worried about stored cookies and what will happen
whenever any node is restarted or added to the pool (we'll deal with
that). I am interested in what happens when erlang:set_cookie/2 is
called in a node that is already in the pool.

--
"The secret of joy in work is contained in one word - excellence. To
know how to do something well is to enjoy it." - Pearl S. Buck.

From ok  Fri Dec 17 02:11:39 2010
From: ok (Richard O'Keefe)
Date: Fri, 17 Dec 2010 14:11:39 +1300
Subject: [erlang-questions] print \t (tab) to stdout
In-Reply-To:
References:
Message-ID:

On 17/12/2010, at 8:13 AM, Jesper Louis Andersen wrote:
> See the ~c parameter and 'man ascii'.

There was nothing wrong with the original format.
The problem is that tab characters are expanded when
written to the console.

From luismarianoguerra  Fri Dec 17 03:25:41 2010
From: luismarianoguerra (Mariano Guerra)
Date: Thu, 16 Dec 2010 23:25:41 -0300
Subject: announcing fnt - jquery-like templates for the erlang platform
Message-ID:

About fnt - efene templates

first the most important, fnt code is hosted at github here:

https://github.com/marianoguerra/fnt---efene-templates

the documentation is here:

http://marianoguerra.com.ar/fnt/

you are invited to contribute by testing it, reporting bugs, improving
the documentation, spreading the word and the most awesome of all, by
helping with the development.

fnt (efene templates) is an erlang module that allows to compile text
templates into erlang modules to be used in the erlang platform
(erlang, efene, reia, LFE, etc.)

fnt uses the syntax of jquery templates , this has several advantages,
first you have to learn only one template syntax for server and client
side templates, second you can reuse the templates to create server
and client generated pages, to improve page crawling by search engines
and provide non javascript versions of your site without duplicating
effort. Also, you have the benefit of more documentation and examples
of the template syntax.

fnt templates are compiled into bytecode, you get fast page generation
since the template is translated into an optimized function that
avoids string concatenations.

your next step should be following the fnt tutorial:
http://marianoguerra.com.ar/fnt/tutorial.html

Frequently Asked Questions

why the name if it?s written in erlang?

I don?t want to push efene as a forced dependency to everyone wanting
to use fnt in languages like erlang, reia and LFE.

also because it will be in the efene standard library and I?m really
bad at names ;)

that said efene is awesome so go and check it out!

license?

BSD

more resources

* Website and documentation: http://marianoguerra.com.ar/fnt
* Tutorial: http://marianoguerra.com.ar/fnt/tutorial.html
* Blog: http://efene.tumblr.com
* Central git repo: http://github.com/marianoguerra/fnt---efene-templates

From ok  Fri Dec 17 03:55:44 2010
From: ok (Richard O'Keefe)
Date: Fri, 17 Dec 2010 15:55:44 +1300
Subject: [erlang-questions] To name a function
In-Reply-To: <4D09D16D.20900@amberbio.com>
References: 	  <4D09D16D.20900@amberbio.com>
Message-ID:

On 16/12/2010, at 9:44 PM, Morten Krogh wrote:

> Hi
>
> As soon as you have seen both an element that satisfies the condition and one that doesn't, you can return "some", making a full list traversal overkill for many inputs.

Note however that this changes the semantics.
If F(E) raises an exception in itself or answers something other than 'true'
or 'false', you will lose the exception if you stop before E.
If F(E) has a side effect, stopping early will lose some of the side effects.

I'm not saying that these are necessarily bad things, but that you shouldn't
lose exceptions or side effects *by accident*.

Let's just consider two functions, prod_full/1, which multiplies all the
elements of a list, and prod_zero/1, which stops when it finds a zero.

prod_full(L) ->
prod_full(L, 1).

prod_full([], P) ->
P;
prod_full([X|Xs], P) ->
prod_full(Xs, P*X).

prod_zero(L) ->
prod_zero(L, 1).

prod_zero([], P) ->
P;
prod_zero([X|Xs], P) ->
P1 = P*X,
if P1 == 0 -> P1
; true    -> prod_zero(Xs, P1)
end.

Leaving aside such things as
prod_full([0,x]) is an error
but prod_zero([0,x]) is 0,
the two functions don't always return the same type:
prod_full([0,1.2]) is 0.0
but prod_zero([0,1.2]) is 0.

Again, I'm not saying "don't do this", I'm saying KNOW what you're doing.

From alain.odea  Fri Dec 17 04:40:06 2010
From: alain.odea (Alain O'Dea)
Date: Fri, 17 Dec 2010 00:10:06 -0330
Subject: [erlang-questions] announcing fnt - jquery-like templates for the
erlang platform
In-Reply-To:
References:
Message-ID:

On Thursday, December 16, 2010, Mariano Guerra
wrote:
> About fnt - efene templates
>
> first the most important, fnt code is hosted at github here:
>
> https://github.com/marianoguerra/fnt---efene-templates
>
> the documentation is here:
>
> http://marianoguerra.com.ar/fnt/
>
> you are invited to contribute by testing it, reporting bugs, improving
> the documentation, spreading the word and the most awesome of all, by
> helping with the development.
>
> fnt (efene templates) is an erlang module that allows to compile text
> templates into erlang modules to be used in the erlang platform
> (erlang, efene, reia, LFE, etc.)
>
> fnt uses the syntax of jquery templates , this has several advantages,
> first you have to learn only one template syntax for server and client
> side templates, second you can reuse the templates to create server
> and client generated pages, to improve page crawling by search engines
> and provide non javascript versions of your site without duplicating
> effort. Also, you have the benefit of more documentation and examples
> of the template syntax.
>
> fnt templates are compiled into bytecode, you get fast page generation
> since the template is translated into an optimized function that
> avoids string concatenations.
>
> your next step should be following the fnt tutorial:
> http://marianoguerra.com.ar/fnt/tutorial.html
>
> Frequently Asked Questions
>
> why the name if it?s written in erlang?
>
> I don?t want to push efene as a forced dependency to everyone wanting
> to use fnt in languages like erlang, reia and LFE.
>
> also because it will be in the efene standard library and I?m really
> bad at names ;)
>
> that said efene is awesome so go and check it out!
>
> license?
>
> BSD
>
> more resources
>
>  ? ?* Website and documentation: http://marianoguerra.com.ar/fnt
>  ? ?* Tutorial: http://marianoguerra.com.ar/fnt/tutorial.html
>  ? ?* Blog: http://efene.tumblr.com
>  ? ?* Central git repo: http://github.com/marianoguerra/fnt---efene-templates
>

FNT looks really cool Mariano!  I am looking forward to trying it out.
Generating callable modules with a friendly API from templates is
awesome :)

From ebegumisa  Fri Dec 17 07:00:13 2010
From: ebegumisa (Edmond Begumisa)
Date: Fri, 17 Dec 2010 17:00:13 +1100
Subject: [erlang-questions] Speaking of comments
In-Reply-To: <20101213145624.GA17922@erix.ericsson.se>
References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz>  <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> <00a601cb96e5\$c12d74d0\$43885e70\$@com>   <20101213145624.GA17922@erix.ericsson.se>
Message-ID:

On Tue, 14 Dec 2010 01:56:24 +1100, Raimo Niskanen
wrote:

> On Mon, Dec 13, 2010 at 02:04:36PM +0530, Banibrata Dutta wrote:
>> On Wed, Dec 8, 2010 at 8:45 PM, Edmond Begumisa
>> > > wrote:
>>
>> > I've thought -- now and then, in the back of my mind -- about removing
>> > comments from actual source all-together (for all languages) and
>> instead,
>> > putting them in companion files that the editor lines up
>> side-by-side. More
>> > like annotating than just traditional commenting.
>> >
>> >
>> It's an interesting thought, as it removes clutter -- especially so for
>> a
>> programmer who is already well versed with the code.
>> Most modern editors have features allowing the view to show all comments
>> collapsed, expanded, and some even done so selectively.
>>
>>
>> > Has this sort of thing been done before? Is there a particular editor
>> that
>> > can give me this out of the box? (I admittedly haven't explored a
>> large
>> > number of editors)
>> >
>> > Using Erlang as an example, I've secretly wanted something like...
>> >
>> > foo.erl
>> > foo.cts
>> >
>
> Many moons ago at Ericsson there was a hiearchical editor named Exco
> used.
> Its concept was that you write your code as a specification where each
> heading could be expanded into sub-headings, and at the leaf level
> was the source code. Then you pre-processed your Exco document to
> extract the leaf level, to compile.
>

Sounds painful. But then, I've never been one for specs (I've never worked
on humongous projects.)

> While editing you expanded/compressed headlines (highlited)
> with simple keystrokes.
>
> This was in the 24x80 VAX and early Unix days, so side-by-side
> panels would have been futile, and color coding was green only.
>
> It would nevertheless be another possibility for your editor suggestion.
> Preprocess the readable document to get the source code.

Ahh, is see. Work backwards. Extract the source from the markup rather
than the markup from the source. Interesting approach.

It might make source-control a bit tricky though since most tools interact
at the file level (you normally want to know what changes were made to
each source file.) Hmmmm... possibly one could commit only the result of
the preprocessing and not the original mashed documents.

> You could even
> use a specialized comment style in .erl files to get a .erl file that
> displays fine in your special editor yet is readable by itself.
>

Yes, this is an option. Why do I suspect it might be easier for editors to
implement this using two different files? Especially if it's a feature
being tacked on-top of existing code.

For example, if a line is added in the middle of a function, you want a
corresponding change to the annotation. Also, for graphical editors, the
annotation/comment file could be loaded separately into a separate widget
with different features (e.g For Komodo Edit, Mozilla's html editor widget
could come in handy here while the actual source would remain in the
scintilla source-editor widget.)

- Edmond -

>>
>> Challenge would be to ensure 100% (fail-proof) lock-step update of the
>> .erl
>> and .cts files in VCS... ideally triggered from a single command.
>>
>>
>> > Then an editor that could give me two panes while keeping the two
>> files in
>> > sync...
>> >
>> > foo ->  | This function does...
>> >  blah  |   This part is buggy...
>> >  balh  |
>> >
>> > Also, in the right pane, I've wanted nestable trees with flexible
>> levels of
>> > detail. Heck, why not even rich text? "FIX ME" in bold red. Take it
>> further:
>> > login-name awareness, source-control/bug-tracker integration (this
>> > programmer said this, that programmer said that.)
>> >
>> > It seems a shame that in 2010, it's still so limiting what we can do
>> with
>> > comments in our source code!
>> >
>> > - Edmond -
>> >
>> > On Thu, 09 Dec 2010 01:39:42 +1100, David Mercer
>> > wrote:
>> >
>> >  On Tuesday, December 07, 2010, Richard O'Keefe wrote:
>> >>
>> >>  Nesting comments are one of those clever ideas
>> >>> that turn out to be really dumb, because they don't actually work.
>> >>>
>> >>
>> >> I'll bite, mainly because I've sometimes thought nesting comments
>> would be
>> >> helpful, for instance, when commenting out large blocks of code, but
>> it is
>> >> rare that I get to work with a language that supports them.  Since
>> you're
>> >> almost always right about such things, why do you say that they don't
>> >> actually work?
>> >>
>> >> Cheers,
>> >>
>> >> David
>> >>
>> >>
>> >>
>

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

From ebegumisa  Fri Dec 17 07:02:05 2010
From: ebegumisa (Edmond Begumisa)
Date: Fri, 17 Dec 2010 17:02:05 +1100
Subject: [erlang-questions] Speaking of comments
In-Reply-To:
References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz>  <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> <00a601cb96e5\$c12d74d0\$43885e70\$@com>
Message-ID:

"collaborative [source] editor"

Many things are popping into my head at the same time!

- Edmond -

On Tue, 14 Dec 2010 02:19:05 +1100, Jesper Louis Andersen
wrote:

> On Mon, Dec 13, 2010 at 8:19 AM, Edmond Begumisa
>  wrote:
>
>> I don't know about using non-ASCII for actual source-code as the author
>> suggests. I'm not a language designer so I have no opinion this (though
>> in
>> relation to this, I've sometimes wondered about alternatives to
>> programing
>> languages revolving around English -- it must really irritate
>> non-English
>> speakers, especially those coming from languages using non-latin
>> alphabets.)
>
> If anyone is serious about moving from a ASCII/UTF8 text
> representation of programs to something else, *now* is the time to
> act. One reason I hate Java with a passion is that the language is
> outright impossible to write in Vim or Emacs. You need IDE integration
> which severely limits your options. In other words, you are not free
> to pick your weapon of choice, but must choose something utterly
> inferior like bent spoon or broken stick. Succinctness is power before
> it gives you freedom to choose the weapon.
>
> However, most of the weapons we use, be it vim or emacs, are rather
> old and this hampers the format by which they can accept code. The
> only way to break that problem is the appearance of a disruptive
> technology which shuns the norm for something new. In this technology
> you can write a collaborative text editor on the web and hopefully
> make it as powerful, or more powerful, than emacs or vim. And only
> then will there be a new weapon to wield - breaking the text-stream
> input norm of programming languages.
>
> And somehow, even with the emerging new devices and systems, I doubt
> there is a chance it will happen despite.
>

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

From ebegumisa  Fri Dec 17 07:06:42 2010
From: ebegumisa (Edmond Begumisa)
Date: Fri, 17 Dec 2010 17:06:42 +1100
Subject: [erlang-questions] Speaking of comments
In-Reply-To: <2BFD8069-41A9-4688-8CF4-A8938A89F53E@masklinn.net>
References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz>  <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> <00a601cb96e5\$c12d74d0\$43885e70\$@com>   <20101213145624.GA17922@erix.ericsson.se>  <2BFD8069-41A9-4688-8CF4-A8938A89F53E@masklinn.net>
Message-ID:

On Tue, 14 Dec 2010 02:32:02 +1100, Masklinn  wrote:

> On 2010-12-13, at 16:08 , I?aki Garay wrote:
>>>> On Wed, Dec 8, 2010 at 8:45 PM, Edmond Begumisa
>>>> >>>> wrote:
>>>>
>>>>> I've thought -- now and then, in the back of my mind -- about
>>>>> removing
>>>>> comments from actual source all-together (for all languages) and
>>>>> instead,
>>>>> putting them in companion files that the editor lines up
>>>>> side-by-side. More
>>>>> like annotating than just traditional commenting.
>> It was my understanding that this is called literate programming, as
>> envisioned by Knuth, although he includes the comment markup in the
>> same file as the code, and uses a preprocessor to extract either the
>> documentation or the code.
>> Knuth's original program was for C and is called CWEB.
> That's exactly the reverse of literate programming: literate programming
> puts prose first and code second (so instead of marking up the comments,
> you mark up the code).
>
> Knuth's own WEB (and CWEB) is extremely complex (out-of-order with macro
> expansions and hypertext references) and rather unlike usual program
> writing, a simpler literate idea can be found in Literate Haskell (lhs)
> where lines of code are prefixed (with `> `) and everything else is
> comment, yielding rather interesting executable documents.
>
> Python also has something similar (though extremely reduced in scope) in
> its "doctests": code lines are prefixed with 4 spaces and sequentially
> executed, everything else is non-executable text. Doctests can be used
> either in docstrings (documentary comments, providing executable
> examples in the APIDoc) or as free-standing documents (documentation,
> papers, etc?).
>
> The core idea stays the same: the core idea of literate programming is
> that the modules are first and foremost used to communicate with humans
> via prose, and the code is the second-class citizen.
>
> As to edmond's idea of having code and comments side-by-side, he might
> be rather interested in Pycco [0] which produces literate-style
> documentation.

Pycco this looks nice. Rendering wise, it's very close to what I had in
mind.

> Though it's a generator (it extracts and formats comments within the
> source file) it does produce something similar to what was described,
> and it seems to be erlang-compatible.

Yes, that's the difference. It would be good to have this kind of thing
available while editing and not have to go through a generation step.

- Edmond -

> [0] http://fitzgen.github.com/pycco/
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe
>

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

From ebegumisa  Fri Dec 17 07:14:41 2010
From: ebegumisa (Edmond Begumisa)
Date: Fri, 17 Dec 2010 17:14:41 +1100
Subject: [erlang-questions] Speaking of comments
In-Reply-To: <3EA0B90D-7320-42C7-823C-BF82EF31EAF2@erlang-solutions.com>
References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz>  <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> <00a601cb96e5\$c12d74d0\$43885e70\$@com>   <20101213145624.GA17922@erix.ericsson.se>  <2BFD8069-41A9-4688-8CF4-A8938A89F53E@masklinn.net> <3EA0B90D-7320-42C7-823C-BF82EF31EAF2@erlang-solutions.com>
Message-ID:

"I noticed that it changes the way you look at your code"

Intriguing revelation.

Maybe an editor that enabled you to write the comments without having to
write markup could help spread the use of such tools.

- Edmond -

On Tue, 14 Dec 2010 03:20:06 +1100, Ulf Wiger
wrote:

>
> On 13 Dec 2010, at 16:32, Masklinn wrote:
>
>> Knuth's own WEB (and CWEB) is extremely complex (out-of-order with
>> macro expansions and hypertext references) and rather unlike usual
>> program writing, a simpler literate idea can be found in Literate
>> Haskell (lhs) where lines of code are prefixed (with `> `) and
>> everything else is comment, yielding rather interesting executable
>> documents.
>>
>> Python also has something similar (though extremely reduced in scope)
>> in its "doctests": code lines are prefixed with 4 spaces and
>> sequentially executed, everything else is non-executable text. Doctests
>> can be used either in docstrings (documentary comments, providing
>> executable examples in the APIDoc) or as free-standing documents
>> (documentation, papers, etc?).
>
>
> http://github.com/uwiger/erl2latex was inspired by a script John Hughes
> used to convert erlang source to PDF via LaTEX.
>
> Some form of documentation, eating my own dog food, can be found in:
> https://github.com/uwiger/erl2latex/raw/master/doc/erl2latex.pdf
>
> It got a bit more complex than I had originally intended, since I wanted
> it
> to do a fair job on legacy code. This introduced all sorts of escaping
> issues.
>
> It was really interesting to work with this, since I noticed that it
> changes the
> way you look at your code - the code really becomes (part of) the
> documentation.
>
> I'm not going to claim that the above document illustrates that. I quit
> working
> on the code at some point, as I got distracted by other things. But I
> remember
> the feeling, and I've been missing it since then.
>
> If I may quote Joe, he wrote this after trying it:
>
> "I like it *very much* It's strange, I've tried edoc (didn't like it -
> the output
> is ugly) - I wrote my own literate programming system (never used it
> much -
> the code is weirdly ordered)
>
> Used a full book markup system (for the prag book) - overkill for module
> documentation.
>
> Somehow erl2latex strikes the right balance between effort and result -
> small effort nice result. (edoc = big effort, no benefit) (book
> production
> system, big effort, big benefit) ?
> ...
> Actually I like this so much I think I'll be using it a lot ?"
>
> I don't know if he actually did, but it was a nice thing to say. :)
>
> BR,
> Ulf W
>
> Ulf Wiger, CTO, Erlang Solutions, Ltd.
> http://erlang-solutions.com
>
>
>

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

From ebegumisa  Fri Dec 17 07:39:51 2010
From: ebegumisa (Edmond Begumisa)
Date: Fri, 17 Dec 2010 17:39:51 +1100
Subject: [erlang-questions] Speaking of comments
In-Reply-To:
References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz>  <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> <00a601cb96e5\$c12d74d0\$43885e70\$@com>
Message-ID:

On Tue, 14 Dec 2010 10:52:57 +1100, Richard O'Keefe
wrote:

>
> On 13/12/2010, at 8:19 PM, Edmond Begumisa wrote:
>
>> Interesting article.
>>
>> I don't know about using non-ASCII for actual source-code as the author
>> suggests. I'm not a language designer so I have no opinion this (though
>> in relation to this, I've sometimes wondered about alternatives to
>> programing languages revolving around English -- it must really
>> irritate non-English speakers, especially those coming from languages
>> using non-latin alphabets.)
>
> MADCAP used a non-ASCII character set, including 2d structures.
> APL used (and uses) a non-ASCII character set.  It has no keywords.
> I have seen Algol 60 programs written in French and Chinese.
> I've also read Pascal in French (including French keywords)
> and seen Simula 67 in Danish.
> IBM mainframe compilers have for a long time allowed DBCS (double byte
> character sets).
>
> Algol 60 was a comparatively straightforward case.  Technically,
> keywords in
> that language are single characters, and their rendering as boldface or
> underlined English words is just one of many possible hardware
> representations.

Educative. Now I can stop wondering :)

>>
>> What I would love is very rich and flexible ways of attaching
>> annotations or "running commentary" to source code.
>
> Well, you _could_ use NuWeb, or NoWeb, or FunnelWeb, and add whatever
> annotations you like.
>

I've had a look. I like these tools. What I don't like is having to go
through a separate generation step to use their output. I think it would
be useful to have these sort of rich annotations for *consumption* in
Editors/IDEs. To be able to both edit and view them while coding.

Also, I'm lazy (this is also why I don't use edoc as much as I should.) I
just want to start typing rich annotations straight into my editor. I want
someone else to take care of the markup. If I have to write markup while
I'm programming, it reduces the chances that I'll adequately comment my
code.

>> I would think this could be done without changing the language in
>> question.
>
> Has very often been done.  People have even written programs with
> commentary in Microsoft Word
> and used a VBA macro to strip out and save separately the text with the
> 'Program' style.  I
> have my own very simple program for extracting  sections, possibly
> restricted to a
> particular class, from HTML so that
> 	html4.0 foo.htm | pre >foo.erl
> can let you extract code from commentary.  How simple?
>
> #include
> #include "dvm2.h"
>
> int main(int argc, char **argv) {
>     char *wanted = argc > 1 ? argv[1] : (char*)0;
>     xml   e0 = load_esis_through(stdin, 0);
>     int   last_was_nl;
>
>     for_each_named_descendant(e0, "pre", e1)
>         if (wanted != 0 && !has_value(e1, "class", wanted)) continue;
>         last_was_nl = 1;
>         for_each_text_descendant(e1, e2)
>             fwrite(text_of(e2), 1, x_size(e2), stdout);
>             if (x_size(e2) != 0)
>                 last_was_nl = text_of(e2)[x_size(e2)-1] == '\n';
>         end_each_text_descendant
>         if (!last_was_nl) putc('\n', stdout);
>     end_each_named_descendant
>     return 0;
> }
>
> That simple.  Doing the same kind of thing using xmerl would be very
> little harder.
>
> Now you could handle parallel comments in HTML using
>
>
> 	  >           >
>
>
>
>
>
>

codecomments
>
> The limit has been our ingenuity, not our tools.\
>

Though we're not really talking about the same thing, I see your point.

- Edmond -

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

From minaev  Fri Dec 17 07:57:11 2010
From: minaev (Dmitri Minaev)
Date: Fri, 17 Dec 2010 09:57:11 +0300
Subject: [erlang-questions] Re: Cannot unload module from remote shell
In-Reply-To: <20101216161807.GA6300@corelatus.se>
References:

<20101216161807.GA6300@corelatus.se>
Message-ID:

On Thu, Dec 16, 2010 at 7:18 PM, Matthias Lang wrote:

>
> You can investigate the problem a bit by using the 'code' module. In
> particular, try calling
>
>   code:which(dmitrys_module)
>

> code:which(rbt).
"/var/lib/rabbitmq/rbt.beam"

That's it. Thank you, Matt. So, if this is really unexpected, I can assume
that RabbitMQ overrides the default compilation procedure, caching the
compiled module, right? And, probably, the default loading procedure, too,
since /var/lib/rabbitmq is missing in the output of code:get_path.

--
With best regards,
Dmitri Minaev

From ebegumisa  Fri Dec 17 08:01:45 2010
From: ebegumisa (Edmond Begumisa)
Date: Fri, 17 Dec 2010 18:01:45 +1100
Subject: [erlang-questions] Re: Speaking of comments
In-Reply-To:
References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz>  <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> <00a601cb96e5\$c12d74d0\$43885e70\$@com>
Message-ID:

On Tue, 14 Dec 2010 09:45:18 +1100, Richard O'Keefe
wrote:

>
> On 9/12/2010, at 4:15 AM, Edmond Begumisa wrote:
>
>> I've thought -- now and then, in the back of my mind -- about removing
>> comments from actual source all-together (for all languages) and
>> instead, putting them in companion files that the editor lines up
>> side-by-side. More like annotating than just traditional commenting.
>>
>> Has this sort of thing been done before? Is there a particular editor
>> that can give me this out of the box? (I admittedly haven't explored a
>> large number of editors)
>
> http://www.xemacs.org/Documentation/beta/html/lispref_52.html

AHA!! *This* looks close what I want. Nice :)

I've never been an emacs guy (you either are or your not.) This is a good
excuse to revisit emacs!

>
> I believe Eclipse and NetBeans also have some kind of annotation support.
> For XML documents, Amaya supports the Annotea protocol.
>>
>> It seems a shame that in 2010, it's still so limiting what we can do
>> with comments in our source code!
>
> _We_, kimosabe?
>
> My strictures against nesting comments do NOT apply to annotated
> annotations.
>

I didn't mean to comment on your comment! Just raising something I had
thought about.

- Edmond -

>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe
>

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

From ebegumisa  Fri Dec 17 08:01:52 2010
From: ebegumisa (Edmond Begumisa)
Date: Fri, 17 Dec 2010 18:01:52 +1100
Subject: [erlang-questions] Speaking of comments
In-Reply-To:
References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz>  <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> <00a601cb96e5\$c12d74d0\$43885e70\$@com>
Message-ID:

docco looks nice, similar to Masklinn's Pycco. But it's a generator
(output is not for consumption in the editor.)

Superimpose that screenshot over your favorite editor; imagine being able
to edit the left-panel without writing markup; imagine a few blog-style
comments from your fellow developers then we're onto something.

- Edmond -

On Tue, 14 Dec 2010 13:37:13 +1100, Tony Arcieri
wrote:

> On Mon, Dec 13, 2010 at 10:56 AM, Nahuel Greco  wrote:
>
>> You guys need to take a look to the image-based Smalltalk philosophy.
>
>
> Smalltalk philosophy is great, but docco is a tool that can generate
> exactly
> this sort of "literate programming" style side-by-side documentation
> today
> from the codebase of many existing languages, including Erlang. Just pump
> your Erlang source code through docco and it will spit out documentation
> with comments and source code side-by-side.
>
> docco's web site itself is an example of the output docco generates:
>
> http://jashkenas.github.com/docco/
>

- Edmond -

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

From matthias  Fri Dec 17 11:23:29 2010
From: matthias (Matthias Lang)
Date: Fri, 17 Dec 2010 11:23:29 +0100
Subject: [erlang-questions] Re: Cannot unload module from remote shell
In-Reply-To:
References:

<20101216161807.GA6300@corelatus.se>

Message-ID: <20101217102329.GA5132@corelatus.se>

Matt> > You can investigate the problem a bit by using the 'code' module. In
Matt> > particular, try calling
> >
Matt> >   code:which(dmitrys_module)

Dmitry> code:which(rbt).
Dmitry> "/var/lib/rabbitmq/rbt.beam"

Dmitry> That's it. Thank you, Matt. So, if this is really unexpected,
Dmitry> I can assume that RabbitMQ overrides the default compilation
Dmitry> procedure, caching the compiled module, right? And, probably,
Dmitry> the default loading procedure, too, since /var/lib/rabbitmq is
Dmitry> missing in the output of code:get_path.

On the copy of rabbitmq (Debian, 1.8.1-1) I just installed:

(rabbit)1> code:get_path().
["/usr/lib/rabbitmq/lib/rabbitmq_server-1.8.1/sbin/../ebin",
".","/usr/lib/erlang/lib/kernel-2.14/ebin",
"/usr/lib/erlang/lib/stdlib-1.17/ebin",
"/usr/lib/erlang/lib/sasl-2.1.9.2/ebin",
"/usr/lib/erlang/lib/syntax_tools-1.6.6/ebin",
"/usr/lib/erlang/lib/ssl-4.0/ebin",
"/usr/lib/erlang/lib/snmp-4.17/ebin",
"/usr/lib/erlang/lib/runtime_tools-1.8.4/ebin",
"/usr/lib/erlang/lib/public_key-0.7/ebin",
"/usr/lib/erlang/lib/otp_mibs-1.0.6/ebin",
"/usr/lib/erlang/lib/os_mon-2.2.5/ebin",
"/usr/lib/erlang/lib/mnesia-4.4.14/ebin",
"/usr/lib/erlang/lib/hipe-3.7.6/ebin",
"/usr/lib/erlang/lib/erts-5.8/ebin",
"/usr/lib/erlang/lib/erl_interface-3.7",
"/usr/lib/erlang/lib/crypto-2.0/ebin",
"/usr/lib/erlang/lib/compiler-4.7/ebin"]

Notice that ".", i.e. the current directory, is included in the path.
What does rabbitmq use for a current directory?

(rabbit)2> pwd().
/var/lib/rabbitmq

So there's nothing unexpected about Erlang loading code from
/var/lib/rabbitmq, it's the current directory for rabbitmq and
the current directory is in the code path!

Matt

(Bonus question for the rabbitmq guys: what's the .erlang.cookie file
for?  Is it a cookie or a hash of a cookie?)

From dkoch  Fri Dec 17 13:08:12 2010
From: dkoch (dkoch)
Date: Fri, 17 Dec 2010 13:08:12 +0100 (CET)
Subject: REF: Erlang and OpenGL broken (MOYEN URGENT)
Message-ID: <9847241.937021292587692545.JavaMail.www@wsfrf1211>

I don't know how I managed to do that, but Erlang+OpenGL doesn't work anymore on my machine :(

I mean, Wings3D starts but hang when it wants to display the OpenGL window, wxErlang OpenGL canvas behaves the same way (hanging) and my previous working esdl code either. Otherwise my C++ OpenGL works fine.
I checked the SDL.dll, OpenGL dlls, whatever. C code works, not Erlang. Any hints ? Thanks...
David

From dgud  Fri Dec 17 13:23:10 2010
From: dgud (Dan Gudmundsson)
Date: Fri, 17 Dec 2010 13:23:10 +0100
Subject: [erlang-questions] REF: Erlang and OpenGL broken (MOYEN URGENT)
In-Reply-To: <9847241.937021292587692545.JavaMail.www@wsfrf1211>
References: <9847241.937021292587692545.JavaMail.www@wsfrf1211>
Message-ID:

Windows, I guess?

Which wings doesn't work? home built or downloaded standalone package?

What versions, erlang esdl and wings?

I have changed the OpenGL part of wx to be a standalone dll in the
latest OTP release,
but even if I broke something that shouldn't change esdl or wings.

/Dan

On Fri, Dec 17, 2010 at 1:08 PM,   wrote:
> I don't know how I managed to do that, but Erlang+OpenGL doesn't work anymore on my machine :(
>
> I mean, Wings3D starts but hang when it wants to display the OpenGL window, wxErlang OpenGL canvas behaves the same way (hanging) and my previous working esdl code either. Otherwise my C++ OpenGL works fine.
> I checked the SDL.dll, OpenGL dlls, whatever. C code works, not Erlang. Any hints ? Thanks...
> David
>

From ebegumisa  Fri Dec 17 13:48:10 2010
From: ebegumisa (Edmond Begumisa)
Date: Fri, 17 Dec 2010 23:48:10 +1100
Subject: [erlang-questions] Erlang Intro/Evangelism Presentation --
Starbucks!
In-Reply-To:
References:
Message-ID:

MESSAGE-PASSING @ STARBUCKS

"... I started to think about how Starbucks processes drink orders.
Starbucks, like most other businesses is primarily interested in
maximizing throughput of orders. More orders equals more revenue. As a
result they use asynchronous processing ..."

"... we can see that the real world is often asynchronous. Our daily lives
consists of many coordinated, but asynchronous interactions...
asynchronous messaging architecture can often be a natural way to model
these types of interactions... also means that often we can look at daily
life to help design successful messaging solutions ..."*

http://www.eaipatterns.com/ramblings/18_starbucks.html

I hope I'm not too late with this, but I really liked this old article by
Google's Gregor Hohpe on asynchronous message passing. He wasn't talking
explicitly about Erlang but the content should resonate instantaneously
with Erlang programmers while at the same time being insightful for
non-Erlangers. You might want to reference a few of his well-worded
analogies for evangelising some of the core ideas built into Erlang.

*Joe Armstrong made a similar compelling argument at the beginning of his
book. As a relatively new Erlang programmer myself, _THIS_ is the main
line of argument that convinced me to try out the Erlang environment.
Particularly the implications on concurrency which I had struggled with in
other environments (in retrospect, it was because those environments
didn't have these ideas built-in or actively encouraged -- I've found
Erlang does a lot of hand-holding to make sure you do the sane thing in
order to avoid painting yourself into a corner -- something you could
emphasise in your presentation.)

- Edmond -

On Sat, 04 Dec 2010 05:43:34 +1100, Ryan Zezeski
wrote:

> I've been tasked with giving an introductory level presentation on
> Erlang at
> work.  The focus is on why you would use Erlang and what does it look
> like
> on the surface level.  We have a lot of your standard Java/C#/C
> developers
> and this will act as a potential launching pad to introducing Erlang to
> the
> company.  There is the potential for a large number of people to video
> conference into this possibly spanning several countries so I really
> want to
> knock this out of the park.
>
> I'm writing as an inquiry for links to any prior art that I may use for
> inspiration or even steal and use as my own.  Anything that you think
> might
> be helpful is appreciated, even input on possible approaches.  I'd really
> like to hear from people who have done this sort of thing before, i.e.
> pubic
> speaking on Erlang.
>
> Thanks,
> -Ryan

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

From fdmanana  Fri Dec 17 13:48:44 2010
From: fdmanana (Filipe David Manana)
Date: Fri, 17 Dec 2010 12:48:44 +0000
Subject: Possible supervisor patch
Message-ID:

Hi,

I find it useful to be able to restart a supervisor child with
arguments different from those specified in the MFA component of the
original child spec.
Is this completely against the principles of OTP supervisors/servers,
or something that may be added?

I made a quick and tiny patch that adds this feature and is working as I want:

https://github.com/fdmanana/otp/commit/a80f39109292c915ce56ea86b7e036b581f686b2

If someone from the OTP team confirms this might be considered for
inclusion, I'll be glad to refine it if necessary.

best regards,

--
Filipe David Manana,
fdmanana, fdmanana

"Reasonable men adapt themselves to the world.
?Unreasonable men adapt the world to themselves.
?That's why all progress depends on unreasonable men."

From minaev  Fri Dec 17 14:10:55 2010
From: minaev (Dmitri Minaev)
Date: Fri, 17 Dec 2010 16:10:55 +0300
Subject: [erlang-questions] Re: Cannot unload module from remote shell
In-Reply-To: <20101217102329.GA5132@corelatus.se>
References:

<20101216161807.GA6300@corelatus.se>

<20101217102329.GA5132@corelatus.se>
Message-ID:

On Fri, Dec 17, 2010 at 1:23 PM, Matthias Lang wrote:

>
> So there's nothing unexpected about Erlang loading code from
> /var/lib/rabbitmq, it's the current directory for rabbitmq and
> the current directory is in the code path!
>

That simple? Thanks!

> (Bonus question for the rabbitmq guys: what's the .erlang.cookie file
> for?  Is it a cookie or a hash of a cookie?)
>

IMHO, a cookie. At least, being copied into -setcookie, it works.

--
With best regards,
Dmitri Minaev

From dkoch  Fri Dec 17 14:33:26 2010
From: dkoch (dkoch)
Date: Fri, 17 Dec 2010 14:33:26 +0100 (CET)
Subject: [erlang-questions] REF: Erlang and OpenGL broken (MOYEN
URGENT)
In-Reply-To: <9847241.937021292587692545.JavaMail.www@wsfrf1211>
References: <9847241.937021292587692545.JavaMail.www@wsfrf1211>
Message-ID: <21625100.959431292592806447.JavaMail.www@wsfrf1211>

Windows XP, yeah... Wings 1.3.1 standalone as well, esdl 1.0.1, wxErlang + wxWidgets 2.9.1. All of them works on my office machine, so it's not your fault. And I checked my current esdl revamp (which sports opengl support up to 4.1 and also opencl, openal and opende) but no luck either. Have you heard somethings crash ? Neither do I, and that's leaving me a bit puzzled :/
David

========================================

Message du : 17/12/2010
De : "Dan Gudmundsson "
A : dkoch
Copie ? : erlang-questions
Sujet : Re: [erlang-questions] REF: Erlang and OpenGL broken (MOYEN URGENT)

Windows, I guess?

Which wings doesn't work? home built or downloaded standalone package?

What versions, erlang esdl and wings?

I have changed the OpenGL part of wx to be a standalone dll in the
latest OTP release,
but even if I broke something that shouldn't change esdl or wings.

/Dan

On Fri, Dec 17, 2010 at 1:08 PM,   wrote:
> I don't know how I managed to do that, but Erlang+OpenGL doesn't work anymore on my machine :(
>
> I mean, Wings3D starts but hang when it wants to display the OpenGL window, wxErlang OpenGL canvas behaves the same way (hanging) and my previous working esdl code either. Otherwise my C++ OpenGL works fine.
> I checked the SDL.dll, OpenGL dlls, whatever. C code works, not Erlang. Any hints ? Thanks...
> David
>

________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-questions-unsubscribe

From tsuraan  Fri Dec 17 21:30:07 2010
From: tsuraan (tsuraan)
Date: Fri, 17 Dec 2010 14:30:07 -0600
Subject: [erlang-questions] epmd: error in accept
In-Reply-To:
References:

Message-ID:

> I recently submitted this patch that might help you:
>
> http://github.com/erlang/otp/commit/c5c8baa686b2cd5c43ecbf40fbb47d04f200b552
>
> It looks like it's in the otp proposed updates branch but not yet on
> the dev branch, but either way you should be able to apply this patch
> to R13B04 without issue.

Can you put this changeset into the otp main pull requests?  It's
still not committed (at least, it doesn't show up at
https://github.com/erlang/otp/blob/dev/erts/epmd/src/epmd_srv.c), and
I think it really should be.  I only see 3 pull requests outstanding
for the otp github, so I assume that the team is processing them.

From co7eb  Sun Dec 19 04:31:58 2010
From: co7eb (=?iso-8859-1?Q?Gilberio_Carmenates_Garc=EDa?=)
Date: Sun, 19 Dec 2010 00:31:58 -0300
Subject: Endian numbers
Message-ID: <000001cb9f2d\$4c564ce0\$e502e6a0\$@co.cu>

Hi all,

I?ve been always wondering that is the meaning of endian term, for example
in the Bit syntax

{<<16#12345678:32/big>>,<<16#12345678:32/little>>,

<<16#12345678:32/native>>,<<16#12345678:32>>}.

{<<18,52,86,120>>,<<120,86,52,18>>,

<<120,86,52,18>>,<<18,52,86,120>>}

What is the meaning of that I mean what is the different between big, little
or native. And the different endian machines. In the JInterface there is a
reference to that term too, the big endian the little endian and so on.

Could anybody explain this to me, I need to now that very well so I can put
that in my book.

Regards,

Ivan.

----------------------------------------------------------------------------
---------------------------------

Ing: Ivan Carmenates Garc?a

Current project: ExtendedVisualOtp and Erlang Book: "Erlang Avanzado para
principiantes"

Ivanco Software Company in association with SPI Team

spi_red32LogoSPI

=======================================================================
Este mensaje ha sido enviado mediante el servicio de correo electr?nico que ofrece la Federaci?n de Radioaficionados de Cuba a sus miembros para respaldar el cumplimiento de los objetivos de la organizaci?n y su pol?tica informativa. La persona que env?a este correo asume el compromiso de  usar el servicio a tales fines y cumplir con las regulaciones establecidas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:

From steve  Sat Dec 18 07:46:31 2010
From: steve (Steve Strong)
Date: Sat, 18 Dec 2010 07:46:31 +0100
Subject: Endian numbers
In-Reply-To: <000001cb9f2d\$4c564ce0\$e502e6a0\$@co.cu>
References: <000001cb9f2d\$4c564ce0\$e502e6a0\$@co.cu>
Message-ID: <6894BC32A3704B048816B713DA336688@srstrong.com>

Take a read of http://en.wikipedia.org/wiki/Endianness, it should tell you everything you need.

Cheers,

Steve

--
Steve Strong
Sent with Sparrow

On Sunday, December 19, 2010 at 4:31 AM, Gilberio Carmenates Garc?a wrote:

> Hi all,
> I?ve been always wondering that is the meaning of endian term, for example in the Bit syntax
>
> {<<16#12345678:32/big>>,<<16#12345678:32/little>>,
> <<16#12345678:32/native>>,<<16#12345678:32>>}.
> {<<18,52,86,120>>,<<120,86,52,18>>,
> <<120,86,52,18>>,<<18,52,86,120>>}
>
> What is the meaning of that I mean what is the different between big, little or native. And the different endian machines. In the JInterface there is a reference to that term too, the big endian the little endian and so on.
> Could anybody explain this to me, I need to now that very well so I can put that in my book.
>
>
> Regards,
>
> Ivan.
>
> -------------------------------------------------------------------------------------------------------------
> Ing: Ivan Carmenates Garc?a
> Current project: ExtendedVisualOtp and Erlang Book: "Erlang Avanzado para principiantes"
> Ivanco Software Company in association with SPI Team
>
>
>
>
>
>
> =======================================================================
>  Este mensaje ha sido enviado mediante el servicio de correo electr?nico que ofrece la Federaci?n de Radioaficionados de Cuba a sus miembros para respaldar el cumplimiento de los objetivos de la organizaci?n y su pol?tica informativa. La persona que env?a este correo asume el compromiso de usar el servicio a tales fines y cumplir con las regulaciones establecidas.
>
>
>
>

From jared.nance  Sat Dec 18 07:48:26 2010
From: jared.nance (Jared Kofron)
Date: Fri, 17 Dec 2010 22:48:26 -0800
Subject: [erlang-questions] Endian numbers
Message-ID:

Big vs. little endian has to do with whether the most significant byte comes first in the list or the least significant byte.  'Native' encoding means native to the machine that is interpreting the bitstring.  If you look at the encodings you showed below, you can see this effect as the bytes being read from left to right instead of right to left.

JK

Hi all,
I?ve been always wondering that is the meaning of endian term, for example in the Bit syntax

{<<16#12345678:32/big>>,<<16#12345678:32/little>>,
<<16#12345678:32/native>>,<<16#12345678:32>>}.
{<<18,52,86,120>>,<<120,86,52,18>>,
<<120,86,52,18>>,<<18,52,86,120>>}

What is the meaning of that I mean what is the different between big, little or native. And the different endian machines. In the JInterface there is a reference to that term too, the big endian the little endian and so on.
Could anybody explain this to me, I need to now that very well so I can put that in my book.

Regards,

Ivan.

-------------------------------------------------------------------------------------------------------------
Ing: Ivan Carmenates Garc?a
Current project: ExtendedVisualOtp and Erlang Book: "Erlang Avanzado para principiantes"
Ivanco Software Company in association with SPI Team

=======================================================================
Este mensaje ha sido enviado mediante el servicio de correo electr?nico que ofrece la Federaci?n de Radioaficionados de Cuba a sus miembros para respaldar el cumplimiento de los objetivos de la organizaci?n y su pol?tica informativa. La persona que env?a este correo asume el compromiso de usar el servicio a tales fines y cumplir con las regulaciones establecidas.

From netch  Sat Dec 18 08:29:55 2010
From: netch (Valentin Nechayev)
Date: Sat, 18 Dec 2010 09:29:55 +0200
Subject: [erlang-questions] systematic global registration discrepancies
In-Reply-To: <20101123141024.GA12822@netch.kiev.ua>
References: <20101123141024.GA12822@netch.kiev.ua>
Message-ID: <20101218072955.GA35682@netch.kiev.ua>

Tue, Nov 23, 2010 at 16:10:24, netch wrote about "[erlang-questions] systematic global registration discrepancies":

> we are using Erlang cluster for 20-25 nodes which all resides on different
> hosts. We are experiencing systematic problems with global registration of
> following kinds:
>
> 1. Attempt of register via global:register_name() hangs for an unlimited time
> (we could see it for a few hours until our patience is expired).
>
> 2. A name which is successfully reported as registered disappears from
> registered name lists at all nodes (including the registering one!)
>
> We had to add monitoring of global functionality which stops the node where
> registration hangs.  It periodically detects registration failure and stops
> nodes, usually this is group of 7-10 nodes per one such failure. But it can't
> detect second case (silent disappearing).
>
> We use R12B5; it's planned to upgrade but is impossible for the closest next
> release.

R14B01 - the same but length of failing period seems reduced (on partial
statistics; full results will be in a few days)

> Did anybody seen this? Please suggest how to debug such problem.

Repeating the question.

-netch-

From ulf.wiger  Sat Dec 18 14:23:29 2010
From: ulf.wiger (Ulf Wiger)
Date: Sat, 18 Dec 2010 14:23:29 +0100
Subject: mnesia table type: ephemeral
Message-ID:

Some ideas tend to stick in an annoying way until you can either
dismiss them or implement them?

Some weeks ago, I started thinking that it would be very handy to
have an "ephemeral" table type. For those who are unfamiliar with the
term, "ephemeral" means "passing" or "lasting only a very short time"*.

It would actually be quite easy to implement, and if nothing else, it
would be perfectly in line with mnesia's "amnesia" origins. :)

An ephemeral table would work like this:
- It has no content that survives transactions
- You can write to it within a transaction, and read back what is
in the transaction store.
- When committed, the data written gets replicated to all copy holders
(but is not kept)
- You can subscribe to table events just like on normal tables.

The main purpose of an ephemeral table would be to commit derived
and perhaps complex data which can be reported to outside observers
via the mnesia subscription algorithm. Basically, you can sculpt the
commit message without regard to what your persistent data structure
needs to look like. Also, if your transaction results in multiple updates,
you can combine them in one record in the ephemeral table, making it
much easier for subscribers to get the full picture.

One could even use this as a generic publish-subscribe mechanism,
and it should be fine simply doing a dirty write in order to propagate the
information.

The original problem that triggered the idea was creating files from within
mnesia transactions, and keeping the files synchronised on multiple disks.
I'm not entirely convinced that this alone can solve that problem, but perhaps
together with a transaction log hooked into the subscription mechanism, one
can get quite far.

Comments are welcome. I've not started implementing it yet.

BR,
Ulf

Ulf Wiger, CTO, Erlang Solutions, Ltd.
http://erlang-solutions.com

From robert.virding  Sat Dec 18 15:58:02 2010
From: robert.virding (Robert Virding)
Date: Sat, 18 Dec 2010 14:58:02 +0000 (GMT)
Subject: [erlang-questions] Possible supervisor patch
In-Reply-To:
Message-ID: <49603530.214391292684282829.JavaMail.root@zimbra>

You can do it today with:

restart_child(Sup, Id, NewSpec) ->
supervisor:terminate_child(Sup, Id),
supervisor:delete_child(Sup, Id),
supervisor:start_child(Sup, NewSpec).

BUT, it would not be guaranteed to be an atomic operation and it is up to the caller to ensure that the id remains the same.

Robert

----- "Filipe David Manana"  wrote:

> Hi,
>
> I find it useful to be able to restart a supervisor child with
> arguments different from those specified in the MFA component of the
> original child spec.
> Is this completely against the principles of OTP supervisors/servers,
> or something that may be added?
>
> I made a quick and tiny patch that adds this feature and is working as
> I want:
>
> https://github.com/fdmanana/otp/commit/a80f39109292c915ce56ea86b7e036b581f686b2
>
> If someone from the OTP team confirms this might be considered for
> inclusion, I'll be glad to refine it if necessary.
>
> best regards,
>
> --
> Filipe David Manana,
> fdmanana, fdmanana
>
> "Reasonable men adapt themselves to the world.
> ?Unreasonable men adapt the world to themselves.
> ?That's why all progress depends on unreasonable men."
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe

--
Robert Virding, Erlang Solutions Ltd.

From fdmanana  Sat Dec 18 16:57:10 2010
From: fdmanana (Filipe David Manana)
Date: Sat, 18 Dec 2010 15:57:10 +0000
Subject: [erlang-patches] Re: [erlang-questions] Possible supervisor patch
In-Reply-To: <49603530.214391292684282829.JavaMail.root@zimbra>
References:
<49603530.214391292684282829.JavaMail.root@zimbra>
Message-ID:

Exactly, that was my workaround, and the motivation for that patch was
exactly to make it atomic.

Thanks

On Sat, Dec 18, 2010 at 2:58 PM, Robert Virding
wrote:
> You can do it today with:
>
> restart_child(Sup, Id, NewSpec) ->
> ? ?supervisor:terminate_child(Sup, Id),
> ? ?supervisor:delete_child(Sup, Id),
> ? ?supervisor:start_child(Sup, NewSpec).
>
> BUT, it would not be guaranteed to be an atomic operation and it is up to the caller to ensure that the id remains the same.
>
> Robert
>
> ----- "Filipe David Manana"  wrote:
>
>> Hi,
>>
>> I find it useful to be able to restart a supervisor child with
>> arguments different from those specified in the MFA component of the
>> original child spec.
>> Is this completely against the principles of OTP supervisors/servers,
>> or something that may be added?
>>
>> I made a quick and tiny patch that adds this feature and is working as
>> I want:
>>
>> https://github.com/fdmanana/otp/commit/a80f39109292c915ce56ea86b7e036b581f686b2
>>
>> If someone from the OTP team confirms this might be considered for
>> inclusion, I'll be glad to refine it if necessary.
>>
>> best regards,
>>
>> --
>> Filipe David Manana,
>> fdmanana, fdmanana
>>
>> "Reasonable men adapt themselves to the world.
>> ?Unreasonable men adapt the world to themselves.
>> ?That's why all progress depends on unreasonable men."
>>
>> ________________________________________________________________
>> erlang-questions (at) erlang.org mailing list.
>> See http://www.erlang.org/faq.html
>> To unsubscribe; mailto:erlang-questions-unsubscribe
>
> --
> Robert Virding, Erlang Solutions Ltd.
>
> ________________________________________________________________
> erlang-patches (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-patches-unsubscribe
>
>

--
Filipe David Manana,
fdmanana, fdmanana

"Reasonable men adapt themselves to the world.
?Unreasonable men adapt the world to themselves.
?That's why all progress depends on unreasonable men."

From dkoch  Sun Dec 19 21:11:11 2010
From: dkoch (David KOCH)
Date: Sun, 19 Dec 2010 21:11:11 +0100
Subject: [erlang-questions] REF: Erlang and OpenGL broken (MOYEN
URGENT)
In-Reply-To: <21625100.959431292592806447.JavaMail.www@wsfrf1211>
References: <9847241.937021292587692545.JavaMail.www@wsfrf1211>
<21625100.959431292592806447.JavaMail.www@wsfrf1211>
Message-ID:

OK guys, I got it ! I checked and checked again, and here's the result of
my finding for so long. Take a good seat, it's gonna be long.

My home computer ain't a horsepower, just a Jetway J7F2 with a VIA C7 @ 2
GHz (mono-core, IO) with an integrated S3 Unichrome video card (AGP 8x)
plus an external PNY (nVidia) FX5200 Dual-VGA video card on the PCI bus.

For more than 6 months I had not access to my computer and the running OS
(Windows XP SP3) was so outdated. When I switched it on again and
connected it to the Internet some weeks ago, I left it perform a major
upgrade, in which also I updated the forceware driver. And THAT'S where
things are crispy...

I work using triple screen (once tasted, never came back) and my Windows
desktop is organized in such a way than when I was browsing my C++
projects, it was on my S3 Unichrome screen. When you open a program on a
screen, it uses the screen's OpenGL driver, in which case was OpenGL 1.2
(the Unichrome ain't a horsepower either)

On the other hand my Erlang projects were opened on the primary nVidia
screen, which was faulty. The latest driver update for the FX 5200
(175.16) is broken and hangs on the PIXELFORMAT request. No ways to fix
this, I googled the Internet for quite a long time. All I got is "Here it
works" ! Super answer, merci les gars, je vous allumerai un cierge !

Well, I then uninstalled the 175.16 nVidia driver and started with a very
old one. OpenGL was functionnal again, Hurra ! Then I upgraded the driver
step aftert step, taking mesures, probing the OpenGL capabilities, taking
notes, up to the 175.16 driver which again, broke everything. So I just
uninstalled it again and reinstalled the previous one, which is OK. Here's
the summary of my discovering :

Release|File        |Driver |OpenGL
date   |version     |version|support
-------+------------+-------+-----
050224 |7.1.8.4     | 71.84 |1.5.3
051210 |8.1.9.8     | 81.98 |2.0.1
061022 |6.14.10.9371| 93.71 |2.0.3
071004 |6.14.11.6375|163.75 |2.1.1
071205 |6.14.11.6921|169.21 |2.1.2
080516 |6.14.11.7516|175.16 |-----

So using the nVidia 169.21 driver offers OpenGL support up to 2.1.2, which
is currently far enough for me. Somedays I'll buy a new fancy mini-ITX
board with AM3 socket and OpenGL 4.1 support in order to test stress my
current erlang driver.

So sorry if I warned too early, but I NEVER THOUGHT that upgrading a
driver would make things worse, especially breaking the OpenGL support.
And I not made the connection with the fact that opening a program on one
screen or the other would provide different result.

So again, nVidia ForceWare driver 175.16 breaks OPENGL which hang on
PIXELFORMAT request on my FX 5200 video card, whatever I tried to make it
work.

Also on Windows 2000, drivers beyond 93.71 doesn't show the nVidia
advanced panel to select Dualview since they requires GDI+, doh...

Le Fri, 17 Dec 2010 14:33:26 +0100,  a ?crit:

> Windows XP, yeah... Wings 1.3.1 standalone as well, esdl 1.0.1, wxErlang
> + wxWidgets 2.9.1. All of them works on my office machine, so it's not
> your fault. And I checked my current esdl revamp (which sports opengl
> support up to 4.1 and also opencl, openal and opende) but no luck
> either. Have you heard somethings crash ? Neither do I, and that's
> leaving me a bit puzzled :/
> David

From ok  Mon Dec 20 01:20:45 2010
From: ok (Richard O'Keefe)
Date: Mon, 20 Dec 2010 13:20:45 +1300
Subject: [erlang-questions] Speaking of comments
In-Reply-To:
References: <8be0ec38-f72a-41b3-8899-41077ee32ec6@l17g2000yqe.googlegroups.com> <8BB69DB9-5A59-4D86-9D5B-FFFDF65028A3@cs.otago.ac.nz>  <227EEA20-873D-43A5-BEA5-432FD5DA999F@cs.otago.ac.nz> <00a601cb96e5\$c12d74d0\$43885e70\$@com>
Message-ID: <18139BE7-DA2B-4606-A56A-5CC85BC0E793@cs.otago.ac.nz>

On 17/12/2010, at 7:39 PM, Edmond Begumisa wrote:
>> Well, you _could_ use NuWeb, or NoWeb, or FunnelWeb, and add whatever annotations you like.
>>
>
> I've had a look. I like these tools. What I don't like is having to go through a separate generation step to use their output. I think it would be useful to have these sort of rich annotations for *consumption* in Editors/IDEs. To be able to both edit and view them while coding.

I note that Haskell supports both the 'Bird tracks' approach to literate programming (where the
codes is the lines beginning with "> " and the annotation is everything else) and a LaTeX
approach (where the code is in special blocks).  Whether this is done by the Haskell parser proper
or by a separate preprocessing program is really none of the programmer's business.

I don't quite see what you mean by not having rich annotations for consumption in Editors/IDEs.
One edits the annotated document, not the source code alone.  Line numbers in error messages
relate back to the original document, not the source code (this is no different from using
something like Yacc or Happy or Yecc).
>
> Also, I'm lazy (this is also why I don't use edoc as much as I should.) I just want to start typing rich annotations straight into my editor. I want someone else to take care of the markup.

If you are just typing, it is by definition not rich.  You have to do *SOMETHING* to provide the
extra information in rich annotations, and whether it is markup like `...` or
References: <000001cb9f2d\$4c564ce0\$e502e6a0\$@co.cu>
Message-ID: <1292831961.5112.1.camel@seasc1137>

http://en.wikipedia.org/wiki/Endianness

bengt

On Sun, 2010-12-19 at 04:31 +0100, Gilberio Carmenates Garc?a wrote:
> Hi all,
>
> I?ve been always wondering that is the meaning of endian term, for
> example in the Bit syntax
>
>
>
> {<<16#12345678:32/big>>,<<16#12345678:32/little>>,
>
> <<16#12345678:32/native>>,<<16#12345678:32>>}.
>
> {<<18,52,86,120>>,<<120,86,52,18>>,
>
> <<120,86,52,18>>,<<18,52,86,120>>}
>
>
>
> What is the meaning of that I mean what is the different between big,
> little or native. And the different endian machines. In the JInterface
> there is a reference to that term too, the big endian the little
> endian and so on.
>
> Could anybody explain this to me, I need to now that very well so I
> can put that in my book.
>
>
>
>
>
> Regards,
>
>
>
> Ivan.
>
>
>
> -------------------------------------------------------------------------------------------------------------
>
> Ing: Ivan Carmenates Garc?a
>
> Current project: ExtendedVisualOtp and Erlang Book: "Erlang Avanzado
> para principiantes"
>
> Ivanco Software Company in association with SPI Team
>
> spi_red32LogoSPI
>
>
>
>
>
>
>
>
>
> =======================================================================
> Este mensaje ha sido enviado mediante el servicio de correo
> electr?nico que ofrece la Federaci?n de Radioaficionados de Cuba a sus
> miembros para respaldar el cumplimiento de los objetivos de la
> organizaci?n y su pol?tica informativa. La persona que env?a este
> correo asume el compromiso de usar el servicio a tales fines y cumplir
> con las regulaciones establecidas.

From vasdeveloper  Mon Dec 20 09:05:01 2010
From: vasdeveloper (Kannan)
Date: Mon, 20 Dec 2010 00:05:01 -0800
Subject: NIFs for ASN.1
Message-ID:

List,

Are there any specific reasons to the continued use of port drivers for
ASN.1 than NIFs? Isn't NIFs are more suitable for C level encoding/decoding
of ASN.1 PDUs?

I am using ASN.1 in SS7 and CDR.

Thanks,
Kannan.

From kenneth.lundin  Mon Dec 20 09:26:48 2010
From: kenneth.lundin (Kenneth Lundin)
Date: Mon, 20 Dec 2010 09:26:48 +0100
Subject: [erlang-questions] NIFs for ASN.1
In-Reply-To:
References:
Message-ID:

On Mon, Dec 20, 2010 at 9:05 AM, Kannan  wrote:
> List,
>
> Are there any specific reasons to the continued use of port drivers for
> ASN.1 than NIFs? Isn't NIFs are more suitable for C level encoding/decoding
> of ASN.1 PDUs?
>
> I am using ASN.1 in SS7 and CDR.

No there are no specific reasons except lack of time.
It is on the agenda to replace the port driver with NIFs for ASN.1.

NIF's is a much better choice for the kind of work needed during
ASN.1 encode/decode.

/Kenneth Erlang/OTP, Ericsson
>
>
> Thanks,
> Kannan.
>

From vasdeveloper  Mon Dec 20 11:21:52 2010
From: vasdeveloper (Kannan)
Date: Mon, 20 Dec 2010 02:21:52 -0800
Subject: [erlang-questions] NIFs for ASN.1
In-Reply-To:
References:

Message-ID:

Hi Kenneth,

Do you have a tentative timeline for such conversion?

Regards,
Kannan.

On Mon, Dec 20, 2010 at 12:26 AM, Kenneth Lundin
wrote:

> On Mon, Dec 20, 2010 at 9:05 AM, Kannan  wrote:
> > List,
> >
> > Are there any specific reasons to the continued use of port drivers for
> > ASN.1 than NIFs? Isn't NIFs are more suitable for C level
> encoding/decoding
> > of ASN.1 PDUs?
> >
> > I am using ASN.1 in SS7 and CDR.
>
> No there are no specific reasons except lack of time.
> It is on the agenda to replace the port driver with NIFs for ASN.1.
>
> NIF's is a much better choice for the kind of work needed during
> ASN.1 encode/decode.
>
> /Kenneth Erlang/OTP, Ericsson
> >
> >
> > Thanks,
> > Kannan.
> >
>

From kenneth.lundin  Mon Dec 20 14:21:12 2010
From: kenneth.lundin (Kenneth Lundin)
Date: Mon, 20 Dec 2010 14:21:12 +0100
Subject: [erlang-questions] NIFs for ASN.1
In-Reply-To:
References:

Message-ID:

We don't have a definitive plan for this, but I would expect that it
happens during
2011 sometime.

/Kenneth Erlang/OTP, Ericsson

On Mon, Dec 20, 2010 at 11:21 AM, Kannan  wrote:
> Hi Kenneth,
> Do you have a tentative timeline for such conversion?
> Regards,
> Kannan.
>
> On Mon, Dec 20, 2010 at 12:26 AM, Kenneth Lundin
> wrote:
>>
>> On Mon, Dec 20, 2010 at 9:05 AM, Kannan  wrote:
>> > List,
>> >
>> > Are there any specific reasons to the continued use of port drivers for
>> > ASN.1 than NIFs? Isn't NIFs are more suitable for C level
>> > encoding/decoding
>> > of ASN.1 PDUs?
>> >
>> > I am using ASN.1 in SS7 and CDR.
>>
>> No there are no specific reasons except lack of time.
>> It is on the agenda to replace the port driver with NIFs for ASN.1.
>>
>> NIF's is a much better choice for the kind of work needed during
>> ASN.1 encode/decode.
>>
>> /Kenneth Erlang/OTP, Ericsson
>> >
>> >
>> > Thanks,
>> > Kannan.
>> >
>
>

From attila.r.nohl  Mon Dec 20 14:32:09 2010
From: attila.r.nohl (Attila Rajmund Nohl)
Date: Mon, 20 Dec 2010 14:32:09 +0100
Subject: Fault injection for testing?
Message-ID:

Hello!

Testing error handling is complicated, because it might be hard to
cause the error situation in the first place, which in my case it's a
file writing error:

case file:write_file(FileName, <>) of
ok -> ok;
Error ->
io:format(standard_error, "~p ~p Error: '~p' ~n", [?MODULE, ?LINE, Error]),
exit(open_lastwritten_file)
end.

I could modify my code to fail is some debug flag is turned on, but it
has a (minor) performance impact. My other idea is to make sure that
the write_file fails by injecting the fault into the OTP library, i.e.
before the testcase runs in the automatic tests, load a faulty 'file'
module where the write_file function fails (I happen to know the
filename, so it won't fail for other uses), execute the testcase, then
remove the faulty file module.

Do you have any other ideas on how to test these kind of error
handling code? Testing the function separately, outside the whole
application doesn't do it, because it wouldn't detect possible
deadlocks (the original version of this code actually had a deadlock).

From ulf.wiger  Mon Dec 20 14:56:11 2010
From: ulf.wiger (Ulf Wiger)
Date: Mon, 20 Dec 2010 14:56:11 +0100
Subject: discussion: mnesia table-specific options
Message-ID: <8F5DC504-9F9E-40BF-B8AB-8B673E17C220@erlang-solutions.com>

Given that there are now several interesting performance options
for ets, and a 64-bit dets version is (sort of) in the works, it seems
a good time to consider how these things can be refl```