From rvirding@REDACTED Tue Dec 1 03:49:39 2009 From: rvirding@REDACTED (Robert Virding) Date: Tue, 1 Dec 2009 03:49:39 +0100 Subject: [erlang-questions] Concurrent processes on multi-core platforms with lots of chatter In-Reply-To: References: Message-ID: <3dbc6d1c0911301849k2a0ee5e1u9ac6d65c90325593@mail.gmail.com> Another solution would be to use the existing process groups as these are not really used very much today. A process group is defined as all the processes which have the same group leader. It is possible to change group leader. Maybe the VM could try to migrate processes to the same core as their group leader. One problem today is that afaik the VM does not keep track of groups as such, it would have to do this to be able to load balance efficiently. Robert 2009/11/30 Evans, Matthew > Hi, > > I've been running messaging tests on R13B02, using both 8 core Intel and 8 > core CAVIUM processors. The tests involve two or more processes that do > nothing more than sit in a loop exchanging messages as fast as they can. > These tests are, of course, not realistic (as in real applications do more > than sit in a tight loop sending messages), so my findings will likely not > apply to a real deployment. > > First the good news: When running tests that do more than just message > passing the SMP features of R13B02 are leaps and bounds over R12B05 that I > was running previously. What I have however noticed is that in a pure > messaging test (lots of messages, in a tight loop) we appear to run into > caching issues where messages are sent between processes that happen to be > scheduled on different cores. This got me into thinking about a future > enhancement to the Erlang VM: Process affinity. > > In this mode two or more processes that have a lot of IPC chatter would be > associated into a group and executed on the same core. If the scheduler > needed to move one process to another core - they would all be relocated. > > Although this grouping of processes could be done automatically by the VM I > believe the decision making overhead would be too great, and it would likely > make some poor choices as to what processes should be grouped together. > Rather I would leave it to the developer to make these decisions, perhaps > with a library similar to pg2. > > For example, library process affinity (paf) could have the functions: > > paf:create(Name,[Opts]) -> ok, {error, Reason} > paf:join(Name,Pid,[Opts]) -> ok, {error, Reason} > paf:leave(Name,Pid) -> ok > paf:members(Name) -> MemberList > > An affinity group would be created with options for specifying the maximum > size of the group (to ensure we don't have all processes on one core), a > default membership time within a group (to ensure we don't unnecessarily > keep a process in the group when there is no longer a need) and maybe an > option to allow the group to be split over different cores if the group size > reaches a certain threshold. > > A process would join the group with paf:join/3, and would be a member for > the default duration (with options here to override the settings specified > in paf:create). If the group is full the request is rejected (or maybe > queued). After a period of time the process is removed from the group and a > message {paf_leave, Pid} is sent to the process that issued the paf:join > command. If needed the process could be re-joined at that time with another > paf:join call. > > Any takers? R14B01 perhaps ;-) > > Thanks > > Matt > From kagato@REDACTED Tue Dec 1 04:54:58 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Mon, 30 Nov 2009 19:54:58 -0800 Subject: [erlang-questions] Concurrent processes on multi-core platforms with lots of chatter In-Reply-To: <3dbc6d1c0911301849k2a0ee5e1u9ac6d65c90325593@mail.gmail.com> References: <3dbc6d1c0911301849k2a0ee5e1u9ac6d65c90325593@mail.gmail.com> Message-ID: <4CEE5467-8823-45CE-8BCF-44BA58174A2C@souja.net> Off the top of my head, I would expect this to be a process_flag. Something like: process_flag(scheduler_affinity, term()). Possibly with a generic group specified by an atom like undefined. This feels more functional than the proposed paf module, and has the benefit of being data-centric. The reason I would use a term (and then group by the hash of the term) is because it gives an elegant way to group processes by an arbitrary (possibly application specific) key. Imagine if, for example, Mnesia grouped processes by a transaction ID, or if CouchDB grouped them by socket connection, etc. By not specifying it as an atom or an integer, it lets you just use whatever is appropriate for the application. I'm not too keen on reusing process groups primarily because group leaders are used for some really common stuff like IO, which shouldn't affect affinity at all. If we want to be really crazy, we could provide the ability to specify something like a MatchSpec to map a process group to a processor. Call it a SchedSpec. This has the added bonus that you could have multiple handlers that would match in order without having the full blown load of a gen_event or arbitrary fun. This might also provide the beginnings of more powerful prioritization than the existing process_flag(priority) we have now. Currently, the Use Case that people seem to be concerned with is ensuring locality of execution. However, some people might also want to use it to provide dedicated cores to things like system processing. I have no idea how this would fit with things like the AIO threads, but I'm pretty sure that HPC could benefit from, for example, dedicating 1 scheduler to system management tasks, 1 core to IO, and 6 cores to computation. This is a higher bar, but it's important nonetheless. Of course, this would have the user thinking about the underlying CPU topology (which I agree is bad). However, this is simply unavoidable in HPC, so it's best that we accept it. Let me state this emphatically, if we try to make Erlang "smart" about scheduling, what is going to happen is that HPC people will dig down, figure out what its doing wrong, then come back with complaints. We will never be able to make it work right for everyone without exposing these same tunables (but likely with a crappier interface). It's better to give them powerful hooks to customize the scheduler with smart default behavior for everyone else. The reason I like the process_flag(scheduler_affinity) / SchedSpec option is that it can easily start out with just the process_flag, and add something like SchedSpec's later, without having to change the API (or particularly the default behavior). Basically, you get three groups of users: * Normal People: They don't use affinity, although pieces of the system might. (effectively implemented already) * Locality Users: They use affinity for locality using the convenient process_flag interface. (easily done with additional process_flag) * HPC: They use affinity, and plugin SchedSpecs that are custom to their deployment. (can be provided when demanded without breaking first two groups) On Nov 30, 2009, at 6:49 PM, Robert Virding wrote: > Another solution would be to use the existing process groups as these are > not really used very much today. A process group is defined as all the > processes which have the same group leader. It is possible to change group > leader. Maybe the VM could try to migrate processes to the same core as > their group leader. > > One problem today is that afaik the VM does not keep track of groups as > such, it would have to do this to be able to load balance efficiently. > > Robert > > 2009/11/30 Evans, Matthew > >> Hi, >> >> I've been running messaging tests on R13B02, using both 8 core Intel and 8 >> core CAVIUM processors. The tests involve two or more processes that do >> nothing more than sit in a loop exchanging messages as fast as they can. >> These tests are, of course, not realistic (as in real applications do more >> than sit in a tight loop sending messages), so my findings will likely not >> apply to a real deployment. >> >> First the good news: When running tests that do more than just message >> passing the SMP features of R13B02 are leaps and bounds over R12B05 that I >> was running previously. What I have however noticed is that in a pure >> messaging test (lots of messages, in a tight loop) we appear to run into >> caching issues where messages are sent between processes that happen to be >> scheduled on different cores. This got me into thinking about a future >> enhancement to the Erlang VM: Process affinity. >> >> In this mode two or more processes that have a lot of IPC chatter would be >> associated into a group and executed on the same core. If the scheduler >> needed to move one process to another core - they would all be relocated. >> >> Although this grouping of processes could be done automatically by the VM I >> believe the decision making overhead would be too great, and it would likely >> make some poor choices as to what processes should be grouped together. >> Rather I would leave it to the developer to make these decisions, perhaps >> with a library similar to pg2. >> >> For example, library process affinity (paf) could have the functions: >> >> paf:create(Name,[Opts]) -> ok, {error, Reason} >> paf:join(Name,Pid,[Opts]) -> ok, {error, Reason} >> paf:leave(Name,Pid) -> ok >> paf:members(Name) -> MemberList >> >> An affinity group would be created with options for specifying the maximum >> size of the group (to ensure we don't have all processes on one core), a >> default membership time within a group (to ensure we don't unnecessarily >> keep a process in the group when there is no longer a need) and maybe an >> option to allow the group to be split over different cores if the group size >> reaches a certain threshold. >> >> A process would join the group with paf:join/3, and would be a member for >> the default duration (with options here to override the settings specified >> in paf:create). If the group is full the request is rejected (or maybe >> queued). After a period of time the process is removed from the group and a >> message {paf_leave, Pid} is sent to the process that issued the paf:join >> command. If needed the process could be re-joined at that time with another >> paf:join call. >> >> Any takers? R14B01 perhaps ;-) >> >> Thanks >> >> Matt >> -- Jayson Vantuyl kagato@REDACTED From kagato@REDACTED Tue Dec 1 05:00:44 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Mon, 30 Nov 2009 20:00:44 -0800 Subject: [erlang-questions] Concurrent processes on multi-core platforms with lots of chatter In-Reply-To: <4CEE5467-8823-45CE-8BCF-44BA58174A2C@souja.net> References: <3dbc6d1c0911301849k2a0ee5e1u9ac6d65c90325593@mail.gmail.com> <4CEE5467-8823-45CE-8BCF-44BA58174A2C@souja.net> Message-ID: <2A8E6C9C-CBD2-462E-9D98-F7EA631AFBA4@souja.net> Wait, am I confusing process groups with group_leaders? Are those the same? Even if they aren't, I still don't like repurposing pg or creating a new API. Also, the other nice bits about the process_flag option is that: 1. It keeps the all process information together under an existing, extensible API. 2. Creating and deleting affinity groups is implicit. 3. Depending on the uniformity of erlang:phash2/2, it can be used internally to handle the ranging all in native code. On Nov 30, 2009, at 7:54 PM, Jayson Vantuyl wrote: > Off the top of my head, I would expect this to be a process_flag. > > Something like: process_flag(scheduler_affinity, term()). Possibly with a generic group specified by an atom like undefined. This feels more functional than the proposed paf module, and has the benefit of being data-centric. > > The reason I would use a term (and then group by the hash of the term) is because it gives an elegant way to group processes by an arbitrary (possibly application specific) key. Imagine if, for example, Mnesia grouped processes by a transaction ID, or if CouchDB grouped them by socket connection, etc. By not specifying it as an atom or an integer, it lets you just use whatever is appropriate for the application. > > I'm not too keen on reusing process groups primarily because group leaders are used for some really common stuff like IO, which shouldn't affect affinity at all. > > If we want to be really crazy, we could provide the ability to specify something like a MatchSpec to map a process group to a processor. Call it a SchedSpec. This has the added bonus that you could have multiple handlers that would match in order without having the full blown load of a gen_event or arbitrary fun. This might also provide the beginnings of more powerful prioritization than the existing process_flag(priority) we have now. > > Currently, the Use Case that people seem to be concerned with is ensuring locality of execution. However, some people might also want to use it to provide dedicated cores to things like system processing. I have no idea how this would fit with things like the AIO threads, but I'm pretty sure that HPC could benefit from, for example, dedicating 1 scheduler to system management tasks, 1 core to IO, and 6 cores to computation. This is a higher bar, but it's important nonetheless. > > Of course, this would have the user thinking about the underlying CPU topology (which I agree is bad). However, this is simply unavoidable in HPC, so it's best that we accept it. Let me state this emphatically, if we try to make Erlang "smart" about scheduling, what is going to happen is that HPC people will dig down, figure out what its doing wrong, then come back with complaints. We will never be able to make it work right for everyone without exposing these same tunables (but likely with a crappier interface). It's better to give them powerful hooks to customize the scheduler with smart default behavior for everyone else. > > The reason I like the process_flag(scheduler_affinity) / SchedSpec option is that it can easily start out with just the process_flag, and add something like SchedSpec's later, without having to change the API (or particularly the default behavior). Basically, you get three groups of users: > > * Normal People: They don't use affinity, although pieces of the system might. (effectively implemented already) > * Locality Users: They use affinity for locality using the convenient process_flag interface. (easily done with additional process_flag) > * HPC: They use affinity, and plugin SchedSpecs that are custom to their deployment. (can be provided when demanded without breaking first two groups) > > On Nov 30, 2009, at 6:49 PM, Robert Virding wrote: > >> Another solution would be to use the existing process groups as these are >> not really used very much today. A process group is defined as all the >> processes which have the same group leader. It is possible to change group >> leader. Maybe the VM could try to migrate processes to the same core as >> their group leader. >> >> One problem today is that afaik the VM does not keep track of groups as >> such, it would have to do this to be able to load balance efficiently. >> >> Robert >> >> 2009/11/30 Evans, Matthew >> >>> Hi, >>> >>> I've been running messaging tests on R13B02, using both 8 core Intel and 8 >>> core CAVIUM processors. The tests involve two or more processes that do >>> nothing more than sit in a loop exchanging messages as fast as they can. >>> These tests are, of course, not realistic (as in real applications do more >>> than sit in a tight loop sending messages), so my findings will likely not >>> apply to a real deployment. >>> >>> First the good news: When running tests that do more than just message >>> passing the SMP features of R13B02 are leaps and bounds over R12B05 that I >>> was running previously. What I have however noticed is that in a pure >>> messaging test (lots of messages, in a tight loop) we appear to run into >>> caching issues where messages are sent between processes that happen to be >>> scheduled on different cores. This got me into thinking about a future >>> enhancement to the Erlang VM: Process affinity. >>> >>> In this mode two or more processes that have a lot of IPC chatter would be >>> associated into a group and executed on the same core. If the scheduler >>> needed to move one process to another core - they would all be relocated. >>> >>> Although this grouping of processes could be done automatically by the VM I >>> believe the decision making overhead would be too great, and it would likely >>> make some poor choices as to what processes should be grouped together. >>> Rather I would leave it to the developer to make these decisions, perhaps >>> with a library similar to pg2. >>> >>> For example, library process affinity (paf) could have the functions: >>> >>> paf:create(Name,[Opts]) -> ok, {error, Reason} >>> paf:join(Name,Pid,[Opts]) -> ok, {error, Reason} >>> paf:leave(Name,Pid) -> ok >>> paf:members(Name) -> MemberList >>> >>> An affinity group would be created with options for specifying the maximum >>> size of the group (to ensure we don't have all processes on one core), a >>> default membership time within a group (to ensure we don't unnecessarily >>> keep a process in the group when there is no longer a need) and maybe an >>> option to allow the group to be split over different cores if the group size >>> reaches a certain threshold. >>> >>> A process would join the group with paf:join/3, and would be a member for >>> the default duration (with options here to override the settings specified >>> in paf:create). If the group is full the request is rejected (or maybe >>> queued). After a period of time the process is removed from the group and a >>> message {paf_leave, Pid} is sent to the process that issued the paf:join >>> command. If needed the process could be re-joined at that time with another >>> paf:join call. >>> >>> Any takers? R14B01 perhaps ;-) >>> >>> Thanks >>> >>> Matt >>> > > > > -- > Jayson Vantuyl > kagato@REDACTED > > > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > -- Jayson Vantuyl kagato@REDACTED From jarrod@REDACTED Tue Dec 1 05:35:23 2009 From: jarrod@REDACTED (Jarrod Roberson) Date: Mon, 30 Nov 2009 23:35:23 -0500 Subject: Code critique please Message-ID: is there anything that I can do to improve this code? Are the nested case of the best way to do that? It was the only thing I could get to work. % test to see if a dns_rr.domain is subscribed to is_subscribed(_,[]) -> false; is_subscribed(Dom,[S|Rest]) -> case lists:suffix(S,Dom) of true -> {ok,S}; false -> is_subscribed(Dom,Rest) end. % process the list of resource records one at a time process_dnsrec1(Sub,[]) -> Sub; process_dnsrec1(Sub,[Response|Rest]) -> Dom = Response#dns_rr.domain, Key = {Response#dns_rr.domain,Response#dns_rr.type,Response#dns_rr.class}, case is_subscribed(Dom,dict:fetch_keys(Sub)) of {ok,SD} -> {ok,Value} = dict:find(SD,Sub), % if the ttl == Zero then we forget about the details for that server case Response#dns_rr.ttl == 0 of true -> NewSub = dict:store(SD,dict:new(),Sub), process_dnsrec1(NewSub,[]); false -> % update the dns_rr to the current timestamp NewRR = Response#dns_rr{tm=get_timestamp()}, NewValue = dict:store(Key,NewRR,Value), NewSub = dict:store(SD,NewValue,Sub), process_dnsrec1(NewSub,Rest) end; false -> process_dnsrec1(Sub,Rest) end. the entire source can be seen here -> http://github.com/fuzzylollipop/inet_mdns/blob/master/src/inet_mdns.erl From bernie@REDACTED Tue Dec 1 05:53:48 2009 From: bernie@REDACTED (Bernard Duggan) Date: Tue, 01 Dec 2009 15:53:48 +1100 Subject: [erlang-questions] Code critique please In-Reply-To: References: Message-ID: <4B14A15C.3010508@m5net.com> Jarrod Roberson wrote: > case Response#dns_rr.ttl == 0 of > true -> > NewSub = dict:store(SD,dict:new(),Sub), > process_dnsrec1(NewSub,[]); > false -> > % update the dns_rr to the current timestamp > NewRR = Response#dns_rr{tm=get_timestamp()}, > NewValue = dict:store(Key,NewRR,Value), > NewSub = dict:store(SD,NewValue,Sub), > process_dnsrec1(NewSub,Rest) > end; > > Traditionally the inner case block would be done as: Case Response#dns_rr.ttl of 0 -> % do stuff that was in 'true' block _ -> % do stuff that was in 'false' block end; Further, if you do do a comparison against 0, nine times out of ten you will want to use =:= rather than ==. The former is an exact match against the integer 0; the latter will also match the floating point value 0.0. It may not seem important now, but if, to take one example, you start using mnesia and qlc it's a really good habit to be in. If the two-level indenting/nesting of case statements bothers you, the easiest way is just to break the inner case statement out into another function..or even a function with two definitions and do away with the inner 'case' entirely: process_ttl(0) -> % do stuff in 'true' block; process_ttl(_) -> % do stuff in 'false' block Also, from a stylistic point of view, I'd be inclined to alter the return value of is_subscribed from {ok, S} to {true, S}, just because the function name appears to ask a question, and "ok" isn't really an answer :) Of course, that's all just my opinion - I'm still learning this stuff too (aren't we all?) ;) Cheers, Bernard From anders@REDACTED Tue Dec 1 06:24:25 2009 From: anders@REDACTED (Anders Dahlin) Date: Tue, 01 Dec 2009 06:24:25 +0100 Subject: [erlang-questions] Code critique please In-Reply-To: References: Message-ID: <4B14A889.5020604@dahlinenergy.se> The nested case is not needed if you use a guard for the TTL. I would probably write something like the below. Changes besides removing the nested case are mostly for readability: - Pick out multiple parts from the record at once, you could split this in to the things you need for the case (Domain and TTL) and the other later, but I don't think it adds to the readability of the code - Key construction is less obfuscated by record operations to make it clearer what the key is. - Usage of traditional comment levels with two '%%'s indentation following the code (I know erlware has a switch for this and the erlang mode that is part of otp only has that behaviour) - Also changed the return value from is_subscribed to {true, S} | false. As has already been mentioned. %% test to see if a dns_rr.domain is subscribed to is_subscribed(_, []) -> false; is_subscribed(Dom, [S| Rest]) -> case lists:suffix(S, Dom) of true -> {true, S}; false -> is_subscribed(Dom, Rest) end. %% process the list of resource records one at a time process_dnsrec1(Sub, []) -> Sub; process_dnsrec1(Sub, [Response| Rest]) -> #dns_rr{domain = Domain, type = Type, class = Class, ttl = TTL} = Response, case is_subscribed(Domain, dict:fetch_keys(Sub)) of {true, SD} when TTL =:= 0 -> %% ttl == Zero, forget about the details for that server NewSub = dict:store(SD, dict:new(), Sub), process_dnsrec1(NewSub, []); {true, SD} -> %% update the dns_rr to the current timestamp {ok, Value} = dict:find(SD, Sub), Key = {Domain, Type, Class}, NewRR = Response#dns_rr{tm = get_timestamp()}, NewValue = dict:store(Key, NewRR, Value), NewSub = dict:store(SD, NewValue, Sub), process_dnsrec1(NewSub, Rest); false -> process_dnsrec1(Sub, Rest) end. Jarrod Roberson wrote: > is there anything that I can do to improve this code? Are the nested case of > the best way to do that? It was the only thing I could get to work. > > % test to see if a dns_rr.domain is subscribed to > is_subscribed(_,[]) -> false; > is_subscribed(Dom,[S|Rest]) -> > case lists:suffix(S,Dom) of > true -> > {ok,S}; > false -> > is_subscribed(Dom,Rest) > end. > > % process the list of resource records one at a time > process_dnsrec1(Sub,[]) -> Sub; > process_dnsrec1(Sub,[Response|Rest]) -> > Dom = Response#dns_rr.domain, > Key = {Response#dns_rr.domain,Response#dns_rr.type,Response#dns_rr.class}, > case is_subscribed(Dom,dict:fetch_keys(Sub)) of > {ok,SD} -> > {ok,Value} = dict:find(SD,Sub), > % if the ttl == Zero then we forget about the details for that server > case Response#dns_rr.ttl == 0 of > true -> > NewSub = dict:store(SD,dict:new(),Sub), > process_dnsrec1(NewSub,[]); > false -> > % update the dns_rr to the current timestamp > NewRR = Response#dns_rr{tm=get_timestamp()}, > NewValue = dict:store(Key,NewRR,Value), > NewSub = dict:store(SD,NewValue,Sub), > process_dnsrec1(NewSub,Rest) > end; > false -> > process_dnsrec1(Sub,Rest) > end. > > the entire source can be seen here -> > http://github.com/fuzzylollipop/inet_mdns/blob/master/src/inet_mdns.erl > From johann.hoechtl@REDACTED Tue Dec 1 09:33:13 2009 From: johann.hoechtl@REDACTED (=?ISO-8859-15?Q?Johann_H=F6chtl?=) Date: Tue, 01 Dec 2009 09:33:13 +0100 Subject: Web Framework to choose Message-ID: <4B14D4C9.6090902@gmail.com> Hello! I am still a beginner at Erlang (but not FP in general). To get myself startet I plan to toy a bit around with the idea of automated data extraction from twitter and display statistics, etc. using an Erlang web framework. I am uncertain which framework to choose. Those have come into the shortlist: * Nitrogen * Erlang-Web * Zotonic The last one looks promising, but I am uncertain if Zotonic is not to rigid in the sense of enforcing a certain style and I do not kow if it is 'dynamic' enough. For example other CMS systems I am aware of make it hard to add dynamic content beside that is provided. Regrads, Johann From gleber.p@REDACTED Tue Dec 1 10:07:44 2009 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 1 Dec 2009 10:07:44 +0100 Subject: [erlang-questions] Web Framework to choose In-Reply-To: <4B14D4C9.6090902@gmail.com> References: <4B14D4C9.6090902@gmail.com> Message-ID: <14f0e3620912010107i32f3a8e4p6d88ae65f414ab38@mail.gmail.com> On Tue, Dec 1, 2009 at 09:33, Johann H?chtl wrote: > To get myself > startet I plan to toy a bit around with the idea of automated data > extraction from twitter and display statistics, etc. using an Erlang ?web > framework. I haven't tried Erlang Web and Zotonic, but I've used Nitrogen for some quite dynamic site and it was awesome. It's seamless support for AJAX makes it a breeze to create dynamic web sites. From alex.arnon@REDACTED Tue Dec 1 10:23:26 2009 From: alex.arnon@REDACTED (Alex Arnon) Date: Tue, 1 Dec 2009 11:23:26 +0200 Subject: [erlang-questions] Concurrent processes on multi-core platforms with lots of chatter In-Reply-To: <4CEE5467-8823-45CE-8BCF-44BA58174A2C@souja.net> References: <3dbc6d1c0911301849k2a0ee5e1u9ac6d65c90325593@mail.gmail.com> <4CEE5467-8823-45CE-8BCF-44BA58174A2C@souja.net> Message-ID: <944da41d0912010123q181f2be2n84a89d95af31d19d@mail.gmail.com> +1 And then some :) On Tue, Dec 1, 2009 at 5:54 AM, Jayson Vantuyl wrote: > Off the top of my head, I would expect this to be a process_flag. > > Something like: process_flag(scheduler_affinity, term()). Possibly with a > generic group specified by an atom like undefined. This feels more > functional than the proposed paf module, and has the benefit of being > data-centric. > > The reason I would use a term (and then group by the hash of the term) is > because it gives an elegant way to group processes by an arbitrary (possibly > application specific) key. Imagine if, for example, Mnesia grouped > processes by a transaction ID, or if CouchDB grouped them by socket > connection, etc. By not specifying it as an atom or an integer, it lets you > just use whatever is appropriate for the application. > > I'm not too keen on reusing process groups primarily because group leaders > are used for some really common stuff like IO, which shouldn't affect > affinity at all. > > If we want to be really crazy, we could provide the ability to specify > something like a MatchSpec to map a process group to a processor. Call it a > SchedSpec. This has the added bonus that you could have multiple handlers > that would match in order without having the full blown load of a gen_event > or arbitrary fun. This might also provide the beginnings of more powerful > prioritization than the existing process_flag(priority) we have now. > > Currently, the Use Case that people seem to be concerned with is ensuring > locality of execution. However, some people might also want to use it to > provide dedicated cores to things like system processing. I have no idea > how this would fit with things like the AIO threads, but I'm pretty sure > that HPC could benefit from, for example, dedicating 1 scheduler to system > management tasks, 1 core to IO, and 6 cores to computation. This is a > higher bar, but it's important nonetheless. > > Of course, this would have the user thinking about the underlying CPU > topology (which I agree is bad). However, this is simply unavoidable in > HPC, so it's best that we accept it. Let me state this emphatically, if we > try to make Erlang "smart" about scheduling, what is going to happen is that > HPC people will dig down, figure out what its doing wrong, then come back > with complaints. We will never be able to make it work right for everyone > without exposing these same tunables (but likely with a crappier interface). > It's better to give them powerful hooks to customize the scheduler with > smart default behavior for everyone else. > > The reason I like the process_flag(scheduler_affinity) / SchedSpec option > is that it can easily start out with just the process_flag, and add > something like SchedSpec's later, without having to change the API (or > particularly the default behavior). Basically, you get three groups of > users: > > * Normal People: They don't use affinity, although pieces of the system > might. (effectively implemented already) > * Locality Users: They use affinity for locality using the convenient > process_flag interface. (easily done with additional process_flag) > * HPC: They use affinity, and plugin SchedSpecs that are custom to their > deployment. (can be provided when demanded without breaking first two > groups) > > On Nov 30, 2009, at 6:49 PM, Robert Virding wrote: > > > Another solution would be to use the existing process groups as these are > > not really used very much today. A process group is defined as all the > > processes which have the same group leader. It is possible to change > group > > leader. Maybe the VM could try to migrate processes to the same core as > > their group leader. > > > > One problem today is that afaik the VM does not keep track of groups as > > such, it would have to do this to be able to load balance efficiently. > > > > Robert > > > > 2009/11/30 Evans, Matthew > > > >> Hi, > >> > >> I've been running messaging tests on R13B02, using both 8 core Intel and > 8 > >> core CAVIUM processors. The tests involve two or more processes that do > >> nothing more than sit in a loop exchanging messages as fast as they can. > >> These tests are, of course, not realistic (as in real applications do > more > >> than sit in a tight loop sending messages), so my findings will likely > not > >> apply to a real deployment. > >> > >> First the good news: When running tests that do more than just message > >> passing the SMP features of R13B02 are leaps and bounds over R12B05 that > I > >> was running previously. What I have however noticed is that in a pure > >> messaging test (lots of messages, in a tight loop) we appear to run into > >> caching issues where messages are sent between processes that happen to > be > >> scheduled on different cores. This got me into thinking about a future > >> enhancement to the Erlang VM: Process affinity. > >> > >> In this mode two or more processes that have a lot of IPC chatter would > be > >> associated into a group and executed on the same core. If the scheduler > >> needed to move one process to another core - they would all be > relocated. > >> > >> Although this grouping of processes could be done automatically by the > VM I > >> believe the decision making overhead would be too great, and it would > likely > >> make some poor choices as to what processes should be grouped together. > >> Rather I would leave it to the developer to make these decisions, > perhaps > >> with a library similar to pg2. > >> > >> For example, library process affinity (paf) could have the functions: > >> > >> paf:create(Name,[Opts]) -> ok, {error, Reason} > >> paf:join(Name,Pid,[Opts]) -> ok, {error, Reason} > >> paf:leave(Name,Pid) -> ok > >> paf:members(Name) -> MemberList > >> > >> An affinity group would be created with options for specifying the > maximum > >> size of the group (to ensure we don't have all processes on one core), a > >> default membership time within a group (to ensure we don't unnecessarily > >> keep a process in the group when there is no longer a need) and maybe an > >> option to allow the group to be split over different cores if the group > size > >> reaches a certain threshold. > >> > >> A process would join the group with paf:join/3, and would be a member > for > >> the default duration (with options here to override the settings > specified > >> in paf:create). If the group is full the request is rejected (or maybe > >> queued). After a period of time the process is removed from the group > and a > >> message {paf_leave, Pid} is sent to the process that issued the paf:join > >> command. If needed the process could be re-joined at that time with > another > >> paf:join call. > >> > >> Any takers? R14B01 perhaps ;-) > >> > >> Thanks > >> > >> Matt > >> > > > > -- > Jayson Vantuyl > kagato@REDACTED > > > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From roberto.aloi@REDACTED Tue Dec 1 10:30:18 2009 From: roberto.aloi@REDACTED (Roberto Aloi) Date: Tue, 1 Dec 2009 09:30:18 +0000 Subject: [erlang-questions] Web Framework to choose In-Reply-To: <4B14D4C9.6090902@gmail.com> References: <4B14D4C9.6090902@gmail.com> Message-ID: In Erlang Web it's quite easy to do what you need. We developed a twitter library to send and show tweets in a snap. We used an existing o_auth library for the authentication. On the other hand, zotonic will provide you all the login/search/etc features for free (that you probably need). Regards, Roberto Aloi Erlang Training and Consulting Ltd. http://erlang-consulting.com On 1 Dec 2009, at 08:33, Johann H?chtl wrote: > Hello! > > I am still a beginner at Erlang (but not FP in general). To get > myself startet I plan to toy a bit around with the idea of automated > data extraction from twitter and display statistics, etc. using an > Erlang web framework. > > I am uncertain which framework to choose. Those have come into the > shortlist: > > * Nitrogen > * Erlang-Web > * Zotonic > > The last one looks promising, but I am uncertain if Zotonic is not > to rigid in the sense of enforcing a certain style and I do not kow > if it is 'dynamic' enough. For example other CMS systems I am aware > of make it hard to add dynamic content beside that is provided. > > Regrads, > > Johann > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From hakan@REDACTED Tue Dec 1 11:02:31 2009 From: hakan@REDACTED (=?ISO-8859-1?Q?H=E5kan_Mattsson?=) Date: Tue, 1 Dec 2009 11:02:31 +0100 Subject: [erlang-questions] Concurrent processes on multi-core platforms with lots of chatter In-Reply-To: <3dbc6d1c0911301849k2a0ee5e1u9ac6d65c90325593@mail.gmail.com> References: <3dbc6d1c0911301849k2a0ee5e1u9ac6d65c90325593@mail.gmail.com> Message-ID: <922d05850912010202l40c4db49m7bb8178573de5b1a@mail.gmail.com> On Tue, Dec 1, 2009 at 3:49 AM, Robert Virding wrote: > Another solution would be to use the existing process groups as these are > not really used very much today. A process group is defined as all the > processes which have the same group leader. It is possible to change group > leader. Maybe the VM could try to migrate processes to the same core as > their group leader. This would not work so well together with the application concept, as processes in an application has the application master as group leader. Your suggestion would imply that all processes in an application would be migrated to the same core. /H?kan From roberto.ostinelli@REDACTED Tue Dec 1 11:23:44 2009 From: roberto.ostinelli@REDACTED (Roberto Ostinelli) Date: Tue, 1 Dec 2009 11:23:44 +0100 Subject: compile several modules from shell Message-ID: dear all, as many of us are, i often use multiple nodes in my erlang applications. during development, all nodes reside on the same machine. fact is, when i compile a module on one of the nodes, the other nodes are erraticly updated with the freshly compiled module, even if it is not running [probably a cache of the loaded modules, i guess]. what i experience is that some nodes get updated, some others not, in a way i cannot figure a common pattern. therefore, the only thing i have figured out to do is to compile the module on the shell of all the running nodes, issuing the c(module_to_compile) command [which forces the refresh of the loaded modules]. however, when i have to compile many modules, i find myself compiling all of them manually, repeatedly: c(module_1), c(module_2), .... on every node. this is annoying. my questions are: 1. is there another way to force the refresh [if this is the issue] so that, when i use a bash script to compile all modules all the nodes on the machine use the freshly compiled code? 2. otherwise, is ther a way to issue a shell compile on multiple modules [such as c(*) or such]? thank you, r. From roberto@REDACTED Tue Dec 1 11:32:45 2009 From: roberto@REDACTED (Roberto Ostinelli) Date: Tue, 1 Dec 2009 11:32:45 +0100 Subject: [erlang-questions] massive distribution In-Reply-To: <1259009870.3358.11.camel@gram.lan> References: <1259009870.3358.11.camel@gram.lan> Message-ID: > If you're talking about the built-in Erlang distribution mechanisms -- > FWIW: in a quick test I did a while ago I had trouble keeping stable > connections for more than ~80 connected nodes. I must admit I was a bit > surprised as the "Efficiency Guide" seems to imply that the number > should be much higher (?). > > Possibly the number of known (but not connected) nodes can be higher > than this. > > HTH, > peter. thank you peter. 80 connected nodes seems a low number if one seriously need to build cloud applications. i guess that one needs to develop his own mechanisms for interconnecting nodes in a way more similar to a custom 'mesh networking' [pardon the conceptually wrong extension of this term]? would that be more appropriate, to your belief? cheers, r. From bgustavsson@REDACTED Tue Dec 1 11:42:19 2009 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Tue, 1 Dec 2009 11:42:19 +0100 Subject: [erlang-questions] filelib:is_* is missing something necessary. In-Reply-To: References: Message-ID: <6672d0160912010242s2e6edb34sb4936bca59a67bdc@mail.gmail.com> On Sat, Nov 28, 2009 at 3:09 PM, Michael Richter wrote: > It seems to me that they're implemented in terms of > *read_file_info/1*instead of > *read_link_info/1* and I was wondering if it might not be possible to make > one of the following changes, depending on what people in the community > found most useful (I'm easy either way, personally): > > 1. Change the return values such that, say, *is_file/1* returns *true* if > the named file is a straight file, but returns *symlink* if it is a > symbolic link *to a file*. (In any other situation -- directory, symlink > to directory, special file, etc. -- it would still return *false*.) I general, we don't do backward incompatible changes, so this solution is out. (Also, we don't like is_* functions that return other values than 'true' or 'false'.) > 2. Add a predicate *is_symlink/1* so that I can first check if > something's a directory and then follow through with a check if it's a > symbolic link to one. Sounds better. > Currently I've just rewritten the predicates for my code, but in general I > prefer to use system libraries wherever possible so I'd really like to see > one of the two above approaches (or perhaps a third, superior one) written > in. My predicate for *is_symlink/1* looks like this: > > is_symlink(Name) -> > case file:read_link_info(Name) of > {ok, FileInfo} -> FileInfo#file_info.type =:= symlink > end. Are you sure want it to crash if you call it with a name of a file that does not exist? is_regular/1, for instance, returns 'false' if the file does not exist. Maybe you would like to provide a patch? The instructions for patch submission are here: http://wiki.github.com/erlang/otp/submitting-patches In order for the code to be included in the 'pu' branch so that others can test it and comment on, the code itself and a good commit message is all that is needed. In order for the patch to be included in Erlang/OTP, you (or someone else) will also need to write documentation and test cases. Since the functionality is clearly missing, it is very likely that we will actually include it in OTP. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From rtrlists@REDACTED Tue Dec 1 11:47:20 2009 From: rtrlists@REDACTED (Robert Raschke) Date: Tue, 1 Dec 2009 10:47:20 +0000 Subject: [erlang-questions] compile several modules from shell In-Reply-To: References: Message-ID: <6a3ae47e0912010247r6e243a00yde7558e23759272a@mail.gmail.com> On Tue, Dec 1, 2009 at 10:23 AM, Roberto Ostinelli < roberto.ostinelli@REDACTED> wrote: > dear all, > > as many of us are, i often use multiple nodes in my erlang > applications. during development, all nodes reside on the same > machine. > > fact is, when i compile a module on one of the nodes, the other nodes > are erraticly updated with the freshly compiled module, even if it is > not running [probably a cache of the loaded modules, i guess]. what i > experience is that some nodes get updated, some others not, in a way i > cannot figure a common pattern. > > therefore, the only thing i have figured out to do is to compile the > module on the shell of all the running nodes, issuing the > c(module_to_compile) command [which forces the refresh of the loaded > modules]. > > however, when i have to compile many modules, i find myself compiling > all of them manually, repeatedly: c(module_1), c(module_2), .... on > every node. this is annoying. > > my questions are: > > 1. is there another way to force the refresh [if this is the issue] so > that, when i use a bash script to compile all modules all the nodes on > the machine use the freshly compiled code? > 2. otherwise, is ther a way to issue a shell compile on multiple > modules [such as c(*) or such]? > > thank you, > > r. > > Mochiweb contains a neat little module called reloader, which'll reload any changed beam files that your node is aware of. Have a look at that, it might fit your bill. Robby From bengt.kleberg@REDACTED Tue Dec 1 11:49:30 2009 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 01 Dec 2009 11:49:30 +0100 Subject: [erlang-questions] compile several modules from shell In-Reply-To: References: Message-ID: <1259664570.5722.37.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Greetings, Please try the Erlang shell command nl(module_1). It is like l(module_1), but for all the (connected) nodes. bengt On Tue, 2009-12-01 at 11:23 +0100, Roberto Ostinelli wrote: > dear all, > > as many of us are, i often use multiple nodes in my erlang > applications. during development, all nodes reside on the same > machine. > > fact is, when i compile a module on one of the nodes, the other nodes > are erraticly updated with the freshly compiled module, even if it is > not running [probably a cache of the loaded modules, i guess]. what i > experience is that some nodes get updated, some others not, in a way i > cannot figure a common pattern. > > therefore, the only thing i have figured out to do is to compile the > module on the shell of all the running nodes, issuing the > c(module_to_compile) command [which forces the refresh of the loaded > modules]. > > however, when i have to compile many modules, i find myself compiling > all of them manually, repeatedly: c(module_1), c(module_2), .... on > every node. this is annoying. > > my questions are: > > 1. is there another way to force the refresh [if this is the issue] so > that, when i use a bash script to compile all modules all the nodes on > the machine use the freshly compiled code? > 2. otherwise, is ther a way to issue a shell compile on multiple > modules [such as c(*) or such]? > > thank you, > > r. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From kiszl@REDACTED Tue Dec 1 11:54:45 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Tue, 01 Dec 2009 11:54:45 +0100 Subject: [erlang-questions] compile several modules from shell In-Reply-To: References: Message-ID: <4B14F5F5.2020300@tmit.bme.hu> Roberto Ostinelli wrote: > dear all, > > as many of us are, i often use multiple nodes in my erlang > applications. during development, all nodes reside on the same > machine. > > fact is, when i compile a module on one of the nodes, the other nodes > are erraticly updated with the freshly compiled module, even if it is > not running [probably a cache of the loaded modules, i guess]. what i > experience is that some nodes get updated, some others not, in a way i > cannot figure a common pattern. > > therefore, the only thing i have figured out to do is to compile the > module on the shell of all the running nodes, issuing the > c(module_to_compile) command [which forces the refresh of the loaded > modules]. > > however, when i have to compile many modules, i find myself compiling > all of them manually, repeatedly: c(module_1), c(module_2), .... on > every node. this is annoying. > > my questions are: > > 1. is there another way to force the refresh [if this is the issue] so > that, when i use a bash script to compile all modules all the nodes on > the machine use the freshly compiled code? > 2. otherwise, is ther a way to issue a shell compile on multiple > modules [such as c(*) or such]? > > thank you, > > r. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > How about something like this? [case code:is_sticky(M) of true -> sticky; _ -> c(M), nl(M) end || {M, _} <- code:all_loaded()]. Regards, Zoltan. From erlang@REDACTED Tue Dec 1 14:23:45 2009 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 1 Dec 2009 14:23:45 +0100 Subject: [erlang-questions] compile several modules from shell In-Reply-To: References: Message-ID: <9b08084c0912010523k6d5222c9hafbe081426fb2b8d@mail.gmail.com> What you are really asking is "how can I change the default commands in the shell?" This is what the module user_default.erl is for. If you define a module called user_default compile it and put it in your erlang path then the commands in user default will be added to your shell and can be called without giving the prefix "user_default" So to redefine the behaviour of c(file) we do this: -module(user_default). -export([c/1]). c(A) when is_atom(A) -> c:c(A); c(L) when is_list(L) -> [c:c(I) || I <- L]. Compile this add it to your path and you're away: > c(spy). ./spy.erl:22: Warning: variable 'Pid' is unused {ok,spy} > c([spy,elib1_spy]). ./spy.erl:22: Warning: variable 'Pid' is unused [{ok,spy},{ok,elib1_spy}] if you want to send the code to remote nodes or whatever, this is the place to do it, if you want to do this from the shell. To see how the current commands are implement look at the code in something like /usr/local/lib/erlang/lib/stdlib-1.16.1/src/c.erl Modesty prevents me from plugging an Erlang book where this is described :-) /Joe On Tue, Dec 1, 2009 at 11:23 AM, Roberto Ostinelli wrote: > dear all, > > as many of us are, i often use multiple nodes in my erlang > applications. during development, all nodes reside on the same > machine. > > fact is, when i compile a module on one of the nodes, the other nodes > are erraticly updated with the freshly compiled module, even if it is > not running [probably a cache of the loaded modules, i guess]. what i > experience is that some nodes get updated, some others not, in a way i > cannot figure a common pattern. > > therefore, the only thing i have figured out to do is to compile the > module on the shell of all the running nodes, issuing the > c(module_to_compile) command [which forces the refresh of the loaded > modules]. > > however, when i have to compile many modules, i find myself compiling > all of them manually, repeatedly: c(module_1), c(module_2), .... on > every node. this is annoying. > > my questions are: > > 1. is there another way to force the refresh [if this is the issue] so > that, when i use a bash script to compile all modules all the nodes on > the machine use the freshly compiled code? > 2. otherwise, is ther a way to issue a shell compile on multiple > modules [such as c(*) or such]? > > thank you, > > r. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From kevin@REDACTED Tue Dec 1 15:08:29 2009 From: kevin@REDACTED (Kevin A. Smith) Date: Tue, 1 Dec 2009 09:08:29 -0500 Subject: [erlang-questions] massive distribution In-Reply-To: References: <1259009870.3358.11.camel@gram.lan> Message-ID: Fully connected meshes suck for large numbers of nodes. Erlang provides a number of knobs to control how a cluster is stitched together such as "-connect_all false" and "-hidden". Also, tuning the net tick time (see man 3 net_kernel and man 6 kernel) can be helpful in keeping a large cluster running. --Kevin On Dec 1, 2009, at 5:32 AM, Roberto Ostinelli wrote: >> If you're talking about the built-in Erlang distribution mechanisms -- >> FWIW: in a quick test I did a while ago I had trouble keeping stable >> connections for more than ~80 connected nodes. I must admit I was a bit >> surprised as the "Efficiency Guide" seems to imply that the number >> should be much higher (?). >> >> Possibly the number of known (but not connected) nodes can be higher >> than this. >> >> HTH, >> peter. > > thank you peter. > > 80 connected nodes seems a low number if one seriously need to build > cloud applications. > > i guess that one needs to develop his own mechanisms for > interconnecting nodes in a way more similar to a custom 'mesh > networking' [pardon the conceptually wrong extension of this term]? > would that be more appropriate, to your belief? > > cheers, > > r. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From peter@REDACTED Tue Dec 1 15:22:06 2009 From: peter@REDACTED (Peter Sabaini) Date: Tue, 01 Dec 2009 15:22:06 +0100 Subject: [erlang-questions] massive distribution In-Reply-To: References: <1259009870.3358.11.camel@gram.lan> Message-ID: <1259677326.1591.16.camel@w-ehs-psa.telbiomed.at> On Tue, 2009-12-01 at 09:08 -0500, Kevin A. Smith wrote: > Fully connected meshes suck for large numbers of nodes. Erlang provides a number of > knobs to control how a cluster is stitched together such as "-connect_all false" > and "-hidden". Which would entail keeping track of connected nodes and connection establishment/teardown, correct? > Also, tuning the net tick time (see man 3 net_kernel and man 6 kernel) can be helpful > in keeping a large cluster running. I fiddled around with those a bit. I don't have the exact values at hand, but I set net_ticktime to rather large values, something like 300s, without substantial improvements in the number of nodes able to keep a stable connection. peter. > --Kevin > > On Dec 1, 2009, at 5:32 AM, Roberto Ostinelli wrote: > > >> If you're talking about the built-in Erlang distribution mechanisms -- > >> FWIW: in a quick test I did a while ago I had trouble keeping stable > >> connections for more than ~80 connected nodes. I must admit I was a bit > >> surprised as the "Efficiency Guide" seems to imply that the number > >> should be much higher (?). > >> > >> Possibly the number of known (but not connected) nodes can be higher > >> than this. > >> > >> HTH, > >> peter. > > > > thank you peter. > > > > 80 connected nodes seems a low number if one seriously need to build > > cloud applications. > > > > i guess that one needs to develop his own mechanisms for > > interconnecting nodes in a way more similar to a custom 'mesh > > networking' [pardon the conceptually wrong extension of this term]? > > would that be more appropriate, to your belief? > > > > cheers, > > > > r. > > > > ________________________________________________________________ > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > erlang-questions (at) erlang.org > > > From roberto@REDACTED Tue Dec 1 15:34:16 2009 From: roberto@REDACTED (Roberto Ostinelli) Date: Tue, 1 Dec 2009 15:34:16 +0100 Subject: [erlang-questions] compile several modules from shell In-Reply-To: <9b08084c0912010523k6d5222c9hafbe081426fb2b8d@mail.gmail.com> References: <9b08084c0912010523k6d5222c9hafbe081426fb2b8d@mail.gmail.com> Message-ID: > What you are really asking is "how can I change the default commands > in the shell?" hello joe, thank you for the refreshing explanation on this, however i did read your book :) what i'm really asking is: "if i change code and re-compile a module on a local erlang node, what must i do so that the newly re-compiled .beam is also reloaded in another local erlang node?" :) therefore: must i understand from your answer that the only way is to actually use rpc and other procedures to refresh the code on all nodes? r. From thomasl_erlang@REDACTED Tue Dec 1 14:35:49 2009 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 1 Dec 2009 05:35:49 -0800 (PST) Subject: [erlang-questions] compile several modules from shell In-Reply-To: <9b08084c0912010523k6d5222c9hafbe081426fb2b8d@mail.gmail.com> References: <9b08084c0912010523k6d5222c9hafbe081426fb2b8d@mail.gmail.com> Message-ID: <33933.45215.qm@web111410.mail.gq1.yahoo.com> ----- Original Message ---- > From: Joe Armstrong > To: Roberto Ostinelli > Cc: Erlang > Sent: Tue, December 1, 2009 2:23:45 PM > Subject: Re: [erlang-questions] compile several modules from shell > > What you are really asking is "how can I change the default commands > in the shell?" > > This is what the module user_default.erl is for. > > If you define a module called user_default compile it and put it in > your erlang path > then the commands in user default will be added to your shell and can > be called without giving > the prefix "user_default" ... People have provided quite a few nice hacks in user_default over the years. Here is a fairly straightforward one you can cannibalize: http://github.com/thomasl/erlang-repl-utils/blob/master/user_default.erl I love using l/0 and nl/0, for instance. Best, Thomas From erlang@REDACTED Tue Dec 1 16:02:27 2009 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 1 Dec 2009 16:02:27 +0100 Subject: [erlang-questions] compile several modules from shell In-Reply-To: References: <9b08084c0912010523k6d5222c9hafbe081426fb2b8d@mail.gmail.com> Message-ID: <9b08084c0912010702o8290363jecebe8209a19c974@mail.gmail.com> On Tue, Dec 1, 2009 at 3:34 PM, Roberto Ostinelli wrote: >> What you are really asking is "how can I change the default commands >> in the shell?" > > hello joe, > > thank you for the refreshing explanation on this, however i did read > your book :) > > what i'm really asking is: > > "if i change code and re-compile a module on a local erlang node, what > must i do so that the newly re-compiled .beam is also reloaded in > another local erlang node?" > > :) > > therefore: must i understand from your answer that the only way is to > actually use rpc and other procedures to refresh the code on all > nodes? I think so - I'd use code:purge(Mod) and load_binary(Module, Filename, Binary) to be sure do something like: rpc:call(Node, code, purge, [Mod]), rpc:call(Node, code, load_binary, [Mod,FileName, Bin]) You can also compile directly to a binary by adding the atom binary to the compile options, thusly: {ok, Mod, Bin} = compile:file(File, [..., binary, ....]) /Joe > > r. > From peter@REDACTED Tue Dec 1 16:11:21 2009 From: peter@REDACTED (Peter Sabaini) Date: Tue, 01 Dec 2009 16:11:21 +0100 Subject: [erlang-questions] massive distribution In-Reply-To: References: <1259009870.3358.11.camel@gram.lan> Message-ID: <1259680281.1591.67.camel@w-ehs-psa.telbiomed.at> On Tue, 2009-12-01 at 11:32 +0100, Roberto Ostinelli wrote: > > If you're talking about the built-in Erlang distribution mechanisms -- > > FWIW: in a quick test I did a while ago I had trouble keeping stable > > connections for more than ~80 connected nodes. I must admit I was a bit > > surprised as the "Efficiency Guide" seems to imply that the number > > should be much higher (?). > > > > Possibly the number of known (but not connected) nodes can be higher > > than this. > > > > HTH, > > peter. > > thank you peter. > > 80 connected nodes seems a low number if one seriously need to build > cloud applications. I guess that depends on the application and what "serious" means :-) > i guess that one needs to develop his own mechanisms for > interconnecting nodes in a way more similar to a custom 'mesh > networking' [pardon the conceptually wrong extension of this term]? > would that be more appropriate, to your belief? As Kevin hinted at, one can use Erlangs' distribution protocol without using automatic connection handling. OTOH, if you for instance need more security than Erlangs distribution mechanism provide, it might be wise to invest in a custom protocol anyway. FWIW, I imagine the data serialization/deserialization functions could be reused. peter. > cheers, > > r. From filippo.pacini@REDACTED Tue Dec 1 16:26:39 2009 From: filippo.pacini@REDACTED (Filippo Pacini) Date: Tue, 01 Dec 2009 16:26:39 +0100 Subject: [erlang-questions] compile several modules from shell In-Reply-To: References: <9b08084c0912010523k6d5222c9hafbe081426fb2b8d@mail.gmail.com> Message-ID: <4B1535AF.90301@gmail.com> Hi Roberto, I'm not sure if this can help. Mochiweb has a module that during development automatically reloads updated beams. You can find it here: http://code.google.com/p/mochiweb/source/browse/trunk/src/reloader.erl cheers, Filippo Roberto Ostinelli wrote: >> What you are really asking is "how can I change the default commands >> in the shell?" > > hello joe, > > thank you for the refreshing explanation on this, however i did read > your book :) > > what i'm really asking is: > > "if i change code and re-compile a module on a local erlang node, what > must i do so that the newly re-compiled .beam is also reloaded in > another local erlang node?" > > :) > > therefore: must i understand from your answer that the only way is to > actually use rpc and other procedures to refresh the code on all > nodes? > > r. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From mevans@REDACTED Tue Dec 1 16:44:20 2009 From: mevans@REDACTED (Evans, Matthew) Date: Tue, 1 Dec 2009 10:44:20 -0500 Subject: [erlang-questions] Concurrent processes on multi-core platforms with lots of chatter In-Reply-To: <944da41d0912010123q181f2be2n84a89d95af31d19d@mail.gmail.com> References: <3dbc6d1c0911301849k2a0ee5e1u9ac6d65c90325593@mail.gmail.com> <4CEE5467-8823-45CE-8BCF-44BA58174A2C@souja.net> <944da41d0912010123q181f2be2n84a89d95af31d19d@mail.gmail.com> Message-ID: I'll second that. Although I generally agree with the direction Erlang has taken of not exposing the underlying architecture to the developer, we must realize that there is a segment of people who do care. Providing abstractions to map processes onto a specific core would provide benefits to those people. We have already gone in that direction to a small degree with the cpu_topology options (both with the -sct VM invocation arguments, and with the erlang:system_flag/2 function). ________________________________ From: Alex Arnon [mailto:alex.arnon@REDACTED] Sent: Tuesday, December 01, 2009 4:23 AM To: Jayson Vantuyl Cc: Robert Virding; Evans, Matthew; erlang-questions@REDACTED Subject: Re: [erlang-questions] Concurrent processes on multi-core platforms with lots of chatter +1 And then some :) On Tue, Dec 1, 2009 at 5:54 AM, Jayson Vantuyl > wrote: Off the top of my head, I would expect this to be a process_flag. Something like: process_flag(scheduler_affinity, term()). Possibly with a generic group specified by an atom like undefined. This feels more functional than the proposed paf module, and has the benefit of being data-centric. The reason I would use a term (and then group by the hash of the term) is because it gives an elegant way to group processes by an arbitrary (possibly application specific) key. Imagine if, for example, Mnesia grouped processes by a transaction ID, or if CouchDB grouped them by socket connection, etc. By not specifying it as an atom or an integer, it lets you just use whatever is appropriate for the application. I'm not too keen on reusing process groups primarily because group leaders are used for some really common stuff like IO, which shouldn't affect affinity at all. If we want to be really crazy, we could provide the ability to specify something like a MatchSpec to map a process group to a processor. Call it a SchedSpec. This has the added bonus that you could have multiple handlers that would match in order without having the full blown load of a gen_event or arbitrary fun. This might also provide the beginnings of more powerful prioritization than the existing process_flag(priority) we have now. Currently, the Use Case that people seem to be concerned with is ensuring locality of execution. However, some people might also want to use it to provide dedicated cores to things like system processing. I have no idea how this would fit with things like the AIO threads, but I'm pretty sure that HPC could benefit from, for example, dedicating 1 scheduler to system management tasks, 1 core to IO, and 6 cores to computation. This is a higher bar, but it's important nonetheless. Of course, this would have the user thinking about the underlying CPU topology (which I agree is bad). However, this is simply unavoidable in HPC, so it's best that we accept it. Let me state this emphatically, if we try to make Erlang "smart" about scheduling, what is going to happen is that HPC people will dig down, figure out what its doing wrong, then come back with complaints. We will never be able to make it work right for everyone without exposing these same tunables (but likely with a crappier interface). It's better to give them powerful hooks to customize the scheduler with smart default behavior for everyone else. The reason I like the process_flag(scheduler_affinity) / SchedSpec option is that it can easily start out with just the process_flag, and add something like SchedSpec's later, without having to change the API (or particularly the default behavior). Basically, you get three groups of users: * Normal People: They don't use affinity, although pieces of the system might. (effectively implemented already) * Locality Users: They use affinity for locality using the convenient process_flag interface. (easily done with additional process_flag) * HPC: They use affinity, and plugin SchedSpecs that are custom to their deployment. (can be provided when demanded without breaking first two groups) On Nov 30, 2009, at 6:49 PM, Robert Virding wrote: > Another solution would be to use the existing process groups as these are > not really used very much today. A process group is defined as all the > processes which have the same group leader. It is possible to change group > leader. Maybe the VM could try to migrate processes to the same core as > their group leader. > > One problem today is that afaik the VM does not keep track of groups as > such, it would have to do this to be able to load balance efficiently. > > Robert > > 2009/11/30 Evans, Matthew > > >> Hi, >> >> I've been running messaging tests on R13B02, using both 8 core Intel and 8 >> core CAVIUM processors. The tests involve two or more processes that do >> nothing more than sit in a loop exchanging messages as fast as they can. >> These tests are, of course, not realistic (as in real applications do more >> than sit in a tight loop sending messages), so my findings will likely not >> apply to a real deployment. >> >> First the good news: When running tests that do more than just message >> passing the SMP features of R13B02 are leaps and bounds over R12B05 that I >> was running previously. What I have however noticed is that in a pure >> messaging test (lots of messages, in a tight loop) we appear to run into >> caching issues where messages are sent between processes that happen to be >> scheduled on different cores. This got me into thinking about a future >> enhancement to the Erlang VM: Process affinity. >> >> In this mode two or more processes that have a lot of IPC chatter would be >> associated into a group and executed on the same core. If the scheduler >> needed to move one process to another core - they would all be relocated. >> >> Although this grouping of processes could be done automatically by the VM I >> believe the decision making overhead would be too great, and it would likely >> make some poor choices as to what processes should be grouped together. >> Rather I would leave it to the developer to make these decisions, perhaps >> with a library similar to pg2. >> >> For example, library process affinity (paf) could have the functions: >> >> paf:create(Name,[Opts]) -> ok, {error, Reason} >> paf:join(Name,Pid,[Opts]) -> ok, {error, Reason} >> paf:leave(Name,Pid) -> ok >> paf:members(Name) -> MemberList >> >> An affinity group would be created with options for specifying the maximum >> size of the group (to ensure we don't have all processes on one core), a >> default membership time within a group (to ensure we don't unnecessarily >> keep a process in the group when there is no longer a need) and maybe an >> option to allow the group to be split over different cores if the group size >> reaches a certain threshold. >> >> A process would join the group with paf:join/3, and would be a member for >> the default duration (with options here to override the settings specified >> in paf:create). If the group is full the request is rejected (or maybe >> queued). After a period of time the process is removed from the group and a >> message {paf_leave, Pid} is sent to the process that issued the paf:join >> command. If needed the process could be re-joined at that time with another >> paf:join call. >> >> Any takers? R14B01 perhaps ;-) >> >> Thanks >> >> Matt >> -- Jayson Vantuyl kagato@REDACTED ________________________________________________________________ erlang-questions mailing list. See http://www.erlang.org/faq.html erlang-questions (at) erlang.org From marc@REDACTED Tue Dec 1 17:08:49 2009 From: marc@REDACTED (Marc Worrell) Date: Tue, 1 Dec 2009 17:08:49 +0100 Subject: Web Framework to choose Message-ID: <97B857B2-FAA0-4656-9891-58E3B32603F9@worrell.nl> Hello Johann, As mentioned, the nice thing with Zotonic is that you get a complete CMS including an editorial interface. It is also easy to extend, you can add any field to a resource (page), add categories or define completely separate data models. Just take a look how the admin is extended by mod_admin_person or how mod_mailinglist adds its own data model for storing mailing list recipients. Modules are implemented as gen_servers, which makes it straight forward to add polling, long lasting connections or other server functionality. Best is to check the tip of the repository. The 0.1.0 download is already old :-) Kind regards, Marc Worrell. > From: Johann H?chtl > Date: 1 december 2009 09:33:13 GMT+01:00 > To: erlang-questions@REDACTED > Subject: Web Framework to choose > > > Hello! > > I am still a beginner at Erlang (but not FP in general). To get myself startet I plan to toy a bit around with the idea of automated data extraction from twitter and display statistics, etc. using an Erlang web framework. > > I am uncertain which framework to choose. Those have come into the shortlist: > > * Nitrogen > * Erlang-Web > * Zotonic > > The last one looks promising, but I am uncertain if Zotonic is not to rigid in the sense of enforcing a certain style and I do not kow if it is 'dynamic' enough. For example other CMS systems I am aware of make it hard to add dynamic content beside that is provided. > > Regrads, > > Johann From kevin@REDACTED Tue Dec 1 16:24:48 2009 From: kevin@REDACTED (Kevin A. Smith) Date: Tue, 1 Dec 2009 10:24:48 -0500 Subject: [erlang-questions] massive distribution In-Reply-To: <1259680281.1591.67.camel@w-ehs-psa.telbiomed.at> References: <1259009870.3358.11.camel@gram.lan> <1259680281.1591.67.camel@w-ehs-psa.telbiomed.at> Message-ID: <00149977-5338-4141-9C5A-DC4239EB357D@hypotheticalabs.com> On Dec 1, 2009, at 10:11 AM, Peter Sabaini wrote: > On Tue, 2009-12-01 at 11:32 +0100, Roberto Ostinelli wrote: >>> If you're talking about the built-in Erlang distribution mechanisms -- >>> FWIW: in a quick test I did a while ago I had trouble keeping stable >>> connections for more than ~80 connected nodes. I must admit I was a bit >>> surprised as the "Efficiency Guide" seems to imply that the number >>> should be much higher (?). >>> >>> Possibly the number of known (but not connected) nodes can be higher >>> than this. >>> >>> HTH, >>> peter. >> >> thank you peter. >> >> 80 connected nodes seems a low number if one seriously need to build >> cloud applications. > > I guess that depends on the application and what "serious" means :-) > > >> i guess that one needs to develop his own mechanisms for >> interconnecting nodes in a way more similar to a custom 'mesh >> networking' [pardon the conceptually wrong extension of this term]? >> would that be more appropriate, to your belief? > > As Kevin hinted at, one can use Erlangs' distribution protocol without > using automatic connection handling. OTOH, if you for instance need more > security than Erlangs distribution mechanism provide, it might be wise > to invest in a custom protocol anyway. FWIW, I imagine the data > serialization/deserialization functions could be reused. > I've rolled my own clustering bits over TCP sockets for a couple of clients. term_to_binary, binary_to_term, and {packet, 1/2/4} can significantly ease the work involved. It allows you to focus on the security bits and allow Erlang to handle reassembly and serialization. Just my $0.02 worth... --Kevin > peter. > >> cheers, >> >> r. > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From max.lapshin@REDACTED Tue Dec 1 17:16:33 2009 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 1 Dec 2009 19:16:33 +0300 Subject: [erlang-questions] Re: Web Framework to choose In-Reply-To: <97B857B2-FAA0-4656-9891-58E3B32603F9@worrell.nl> References: <97B857B2-FAA0-4656-9891-58E3B32603F9@worrell.nl> Message-ID: Zotonic is a very great work, but it would be much better, if it will migrate from CMS to CMS, written on top of framework. It is absolutely impossible to make CMS, that will fit all need (especially in such projects, that require erlang), but it is possible to copy best solutions from systems like Ruby on Rails and make Zotonic much wider used. From g@REDACTED Tue Dec 1 17:27:17 2009 From: g@REDACTED (Garrett Smith) Date: Tue, 1 Dec 2009 10:27:17 -0600 Subject: [erlang-questions] massive distribution In-Reply-To: <1259677326.1591.16.camel@w-ehs-psa.telbiomed.at> References: <1259009870.3358.11.camel@gram.lan> <1259677326.1591.16.camel@w-ehs-psa.telbiomed.at> Message-ID: On Tue, Dec 1, 2009 at 8:22 AM, Peter Sabaini wrote: > On Tue, 2009-12-01 at 09:08 -0500, Kevin A. Smith wrote: >> Fully connected meshes suck for large numbers of nodes. Erlang provides a number of >> knobs to control how a cluster is stitched together such as "-connect_all false" >> and "-hidden". > > Which would entail keeping track of connected nodes and connection > establishment/teardown, correct? > >> Also, tuning the net tick time (see man 3 net_kernel and man 6 kernel) can be helpful >> in keeping a large cluster running. > > I fiddled around with those a bit. I don't have the exact values at > hand, but I set net_ticktime to rather large values, something like > 300s, without substantial improvements in the number of nodes able to > keep a stable connection. What is happening that makes something an unstable connection? I have a mesh of several dozen nodes and the connections can drop at any time given the basic unreliability of network connections. Each node, however, is responsible for trying to reestablish a connection to a well known 'hub', which tends to keep the mesh in tact even when some nodes fall off occasionally. (This is a single point of failure, but the 'hub' could easily be a list, like DNS.) I've found that setting -connect_all false disables the global process registry, which makes the setting practically useless. I'm guess I've missed something here. What is the approach to keeping the global registry in sync when -connect_all false is set? I've also read about, but not explored, a pattern of segmenting a mesh into smaller groups of nodes. From what I understand -- that each node tries to connect to each node -- a mesh has m(n-1)/2 connections, so 80 nodes would imply 3000+ connections. For most applications, that's a lot of unneeded overhead -- not ever node is going to need to talk to every other node. When networks are small, Erlang's global process registration and lookup facility is phenomenal. But the out-of-the-box scheme definitely presents challenges in large networks. I'm definitely curious to know how others have dealt with this type of problem. Garrett From rvirding@REDACTED Tue Dec 1 17:32:35 2009 From: rvirding@REDACTED (Robert Virding) Date: Tue, 1 Dec 2009 17:32:35 +0100 Subject: [erlang-questions] Concurrent processes on multi-core platforms with lots of chatter In-Reply-To: <2A8E6C9C-CBD2-462E-9D98-F7EA631AFBA4@souja.net> References: <3dbc6d1c0911301849k2a0ee5e1u9ac6d65c90325593@mail.gmail.com> <4CEE5467-8823-45CE-8BCF-44BA58174A2C@souja.net> <2A8E6C9C-CBD2-462E-9D98-F7EA631AFBA4@souja.net> Message-ID: <3dbc6d1c0912010832r11487aa6x7232150b254cee4f@mail.gmail.com> 2009/12/1 Jayson Vantuyl > Wait, am I confusing process groups with group_leaders? Are those the > same? Even if they aren't, I still don't like repurposing pg or creating a > new API. > I mean the built-in process groups which you access with the group_leader/0/1 BIFs and *NOT* the process groups as defined using the modules pg or pg2. There is an unfortunate name clash here by pg and pg2. Robert From marc@REDACTED Tue Dec 1 17:47:53 2009 From: marc@REDACTED (Marc Worrell) Date: Tue, 1 Dec 2009 17:47:53 +0100 Subject: [erlang-questions] Re: Web Framework to choose In-Reply-To: References: <97B857B2-FAA0-4656-9891-58E3B32603F9@worrell.nl> Message-ID: I am not entirely sure what you mean by "CMS written on top of framework" and how feasible such an approach is in the long run. Though we are open to suggestions. We made Zotonic to make projects for customers. While building it we had an eye on a couple of CMS systems, notably anyMeta, Drupal and WordPress. anyMeta had a great influence, as we are rather actively involved in its development (in fact we made it). We used Erlang to solve major problems we encountered in the PHP systems most people are using. Zotonic's current direction is to add real time sharing of information, using XMPP PubSub and other protocols. Of course besides adding more functionalities needed for a CMS. Some other people are also checking to see if it can be made distributed, and if it is possible to use a key value store. We like to have a good out of the box experience, so that designers are also happy to work with Zotonic. Kind Regards, Marc Worrell On 1 dec 2009, at 17:16, Max Lapshin wrote: > Zotonic is a very great work, but it would be much better, if it will > migrate from CMS to > CMS, written on top of framework. > > It is absolutely impossible to make CMS, that will fit all need > (especially in such projects, that require erlang), > but it is possible to copy best solutions from systems like Ruby on > Rails and make Zotonic much wider used. From max.lapshin@REDACTED Tue Dec 1 17:53:07 2009 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 1 Dec 2009 19:53:07 +0300 Subject: [erlang-questions] Re: Web Framework to choose In-Reply-To: References: <97B857B2-FAA0-4656-9891-58E3B32603F9@worrell.nl> Message-ID: On Tue, Dec 1, 2009 at 7:47 PM, Marc Worrell wrote: > I am not entirely sure what you mean by "CMS written on top of framework" and how feasible such an approach is in the long run. Though we are open to suggestions. > Marc, I will prepare more exact suggestions to you about structure of Zotonic. From g@REDACTED Tue Dec 1 18:01:44 2009 From: g@REDACTED (Garrett Smith) Date: Tue, 1 Dec 2009 11:01:44 -0600 Subject: [erlang-questions] Web Framework to choose In-Reply-To: <4B14D4C9.6090902@gmail.com> References: <4B14D4C9.6090902@gmail.com> Message-ID: On Tue, Dec 1, 2009 at 2:33 AM, Johann H?chtl wrote: > Hello! > > I am still a beginner at Erlang (but not FP in general). To get myself > startet I plan to toy a bit around with the idea of automated data > extraction from twitter and display statistics, etc. using an Erlang ?web > framework. It's not a framework but mochiweb gets you an HTTP server and some nice util functions for handling requests. If you're mainly interested in solving a web related problem in Erlang, you might consider side stepping a framework for now. Garrett From jarrod@REDACTED Tue Dec 1 18:02:32 2009 From: jarrod@REDACTED (Jarrod Roberson) Date: Tue, 1 Dec 2009 12:02:32 -0500 Subject: [erlang-questions] Code critique please In-Reply-To: <4d08db370912010636s185f6a58xe421949a78a3f3b@mail.gmail.com> References: <4d08db370912010636s185f6a58xe421949a78a3f3b@mail.gmail.com> Message-ID: Thanks for all the feedback this is EXACTLY the kind of criticisms I was looking for. I am getting to understand Erlang better ( coming from 20+ years or procedural / OO background ) is it tough get my head around it. And even in a city the size of Atlanta I can't find a "mentor" to help me locally. -- Jarrod Roberson 678.551.2852 From rvirding@REDACTED Tue Dec 1 18:04:37 2009 From: rvirding@REDACTED (Robert Virding) Date: Tue, 1 Dec 2009 18:04:37 +0100 Subject: [erlang-questions] Concurrent processes on multi-core platforms with lots of chatter In-Reply-To: <922d05850912010202l40c4db49m7bb8178573de5b1a@mail.gmail.com> References: <3dbc6d1c0911301849k2a0ee5e1u9ac6d65c90325593@mail.gmail.com> <922d05850912010202l40c4db49m7bb8178573de5b1a@mail.gmail.com> Message-ID: <3dbc6d1c0912010904h640ac132ue2dcd6da8740e758@mail.gmail.com> I will try and answer these two messages together as the replies are linked. 2009/12/1 Jayson Vantuyl > I'm not too keen on reusing process groups primarily because group leaders > are used for some really common stuff like IO, which shouldn't affect > affinity at all. > 2009/12/1 H?kan Mattsson > On Tue, Dec 1, 2009 at 3:49 AM, Robert Virding wrote: > > Another solution would be to use the existing process groups as these are > > not really used very much today. A process group is defined as all the > > processes which have the same group leader. It is possible to change > group > > leader. Maybe the VM could try to migrate processes to the same core as > > their group leader. > > This would not work so well together with the application concept, as > processes > in an application has the application master as group leader. Your > suggestion > would imply that all processes in an application would be migrated to the > same > core. > The process group feature was added long-ago as a means of building multiple more-or-less separate apps (not talking about OTP apps here) each with their own set of defaults and properties within one erlang node. So each group could have its own databases, default I/O, current working directories etc, basically most data that is global to a node today, and not have to share with other groups. It would be almost like having multiple nodes within a node. It was (very) loosely modelled on unix process groups. We were thinking along the Erlang-as-an-OS line here. As the hierarchy-less process view was already well established, and the Right Thing, we kept the hierarchy created using process groups to be very loose, it is only one way, and by default not really noticeable, you inherit your parent's group. This vision was never really developed and all that process groups are used for today is default I/O. This also means that they are very sparingly used. So my direct comments: - I think the fact that process groups today are used for stuff common to the group is something which should affect affinity. Where better to put stuff common to a group of processes than close to the processes? - As process groups are used for very little, then they are very little used. There is nothing as far as I know which demands that an application is in only one group, it is done so today because that is sufficient for process groups provide. In the same way you have supervisor trees there is nothing which prohibits you from having group leader trees with different types of group leaders depending on where the group common stuff is to be handled; a group leader could pass on its requests up the tree until the right group leader is reached. I don't like the idea of adding new features to the language if there is something already there which could be used, the language is growing enough as it is, not all bad of course. Robert P.S. There is a bug in my argument which is correctable. What it is is left as problem for the reader. :-) From kiszl@REDACTED Tue Dec 1 18:14:15 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Tue, 01 Dec 2009 18:14:15 +0100 Subject: [erlang-questions] Concurrent processes on multi-core platforms with lots of chatter In-Reply-To: References: <3dbc6d1c0911301849k2a0ee5e1u9ac6d65c90325593@mail.gmail.com> <4CEE5467-8823-45CE-8BCF-44BA58174A2C@souja.net> <944da41d0912010123q181f2be2n84a89d95af31d19d@mail.gmail.com> Message-ID: <4B154EE7.4020703@tmit.bme.hu> Moving back to the original problem... Your processes need to do a lot of chatter, which means the tasks run within these processes need to have a lot of shared data. If that's the case, why don't you "migrate" the tasks onto one process? When a process of yours would create such an affinity group, it could very well say to the other process: "Hey, you are going to have too many requests for me. Instead of messaging me, run this and that task". Instead of leaving the group, it could say "Okay, just ask me if you need anything from now on.". This is doable in Erlang without any changes to the VM, and my guess is it has the same effect on performance as the affinity groups would have. Regards, Zoltan. Evans, Matthew wrote: > I'll second that. Although I generally agree with the direction Erlang has taken of not exposing the underlying architecture to the developer, we must realize that there is a segment of people who do care. Providing abstractions to map processes onto a specific core would provide benefits to those people. We have already gone in that direction to a small degree with the cpu_topology options (both with the -sct VM invocation arguments, and with the erlang:system_flag/2 function). > > ________________________________ > From: Alex Arnon [mailto:alex.arnon@REDACTED] > Sent: Tuesday, December 01, 2009 4:23 AM > To: Jayson Vantuyl > Cc: Robert Virding; Evans, Matthew; erlang-questions@REDACTED > Subject: Re: [erlang-questions] Concurrent processes on multi-core platforms with lots of chatter > > +1 > And then some :) > > On Tue, Dec 1, 2009 at 5:54 AM, Jayson Vantuyl > wrote: > Off the top of my head, I would expect this to be a process_flag. > > Something like: process_flag(scheduler_affinity, term()). Possibly with a generic group specified by an atom like undefined. This feels more functional than the proposed paf module, and has the benefit of being data-centric. > > The reason I would use a term (and then group by the hash of the term) is because it gives an elegant way to group processes by an arbitrary (possibly application specific) key. Imagine if, for example, Mnesia grouped processes by a transaction ID, or if CouchDB grouped them by socket connection, etc. By not specifying it as an atom or an integer, it lets you just use whatever is appropriate for the application. > > I'm not too keen on reusing process groups primarily because group leaders are used for some really common stuff like IO, which shouldn't affect affinity at all. > > If we want to be really crazy, we could provide the ability to specify something like a MatchSpec to map a process group to a processor. Call it a SchedSpec. This has the added bonus that you could have multiple handlers that would match in order without having the full blown load of a gen_event or arbitrary fun. This might also provide the beginnings of more powerful prioritization than the existing process_flag(priority) we have now. > > Currently, the Use Case that people seem to be concerned with is ensuring locality of execution. However, some people might also want to use it to provide dedicated cores to things like system processing. I have no idea how this would fit with things like the AIO threads, but I'm pretty sure that HPC could benefit from, for example, dedicating 1 scheduler to system management tasks, 1 core to IO, and 6 cores to computation. This is a higher bar, but it's important nonetheless. > > Of course, this would have the user thinking about the underlying CPU topology (which I agree is bad). However, this is simply unavoidable in HPC, so it's best that we accept it. Let me state this emphatically, if we try to make Erlang "smart" about scheduling, what is going to happen is that HPC people will dig down, figure out what its doing wrong, then come back with complaints. We will never be able to make it work right for everyone without exposing these same tunables (but likely with a crappier interface). It's better to give them powerful hooks to customize the scheduler with smart default behavior for everyone else. > > The reason I like the process_flag(scheduler_affinity) / SchedSpec option is that it can easily start out with just the process_flag, and add something like SchedSpec's later, without having to change the API (or particularly the default behavior). Basically, you get three groups of users: > > * Normal People: They don't use affinity, although pieces of the system might. (effectively implemented already) > * Locality Users: They use affinity for locality using the convenient process_flag interface. (easily done with additional process_flag) > * HPC: They use affinity, and plugin SchedSpecs that are custom to their deployment. (can be provided when demanded without breaking first two groups) > > On Nov 30, 2009, at 6:49 PM, Robert Virding wrote: > > >> Another solution would be to use the existing process groups as these are >> not really used very much today. A process group is defined as all the >> processes which have the same group leader. It is possible to change group >> leader. Maybe the VM could try to migrate processes to the same core as >> their group leader. >> >> One problem today is that afaik the VM does not keep track of groups as >> such, it would have to do this to be able to load balance efficiently. >> >> Robert >> >> 2009/11/30 Evans, Matthew > >> >> >>> Hi, >>> >>> I've been running messaging tests on R13B02, using both 8 core Intel and 8 >>> core CAVIUM processors. The tests involve two or more processes that do >>> nothing more than sit in a loop exchanging messages as fast as they can. >>> These tests are, of course, not realistic (as in real applications do more >>> than sit in a tight loop sending messages), so my findings will likely not >>> apply to a real deployment. >>> >>> First the good news: When running tests that do more than just message >>> passing the SMP features of R13B02 are leaps and bounds over R12B05 that I >>> was running previously. What I have however noticed is that in a pure >>> messaging test (lots of messages, in a tight loop) we appear to run into >>> caching issues where messages are sent between processes that happen to be >>> scheduled on different cores. This got me into thinking about a future >>> enhancement to the Erlang VM: Process affinity. >>> >>> In this mode two or more processes that have a lot of IPC chatter would be >>> associated into a group and executed on the same core. If the scheduler >>> needed to move one process to another core - they would all be relocated. >>> >>> Although this grouping of processes could be done automatically by the VM I >>> believe the decision making overhead would be too great, and it would likely >>> make some poor choices as to what processes should be grouped together. >>> Rather I would leave it to the developer to make these decisions, perhaps >>> with a library similar to pg2. >>> >>> For example, library process affinity (paf) could have the functions: >>> >>> paf:create(Name,[Opts]) -> ok, {error, Reason} >>> paf:join(Name,Pid,[Opts]) -> ok, {error, Reason} >>> paf:leave(Name,Pid) -> ok >>> paf:members(Name) -> MemberList >>> >>> An affinity group would be created with options for specifying the maximum >>> size of the group (to ensure we don't have all processes on one core), a >>> default membership time within a group (to ensure we don't unnecessarily >>> keep a process in the group when there is no longer a need) and maybe an >>> option to allow the group to be split over different cores if the group size >>> reaches a certain threshold. >>> >>> A process would join the group with paf:join/3, and would be a member for >>> the default duration (with options here to override the settings specified >>> in paf:create). If the group is full the request is rejected (or maybe >>> queued). After a period of time the process is removed from the group and a >>> message {paf_leave, Pid} is sent to the process that issued the paf:join >>> command. If needed the process could be re-joined at that time with another >>> paf:join call. >>> >>> Any takers? R14B01 perhaps ;-) >>> >>> Thanks >>> >>> Matt >>> >>> > > > -- > Jayson Vantuyl > kagato@REDACTED > > > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > > From zabrane3@REDACTED Tue Dec 1 18:37:19 2009 From: zabrane3@REDACTED (zabrane Mikael) Date: Tue, 1 Dec 2009 18:37:19 +0100 Subject: passing an include path to escript Message-ID: <18a1db030912010937y51eac9b6rb399631e6064cc3e@mail.gmail.com> Hi List ! I'm facing the same issue as "Wojtek" here: http://forum.trapexit.org/viewtopic.php?p=48544&sid=d7fe0c082bbea7b130d30713a2925491 Could someone please, show us a clean way to add relative paths to our ".hrl"files which are outside "lib_dir"? Regards Zabrane From stoltene2@REDACTED Tue Dec 1 19:22:33 2009 From: stoltene2@REDACTED (Eric Stolten) Date: Tue, 1 Dec 2009 13:22:33 -0500 Subject: [erlang-questions] user management code for a web site? In-Reply-To: References: <6259594.55171258991088009.JavaMail.root@zimbra> <13744342.55191258991308441.JavaMail.root@zimbra> Message-ID: I have given it a try and it is very smooth, modular, and fast. It is great to see such a well put together open source erlang application. I plan on taking a close look at their code. On Mon, Nov 23, 2009 at 10:55 AM, Olivier Sambourg < olivier.sambourg@REDACTED> wrote: > Hi, > > There's also the new Erlang CMS, Zotonic, which was announced here a couple > of days ago: > http://zotonic.com/ > Looks promising, but I haven't got the chance to give it a try yet. > > Olivier > > On Mon, Nov 23, 2009 at 4:48 PM, Roberto Aloi < > roberto.aloi@REDACTED> wrote: > > > Hi Joe, > > > > > I want to make a web site :-) > > lol > > > > > One thing I need is "all the junk to do with user management" > > Fair enough > > > > > This includes: > > > > > > - signing up for a new account > > > - "I forgot my passport" > > > - quotas and accounting > > > - rejecting "bots" that sign up for false accounts > > > - being able to send mails to gmail/etc. > > > - CAPTCHA integration etc. > > > - etc. etc. etc. > > > > > > > > > These needs are *generic* to many applications and have very little > > > to > > > do with the > > > specific application concerned. Is there an Erlang applications that > > > can do all of this? > > > I'm not concerned with presentation issues, nor with which web > > > framework to use. > > > Nor with any backend issues of which data store is used as a > > > persistent store > > > for user data. > > > > > > I just need a generic interface. Is there such a thing in Erlang? > > > > The Erlang Web framework offers an e_auth component. The idea is to have > an > > e_auth interface layer and some specific implementations. > > As far as I know they support dets tables and mnesia. They also have a > LDAP > > implementation, even if I'm not sure they ever completed it. > > More information here: > > > > http://wiki.erlang-web.org/Tutorial/Step5_Authentication?highlight=(e > > > \_auth) > > > > About the rest of your needs, I already have 80% of what you asked, but > the > > code is not released yet. This will hopefully happen in the next couple > of > > weeks. > > > > I'm still missing CAPTCHAs. I was thinking about implementing an Erlang > Web > > component for this: > > http://www.captcha.net/ > > > > I also would like to integrate my stuff with esmtp (so far I'm using my > own > > mailer): > > > > http://github.com/archaelus/esmtp > > > > Let me know if you want to share some of this work. > > > > > Failing this is there such a thing in any other language that I might > > > learn from? > > There are no languages other than Erlang and Music. Maybe Sicilian. > > > > Regards, > > > > Roberto Aloi > > Erlang Training and Consulting Ltd. > > http://www.erlang-consulting.com > > Twitter: @prof3ta > > Blog: http://aloiroberto.wordpress.com > > > > ________________________________________________________________ > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > erlang-questions (at) erlang.org > > > > > From bob@REDACTED Tue Dec 1 19:36:59 2009 From: bob@REDACTED (Bob Ippolito) Date: Tue, 1 Dec 2009 10:36:59 -0800 Subject: [erlang-questions] Web Framework to choose In-Reply-To: References: <4B14D4C9.6090902@gmail.com> Message-ID: <6a36e7290912011036m463ba9ddobaa81aa9c389d993@mail.gmail.com> On Tue, Dec 1, 2009 at 9:01 AM, Garrett Smith wrote: > On Tue, Dec 1, 2009 at 2:33 AM, Johann H?chtl wrote: >> Hello! >> >> I am still a beginner at Erlang (but not FP in general). To get myself >> startet I plan to toy a bit around with the idea of automated data >> extraction from twitter and display statistics, etc. using an Erlang ?web >> framework. > > It's not a framework but mochiweb gets you an HTTP server and some > nice util functions for handling requests. > > If you're mainly interested in solving a web related problem in > Erlang, you might consider side stepping a framework for now. If you want a little more framework than mochiweb provides you should also consider using webmachine. -bob From clist@REDACTED Tue Dec 1 21:00:20 2009 From: clist@REDACTED (Angel Alvarez) Date: Tue, 1 Dec 2009 21:00:20 +0100 Subject: OT: Computer Science historic documents Message-ID: <200912012100.20107.clist@uah.es> FYI Many computer programming language texts worth take a look http://www.fh-jena.de/~kleine/history/history.html /Angel -- "Whereas Europeans generally pronounce my name the right way ('Nick-louse Veert'), Americans invariably mangle it into 'Nickel's Worth.' This is to say that Europeans call me by name, but Americans call me by value." ->>----------------------------------------------- Clist UAH a.k.a Angel ---------------------------------[www.uah.es]-<<-- From mevans@REDACTED Tue Dec 1 21:17:37 2009 From: mevans@REDACTED (Evans, Matthew) Date: Tue, 1 Dec 2009 15:17:37 -0500 Subject: [erlang-questions] Concurrent processes on multi-core platforms with lots of chatter In-Reply-To: <4B154EE7.4020703@tmit.bme.hu> References: <3dbc6d1c0911301849k2a0ee5e1u9ac6d65c90325593@mail.gmail.com> <4CEE5467-8823-45CE-8BCF-44BA58174A2C@souja.net> <944da41d0912010123q181f2be2n84a89d95af31d19d@mail.gmail.com> <4B154EE7.4020703@tmit.bme.hu> Message-ID: Hi, The application in question needs to talk to low-level C/C++ drivers. The idea is to create a "pool" or Erlang processes that act as an interface to a linked in driver (or maybe even have NIF functions). We expect to have somewhere in the order of 10,000 Erlang processes requiring access to these drivers at any time, and for obvious reasons a pool of processes providing serialized access to the drivers makes a little more sense than every Erlang process accessing that driver directly. Now I don't imagine that the Erlang IPC is going to be the "lowest hanging fruit" in regards to performance here - far from it. But there is an internal debate as to how much code should be C/C++ vs Erlang. Anything that can show the Erlang side is efficient (I know it is - for this highly concurrent application it has proven far superior to any C++ code that has been written) will help. It's not critical that this is addressed immediately. But certainly if it was a feature on the radar of the OTP team I think it would go a long way to calming some nerves over here. Thanks Matt -----Original Message----- From: Zoltan Lajos Kis [mailto:kiszl@REDACTED] Sent: Tuesday, December 01, 2009 12:14 PM To: Evans, Matthew Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] Concurrent processes on multi-core platforms with lots of chatter Moving back to the original problem... Your processes need to do a lot of chatter, which means the tasks run within these processes need to have a lot of shared data. If that's the case, why don't you "migrate" the tasks onto one process? When a process of yours would create such an affinity group, it could very well say to the other process: "Hey, you are going to have too many requests for me. Instead of messaging me, run this and that task". Instead of leaving the group, it could say "Okay, just ask me if you need anything from now on.". This is doable in Erlang without any changes to the VM, and my guess is it has the same effect on performance as the affinity groups would have. Regards, Zoltan. Evans, Matthew wrote: > I'll second that. Although I generally agree with the direction Erlang has taken of not exposing the underlying architecture to the developer, we must realize that there is a segment of people who do care. Providing abstractions to map processes onto a specific core would provide benefits to those people. We have already gone in that direction to a small degree with the cpu_topology options (both with the -sct VM invocation arguments, and with the erlang:system_flag/2 function). > > ________________________________ > From: Alex Arnon [mailto:alex.arnon@REDACTED] > Sent: Tuesday, December 01, 2009 4:23 AM > To: Jayson Vantuyl > Cc: Robert Virding; Evans, Matthew; erlang-questions@REDACTED > Subject: Re: [erlang-questions] Concurrent processes on multi-core platforms with lots of chatter > > +1 > And then some :) > > On Tue, Dec 1, 2009 at 5:54 AM, Jayson Vantuyl > wrote: > Off the top of my head, I would expect this to be a process_flag. > > Something like: process_flag(scheduler_affinity, term()). Possibly with a generic group specified by an atom like undefined. This feels more functional than the proposed paf module, and has the benefit of being data-centric. > > The reason I would use a term (and then group by the hash of the term) is because it gives an elegant way to group processes by an arbitrary (possibly application specific) key. Imagine if, for example, Mnesia grouped processes by a transaction ID, or if CouchDB grouped them by socket connection, etc. By not specifying it as an atom or an integer, it lets you just use whatever is appropriate for the application. > > I'm not too keen on reusing process groups primarily because group leaders are used for some really common stuff like IO, which shouldn't affect affinity at all. > > If we want to be really crazy, we could provide the ability to specify something like a MatchSpec to map a process group to a processor. Call it a SchedSpec. This has the added bonus that you could have multiple handlers that would match in order without having the full blown load of a gen_event or arbitrary fun. This might also provide the beginnings of more powerful prioritization than the existing process_flag(priority) we have now. > > Currently, the Use Case that people seem to be concerned with is ensuring locality of execution. However, some people might also want to use it to provide dedicated cores to things like system processing. I have no idea how this would fit with things like the AIO threads, but I'm pretty sure that HPC could benefit from, for example, dedicating 1 scheduler to system management tasks, 1 core to IO, and 6 cores to computation. This is a higher bar, but it's important nonetheless. > > Of course, this would have the user thinking about the underlying CPU topology (which I agree is bad). However, this is simply unavoidable in HPC, so it's best that we accept it. Let me state this emphatically, if we try to make Erlang "smart" about scheduling, what is going to happen is that HPC people will dig down, figure out what its doing wrong, then come back with complaints. We will never be able to make it work right for everyone without exposing these same tunables (but likely with a crappier interface). It's better to give them powerful hooks to customize the scheduler with smart default behavior for everyone else. > > The reason I like the process_flag(scheduler_affinity) / SchedSpec option is that it can easily start out with just the process_flag, and add something like SchedSpec's later, without having to change the API (or particularly the default behavior). Basically, you get three groups of users: > > * Normal People: They don't use affinity, although pieces of the system might. (effectively implemented already) > * Locality Users: They use affinity for locality using the convenient process_flag interface. (easily done with additional process_flag) > * HPC: They use affinity, and plugin SchedSpecs that are custom to their deployment. (can be provided when demanded without breaking first two groups) > > On Nov 30, 2009, at 6:49 PM, Robert Virding wrote: > > >> Another solution would be to use the existing process groups as these are >> not really used very much today. A process group is defined as all the >> processes which have the same group leader. It is possible to change group >> leader. Maybe the VM could try to migrate processes to the same core as >> their group leader. >> >> One problem today is that afaik the VM does not keep track of groups as >> such, it would have to do this to be able to load balance efficiently. >> >> Robert >> >> 2009/11/30 Evans, Matthew > >> >> >>> Hi, >>> >>> I've been running messaging tests on R13B02, using both 8 core Intel and 8 >>> core CAVIUM processors. The tests involve two or more processes that do >>> nothing more than sit in a loop exchanging messages as fast as they can. >>> These tests are, of course, not realistic (as in real applications do more >>> than sit in a tight loop sending messages), so my findings will likely not >>> apply to a real deployment. >>> >>> First the good news: When running tests that do more than just message >>> passing the SMP features of R13B02 are leaps and bounds over R12B05 that I >>> was running previously. What I have however noticed is that in a pure >>> messaging test (lots of messages, in a tight loop) we appear to run into >>> caching issues where messages are sent between processes that happen to be >>> scheduled on different cores. This got me into thinking about a future >>> enhancement to the Erlang VM: Process affinity. >>> >>> In this mode two or more processes that have a lot of IPC chatter would be >>> associated into a group and executed on the same core. If the scheduler >>> needed to move one process to another core - they would all be relocated. >>> >>> Although this grouping of processes could be done automatically by the VM I >>> believe the decision making overhead would be too great, and it would likely >>> make some poor choices as to what processes should be grouped together. >>> Rather I would leave it to the developer to make these decisions, perhaps >>> with a library similar to pg2. >>> >>> For example, library process affinity (paf) could have the functions: >>> >>> paf:create(Name,[Opts]) -> ok, {error, Reason} >>> paf:join(Name,Pid,[Opts]) -> ok, {error, Reason} >>> paf:leave(Name,Pid) -> ok >>> paf:members(Name) -> MemberList >>> >>> An affinity group would be created with options for specifying the maximum >>> size of the group (to ensure we don't have all processes on one core), a >>> default membership time within a group (to ensure we don't unnecessarily >>> keep a process in the group when there is no longer a need) and maybe an >>> option to allow the group to be split over different cores if the group size >>> reaches a certain threshold. >>> >>> A process would join the group with paf:join/3, and would be a member for >>> the default duration (with options here to override the settings specified >>> in paf:create). If the group is full the request is rejected (or maybe >>> queued). After a period of time the process is removed from the group and a >>> message {paf_leave, Pid} is sent to the process that issued the paf:join >>> command. If needed the process could be re-joined at that time with another >>> paf:join call. >>> >>> Any takers? R14B01 perhaps ;-) >>> >>> Thanks >>> >>> Matt >>> >>> > > > -- > Jayson Vantuyl > kagato@REDACTED > > > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > > From jarrod@REDACTED Tue Dec 1 21:39:02 2009 From: jarrod@REDACTED (Jarrod Roberson) Date: Tue, 1 Dec 2009 15:39:02 -0500 Subject: [erlang-questions] massive distribution In-Reply-To: References: <1259009870.3358.11.camel@gram.lan> <1259677326.1591.16.camel@w-ehs-psa.telbiomed.at> Message-ID: the project I am working on (inet_mdns @ github.com) addresses one part of this solution. Bonjour / Zeroconf is an auto discovery protocol based on multicast dns. It is used for example by iTunes to auto-discover and publish music shares. It is used be SubEthaEdit to auto-discover and publish shared documents. I have used it very successfully to auto-discover / publish services in a multi-language platform environment in production systems. We added Zeroconf to Apache to auto-discover back end servers, we added it to memcached, so that it could be auto-discovered, we used it in J2EE applications to publish and auto-discover dependent services. We also used it in a Twisted server to auto-discover clustered nodes of other Twisted servers and publish its services to clients using the Twisted server. I am using this project as a kind of Rosetta stone because I have implemented Zeroconf in Java, Python and worked with C code. So it is a known problem domain, I am trying to recreate those implementations in Erlang as a real learning experience. There is even something called Wide Area Bonjour for service discovery over the internet proper. From peter@REDACTED Tue Dec 1 22:44:53 2009 From: peter@REDACTED (Peter Sabaini) Date: Tue, 01 Dec 2009 22:44:53 +0100 Subject: [erlang-questions] massive distribution In-Reply-To: References: <1259009870.3358.11.camel@gram.lan> <1259677326.1591.16.camel@w-ehs-psa.telbiomed.at> Message-ID: <1259703893.2947.16.camel@gram.local> On Tue, 2009-12-01 at 10:27 -0600, Garrett Smith wrote: > On Tue, Dec 1, 2009 at 8:22 AM, Peter Sabaini wrote: > > On Tue, 2009-12-01 at 09:08 -0500, Kevin A. Smith wrote: > >> Fully connected meshes suck for large numbers of nodes. Erlang provides a number of > >> knobs to control how a cluster is stitched together such as "-connect_all false" > >> and "-hidden". > > > > Which would entail keeping track of connected nodes and connection > > establishment/teardown, correct? > > > >> Also, tuning the net tick time (see man 3 net_kernel and man 6 kernel) can be helpful > >> in keeping a large cluster running. > > > > I fiddled around with those a bit. I don't have the exact values at > > hand, but I set net_ticktime to rather large values, something like > > 300s, without substantial improvements in the number of nodes able to > > keep a stable connection. > > What is happening that makes something an unstable connection? The behaviour was that nodes seemed to randomly produced error messages, eg.: =ERROR REPORT==== 9-Jul-2009::13:56:07 === The global_name_server locker process received an unexpected message: {{#Ref<0.0.0.1957>,'xy@REDACTED'},false} Or =ERROR REPORT==== 9-Jul-2009::14:03:33 === global: 'foo@REDACTED' failed to connect to 'qux@REDACTED' In my test I just tried to run "fully-meshed" ie. every node is connected to every other node; I ran 50 - 120 nodes distributed across 5 physical machines on a local, otherwise healthy, LAN. As you say, running "fully-meshed" is a lot of overhead, which might not be necessary in an actual deployment. On the other hand, the near-automatic network setup is also very convenient :-) > I have a mesh of several dozen nodes and the connections can drop at > any time given the basic unreliability of network connections. TCP/IP in a local LAN should be way more reliable than that. peter. > Each > node, however, is responsible for trying to reestablish a connection > to a well known 'hub', which tends to keep the mesh in tact even when > some nodes fall off occasionally. (This is a single point of failure, > but the 'hub' could easily be a list, like DNS.) > > I've found that setting -connect_all false disables the global process > registry, which makes the setting practically useless. I'm guess I've > missed something here. What is the approach to keeping the global > registry in sync when -connect_all false is set? > > I've also read about, but not explored, a pattern of segmenting a mesh > into smaller groups of nodes. From what I understand -- that each node > tries to connect to each node -- a mesh has m(n-1)/2 connections, so > 80 nodes would imply 3000+ connections. For most applications, that's > a lot of unneeded overhead -- not ever node is going to need to talk > to every other node. > > When networks are small, Erlang's global process registration and > lookup facility is phenomenal. But the out-of-the-box scheme > definitely presents challenges in large networks. > > I'm definitely curious to know how others have dealt with this type of problem. > > Garrett -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part URL: From peter@REDACTED Tue Dec 1 22:51:29 2009 From: peter@REDACTED (Peter Sabaini) Date: Tue, 01 Dec 2009 22:51:29 +0100 Subject: [erlang-questions] massive distribution In-Reply-To: References: <1259009870.3358.11.camel@gram.lan> <1259677326.1591.16.camel@w-ehs-psa.telbiomed.at> Message-ID: <1259704289.2947.22.camel@gram.local> On Tue, 2009-12-01 at 15:39 -0500, Jarrod Roberson wrote: > the project I am working on (inet_mdns @ github.com) addresses one part of > this solution. Cool, thanks! > Bonjour / Zeroconf is an auto discovery protocol based on multicast dns. > It is used for example by iTunes to auto-discover and publish music shares. > It is used be SubEthaEdit to auto-discover and publish shared documents. > I have used it very successfully to auto-discover / publish services in a > multi-language platform environment > in production systems. We added Zeroconf to Apache to auto-discover back end > servers, we added it to memcached, > so that it could be auto-discovered, we used it in J2EE applications to > publish and auto-discover dependent services. > We also used it in a Twisted server to auto-discover clustered nodes of > other Twisted servers and publish its services > to clients using the Twisted server. > > I am using this project as a kind of Rosetta stone because I have > implemented Zeroconf in Java, Python and worked with C code. > So it is a known problem domain, I am trying to recreate those > implementations in Erlang as a real learning experience. > There is even something called Wide Area Bonjour for service discovery over > the internet proper. > -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part URL: From g@REDACTED Tue Dec 1 23:34:27 2009 From: g@REDACTED (Garrett Smith) Date: Tue, 1 Dec 2009 16:34:27 -0600 Subject: [erlang-questions] massive distribution In-Reply-To: <1259703893.2947.16.camel@gram.local> References: <1259009870.3358.11.camel@gram.lan> <1259677326.1591.16.camel@w-ehs-psa.telbiomed.at> <1259703893.2947.16.camel@gram.local> Message-ID: On Tue, Dec 1, 2009 at 3:44 PM, Peter Sabaini wrote: > On Tue, 2009-12-01 at 10:27 -0600, Garrett Smith wrote: >> What is happening that makes something an unstable connection? > > The behaviour was that nodes seemed to randomly produced error messages, > eg.: > > =ERROR REPORT==== 9-Jul-2009::13:56:07 === > The global_name_server locker process received an unexpected message: > {{#Ref<0.0.0.1957>,'xy@REDACTED'},false} > > Or > > =ERROR REPORT==== 9-Jul-2009::14:03:33 === > global: 'foo@REDACTED' failed to connect to 'qux@REDACTED' Hmm...not to say the node count isn't part of the problem, but there are *lots* of reasons this could happen, none of which have anything to do with Erlang. > In my test I just tried to run "fully-meshed" ie. every node is > connected to every other node; I ran 50 - 120 nodes distributed across 5 > physical machines on a local, otherwise healthy, LAN. How often were you running into the "failed to connect" error above with ~120 nodes? Can you rpc to the nodes and get them to reconnect? > As you say, running "fully-meshed" is a lot of overhead, which might not > be necessary in an actual deployment. On the other hand, the > near-automatic network setup is also very convenient :-) True. But it's also a bit annoying to see all of the nodes busily trying to hook up, when I really don't need or want them to. As I've mentioned before, I use -connect_all false but then lose the global process registry. What's the solution? I probably just need to dig deeper. >> I have a mesh of several dozen nodes and the connections can drop at >> any time given the basic unreliability of network connections. > > TCP/IP in a local LAN should be way more reliable than that. But not 100%. Something's going to fall over at some point and you're going to need to deal with it. I use a state machine that monitors a node's connection to another and goes into a retry mode when something drops. This works well. My concern is in how the myriad distributed features of Erlang (global process registry, again, being just one example) deals with large meshes. If the errors you're seeing are revealing a problem with Erlang in large networks, it'd be interesting to get to the underlying cause. I think ultimately it's crazy to expect n(n-1) to scale, so at some point the thing needs to be partitioned. Garrett From kagato@REDACTED Wed Dec 2 00:46:32 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Tue, 1 Dec 2009 15:46:32 -0800 Subject: [erlang-questions] Concurrent processes on multi-core platforms with lots of chatter In-Reply-To: <3dbc6d1c0912010904h640ac132ue2dcd6da8740e758@mail.gmail.com> References: <3dbc6d1c0911301849k2a0ee5e1u9ac6d65c90325593@mail.gmail.com> <922d05850912010202l40c4db49m7bb8178573de5b1a@mail.gmail.com> <3dbc6d1c0912010904h640ac132ue2dcd6da8740e758@mail.gmail.com> Message-ID: <8F5C2AA2-1A63-497E-9C41-D08914716B96@souja.net> > This vision was never really developed and all that process groups are used > for today is default I/O. This also means that they are very sparingly used. I have code that manipulates the group_leader precisely to control where default IO happens and where SASL logs go. I would rather not have this break. > - I think the fact that process groups today are used for stuff common to > the group is something which should affect affinity. Where better to put > stuff common to a group of processes than close to the processes? I don't think that the current semantics of process groups can accommodate this. By doing this, you either bind logging, default IO, and affinity, or you break any code that uses group_leader to manage logging and default IO. I would imagine that the latter is pretty painful. > - As process groups are used for very little, then they are very little > used. There is nothing as far as I know which demands that an application is > in only one group, it is done so today because that is sufficient for > process groups provide. In the same way you have supervisor trees there is > nothing which prohibits you from having group leader trees with different > types of group leaders depending on where the group common stuff is to be > handled; a group leader could pass on its requests up the tree until the > right group leader is reached. Again, we're overloading a concept. If we had keyed group leaders, this might make sense. Something like group_leader(GroupLeader,Pid,GroupKey), so you could do group_leader(Leader,self(),affinity). However, I don't particularly see this as more effective than a process_flag, and I am loathe to break any custom code for directing SASL logs or default IO. This is a *big thing*. Another mark in favor of process_flag is that it doesn't require an arbitrary leader process. When a group_leader exits it appears from my limited testing that the processes old group_leader is still returned by the group_leader function. I'm not sure that this is the right behavior for affinity. Similarly, there may not be a suitable leader process in all situations, and tossing around extra processes for this seems like more work than necessary. I can't imagine that this makes it any easier on the scheduling side either. Migration of a group_leader would be a big deal, as tons of processes might follow it. Allocating affine processes from a hash is a static matter with low overhead. Making group_leaders "static" doesn't really help either, as it's more interface overhead (and may create load issues unless you rebalance them, again with a hash, just like I propose with process_flag). Again, affinity with process_flag requires one line of code per worker, ever. No processes are special, which is nice. The little bits of extra work associated with managing processes is one more thing on the pile of stuff that makes Erlang code unnecessarily verbose (which, honestly, is already quite significant). One thing I did notice was that group_leader is explicitly inherited. This is important, because I think that's a behavior of process affinity that has been assumed, but nobody mentioned it yet. Using group_leader would definitely imply inheritance. > I don't like the idea of adding new features to the language if there is > something already there which could be used, the language is growing enough > as it is, not all bad of course. Ironically, that's the same reason I recommended process_flag. Process_flag exists already and is designed to be extensible. I didn't really see this as an added feature, so much as a completely backwards-compatible extension to an intentionally extensible interface. Unless you're talking about the feature of affinity, which is added in either case. -- Jayson Vantuyl kagato@REDACTED From jarrod@REDACTED Wed Dec 2 00:57:40 2009 From: jarrod@REDACTED (Jarrod Roberson) Date: Tue, 1 Dec 2009 18:57:40 -0500 Subject: [erlang-questions] massive distribution In-Reply-To: <18a1db030912011306j562b6174ybfe559d412ee0431@mail.gmail.com> References: <1259009870.3358.11.camel@gram.lan> <1259677326.1591.16.camel@w-ehs-psa.telbiomed.at> <18a1db030912011306j562b6174ybfe559d412ee0431@mail.gmail.com> Message-ID: On Tue, Dec 1, 2009 at 4:06 PM, zabrane Mikael wrote: > Hi Jarrod ! > > Is "inet_mdns" ready to use? > Could you please give me a short example of how to use it in real world? > > Regards > Zabrane > it isn't finished by a long shot, but I do have "browsing" or "subscriptions" working. you start it like. {S.Pid}=inet_mdns:start(). then to be notified about say, iTunes you would subscribe to that "domain" ( _daap._tcp.local ) inet_mdns:subscribed("_daap._tcp.local",Pid). Then start iTunes, it will broadcast about it self on start up. I don't have sending of queries working yet. and then you can "browse" for the results by Results = inet_mdns:getsubscriptions(Pid). where Results is just a nested Dict of all the subscribed domains. Note: that the public interface is only like 5 days old, I am going to change it. Especially with critique and feedback from the group. I am going to build custom Results objects and add parsing of TXT records into Dicts. There is lots of work to do. From jarrod@REDACTED Wed Dec 2 01:10:52 2009 From: jarrod@REDACTED (Jarrod Roberson) Date: Tue, 1 Dec 2009 19:10:52 -0500 Subject: [erlang-questions] Code critique please In-Reply-To: <4d08db370912010636s185f6a58xe421949a78a3f3b@mail.gmail.com> References: <4d08db370912010636s185f6a58xe421949a78a3f3b@mail.gmail.com> Message-ID: thanks for the github pull request, other than one small typo in the very last process_response function which was missing the Val argument it works. Thanks for the input it much more functional looking now. I am going to really study what you did so I can use those techniques going forward. From nick@REDACTED Wed Dec 2 01:29:22 2009 From: nick@REDACTED (Nick Gerakines) Date: Tue, 1 Dec 2009 16:29:22 -0800 Subject: SFErlounge, hosted by LinkedIn Message-ID: Friday, December 11th, 2009 from 6:00 pm to 8:00 pm. I'm pleased to announce that LinkedIn is hosting the next San Francisco Erlounge in Mountain View. The event is open to the public. Erlang developers, functional programming folks and the curious are welcome to this social event. Light food and drinks will be provided. There isn't a set agenda so please let me know if you'd like to present. Otherwise, we'll go over the EUC slides and presentation and host a related discussion which I'm sure will be a lot of fun. LinkedIn Corporation 2027 Stierlin Court Mountain View, CA 94043 As always, we greatly appreciate it when you RSVP. Please direct any questions or comments to nick+sferlounge@REDACTED I can also be reached on my mobile phone, +1 (415) 963-1165. There is ample parking in and around the area/building. If you plan on attending from the city, please consider carpooling or taking caltrain because traffic around 5:30pm / 6:00pm isn't so fun. I'll make myself available to help people get to and from caltrain if needed, but please let me know ahead of time so I can schedule accordingly. As always, the same or better information can be found at http://sferlounge.com/. If you are interested in hosting or have questions, don't hesitate to contact me. # Nick Gerakines From carlo.cabanilla@REDACTED Wed Dec 2 02:28:53 2009 From: carlo.cabanilla@REDACTED (Carlo Cabanilla) Date: Tue, 1 Dec 2009 20:28:53 -0500 Subject: erlang search engine library? Message-ID: <1af9aae30912011728q4e966e27pb25b0b8efd9a0312@mail.gmail.com> Hi, Is there a widely used search engine library for Erlang? Something similar to Java's Lucene. I know Joe wrote one in Programming Erlang, what's the license on that code? Has anyone made the effort to transcribe it and slap it on Github? I wrote Erl4j (http://github.com/clofresh/erl4j) in order to write Lucene indexes from Erlang but I was wondering if I could build full text search indexes from native Erlang instead. -- .Carlo syntacticbayleaves.com From kagato@REDACTED Wed Dec 2 02:41:09 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Tue, 1 Dec 2009 17:41:09 -0800 Subject: [erlang-questions] erlang search engine library? In-Reply-To: <1af9aae30912011728q4e966e27pb25b0b8efd9a0312@mail.gmail.com> References: <1af9aae30912011728q4e966e27pb25b0b8efd9a0312@mail.gmail.com> Message-ID: <80FB8CEE-4FC9-4454-8497-B3774BFB7AB3@souja.net> Kevin Smith wrote Giza, which is an Erlang library to interface with Sphinx. Unsure about others. http://github.com/kevsmith/giza On Dec 1, 2009, at 5:28 PM, Carlo Cabanilla wrote: > Hi, > > Is there a widely used search engine library for Erlang? Something similar > to Java's Lucene. I know Joe wrote one in Programming Erlang, what's the > license on that code? Has anyone made the effort to transcribe it and slap > it on Github? > > I wrote Erl4j (http://github.com/clofresh/erl4j) in order to write Lucene > indexes from Erlang but I was wondering if I could build full text search > indexes from native Erlang instead. > > -- > > > .Carlo > syntacticbayleaves.com -- Jayson Vantuyl kagato@REDACTED From jarrod@REDACTED Wed Dec 2 04:04:52 2009 From: jarrod@REDACTED (Jarrod Roberson) Date: Tue, 1 Dec 2009 22:04:52 -0500 Subject: [erlang-questions] erlang search engine library? In-Reply-To: <1af9aae30912011728q4e966e27pb25b0b8efd9a0312@mail.gmail.com> References: <1af9aae30912011728q4e966e27pb25b0b8efd9a0312@mail.gmail.com> Message-ID: On Tue, Dec 1, 2009 at 8:28 PM, Carlo Cabanilla wrote: > Hi, > > Is there a widely used search engine library for Erlang? Something similar > to Java's Lucene. I know Joe wrote one in Programming Erlang, what's the > license on that code? Has anyone made the effort to transcribe it and slap > it on Github? > > I wrote Erl4j (http://github.com/clofresh/erl4j) in order to write Lucene > indexes from Erlang but I was wondering if I could build full text search > indexes from native Erlang instead. I know this doesn't help you right now but I have a backburner project I am working on to create a Erlang interface to Xapian. Once I get my current inet_mdns project finished I am going to start working on that. -- Jarrod Roberson www.vertigrated.com/blog/ AIM: jarrodhroberson GoogleTalk jarrod.roberson 678.551.2852 From kevin@REDACTED Wed Dec 2 04:20:35 2009 From: kevin@REDACTED (Kevin A. Smith) Date: Tue, 1 Dec 2009 22:20:35 -0500 Subject: [erlang-questions] erlang search engine library? In-Reply-To: <80FB8CEE-4FC9-4454-8497-B3774BFB7AB3@souja.net> References: <1af9aae30912011728q4e966e27pb25b0b8efd9a0312@mail.gmail.com> <80FB8CEE-4FC9-4454-8497-B3774BFB7AB3@souja.net> Message-ID: <02204045-49ED-4FB9-95AC-FC04607B667E@hypotheticalabs.com> It's been on the back burner for a while due to other client work but I'm interested in moving giza forward with help from others. In other words, patches and suggestions (with patches), are always welcome! --Kevin On Dec 1, 2009, at 8:41 PM, Jayson Vantuyl wrote: > Kevin Smith wrote Giza, which is an Erlang library to interface with Sphinx. Unsure about others. > > http://github.com/kevsmith/giza > > On Dec 1, 2009, at 5:28 PM, Carlo Cabanilla wrote: > >> Hi, >> >> Is there a widely used search engine library for Erlang? Something similar >> to Java's Lucene. I know Joe wrote one in Programming Erlang, what's the >> license on that code? Has anyone made the effort to transcribe it and slap >> it on Github? >> >> I wrote Erl4j (http://github.com/clofresh/erl4j) in order to write Lucene >> indexes from Erlang but I was wondering if I could build full text search >> indexes from native Erlang instead. >> >> -- >> >> >> .Carlo >> syntacticbayleaves.com > > > -- > Jayson Vantuyl > kagato@REDACTED > > > > > From mml6364@REDACTED Wed Dec 2 06:12:16 2009 From: mml6364@REDACTED (mliu) Date: Tue, 1 Dec 2009 21:12:16 -0800 (PST) Subject: ll_alloc reallocate crash In-Reply-To: <19210.40207.491057.303903@pilspetsen.it.uu.se> References: <19210.40207.491057.303903@pilspetsen.it.uu.se> Message-ID: <85c2876d-7757-49e8-a680-6622302bf7f7@s31g2000yqs.googlegroups.com> Thanks, Mikael, for the suggestions. The 3GB ceiling did look very suspicious to me too that it was an address space problem. Just an update for future reference. After building with 64bit erlang, we are able to take it far beyond 3GB. But, as some of the other posts mentioned, erlang/otp's choice to use lists by default in many places greatly impacts memory use. It turned out we could only support 150K connections with ~7GB of memory used in the 64bit build. We're also aware of efficiency gains using binary, and tried to maximize its use, so it looks to me this 2-fold increase in memory is the minimum we can expect. So with the current hardware of the machine (8GB), we end up with the same number of connections for 32/64 bit, with cpu use remaining consistently low. We did think about using multiple 32bit nodes on the same machine to segment connection handling across nodes, but weren't sure whether the cost in complexity introduced and the extra overhead in inter-node message passing would balance out with the cost of simply just adding more memory. If anyone has any insights in this regard, please reply. Thanks, Mike From jarrod@REDACTED Wed Dec 2 06:45:38 2009 From: jarrod@REDACTED (Jarrod Roberson) Date: Wed, 2 Dec 2009 00:45:38 -0500 Subject: [erlang-questions] Code critique please In-Reply-To: <4d08db370912010636s185f6a58xe421949a78a3f3b@mail.gmail.com> References: <4d08db370912010636s185f6a58xe421949a78a3f3b@mail.gmail.com> Message-ID: On Tue, Dec 1, 2009 at 9:36 AM, Hynek Vychodil wrote: > > I would prefer something like this: > > process_dnsrec(Sub,{ok,#dns_rec{anlist=Responses}}) -> > ? ?dict:map(fun(S, V) -> process_responses(S, V, Responses) end, Sub). > > % process the list of resource records one at a time > process_responses(S, Value, Responses) -> > ? ?lists:foldl(fun(#dns_rr{domain = Domain} = Response, Val) -> > ? ? ? ?process_response(lists:suffix(S, Domain), Response, Val) > ? ?end, Value, Responses). > > process_response(false, _Response, Val) -> Val; > process_response(true, #dns_rr{ttl = TTL} = Response, Val) when TTL == 0 -> > ? ?dict:new(); > process_response(true, #dns_rr{domain = Domain, type = Type, class = > Class} = Response) -> > ? ?NewRR = Response#dns_rr{tm=get_timestamp()}, > ? ?dict:store({Domain, Type, Class}, NewRR, Val). > > You have got pull request on hithub ;-) > thanks for the help, this really set off a lightbulb for me! I was able to add TXT record data parsing with your example and the other foldl example from Zoltan Lajos Kis I came up with this on my own. process_response(true, #dns_rr{domain = Domain, type = Type, class = Class} = Response, Val) when Type == txt -> ????DTXT = lists:foldl(fun(T,D) -> [K,V] = re:split(T,"=",[{return,list}]),dict:store(K,V,D) end,dict:new(),Response#dns_rr.data), ????NewRR = Response#dns_rr{tm=get_timestamp(),data=DTXT}, ????dict:store({Domain,Type,Class},NewRR,Val); note: I had to get rid of the string:tokens since I ended up getting things like "url=" and I was getting "bad_match" errors. So I had to learn someelse new, the re module! Next up is actually sending the Queries to generate the responses without having to get iChat to broadcast manually. -- Jarrod Roberson www.vertigrated.com/blog/ From kagato@REDACTED Wed Dec 2 09:01:07 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Wed, 2 Dec 2009 00:01:07 -0800 Subject: gen_udp:connect/3 Message-ID: <3F6752D7-E396-483F-A62C-237C580646E0@souja.net> Dear Erlangers, Is this call guaranteed to be stable? I have a unique problem. My application is going to be deployed in a range of environments where it is not trivial to know what your IP address is. It's also critical that I determine the address without generating traffic and in a way that gets its local address, not the address that might be assigned by NAT. That's largely because its IP address is being used to detect NAT, so I can't just ask a public server. It turns out that this is a fairly open problem in with sockets, especially if DNS isn't configured just right. The best option I've found is opening a UDP socket, connecting it to some presumably non-local address, and then asking what the source socket is. In the Erlang shell, this looks something like this: > Erlang R13B (erts-5.7.1) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false] > > Eshell V5.7.1 (abort with ^G) > 1> {ok,U} = gen_udp:open(0). > {ok,#Port<0.435>} > 2> gen_udp:connect(U,"1.2.3.4",1234). > ok > 3> inet:sockname(U). > {ok,{{192,168,3,239},59163}} > 4> The catch is that gen_udp:connect/3 isn't documented. Is there some guarantee that this API will be supported (and hopefully someday documented)? Also, does anybody have any idea if this works well across Windows versions? Thanks, -- Jayson Vantuyl kagato@REDACTED From erlang@REDACTED Wed Dec 2 10:28:58 2009 From: erlang@REDACTED (Joe Armstrong) Date: Wed, 2 Dec 2009 10:28:58 +0100 Subject: Best practice for defining functions with edoc,erlc,eunit and the dialyzer Message-ID: <9b08084c0912020128w6d5e685dq2dd259e82806d2aa@mail.gmail.com> Best practice for writing documenting and testing code I'd like to try and define "best practice" for writing documenting and testing Erlang code. I want to use: - only the tools supplied in the OTP release So I use: - eunit for unit testing - the dialyzer for checking my code - edoc for documenting things - type specifications for specifying types These tools do not completely "play together" in a satisfactory manner, so I'd like to define what I thing is "best practice" and hope that by doing so the tools will converge. Let's suppose I want to define the good 'ol factorial. Here's a module called elib1_best.erl. I've written it in such a way that it can be processed by erlc,eunit,edoc and the dialyzer - read the footnotes in brackets for an explanation. -module(elib1_best). %% [1] %% elib1_best: Best practice template for library modules [2] %% Time-stamp: <2009-12-02 09:43:12 ejoearm> [3] %%---------------------------------------------------------------------- %% Copyright (c) 2009 Joe Armstrong [4] %% Copyright (c) 2009 Whoomph Software AB %% %% Permission is hereby granted, free of charge, to any person %% obtaining a copy of this software and associated documentation %% files (the "Software"), to deal in the Software without %% restriction, including without limitation the rights to use, copy, %% modify, merge, publish, distribute, sublicense, and/or sell copies %% of the Software, and to permit persons to whom the Software is %% furnished to do so, subject to the following conditions: %% %% The above copyright notice and this permission notice shall be %% included in all copies or substantial portions of the Software. %% %% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, %% EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF %% MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND %% NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS %% BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN %% ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN %% CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE %% SOFTWARE. %%----------------------------------------------------------------------- -include_lib("eunit/include/eunit.hrl"). %% [5] -export([fac/1]). %% [6] %% @doc fac(N) computes factorial(N) using a fast %% iterative algorithm. [7] -spec fac(integer()) -> integer(). [8] fac(N) when is_integer(N), N >= 0 -> fac1(N, 1). fac1(0, K) -> K; fac1(N, K) -> fac1(N-1, K*N). fac_test() -> %% [9] 6 = fac(3), 24 = fac(4). %% Notes: %% [1] - module on line 1 %% [2] - module comment %% [3] - Time stamp auto generated by emacs. %% Must be near start of file %% [4] - Copyright (I always forget this, but adding a %% copyright reduces the pain later %% [5] - Needed for eunit %% [6] - use export and NOT compile(export_all) %% [7] - @doc comes first %% [8] - -spec comes immediately *before* the function %% [9] - test cases come immediately after the function %% end of module ... Now let's see what happens: 1) Compiling erlc +warn_missing_spec -o ../ebin -W elib1_best.erl ./elib1_best.erl:0: Warning: missing specification for function test/0 ./elib1_best.erl:44: Warning: missing specification for function fac_test/0 Best practice is to support type specifications for all exported functions. But eunit magically adds a function test/0 and I really don't want to have to add manual exports and type specs for fac_test/0. [A fix is needed to erlc here, OR eunit can add type specs, I think the latter is better - erlc should not need to know about eunit] 2) Dialyzing dialyzer --src elib1_best.erl Checking whether the PLT /home/ejoearm/.dialyzer_plt is up-to-date... yes Proceeding with analysis... Unknown functions: eunit:test/1 done in 0m0.32s done (passed successfully) This is ok - I could add eunit to my plt if I wanted ... the dialyzer warns for missing functions so I don't need to run xref 3) Documentation I'll run edoc on everything in the current directory putting the results in ../doc > erl -noshell -eval "edoc:application(lib, \".\", [{dir,\"../doc\"}])" \ -s init stop This works fine and ../doc/elib1_best.html has the documentation but now edoc has not found my nice -spec declaration and thinks that fac has type: fac(N) -> any() Why: because edoc and erlc don't use the same type parser. Current best practice is to use -spec (in code) and not @spec (in edoc comments) [A fix is needed here to edoc, to understand -spec's] 4) Testing 1> eunit:test(elib1_best, [verbose]). ======================== EUnit ======================== elib1_best: fac_test (module 'elib1_best')...ok ======================================================= Test passed. ok Great ... Now for questions. 1) Does this represent best practice? Is this the best way to write code? - can anybody improve on this? [And yes I know about quickcheck, but I'm only concerned with SW in the OTP release] 2) If I write like this can I assume that one day edoc and eunit and erlc will converge so that I get correctly displayed types in edoc and no warnings in erlc etc? 3) Does anything else have to be fixed? 4) Improvements.. I can think of one. I have some code to convert .erl to .html with correctly colored code and hyperlinks etc. So I can "surf" the code. It would be nice to have hooks into edoc so I can call this code That's all for now ... /Joe From peter@REDACTED Wed Dec 2 11:07:36 2009 From: peter@REDACTED (Peter Sabaini) Date: Wed, 02 Dec 2009 11:07:36 +0100 Subject: [erlang-questions] massive distribution In-Reply-To: References: <1259009870.3358.11.camel@gram.lan> <1259677326.1591.16.camel@w-ehs-psa.telbiomed.at> <1259703893.2947.16.camel@gram.local> Message-ID: <1259748456.26113.17.camel@w-ehs-psa.telbiomed.at> On Tue, 2009-12-01 at 16:34 -0600, Garrett Smith wrote: > On Tue, Dec 1, 2009 at 3:44 PM, Peter Sabaini wrote: > > On Tue, 2009-12-01 at 10:27 -0600, Garrett Smith wrote: > >> What is happening that makes something an unstable connection? > > > > The behaviour was that nodes seemed to randomly produced error messages, > > eg.: > > > > =ERROR REPORT==== 9-Jul-2009::13:56:07 === > > The global_name_server locker process received an unexpected message: > > {{#Ref<0.0.0.1957>,'xy@REDACTED'},false} > > > > Or > > > > =ERROR REPORT==== 9-Jul-2009::14:03:33 === > > global: 'foo@REDACTED' failed to connect to 'qux@REDACTED' > > Hmm...not to say the node count isn't part of the problem, but there > are *lots* of reasons this could happen, none of which have anything > to do with Erlang. My evidence is that these problems appeared (with little load) when I increased the nodecount, and disappeared (even under heavy load) when going beyond a threshold (seemed stable with 64 nodes in my case). I didn't investigate this further though as I was more interested in the behaviour of my application. > > In my test I just tried to run "fully-meshed" ie. every node is > > connected to every other node; I ran 50 - 120 nodes distributed across 5 > > physical machines on a local, otherwise healthy, LAN. > > How often were you running into the "failed to connect" error above > with ~120 nodes? Can you rpc to the nodes and get them to reconnect? I don't have the setup at hand anymore, but as far as I can remember with 120 nodes the connection errors would occur quite frequently, and the nodes would then be considered down. > > As you say, running "fully-meshed" is a lot of overhead, which might not > > be necessary in an actual deployment. On the other hand, the > > near-automatic network setup is also very convenient :-) > > True. But it's also a bit annoying to see all of the nodes busily > trying to hook up, when I really don't need or want them to. As I've > mentioned before, I use -connect_all false but then lose the global > process registry. What's the solution? I probably just need to dig > deeper. > > >> I have a mesh of several dozen nodes and the connections can drop at > >> any time given the basic unreliability of network connections. > > > > TCP/IP in a local LAN should be way more reliable than that. > > But not 100%. Something's going to fall over at some point and you're > going to need to deal with it. I use a state machine that monitors a > node's connection to another and goes into a retry mode when something > drops. This works well. > My concern is in how the myriad distributed features of Erlang (global > process registry, again, being just one example) deals with large > meshes. If the errors you're seeing are revealing a problem with > Erlang in large networks, it'd be interesting to get to the underlying > cause. Right, thats what I was getting at -- there is no such thing as absolute reliability, but OTOH the connection problems I observed cannot be explained by TCP/IP unreliability. Yeah, would be interesting to explore this further. I was pretty strapped for time when I tried this, but maybe I get around to do this one of these days. peter. > I think ultimately it's crazy to expect n(n-1) to scale, so at some > point the thing needs to be partitioned. > > Garrett From Jakub.Zawierucha@REDACTED Wed Dec 2 11:26:03 2009 From: Jakub.Zawierucha@REDACTED (Jakub Zawierucha) Date: Wed, 02 Dec 2009 11:26:03 +0100 Subject: xmerl_sax_parser node information trivial problem Message-ID: <4B1640BB.5020209@nit.pl> Hello, I'm trying to write a simple app that will process XML file and give me information about some nodes. I need to know how many attributes and children nodes are avaliable in that node. I know how to obtain attr count (just count Attributes) but how about children nodes ? Any ideas ? i have: do_magic(Lang, Xml) -> xmerl_sax_parser:stream(Xml, [ {continuation_fun, fun continuationfun/1}, {event_fun, fun eventfun/3}, {event_state, {[Lang],<<>>}} ]). (...) eventfun({startElement, Uri, LocalName, QualifiedName, Attrubutes}, Location, {Stack, Acc}) -> [Lang|_] = Stack, % >>>>>> How many subnodes is in tag called: LocalName <<<<<< {Stack, Acc} end; Thanks, Jakub Zawierucha From kiszl@REDACTED Wed Dec 2 11:31:20 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Wed, 02 Dec 2009 11:31:20 +0100 Subject: [erlang-questions] Best practice for defining functions with edoc,erlc,eunit and the dialyzer In-Reply-To: <9b08084c0912020128w6d5e685dq2dd259e82806d2aa@mail.gmail.com> References: <9b08084c0912020128w6d5e685dq2dd259e82806d2aa@mail.gmail.com> Message-ID: <4B1641F8.2040708@tmit.bme.hu> Joe Armstrong wrote: > Best practice for writing documenting and testing code > > I'd like to try and define "best practice" for writing documenting and > testing Erlang code. I want to use: > > - only the tools supplied in the OTP release > > So I use: > > - eunit for unit testing > - the dialyzer for checking my code > - edoc for documenting things > - type specifications for specifying types > > These tools do not completely "play together" in a satisfactory manner, > so I'd like to define what I thing is "best practice" and hope that by doing > so the tools will converge. > > Let's suppose I want to define the good 'ol factorial. Here's a module > called elib1_best.erl. I've written it in such a way that it can be > processed by erlc,eunit,edoc and the dialyzer - read the footnotes > in brackets for an explanation. > > -module(elib1_best). %% [1] > > %% elib1_best: Best practice template for library modules [2] > %% Time-stamp: <2009-12-02 09:43:12 ejoearm> [3] > > %%---------------------------------------------------------------------- > %% Copyright (c) 2009 Joe Armstrong [4] > %% Copyright (c) 2009 Whoomph Software AB > %% > %% Permission is hereby granted, free of charge, to any person > %% obtaining a copy of this software and associated documentation > %% files (the "Software"), to deal in the Software without > %% restriction, including without limitation the rights to use, copy, > %% modify, merge, publish, distribute, sublicense, and/or sell copies > %% of the Software, and to permit persons to whom the Software is > %% furnished to do so, subject to the following conditions: > %% > %% The above copyright notice and this permission notice shall be > %% included in all copies or substantial portions of the Software. > %% > %% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, > %% EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF > %% MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND > %% NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS > %% BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN > %% ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN > %% CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE > %% SOFTWARE. > %%----------------------------------------------------------------------- > > -include_lib("eunit/include/eunit.hrl"). %% [5] > > -export([fac/1]). %% [6] > > > %% @doc fac(N) computes factorial(N) using a fast > %% iterative algorithm. [7] > > -spec fac(integer()) -> integer(). [8] > > fac(N) when is_integer(N), N >= 0 -> fac1(N, 1). > > fac1(0, K) -> K; > fac1(N, K) -> fac1(N-1, K*N). > > fac_test() -> %% [9] > 6 = fac(3), > 24 = fac(4). > > %% Notes: > %% [1] - module on line 1 > %% [2] - module comment > %% [3] - Time stamp auto generated by emacs. > %% Must be near start of file > %% [4] - Copyright (I always forget this, but adding a > %% copyright reduces the pain later > %% [5] - Needed for eunit > %% [6] - use export and NOT compile(export_all) > %% [7] - @doc comes first > %% [8] - -spec comes immediately *before* the function > %% [9] - test cases come immediately after the function > > %% end of module > ... > > Now let's see what happens: > > 1) Compiling > > erlc +warn_missing_spec -o ../ebin -W elib1_best.erl > > ./elib1_best.erl:0: Warning: missing specification for function test/0 > ./elib1_best.erl:44: Warning: missing specification for function fac_test/0 > > Best practice is to support type specifications for all exported > functions. But eunit magically adds a function test/0 and I really > don't want to have to add manual exports and type specs for > fac_test/0. > > [A fix is needed to erlc here, OR eunit can add type specs, > I think the latter is better - erlc should not need to know about eunit] > > 2) Dialyzing > > dialyzer --src elib1_best.erl > Checking whether the PLT /home/ejoearm/.dialyzer_plt is up-to-date... yes > Proceeding with analysis... > Unknown functions: > eunit:test/1 > done in 0m0.32s > done (passed successfully) > > This is ok - I could add eunit to my plt if I wanted ... > the dialyzer warns for missing functions so I don't need to run > xref > > 3) Documentation > > I'll run edoc on everything in the current directory putting the > results in ../doc > > > erl -noshell -eval "edoc:application(lib, \".\", [{dir,\"../doc\"}])" \ > -s init stop > > This works fine and ../doc/elib1_best.html has the documentation > but now edoc has not found my nice -spec declaration and thinks that > fac has type: fac(N) -> any() > > Why: because edoc and erlc don't use the same type parser. > > Current best practice is to use -spec (in code) and > not @spec (in edoc comments) > > [A fix is needed here to edoc, to understand -spec's] > > 4) Testing > > 1> eunit:test(elib1_best, [verbose]). > ======================== EUnit ======================== > elib1_best: fac_test (module 'elib1_best')...ok > ======================================================= > Test passed. > ok > > Great ... > > Now for questions. > > 1) Does this represent best practice? Is this the best way to > write code? - can anybody improve on this? > > [And yes I know about quickcheck, but I'm only concerned > with SW in the OTP release] > > 2) If I write like this can I assume that one day edoc > and eunit and erlc will converge so that I get correctly displayed > types in edoc and no warnings in erlc etc? > > 3) Does anything else have to be fixed? > > 4) Improvements.. > > I can think of one. I have some code to convert .erl to > .html with correctly colored code and hyperlinks etc. > So I can "surf" the code. It would be nice to have hooks > into edoc so I can call this code > > That's all for now ... > > /Joe > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > One more thing that can be addressed is the order of exporting (and defining) functions. My preference is to: - 1, export API functions - 2, export Behavior callback functions (a separate export line for each behavior) - 3, export internal functions. The functions that you _don't want to export_, but Erlang makes you to do so in order to use them in spawns, applys, etc. Something like: %% API -export([start_link/0, update/0, get/1, put/2, ...]). %% Behavior callbacks -behaviour(gen_server). -export([init/1, handle_call/3, handle_cast/2, ...]). %% Internal functions -export([spawnee/0, applyee/2, ...]). I also like to implement the functions in the same order as they appear in the export list. In fact I also prefer to have my exported functions first, and have the internal functions below. Test code follows at the end of the module. The style of having internal functions directly below the exported ones looks nice until you encounter a bunch of internal functions that are used by multiple externals. For me it usually leads to a guess-game of where it was defined... Maybe there are things that does not need to be fixed :) Regards, Zoltan. From raimo+erlang-questions@REDACTED Wed Dec 2 11:55:37 2009 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Wed, 2 Dec 2009 11:55:37 +0100 Subject: [erlang-questions] online documentation In-Reply-To: References: <95be1d3b0911270523m7e78892dg5e80aeaf875e3829@mail.gmail.com> Message-ID: <20091202105536.GA21292@erix.ericsson.se> On Fri, Nov 27, 2009 at 03:15:03PM +0100, Kenneth Lundin wrote: > Hi Vlad, > > A search facility will come , we will create an index > for this purpose as part of the docbuilding process. > > No need to patch the docbuilder application. > > /Kenneth Erlang/OTP Ericsson There is a preliminary version of the search facility now running on the (perliminary) demo site: Go to http://demo.erlang.org/doc.html and type e.g "keyse" in the text field in the grey right column, then click the looking glass button... Comments are welcome. The same search application should eventually be possible to run via the OTP webtool application on your local Erlang/OTP installation as a HTTP server on your local host. / Raimo > > On Fri, Nov 27, 2009 at 2:23 PM, Vlad Dumitrescu wrote: > > Hi! > > > > I really like the looks of the new documentation. > > > > There is a small thing that was suggested before and that would help a > > lot: a search field (hopefully with autocompletion, too). Typing > > "li:keys" to go to lists:keysearch would be soooo sweet!... > > > > I realize now that generating this is probably the job of the > > docbuilder application, which would mean that I can probably submit a > > patch myself (if I get to it). Will check that (but if someone else > > has faster fingers, I won't hold a grudge :-). > > > > BTW, a related question: I see that the issue tracker at github is > > being used. What is the current policy for reporting bugs? It would be > > nice if there was only a single place instead of three (some people > > like me do post bug reports here instead of erlang-bugs anyway), for > > example if the github tracker could send email notifications to > > erlang-bugs. > > > > best regards, > > Vlad > > > > ________________________________________________________________ > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > erlang-questions (at) erlang.org > > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From raimo+erlang-questions@REDACTED Wed Dec 2 12:03:44 2009 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Wed, 2 Dec 2009 12:03:44 +0100 Subject: [erlang-questions] Re: [erlang-patches] What's cooking in erlang/otp In-Reply-To: <200911291928.42654.als@iinet.net.au> References: <6672d0160911280659l679af131g4ee2c443b79f71f7@mail.gmail.com> <200911291619.09306.als@iinet.net.au> <1259477575.3325.10.camel@piko.site> <200911291928.42654.als@iinet.net.au> Message-ID: <20091202110344.GB21292@erix.ericsson.se> On Sun, Nov 29, 2009 at 07:28:42PM +1100, Anthony Shipman wrote: > On Sun, 29 Nov 2009 05:52:55 pm Alpar Juttner wrote: > > In distributed RCS like git, the process of creating/commiting a > > changeset is separated from putting it into a repository (branch). > > Therefore you can make any kind of changes, your commits will appear > > under your name, but they can be reviewed before getting into the > > official repository. > > > > Regards, > > Alpar > > Do you mean that people commit in repositories in their own computers and then > later someone can pull the changes into the official repository? Allmost right. People work in their repositories on their own computers, then push to a public privately owned repository on e.g github, and from there someone can pull changes into the official repository (via first pull to a repository on their own computer, testing, evaluating, cleaning up, finally pushing to the official) > > -- > Anthony Shipman Mamas don't let your babies > als@REDACTED grow up to be outsourced. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From frank@REDACTED Wed Dec 2 12:08:46 2009 From: frank@REDACTED (Frank Mueller) Date: Wed, 2 Dec 2009 12:08:46 +0100 (CET) Subject: [erlang-questions] Best practice for defining functions with edoc,erlc,eunit and the dialyzer In-Reply-To: <9b08084c0912020128w6d5e685dq2dd259e82806d2aa@mail.gmail.com> References: <9b08084c0912020128w6d5e685dq2dd259e82806d2aa@mail.gmail.com> Message-ID: <2924190b1a253448d5fac232381b86db.squirrel@alpha.mworld.biz> > Best practice for writing documenting and testing code > > I'd like to try and define "best practice" for writing documenting and > testing Erlang code. I want to use: > > - only the tools supplied in the OTP release > > So I use: > > - eunit for unit testing > - the dialyzer for checking my code > - edoc for documenting things > - type specifications for specifying types > Now for questions. > > 1) Does this represent best practice? Is this the best way to > write code? - can anybody improve on this? It almost fits for me. I'm only separating functional and test code into different modules (I've allways done so in other languages before, so just called it a habit.). And I use the module documentation more. Take a look at http://code.google.com/p/tideland-cel/source/browse/trunk/src/celjob.erl and http://code.google.com/p/tideland-cel/source/browse/trunk/src/celjobtst.erl. I'll change all my function comments to use the -spec notation. > 3) Does anything else have to be fixed? I'm not happy with the mixed notation in comments or using -spec. So it should be @spec in a comment or -doc handled like -spec. > 4) Improvements.. > > I can think of one. I have some code to convert .erl to > .html with correctly colored code and hyperlinks etc. > So I can "surf" the code. It would be nice to have hooks > into edoc so I can call this code Sounds great, yes. Warm regards mue -- ** ** Frank Mueller / Oldenburg / Germany ** From raimo+erlang-questions@REDACTED Wed Dec 2 12:20:53 2009 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Wed, 2 Dec 2009 12:20:53 +0100 Subject: [erlang-questions] online documentation In-Reply-To: <23E6EAD4-8ADA-484B-833E-197D0935169E@souja.net> References: <95be1d3b0911270523m7e78892dg5e80aeaf875e3829@mail.gmail.com> <20091202105536.GA21292@erix.ericsson.se> <23E6EAD4-8ADA-484B-833E-197D0935169E@souja.net> Message-ID: <20091202112053.GA21860@erix.ericsson.se> On Wed, Dec 02, 2009 at 03:08:05AM -0800, Jayson Vantuyl wrote: > When I searched for a fully qualified function (i.e. ets:new), it seemed to have an issue URL-decoding the colon, and the search generally didn't like it even when manually adjusted on the next page. Nice start, though. Currently it searches for names anywhere (functions, modules and applications), so you can search for `ets', follow to the ets man page and then scroll down to the `new' function. Or you can search for `new'. You can also search for `ets new', which oddly enough does not give ets:new higher ranking than any other Whatever:new function... It sounds like a very nice idea that either `ets:new' or `ets new' would give higher ranking for a hit on both module and function (and application). I will forward the idea to the developers (hope they read this too). > > On Dec 2, 2009, at 2:55 AM, Raimo Niskanen wrote: > > > On Fri, Nov 27, 2009 at 03:15:03PM +0100, Kenneth Lundin wrote: > >> Hi Vlad, > >> > >> A search facility will come , we will create an index > >> for this purpose as part of the docbuilding process. > >> > >> No need to patch the docbuilder application. > >> > >> /Kenneth Erlang/OTP Ericsson > > > > There is a preliminary version of the search facility > > now running on the (perliminary) demo site: > > Go to http://demo.erlang.org/doc.html and type e.g "keyse" > > in the text field in the grey right column, then click the > > looking glass button... Comments are welcome. > > > > The same search application should eventually be > > possible to run via the OTP webtool application on > > your local Erlang/OTP installation as a HTTP > > server on your local host. > > > > / Raimo > > > > > >> > >> On Fri, Nov 27, 2009 at 2:23 PM, Vlad Dumitrescu wrote: > >>> Hi! > >>> > >>> I really like the looks of the new documentation. > >>> > >>> There is a small thing that was suggested before and that would help a > >>> lot: a search field (hopefully with autocompletion, too). Typing > >>> "li:keys" to go to lists:keysearch would be soooo sweet!... > >>> > >>> I realize now that generating this is probably the job of the > >>> docbuilder application, which would mean that I can probably submit a > >>> patch myself (if I get to it). Will check that (but if someone else > >>> has faster fingers, I won't hold a grudge :-). > >>> > >>> BTW, a related question: I see that the issue tracker at github is > >>> being used. What is the current policy for reporting bugs? It would be > >>> nice if there was only a single place instead of three (some people > >>> like me do post bug reports here instead of erlang-bugs anyway), for > >>> example if the github tracker could send email notifications to > >>> erlang-bugs. > >>> > >>> best regards, > >>> Vlad > >>> > >>> ________________________________________________________________ > >>> erlang-questions mailing list. See http://www.erlang.org/faq.html > >>> erlang-questions (at) erlang.org > >>> > >>> > >> > >> ________________________________________________________________ > >> erlang-questions mailing list. See http://www.erlang.org/faq.html > >> erlang-questions (at) erlang.org > > > > -- > > > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > > ________________________________________________________________ > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > erlang-questions (at) erlang.org > > > > > > -- > Jayson Vantuyl > kagato@REDACTED > > > > > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From erlang@REDACTED Wed Dec 2 12:57:00 2009 From: erlang@REDACTED (Joe Armstrong) Date: Wed, 2 Dec 2009 12:57:00 +0100 Subject: where are erlang type definitions defined? Message-ID: <9b08084c0912020357qd50e39g8533147da8e8b62a@mail.gmail.com> Is there a definitive document describing what Erlang types are supposed to be? I'd like a reference to one document (not the grammar) that defines what types are *supposed* to be. The best In could find is http://www.erlang.org/eeps/eep-0008.html Is this the definitive document? /Joe From jasonwframe@REDACTED Wed Dec 2 13:14:58 2009 From: jasonwframe@REDACTED (Jason Frame) Date: Wed, 2 Dec 2009 22:14:58 +1000 Subject: Compiling Erlang on OpenSolaris Message-ID: <9e2890c20912020414t4cee42d3v57583fd623009f8d@mail.gmail.com> Hi, I am trying to compile Erlang R13B03 on OpenSolaris build 127. Configure seems to run fine, then when running gmake the build fails with this error mentioning that IFHWADDRLEN is undeclared. Any ideas on how to get Erlang compiling on OpenSolaris? I would be happy to use a binary for R13 if there is one available for OpenSolaris as well, however the only binaries I have seen have been for older versions. gcc -g -O2 -I/export/home/jason/otp_src_R13B03/erts/i386-pc-solaris2.11 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DERTS_SMP -DHAVE_CONFIG_H -Wall -Wstrict-prototypes -Wmissing-prototypes -Wdeclaration-after-statement -DUSE_THREADS -D_THREAD_SAFE -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DLIBSCTP= -Ii386-pc-solaris2.11/opt/smp -Ibeam -Isys/unix -Isys/common -Ii386-pc-solaris2.11 -Izlib -Ipcre -Ihipe -I../include -I../include/i386-pc-solaris2.11 -I../include/internal -I../include/internal/i386-pc-solaris2.11 -Idrivers/common -Idrivers/unix -c drivers/common/inet_drv.c -o obj/i386-pc-solaris2.11/opt/smp/inet_drv.o drivers/common/inet_drv.c: In function `inet_ctl_ifget': drivers/common/inet_drv.c:4170: error: `IFHWADDRLEN' undeclared (first use in this function) drivers/common/inet_drv.c:4170: error: (Each undeclared identifier is reported only once drivers/common/inet_drv.c:4170: error: for each function it appears in.) drivers/common/inet_drv.c:4173: error: structure has no member named `ifr_hwaddr' make[3]: *** [obj/i386-pc-solaris2.11/opt/smp/inet_drv.o] Error 1 make[3]: Leaving directory `/export/home/jason/otp_src_R13B03/erts/emulator' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/export/home/jason/otp_src_R13B03/erts/emulator' make[1]: *** [smp] Error 2 make[1]: Leaving directory `/export/home/jason/otp_src_R13B03/erts' gmake: *** [emulator] Error 2 From the.ajarn@REDACTED Wed Dec 2 15:55:27 2009 From: the.ajarn@REDACTED (Brentley Jones) Date: Wed, 2 Dec 2009 08:55:27 -0600 Subject: [erlang-questions] Best practice for defining functions with edoc,erlc,eunit and the dialyzer In-Reply-To: <2924190b1a253448d5fac232381b86db.squirrel@alpha.mworld.biz> References: <9b08084c0912020128w6d5e685dq2dd259e82806d2aa@mail.gmail.com> <2924190b1a253448d5fac232381b86db.squirrel@alpha.mworld.biz> Message-ID: <0EBB0C77-1A8A-40D3-849E-ED51DA7B3DD4@gmail.com> On Dec 2, 2009, at 5:08 AM, Frank Mueller wrote: >> 3) Does anything else have to be fixed? > > I'm not happy with the mixed notation in comments or using -spec. So it should be @spec in a > comment or -doc handled like -spec. I also agree here. I would prefer that I could write everything in a module attribute style. Then edoc, and other programs, could read the attribute instead of parsing the file. - Brentley Jones From rumata-estor@REDACTED Wed Dec 2 16:16:02 2009 From: rumata-estor@REDACTED (Dmitry Belyaev) Date: Wed, 02 Dec 2009 18:16:02 +0300 Subject: [erlang-questions] Best practice for defining functions with edoc,erlc,eunit and the dialyzer In-Reply-To: <0EBB0C77-1A8A-40D3-849E-ED51DA7B3DD4@gmail.com> References: <9b08084c0912020128w6d5e685dq2dd259e82806d2aa@mail.gmail.com> <2924190b1a253448d5fac232381b86db.squirrel@alpha.mworld.biz> <0EBB0C77-1A8A-40D3-849E-ED51DA7B3DD4@gmail.com> Message-ID: <1259766962.16821.2.camel@rumbuntu> And this could lead us to interactive documentation like in python. That would be great! On Wed, 2009-12-02 at 08:55 -0600, Brentley Jones wrote: > On Dec 2, 2009, at 5:08 AM, Frank Mueller wrote: > > >> 3) Does anything else have to be fixed? > > > > I'm not happy with the mixed notation in comments or using -spec. So it should be @spec in a > > comment or -doc handled like -spec. > > I also agree here. I would prefer that I could write everything in a module attribute style. Then > edoc, and other programs, could read the attribute instead of parsing the file. > > - Brentley Jones > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From g@REDACTED Wed Dec 2 16:56:34 2009 From: g@REDACTED (Garrett Smith) Date: Wed, 2 Dec 2009 09:56:34 -0600 Subject: [erlang-questions] massive distribution In-Reply-To: <1259748456.26113.17.camel@w-ehs-psa.telbiomed.at> References: <1259009870.3358.11.camel@gram.lan> <1259677326.1591.16.camel@w-ehs-psa.telbiomed.at> <1259703893.2947.16.camel@gram.local> <1259748456.26113.17.camel@w-ehs-psa.telbiomed.at> Message-ID: On Wed, Dec 2, 2009 at 4:07 AM, Peter Sabaini wrote: > On Tue, 2009-12-01 at 16:34 -0600, Garrett Smith wrote: >> On Tue, Dec 1, 2009 at 3:44 PM, Peter Sabaini wrote: >> > On Tue, 2009-12-01 at 10:27 -0600, Garrett Smith wrote: >> >> What is happening that makes something an unstable connection? >> > >> > The behaviour was that nodes seemed to randomly produced error messages, >> > eg.: >> > >> > =ERROR REPORT==== 9-Jul-2009::13:56:07 === >> > The global_name_server locker process received an unexpected message: >> > {{#Ref<0.0.0.1957>,'xy@REDACTED'},false} >> > >> > Or >> > >> > =ERROR REPORT==== 9-Jul-2009::14:03:33 === >> > global: 'foo@REDACTED' failed to connect to 'qux@REDACTED' >> >> Hmm...not to say the node count isn't part of the problem, but there >> are *lots* of reasons this could happen, none of which have anything >> to do with Erlang. > > My evidence is that these problems appeared (with little load) when I > increased the nodecount, and disappeared (even under heavy load) when > going beyond a threshold (seemed stable with 64 nodes in my case). I > didn't investigate this further though as I was more interested in the > behaviour of my application. This is good input and a bit of a stab (well, poke) in heart of Erlang's "distributed" story. 100+ nodes may have historically been a large cluster, but that's quickly changing. It's not unlike the set of problems that get kicked up by the new large multicore systems (e.g. process affinity threads that keep popping up here). Taking the global process registry alone -- and this seems to a cornerstone of distributed Erlang -- you'd need a robust peer-to-peer replication strategy that survives constant linear growth of the network. Or maybe this is nonsense and one must conceded that Erlang's out-of-the-box location transparency stops at around 100 nodes over TCP/IP. Garrett From samb-bulk@REDACTED Wed Dec 2 17:41:21 2009 From: samb-bulk@REDACTED (Sam Bobroff) Date: Wed, 02 Dec 2009 11:41:21 -0500 Subject: [erlang-questions] Code critique please In-Reply-To: References: Message-ID: <4B1698B1.3040503@m5networks.com.au> Jarrod Roberson wrote: > is there anything that I can do to improve this code? Are the nested case of > the best way to do that? It was the only thing I could get to work. > Hi Jarrod, I have another suggestion you might find interesting. I would like to factor out the recursion in the "is_subscribed" function because I think it's generally good to use comprehensions or folds if you can, instead of creating your own recursion. Unfortunately I can't see a way to do this trivially, so: Given this code: > % test to see if a dns_rr.domain is subscribed to > is_subscribed(_,[]) -> false; > is_subscribed(Dom,[S|Rest]) -> > case lists:suffix(S,Dom) of > true -> > {ok,S}; > false -> > is_subscribed(Dom,Rest) > end. I would first write a function like this: %% first(Pred, List): Return either false or {true, Elem} where Elem is the first element of List for which Pred(Elem) returns true. %% Pred must take one argument and return true or false. first(Pred, []) -> false; first(Pred, [X | Xs]) -> case Pred(X) of true -> {true, X}; false -> first(Pred, Xs) end. Then I could write is_subscribed like this: is_subscribed(Dom, SS) -> first(fun(S) -> lists:suffix(S, Dom) end, SS). This makes the "is_subscribed" function really easy to understand and provides "first" as a useful tool. To be honest I was quite surprised that it wasn't in the "lists" module... maybe there is one somewhere I couldn't find. Sam. From mevans@REDACTED Wed Dec 2 17:54:55 2009 From: mevans@REDACTED (Evans, Matthew) Date: Wed, 2 Dec 2009 11:54:55 -0500 Subject: [erlang-questions] massive distribution In-Reply-To: References: <1259009870.3358.11.camel@gram.lan> <1259677326.1591.16.camel@w-ehs-psa.telbiomed.at> <1259703893.2947.16.camel@gram.local> <1259748456.26113.17.camel@w-ehs-psa.telbiomed.at> Message-ID: I'm entering this thread a bit late. One thing I have noticed when running on certain processors is that the TCP connection becomes a bottle neck if there is a lot of traffic. There can even be issues with low load caused by things like no_delay set or not set (that can be resolved with modifying the "dist" TCP kernel options - for example {dist_nodelay, true}). But with the load issue: One thing that would be nice is having the ability to specify a "pool" of TCP connections between VMs, rather than one. Especially with lots of processes where we could be hitting locks in the kernel. If this is possible today, please let me know how to do that :-) -----Original Message----- From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] On Behalf Of Garrett Smith Sent: Wednesday, December 02, 2009 10:57 AM To: Peter Sabaini Cc: Erlang Users' List Subject: Re: [erlang-questions] massive distribution On Wed, Dec 2, 2009 at 4:07 AM, Peter Sabaini wrote: > On Tue, 2009-12-01 at 16:34 -0600, Garrett Smith wrote: >> On Tue, Dec 1, 2009 at 3:44 PM, Peter Sabaini wrote: >> > On Tue, 2009-12-01 at 10:27 -0600, Garrett Smith wrote: >> >> What is happening that makes something an unstable connection? >> > >> > The behaviour was that nodes seemed to randomly produced error messages, >> > eg.: >> > >> > =ERROR REPORT==== 9-Jul-2009::13:56:07 === >> > The global_name_server locker process received an unexpected message: >> > {{#Ref<0.0.0.1957>,'xy@REDACTED'},false} >> > >> > Or >> > >> > =ERROR REPORT==== 9-Jul-2009::14:03:33 === >> > global: 'foo@REDACTED' failed to connect to 'qux@REDACTED' >> >> Hmm...not to say the node count isn't part of the problem, but there >> are *lots* of reasons this could happen, none of which have anything >> to do with Erlang. > > My evidence is that these problems appeared (with little load) when I > increased the nodecount, and disappeared (even under heavy load) when > going beyond a threshold (seemed stable with 64 nodes in my case). I > didn't investigate this further though as I was more interested in the > behaviour of my application. This is good input and a bit of a stab (well, poke) in heart of Erlang's "distributed" story. 100+ nodes may have historically been a large cluster, but that's quickly changing. It's not unlike the set of problems that get kicked up by the new large multicore systems (e.g. process affinity threads that keep popping up here). Taking the global process registry alone -- and this seems to a cornerstone of distributed Erlang -- you'd need a robust peer-to-peer replication strategy that survives constant linear growth of the network. Or maybe this is nonsense and one must conceded that Erlang's out-of-the-box location transparency stops at around 100 nodes over TCP/IP. Garrett ________________________________________________________________ erlang-questions mailing list. See http://www.erlang.org/faq.html erlang-questions (at) erlang.org From kiszl@REDACTED Wed Dec 2 17:58:58 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Wed, 02 Dec 2009 17:58:58 +0100 Subject: [erlang-questions] Code critique please In-Reply-To: <4B1698B1.3040503@m5networks.com.au> References: <4B1698B1.3040503@m5networks.com.au> Message-ID: <4B169CD2.5050606@tmit.bme.hu> Sam Bobroff wrote: > Jarrod Roberson wrote: >> is there anything that I can do to improve this code? Are the nested >> case of >> the best way to do that? It was the only thing I could get to work. >> > Hi Jarrod, > > I have another suggestion you might find interesting. I would like to > factor out the recursion in the "is_subscribed" function because I > think it's generally good to use comprehensions or folds if you can, > instead of creating your own recursion. Unfortunately I can't see a > way to do this trivially, so: > > Given this code: >> % test to see if a dns_rr.domain is subscribed to >> is_subscribed(_,[]) -> false; >> is_subscribed(Dom,[S|Rest]) -> >> case lists:suffix(S,Dom) of >> true -> >> {ok,S}; >> false -> >> is_subscribed(Dom,Rest) >> end. > I would first write a function like this: > > %% first(Pred, List): Return either false or {true, Elem} where Elem > is the first element of List for which Pred(Elem) returns true. > %% Pred must take one argument and return true or false. > first(Pred, []) -> > false; > first(Pred, [X | Xs]) -> > case Pred(X) of > true -> > {true, X}; > false -> > first(Pred, Xs) > end. > > Then I could write is_subscribed like this: > > is_subscribed(Dom, SS) -> > first(fun(S) -> lists:suffix(S, Dom) end, SS). > > This makes the "is_subscribed" function really easy to understand and > provides "first" as a useful tool. > > To be honest I was quite surprised that it wasn't in the "lists" > module... maybe there is one somewhere I couldn't find. > > Sam. > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > It is there inversed: lists:dropwhile/2 is_subscribed(Dom, SS) -> case lists:dropwhile(fun(S) -> not lists:suffix(S, Dom) end, SS) of [X|_] -> {true, X}; [] -> false end Regards, Zoltan. From andrew@REDACTED Wed Dec 2 18:04:05 2009 From: andrew@REDACTED (Andrew Thompson) Date: Wed, 2 Dec 2009 12:04:05 -0500 Subject: [erlang-questions] where are erlang type definitions defined? In-Reply-To: <9b08084c0912020357qd50e39g8533147da8e8b62a@mail.gmail.com> References: <9b08084c0912020357qd50e39g8533147da8e8b62a@mail.gmail.com> Message-ID: <20091202170405.GA2417@hijacked.us> On Wed, Dec 02, 2009 at 12:57:00PM +0100, Joe Armstrong wrote: > Is there a definitive document describing what Erlang types are supposed to be? > > I'd like a reference to one document (not the grammar) that defines what types > are *supposed* to be. > > The best In could find is > > http://www.erlang.org/eeps/eep-0008.html > > Is this the definitive document? > I believe it *was* the definitive document but I know there's syntax and types available that aren't described in it because they've been added later. I'm not aware of anything more current other than the dialyzer source and the specs used in OTP itself, however. Andrew From bengt.kleberg@REDACTED Wed Dec 2 18:03:26 2009 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 02 Dec 2009 18:03:26 +0100 Subject: [erlang-questions] Code critique please In-Reply-To: <4B1698B1.3040503@m5networks.com.au> References: <4B1698B1.3040503@m5networks.com.au> Message-ID: <1259773406.4754.20.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Greetings, Perhaps lists:dropwhile/2 can be used instead of first/2 ? bengt On Wed, 2009-12-02 at 11:41 -0500, Sam Bobroff wrote: > Jarrod Roberson wrote: > > is there anything that I can do to improve this code? Are the nested case of > > the best way to do that? It was the only thing I could get to work. > > > Hi Jarrod, > > I have another suggestion you might find interesting. I would like to > factor out the recursion in the "is_subscribed" function because I think > it's generally good to use comprehensions or folds if you can, instead > of creating your own recursion. Unfortunately I can't see a way to do > this trivially, so: > > Given this code: > > % test to see if a dns_rr.domain is subscribed to > > is_subscribed(_,[]) -> false; > > is_subscribed(Dom,[S|Rest]) -> > > case lists:suffix(S,Dom) of > > true -> > > {ok,S}; > > false -> > > is_subscribed(Dom,Rest) > > end. > I would first write a function like this: > > %% first(Pred, List): Return either false or {true, Elem} where Elem is > the first element of List for which Pred(Elem) returns true. > %% Pred must take one argument and return true or false. > first(Pred, []) -> > false; > first(Pred, [X | Xs]) -> > case Pred(X) of > true -> > {true, X}; > false -> > first(Pred, Xs) > end. > > Then I could write is_subscribed like this: > > is_subscribed(Dom, SS) -> > first(fun(S) -> lists:suffix(S, Dom) end, SS). > > This makes the "is_subscribed" function really easy to understand and > provides "first" as a useful tool. > > To be honest I was quite surprised that it wasn't in the "lists" > module... maybe there is one somewhere I couldn't find. > > Sam. > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From g@REDACTED Wed Dec 2 18:10:25 2009 From: g@REDACTED (Garrett Smith) Date: Wed, 2 Dec 2009 11:10:25 -0600 Subject: Getting the position of a list item Message-ID: I'm missing something basic here :\ The lists module has keyfind/3 but no find/2, where you want to return the position of a particular list item. This is surprising. Is there a commonly used pattern for this? Garrett From kiszl@REDACTED Wed Dec 2 18:25:13 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Wed, 02 Dec 2009 18:25:13 +0100 Subject: [erlang-questions] Code critique please In-Reply-To: <4B169F25.2040109@m5networks.com.au> References: <4B1698B1.3040503@m5networks.com.au> <4B169CD2.5050606@tmit.bme.hu> <4B169F25.2040109@m5networks.com.au> Message-ID: <4B16A2F9.50907@tmit.bme.hu> Sam Bobroff wrote: > Zoltan Lajos Kis wrote: >> Sam Bobroff wrote: >>> Jarrod Roberson wrote: >>>> is there anything that I can do to improve this code? Are the >>>> nested case of >>>> the best way to do that? It was the only thing I could get to work. >>>> >>> Hi Jarrod, >>> >>> I have another suggestion you might find interesting. I would like >>> to factor out the recursion in the "is_subscribed" function because >>> I think it's generally good to use comprehensions or folds if you >>> can, instead of creating your own recursion. Unfortunately I can't >>> see a way to do this trivially, so: >>> >>> Given this code: >>>> % test to see if a dns_rr.domain is subscribed to >>>> is_subscribed(_,[]) -> false; >>>> is_subscribed(Dom,[S|Rest]) -> >>>> case lists:suffix(S,Dom) of >>>> true -> >>>> {ok,S}; >>>> false -> >>>> is_subscribed(Dom,Rest) >>>> end. >>> I would first write a function like this: >>> >>> %% first(Pred, List): Return either false or {true, Elem} where Elem >>> is the first element of List for which Pred(Elem) returns true. >>> %% Pred must take one argument and return true or false. >>> first(Pred, []) -> >>> false; >>> first(Pred, [X | Xs]) -> >>> case Pred(X) of >>> true -> >>> {true, X}; >>> false -> >>> first(Pred, Xs) >>> end. >>> >>> Then I could write is_subscribed like this: >>> >>> is_subscribed(Dom, SS) -> >>> first(fun(S) -> lists:suffix(S, Dom) end, SS). >>> >>> This makes the "is_subscribed" function really easy to understand >>> and provides "first" as a useful tool. >>> >>> To be honest I was quite surprised that it wasn't in the "lists" >>> module... maybe there is one somewhere I couldn't find. >>> >>> Sam. >>> >>> >>> >>> ________________________________________________________________ >>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>> erlang-questions (at) erlang.org >>> >> It is there inversed: lists:dropwhile/2 >> >> is_subscribed(Dom, SS) -> >> case lists:dropwhile(fun(S) -> not lists:suffix(S, Dom) end, SS) of >> [X|_] -> {true, X}; >> [] -> false >> end >> >> Regards, >> Zoltan. > I actually looked at dropwhile/2, but I didn't think it was a good > solution because: > > * It might create a copy of the tail of the list, which you don't need > (I don't know enough about Erlang to know if this happens or not). > * The whole point of factoring is_subscribed/2 was to make it clearer > and I don't think it achieves that. > > So thanks for pointing that out but I still like the idea of a first/2 > function :-) > > Cheers, > Sam. The list won't be copied, the function will only return a "pointer" into the middle of the list as far as I know. I think your refactoring is merely putting stuff behind the scenes. Your is_subscribed only looks "clearer" because you purposefully made your first function return values in a way that no additional handling is required in is_subscribed. In other functions you will have to do that. Same with dropwhile. Regards, Zoltan. From rtrlists@REDACTED Wed Dec 2 18:34:46 2009 From: rtrlists@REDACTED (Robert Raschke) Date: Wed, 2 Dec 2009 17:34:46 +0000 Subject: [erlang-questions] Getting the position of a list item In-Reply-To: References: Message-ID: <6a3ae47e0912020934j27430d00wed628a10bfb48707@mail.gmail.com> On Wed, Dec 2, 2009 at 5:10 PM, Garrett Smith wrote: > I'm missing something basic here :\ > > The lists module has keyfind/3 but no find/2, where you want to return > the position of a particular list item. This is surprising. > > Is there a commonly used pattern for this? > > > Hmm, I fail to come up with a good usage scenario for wanting this. What are you needing the position of an item in a list for? Robby From andrew@REDACTED Wed Dec 2 18:50:40 2009 From: andrew@REDACTED (Andrew Thompson) Date: Wed, 2 Dec 2009 12:50:40 -0500 Subject: [erlang-questions] Getting the position of a list item In-Reply-To: References: Message-ID: <20091202175040.GB2417@hijacked.us> On Wed, Dec 02, 2009 at 11:10:25AM -0600, Garrett Smith wrote: > I'm missing something basic here :\ > > The lists module has keyfind/3 but no find/2, where you want to return > the position of a particular list item. This is surprising. > > Is there a commonly used pattern for this? > gen_leader has a compact little function I've 'borrowed' a couple times: pos(_, []) -> 100000; pos(N1,[N1|_]) -> 1; pos(N1,[_|Ns]) -> 1+pos(N1,Ns). I agree that something like this would be handy to have in the stdlib (I've also written a version that finds the index of the first element that a predicate fun returns true for). Andrew From igorrs@REDACTED Wed Dec 2 18:53:04 2009 From: igorrs@REDACTED (Igor Ribeiro Sucupira) Date: Wed, 2 Dec 2009 15:53:04 -0200 Subject: [erlang-questions] Getting the position of a list item In-Reply-To: References: Message-ID: I happened to need that once and ended up implementing my own, so I think you won't find it in the standard library. Later, I realized there was a more elegant way of doing what I wanted, so I should agree with Robert in that you probably don't need that functionality (but we could be wrong, of course...). find_first(Element, List) when is_list(List) -> find_first(Element, List, 0). find_first(_Element, [], Inc) when is_integer(Inc) -> Inc + 1; find_first(Element, [Element | _Tail], Inc) when is_integer(Inc) -> Inc + 1; find_first(Element, [_ | Tail], Inc) when is_integer(Inc) -> find_first(Element, Tail, Inc + 1). Igor. On Wed, Dec 2, 2009 at 3:10 PM, Garrett Smith wrote: > I'm missing something basic here :\ > > The lists module has keyfind/3 but no find/2, where you want to return > the position of a particular list item. This is surprising. > > Is there a commonly used pattern for this? > > Garrett -- "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 g@REDACTED Wed Dec 2 18:53:43 2009 From: g@REDACTED (Garrett Smith) Date: Wed, 2 Dec 2009 11:53:43 -0600 Subject: [erlang-questions] Getting the position of a list item In-Reply-To: <6a3ae47e0912020934j27430d00wed628a10bfb48707@mail.gmail.com> References: <6a3ae47e0912020934j27430d00wed628a10bfb48707@mail.gmail.com> Message-ID: On Wed, Dec 2, 2009 at 11:34 AM, Robert Raschke wrote: > On Wed, Dec 2, 2009 at 5:10 PM, Garrett Smith wrote: > >> I'm missing something basic here :\ >> >> The lists module has keyfind/3 but no find/2, where you want to return >> the position of a particular list item. This is surprising. >> >> Is there a commonly used pattern for this? >> > Hmm, I fail to come up with a good usage scenario for wanting this. What are > you needing the position of an item in a list for? I'm stitching together record field values and want to get an insertion position using a field token. So, this goes in hard with an "insert_at(Value, N, List_Or_Tuple)" type of function. In general though, there are several functions in the lists module that accept a positional argument (N) -- having some easy ways of getting N seems reasonable. Functions like l/find and rfind are pretty common in the list APIs I'm familiar with. Garrett From g@REDACTED Wed Dec 2 19:00:35 2009 From: g@REDACTED (Garrett Smith) Date: Wed, 2 Dec 2009 12:00:35 -0600 Subject: [erlang-questions] Getting the position of a list item In-Reply-To: References: Message-ID: On Wed, Dec 2, 2009 at 11:53 AM, Igor Ribeiro Sucupira wrote: > I happened to need that once and ended up implementing my own, so I > think you won't find it in the standard library. > > Later, I realized there was a more elegant way of doing what I wanted, > so I should agree with Robert in that you probably don't need that > functionality (but we could be wrong, of course...). > > find_first(Element, List) when is_list(List) -> > ? ?find_first(Element, List, 0). > > find_first(_Element, [], Inc) when is_integer(Inc) -> > ? ?Inc + 1; > find_first(Element, [Element | _Tail], Inc) when is_integer(Inc) -> > ? ?Inc + 1; > find_first(Element, [_ | Tail], Inc) when is_integer(Inc) -> > ? ?find_first(Element, Tail, Inc + 1). Yup, not hard to roll your own on this. I was just surprised it wasn't there. For the record, I think lists should have: lfind(Elem, List) -> N | false rfind(Elem, List) -> N | false But if a 20 year old language can get by without these, then by definition *I'm* wrong :) Still, I'm happy to contribute a patch for these ;) Garrett From rtrlists@REDACTED Wed Dec 2 19:00:39 2009 From: rtrlists@REDACTED (Robert Raschke) Date: Wed, 2 Dec 2009 18:00:39 +0000 Subject: [erlang-questions] Getting the position of a list item In-Reply-To: References: <6a3ae47e0912020934j27430d00wed628a10bfb48707@mail.gmail.com> Message-ID: <6a3ae47e0912021000h1fc0bcd1va771e82341f19804@mail.gmail.com> On Wed, Dec 2, 2009 at 5:53 PM, Garrett Smith wrote: > On Wed, Dec 2, 2009 at 11:34 AM, Robert Raschke > wrote: > > On Wed, Dec 2, 2009 at 5:10 PM, Garrett Smith wrote: > > > >> I'm missing something basic here :\ > >> > >> The lists module has keyfind/3 but no find/2, where you want to return > >> the position of a particular list item. This is surprising. > >> > >> Is there a commonly used pattern for this? > >> > > Hmm, I fail to come up with a good usage scenario for wanting this. What > are > > you needing the position of an item in a list for? > > I'm stitching together record field values and want to get an > insertion position using a field token. > > So, this goes in hard with an "insert_at(Value, N, List_Or_Tuple)" > type of function. > > In general though, there are several functions in the lists module > that accept a positional argument (N) -- having some easy ways of > getting N seems reasonable. Functions like l/find and rfind are pretty > common in the list APIs I'm familiar with. > > Garrett > Not 100% sure what it is exactly you're doing, but it sounds like it could be a bit easier using tuple_to_list/1 and list comprehensions? Robby From kiszl@REDACTED Wed Dec 2 18:53:08 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Wed, 02 Dec 2009 18:53:08 +0100 Subject: [erlang-questions] Getting the position of a list item In-Reply-To: <6a3ae47e0912020934j27430d00wed628a10bfb48707@mail.gmail.com> References: <6a3ae47e0912020934j27430d00wed628a10bfb48707@mail.gmail.com> Message-ID: <4B16A984.8050705@tmit.bme.hu> Robert Raschke wrote: > On Wed, Dec 2, 2009 at 5:10 PM, Garrett Smith wrote: > > >> I'm missing something basic here :\ >> >> The lists module has keyfind/3 but no find/2, where you want to return >> the position of a particular list item. This is surprising. >> >> Is there a commonly used pattern for this? >> >> >> >> > Hmm, I fail to come up with a good usage scenario for wanting this. What are > you needing the position of an item in a list for? > > Robby > > Find a good usage for lists:nth/2 and lists:nthtail/2 functions, and you will find a good one for this :). From attila.r.nohl@REDACTED Wed Dec 2 19:29:30 2009 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Wed, 2 Dec 2009 19:29:30 +0100 Subject: [erlang-questions] Getting the position of a list item In-Reply-To: References: Message-ID: <401d3ba30912021029g2d521aceoe086fda6c9e1746b@mail.gmail.com> 2009/12/2, Garrett Smith : > I'm missing something basic here :\ > > The lists module has keyfind/3 but no find/2, where you want to return > the position of a particular list item. This is surprising. > > Is there a commonly used pattern for this? string:str(List, [Element]). From attila.r.nohl@REDACTED Wed Dec 2 19:44:40 2009 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Wed, 2 Dec 2009 19:44:40 +0100 Subject: [erlang-questions] Getting the position of a list item In-Reply-To: References: Message-ID: <401d3ba30912021044t6410f9a2l86c408a12d28efa0@mail.gmail.com> 2009/12/2, Garrett Smith : [...] > But if a 20 year old language can get by without these, then by > definition *I'm* wrong :) Well, actually I think in this case Erlang is wrong. There was a thread here a couple of months ago that some (most?) libraries on OTP were developed more in an "evolutionary" way, not "intelligently designed". For example the string module has substr and sub_string, because the module was merged from two previous string modules. Lookup functions have different interfaces: ets:lookup(Table, Key) -> [Objects] dict:find(Key, Dict) -> {ok, Value} | error gb_tree:lookup(Key, Tree) -> {value, Val} | none lists:keysearch(Key, N, TupleList) -> {value, Tuple} | false proplists:lookup(Key, List) -> none | tuple() Our local proplist:lookup-clone function returns no_value where proplists would return none. Expect the unexpected, when you work with Erlang libraries. From twoggle@REDACTED Wed Dec 2 20:43:19 2009 From: twoggle@REDACTED (Tim Fletcher) Date: Wed, 2 Dec 2009 11:43:19 -0800 (PST) Subject: Getting the position of a list item In-Reply-To: <6a3ae47e0912020934j27430d00wed628a10bfb48707@mail.gmail.com> References: <6a3ae47e0912020934j27430d00wed628a10bfb48707@mail.gmail.com> Message-ID: <563519ba-ac11-4f51-a00d-cd046fbaf685@s20g2000yqd.googlegroups.com> > Hmm, I fail to come up with a good usage scenario for wanting this. What are > you needing the position of an item in a list for? FWIW, here's something i wrote recently: base32_decode(Char) -> list_index(Char, base32_alphabet()). base32_alphabet() -> "0123456789bcdefghjkmnpqrstuvwxyz". The corresponding encode function uses lists:nth/2. Can't remember ever needing it before though (in erlang). From jarrod@REDACTED Wed Dec 2 22:13:15 2009 From: jarrod@REDACTED (Jarrod Roberson) Date: Wed, 2 Dec 2009 16:13:15 -0500 Subject: Ternary Like Operation Idiom in Erlang Message-ID: In multicast dns TXT records you have name value pairs that can look like "key=value", "key=" and "key". "key=" means key with no values "key" implies "key=true" I need to convert any thing that looks like "key" to "key=true" to normalize my data I am converting to dictionaries using re:split/2. here is how I would do this in Java. String s = "xxx"; return s.matches("=") ? s : s + "=true"; here is what I have come up with in Erlang. fix(T,{match,_}) -> T; fix(T,nomatch) -> string:concat(T,"=true"). where I call it like S = "key". fix(S,re:run(S,"=")). Ignoring that the function name "fix" needs to be more descriptive. Is this the best way to do something like this? Or is there some fancy one line way of doing this? From mevans@REDACTED Wed Dec 2 22:56:14 2009 From: mevans@REDACTED (Evans, Matthew) Date: Wed, 2 Dec 2009 16:56:14 -0500 Subject: [erlang-questions] Ternary Like Operation Idiom in Erlang In-Reply-To: References: Message-ID: Would this work? hd(re:split(Value,"=",[{return,list}])) ++ "=true". For example: (scm@REDACTED)1> Test1 = "key". "key" (scm@REDACTED)2> Test2 = "key=true". "key=true" (scm@REDACTED)3> (scm@REDACTED)3> hd(re:split(Test1,"=",[{return,list}])) ++ "=true". "key=true" (scm@REDACTED)4> hd(re:split(Test2,"=",[{return,list}])) ++ "=true". "key=true" -----Original Message----- From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] On Behalf Of Jarrod Roberson Sent: Wednesday, December 02, 2009 4:13 PM To: Erlang Subject: [erlang-questions] Ternary Like Operation Idiom in Erlang In multicast dns TXT records you have name value pairs that can look like "key=value", "key=" and "key". "key=" means key with no values "key" implies "key=true" I need to convert any thing that looks like "key" to "key=true" to normalize my data I am converting to dictionaries using re:split/2. here is how I would do this in Java. String s = "xxx"; return s.matches("=") ? s : s + "=true"; here is what I have come up with in Erlang. fix(T,{match,_}) -> T; fix(T,nomatch) -> string:concat(T,"=true"). where I call it like S = "key". fix(S,re:run(S,"=")). Ignoring that the function name "fix" needs to be more descriptive. Is this the best way to do something like this? Or is there some fancy one line way of doing this? ________________________________________________________________ erlang-questions mailing list. See http://www.erlang.org/faq.html erlang-questions (at) erlang.org From jarrod@REDACTED Wed Dec 2 23:10:18 2009 From: jarrod@REDACTED (Jarrod Roberson) Date: Wed, 2 Dec 2009 17:10:18 -0500 Subject: [erlang-questions] Ternary Like Operation Idiom in Erlang In-Reply-To: References: Message-ID: Thanks to Dale's version I came up with this. F = fun(T) -> case re:split(T,"=",[{return,list}]) of [K] -> {K,true}; [K,V] -> {K,V} end end. in action Eshell V5.7.3 (abort with ^G) 1> F = fun(T) -> case re:split(T,"=",[{return,list}]) of [K] -> {K,true}; [K,V] -> {K,V} end end. #Fun 2> F("key"). {"key",true} 3> F("key=value"). {"key","value"} 4> F("key="). {"key",[]} 5> From ok@REDACTED Wed Dec 2 23:29:43 2009 From: ok@REDACTED (Richard O'Keefe) Date: Thu, 3 Dec 2009 11:29:43 +1300 Subject: [erlang-questions] Best practice for defining functions with edoc,erlc,eunit and the dialyzer In-Reply-To: <9b08084c0912020128w6d5e685dq2dd259e82806d2aa@mail.gmail.com> References: <9b08084c0912020128w6d5e685dq2dd259e82806d2aa@mail.gmail.com> Message-ID: On Dec 2, 2009, at 10:28 PM, Joe Armstrong wrote: > Best practice for writing documenting and testing code > -module(elib1_best). %% [1] > > %% elib1_best: Best practice template for library modules [2] > %% Time-stamp: <2009-12-02 09:43:12 ejoearm> [3] If you are using edoc, shouldn't that be %% @author Joe Armstrong %% @version 2009-12-02 09:43:12 Perhaps there should be a @date tag; dates and version numbers really aren't the same thing. > > % > %---------------------------------------------------------------------- > %% Copyright (c) 2009 Joe Armstrong [4] > %% Copyright (c) 2009 Whoomph Software AB Again, if you are using edoc, shouldn't those be %% @copyright ? 2009 Joe Armstrong %% @copyright ? 2009 Whoomph Software AB The old idea of using -(). declarations seemed to me to be a better way of doing this: the information was available to any documentation tool that wanted it *AND* it could be copied into the .beam file by the compiler. From zabrane3@REDACTED Wed Dec 2 23:48:12 2009 From: zabrane3@REDACTED (zabrane Mikael) Date: Wed, 2 Dec 2009 23:48:12 +0100 Subject: gen_server:call/3 and timeout handling Message-ID: <18a1db030912021448i72e693d0p46f7759966e17722@mail.gmail.com> Hi List ! When I use the call "gen_server:call/3 (I mean using the timeout option), a timout may occur if the corresponding "gen_server:handle_call/3" takes take too long. Then, the whole "gen_server" crashes with an error report. What I'd like to achieve is to "intercept" this "timeout" message in my "gen_server" code and handle it gracefully without stopping my "gen_server" (eg. by sending back a reply with reason = timeout). Is this possible? Is there a best practice for that? Regards Zabrane From ok@REDACTED Wed Dec 2 23:53:14 2009 From: ok@REDACTED (Richard O'Keefe) Date: Thu, 3 Dec 2009 11:53:14 +1300 Subject: [erlang-questions] Best practice for defining functions with edoc,erlc,eunit and the dialyzer In-Reply-To: <4B1641F8.2040708@tmit.bme.hu> References: <9b08084c0912020128w6d5e685dq2dd259e82806d2aa@mail.gmail.com> <4B1641F8.2040708@tmit.bme.hu> Message-ID: <5AA5B557-9354-4B89-BBA7-A6DE3775A52A@cs.otago.ac.nz> On Dec 2, 2009, at 11:31 PM, Zoltan Lajos Kis wrote: >> > One more thing that can be addressed is the order of exporting (and > defining) functions. My preference is to: > - 1, export API functions > - 2, export Behavior callback functions (a separate export line for > each behavior) > - 3, export internal functions. The functions that you _don't want > to export_, but Erlang makes you to do so in order to use them in > spawns, applys, etc. > Could I make a plea for - a SINGLE export list for all "API" (horrible term) functions - in alphabetic order > Something like: > > %% API > -export([start_link/0, update/0, get/1, put/2, ...]). Something like -export([ get/1, put/2, start_link/0, update/0 ]). It's just that much easier to see what the module is all about. Someone using emacs can easily keep such a list in order using sort-lines. > > > %% Behavior callbacks > -behaviour(gen_server). > -export([init/1, handle_call/3, handle_cast/2, ...]). Years ago I recommended that the syntax should be extended to -behaviour(Behaviour, [Callback...]). so that a cross-checking tool could tell that these functions were *intended* to be used as callbacks by that behaviour and weren't just accidentally adjacent. > > > %% Internal functions > -export([spawnee/0, applyee/2, ...]). Now that we have spawn(fun () -> ... end) and F(...), we shouldn't need this group at all. From bflatmaj7th@REDACTED Thu Dec 3 00:29:18 2009 From: bflatmaj7th@REDACTED (Richard Andrews) Date: Thu, 3 Dec 2009 10:29:18 +1100 Subject: Has Intel implemented erlang IPC in a chip? Message-ID: <7702c0610912021529t70937ed9x3f81fdbc20701692@mail.gmail.com> http://www.pcper.com/article.php?aid=825 I found the parallels between this chip's message passing system and the erlang inter-process messaging interesting. In some ways it's a validation of the core ideas in erlang about how to scale for truly concurrent operations - eg. share nothing, pass messages. How well do you think erlang would run on this architecture? From ok@REDACTED Thu Dec 3 01:16:32 2009 From: ok@REDACTED (Richard O'Keefe) Date: Thu, 3 Dec 2009 13:16:32 +1300 Subject: [erlang-questions] Ternary Like Operation Idiom in Erlang In-Reply-To: References: Message-ID: <5254A814-FABA-4B57-BA29-48D265833AA6@cs.otago.ac.nz> On Dec 3, 2009, at 10:13 AM, Jarrod Roberson wrote: > In multicast dns TXT records you have name value pairs that can look > like "key=value", "key=" and "key". > "key=" means key with no values > "key" implies "key=true" > I need to convert any thing that looks like "key" to "key=true" to > normalize my data I am converting to dictionaries using re:split/2. > > here is how I would do this in Java. > > String s = "xxx"; > return s.matches("=") ? s : s + "=true"; Why not s.indexOf('=') < 0 ? s : s + "=true" ? > > > here is what I have come up with in Erlang. case lists:member($=, String) of true -> String ; false -> String ++ "=true" end Logically the same as the (improved) Java version. From igorrs@REDACTED Thu Dec 3 01:58:59 2009 From: igorrs@REDACTED (Igor Ribeiro Sucupira) Date: Wed, 2 Dec 2009 22:58:59 -0200 Subject: [erlang-questions] Getting the position of a list item In-Reply-To: References: <6a3ae47e0912020934j27430d00wed628a10bfb48707@mail.gmail.com> Message-ID: Hum... when you talked about records, I realized I still have one function that needs to find the position of an item on a list. The function is used to get the value of a field F on a record, when F is defined at runtime. I don't understand exactly what you need, but I guess it's basically the same thing, isn't it? On Wed, Dec 2, 2009 at 3:53 PM, Garrett Smith wrote: > On Wed, Dec 2, 2009 at 11:34 AM, Robert Raschke wrote: >> On Wed, Dec 2, 2009 at 5:10 PM, Garrett Smith wrote: >> >>> I'm missing something basic here :\ >>> >>> The lists module has keyfind/3 but no find/2, where you want to return >>> the position of a particular list item. This is surprising. >>> >>> Is there a commonly used pattern for this? >>> >> Hmm, I fail to come up with a good usage scenario for wanting this. What are >> you needing the position of an item in a list for? > > I'm stitching together record field values and want to get an > insertion position using a field token. > > So, this goes in hard with an "insert_at(Value, N, List_Or_Tuple)" > type of function. > > In general though, there are several functions in the lists module > that accept a positional argument (N) -- having some easy ways of > getting N seems reasonable. Functions like l/find and rfind are pretty > common in the list APIs I'm familiar with. > > Garrett > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > -- "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 igorrs@REDACTED Thu Dec 3 02:16:48 2009 From: igorrs@REDACTED (Igor Ribeiro Sucupira) Date: Wed, 2 Dec 2009 23:16:48 -0200 Subject: [erlang-questions] Getting the position of a list item In-Reply-To: References: <6a3ae47e0912020934j27430d00wed628a10bfb48707@mail.gmail.com> Message-ID: By the way, this is the function (with some details like module names removed/changed): field_value(R, F) when is_record(R, test), is_atom(F) -> P = find_first(F, record_info(fields, test)), lists:nth(P + 1, tuple_to_list(R)). I don't think there would be something easier without the function to get the position of the list item (find_first, in my example). Igor. On Wed, Dec 2, 2009 at 10:58 PM, Igor Ribeiro Sucupira wrote: > Hum... when you talked about records, I realized I still have one > function that needs to find the position of an item on a list. The > function is used to get the value of a field F on a record, when F is > defined at runtime. > > I don't understand exactly what you need, but I guess it's basically > the same thing, isn't it? > > On Wed, Dec 2, 2009 at 3:53 PM, Garrett Smith wrote: >> On Wed, Dec 2, 2009 at 11:34 AM, Robert Raschke wrote: >>> On Wed, Dec 2, 2009 at 5:10 PM, Garrett Smith wrote: >>> >>>> I'm missing something basic here :\ >>>> >>>> The lists module has keyfind/3 but no find/2, where you want to return >>>> the position of a particular list item. This is surprising. >>>> >>>> Is there a commonly used pattern for this? >>>> >>> Hmm, I fail to come up with a good usage scenario for wanting this. What are >>> you needing the position of an item in a list for? >> >> I'm stitching together record field values and want to get an >> insertion position using a field token. >> >> So, this goes in hard with an "insert_at(Value, N, List_Or_Tuple)" >> type of function. >> >> In general though, there are several functions in the lists module >> that accept a positional argument (N) -- having some easy ways of >> getting N seems reasonable. Functions like l/find and rfind are pretty >> common in the list APIs I'm familiar with. >> >> Garrett >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> > > > > -- > "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. > -- "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 ngocdaothanh@REDACTED Thu Dec 3 02:23:03 2009 From: ngocdaothanh@REDACTED (Ngoc Dao) Date: Thu, 3 Dec 2009 10:23:03 +0900 Subject: [erlang-questions] Getting the position of a list item In-Reply-To: <401d3ba30912021029g2d521aceoe086fda6c9e1746b@mail.gmail.com> References: <401d3ba30912021029g2d521aceoe086fda6c9e1746b@mail.gmail.com> Message-ID: <5c493e530912021723j35f05189ie0b5bb3f68a65d27@mail.gmail.com> > string:str(List, [Element]). What a surprise! Thank you. From g@REDACTED Thu Dec 3 02:50:53 2009 From: g@REDACTED (Garrett Smith) Date: Wed, 2 Dec 2009 19:50:53 -0600 Subject: [erlang-questions] Getting the position of a list item In-Reply-To: <5c493e530912021723j35f05189ie0b5bb3f68a65d27@mail.gmail.com> References: <401d3ba30912021029g2d521aceoe086fda6c9e1746b@mail.gmail.com> <5c493e530912021723j35f05189ie0b5bb3f68a65d27@mail.gmail.com> Message-ID: On Wed, Dec 2, 2009 at 7:23 PM, Ngoc Dao wrote: >> string:str(List, [Element]). > > What a surprise! Thank you. A good example of "most astonishment" :) From ngocdaothanh@REDACTED Thu Dec 3 03:53:18 2009 From: ngocdaothanh@REDACTED (Ngoc Dao) Date: Thu, 3 Dec 2009 11:53:18 +0900 Subject: [erlang-questions] online documentation In-Reply-To: <20091202112053.GA21860@erix.ericsson.se> References: <95be1d3b0911270523m7e78892dg5e80aeaf875e3829@mail.gmail.com> <20091202105536.GA21292@erix.ericsson.se> <23E6EAD4-8ADA-484B-833E-197D0935169E@souja.net> <20091202112053.GA21860@erix.ericsson.se> Message-ID: <5c493e530912021853p6f0b2481k5e7a274c62c11ecc@mail.gmail.com> This is an impressive improvement. Currently I am using gotapi, and its API is not the latest: http://www.gotapi.com/erlang On Wed, Dec 2, 2009 at 8:20 PM, Raimo Niskanen wrote: > On Wed, Dec 02, 2009 at 03:08:05AM -0800, Jayson Vantuyl wrote: >> When I searched for a fully qualified function (i.e. ets:new), it seemed to have an issue URL-decoding the colon, and the search generally didn't like it even when manually adjusted on the next page. ?Nice start, though. > > Currently it searches for names anywhere (functions, modules and applications), > so you can search for `ets', follow to the ets man page and then > scroll down to the `new' function. > > Or you can search for `new'. > > You can also search for `ets new', which oddly enough > does not give ets:new higher ranking than any other > Whatever:new function... > > It sounds like a very nice idea that either `ets:new' or > `ets new' would give higher ranking for a hit on both > module and function (and application). I will forward > the idea to the developers (hope they read this too). > >> >> On Dec 2, 2009, at 2:55 AM, Raimo Niskanen wrote: >> >> > On Fri, Nov 27, 2009 at 03:15:03PM +0100, Kenneth Lundin wrote: >> >> Hi Vlad, >> >> >> >> A search facility will come , we will create an index >> >> for this purpose as part of the docbuilding process. >> >> >> >> No need to patch the docbuilder application. >> >> >> >> /Kenneth Erlang/OTP Ericsson >> > >> > There is a preliminary version of the search facility >> > now running on the (perliminary) demo site: >> > Go to http://demo.erlang.org/doc.html and type e.g "keyse" >> > in the text field in the grey right column, then click the >> > looking glass button... Comments are welcome. >> > >> > The same search application should eventually be >> > possible to run via the OTP webtool application on >> > your local Erlang/OTP installation as a HTTP >> > server on your local host. >> > >> > / Raimo >> > >> > >> >> >> >> On Fri, Nov 27, 2009 at 2:23 PM, Vlad Dumitrescu wrote: >> >>> Hi! >> >>> >> >>> I really like the looks of the new documentation. >> >>> >> >>> There is a small thing that was suggested before and that would help a >> >>> lot: a search field (hopefully with autocompletion, too). Typing >> >>> "li:keys" to go to lists:keysearch would be soooo sweet!... >> >>> >> >>> I realize now that generating this is probably the job of the >> >>> docbuilder application, which would mean that I can probably submit a >> >>> patch myself (if I get to it). Will check that (but if someone else >> >>> has faster fingers, I won't hold a grudge :-). >> >>> >> >>> BTW, a related question: I see that the issue tracker at github is >> >>> being used. What is the current policy for reporting bugs? It would be >> >>> nice if there was only a single place instead of three (some people >> >>> like me do post bug reports here instead of erlang-bugs anyway), for >> >>> example if the github tracker could send email notifications to >> >>> erlang-bugs. >> >>> >> >>> best regards, >> >>> Vlad >> >>> >> >>> ________________________________________________________________ >> >>> erlang-questions mailing list. See http://www.erlang.org/faq.html >> >>> erlang-questions (at) erlang.org >> >>> >> >>> >> >> >> >> ________________________________________________________________ >> >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> >> erlang-questions (at) erlang.org >> > >> > -- >> > >> > / Raimo Niskanen, Erlang/OTP, Ericsson AB >> > >> > ________________________________________________________________ >> > erlang-questions mailing list. See http://www.erlang.org/faq.html >> > erlang-questions (at) erlang.org >> > >> >> >> >> -- >> Jayson Vantuyl >> kagato@REDACTED >> >> >> >> >> > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From aduston@REDACTED Thu Dec 3 04:24:56 2009 From: aduston@REDACTED (adam) Date: Wed, 2 Dec 2009 19:24:56 -0800 (PST) Subject: The Unbearable Slowness of Some disc_only_copies Transactions Message-ID: <6371951e-9465-4330-9091-ed053548e420@u7g2000yqm.googlegroups.com> We have running Erlang code that is executing about 30 transactions per second. Each transaction puts a write lock on a couple of records, then performs a read and a write. We need to hold several hundred million records simultaneously. When using disc_copies tables, we can easily manage to run about 160 transactions per second. We also see that each transaction takes an average of about 750-1400 microseconds to run. Min time is 350 microseconds, and max time seems to go between 30-100 milliseconds. However, with disc_only_copies tables, individual transaction time ranges between 500 microseconds up to about 90 seconds(!). Why do individual transactions sometimes take such a long time with disc_only_copies? Thank you! Adam From jeffm@REDACTED Thu Dec 3 05:00:21 2009 From: jeffm@REDACTED (jm) Date: Thu, 03 Dec 2009 15:00:21 +1100 Subject: reading data from a file Message-ID: <4B1737D5.6080406@ghostgun.com> I have a file of erlang terms with comments of the form, %% comment [ {string(), {atom(), atom() | integer}} ]. For example, %% comment %% another comment [ {"Some text", {some, none}}, {"More text", {more, 1}} ]. as I thought this wold be easy to read in as many of the data files used with OTP have similar formats, eg emake files. Now I'm searching for a convenient function to road this in. I seem to be missing something. I've found io:scan_erl_exprs/3 but this seems a little low level. Is there a higher level call which will convert this text into a matching data structure (quick and dirty is fine)? Is there better way to do this that is not quick and dirty, and would be safer for publicly submitted files? thanks in advance, Jeff. From kagato@REDACTED Thu Dec 3 05:49:03 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Wed, 2 Dec 2009 20:49:03 -0800 Subject: [erlang-questions] reading data from a file In-Reply-To: <4B1737D5.6080406@ghostgun.com> References: <4B1737D5.6080406@ghostgun.com> Message-ID: <4BAF0096-778C-474E-8FFA-FD398A4B06CF@souja.net> file:consult/1. Note that I don't believe it recovers the comments, so rewriting files with it can be ugly unless you want to do something like "All bare strings are preserved as comments". That said, i've always found file:consult/1 to be worth it's weight in gold, even if it's unusually named. On Dec 2, 2009, at 8:00 PM, jm wrote: > I have a file of erlang terms with comments of the form, > > > %% comment > [ > {string(), {atom(), atom() | integer}} > ]. > > For example, > %% comment > %% another comment > [ > {"Some text", {some, none}}, > {"More text", {more, 1}} > ]. > > > as I thought this wold be easy to read in as many of the data files used with OTP have similar formats, eg emake files. Now I'm searching for a convenient function to road this in. I seem to be missing something. I've found io:scan_erl_exprs/3 but this seems a little low level. Is there a higher level call which will convert this text into a matching data structure (quick and dirty is fine)? Is there better way to do this that is not quick and dirty, and would be safer for publicly submitted files? > > thanks in advance, > Jeff. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org -- Jayson Vantuyl kagato@REDACTED From jeffm@REDACTED Thu Dec 3 06:09:36 2009 From: jeffm@REDACTED (jm) Date: Thu, 03 Dec 2009 16:09:36 +1100 Subject: [erlang-questions] reading data from a file In-Reply-To: <4BAF0096-778C-474E-8FFA-FD398A4B06CF@souja.net> References: <4B1737D5.6080406@ghostgun.com> <4BAF0096-778C-474E-8FFA-FD398A4B06CF@souja.net> Message-ID: <4B174810.6010405@ghostgun.com> Thanks guys. You just saved me from myself. I had begin to descend into parsing hell by starting a hand written parser to process the token output of io:scan_erl_exprs/3. It was looking like a long and hard road. The loss of comments doesn't worry me as the comments are there to remind me of the format of the file and nothing else. Given the price of gold it's just as well it's weight is measured in electrons :-). Jeff. Jayson Vantuyl wrote: > file:consult/1. Note that I don't believe it recovers the comments, so rewriting files with it can be ugly unless you want to do something like "All bare strings are preserved as comments". > > That said, i've always found file:consult/1 to be worth it's weight in gold, even if it's unusually named. > > On Dec 2, 2009, at 8:00 PM, jm wrote: > > > From vladdu55@REDACTED Thu Dec 3 08:58:14 2009 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Thu, 3 Dec 2009 08:58:14 +0100 Subject: [erlang-questions] online documentation In-Reply-To: <20091202105536.GA21292@erix.ericsson.se> References: <95be1d3b0911270523m7e78892dg5e80aeaf875e3829@mail.gmail.com> <20091202105536.GA21292@erix.ericsson.se> Message-ID: <95be1d3b0912022358t9ab9bbnd11e46957149d73a@mail.gmail.com> On Wed, Dec 2, 2009 at 11:55, Raimo Niskanen wrote: > There is a preliminary version of the search facility > now running on the (perliminary) demo site: > Go to http://demo.erlang.org/doc.html and type e.g "keyse" > in the text field in the grey right column, then click the > looking glass button... Comments are welcome. Looking good! I look forward to an UI similar to gotapi, where the input box shows the filtered results in real time. regards, Vlad From leap@REDACTED Thu Dec 3 09:04:17 2009 From: leap@REDACTED (Michael Turner) Date: Thu, 03 Dec 2009 08:04:17 +0000 Subject: http://en.wikipedia.org/wiki/Intel_iAPX_432#Multitasking_and_interprocess_communication In-Reply-To: <7702c0610912021529t70937ed9x3f81fdbc20701692@mail.gmail.com> Message-ID: Intel architecture per core, with (unstated but necessarily) limited memory per core, and no cache coherence . . . well, this just leaves me asking: Why bother with Intel architecture per core? All it gets you is binary compatibility with apps written for Intel CPUs, and just about everything already written for Intel CPUs requires a large virtual address space these days. Just about any RISC architecture would probably consume less area and power per core. ARM cores, for example, would make a lot more sense. Not likely to see that from Intel, though. Intel's Justin Rattner (the CTO quoted in the article) and message passing architectures actually have some shared history. Under his direction, Intel R&D probably implemented something like Erlang messaging in silicon as far back as 1981: http://en.wikipedia.org/wiki/Intel_iAPX_432#Multitasking_and_interprocess_communication But not just message passing and h/w support for concurrency and parallelism, but on-chip object-orientation and garbage collection as well. These people know how to do everything, and they have known how for a long time. But once you get them started, they just don't know where to stop. -michael turner On 12/2/2009, "Richard Andrews" wrote: >http://www.pcper.com/article.php?aid=825 > >I found the parallels between this chip's message passing system and >the erlang inter-process messaging interesting. In some ways it's a >validation of the core ideas in erlang about how to scale for truly >concurrent operations - eg. share nothing, pass messages. > >How well do you think erlang would run on this architecture? > >________________________________________________________________ >erlang-questions mailing list. See http://www.erlang.org/faq.html >erlang-questions (at) erlang.org > > From leap@REDACTED Thu Dec 3 10:08:45 2009 From: leap@REDACTED (Michael Turner) Date: Thu, 03 Dec 2009 09:08:45 +0000 Subject: [erlang-questions] Ternary Like Operation Idiom in Erlang In-Reply-To: Message-ID: >Thanks to Dale's version I came up with this. > >F = fun(T) -> case re:split(T,"=",[{return,list}]) of [K] -> {K,true}; >[K,V] -> {K,V} end end. Cute, but with whitespace trailing after the "=", you get {key, " "}, which might not be the desired behavior. Moreover, an embedded "=" in the Value part (e.g, key='a=1' or something ridiculous like that) will cause it to fail, which also might not be desired behavior. Getting close, though. The following Fm = fun(T) -> case re:split(string:strip(T),"=",[{return,list}]) of [K] -> {K, true}; [K | V] -> {K, string:join (V, "=")} end end. seems to cover those cases. I'm assuming you don't care that there's no whitespace stripped from the left end of the V string. But maybe you do. It's admittedly now too long to a candidate for "idiomatic Erlang." I wonder if it could be significantly shorter, but still robust? I'd love to pursue this further, but I just got an urgent call about some gig that involves biting the heads off of live chickens. -michael turner On 12/2/2009, "Jarrod Roberson" wrote: >Thanks to Dale's version I came up with this. > >F = fun(T) -> case re:split(T,"=",[{return,list}]) of [K] -> {K,true}; >[K,V] -> {K,V} end end. > >in action > >Eshell V5.7.3 (abort with ^G) >1> F = fun(T) -> case re:split(T,"=",[{return,list}]) of [K] -> >{K,true}; [K,V] -> {K,V} end end. >#Fun >2> F("key"). >{"key",true} >3> F("key=value"). >{"key","value"} >4> F("key="). >{"key",[]} >5> > >________________________________________________________________ >erlang-questions mailing list. See http://www.erlang.org/faq.html >erlang-questions (at) erlang.org > > From raimo+erlang-questions@REDACTED Thu Dec 3 10:45:59 2009 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 3 Dec 2009 10:45:59 +0100 Subject: [erlang-questions] online documentation In-Reply-To: <5c493e530912021853p6f0b2481k5e7a274c62c11ecc@mail.gmail.com> References: <95be1d3b0911270523m7e78892dg5e80aeaf875e3829@mail.gmail.com> <20091202105536.GA21292@erix.ericsson.se> <23E6EAD4-8ADA-484B-833E-197D0935169E@souja.net> <20091202112053.GA21860@erix.ericsson.se> <5c493e530912021853p6f0b2481k5e7a274c62c11ecc@mail.gmail.com> Message-ID: <20091203094559.GA4467@erix.ericsson.se> On Thu, Dec 03, 2009 at 11:53:18AM +0900, Ngoc Dao wrote: > This is an impressive improvement. > > Currently I am using gotapi, and its API is not the latest: > http://www.gotapi.com/erlang That is a really cool tool. Annoying that they call modules "class", but anyway impressive... This site sets a standard that erldoc should strive to reach, but with the latest documentation! > > > On Wed, Dec 2, 2009 at 8:20 PM, Raimo Niskanen > wrote: > > On Wed, Dec 02, 2009 at 03:08:05AM -0800, Jayson Vantuyl wrote: > >> When I searched for a fully qualified function (i.e. ets:new), it seemed to have an issue URL-decoding the colon, and the search generally didn't like it even when manually adjusted on the next page. ?Nice start, though. > > > > Currently it searches for names anywhere (functions, modules and applications), > > so you can search for `ets', follow to the ets man page and then > > scroll down to the `new' function. > > > > Or you can search for `new'. > > > > You can also search for `ets new', which oddly enough > > does not give ets:new higher ranking than any other > > Whatever:new function... > > > > It sounds like a very nice idea that either `ets:new' or > > `ets new' would give higher ranking for a hit on both > > module and function (and application). I will forward > > the idea to the developers (hope they read this too). > > > >> > >> On Dec 2, 2009, at 2:55 AM, Raimo Niskanen wrote: > >> > >> > On Fri, Nov 27, 2009 at 03:15:03PM +0100, Kenneth Lundin wrote: > >> >> Hi Vlad, > >> >> > >> >> A search facility will come , we will create an index > >> >> for this purpose as part of the docbuilding process. > >> >> > >> >> No need to patch the docbuilder application. > >> >> > >> >> /Kenneth Erlang/OTP Ericsson > >> > > >> > There is a preliminary version of the search facility > >> > now running on the (perliminary) demo site: > >> > Go to http://demo.erlang.org/doc.html and type e.g "keyse" > >> > in the text field in the grey right column, then click the > >> > looking glass button... Comments are welcome. > >> > > >> > The same search application should eventually be > >> > possible to run via the OTP webtool application on > >> > your local Erlang/OTP installation as a HTTP > >> > server on your local host. > >> > > >> > / Raimo > >> > > >> > > >> >> > >> >> On Fri, Nov 27, 2009 at 2:23 PM, Vlad Dumitrescu wrote: > >> >>> Hi! > >> >>> > >> >>> I really like the looks of the new documentation. > >> >>> > >> >>> There is a small thing that was suggested before and that would help a > >> >>> lot: a search field (hopefully with autocompletion, too). Typing > >> >>> "li:keys" to go to lists:keysearch would be soooo sweet!... > >> >>> > >> >>> I realize now that generating this is probably the job of the > >> >>> docbuilder application, which would mean that I can probably submit a > >> >>> patch myself (if I get to it). Will check that (but if someone else > >> >>> has faster fingers, I won't hold a grudge :-). > >> >>> > >> >>> BTW, a related question: I see that the issue tracker at github is > >> >>> being used. What is the current policy for reporting bugs? It would be > >> >>> nice if there was only a single place instead of three (some people > >> >>> like me do post bug reports here instead of erlang-bugs anyway), for > >> >>> example if the github tracker could send email notifications to > >> >>> erlang-bugs. > >> >>> > >> >>> best regards, > >> >>> Vlad > >> >>> > >> >>> ________________________________________________________________ > >> >>> erlang-questions mailing list. See http://www.erlang.org/faq.html > >> >>> erlang-questions (at) erlang.org > >> >>> > >> >>> > >> >> > >> >> ________________________________________________________________ > >> >> erlang-questions mailing list. See http://www.erlang.org/faq.html > >> >> erlang-questions (at) erlang.org > >> > > >> > -- > >> > > >> > / Raimo Niskanen, Erlang/OTP, Ericsson AB > >> > > >> > ________________________________________________________________ > >> > erlang-questions mailing list. See http://www.erlang.org/faq.html > >> > erlang-questions (at) erlang.org > >> > > >> > >> > >> > >> -- > >> Jayson Vantuyl > >> kagato@REDACTED > >> > >> > >> > >> > >> > > > > -- > > > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > > ________________________________________________________________ > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > erlang-questions (at) erlang.org > > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From ms@REDACTED Thu Dec 3 10:54:31 2009 From: ms@REDACTED (Martin Scholl) Date: Thu, 03 Dec 2009 10:54:31 +0100 Subject: [erlang-questions] http://en.wikipedia.org/wiki/Intel_iAPX_432#Multitasking_and_interprocess_communication In-Reply-To: References: Message-ID: <4B178AD7.3040704@diskware.net> Michael Turner wrote: > Intel architecture per core, with (unstated but necessarily) limited > memory per core, and no cache coherence . . . well, this just leaves me > asking: Why bother with Intel architecture per core? All it gets you is > binary compatibility with apps written for Intel CPUs, and just about > everything already written for Intel CPUs requires a large virtual > address space these days. Actually, there is a an operating system written to handle this: Barrelfish[0]. Why does this arch have no cache coherent shared memory? In [1] you will find arguments why a low-level rpc / message passing system actually outperforms shared-memory based communication given a sufficient large number of cores / dies / cpus. > > Just about any RISC architecture would probably consume less area and > power per core. ARM cores, for example, would make a lot more sense. > Not likely to see that from Intel, though. True. But ARM is getting traction in large-scale deployment. E.g. Dell has an offering based on low-cost low-power ARM-based "microslice" servers. Martin [0] http://barrelfish.org/ [1] http://barrelfish.org/barrelfish_sosp09.pdf From kiszl@REDACTED Thu Dec 3 10:55:50 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Thu, 3 Dec 2009 10:55:50 +0100 (CET) Subject: [erlang-questions] Best practice for defining functions with edoc,erlc,eunit and the dialyzer In-Reply-To: <5AA5B557-9354-4B89-BBA7-A6DE3775A52A@cs.otago.ac.nz> References: <9b08084c0912020128w6d5e685dq2dd259e82806d2aa@mail.gmail.com> <4B1641F8.2040708@tmit.bme.hu> <5AA5B557-9354-4B89-BBA7-A6DE3775A52A@cs.otago.ac.nz> Message-ID: <50763.194.88.55.211.1259834150.squirrel@localhost> > > On Dec 2, 2009, at 11:31 PM, Zoltan Lajos Kis wrote: >>> >> One more thing that can be addressed is the order of exporting (and >> defining) functions. My preference is to: >> - 1, export API functions >> - 2, export Behavior callback functions (a separate export line for >> each behavior) >> - 3, export internal functions. The functions that you _don't want >> to export_, but Erlang makes you to do so in order to use them in >> spawns, applys, etc. >> > > Could I make a plea for > - a SINGLE export list for all "API" (horrible term) functions > - in alphabetic order Sorry. Borrowed the term from the Erlang/OTP source code :) > >> Something like: >> >> %% API >> -export([start_link/0, update/0, get/1, put/2, ...]). > > Something like > > -export([ > get/1, > put/2, > start_link/0, > update/0 > ]). > > It's just that much easier to see what the module is all about. > Someone using emacs can easily keep such a list in order using > sort-lines. I prefer to group the "API" functions based on their functionality and order them by the order they will most probably be used. In my config server example start_link / update will be used by the supervisor/management hierarchy, while get and put will be used by whoever needs something. > >> >> >> %% Behavior callbacks >> -behaviour(gen_server). >> -export([init/1, handle_call/3, handle_cast/2, ...]). > > Years ago I recommended that the syntax should be extended > to > -behaviour(Behaviour, [Callback...]). > so that a cross-checking tool could tell that these functions > were *intended* to be used as callbacks by that behaviour and > weren't just accidentally adjacent. A simple -behavior(Behavior). could be interpreted by the compiler as exporting all of the behavior's callback functions. That would trigger a compiler error if you forgot to implement one. > >> >> >> %% Internal functions >> -export([spawnee/0, applyee/2, ...]). > > Now that we have spawn(fun () -> ... end) and F(...), > we shouldn't need this group at all. > In general you can argue that all of these internal functions can be handled as callbacks, and thus put into behaviors, and exported as such. Nevertheless grep for "internal exports" in the Erlang/OTP source. There is quite a lot of them. Regards, Zoltan. From Jakub.Zawierucha@REDACTED Thu Dec 3 11:12:25 2009 From: Jakub.Zawierucha@REDACTED (Jakub Zawierucha) Date: Thu, 03 Dec 2009 11:12:25 +0100 Subject: string in << >> Message-ID: <4B178F09.80000@nit.pl> Hello, How can I put string into binary form ? Below you can find description on my problem. 49> f(). ok 50> X = "dupa". "dupa" 51> <<"dupa", 3:2>>. <<100,117,112,97,3:2>> 52> <>. ** exception error: bad argument Thanks, Jakub Zawierucha From raimo+erlang-questions@REDACTED Thu Dec 3 10:50:45 2009 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 3 Dec 2009 10:50:45 +0100 Subject: [erlang-questions] online documentation In-Reply-To: <95be1d3b0912022358t9ab9bbnd11e46957149d73a@mail.gmail.com> References: <95be1d3b0911270523m7e78892dg5e80aeaf875e3829@mail.gmail.com> <20091202105536.GA21292@erix.ericsson.se> <95be1d3b0912022358t9ab9bbnd11e46957149d73a@mail.gmail.com> Message-ID: <20091203095045.GB4467@erix.ericsson.se> On Thu, Dec 03, 2009 at 08:58:14AM +0100, Vlad Dumitrescu wrote: > On Wed, Dec 2, 2009 at 11:55, Raimo Niskanen > wrote: > > There is a preliminary version of the search facility > > now running on the (perliminary) demo site: > > Go to http://demo.erlang.org/doc.html and type e.g "keyse" > > in the text field in the grey right column, then click the > > looking glass button... Comments are welcome. > > Looking good! > > I look forward to an UI similar to gotapi, where the input box shows > the filtered results in real time. Well, when you are in the search page, the search result list is updated in real time. It is not a drop-down menu, though, and gotapi feels snappier. Good enough? > > regards, > Vlad > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From rtrlists@REDACTED Thu Dec 3 11:15:21 2009 From: rtrlists@REDACTED (Robert Raschke) Date: Thu, 3 Dec 2009 10:15:21 +0000 Subject: [erlang-questions] gen_server:call/3 and timeout handling In-Reply-To: <18a1db030912021448i72e693d0p46f7759966e17722@mail.gmail.com> References: <18a1db030912021448i72e693d0p46f7759966e17722@mail.gmail.com> Message-ID: <6a3ae47e0912030215uc4219ejd6ad7f1147bafe74@mail.gmail.com> On Wed, Dec 2, 2009 at 10:48 PM, zabrane Mikael wrote: > When I use the call "gen_server:call/3 (I mean using the timeout option), > a timout may occur if the corresponding "gen_server:handle_call/3" takes > take too long. > Then, the whole "gen_server" crashes with an error report. > > > What I'd like to achieve is to "intercept" this "timeout" message in my > "gen_server" code and handle > it gracefully without stopping my "gen_server" (eg. by sending back a reply > with reason = timeout). > > Is this possible? Is there a best practice for that? > > I think you would need to wrap the call in a try-catch, as the function call itself is failing due to the timeout. For example, using this dummy server: -module(timeout_test). -behaviour(gen_server). -export([start_link/0, test/0]). -export([init/1, handle_call/3, handle_cast/2, handle_info/2, code_change/3, terminate/2]). start_link() -> gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). test() -> gen_server:call(?MODULE, test, 1000). init([]) -> {ok, []}. handle_call(test, _From, State) -> {reply, timer:sleep(1500), State}. handle_cast(_Request, State) -> {noreply, State}. handle_info(_, State) -> {noreply, State}. code_change(_Old, State, _Extra) -> {ok, State}. terminate(_Reason, _State) -> ok. And in the shell: Eshell V5.6.5 (abort with ^G) 1> c(timeout_test). {ok,timeout_test} 2> timeout_test:start_link(). {ok,<0.27047.4>} 3> try timeout_test:test() catch Error:Reason -> {Error, Reason} end. {exit,{timeout,{gen_server,call,[timeout_test,test,1000]}}} 4> You can obviously also put the try-catch into the function that does the gen_server:call and return interesting values depending on the catch. Hope this gets you in the right direction, Robby From gleber.p@REDACTED Thu Dec 3 11:16:53 2009 From: gleber.p@REDACTED (Gleb Peregud) Date: Thu, 3 Dec 2009 11:16:53 +0100 Subject: [erlang-questions] string in << >> In-Reply-To: <4B178F09.80000@nit.pl> References: <4B178F09.80000@nit.pl> Message-ID: <14f0e3620912030216y781f7b06la3b9f263c2f1ef03@mail.gmail.com> You have to convert your list to binary first: 1> X = "milsze-slowo-niz-dupa". "milsze-slowo-niz-dupa" 2> Y = list_to_binary(X). <<"milsze-slowo-niz-dupa">> 3> <>. <<109,105,108,115,122,101,45,115,108,111,119,111,45,110, 105,122,45,100,117,112,97,3:2>> 2009/12/3 Jakub Zawierucha : > Hello, > > How can I put string into binary form ? Below you can find description on my > problem. > > 49> f(). > ok > 50> X = "dupa". > "dupa" > 51> <<"dupa", 3:2>>. > <<100,117,112,97,3:2>> > 52> <>. > ** exception error: bad argument > > Thanks, > Jakub Zawierucha > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From vladdu55@REDACTED Thu Dec 3 11:17:17 2009 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Thu, 3 Dec 2009 11:17:17 +0100 Subject: [erlang-questions] online documentation In-Reply-To: <20091203095045.GB4467@erix.ericsson.se> References: <95be1d3b0911270523m7e78892dg5e80aeaf875e3829@mail.gmail.com> <20091202105536.GA21292@erix.ericsson.se> <95be1d3b0912022358t9ab9bbnd11e46957149d73a@mail.gmail.com> <20091203095045.GB4467@erix.ericsson.se> Message-ID: <95be1d3b0912030217m404adddcxd1fca1bc5cbe3ec8@mail.gmail.com> On Thu, Dec 3, 2009 at 10:50, Raimo Niskanen wrote: > Well, when you are in the search page, the search result list > is updated in real time. It is not a drop-down menu, though, > and gotapi feels snappier. > > Good enough? I didn't notice that. It's good enough for me. Thanks! regards, /Vlad From rumata-estor@REDACTED Thu Dec 3 11:21:23 2009 From: rumata-estor@REDACTED (Dmitry Belyaev) Date: Thu, 03 Dec 2009 13:21:23 +0300 Subject: [erlang-questions] online documentation In-Reply-To: <20091203094559.GA4467@erix.ericsson.se> References: <95be1d3b0911270523m7e78892dg5e80aeaf875e3829@mail.gmail.com> <20091202105536.GA21292@erix.ericsson.se> <23E6EAD4-8ADA-484B-833E-197D0935169E@souja.net> <20091202112053.GA21860@erix.ericsson.se> <5c493e530912021853p6f0b2481k5e7a274c62c11ecc@mail.gmail.com> <20091203094559.GA4467@erix.ericsson.se> Message-ID: <1259835683.21785.4.camel@rumbuntu> I prefer http://erlapi.prepor.ru/docs/ It scrolls to selected function and has pretty style. On Thu, 2009-12-03 at 10:45 +0100, Raimo Niskanen wrote: > On Thu, Dec 03, 2009 at 11:53:18AM +0900, Ngoc Dao wrote: > > This is an impressive improvement. > > > > Currently I am using gotapi, and its API is not the latest: > > http://www.gotapi.com/erlang > > That is a really cool tool. Annoying that they call modules > "class", but anyway impressive... > > This site sets a standard that erldoc should strive to > reach, but with the latest documentation! > > > > > > > On Wed, Dec 2, 2009 at 8:20 PM, Raimo Niskanen > > wrote: > > > On Wed, Dec 02, 2009 at 03:08:05AM -0800, Jayson Vantuyl wrote: > > >> When I searched for a fully qualified function (i.e. ets:new), it seemed to have an issue URL-decoding the colon, and the search generally didn't like it even when manually adjusted on the next page. Nice start, though. > > > > > > Currently it searches for names anywhere (functions, modules and applications), > > > so you can search for `ets', follow to the ets man page and then > > > scroll down to the `new' function. > > > > > > Or you can search for `new'. > > > > > > You can also search for `ets new', which oddly enough > > > does not give ets:new higher ranking than any other > > > Whatever:new function... > > > > > > It sounds like a very nice idea that either `ets:new' or > > > `ets new' would give higher ranking for a hit on both > > > module and function (and application). I will forward > > > the idea to the developers (hope they read this too). > > > > > >> > > >> On Dec 2, 2009, at 2:55 AM, Raimo Niskanen wrote: > > >> > > >> > On Fri, Nov 27, 2009 at 03:15:03PM +0100, Kenneth Lundin wrote: > > >> >> Hi Vlad, > > >> >> > > >> >> A search facility will come , we will create an index > > >> >> for this purpose as part of the docbuilding process. > > >> >> > > >> >> No need to patch the docbuilder application. > > >> >> > > >> >> /Kenneth Erlang/OTP Ericsson > > >> > > > >> > There is a preliminary version of the search facility > > >> > now running on the (perliminary) demo site: > > >> > Go to http://demo.erlang.org/doc.html and type e.g "keyse" > > >> > in the text field in the grey right column, then click the > > >> > looking glass button... Comments are welcome. > > >> > > > >> > The same search application should eventually be > > >> > possible to run via the OTP webtool application on > > >> > your local Erlang/OTP installation as a HTTP > > >> > server on your local host. > > >> > > > >> > / Raimo > > >> > > > >> > > > >> >> > > >> >> On Fri, Nov 27, 2009 at 2:23 PM, Vlad Dumitrescu wrote: > > >> >>> Hi! > > >> >>> > > >> >>> I really like the looks of the new documentation. > > >> >>> > > >> >>> There is a small thing that was suggested before and that would help a > > >> >>> lot: a search field (hopefully with autocompletion, too). Typing > > >> >>> "li:keys" to go to lists:keysearch would be soooo sweet!... > > >> >>> > > >> >>> I realize now that generating this is probably the job of the > > >> >>> docbuilder application, which would mean that I can probably submit a > > >> >>> patch myself (if I get to it). Will check that (but if someone else > > >> >>> has faster fingers, I won't hold a grudge :-). > > >> >>> > > >> >>> BTW, a related question: I see that the issue tracker at github is > > >> >>> being used. What is the current policy for reporting bugs? It would be > > >> >>> nice if there was only a single place instead of three (some people > > >> >>> like me do post bug reports here instead of erlang-bugs anyway), for > > >> >>> example if the github tracker could send email notifications to > > >> >>> erlang-bugs. > > >> >>> > > >> >>> best regards, > > >> >>> Vlad > > >> >>> > > >> >>> ________________________________________________________________ > > >> >>> erlang-questions mailing list. See http://www.erlang.org/faq.html > > >> >>> erlang-questions (at) erlang.org > > >> >>> > > >> >>> > > >> >> > > >> >> ________________________________________________________________ > > >> >> erlang-questions mailing list. See http://www.erlang.org/faq.html > > >> >> erlang-questions (at) erlang.org > > >> > > > >> > -- > > >> > > > >> > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > >> > > > >> > ________________________________________________________________ > > >> > erlang-questions mailing list. See http://www.erlang.org/faq.html > > >> > erlang-questions (at) erlang.org > > >> > > > >> > > >> > > >> > > >> -- > > >> Jayson Vantuyl > > >> kagato@REDACTED > > >> > > >> > > >> > > >> > > >> > > > > > > -- > > > > > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > > > > ________________________________________________________________ > > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > > erlang-questions (at) erlang.org > > > > > > > > > > ________________________________________________________________ > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > erlang-questions (at) erlang.org > > > From rapsey@REDACTED Thu Dec 3 11:22:47 2009 From: rapsey@REDACTED (Rapsey) Date: Thu, 3 Dec 2009 11:22:47 +0100 Subject: [erlang-questions] string in << >> In-Reply-To: <4B178F09.80000@nit.pl> References: <4B178F09.80000@nit.pl> Message-ID: <97619b170912030222p31c16066we88ce9c21e2d1595@mail.gmail.com> list_to_binary(X) Sergej 2009/12/3 Jakub Zawierucha > Hello, > > How can I put string into binary form ? Below you can find description on > my problem. > > 49> f(). > ok > 50> X = "dupa". > "dupa" > 51> <<"dupa", 3:2>>. > <<100,117,112,97,3:2>> > 52> <>. > ** exception error: bad argument > > Thanks, > Jakub Zawierucha > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From zabrane3@REDACTED Thu Dec 3 11:27:04 2009 From: zabrane3@REDACTED (zabrane Mikael) Date: Thu, 3 Dec 2009 11:27:04 +0100 Subject: [erlang-questions] gen_server:call/3 and timeout handling In-Reply-To: <6a3ae47e0912030215uc4219ejd6ad7f1147bafe74@mail.gmail.com> References: <18a1db030912021448i72e693d0p46f7759966e17722@mail.gmail.com> <6a3ae47e0912030215uc4219ejd6ad7f1147bafe74@mail.gmail.com> Message-ID: <18a1db030912030227w2cba472euacc2a8f69a647388@mail.gmail.com> Hi Robert ! Applied your try-catch in my code. It works perfectly. Thanks again. Regards Zabrane 2009/12/3 Robert Raschke > On Wed, Dec 2, 2009 at 10:48 PM, zabrane Mikael wrote: > >> When I use the call "gen_server:call/3 (I mean using the timeout option), >> a timout may occur if the corresponding "gen_server:handle_call/3" takes >> take too long. >> Then, the whole "gen_server" crashes with an error report. >> >> >> What I'd like to achieve is to "intercept" this "timeout" message in my >> "gen_server" code and handle >> it gracefully without stopping my "gen_server" (eg. by sending back a >> reply >> with reason = timeout). >> >> Is this possible? Is there a best practice for that? >> >> > I think you would need to wrap the call in a try-catch, as the function > call itself is failing due to the timeout. > > For example, using this dummy server: > > -module(timeout_test). > -behaviour(gen_server). > > -export([start_link/0, test/0]). > -export([init/1, handle_call/3, handle_cast/2, handle_info/2, > code_change/3, terminate/2]). > > start_link() -> gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). > test() -> gen_server:call(?MODULE, test, 1000). > > init([]) -> {ok, []}. > > handle_call(test, _From, State) -> {reply, timer:sleep(1500), State}. > > handle_cast(_Request, State) -> {noreply, State}. > handle_info(_, State) -> {noreply, State}. > code_change(_Old, State, _Extra) -> {ok, State}. > terminate(_Reason, _State) -> ok. > > > And in the shell: > > Eshell V5.6.5 (abort with ^G) > 1> c(timeout_test). > {ok,timeout_test} > 2> timeout_test:start_link(). > {ok,<0.27047.4>} > 3> try timeout_test:test() catch Error:Reason -> {Error, Reason} end. > {exit,{timeout,{gen_server,call,[timeout_test,test,1000]}}} > 4> > > You can obviously also put the try-catch into the function that does the > gen_server:call and return interesting values depending on the catch. > > Hope this gets you in the right direction, > Robby > > From bengt.kleberg@REDACTED Thu Dec 3 11:37:17 2009 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 03 Dec 2009 11:37:17 +0100 Subject: [erlang-questions] Best practice for defining functions with edoc,erlc,eunit and the dialyzer In-Reply-To: <50763.194.88.55.211.1259834150.squirrel@localhost> References: <9b08084c0912020128w6d5e685dq2dd259e82806d2aa@mail.gmail.com> <4B1641F8.2040708@tmit.bme.hu> <5AA5B557-9354-4B89-BBA7-A6DE3775A52A@cs.otago.ac.nz> <50763.194.88.55.211.1259834150.squirrel@localhost> Message-ID: <1259836637.6799.13.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Greetings, If the Erlang/OTP source that has "internal exports" is old, it could pre-date the existence of erlang:spawn/1. In that case it would not be a good example. Regarding exports I always have them in a single, sorted, list since it makes it easier for humans to find out which functions that are exported. bengt On Thu, 2009-12-03 at 10:55 +0100, Zoltan Lajos Kis wrote: > > > > On Dec 2, 2009, at 11:31 PM, Zoltan Lajos Kis wrote: > >>> > >> One more thing that can be addressed is the order of exporting (and > >> defining) functions. My preference is to: > >> - 1, export API functions > >> - 2, export Behavior callback functions (a separate export line for > >> each behavior) > >> - 3, export internal functions. The functions that you _don't want > >> to export_, but Erlang makes you to do so in order to use them in > >> spawns, applys, etc. > >> > > > > Could I make a plea for > > - a SINGLE export list for all "API" (horrible term) functions > > - in alphabetic order > > Sorry. Borrowed the term from the Erlang/OTP source code :) > > > > >> Something like: > >> > >> %% API > >> -export([start_link/0, update/0, get/1, put/2, ...]). > > > > Something like > > > > -export([ > > get/1, > > put/2, > > start_link/0, > > update/0 > > ]). > > > > It's just that much easier to see what the module is all about. > > Someone using emacs can easily keep such a list in order using > > sort-lines. > > I prefer to group the "API" functions based on their functionality and > order them by the order they will most probably be used. > In my config server example start_link / update will be used by the > supervisor/management hierarchy, while get and put will be used by whoever > needs something. > > > > >> > >> > >> %% Behavior callbacks > >> -behaviour(gen_server). > >> -export([init/1, handle_call/3, handle_cast/2, ...]). > > > > Years ago I recommended that the syntax should be extended > > to > > -behaviour(Behaviour, [Callback...]). > > so that a cross-checking tool could tell that these functions > > were *intended* to be used as callbacks by that behaviour and > > weren't just accidentally adjacent. > > A simple -behavior(Behavior). could be interpreted by the compiler as > exporting all of the behavior's callback functions. That would trigger a > compiler error if you forgot to implement one. > > > > >> > >> > >> %% Internal functions > >> -export([spawnee/0, applyee/2, ...]). > > > > Now that we have spawn(fun () -> ... end) and F(...), > > we shouldn't need this group at all. > > > > In general you can argue that all of these internal functions can be > handled as callbacks, and thus put into behaviors, and exported as such. > Nevertheless grep for "internal exports" in the Erlang/OTP source. There > is quite a lot of them. > > Regards, > Zoltan. > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From raimo+erlang-questions@REDACTED Thu Dec 3 14:07:36 2009 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 3 Dec 2009 14:07:36 +0100 Subject: [erlang-questions] online documentation In-Reply-To: <1259835683.21785.4.camel@rumbuntu> References: <95be1d3b0911270523m7e78892dg5e80aeaf875e3829@mail.gmail.com> <20091202105536.GA21292@erix.ericsson.se> <23E6EAD4-8ADA-484B-833E-197D0935169E@souja.net> <20091202112053.GA21860@erix.ericsson.se> <5c493e530912021853p6f0b2481k5e7a274c62c11ecc@mail.gmail.com> <20091203094559.GA4467@erix.ericsson.se> <1259835683.21785.4.camel@rumbuntu> Message-ID: <20091203130736.GA9888@erix.ericsson.se> On Thu, Dec 03, 2009 at 01:21:23PM +0300, Dmitry Belyaev wrote: > I prefer > http://erlapi.prepor.ru/docs/ Yet another nice one. This seems to be a problem that many want solutions for. It is also fast, but I can not readily find a quick way to search for a function name when I do not know the module. If I type "new" ets:new comes at least one page down and there is no possibility to filter for function names only. Another nice thing on this site is that you get Application Module:Function Short description already in the search results. > > It scrolls to selected function and has pretty style. > > On Thu, 2009-12-03 at 10:45 +0100, Raimo Niskanen wrote: > > On Thu, Dec 03, 2009 at 11:53:18AM +0900, Ngoc Dao wrote: > > > This is an impressive improvement. > > > > > > Currently I am using gotapi, and its API is not the latest: > > > http://www.gotapi.com/erlang > > > > That is a really cool tool. Annoying that they call modules > > "class", but anyway impressive... > > > > This site sets a standard that erldoc should strive to > > reach, but with the latest documentation! > > > > > > > > > > > On Wed, Dec 2, 2009 at 8:20 PM, Raimo Niskanen > > > wrote: > > > > On Wed, Dec 02, 2009 at 03:08:05AM -0800, Jayson Vantuyl wrote: > > > >> When I searched for a fully qualified function (i.e. ets:new), it seemed to have an issue URL-decoding the colon, and the search generally didn't like it even when manually adjusted on the next page. Nice start, though. > > > > > > > > Currently it searches for names anywhere (functions, modules and applications), > > > > so you can search for `ets', follow to the ets man page and then > > > > scroll down to the `new' function. > > > > > > > > Or you can search for `new'. > > > > > > > > You can also search for `ets new', which oddly enough > > > > does not give ets:new higher ranking than any other > > > > Whatever:new function... > > > > > > > > It sounds like a very nice idea that either `ets:new' or > > > > `ets new' would give higher ranking for a hit on both > > > > module and function (and application). I will forward > > > > the idea to the developers (hope they read this too). > > > > > > > >> > > > >> On Dec 2, 2009, at 2:55 AM, Raimo Niskanen wrote: > > > >> > > > >> > On Fri, Nov 27, 2009 at 03:15:03PM +0100, Kenneth Lundin wrote: > > > >> >> Hi Vlad, > > > >> >> > > > >> >> A search facility will come , we will create an index > > > >> >> for this purpose as part of the docbuilding process. > > > >> >> > > > >> >> No need to patch the docbuilder application. > > > >> >> > > > >> >> /Kenneth Erlang/OTP Ericsson > > > >> > > > > >> > There is a preliminary version of the search facility > > > >> > now running on the (perliminary) demo site: > > > >> > Go to http://demo.erlang.org/doc.html and type e.g "keyse" > > > >> > in the text field in the grey right column, then click the > > > >> > looking glass button... Comments are welcome. > > > >> > > > > >> > The same search application should eventually be > > > >> > possible to run via the OTP webtool application on > > > >> > your local Erlang/OTP installation as a HTTP > > > >> > server on your local host. > > > >> > > > > >> > / Raimo > > > >> > > > > >> > > > > >> >> > > > >> >> On Fri, Nov 27, 2009 at 2:23 PM, Vlad Dumitrescu wrote: > > > >> >>> Hi! > > > >> >>> > > > >> >>> I really like the looks of the new documentation. > > > >> >>> > > > >> >>> There is a small thing that was suggested before and that would help a > > > >> >>> lot: a search field (hopefully with autocompletion, too). Typing > > > >> >>> "li:keys" to go to lists:keysearch would be soooo sweet!... > > > >> >>> > > > >> >>> I realize now that generating this is probably the job of the > > > >> >>> docbuilder application, which would mean that I can probably submit a > > > >> >>> patch myself (if I get to it). Will check that (but if someone else > > > >> >>> has faster fingers, I won't hold a grudge :-). > > > >> >>> > > > >> >>> BTW, a related question: I see that the issue tracker at github is > > > >> >>> being used. What is the current policy for reporting bugs? It would be > > > >> >>> nice if there was only a single place instead of three (some people > > > >> >>> like me do post bug reports here instead of erlang-bugs anyway), for > > > >> >>> example if the github tracker could send email notifications to > > > >> >>> erlang-bugs. > > > >> >>> > > > >> >>> best regards, > > > >> >>> Vlad > > > >> >>> > > > >> >>> ________________________________________________________________ > > > >> >>> erlang-questions mailing list. See http://www.erlang.org/faq.html > > > >> >>> erlang-questions (at) erlang.org > > > >> >>> > > > >> >>> > > > >> >> > > > >> >> ________________________________________________________________ > > > >> >> erlang-questions mailing list. See http://www.erlang.org/faq.html > > > >> >> erlang-questions (at) erlang.org > > > >> > > > > >> > -- > > > >> > > > > >> > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > >> > > > > >> > ________________________________________________________________ > > > >> > erlang-questions mailing list. See http://www.erlang.org/faq.html > > > >> > erlang-questions (at) erlang.org > > > >> > > > > >> > > > >> > > > >> > > > >> -- > > > >> Jayson Vantuyl > > > >> kagato@REDACTED > > > >> > > > >> > > > >> > > > >> > > > >> > > > > > > > > -- > > > > > > > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > > > > > > ________________________________________________________________ > > > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > > > erlang-questions (at) erlang.org > > > > > > > > > > > > > > ________________________________________________________________ > > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > > erlang-questions (at) erlang.org > > > > > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From dale@REDACTED Thu Dec 3 14:22:19 2009 From: dale@REDACTED (Dale Harvey) Date: Thu, 3 Dec 2009 13:22:19 +0000 Subject: [erlang-questions] online documentation In-Reply-To: <20091203130736.GA9888@erix.ericsson.se> References: <95be1d3b0911270523m7e78892dg5e80aeaf875e3829@mail.gmail.com> <20091202105536.GA21292@erix.ericsson.se> <23E6EAD4-8ADA-484B-833E-197D0935169E@souja.net> <20091202112053.GA21860@erix.ericsson.se> <5c493e530912021853p6f0b2481k5e7a274c62c11ecc@mail.gmail.com> <20091203094559.GA4467@erix.ericsson.se> <1259835683.21785.4.camel@rumbuntu> <20091203130736.GA9888@erix.ericsson.se> Message-ID: 2009/12/3 Raimo Niskanen > > On Thu, Dec 03, 2009 at 01:21:23PM +0300, Dmitry Belyaev wrote: > > I prefer > > http://erlapi.prepor.ru/docs/ > > Yet another nice one. This seems to be a problem > that many want solutions for. > Quite so, theres also mine :) http://erldocs.com/R13B03/ > > It is also fast, but I can not readily find a quick > way to search for a function name when I do not > know the module. If I type "new" ets:new comes at least > one page down and there is no possibility to filter > for function names only. > > Another nice thing on this site is that you get > Application > Module:Function > Short description > already in the search results. > > > > > It scrolls to selected function and has pretty style. > > > > On Thu, 2009-12-03 at 10:45 +0100, Raimo Niskanen wrote: > > > On Thu, Dec 03, 2009 at 11:53:18AM +0900, Ngoc Dao wrote: > > > > This is an impressive improvement. > > > > > > > > Currently I am using gotapi, and its API is not the latest: > > > > http://www.gotapi.com/erlang > > > > > > That is a really cool tool. Annoying that they call modules > > > "class", but anyway impressive... > > > > > > This site sets a standard that erldoc should strive to > > > reach, but with the latest documentation! > > > > > > > > > > > > > > > On Wed, Dec 2, 2009 at 8:20 PM, Raimo Niskanen > > > > > > wrote: > > > > > On Wed, Dec 02, 2009 at 03:08:05AM -0800, Jayson Vantuyl wrote: > > > > >> When I searched for a fully qualified function (i.e. ets:new), it > seemed to have an issue URL-decoding the colon, and the search generally > didn't like it even when manually adjusted on the next page. Nice start, > though. > > > > > > > > > > Currently it searches for names anywhere (functions, modules and > applications), > > > > > so you can search for `ets', follow to the ets man page and then > > > > > scroll down to the `new' function. > > > > > > > > > > Or you can search for `new'. > > > > > > > > > > You can also search for `ets new', which oddly enough > > > > > does not give ets:new higher ranking than any other > > > > > Whatever:new function... > > > > > > > > > > It sounds like a very nice idea that either `ets:new' or > > > > > `ets new' would give higher ranking for a hit on both > > > > > module and function (and application). I will forward > > > > > the idea to the developers (hope they read this too). > > > > > > > > > >> > > > > >> On Dec 2, 2009, at 2:55 AM, Raimo Niskanen wrote: > > > > >> > > > > >> > On Fri, Nov 27, 2009 at 03:15:03PM +0100, Kenneth Lundin wrote: > > > > >> >> Hi Vlad, > > > > >> >> > > > > >> >> A search facility will come , we will create an index > > > > >> >> for this purpose as part of the docbuilding process. > > > > >> >> > > > > >> >> No need to patch the docbuilder application. > > > > >> >> > > > > >> >> /Kenneth Erlang/OTP Ericsson > > > > >> > > > > > >> > There is a preliminary version of the search facility > > > > >> > now running on the (perliminary) demo site: > > > > >> > Go to http://demo.erlang.org/doc.html and type e.g "keyse" > > > > >> > in the text field in the grey right column, then click the > > > > >> > looking glass button... Comments are welcome. > > > > >> > > > > > >> > The same search application should eventually be > > > > >> > possible to run via the OTP webtool application on > > > > >> > your local Erlang/OTP installation as a HTTP > > > > >> > server on your local host. > > > > >> > > > > > >> > / Raimo > > > > >> > > > > > >> > > > > > >> >> > > > > >> >> On Fri, Nov 27, 2009 at 2:23 PM, Vlad Dumitrescu < > vladdu55@REDACTED> wrote: > > > > >> >>> Hi! > > > > >> >>> > > > > >> >>> I really like the looks of the new documentation. > > > > >> >>> > > > > >> >>> There is a small thing that was suggested before and that > would help a > > > > >> >>> lot: a search field (hopefully with autocompletion, too). > Typing > > > > >> >>> "li:keys" to go to lists:keysearch would be soooo > sweet!... > > > > >> >>> > > > > >> >>> I realize now that generating this is probably the job of the > > > > >> >>> docbuilder application, which would mean that I can probably > submit a > > > > >> >>> patch myself (if I get to it). Will check that (but if someone > else > > > > >> >>> has faster fingers, I won't hold a grudge :-). > > > > >> >>> > > > > >> >>> BTW, a related question: I see that the issue tracker at > github is > > > > >> >>> being used. What is the current policy for reporting bugs? It > would be > > > > >> >>> nice if there was only a single place instead of three (some > people > > > > >> >>> like me do post bug reports here instead of erlang-bugs > anyway), for > > > > >> >>> example if the github tracker could send email notifications > to > > > > >> >>> erlang-bugs. > > > > >> >>> > > > > >> >>> best regards, > > > > >> >>> Vlad > > > > >> >>> > > > > >> >>> > ________________________________________________________________ > > > > >> >>> erlang-questions mailing list. See > http://www.erlang.org/faq.html > > > > >> >>> erlang-questions (at) erlang.org > > > > >> >>> > > > > >> >>> > > > > >> >> > > > > >> >> > ________________________________________________________________ > > > > >> >> erlang-questions mailing list. See > http://www.erlang.org/faq.html > > > > >> >> erlang-questions (at) erlang.org > > > > >> > > > > > >> > -- > > > > >> > > > > > >> > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > > >> > > > > > >> > ________________________________________________________________ > > > > >> > erlang-questions mailing list. See > http://www.erlang.org/faq.html > > > > >> > erlang-questions (at) erlang.org > > > > >> > > > > > >> > > > > >> > > > > >> > > > > >> -- > > > > >> Jayson Vantuyl > > > > >> kagato@REDACTED > > > > >> > > > > >> > > > > >> > > > > >> > > > > >> > > > > > > > > > > -- > > > > > > > > > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > > > > > > > > ________________________________________________________________ > > > > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > > > > erlang-questions (at) erlang.org > > > > > > > > > > > > > > > > > > ________________________________________________________________ > > > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > > > erlang-questions (at) erlang.org > > > > > > > > > > > > > > > ________________________________________________________________ > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > erlang-questions (at) erlang.org > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From xcentricity@REDACTED Thu Dec 3 15:22:20 2009 From: xcentricity@REDACTED (XCentric) Date: Thu, 3 Dec 2009 19:52:20 +0530 Subject: erl_syntax: Module import statement Message-ID: Hi! Could anyone please give me an example of how to use erl_syntax:attribute/2 to generate AST for a module import statement? For example, how to represent "-import(io)." using erl_syntax:attribute/2? Many thanks for your help. Regards, Ali Ranalvi From rvirding@REDACTED Thu Dec 3 15:47:02 2009 From: rvirding@REDACTED (Robert Virding) Date: Thu, 3 Dec 2009 15:47:02 +0100 Subject: [erlang-questions] Getting the position of a list item In-Reply-To: References: <401d3ba30912021029g2d521aceoe086fda6c9e1746b@mail.gmail.com> <5c493e530912021723j35f05189ie0b5bb3f68a65d27@mail.gmail.com> Message-ID: <3dbc6d1c0912030647g65910ddbj88a5a58e77555146@mail.gmail.com> 2009/12/3 Garrett Smith > On Wed, Dec 2, 2009 at 7:23 PM, Ngoc Dao wrote: > >> string:str(List, [Element]). > > > > What a surprise! Thank you. > > A good example of "most astonishment" :) > Unfortunately they have added som type checking in string otherwise you could do string:chr(List,Element). :-( Robert From the.ajarn@REDACTED Thu Dec 3 15:51:48 2009 From: the.ajarn@REDACTED (Brentley Jones) Date: Thu, 3 Dec 2009 08:51:48 -0600 Subject: [erlang-questions] online documentation In-Reply-To: References: <95be1d3b0911270523m7e78892dg5e80aeaf875e3829@mail.gmail.com> <20091202105536.GA21292@erix.ericsson.se> <23E6EAD4-8ADA-484B-833E-197D0935169E@souja.net> <20091202112053.GA21860@erix.ericsson.se> <5c493e530912021853p6f0b2481k5e7a274c62c11ecc@mail.gmail.com> <20091203094559.GA4467@erix.ericsson.se> <1259835683.21785.4.camel@rumbuntu> <20091203130736.GA9888@erix.ericsson.se> Message-ID: On Dec 3, 2009, at 7:22 AM, Dale Harvey wrote: > 2009/12/3 Raimo Niskanen > >> > >> On Thu, Dec 03, 2009 at 01:21:23PM +0300, Dmitry Belyaev wrote: >>> I prefer >>> http://erlapi.prepor.ru/docs/ >> >> Yet another nice one. This seems to be a problem >> that many want solutions for. >> > > Quite so, theres also mine :) > > http://erldocs.com/R13B03/ Wow, I'm bookmarking that one. From rapsey@REDACTED Thu Dec 3 15:52:06 2009 From: rapsey@REDACTED (Rapsey) Date: Thu, 3 Dec 2009 15:52:06 +0100 Subject: [erlang-questions] online documentation In-Reply-To: References: <95be1d3b0911270523m7e78892dg5e80aeaf875e3829@mail.gmail.com> <20091202105536.GA21292@erix.ericsson.se> <23E6EAD4-8ADA-484B-833E-197D0935169E@souja.net> <20091202112053.GA21860@erix.ericsson.se> <5c493e530912021853p6f0b2481k5e7a274c62c11ecc@mail.gmail.com> <20091203094559.GA4467@erix.ericsson.se> <1259835683.21785.4.camel@rumbuntu> <20091203130736.GA9888@erix.ericsson.se> Message-ID: <97619b170912030652p6a51282fl93adb69a3fd74362@mail.gmail.com> Both http://erlapi.prepor.ru/docs/ and http://erldocs.com/R13B03/ seem to be incomplete. Searching for erl_nif for instance has no results. Neither do they find any of the driver_* functions in erts. Sergej On Thu, Dec 3, 2009 at 2:22 PM, Dale Harvey wrote: > 2009/12/3 Raimo Niskanen > > > > > > > > > On Thu, Dec 03, 2009 at 01:21:23PM +0300, Dmitry Belyaev wrote: > > > I prefer > > > http://erlapi.prepor.ru/docs/ > > > > Yet another nice one. This seems to be a problem > > that many want solutions for. > > > > Quite so, theres also mine :) > > http://erldocs.com/R13B03/ > > > > > > It is also fast, but I can not readily find a quick > > way to search for a function name when I do not > > know the module. If I type "new" ets:new comes at least > > one page down and there is no possibility to filter > > for function names only. > > > > Another nice thing on this site is that you get > > Application > > Module:Function > > Short description > > already in the search results. > > > > > > > > It scrolls to selected function and has pretty style. > > > > > > On Thu, 2009-12-03 at 10:45 +0100, Raimo Niskanen wrote: > > > > On Thu, Dec 03, 2009 at 11:53:18AM +0900, Ngoc Dao wrote: > > > > > This is an impressive improvement. > > > > > > > > > > Currently I am using gotapi, and its API is not the latest: > > > > > http://www.gotapi.com/erlang > > > > > > > > That is a really cool tool. Annoying that they call modules > > > > "class", but anyway impressive... > > > > > > > > This site sets a standard that erldoc should strive to > > > > reach, but with the latest documentation! > > > > > > > > > > > > > > > > > > > On Wed, Dec 2, 2009 at 8:20 PM, Raimo Niskanen > > > > > > > >> > > wrote: > > > > > > On Wed, Dec 02, 2009 at 03:08:05AM -0800, Jayson Vantuyl wrote: > > > > > >> When I searched for a fully qualified function (i.e. ets:new), > it > > seemed to have an issue URL-decoding the colon, and the search generally > > didn't like it even when manually adjusted on the next page. Nice start, > > though. > > > > > > > > > > > > Currently it searches for names anywhere (functions, modules and > > applications), > > > > > > so you can search for `ets', follow to the ets man page and then > > > > > > scroll down to the `new' function. > > > > > > > > > > > > Or you can search for `new'. > > > > > > > > > > > > You can also search for `ets new', which oddly enough > > > > > > does not give ets:new higher ranking than any other > > > > > > Whatever:new function... > > > > > > > > > > > > It sounds like a very nice idea that either `ets:new' or > > > > > > `ets new' would give higher ranking for a hit on both > > > > > > module and function (and application). I will forward > > > > > > the idea to the developers (hope they read this too). > > > > > > > > > > > >> > > > > > >> On Dec 2, 2009, at 2:55 AM, Raimo Niskanen wrote: > > > > > >> > > > > > >> > On Fri, Nov 27, 2009 at 03:15:03PM +0100, Kenneth Lundin > wrote: > > > > > >> >> Hi Vlad, > > > > > >> >> > > > > > >> >> A search facility will come , we will create an index > > > > > >> >> for this purpose as part of the docbuilding process. > > > > > >> >> > > > > > >> >> No need to patch the docbuilder application. > > > > > >> >> > > > > > >> >> /Kenneth Erlang/OTP Ericsson > > > > > >> > > > > > > >> > There is a preliminary version of the search facility > > > > > >> > now running on the (perliminary) demo site: > > > > > >> > Go to http://demo.erlang.org/doc.html and type e.g "keyse" > > > > > >> > in the text field in the grey right column, then click the > > > > > >> > looking glass button... Comments are welcome. > > > > > >> > > > > > > >> > The same search application should eventually be > > > > > >> > possible to run via the OTP webtool application on > > > > > >> > your local Erlang/OTP installation as a HTTP > > > > > >> > server on your local host. > > > > > >> > > > > > > >> > / Raimo > > > > > >> > > > > > > >> > > > > > > >> >> > > > > > >> >> On Fri, Nov 27, 2009 at 2:23 PM, Vlad Dumitrescu < > > vladdu55@REDACTED> wrote: > > > > > >> >>> Hi! > > > > > >> >>> > > > > > >> >>> I really like the looks of the new documentation. > > > > > >> >>> > > > > > >> >>> There is a small thing that was suggested before and that > > would help a > > > > > >> >>> lot: a search field (hopefully with autocompletion, too). > > Typing > > > > > >> >>> "li:keys" to go to lists:keysearch would be soooo > > sweet!... > > > > > >> >>> > > > > > >> >>> I realize now that generating this is probably the job of > the > > > > > >> >>> docbuilder application, which would mean that I can probably > > submit a > > > > > >> >>> patch myself (if I get to it). Will check that (but if > someone > > else > > > > > >> >>> has faster fingers, I won't hold a grudge :-). > > > > > >> >>> > > > > > >> >>> BTW, a related question: I see that the issue tracker at > > github is > > > > > >> >>> being used. What is the current policy for reporting bugs? > It > > would be > > > > > >> >>> nice if there was only a single place instead of three (some > > people > > > > > >> >>> like me do post bug reports here instead of erlang-bugs > > anyway), for > > > > > >> >>> example if the github tracker could send email notifications > > to > > > > > >> >>> erlang-bugs. > > > > > >> >>> > > > > > >> >>> best regards, > > > > > >> >>> Vlad > > > > > >> >>> > > > > > >> >>> > > ________________________________________________________________ > > > > > >> >>> erlang-questions mailing list. See > > http://www.erlang.org/faq.html > > > > > >> >>> erlang-questions (at) erlang.org > > > > > >> >>> > > > > > >> >>> > > > > > >> >> > > > > > >> >> > > ________________________________________________________________ > > > > > >> >> erlang-questions mailing list. See > > http://www.erlang.org/faq.html > > > > > >> >> erlang-questions (at) erlang.org > > > > > >> > > > > > > >> > -- > > > > > >> > > > > > > >> > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > > > >> > > > > > > >> > > ________________________________________________________________ > > > > > >> > erlang-questions mailing list. See > > http://www.erlang.org/faq.html > > > > > >> > erlang-questions (at) erlang.org > > > > > >> > > > > > > >> > > > > > >> > > > > > >> > > > > > >> -- > > > > > >> Jayson Vantuyl > > > > > >> kagato@REDACTED > > > > > >> > > > > > >> > > > > > >> > > > > > >> > > > > > >> > > > > > > > > > > > > -- > > > > > > > > > > > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > > > > > > > > > > ________________________________________________________________ > > > > > > erlang-questions mailing list. See > http://www.erlang.org/faq.html > > > > > > erlang-questions (at) erlang.org > > > > > > > > > > > > > > > > > > > > > > ________________________________________________________________ > > > > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > > > > erlang-questions (at) erlang.org > > > > > > > > > > > > > > > > > > > > > ________________________________________________________________ > > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > > erlang-questions (at) erlang.org > > > > -- > > > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > > ________________________________________________________________ > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > erlang-questions (at) erlang.org > > > > > From dale@REDACTED Thu Dec 3 16:03:18 2009 From: dale@REDACTED (Dale Harvey) Date: Thu, 3 Dec 2009 15:03:18 +0000 Subject: [erlang-questions] online documentation In-Reply-To: <97619b170912030652p6a51282fl93adb69a3fd74362@mail.gmail.com> References: <95be1d3b0911270523m7e78892dg5e80aeaf875e3829@mail.gmail.com> <20091202105536.GA21292@erix.ericsson.se> <23E6EAD4-8ADA-484B-833E-197D0935169E@souja.net> <20091202112053.GA21860@erix.ericsson.se> <5c493e530912021853p6f0b2481k5e7a274c62c11ecc@mail.gmail.com> <20091203094559.GA4467@erix.ericsson.se> <1259835683.21785.4.camel@rumbuntu> <20091203130736.GA9888@erix.ericsson.se> <97619b170912030652p6a51282fl93adb69a3fd74362@mail.gmail.com> Message-ID: There is a few files modules (egd / nif) that generate the documentation source from the .erl source files and edoc, those are the ones missing (erlapi and erldocs were both built before the ability to build the docs in otp was released) the 99% are built from the xml files in app/doc/src, Ive added it as an issue on erldocs to fix. There are other things missing, primarily application chapters / user guides, these require a lot more fudging to get into a format thats usable considering the different layouts. 2009/12/3 Rapsey > Both http://erlapi.prepor.ru/docs/ and http://erldocs.com/R13B03/ > seem to be incomplete. Searching for erl_nif for instance has no results. > Neither do they find any of the driver_* functions in erts. > > > Sergej > > > On Thu, Dec 3, 2009 at 2:22 PM, Dale Harvey wrote: > > > 2009/12/3 Raimo Niskanen > > > > > > > > > > > > > > > > > > > > > On Thu, Dec 03, 2009 at 01:21:23PM +0300, Dmitry Belyaev wrote: > > > > I prefer > > > > http://erlapi.prepor.ru/docs/ > > > > > > Yet another nice one. This seems to be a problem > > > that many want solutions for. > > > > > > > Quite so, theres also mine :) > > > > http://erldocs.com/R13B03/ > > > > > > > > > > It is also fast, but I can not readily find a quick > > > way to search for a function name when I do not > > > know the module. If I type "new" ets:new comes at least > > > one page down and there is no possibility to filter > > > for function names only. > > > > > > Another nice thing on this site is that you get > > > Application > > > Module:Function > > > Short description > > > already in the search results. > > > > > > > > > > > It scrolls to selected function and has pretty style. > > > > > > > > On Thu, 2009-12-03 at 10:45 +0100, Raimo Niskanen wrote: > > > > > On Thu, Dec 03, 2009 at 11:53:18AM +0900, Ngoc Dao wrote: > > > > > > This is an impressive improvement. > > > > > > > > > > > > Currently I am using gotapi, and its API is not the latest: > > > > > > http://www.gotapi.com/erlang > > > > > > > > > > That is a really cool tool. Annoying that they call modules > > > > > "class", but anyway impressive... > > > > > > > > > > This site sets a standard that erldoc should strive to > > > > > reach, but with the latest documentation! > > > > > > > > > > > > > > > > > > > > > > > On Wed, Dec 2, 2009 at 8:20 PM, Raimo Niskanen > > > > > > > > > > > > > > > > >> > > > wrote: > > > > > > > On Wed, Dec 02, 2009 at 03:08:05AM -0800, Jayson Vantuyl wrote: > > > > > > >> When I searched for a fully qualified function (i.e. ets:new), > > it > > > seemed to have an issue URL-decoding the colon, and the search > generally > > > didn't like it even when manually adjusted on the next page. Nice > start, > > > though. > > > > > > > > > > > > > > Currently it searches for names anywhere (functions, modules > and > > > applications), > > > > > > > so you can search for `ets', follow to the ets man page and > then > > > > > > > scroll down to the `new' function. > > > > > > > > > > > > > > Or you can search for `new'. > > > > > > > > > > > > > > You can also search for `ets new', which oddly enough > > > > > > > does not give ets:new higher ranking than any other > > > > > > > Whatever:new function... > > > > > > > > > > > > > > It sounds like a very nice idea that either `ets:new' or > > > > > > > `ets new' would give higher ranking for a hit on both > > > > > > > module and function (and application). I will forward > > > > > > > the idea to the developers (hope they read this too). > > > > > > > > > > > > > >> > > > > > > >> On Dec 2, 2009, at 2:55 AM, Raimo Niskanen wrote: > > > > > > >> > > > > > > >> > On Fri, Nov 27, 2009 at 03:15:03PM +0100, Kenneth Lundin > > wrote: > > > > > > >> >> Hi Vlad, > > > > > > >> >> > > > > > > >> >> A search facility will come , we will create an index > > > > > > >> >> for this purpose as part of the docbuilding process. > > > > > > >> >> > > > > > > >> >> No need to patch the docbuilder application. > > > > > > >> >> > > > > > > >> >> /Kenneth Erlang/OTP Ericsson > > > > > > >> > > > > > > > >> > There is a preliminary version of the search facility > > > > > > >> > now running on the (perliminary) demo site: > > > > > > >> > Go to http://demo.erlang.org/doc.html and type e.g "keyse" > > > > > > >> > in the text field in the grey right column, then click the > > > > > > >> > looking glass button... Comments are welcome. > > > > > > >> > > > > > > > >> > The same search application should eventually be > > > > > > >> > possible to run via the OTP webtool application on > > > > > > >> > your local Erlang/OTP installation as a HTTP > > > > > > >> > server on your local host. > > > > > > >> > > > > > > > >> > / Raimo > > > > > > >> > > > > > > > >> > > > > > > > >> >> > > > > > > >> >> On Fri, Nov 27, 2009 at 2:23 PM, Vlad Dumitrescu < > > > vladdu55@REDACTED> wrote: > > > > > > >> >>> Hi! > > > > > > >> >>> > > > > > > >> >>> I really like the looks of the new documentation. > > > > > > >> >>> > > > > > > >> >>> There is a small thing that was suggested before and that > > > would help a > > > > > > >> >>> lot: a search field (hopefully with autocompletion, too). > > > Typing > > > > > > >> >>> "li:keys" to go to lists:keysearch would be soooo > > > sweet!... > > > > > > >> >>> > > > > > > >> >>> I realize now that generating this is probably the job of > > the > > > > > > >> >>> docbuilder application, which would mean that I can > probably > > > submit a > > > > > > >> >>> patch myself (if I get to it). Will check that (but if > > someone > > > else > > > > > > >> >>> has faster fingers, I won't hold a grudge :-). > > > > > > >> >>> > > > > > > >> >>> BTW, a related question: I see that the issue tracker at > > > github is > > > > > > >> >>> being used. What is the current policy for reporting bugs? > > It > > > would be > > > > > > >> >>> nice if there was only a single place instead of three > (some > > > people > > > > > > >> >>> like me do post bug reports here instead of erlang-bugs > > > anyway), for > > > > > > >> >>> example if the github tracker could send email > notifications > > > to > > > > > > >> >>> erlang-bugs. > > > > > > >> >>> > > > > > > >> >>> best regards, > > > > > > >> >>> Vlad > > > > > > >> >>> > > > > > > >> >>> > > > ________________________________________________________________ > > > > > > >> >>> erlang-questions mailing list. See > > > http://www.erlang.org/faq.html > > > > > > >> >>> erlang-questions (at) erlang.org > > > > > > >> >>> > > > > > > >> >>> > > > > > > >> >> > > > > > > >> >> > > > ________________________________________________________________ > > > > > > >> >> erlang-questions mailing list. See > > > http://www.erlang.org/faq.html > > > > > > >> >> erlang-questions (at) erlang.org > > > > > > >> > > > > > > > >> > -- > > > > > > >> > > > > > > > >> > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > > > > >> > > > > > > > >> > > > ________________________________________________________________ > > > > > > >> > erlang-questions mailing list. See > > > http://www.erlang.org/faq.html > > > > > > >> > erlang-questions (at) erlang.org > > > > > > >> > > > > > > > >> > > > > > > >> > > > > > > >> > > > > > > >> -- > > > > > > >> Jayson Vantuyl > > > > > > >> kagato@REDACTED > > > > > > >> > > > > > > >> > > > > > > >> > > > > > > >> > > > > > > >> > > > > > > > > > > > > > > -- > > > > > > > > > > > > > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > > > > > > > > > > > > > ________________________________________________________________ > > > > > > > erlang-questions mailing list. See > > http://www.erlang.org/faq.html > > > > > > > erlang-questions (at) erlang.org > > > > > > > > > > > > > > > > > > > > > > > > > > ________________________________________________________________ > > > > > > erlang-questions mailing list. See > http://www.erlang.org/faq.html > > > > > > erlang-questions (at) erlang.org > > > > > > > > > > > > > > > > > > > > > > > > > > > ________________________________________________________________ > > > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > > > erlang-questions (at) erlang.org > > > > > > -- > > > > > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > > > > ________________________________________________________________ > > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > > erlang-questions (at) erlang.org > > > > > > > > > From jarrod@REDACTED Thu Dec 3 16:33:17 2009 From: jarrod@REDACTED (Jarrod Roberson) Date: Thu, 3 Dec 2009 10:33:17 -0500 Subject: [erlang-questions] Ternary Like Operation Idiom in Erlang In-Reply-To: References: Message-ID: On Thu, Dec 3, 2009 at 4:08 AM, Michael Turner wrote: > >>Thanks to Dale's version I came up with this. >> >>F = fun(T) -> case re:split(T,"=",[{return,list}]) of [K] -> {K,true}; >>[K,V] -> {K,V} end end. > > Cute, but with whitespace trailing after the "=", you get {key, " "}, > which might not be the desired behavior. ?Moreover, an embedded "=" in > the Value part (e.g, key='a=1' or something ridiculous like that) will > cause it to fail, which also might not be desired behavior. ?Getting > close, though. > > The following > > Fm = fun(T) -> > ? case re:split(string:strip(T),"=",[{return,list}]) of > ? ?[K] -> {K, true}; > ? ?[K | V] -> {K, string:join (V, "=")} > ? end > end. > > seems to cover those cases. ?I'm assuming you don't care that there's > no whitespace stripped from the left end of the V string. ?But maybe you > do. "key= " is valid and should parse to {"key"," "}, the spec for what is valid in my case is pretty strict. there should only be one "=" and anything else should FAIL. I will probably have to add some thing to catch those cases but for now I just want to get it to work with valid data. From attila.r.nohl@REDACTED Thu Dec 3 16:47:43 2009 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Thu, 3 Dec 2009 16:47:43 +0100 Subject: [erlang-questions] Re: Getting the position of a list item In-Reply-To: <563519ba-ac11-4f51-a00d-cd046fbaf685@s20g2000yqd.googlegroups.com> References: <6a3ae47e0912020934j27430d00wed628a10bfb48707@mail.gmail.com> <563519ba-ac11-4f51-a00d-cd046fbaf685@s20g2000yqd.googlegroups.com> Message-ID: <401d3ba30912030747s41acff62w6718a4724fdc526f@mail.gmail.com> 2009/12/2, Tim Fletcher : >> Hmm, I fail to come up with a good usage scenario for wanting this. What >> are >> you needing the position of an item in a list for? > > FWIW, here's something i wrote recently: > > base32_decode(Char) -> > list_index(Char, base32_alphabet()). > > base32_alphabet() -> > "0123456789bcdefghjkmnpqrstuvwxyz". I usually see code like this implemented like this: base32_decode2(Char) when Char>=$0, Char=<$9 -> Char-47; base32_decode2(Char) when Char>=$b, Char=<$h -> Char-87; base32_decode2(Char) when Char>=$j, Char=<$k -> Char-88; base32_decode2(Char) when Char>=$m, Char=<$n -> Char-89; base32_decode2(Char) when Char>=$p, Char=<$z -> Char-90. It (ab)uses the fact that we're latin-1 (effectively ASCII) charset. The other kind of code I usually see for this kind of task contains one function clause for each possible inputs. I don't know, but I think both approaches are faster than traversing the list with string:str/2. Probably binaries could be used instead of lists to speed up indexing. From raimo+erlang-questions@REDACTED Thu Dec 3 17:45:49 2009 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 3 Dec 2009 17:45:49 +0100 Subject: [erlang-questions] online documentation In-Reply-To: References: <20091202105536.GA21292@erix.ericsson.se> <23E6EAD4-8ADA-484B-833E-197D0935169E@souja.net> <20091202112053.GA21860@erix.ericsson.se> <5c493e530912021853p6f0b2481k5e7a274c62c11ecc@mail.gmail.com> <20091203094559.GA4467@erix.ericsson.se> <1259835683.21785.4.camel@rumbuntu> <20091203130736.GA9888@erix.ericsson.se> <97619b170912030652p6a51282fl93adb69a3fd74362@mail.gmail.com> Message-ID: <20091203164549.GA17318@erix.ericsson.se> On Thu, Dec 03, 2009 at 03:03:18PM +0000, Dale Harvey wrote: > There is a few files modules (egd / nif) that generate the documentation > source from the .erl source files and edoc, those are the ones missing > > (erlapi and erldocs were both built before the ability to build the docs in > otp was released) > > the 99% are built from the xml files in app/doc/src, Ive added it as an > issue on erldocs to fix. > > There are other things missing, primarily application chapters / user > guides, these require a lot more fudging to get into a format thats usable > considering the different layouts. To simplify for erldoc (and such) we have started to generate index files during the documentation build, and these .eix files are used as input by erldoc on the demo site. Since they are generated during build all problems with include files, .erl sources through edoc, and such, disappear. The .eix files will be in the normal documentation tarball beginning with the next minor release. For the eager to try you can currently find a supplementary tarball on the demo site: http://demo.erlang.org/upload/otp_doc_eix_R13B03.tar.gz The format is not documented at all, it is just a file you can file:parse and get a term list sorting out module, application and documentation html tag, etc. We may change the format. Maybe it could be more general for other documentation search engines than erldoc... For what it is worth. > > > > 2009/12/3 Rapsey > > > Both http://erlapi.prepor.ru/docs/ and http://erldocs.com/R13B03/ > > seem to be incomplete. Searching for erl_nif for instance has no results. > > Neither do they find any of the driver_* functions in erts. > > > > > > Sergej > > > > > > On Thu, Dec 3, 2009 at 2:22 PM, Dale Harvey wrote: > > > > > 2009/12/3 Raimo Niskanen > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Thu, Dec 03, 2009 at 01:21:23PM +0300, Dmitry Belyaev wrote: > > > > > I prefer > > > > > http://erlapi.prepor.ru/docs/ > > > > > > > > Yet another nice one. This seems to be a problem > > > > that many want solutions for. > > > > > > > > > > Quite so, theres also mine :) > > > > > > http://erldocs.com/R13B03/ > > > > > > > > > > > > > > It is also fast, but I can not readily find a quick > > > > way to search for a function name when I do not > > > > know the module. If I type "new" ets:new comes at least > > > > one page down and there is no possibility to filter > > > > for function names only. > > > > > > > > Another nice thing on this site is that you get > > > > Application > > > > Module:Function > > > > Short description > > > > already in the search results. > > > > > > > > > > > > > > It scrolls to selected function and has pretty style. > > > > > > > > > > On Thu, 2009-12-03 at 10:45 +0100, Raimo Niskanen wrote: > > > > > > On Thu, Dec 03, 2009 at 11:53:18AM +0900, Ngoc Dao wrote: > > > > > > > This is an impressive improvement. > > > > > > > > > > > > > > Currently I am using gotapi, and its API is not the latest: > > > > > > > http://www.gotapi.com/erlang > > > > > > > > > > > > That is a really cool tool. Annoying that they call modules > > > > > > "class", but anyway impressive... > > > > > > > > > > > > This site sets a standard that erldoc should strive to > > > > > > reach, but with the latest documentation! > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, Dec 2, 2009 at 8:20 PM, Raimo Niskanen > > > > > > > > > > > > > > > > > > > > > > > >> > > > > wrote: > > > > > > > > On Wed, Dec 02, 2009 at 03:08:05AM -0800, Jayson Vantuyl wrote: > > > > > > > >> When I searched for a fully qualified function (i.e. ets:new), > > > it > > > > seemed to have an issue URL-decoding the colon, and the search > > generally > > > > didn't like it even when manually adjusted on the next page. Nice > > start, > > > > though. > > > > > > > > > > > > > > > > Currently it searches for names anywhere (functions, modules > > and > > > > applications), > > > > > > > > so you can search for `ets', follow to the ets man page and > > then > > > > > > > > scroll down to the `new' function. > > > > > > > > > > > > > > > > Or you can search for `new'. > > > > > > > > > > > > > > > > You can also search for `ets new', which oddly enough > > > > > > > > does not give ets:new higher ranking than any other > > > > > > > > Whatever:new function... > > > > > > > > > > > > > > > > It sounds like a very nice idea that either `ets:new' or > > > > > > > > `ets new' would give higher ranking for a hit on both > > > > > > > > module and function (and application). I will forward > > > > > > > > the idea to the developers (hope they read this too). > > > > > > > > > > > > > > > >> > > > > > > > >> On Dec 2, 2009, at 2:55 AM, Raimo Niskanen wrote: > > > > > > > >> > > > > > > > >> > On Fri, Nov 27, 2009 at 03:15:03PM +0100, Kenneth Lundin > > > wrote: > > > > > > > >> >> Hi Vlad, > > > > > > > >> >> > > > > > > > >> >> A search facility will come , we will create an index > > > > > > > >> >> for this purpose as part of the docbuilding process. > > > > > > > >> >> > > > > > > > >> >> No need to patch the docbuilder application. > > > > > > > >> >> > > > > > > > >> >> /Kenneth Erlang/OTP Ericsson > > > > > > > >> > > > > > > > > >> > There is a preliminary version of the search facility > > > > > > > >> > now running on the (perliminary) demo site: > > > > > > > >> > Go to http://demo.erlang.org/doc.html and type e.g "keyse" > > > > > > > >> > in the text field in the grey right column, then click the > > > > > > > >> > looking glass button... Comments are welcome. > > > > > > > >> > > > > > > > > >> > The same search application should eventually be > > > > > > > >> > possible to run via the OTP webtool application on > > > > > > > >> > your local Erlang/OTP installation as a HTTP > > > > > > > >> > server on your local host. > > > > > > > >> > > > > > > > > >> > / Raimo > > > > > > > >> > > > > > > > > >> > > > > > > > > >> >> > > > > > > > >> >> On Fri, Nov 27, 2009 at 2:23 PM, Vlad Dumitrescu < > > > > vladdu55@REDACTED> wrote: > > > > > > > >> >>> Hi! > > > > > > > >> >>> > > > > > > > >> >>> I really like the looks of the new documentation. > > > > > > > >> >>> > > > > > > > >> >>> There is a small thing that was suggested before and that > > > > would help a > > > > > > > >> >>> lot: a search field (hopefully with autocompletion, too). > > > > Typing > > > > > > > >> >>> "li:keys" to go to lists:keysearch would be soooo > > > > sweet!... > > > > > > > >> >>> > > > > > > > >> >>> I realize now that generating this is probably the job of > > > the > > > > > > > >> >>> docbuilder application, which would mean that I can > > probably > > > > submit a > > > > > > > >> >>> patch myself (if I get to it). Will check that (but if > > > someone > > > > else > > > > > > > >> >>> has faster fingers, I won't hold a grudge :-). > > > > > > > >> >>> > > > > > > > >> >>> BTW, a related question: I see that the issue tracker at > > > > github is > > > > > > > >> >>> being used. What is the current policy for reporting bugs? > > > It > > > > would be > > > > > > > >> >>> nice if there was only a single place instead of three > > (some > > > > people > > > > > > > >> >>> like me do post bug reports here instead of erlang-bugs > > > > anyway), for > > > > > > > >> >>> example if the github tracker could send email > > notifications > > > > to > > > > > > > >> >>> erlang-bugs. > > > > > > > >> >>> > > > > > > > >> >>> best regards, > > > > > > > >> >>> Vlad > > > > > > > >> >>> > > > > > > > >> >>> > > > > ________________________________________________________________ > > > > > > > >> >>> erlang-questions mailing list. See > > > > http://www.erlang.org/faq.html > > > > > > > >> >>> erlang-questions (at) erlang.org > > > > > > > >> >>> > > > > > > > >> >>> > > > > > > > >> >> > > > > > > > >> >> > > > > ________________________________________________________________ > > > > > > > >> >> erlang-questions mailing list. See > > > > http://www.erlang.org/faq.html > > > > > > > >> >> erlang-questions (at) erlang.org > > > > > > > >> > > > > > > > > >> > -- > > > > > > > >> > > > > > > > > >> > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > > > > > >> > > > > > > > > >> > > > > ________________________________________________________________ > > > > > > > >> > erlang-questions mailing list. See > > > > http://www.erlang.org/faq.html > > > > > > > >> > erlang-questions (at) erlang.org > > > > > > > >> > > > > > > > > >> > > > > > > > >> > > > > > > > >> > > > > > > > >> -- > > > > > > > >> Jayson Vantuyl > > > > > > > >> kagato@REDACTED > > > > > > > >> > > > > > > > >> > > > > > > > >> > > > > > > > >> > > > > > > > >> > > > > > > > > > > > > > > > > -- > > > > > > > > > > > > > > > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > > > > > > > > > > > > > > > > ________________________________________________________________ > > > > > > > > erlang-questions mailing list. See > > > http://www.erlang.org/faq.html > > > > > > > > erlang-questions (at) erlang.org > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ________________________________________________________________ > > > > > > > erlang-questions mailing list. See > > http://www.erlang.org/faq.html > > > > > > > erlang-questions (at) erlang.org > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ________________________________________________________________ > > > > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > > > > erlang-questions (at) erlang.org > > > > > > > > -- > > > > > > > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > > > > > > ________________________________________________________________ > > > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > > > erlang-questions (at) erlang.org > > > > > > > > > > > > > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From dale@REDACTED Thu Dec 3 17:55:30 2009 From: dale@REDACTED (Dale Harvey) Date: Thu, 3 Dec 2009 16:55:30 +0000 Subject: [erlang-questions] online documentation In-Reply-To: <20091203164549.GA17318@erix.ericsson.se> References: <20091202105536.GA21292@erix.ericsson.se> <20091202112053.GA21860@erix.ericsson.se> <5c493e530912021853p6f0b2481k5e7a274c62c11ecc@mail.gmail.com> <20091203094559.GA4467@erix.ericsson.se> <1259835683.21785.4.camel@rumbuntu> <20091203130736.GA9888@erix.ericsson.se> <97619b170912030652p6a51282fl93adb69a3fd74362@mail.gmail.com> <20091203164549.GA17318@erix.ericsson.se> Message-ID: 2009/12/3 Raimo Niskanen > > On Thu, Dec 03, 2009 at 03:03:18PM +0000, Dale Harvey wrote: > > There is a few files modules (egd / nif) that generate the documentation > > source from the .erl source files and edoc, those are the ones missing > > > > (erlapi and erldocs were both built before the ability to build the docs > in > > otp was released) > > > > the 99% are built from the xml files in app/doc/src, Ive added it as an > > issue on erldocs to fix. > > > > There are other things missing, primarily application chapters / user > > guides, these require a lot more fudging to get into a format thats > usable > > considering the different layouts. > > I actually lied, nif is documented as a library not a module, but egd wasnt wasnt added to /doc/src/ either way they have both been added http://erldocs.com/R13B03/erts/erl_nif.html?search=nif&i=0 http://erldocs.com/R13B03/percept/egd.html?search=egd&i=0 > To simplify for erldoc (and such) we have started to generate > index files during the documentation build, and these .eix > files are used as input by erldoc on the demo site. Since > they are generated during build all problems with include > files, .erl sources through edoc, and such, disappear. > > The .eix files will be in the normal documentation tarball > beginning with the next minor release. > > For the eager to try you can currently find a supplementary > tarball on the demo site: > http://demo.erlang.org/upload/otp_doc_eix_R13B03.tar.gz > > The format is not documented at all, it is just a file > you can file:parse and get a term list sorting out > module, application and documentation html tag, etc. > We may change the format. Maybe it could be more > general for other documentation search engines than erldoc... > > For what it is worth. > > Thats awesome, thanks. > > > > > > > > 2009/12/3 Rapsey > > > > > Both http://erlapi.prepor.ru/docs/ and http://erldocs.com/R13B03/ > > > seem to be incomplete. Searching for erl_nif for instance has no > results. > > > Neither do they find any of the driver_* functions in erts. > > > > > > > > > Sergej > > > > > > > > > On Thu, Dec 3, 2009 at 2:22 PM, Dale Harvey > wrote: > > > > > > > 2009/12/3 Raimo Niskanen > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Thu, Dec 03, 2009 at 01:21:23PM +0300, Dmitry Belyaev wrote: > > > > > > I prefer > > > > > > http://erlapi.prepor.ru/docs/ > > > > > > > > > > Yet another nice one. This seems to be a problem > > > > > that many want solutions for. > > > > > > > > > > > > > Quite so, theres also mine :) > > > > > > > > http://erldocs.com/R13B03/ > > > > > > > > > > > > > > > > > > It is also fast, but I can not readily find a quick > > > > > way to search for a function name when I do not > > > > > know the module. If I type "new" ets:new comes at least > > > > > one page down and there is no possibility to filter > > > > > for function names only. > > > > > > > > > > Another nice thing on this site is that you get > > > > > Application > > > > > Module:Function > > > > > Short description > > > > > already in the search results. > > > > > > > > > > > > > > > > > It scrolls to selected function and has pretty style. > > > > > > > > > > > > On Thu, 2009-12-03 at 10:45 +0100, Raimo Niskanen wrote: > > > > > > > On Thu, Dec 03, 2009 at 11:53:18AM +0900, Ngoc Dao wrote: > > > > > > > > This is an impressive improvement. > > > > > > > > > > > > > > > > Currently I am using gotapi, and its API is not the latest: > > > > > > > > http://www.gotapi.com/erlang > > > > > > > > > > > > > > That is a really cool tool. Annoying that they call modules > > > > > > > "class", but anyway impressive... > > > > > > > > > > > > > > This site sets a standard that erldoc should strive to > > > > > > > reach, but with the latest documentation! > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, Dec 2, 2009 at 8:20 PM, Raimo Niskanen > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >> > > > > > wrote: > > > > > > > > > On Wed, Dec 02, 2009 at 03:08:05AM -0800, Jayson Vantuyl > wrote: > > > > > > > > >> When I searched for a fully qualified function (i.e. > ets:new), > > > > it > > > > > seemed to have an issue URL-decoding the colon, and the search > > > generally > > > > > didn't like it even when manually adjusted on the next page. Nice > > > start, > > > > > though. > > > > > > > > > > > > > > > > > > Currently it searches for names anywhere (functions, > modules > > > and > > > > > applications), > > > > > > > > > so you can search for `ets', follow to the ets man page and > > > then > > > > > > > > > scroll down to the `new' function. > > > > > > > > > > > > > > > > > > Or you can search for `new'. > > > > > > > > > > > > > > > > > > You can also search for `ets new', which oddly enough > > > > > > > > > does not give ets:new higher ranking than any other > > > > > > > > > Whatever:new function... > > > > > > > > > > > > > > > > > > It sounds like a very nice idea that either `ets:new' or > > > > > > > > > `ets new' would give higher ranking for a hit on both > > > > > > > > > module and function (and application). I will forward > > > > > > > > > the idea to the developers (hope they read this too). > > > > > > > > > > > > > > > > > >> > > > > > > > > >> On Dec 2, 2009, at 2:55 AM, Raimo Niskanen wrote: > > > > > > > > >> > > > > > > > > >> > On Fri, Nov 27, 2009 at 03:15:03PM +0100, Kenneth Lundin > > > > wrote: > > > > > > > > >> >> Hi Vlad, > > > > > > > > >> >> > > > > > > > > >> >> A search facility will come , we will create an index > > > > > > > > >> >> for this purpose as part of the docbuilding process. > > > > > > > > >> >> > > > > > > > > >> >> No need to patch the docbuilder application. > > > > > > > > >> >> > > > > > > > > >> >> /Kenneth Erlang/OTP Ericsson > > > > > > > > >> > > > > > > > > > >> > There is a preliminary version of the search facility > > > > > > > > >> > now running on the (perliminary) demo site: > > > > > > > > >> > Go to http://demo.erlang.org/doc.html and type e.g > "keyse" > > > > > > > > >> > in the text field in the grey right column, then click > the > > > > > > > > >> > looking glass button... Comments are welcome. > > > > > > > > >> > > > > > > > > > >> > The same search application should eventually be > > > > > > > > >> > possible to run via the OTP webtool application on > > > > > > > > >> > your local Erlang/OTP installation as a HTTP > > > > > > > > >> > server on your local host. > > > > > > > > >> > > > > > > > > > >> > / Raimo > > > > > > > > >> > > > > > > > > > >> > > > > > > > > > >> >> > > > > > > > > >> >> On Fri, Nov 27, 2009 at 2:23 PM, Vlad Dumitrescu < > > > > > vladdu55@REDACTED> wrote: > > > > > > > > >> >>> Hi! > > > > > > > > >> >>> > > > > > > > > >> >>> I really like the looks of the new documentation. > > > > > > > > >> >>> > > > > > > > > >> >>> There is a small thing that was suggested before and > that > > > > > would help a > > > > > > > > >> >>> lot: a search field (hopefully with autocompletion, > too). > > > > > Typing > > > > > > > > >> >>> "li:keys" to go to lists:keysearch would be soooo > > > > > sweet!... > > > > > > > > >> >>> > > > > > > > > >> >>> I realize now that generating this is probably the job > of > > > > the > > > > > > > > >> >>> docbuilder application, which would mean that I can > > > probably > > > > > submit a > > > > > > > > >> >>> patch myself (if I get to it). Will check that (but if > > > > someone > > > > > else > > > > > > > > >> >>> has faster fingers, I won't hold a grudge :-). > > > > > > > > >> >>> > > > > > > > > >> >>> BTW, a related question: I see that the issue tracker > at > > > > > github is > > > > > > > > >> >>> being used. What is the current policy for reporting > bugs? > > > > It > > > > > would be > > > > > > > > >> >>> nice if there was only a single place instead of three > > > (some > > > > > people > > > > > > > > >> >>> like me do post bug reports here instead of > erlang-bugs > > > > > anyway), for > > > > > > > > >> >>> example if the github tracker could send email > > > notifications > > > > > to > > > > > > > > >> >>> erlang-bugs. > > > > > > > > >> >>> > > > > > > > > >> >>> best regards, > > > > > > > > >> >>> Vlad > > > > > > > > >> >>> > > > > > > > > >> >>> > > > > > ________________________________________________________________ > > > > > > > > >> >>> erlang-questions mailing list. See > > > > > http://www.erlang.org/faq.html > > > > > > > > >> >>> erlang-questions (at) erlang.org > > > > > > > > >> >>> > > > > > > > > >> >>> > > > > > > > > >> >> > > > > > > > > >> >> > > > > > ________________________________________________________________ > > > > > > > > >> >> erlang-questions mailing list. See > > > > > http://www.erlang.org/faq.html > > > > > > > > >> >> erlang-questions (at) erlang.org > > > > > > > > >> > > > > > > > > > >> > -- > > > > > > > > >> > > > > > > > > > >> > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > > > > > > >> > > > > > > > > > >> > > > > > ________________________________________________________________ > > > > > > > > >> > erlang-questions mailing list. See > > > > > http://www.erlang.org/faq.html > > > > > > > > >> > erlang-questions (at) erlang.org > > > > > > > > >> > > > > > > > > > >> > > > > > > > > >> > > > > > > > > >> > > > > > > > > >> -- > > > > > > > > >> Jayson Vantuyl > > > > > > > > >> kagato@REDACTED > > > > > > > > >> > > > > > > > > >> > > > > > > > > >> > > > > > > > > >> > > > > > > > > >> > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > > > > > > > > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > > > > > > > > > > > > > > > > > > > ________________________________________________________________ > > > > > > > > > erlang-questions mailing list. See > > > > http://www.erlang.org/faq.html > > > > > > > > > erlang-questions (at) erlang.org > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ________________________________________________________________ > > > > > > > > erlang-questions mailing list. See > > > http://www.erlang.org/faq.html > > > > > > > > erlang-questions (at) erlang.org > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ________________________________________________________________ > > > > > > erlang-questions mailing list. See > http://www.erlang.org/faq.html > > > > > > erlang-questions (at) erlang.org > > > > > > > > > > -- > > > > > > > > > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > > > > > > > > ________________________________________________________________ > > > > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > > > > erlang-questions (at) erlang.org > > > > > > > > > > > > > > > > > > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > From xcentricity@REDACTED Thu Dec 3 19:35:51 2009 From: xcentricity@REDACTED (XCentric) Date: Fri, 4 Dec 2009 00:05:51 +0530 Subject: [erlang-questions] erl_syntax: Module import statement In-Reply-To: <4B17DA21.30407@it.uu.se> References: <4B17DA21.30407@it.uu.se> Message-ID: Many thanks, Richard. Regards, AR On Thu, Dec 3, 2009 at 9:02 PM, Richard Carlsson wrote: > XCentric wrote: > > Hi! > > > > Could anyone please give me an example of how to use > erl_syntax:attribute/2 > > to generate AST for a module import statement? For example, how to > represent > > "-import(io)." using erl_syntax:attribute/2? > > Like this: > > 1> A = erl_syntax:attribute(erl_syntax:atom(import), > [erl_syntax:atom(io)]). > 2> io:put_chars(erl_prettypr:format(A)). > -import(io).ok > > > /Richard > From johann.hoechtl@REDACTED Thu Dec 3 21:36:56 2009 From: johann.hoechtl@REDACTED (=?ISO-8859-1?Q?Johann_H=F6chtl?=) Date: Thu, 03 Dec 2009 21:36:56 +0100 Subject: [erlang-questions] Re: Web Framework to choose In-Reply-To: <97B857B2-FAA0-4656-9891-58E3B32603F9@worrell.nl> References: <97B857B2-FAA0-4656-9891-58E3B32603F9@worrell.nl> Message-ID: <4B182168.40209@gmail.com> Thanks a lot for all the replies. I will go with nitrogen, as my site will be very interactive, and nitrogen with comet support seems to support this very well. From twoggle@REDACTED Thu Dec 3 22:50:05 2009 From: twoggle@REDACTED (Tim Fletcher) Date: Thu, 3 Dec 2009 13:50:05 -0800 (PST) Subject: Getting the position of a list item In-Reply-To: <401d3ba30912030747s41acff62w6718a4724fdc526f@mail.gmail.com> References: <6a3ae47e0912020934j27430d00wed628a10bfb48707@mail.gmail.com> <563519ba-ac11-4f51-a00d-cd046fbaf685@s20g2000yqd.googlegroups.com> <401d3ba30912030747s41acff62w6718a4724fdc526f@mail.gmail.com> Message-ID: <0f88187d-01aa-437f-8d54-2d9ecb6be181@k17g2000yqh.googlegroups.com> > I usually see code like this implemented like this: > > base32_decode2(Char) when Char>=$0, Char=<$9 -> > ? ? Char-47; > > base32_decode2(Char) when Char>=$b, Char=<$h -> > ? ? Char-87; > > base32_decode2(Char) when Char>=$j, Char=<$k -> > ? ? Char-88; > > base32_decode2(Char) when Char>=$m, Char=<$n -> > ? ? Char-89; > > base32_decode2(Char) when Char>=$p, Char=<$z -> > ? ? Char-90. Sure, that's the style i'd usually use for similar problems, but because there were gaps in the sequence of letters i thought that the 2 shorter functions would be better than the one longer one. Something like "0123456789bcdefghjkmnpqrstuvwxyz".index(char) is pretty succinct in comparison, but then languages like Python, Ruby etc. don't have the pattern matching as an alternative, so the index function is more idiomatic there. Tim From rvirding@REDACTED Fri Dec 4 00:05:31 2009 From: rvirding@REDACTED (Robert Virding) Date: Fri, 4 Dec 2009 00:05:31 +0100 Subject: [erlang-questions] Ternary Like Operation Idiom in Erlang In-Reply-To: References: Message-ID: <3dbc6d1c0912031505m141c4fc8x4ca068ed97569746@mail.gmail.com> 2009/12/3 Jarrod Roberson > On Thu, Dec 3, 2009 at 4:08 AM, Michael Turner wrote: > > > >>Thanks to Dale's version I came up with this. > >> > >>F = fun(T) -> case re:split(T,"=",[{return,list}]) of [K] -> {K,true}; > >>[K,V] -> {K,V} end end. > > > > Cute, but with whitespace trailing after the "=", you get {key, " "}, > > which might not be the desired behavior. Moreover, an embedded "=" in > > the Value part (e.g, key='a=1' or something ridiculous like that) will > > cause it to fail, which also might not be desired behavior. Getting > > close, though. > > > > The following > > > > Fm = fun(T) -> > > case re:split(string:strip(T),"=",[{return,list}]) of > > [K] -> {K, true}; > > [K | V] -> {K, string:join (V, "=")} > > end > > end. > > > > seems to cover those cases. I'm assuming you don't care that there's > > no whitespace stripped from the left end of the V string. But maybe you > > do. > > "key= " is valid and should parse to {"key"," "}, the spec for what is > valid in my case is pretty strict. > there should only be one "=" and anything else should FAIL. I will > probably have to add some thing to catch > those cases but for now I just want to get it to work with valid data. > In that case the easiest would be a small modification to Michael's code (your func name): fix(T) -> case re:split(T, "=", [{return,list}]) of [Key] -> {Key,"true"}; %key [Key,[]] -> {Key,""}; %key= [Key,Val] -> {Key,Val} %key=value end. which will generate an error if you have more than one "=". Robert From ok@REDACTED Fri Dec 4 00:49:07 2009 From: ok@REDACTED (Richard O'Keefe) Date: Fri, 4 Dec 2009 12:49:07 +1300 Subject: [erlang-questions] Best practice for defining functions with edoc,erlc,eunit and the dialyzer In-Reply-To: <50763.194.88.55.211.1259834150.squirrel@localhost> References: <9b08084c0912020128w6d5e685dq2dd259e82806d2aa@mail.gmail.com> <4B1641F8.2040708@tmit.bme.hu> <5AA5B557-9354-4B89-BBA7-A6DE3775A52A@cs.otago.ac.nz> <50763.194.88.55.211.1259834150.squirrel@localhost> Message-ID: <62572D38-D2B5-4E60-961D-43B270FF9A81@cs.otago.ac.nz> On Dec 3, 2009, at 10:55 PM, Zoltan Lajos Kis wrote: > I prefer to group the "API" functions based on their functionality If their functionality isn't too close to make this easy, why are they in the same module? OK, let's take Smalltalk as a model, and consider a Set data type -export([ % @category Instance creation empty/0, % empty() is empty from_list/1, % from_list([X1,...,Xn]) has the listed members singleton/1, % singleton(X) has X as only member % @category Size is_empty/1, % is_empty(S) iff S is empty() not_empty/1, % not_empty(S) iff not is_empty(S) size/1, % size(S) is number of elements % @category Single element operations arb/1, % arb(S) when not_empty(S) is some element excludes/2, % excludes(S, X) iff X is not in S includes/2, % includes(S, X) iff X is in S sans/2, % sans(S, X) is S \ {X} with/2, % with(S, X) is S U {X} % @category Whole container comparisons are_equal/2, % are_equal(S1, S2) iff S1\S2 and S2\S1 empty not_equal/2, % not_equal(S1, S2) iff S1 S2 different as sets excludes_all/2, % excludes_all(S1, S2) iff no overlap excludes_any/2, % excludes_any(S1, S2) iff not_empty(S2\S1) includes_all/2, % includes_all(S1, S2) iff is_empty(S2\S1) includes_any/2, % includes_any(S1, S2) iff some overlap % @category Whole container operations difference/2, % difference(S1, S2) = S1 \ S2 intersection/2, % intersection(S1, S2) union/2, % union(S1, S2) = S1 U S2 % @category Iteration all_satisfy/2, % all_satisfy(S, P) when P(X) for all X in S any_satisfy/2, % any_satisfy(S, P) when P(X) for some X in S fold/3, % fold(F, A, S) map/2, % map(F, S) = {F(X) | X <- S} none_satisfy/2, % non_satisfy(S, P) = not any_satisfy(S, P) % @category Conversion to_list/1 % to_list(S) lists elements in unspecified order ]). Is this _really_ more useful than a single alphabetic list? (It helps when there is a consistently applied vocabulary of categories.) Take a look at http://hackage.haskell.org/packages/archive/logfloat/0.12.0.1/doc/html/Data-Number-LogFloat.html for functions in groups. It can be a useful indexing tool WHEN YOU ARE SEARCHING THE DOCUMENTATION. But the order in which something is documented and the order in which it is presented in the code need not be the same. At least let the functions in each group be presented alphabetically. > and > order them by the order they will most probably be used. Why do you think that is a good order? If someone is reading for the first time, the order they need is some sort of logical dependency order, and your "my guess about your frequency of use" order gets in the way. If someone is re-reading, chances are they're looking for a particular topic, in which case the frequency-guess order at best doesn't help. (The thing you most need to read about is probably the thing you use least often, because it's the thing you reinforce your memory of least.) >> >> Years ago I recommended that the syntax should be extended >> to >> -behaviour(Behaviour, [Callback...]). >> so that a cross-checking tool could tell that these functions >> were *intended* to be used as callbacks by that behaviour and >> weren't just accidentally adjacent. > > A simple -behavior(Behavior). could be interpreted by the compiler as > exporting all of the behavior's callback functions. That would > trigger a > compiler error if you forgot to implement one. Yes, but it wouldn't be as helpful for the human reader. >>> >>> %% Internal functions >>> -export([spawnee/0, applyee/2, ...]). >> >> Now that we have spawn(fun () -> ... end) and F(...), >> we shouldn't need this group at all. >> > > In general you can argue that all of these internal functions can be > handled as callbacks, and thus put into behaviors, and exported as > such. Possibly true, but NOT the point I was making here. > > Nevertheless grep for "internal exports" in the Erlang/OTP source. > There > is quite a lot of them. Let's take pool.erl as an example. -export([statistic_collector/0, do_spawn/4, init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2]). Let's take the first function in that list. It is exported because of these two calls: spawn_link(pool, statistic_collector, []), spawn_link(Node, pool, statistic_collector, []), This is the old way of doing things. These days, those calls can be written as spawn_link(fun () -> pool:statistic_collector() end), spawn_link(Node, fun () -> pool:statistic_collector() end), with no need for an export. Now let's look at do_spawn/4. This time there's one call. Pid = spawn(N, pool, do_spawn, [Gl, M, F, A]), which could now be Pid = spawn(N, fun () -> pool:do_spawn(Gl, M, F, A) end), and then we could eliminate do_spawn/4, Pid = spawn(N, fun () -> group_leader(Gl, self()), apply(M, F, A) end), The remaining "Internal exports", init/1, handle_call/3, handle_cast/2, handle_info/2, and terminate/2 are precisely callbacks for gen_server, so they fall into the class of "behaviour callbacks" for which we agreed that a second export list was appropriate. As behaviour call-backs, they should not be described as "Internal exports". Let's try another file with "Internal exports". proc_lib.erl has one, wake_up/3. That's used here: hibernate(M, F,A) when is_atom(M), is_atom(F), is_list(A) -> erlang:hibernate(proc_lib, wake_up, [M,F,A]). This one currently has to survive because there is no erlang:hibernate/1, though it's not clear why. If there were, it could be hibernate(Fun) -> erlang:hibernate(fun () -> wake_up(Fun) end). Just because there _are_ lots of "Internal exports" doesn't mean that there NOW _should be_. I've written up an EEP for this, but on reflection, I believe that library changes are supposed to be posted to this list, so my next message will be exactly that. From ok@REDACTED Fri Dec 4 00:53:45 2009 From: ok@REDACTED (Richard O'Keefe) Date: Fri, 4 Dec 2009 12:53:45 +1300 Subject: [erlang-questions] Add hibernate/1 (was: Best practice for defining functions with edoc,erlc,eunit and the dialyzer) In-Reply-To: <50763.194.88.55.211.1259834150.squirrel@localhost> References: <9b08084c0912020128w6d5e685dq2dd259e82806d2aa@mail.gmail.com> <4B1641F8.2040708@tmit.bme.hu> <5AA5B557-9354-4B89-BBA7-A6DE3775A52A@cs.otago.ac.nz> <50763.194.88.55.211.1259834150.squirrel@localhost> Message-ID: <5E380FDF-B61C-4701-8F85-7D6BC7E0BDF8@cs.otago.ac.nz> Proposal: Add erlang:hibernate(Fun) and proc_lib:hibernate(Fun) I was going to make this an EEP, but I believe that library changes of this magnitude are not supposed to be EEPs. The attachment is still in the form of an EEP. It's 168 lines. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: eep-hibe.txt URL: -------------- next part -------------- From ttmrichter@REDACTED Fri Dec 4 05:22:49 2009 From: ttmrichter@REDACTED (Michael Richter) Date: Fri, 4 Dec 2009 12:22:49 +0800 Subject: [erlang-questions] http://en.wikipedia.org/wiki/Intel_iAPX_432#Multitasking_and_interprocess_communication In-Reply-To: References: <7702c0610912021529t70937ed9x3f81fdbc20701692@mail.gmail.com> Message-ID: 2009/12/3 Michael Turner > Just about any RISC architecture would probably consume less area and > power per core. ARM cores, for example, would make a lot more sense. > Not likely to see that from Intel, though. > Intel wasn't always x86-only... From johann.hoechtl@REDACTED Fri Dec 4 09:35:39 2009 From: johann.hoechtl@REDACTED (=?ISO-8859-15?Q?Johann_H=F6chtl?=) Date: Fri, 04 Dec 2009 09:35:39 +0100 Subject: Word Frequency Analysis Message-ID: <4B18C9DB.40402@gmail.com> Hello! I need to compute a word frequency analysis of a fairly large corpus. At present I discovered the disco database http://discoproject.org/ which seems to include a tf-idf indexer. What about couchdb? I found an article that it fails rather quickly (somewhere between 100 and 1000 wikipedia text pages) http://knuthellan.com/2009/07/09/the-couchdb-indexer-lightweight-search-engine-in-hours/ Are there other erlang frameworks or can somebody provide me with a hint to another DBM system which naturally supports wortd frequncy analysis? Thank you! Regards, Johann From leap@REDACTED Fri Dec 4 10:35:00 2009 From: leap@REDACTED (Michael Turner) Date: Fri, 04 Dec 2009 09:35:00 +0000 Subject: [erlang-questions] http://en.wikipedia.org/wiki/Intel_iAPX_432#Multitasking_and_interprocess_communication In-Reply-To: Message-ID: On 12/4/2009, "Michael Richter" wrote: >2009/12/3 Michael Turner > >> Just about any RISC architecture would probably consume less area and >> power per core. ARM cores, for example, would make a lot more sense. >> Not likely to see that from Intel, though. >> > >Intel wasn't always x86-only... Which kind of proves my point: they got a line of ARM-based IP from a lawsuit settlement with DEC, only to dump that line later, on Marvell. Admittedly, before that, they had their i860/960 RISC processors, even their own workstations that used them. But I never got the impression they were very serious about RISC on the product side. They didn't have to be, really. Intel has deep pockets, they learn a lot about competitive threats (and new markets within them) simply by emulating industry trends in-house. Even if they lost money on the i860 and the workstation they cobbled together around it, they probably learned something very valuable: how to make money in the market for support chips for engineering workstations. In any market-based view of the matter, however, anything RISCy is risky -- mainly, cannibalistic -- for Intel. I think Erlang is more likely to have an impact sometime soon in massive-multicore apps IF it can become popular as some sort of higher-level control language for specialized processor arrays, such as the kind suggested here (in another response to the Intel announcement): Researchers rethink approaches to computer vision http://tinyurl.com/yaybfj9 Not just in the lab, either. For apps with a (relatively) fixed process structure, Erlang programs might, with modifications, be mapped onto systems like the picoArray http://www.picochip.com/page/42/multi-core-dsp-architecture%20 Note that typical applications for picoArrays (cellular basestations) are also conveniently adjacent to the telecom equipment where Erlang earned its spurs industrially. -michael turner From Jakub.Zawierucha@REDACTED Fri Dec 4 12:13:29 2009 From: Jakub.Zawierucha@REDACTED (Jakub Zawierucha) Date: Fri, 04 Dec 2009 12:13:29 +0100 Subject: [erlang-questions] xmerl_sax_parser node information trivial problem In-Reply-To: <4B1640BB.5020209@nit.pl> References: <4B1640BB.5020209@nit.pl> Message-ID: <4B18EED9.90603@nit.pl> I've solved this by putting tags on stack. JZ Jakub Zawierucha pisze: > Hello, > > I'm trying to write a simple app that will process XML file and give > me information about some nodes. I need to know how many attributes > and children nodes are avaliable in that node. I know how to obtain > attr count (just count Attributes) but how about children nodes ? Any > ideas ? > > i have: > > do_magic(Lang, Xml) -> > xmerl_sax_parser:stream(Xml, [ > {continuation_fun, fun > continuationfun/1}, > {event_fun, fun eventfun/3}, > {event_state, {[Lang],<<>>}} > ]). > (...) > > eventfun({startElement, Uri, LocalName, QualifiedName, Attrubutes}, > Location, {Stack, Acc}) -> > [Lang|_] = Stack, % >>>>>> How many subnodes is in > tag called: LocalName <<<<<< > {Stack, Acc} > end; > > Thanks, > Jakub Zawierucha > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From kiran.khaladkar@REDACTED Fri Dec 4 14:10:53 2009 From: kiran.khaladkar@REDACTED (kiran) Date: Fri, 04 Dec 2009 16:10:53 +0300 Subject: case statements really required?? Message-ID: <4B190A5D.1030006@geodesic.com> hi, is it good to use case statements in functional language.. according to me .. pattern matching-functions could do the task. any commnets?? -- Kiran Khaladkar | Software Engineer Geodesic Limited | www.geodesic.com Tel: +91 22 4031 5800 - ext - 225 Mob: 9870587508 From max.lapshin@REDACTED Fri Dec 4 12:55:57 2009 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 4 Dec 2009 14:55:57 +0300 Subject: RTSP, RTP implementation Message-ID: Hi, everyone. As erlyvideo project is growing and can now stream to web clients video from MPEG TS, I wanted to add ability to record video from Quicktime Video Broadcaster. This tool can stream to server by RTSP protocol. Is there any working code, that implements RTP and/or RTSP protocols? From attila.r.nohl@REDACTED Fri Dec 4 13:52:20 2009 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Fri, 4 Dec 2009 13:52:20 +0100 Subject: [erlang-questions] case statements really required?? In-Reply-To: <4B190A5D.1030006@geodesic.com> References: <4B190A5D.1030006@geodesic.com> Message-ID: <401d3ba30912040452k643b3f90ie279f2cea6284683@mail.gmail.com> 2009/12/4, kiran : > hi, > is it good to use case statements in functional language.. according to > me .. pattern matching-functions could do the task. > any commnets?? Using pattern matching leads to "function fragmentation", i.e. to loads of one liner function cases and it gets hard to follow the control flow. Let's consider this code: check_language(Module) -> case catch Module:module_info(exports) of {'EXIT', _Reason} -> not_blm; Exports -> case {lists:member({blm_cmd, 0}, Exports), lists:member({blm_error, 1}, Exports)} of {true, true} -> {ok, blm_lang}; _ -> not_blm end end. 12 lines, does what it's named (returns {ok, blm_lang} if the two specified functions are exported from the module, otherwise returns not_blm. Without case the code would look like this: check_language(Module) -> really_check_language(catch Module:module_info(exports)). really_check_language({'Exit', _Reason}) -> not_blm; really_check_language(Exports) -> check_exported_functions( lists:member({blm_cmd,0},Exports), lists:member({blm_error, 1}, Exports)); check_exported_functions(true, true) -> {ok, blm_lang}; check_exported_functions(_, _) -> not_blm. 16 lines of screen used (and no documentation comments, type specifications, etc. are written, they could add a couple of more lines), a stupid function name had to be invented, etc. Consider the equivalent in Java: String checkLanguage(String module) { try { int f=0; for (Method m : Class.forName(module).getMethods()) { if (m.getName().equals("blm_cmd") || m.getName().equals("blm_error")) { f++; } } return (f==2?"{ok, blm_lang}":"not_blm"); } catch (ClassNotFoundException e) { return "not_blm"; } } 15 lines, but 5 of them contain only "}" (the original Erlang also contained two lines of only "end", so it's the same length). From seancribbs@REDACTED Fri Dec 4 14:21:16 2009 From: seancribbs@REDACTED (Sean Cribbs) Date: Fri, 04 Dec 2009 08:21:16 -0500 Subject: [erlang-questions] case statements really required?? In-Reply-To: <4B190A5D.1030006@geodesic.com> References: <4B190A5D.1030006@geodesic.com> Message-ID: <4B190CCC.1030504@gmail.com> kiran wrote: > hi, > is it good to use case statements in functional language.. according > to me .. pattern matching-functions could do the task. > any commnets?? > Often I turn case statements into multiple function clauses, as you suggest; however, sometimes it's more expedient to use a case statement. It's a matter of style and pragmatism, and I like having both available. Sean From roberto.aloi@REDACTED Fri Dec 4 14:49:43 2009 From: roberto.aloi@REDACTED (Roberto Aloi) Date: Fri, 4 Dec 2009 13:49:43 +0000 (GMT) Subject: [erlang-questions] case statements really required?? In-Reply-To: <4B190A5D.1030006@geodesic.com> Message-ID: <29490402.80201259934583081.JavaMail.root@zimbra> This topic has already been discussed in StackOverflow: http://stackoverflow.com/questions/1050913/erlang-style-case-vs-function-pattern-matching Cheers, ----- "kiran" wrote: > hi, > is it good to use case statements in functional language.. according > to > me .. pattern matching-functions could do the task. > any commnets?? > > -- > Kiran Khaladkar | Software Engineer > Geodesic Limited | www.geodesic.com > Tel: +91 22 4031 5800 - ext - 225 > Mob: 9870587508 > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org -- Roberto Aloi roberto.aloi@REDACTED http://www.erlang-consulting.com From johann.hoechtl@REDACTED Fri Dec 4 17:57:03 2009 From: johann.hoechtl@REDACTED (=?ISO-8859-15?Q?Johann_H=F6chtl?=) Date: Fri, 04 Dec 2009 17:57:03 +0100 Subject: Word Frequency Analysis Message-ID: <4B193F5F.5060607@gmail.com> Hello! I need to compute a word frequency analysis of a fairly large corpus. At present I discovered the disco database http://discoproject.org/ which seems to include a tf-idf indexer. What about couchdb? I found an article that it fails rather quickly (somewhere between 100 and 1000 wikipedia text pages) http://knuthellan.com/2009/07/09/the-couchdb-indexer-lightweight-search-engine-in-hours/ Are there other erlang frameworks or can somebody provide me with a hint to another DBM system which naturally supports wortd frequncy analysis? Thank you! Regards, Johann From johann.hoechtl@REDACTED Fri Dec 4 17:59:06 2009 From: johann.hoechtl@REDACTED (=?ISO-8859-1?Q?Johann_H=F6chtl?=) Date: Fri, 04 Dec 2009 17:59:06 +0100 Subject: [erlang-questions] Re: Web Framework to choose In-Reply-To: <97B857B2-FAA0-4656-9891-58E3B32603F9@worrell.nl> References: <97B857B2-FAA0-4656-9891-58E3B32603F9@worrell.nl> Message-ID: <4B193FDA.8030500@gmail.com> Thanks a lot for all the replies. I will go with nitrogen, as my site will be very interactive, and nitrogen with comet support seems to support this very well. Thank you for the help, Johann From dietmar-s@REDACTED Fri Dec 4 20:08:57 2009 From: dietmar-s@REDACTED (Dietmar Schaefer) Date: Fri, 04 Dec 2009 20:08:57 +0100 Subject: What happend to the docs ? Message-ID: <4B195E49.3060103@online.de> Since this morning I am unable to read the pdf docs. All I get is Forbidden You don't have permission to access /doc/pdf/ on this server What happend ? regards Dietmar From johann.hoechtl@REDACTED Fri Dec 4 20:40:38 2009 From: johann.hoechtl@REDACTED (=?ISO-8859-1?Q?Johann_H=F6chtl?=) Date: Fri, 4 Dec 2009 11:40:38 -0800 (PST) Subject: erlang search engine library? In-Reply-To: <1af9aae30912011728q4e966e27pb25b0b8efd9a0312@mail.gmail.com> References: <1af9aae30912011728q4e966e27pb25b0b8efd9a0312@mail.gmail.com> Message-ID: On Dec 2, 2:28?am, Carlo Cabanilla wrote: > Hi, > > Is there a widely used search engine library for Erlang? Something similar > to Java's Lucene. I know Joe wrote one in Programming Erlang, what's the > license on that code? Has anyone made the effort to transcribe it and slap > it on Github? > You may take a look at http://github.com/bdionne/indexer Someone is working on FTI for couchdb in pure Erlang. > -- > > .Carlo > syntacticbayleaves.com From carlo.cabanilla@REDACTED Fri Dec 4 22:14:50 2009 From: carlo.cabanilla@REDACTED (Carlo Cabanilla) Date: Fri, 4 Dec 2009 16:14:50 -0500 Subject: [erlang-questions] Re: erlang search engine library? In-Reply-To: References: <1af9aae30912011728q4e966e27pb25b0b8efd9a0312@mail.gmail.com> Message-ID: <1af9aae30912041314s5e136afby560f9c57e43fd470@mail.gmail.com> indexer looks promising, thanks! On Fri, Dec 4, 2009 at 2:40 PM, Johann H?chtl wrote: > > > On Dec 2, 2:28 am, Carlo Cabanilla wrote: > > Hi, > > > > Is there a widely used search engine library for Erlang? Something > similar > > to Java's Lucene. I know Joe wrote one in Programming Erlang, what's the > > license on that code? Has anyone made the effort to transcribe it and > slap > > it on Github? > > > You may take a look at > http://github.com/bdionne/indexer > > Someone is working on FTI for couchdb in pure Erlang. > > -- > > > > .Carlo > > syntacticbayleaves.com > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > -- .Carlo From kiszl@REDACTED Fri Dec 4 23:29:15 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Fri, 04 Dec 2009 23:29:15 +0100 Subject: [erlang-questions] Best practice for defining functions with edoc,erlc,eunit and the dialyzer In-Reply-To: <62572D38-D2B5-4E60-961D-43B270FF9A81@cs.otago.ac.nz> References: <9b08084c0912020128w6d5e685dq2dd259e82806d2aa@mail.gmail.com> <4B1641F8.2040708@tmit.bme.hu> <5AA5B557-9354-4B89-BBA7-A6DE3775A52A@cs.otago.ac.nz> <50763.194.88.55.211.1259834150.squirrel@localhost> <62572D38-D2B5-4E60-961D-43B270FF9A81@cs.otago.ac.nz> Message-ID: <4B198D3B.7030205@tmit.bme.hu> Richard O'Keefe wrote: > > On Dec 3, 2009, at 10:55 PM, Zoltan Lajos Kis wrote: >> I prefer to group the "API" functions based on their functionality > > If their functionality isn't too close to make this easy, > why are they in the same module? Most servers provide a server-functionality (start, start_link, stop, ...) towards the application, and a separate functionality towards its users. But you are right, even these can be put into two separate modules. I will consider this. > ... cut intentionally ... > This one currently has to survive because there is no > erlang:hibernate/1, though it's not clear why. If there were, > it could be > > hibernate(Fun) -> > erlang:hibernate(fun () -> wake_up(Fun) end). > > > Just because there _are_ lots of "Internal exports" doesn't > mean that there NOW _should be_. > > I've written up an EEP for this, but on reflection, I believe that > library changes are supposed to be posted to this list, so my next > message will be exactly that. > I got your point. A minor inconvenience with this approach is that it generates a bunch of "function xyz/# is unused" warnings. From kiran.khaladkar@REDACTED Sat Dec 5 07:53:56 2009 From: kiran.khaladkar@REDACTED (kiran) Date: Sat, 05 Dec 2009 09:53:56 +0300 Subject: [erlang-questions] case statements really required?? In-Reply-To: <401d3ba30912040452k643b3f90ie279f2cea6284683@mail.gmail.com> References: <4B190A5D.1030006@geodesic.com> <401d3ba30912040452k643b3f90ie279f2cea6284683@mail.gmail.com> Message-ID: <4B1A0384.5020702@geodesic.com> Attila Rajmund Nohl wrote: > 2009/12/4, kiran : > >> hi, >> is it good to use case statements in functional language.. according to >> me .. pattern matching-functions could do the task. >> any commnets?? >> > > Using pattern matching leads to "function fragmentation", i.e. to > loads of one liner function cases and it gets hard to follow the > control flow. Let's consider this code: > > check_language(Module) -> > case catch Module:module_info(exports) of > {'EXIT', _Reason} -> > not_blm; > Exports -> > case {lists:member({blm_cmd, 0}, Exports), > lists:member({blm_error, 1}, Exports)} of > {true, true} -> > {ok, blm_lang}; > _ -> > not_blm > end > end. > > 12 lines, does what it's named (returns {ok, blm_lang} if the two > specified functions are exported from the module, otherwise returns > not_blm. Without case the code would look like this: > > check_language(Module) -> > really_check_language(catch Module:module_info(exports)). > > really_check_language({'Exit', _Reason}) -> > not_blm; > > really_check_language(Exports) -> > check_exported_functions( > lists:member({blm_cmd,0},Exports), > lists:member({blm_error, 1}, Exports)); > > check_exported_functions(true, true) -> > {ok, blm_lang}; > > check_exported_functions(_, _) -> > not_blm. > > 16 lines of screen used (and no documentation comments, type > specifications, etc. are written, they could add a couple of more > lines), a stupid function name had to be invented, etc. Consider the > equivalent in Java: > > String checkLanguage(String module) { > try { > int f=0; > for (Method m : Class.forName(module).getMethods()) { > if (m.getName().equals("blm_cmd") || > m.getName().equals("blm_error")) { > f++; > } > } > return (f==2?"{ok, blm_lang}":"not_blm"); > } > catch (ClassNotFoundException e) { > return "not_blm"; > } > } > > 15 lines, but 5 of them contain only "}" (the original Erlang also > contained two lines of only "end", so it's the same length). > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > I dont think the no of lines matter "so much" (4-5 lines diff is not much) .. what matters to me more is whether the code is "functional" (following fp) or not. In fact no of lines can be saved using pattern matching functions in most of the scenarios if thats the concern. Using functions and pattern matching makes the code more functional and can be more optimized by erlang vm than using cases (am i right?? comments please ... ). -- Kiran Khaladkar | Software Engineer Geodesic Limited | www.geodesic.com Tel: +91 22 4031 5800 - ext - 225 Mob: 9870587508 From jarrod@REDACTED Sat Dec 5 06:46:36 2009 From: jarrod@REDACTED (Jarrod Roberson) Date: Sat, 5 Dec 2009 00:46:36 -0500 Subject: Sending broadcast UDP messages on port 5353 Message-ID: My Java, Python and Objective-C, and C code can send on Port 5353 on the same machine, I can't figure out how to make Erlang do the same. There is some kind of magical combination of options I need and I can't figure out what they are. I am opening a port like this and it is able to listen and receive messages. -define(ADDR,{224,0,0,251}). -define(PORT,5353). start() -> ? ?%% start the process listening for mdns messages ? {ok,S} = gen_udp:open(?PORT,[{reuseaddr,true},{ip,?ADDR},binary]), ? inet:setopts(S,[{add_membership,{?ADDR,{0,0,0,0}}}]), ? Pid=spawn(?MODULE,receiver,[dict:new()]), ? gen_udp:controlling_process(S,Pid), ? {S,Pid}. I appears that {reuseaddr,true} only applies to listening on that PORT, because I receive packets with the code in start/0 just fine. I just get silent failures, nothing comes thru on any of my other listening clients. And I don't get any error dumps or anything. I even tried adding {broadcast,true} to the above options and that didn't work either. I can't get it SEND anything using that socket S so . . . I have tried creating a whole new socket like this -define(ADDR,{224,0,0,251}). -define(PORT,5353). send() -> ? ?H = #dns_header{qr=1,aa=1}, ? ?{ok,HN} = inet:gethostname(), ? ?D = "test@" ++ HN ++ "._test._tcp.local", ? ?R = #dns_rr{domain="_test._tcp.local",type=ptr,ttl=4500,data=D}, ? ?Rec = #dns_rec{header=H,anlist=[R]}, ? ?{ok,S}=gen_udp:open(?PORT,[{reuseaddr,true},{broadcast,true}]), ? ?gen_udp:send(S,?ADDR,?PORT,inet_dns:encode(Rec)). and all I get is this Eshell V5.7.4 (abort with ^G) 1> inet_mdns:send(). ** exception error: no match of right hand side value {error,eaddrinuse} in function inet_mdns:send/0 2> If I pass in PORT = ZERO then it works but that really doesn't do me any good because of the way the spec for this service is written. I REALLY need to be able to SEND on 5353 because of the spec below. Here is why I can't do the gen_udp with port ZERO. " If the source UDP port in a received Multicast DNS Query is not port 5353, this indicates that the client originating the query is a simple client that does not fully implement all of Multicast DNS. In this case, the Multicast DNS Responder MUST send a UDP response directly back to the client, via unicast, to the query packet's source IP address and port. This unicast response MUST be a conventional unicast response as would be generated by a conventional unicast DNS server; for example, it MUST repeat the query ID and the question given in the query packet." From jarrod@REDACTED Sat Dec 5 07:11:26 2009 From: jarrod@REDACTED (Jarrod Roberson) Date: Sat, 5 Dec 2009 01:11:26 -0500 Subject: [erlang-questions] Struggling with multicast udp send In-Reply-To: <97619b170911152321v738d6c96p8350ea5a1a64fd04@mail.gmail.com> References: <97619b170911152141u21d1c580w6d207df151a10788@mail.gmail.com> <97619b170911152321v738d6c96p8350ea5a1a64fd04@mail.gmail.com> Message-ID: On Mon, Nov 16, 2009 at 2:21 AM, Rapsey wrote: > The code I pasted was for sending. I use it to transmit an IPTV multicast > video stream. Why is source port important? If you wish to also receive on > that port, you could always have a different regular udp socket used just > for listening. > > > Sergej Source port is important because of the way the spec is written. " If the source UDP port in a received Multicast DNS Query is not port 5353, this indicates that the client originating the query is a simple client that does not fully implement all of Multicast DNS. In this case, the Multicast DNS Responder MUST send a UDP response directly back to the client, via unicast, to the query packet's source IP address and port. This unicast response MUST be a conventional unicast response as would be generated by a conventional unicast DNS server; for example, it MUST repeat the query ID and the question given in the query packet. " any other source port than 5353 implies my client is not a compliant client. So I have to be able to send on source port 5353. I have tried multiple sockets, same socket, nothing lets me send on 5353. I have Java, Python, C, C++ that all work on OSX, Windows, Linux and Solaris that let me do this without any problems. From rapsey@REDACTED Sat Dec 5 08:58:29 2009 From: rapsey@REDACTED (Rapsey) Date: Sat, 5 Dec 2009 08:58:29 +0100 Subject: [erlang-questions] Sending broadcast UDP messages on port 5353 In-Reply-To: References: Message-ID: <97619b170912042358hc33a0ex74a27378d4dd3842@mail.gmail.com> Well you could use the new erl_nif module to call your C code to send? Sergej On Sat, Dec 5, 2009 at 6:46 AM, Jarrod Roberson wrote: > My Java, Python and Objective-C, and C code can send on Port 5353 on > the same machine, > I can't figure out how to make Erlang do the same. > There is some kind of magical combination of options I need and I > can't figure out what they are. > I am opening a port like this and it is able to listen and receive > messages. > > -define(ADDR,{224,0,0,251}). > -define(PORT,5353). > > start() -> > %% start the process listening for mdns messages > {ok,S} = gen_udp:open(?PORT,[{reuseaddr,true},{ip,?ADDR},binary]), > inet:setopts(S,[{add_membership,{?ADDR,{0,0,0,0}}}]), > Pid=spawn(?MODULE,receiver,[dict:new()]), > gen_udp:controlling_process(S,Pid), > {S,Pid}. > > I appears that {reuseaddr,true} only applies to listening on that > PORT, because I > receive packets with the code in start/0 just fine. > I just get silent failures, nothing comes thru on any of my other > listening clients. > And I don't get any error dumps or anything. > I even tried adding {broadcast,true} to the above options and that > didn't work either. > I can't get it SEND anything using that socket S so . . . > > I have tried creating a whole new socket like this > > -define(ADDR,{224,0,0,251}). > -define(PORT,5353). > > send() -> > H = #dns_header{qr=1,aa=1}, > {ok,HN} = inet:gethostname(), > D = "test@" ++ HN ++ "._test._tcp.local", > R = #dns_rr{domain="_test._tcp.local",type=ptr,ttl=4500,data=D}, > Rec = #dns_rec{header=H,anlist=[R]}, > {ok,S}=gen_udp:open(?PORT,[{reuseaddr,true},{broadcast,true}]), > gen_udp:send(S,?ADDR,?PORT,inet_dns:encode(Rec)). > > and all I get is this > > > Eshell V5.7.4 (abort with ^G) > 1> inet_mdns:send(). > ** exception error: no match of right hand side value {error,eaddrinuse} > in function inet_mdns:send/0 > 2> > > If I pass in PORT = ZERO then it works but that really doesn't do me any > good > because of the way the spec for this service is written. > > I REALLY need to be able to SEND on 5353 because of the spec below. > Here is why I can't do the gen_udp with port ZERO. > > " If the source UDP port in a received Multicast DNS Query is not port > 5353, this indicates that the client originating the query is a > simple client that does not fully implement all of Multicast DNS. > In this case, the Multicast DNS Responder MUST send a UDP response > directly back to the client, via unicast, to the query packet's > source IP address and port. This unicast response MUST be a > conventional unicast response as would be generated by a conventional > unicast DNS server; for example, it MUST repeat the query ID and the > question given in the query packet." > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From bgustavsson@REDACTED Sat Dec 5 10:15:19 2009 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Sat, 5 Dec 2009 10:15:19 +0100 Subject: [erlang-questions] What happend to the docs ? In-Reply-To: <4B195E49.3060103@online.de> References: <4B195E49.3060103@online.de> Message-ID: <6672d0160912050115j594dba72g160021678df8d1df@mail.gmail.com> On Fri, Dec 4, 2009 at 8:08 PM, Dietmar Schaefer wrote: > You don't have permission to access /doc/pdf/ on this server > > What happend ? > They have been moved. From the HTML page for each application, there is a link to the corresponding PDF file for the application. The direct links look like this: http://www.erlang.org/doc/apps/stdlib/stdlib.pdf -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From kiszl@REDACTED Sat Dec 5 10:17:57 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Sat, 05 Dec 2009 10:17:57 +0100 Subject: [erlang-questions] case statements really required?? In-Reply-To: <4B1A0384.5020702@geodesic.com> References: <4B190A5D.1030006@geodesic.com> <401d3ba30912040452k643b3f90ie279f2cea6284683@mail.gmail.com> <4B1A0384.5020702@geodesic.com> Message-ID: <4B1A2545.3070505@tmit.bme.hu> kiran wrote: > I dont think the no of lines matter "so much" (4-5 lines diff is not > much) .. what matters to me more is whether the code is "functional" > (following fp) or not. > In fact no of lines can be saved using pattern matching functions in > most of the scenarios if thats the concern. > Using functions and pattern matching makes the code more functional > and can be more optimized by erlang vm than using cases (am i right?? > comments please ... ). > Can you elaborate on your "metric of functionality", that makes a function more functional than a case construct? From bgustavsson@REDACTED Sat Dec 5 10:24:30 2009 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Sat, 5 Dec 2009 10:24:30 +0100 Subject: [erlang-questions] case statements really required?? In-Reply-To: <4B1A0384.5020702@geodesic.com> References: <4B190A5D.1030006@geodesic.com> <401d3ba30912040452k643b3f90ie279f2cea6284683@mail.gmail.com> <4B1A0384.5020702@geodesic.com> Message-ID: <6672d0160912050124g209e4530m2b38a0118af7dd5e@mail.gmail.com> On Sat, Dec 5, 2009 at 7:53 AM, kiran wrote: > Using functions and pattern matching makes the code more functional and can > be more optimized by erlang vm than using cases (am i right?? comments > please ... ). No. Internally in the compiler, the Erlang program is first translated to Core Erlang, and in Core Erlang the only way to do matching is with "case". So matching in function heads, if statements, and matching like "Pattern = Expr" in a function body are all rewritten to Core Erlang "case" statements. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From zabrane3@REDACTED Sat Dec 5 16:45:27 2009 From: zabrane3@REDACTED (zabrane Mikael) Date: Sat, 5 Dec 2009 16:45:27 +0100 Subject: Best way to interface Erlang with Java code Message-ID: <18a1db030912050745r473683fboe722b1ec9a449d24@mail.gmail.com> Hi List ! I've a small program written in "Java" which take a filename (input), proceed it, and print out a text (output). What's the best way to be able to access to that program from Erlang? My whish is get back the "output" as an Erlang binary. Thanks Zabrane From seancribbs@REDACTED Sat Dec 5 16:53:35 2009 From: seancribbs@REDACTED (Sean Cribbs) Date: Sat, 05 Dec 2009 10:53:35 -0500 Subject: [erlang-questions] Best way to interface Erlang with Java code In-Reply-To: <18a1db030912050745r473683fboe722b1ec9a449d24@mail.gmail.com> References: <18a1db030912050745r473683fboe722b1ec9a449d24@mail.gmail.com> Message-ID: <4B1A81FF.6050804@gmail.com> zabrane Mikael wrote: > Hi List ! > > I've a small program written in "Java" which take a filename (input), > proceed it, and print out > a text (output). > > What's the best way to be able to access to that program from Erlang? > My whish is get back the "output" as an Erlang binary. > > Thanks > Zabrane > > Use os:cmd/1, which returns a string/list - http://erldocs.com/R13B03/kernel/os.html?search=os&i=5 Sean From zabrane3@REDACTED Sat Dec 5 18:27:24 2009 From: zabrane3@REDACTED (zabrane Mikael) Date: Sat, 5 Dec 2009 18:27:24 +0100 Subject: [erlang-questions] Best way to interface Erlang with Java code In-Reply-To: <4B1A81FF.6050804@gmail.com> References: <18a1db030912050745r473683fboe722b1ec9a449d24@mail.gmail.com> <4B1A81FF.6050804@gmail.com> Message-ID: <18a1db030912050927o1faff113g3ffd5083779ba623@mail.gmail.com> Hi Sean ! Ok I see. But how then cal I handle error code in Erlang if my Java program crash or returns something different from error code 0? Thanks Zabrane 2009/12/5 Sean Cribbs > zabrane Mikael wrote: > >> Hi List ! >> >> I've a small program written in "Java" which take a filename (input), >> proceed it, and print out >> a text (output). >> >> What's the best way to be able to access to that program from Erlang? >> My whish is get back the "output" as an Erlang binary. >> >> Thanks >> Zabrane >> >> >> > Use os:cmd/1, which returns a string/list - > http://erldocs.com/R13B03/kernel/os.html?search=os&i=5 > > Sean > From clist@REDACTED Sat Dec 5 18:37:19 2009 From: clist@REDACTED (Angel Alvarez) Date: Sat, 5 Dec 2009 18:37:19 +0100 Subject: New Intel manycore processor. Message-ID: <200912051837.19174.clist@uah.es> A new Intel toy is on the road... The new "Single-Chip Cloud Computer" (48 cores) apparently is focused to be marketed unlike his predecesor Polaris (80 cores) that was just a prototype. 48 cores arranged as 24 "tiles" of dual core full x86 capable processor interconnected with a 2d mesh network with 3 ddr memory ports. No cache coherency! " All cache communication between cores and tiles will thus be handled by the mesh data communication system and the dedicated "message buffer" on each tile" a perfect match for erlang model? Read more at: http://www.pcper.com/article.php?aid=825 Anyone interested can submit a form http://www.makebettercode.com/scc_software_research/form.php -- Agua para todo? No, Agua para Todos. ->>----------------------------------------------- Clist UAH a.k.a Angel ---------------------------------[www.uah.es]-<<-- HONEY BUNNY - Any of you *uckin' pricks move and I'll execute every mother*ucking last one of you. From erlangy@REDACTED Sat Dec 5 19:20:59 2009 From: erlangy@REDACTED (Michael) Date: Sat, 5 Dec 2009 10:20:59 -0800 Subject: [erlang-questions] Best way to interface Erlang with Java code In-Reply-To: <18a1db030912050927o1faff113g3ffd5083779ba623@mail.gmail.com> References: <18a1db030912050745r473683fboe722b1ec9a449d24@mail.gmail.com> <4B1A81FF.6050804@gmail.com> <18a1db030912050927o1faff113g3ffd5083779ba623@mail.gmail.com> Message-ID: <20091205182059.GE11530@delora.autosys.us> on my Linux box ... $ erl Erlang R13B03 (erts-5.7.4) [rq:1] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.7.4 (abort with ^G) 1> re:split(os:cmd("java x ; echo $?"),"\n"). [<<"Exception in thread \"main\" java.lang.NoClassDefFoundError: x">>, <<"1">>,<<>>] 2> On Sat, Dec 05, 2009 at 06:27:24PM +0100, zabrane Mikael wrote: > Hi Sean ! > > Ok I see. But how then cal I handle error code in Erlang if my Java program > crash or returns something different from error code 0? > > Thanks > Zabrane > > 2009/12/5 Sean Cribbs > > > zabrane Mikael wrote: > > > >> Hi List ! > >> > >> I've a small program written in "Java" which take a filename (input), > >> proceed it, and print out > >> a text (output). > >> > >> What's the best way to be able to access to that program from Erlang? > >> My whish is get back the "output" as an Erlang binary. > >> > >> Thanks > >> Zabrane > >> > >> > >> > > Use os:cmd/1, which returns a string/list - > > http://erldocs.com/R13B03/kernel/os.html?search=os&i=5 > > > > Sean > > From corticalcomputer@REDACTED Sat Dec 5 20:05:02 2009 From: corticalcomputer@REDACTED (G.S.) Date: Sat, 5 Dec 2009 11:05:02 -0800 Subject: [erlang-questions] New Intel manycore processor. In-Reply-To: <200912051837.19174.clist@uah.es> References: <200912051837.19174.clist@uah.es> Message-ID: <2a67d3ff0912051105y3e05c552kfa9e61dc3f85d5fe@mail.gmail.com> The only problem is that it's not for the public, and that there will only be a hundred or so of such processors offered to a very few companies/individuals. But other than that, yes, this and tilera are great, too bad they tanked larabee. On Sat, Dec 5, 2009 at 9:37 AM, Angel Alvarez wrote: > A new Intel toy is on the road... > > The new "Single-Chip Cloud Computer" (48 cores) apparently is > focused to be marketed unlike his predecesor Polaris (80 cores) > that was just a prototype. > > 48 cores arranged as 24 "tiles" of dual core full x86 capable processor > interconnected with a 2d mesh network with 3 ddr memory ports. > > No cache coherency! > > " All cache communication between cores and tiles will thus be handled > by the mesh data communication system and the dedicated "message buffer" on > each tile" > > a perfect match for erlang model? > > > Read more at: > > http://www.pcper.com/article.php?aid=825 > > > Anyone interested can submit a form > > http://www.makebettercode.com/scc_software_research/form.php > -- > Agua para todo? No, Agua para Todos. > ->>----------------------------------------------- > Clist UAH a.k.a Angel > ---------------------------------[www.uah.es]-<<-- > > HONEY BUNNY - Any of you *uckin' pricks move and I'll execute every > mother*ucking last one of you. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From the.ajarn@REDACTED Sat Dec 5 22:42:23 2009 From: the.ajarn@REDACTED (Brentley Jones) Date: Sat, 5 Dec 2009 15:42:23 -0600 Subject: Limit functions available to a process Message-ID: <50F33A05-1468-43AC-B7D7-76B6FEC5A53B@gmail.com> Hi list, I remember seeing in the list a topic which talked a proposal which would allow different functions being available from a module depending on context. One would be able to give a different name to a module and expose different functions to certain modules. (Maybe someone could find a link to this?) I only mention this to give context to what I want to be able to do. I know that currently in Erlang every process can call any function that it is exposed to. This includes the auto-imported "global" functions and BIFs, as well as all exported functions of other modules. I want to be able to limit a process, or module, from calling certain functions. For example, if I have the following module, with [1] being just one way to allow this, I want [2] below to produce either an undef or similar runtime error. %% sandbox.erl -module(sandbox). -unimport(os). %[1] -unimport(erlang, [spawn/1, spawn/2, spawn/3, spawn/4]). % [1] do_something_naughty() -> os:cmd("rm important_file"). % [2] There have been a couple "safe Erlang" topics started recently, and I know that this won't prevent a process from calling the function through RPC, but it is a start to sandboxing Erlang modules or processes. Since I know this currently isn't supported, where would I start looking (erl code or C code) to make this change? If I'm only thinking on the module level, is there a table that holds all exposed modules and/or functions? Thanks for your time, - Brentley Jones From the.ajarn@REDACTED Sat Dec 5 23:23:42 2009 From: the.ajarn@REDACTED (Brentley Jones) Date: Sat, 5 Dec 2009 14:23:42 -0800 (PST) Subject: Limit functions available to a process In-Reply-To: <50F33A05-1468-43AC-B7D7-76B6FEC5A53B@gmail.com> References: <50F33A05-1468-43AC-B7D7-76B6FEC5A53B@gmail.com> Message-ID: <0bda2127-8136-427a-aba2-264af2856946@j9g2000vbp.googlegroups.com> On Dec 5, 3:42?pm, Brentley Jones wrote: > I remember seeing in the list a topic which talked a proposal which would allow different functions being available from a module depending on context. One would be able to give a different name to a module and expose different functions to certain modules. (Maybe someone could find a link to this?) I found the topic that I was trying to explain: http://www.erlang.org/pipermail/erlang-questions/2006-November/023879.html It was before the google groups indexing, thus why I couldn't find it. O'Keefe's proposal would actually do what I want. By being able to define an environment that only has access to module a,c,b I would have what I want. From tony@REDACTED Sun Dec 6 00:17:39 2009 From: tony@REDACTED (Tony Arcieri) Date: Sat, 5 Dec 2009 16:17:39 -0700 Subject: What happens if the code server crashes? In-Reply-To: References: Message-ID: On Sat, Nov 28, 2009 at 1:09 PM, Tony Arcieri wrote: > What does Erlang do when a bug in the code server is encountered? > Nobody knows, huh? Kinda scary... -- Tony Arcieri Medioh/Nagravision From zabrane3@REDACTED Sun Dec 6 00:28:05 2009 From: zabrane3@REDACTED (zabrane Mikael) Date: Sun, 6 Dec 2009 00:28:05 +0100 Subject: [erlang-questions] Best way to interface Erlang with Java code In-Reply-To: <20091205182059.GE11530@delora.autosys.us> References: <18a1db030912050745r473683fboe722b1ec9a449d24@mail.gmail.com> <4B1A81FF.6050804@gmail.com> <18a1db030912050927o1faff113g3ffd5083779ba623@mail.gmail.com> <20091205182059.GE11530@delora.autosys.us> Message-ID: <18a1db030912051528t327ef931yd60282d93ecbb72f@mail.gmail.com> Thanks Michael. 2009/12/5 Michael > on my Linux box ... > > $ erl > Erlang R13B03 (erts-5.7.4) [rq:1] [async-threads:0] [hipe] > [kernel-poll:false] > > Eshell V5.7.4 (abort with ^G) > 1> re:split(os:cmd("java x ; echo $?"),"\n"). > [<<"Exception in thread \"main\" java.lang.NoClassDefFoundError: x">>, > <<"1">>,<<>>] > 2> > > > On Sat, Dec 05, 2009 at 06:27:24PM +0100, zabrane Mikael wrote: > > Hi Sean ! > > > > Ok I see. But how then cal I handle error code in Erlang if my Java > program > > crash or returns something different from error code 0? > > > > Thanks > > Zabrane > > > > 2009/12/5 Sean Cribbs > > > > > zabrane Mikael wrote: > > > > > >> Hi List ! > > >> > > >> I've a small program written in "Java" which take a filename (input), > > >> proceed it, and print out > > >> a text (output). > > >> > > >> What's the best way to be able to access to that program from Erlang? > > >> My whish is get back the "output" as an Erlang binary. > > >> > > >> Thanks > > >> Zabrane > > >> > > >> > > >> > > > Use os:cmd/1, which returns a string/list - > > > http://erldocs.com/R13B03/kernel/os.html?search=os&i=5 > > > > > > Sean > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From jerome@REDACTED Sun Dec 6 00:44:11 2009 From: jerome@REDACTED (=?ISO-8859-1?Q?J=E9r=F4me_Desquilbet?=) Date: Sun, 06 Dec 2009 00:44:11 +0100 Subject: [erlang-questions] Re: What happens if the code server crashes? In-Reply-To: References: Message-ID: <4B1AF04B.9030304@desquilbet.org> Tony Arcieri a ?crit : > On Sat, Nov 28, 2009 at 1:09 PM, Tony Arcieri wrote: > >> What does Erlang do when a bug in the code server is encountered? >> > > Nobody knows, huh? Kinda scary... > It restarts the server? J. From zabrane3@REDACTED Sun Dec 6 01:31:05 2009 From: zabrane3@REDACTED (zabrane Mikael) Date: Sun, 6 Dec 2009 01:31:05 +0100 Subject: [erlang-questions] Best way to interface Erlang with Java code In-Reply-To: <18a1db030912051528t327ef931yd60282d93ecbb72f@mail.gmail.com> References: <18a1db030912050745r473683fboe722b1ec9a449d24@mail.gmail.com> <4B1A81FF.6050804@gmail.com> <18a1db030912050927o1faff113g3ffd5083779ba623@mail.gmail.com> <20091205182059.GE11530@delora.autosys.us> <18a1db030912051528t327ef931yd60282d93ecbb72f@mail.gmail.com> Message-ID: <18a1db030912051631l383d73ak944144680e97d109@mail.gmail.com> What's the status of "erlexec" at: http://code.google.com/p/erlexec It seems ideal for my problem. Is it still maintained by "Serge Aleynikov"? Regards Zabrane 2009/12/6 zabrane Mikael > Thanks Michael. > > 2009/12/5 Michael > > on my Linux box ... >> >> $ erl >> Erlang R13B03 (erts-5.7.4) [rq:1] [async-threads:0] [hipe] >> [kernel-poll:false] >> >> Eshell V5.7.4 (abort with ^G) >> 1> re:split(os:cmd("java x ; echo $?"),"\n"). >> [<<"Exception in thread \"main\" java.lang.NoClassDefFoundError: x">>, >> <<"1">>,<<>>] >> 2> >> >> >> On Sat, Dec 05, 2009 at 06:27:24PM +0100, zabrane Mikael wrote: >> > Hi Sean ! >> > >> > Ok I see. But how then cal I handle error code in Erlang if my Java >> program >> > crash or returns something different from error code 0? >> > >> > Thanks >> > Zabrane >> > >> > 2009/12/5 Sean Cribbs >> > >> > > zabrane Mikael wrote: >> > > >> > >> Hi List ! >> > >> >> > >> I've a small program written in "Java" which take a filename (input), >> > >> proceed it, and print out >> > >> a text (output). >> > >> >> > >> What's the best way to be able to access to that program from Erlang? >> > >> My whish is get back the "output" as an Erlang binary. >> > >> >> > >> Thanks >> > >> Zabrane >> > >> >> > >> >> > >> >> > > Use os:cmd/1, which returns a string/list - >> > > http://erldocs.com/R13B03/kernel/os.html?search=os&i=5 >> > > >> > > Sean >> > > >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> > From seancribbs@REDACTED Sun Dec 6 02:39:45 2009 From: seancribbs@REDACTED (Sean Cribbs) Date: Sat, 05 Dec 2009 20:39:45 -0500 Subject: [ANN] Neotoma 1.4 Message-ID: <4B1B0B61.7000802@gmail.com> I'm pleased to announce another update to Neotoma. The features and changes in this release are: * Concurrent parsing is supported, as the memoization ets table no longer uses the named_table option. * You can retrieve the tid of the memoization table using memo_table_name/0 from within your inline or additional code. * Additional code (currently specified at the bottom of the grammar) will be placed at the top of the generated parser, allowing macro definitions and other module attributes to be added. Many thanks to Vsevolod Balashov for assisting with the concurrent parsing issue. What is Neotoma? Neotoma is a packrat parser-generator for Erlang for Parsing Expression Grammars (PEGs). It consists of a parsing-combinator library with memoization routines, a parser for PEGs, and a utility to generate parsers from PEGs. It is inspired by treetop, a Ruby library with similar aims, and parsec, the parser-combinator library for Haskell. Browse & Fork: http://github.com/seancribbs/neotoma Download: http://github.com/seancribbs/neotoma/downloads Source: git clone git://github.com/seancribbs/neotoma.git Discussion: http://groups.google.com/group/neotoma-erl Cheers, Sean Cribbs From nem@REDACTED Sun Dec 6 08:29:43 2009 From: nem@REDACTED (Geoff Cant) Date: Sun, 06 Dec 2009 20:29:43 +1300 Subject: [erlang-questions] Re: What happens if the code server crashes? In-Reply-To: (Tony Arcieri's message of "Sat, 5 Dec 2009 16:17:39 -0700") References: Message-ID: Tony Arcieri writes: > On Sat, Nov 28, 2009 at 1:09 PM, Tony Arcieri wrote: > >> What does Erlang do when a bug in the code server is encountered? >> > > Nobody knows, huh? Kinda scary... The node shuts down - the code_server is attached to the kernel_sup, and any crash of a kernel_sup child results in a node shutdown. See the comments around http://github.com/erlang/otp/blob/ccase/r13b04_dev/lib/kernel/src/kernel.erl#L61 You can see this for yourself via exit(whereis(code_server), kill) in the shell. Cheers, -- Geoff Cant From johann.hoechtl@REDACTED Sun Dec 6 12:06:58 2009 From: johann.hoechtl@REDACTED (=?ISO-8859-1?Q?Johann_H=F6chtl?=) Date: Sun, 6 Dec 2009 03:06:58 -0800 (PST) Subject: Port forwarding / managed web Message-ID: Hello, I have been out of programming the last five years. During this time the world considerably changed, especially when it comes to web frameworks. Back then, everything was served by apache (eg. PHP),or on windows IIS (.NET worker process) and the frameworks were citizens of the web servers. In the Erlang world this seems considerably different. Nitrogen, webmachine, Erlang Web preferably embed a web server (Yaws, mochiweb), instead of beeing an application served in an existing web framework. Let's assume, that I have multiple web applications runing on different ports, possibly load balanced by the distributed nature of erlang. What I woud like to achive is that incoming request are all routed to port 80 (or 443 resp.) eg, /application1, /application2 and internally forwarded to the respective applications. I know that this question is not necessarily erlang centric. Can somebody give me some hints as how to set up a web ecosystem in a unix/linux environment, that best suits that requirement? Thank you, Johann From rapsey@REDACTED Sun Dec 6 13:11:32 2009 From: rapsey@REDACTED (Rapsey) Date: Sun, 6 Dec 2009 13:11:32 +0100 Subject: [erlang-questions] Port forwarding / managed web In-Reply-To: References: Message-ID: <97619b170912060411t6c346702x2ae7970b3039dcc3@mail.gmail.com> I use haproxy or nginx on port 80/443 that reverse proxy connections to my Erlang server. That way I don't have erlang running as root. nginx is great because it handles https and can serve static content at the same time, but has a crappy way of handling file uploads, so I use haproxy when I need that. Sergej On Sun, Dec 6, 2009 at 12:06 PM, Johann H?chtl wrote: > Hello, > > I have been out of programming the last five years. During this time > the world considerably changed, especially when it comes to web > frameworks. Back then, everything was served by apache (eg. PHP),or on > windows IIS (.NET worker process) and the frameworks were citizens of > the web servers. > > In the Erlang world this seems considerably different. Nitrogen, > webmachine, Erlang Web preferably embed a web server (Yaws, mochiweb), > instead of beeing an application served in an existing web framework. > > Let's assume, that I have multiple web applications runing on > different ports, possibly load balanced by the distributed nature of > erlang. What I woud like to achive is that incoming request are all > routed to port 80 (or 443 resp.) eg, /application1, /application2 and > internally forwarded to the respective applications. > > I know that this question is not necessarily erlang centric. > > Can somebody give me some hints as how to set up a web ecosystem in a > unix/linux environment, that best suits that requirement? > > Thank you, > > Johann > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From tony@REDACTED Sun Dec 6 19:23:47 2009 From: tony@REDACTED (Tony Arcieri) Date: Sun, 6 Dec 2009 11:23:47 -0700 Subject: [erlang-questions] Re: What happens if the code server crashes? In-Reply-To: References: Message-ID: Aha, this is the behavior I was expecting. Thanks for the details about how it's implemented. On Sun, Dec 6, 2009 at 12:29 AM, Geoff Cant wrote: > Tony Arcieri writes: > > > On Sat, Nov 28, 2009 at 1:09 PM, Tony Arcieri wrote: > > > >> What does Erlang do when a bug in the code server is encountered? > >> > > > > Nobody knows, huh? Kinda scary... > > The node shuts down - the code_server is attached to the kernel_sup, and > any crash of a kernel_sup child results in a node shutdown. See the > comments around > > http://github.com/erlang/otp/blob/ccase/r13b04_dev/lib/kernel/src/kernel.erl#L61 > > You can see this for yourself via exit(whereis(code_server), kill) in > the shell. > > Cheers, > -- > Geoff Cant > > -- Tony Arcieri Medioh/Nagravision From tony@REDACTED Sun Dec 6 21:41:01 2009 From: tony@REDACTED (Tony Rogvall) Date: Sun, 6 Dec 2009 21:41:01 +0100 Subject: on_load Message-ID: <3A6811C4-D5A5-43AB-B707-8F8CE0DA4BEE@rogvall.se> I am trying the on_load feature. I did: -on_load(auto_start/0). In a generic server code. Then I defined auto_start as: %% called when module is loaded auto_start() -> io:format("auto_start\n"), Result = start(), io:format("result = ~p\n", [Result]), true. Where start/0 is the normal: start() -> gen_server:start({local, ?SERVER}, ?MODULE, [], []). Question. Is this supposed to be working ? Why not? Currently I get the the "auto_start" output and the the gen_server is registered. Apart from that it is hanging. /Tony From mpalmer@REDACTED Sun Dec 6 23:36:12 2009 From: mpalmer@REDACTED (Matthew Palmer) Date: Mon, 7 Dec 2009 09:36:12 +1100 Subject: Port forwarding / managed web In-Reply-To: References: Message-ID: <20091206223612.GI25450@hezmatt.org> On Sun, Dec 06, 2009 at 03:06:58AM -0800, Johann H?chtl wrote: > Let's assume, that I have multiple web applications runing on > different ports, possibly load balanced by the distributed nature of > erlang. What I woud like to achive is that incoming request are all > routed to port 80 (or 443 resp.) eg, /application1, /application2 and > internally forwarded to the respective applications. Use a "real" webserver to accept the requests on port 80/443, do whatever request decoding is required, and then use the internal proxy modules (mod_proxy on Apache, HttpProxyModule for nginx) to pass the requests back to the applications as required. - Matt From ok@REDACTED Mon Dec 7 02:29:26 2009 From: ok@REDACTED (Richard O'Keefe) Date: Mon, 7 Dec 2009 14:29:26 +1300 Subject: [erlang-questions] case statements really required?? In-Reply-To: <4B190CCC.1030504@gmail.com> References: <4B190A5D.1030006@geodesic.com> <4B190CCC.1030504@gmail.com> Message-ID: <302990E9-B99B-4835-A5B9-644FD2506232@cs.otago.ac.nz> > kiran wrote: >> hi, >> is it good to use case statements in functional language.. >> according to me .. pattern matching-functions could do the task. >> any commnets?? Multiclause pattern-matching functions and case expressions do exactly the same thing; except for the error message you get when there is no match either can be trivially converted to the other. You should consider questions like - can you give this part of your program a meaningful name? [If so, it might make a good function.] - would this part of your program be useful elsewhere, perhaps with a few constants replaced by variables? [If so, it might make a good function.] - is the normal flow of your code obscured by bulky code that could be moved elsewhere? [If so, it might be useful to split it out as a function, or you could use a literate programming tool, but in either case you'll have to find a good name for it]. From ok@REDACTED Mon Dec 7 02:48:14 2009 From: ok@REDACTED (Richard O'Keefe) Date: Mon, 7 Dec 2009 14:48:14 +1300 Subject: [erlang-questions] Best practice for defining functions with edoc,erlc,eunit and the dialyzer In-Reply-To: <4d08db370912040957k4b58d363h1d9c83f5cc6e412d@mail.gmail.com> References: <9b08084c0912020128w6d5e685dq2dd259e82806d2aa@mail.gmail.com> <4B1641F8.2040708@tmit.bme.hu> <5AA5B557-9354-4B89-BBA7-A6DE3775A52A@cs.otago.ac.nz> <50763.194.88.55.211.1259834150.squirrel@localhost> <62572D38-D2B5-4E60-961D-43B270FF9A81@cs.otago.ac.nz> <4d08db370912040957k4b58d363h1d9c83f5cc6e412d@mail.gmail.com> Message-ID: <5FB71126-B36E-460E-B36E-791097610A17@cs.otago.ac.nz> On Dec 5, 2009, at 6:57 AM, Hynek Vychodil wrote: > I can't believe you forgot one most important think about internal > exports, It is mandatory for hot code swapping. You're right, I not only didn't _mention_ that use of internal exports, I didn't _think_ of it. The reason is that I was only really thinking about the internal exports that *shouldn't* be there any more, which is most of them. Strictly speaking, in hot code swapping these aren't really _internal_ exports: they are there to let the old version of a module call the new version, so they are really about calls between two different modules. But that's quibbling. I've just added another style check to my Smalltalk compiler. I've actually found such things more helpful in finding bugs than type checking would have been. So this got me thinking about a style check here: If a module is likely to contain a long-running computation, it SHOULD have a call through ?MODULE:loop(...) somewhere. What exactly should a style check like this look like? One thing that occurs to me is that if you have - a recursive function - in which at least one recursive call is ?MODULE:... - then every recursive call should probably use the ?MODULE: prefix - and the recursive calls should be tail calls. From ok@REDACTED Mon Dec 7 03:21:27 2009 From: ok@REDACTED (Richard O'Keefe) Date: Mon, 7 Dec 2009 15:21:27 +1300 Subject: [erlang-questions] Add hibernate/1 (was: Best practice for defining functions with edoc,erlc,eunit and the dialyzer) In-Reply-To: <1259992723.2990.3.camel@piko.site> References: <9b08084c0912020128w6d5e685dq2dd259e82806d2aa@mail.gmail.com> <4B1641F8.2040708@tmit.bme.hu> <5AA5B557-9354-4B89-BBA7-A6DE3775A52A@cs.otago.ac.nz> <50763.194.88.55.211.1259834150.squirrel@localhost> <5E380FDF-B61C-4701-8F85-7D6BC7E0BDF8@cs.otago.ac.nz> <1259992723.2990.3.camel@piko.site> Message-ID: On Dec 5, 2009, at 6:58 PM, Alp?r J?ttner wrote: > I can see another (very small) class: > (D) functions to be invoked by timer:tc/3. This should be added to my quasi-EEP about hibernate/3. It is in fact another class where there *shouldn't* be an internal export, but it's forced because the library isn't up to date yet. I have revised my quasi-EEP to include Add the following code to stdlib/src/timer.erl %% %% Measure the execution time (in microseconds) for a Fun. %% -spec tc(fun(() -> T)) -> {time(), T}. tc(Fun) when is_function(Fun, 0) -> Before = erlang:now(), Value = (catch Fun()), After = erlang:now(), {now_diff(After, Before), Value}. Add the following documentation for timer: tc(Fun) Types: Fun = fun() Evaluates Fun() and measures the elapsed real time. Returns {Time, Value}, where Time is the elapsed real time in microseconds, and Value is what is returned by the Fun(). From zabrane3@REDACTED Mon Dec 7 03:37:25 2009 From: zabrane3@REDACTED (zabrane Mikael) Date: Mon, 7 Dec 2009 03:37:25 +0100 Subject: [erlang-questions] Best way to interface Erlang with Java code In-Reply-To: <20091205182059.GE11530@delora.autosys.us> References: <18a1db030912050745r473683fboe722b1ec9a449d24@mail.gmail.com> <4B1A81FF.6050804@gmail.com> <18a1db030912050927o1faff113g3ffd5083779ba623@mail.gmail.com> <20091205182059.GE11530@delora.autosys.us> Message-ID: <18a1db030912061837w7ad4591fy9f8b26b9431f1fbd@mail.gmail.com> Hi Michael ! I found a subtle problem when trying your solution when my program returns a text with one or more "\n". Eg: 1> re:split (os:cmd ("java transform animals.txt ; echo $?"), "\n"). [<<"Cat">>, <<"Shark">>, ........ % a lot of animal names here (more than 1000) <<"Wolf">>, <<"1">>,<<>>] 2> How then can I distinguish between my program output and the error code (which is at the end of the list) ? Thanks Zabrane 2009/12/5 Michael > on my Linux box ... > > $ erl > Erlang R13B03 (erts-5.7.4) [rq:1] [async-threads:0] [hipe] > [kernel-poll:false] > > Eshell V5.7.4 (abort with ^G) > 1> re:split(os:cmd("java x ; echo $?"),"\n"). > [<<"Exception in thread \"main\" java.lang.NoClassDefFoundError: x">>, > <<"1">>,<<>>] > 2> > > > On Sat, Dec 05, 2009 at 06:27:24PM +0100, zabrane Mikael wrote: > > Hi Sean ! > > > > Ok I see. But how then cal I handle error code in Erlang if my Java > program > > crash or returns something different from error code 0? > > > > Thanks > > Zabrane > > > > 2009/12/5 Sean Cribbs > > > > > zabrane Mikael wrote: > > > > > >> Hi List ! > > >> > > >> I've a small program written in "Java" which take a filename (input), > > >> proceed it, and print out > > >> a text (output). > > >> > > >> What's the best way to be able to access to that program from Erlang? > > >> My whish is get back the "output" as an Erlang binary. > > >> > > >> Thanks > > >> Zabrane > > >> > > >> > > >> > > > Use os:cmd/1, which returns a string/list - > > > http://erldocs.com/R13B03/kernel/os.html?search=os&i=5 > > > > > > Sean > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From erlangy@REDACTED Mon Dec 7 04:13:52 2009 From: erlangy@REDACTED (Michael McDaniel) Date: Sun, 6 Dec 2009 19:13:52 -0800 Subject: [erlang-questions] Best way to interface Erlang with Java code In-Reply-To: <18a1db030912061837w7ad4591fy9f8b26b9431f1fbd@mail.gmail.com> References: <18a1db030912050745r473683fboe722b1ec9a449d24@mail.gmail.com> <4B1A81FF.6050804@gmail.com> <18a1db030912050927o1faff113g3ffd5083779ba623@mail.gmail.com> <20091205182059.GE11530@delora.autosys.us> <18a1db030912061837w7ad4591fy9f8b26b9431f1fbd@mail.gmail.com> Message-ID: <20091207031351.GP11530@delora.autosys.us> one way ... 1> L = re:split (os:cmd ("java transform animals.txt ; echo $?"), "\n"). [<<"Cat">>, <<"Shark">>, ........ % a lot of animal names here (more than 1000) <<"Wolf">>, <<"1">>,<<>>] 2> Ret = lists:nth( 2, lists:reverse( L ) ) . <<"1">> 3> case Ret 3> of <<"0">> -> do_something ; 3> _ -> do_something_else 3> end. failure read up on lists and re modules for different ways of playing with the output ~Michael On Mon, Dec 07, 2009 at 03:37:25AM +0100, zabrane Mikael wrote: > Hi Michael ! > > I found a subtle problem when trying your solution when my program returns a > text with one or more "\n". > > Eg: > 1> re:split (os:cmd ("java transform animals.txt ; echo $?"), "\n"). > [<<"Cat">>, > <<"Shark">>, > ........ % a lot of animal names here (more than 1000) > <<"Wolf">>, > <<"1">>,<<>>] > 2> > > How then can I distinguish between my program output and the error code > (which is at the end of the list) ? > > Thanks > Zabrane > > 2009/12/5 Michael > > > on my Linux box ... > > > > $ erl > > Erlang R13B03 (erts-5.7.4) [rq:1] [async-threads:0] [hipe] > > [kernel-poll:false] > > > > Eshell V5.7.4 (abort with ^G) > > 1> re:split(os:cmd("java x ; echo $?"),"\n"). > > [<<"Exception in thread \"main\" java.lang.NoClassDefFoundError: x">>, > > <<"1">>,<<>>] > > 2> > > > > > > On Sat, Dec 05, 2009 at 06:27:24PM +0100, zabrane Mikael wrote: > > > Hi Sean ! > > > > > > Ok I see. But how then cal I handle error code in Erlang if my Java > > program > > > crash or returns something different from error code 0? > > > > > > Thanks > > > Zabrane > > > > > > 2009/12/5 Sean Cribbs > > > > > > > zabrane Mikael wrote: > > > > > > > >> Hi List ! > > > >> > > > >> I've a small program written in "Java" which take a filename (input), > > > >> proceed it, and print out > > > >> a text (output). > > > >> > > > >> What's the best way to be able to access to that program from Erlang? > > > >> My whish is get back the "output" as an Erlang binary. > > > >> > > > >> Thanks > > > >> Zabrane > > > >> > > > >> > > > >> > > > > Use os:cmd/1, which returns a string/list - > > > > http://erldocs.com/R13B03/kernel/os.html?search=os&i=5 > > > > > > > > Sean > > > > > > > > ________________________________________________________________ > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > erlang-questions (at) erlang.org > > From erlangy@REDACTED Mon Dec 7 05:00:33 2009 From: erlangy@REDACTED (Michael McDaniel) Date: Sun, 6 Dec 2009 20:00:33 -0800 Subject: [erlang-questions] Best way to interface Erlang with Java code In-Reply-To: <20091207031351.GP11530@delora.autosys.us> References: <18a1db030912050745r473683fboe722b1ec9a449d24@mail.gmail.com> <4B1A81FF.6050804@gmail.com> <18a1db030912050927o1faff113g3ffd5083779ba623@mail.gmail.com> <20091205182059.GE11530@delora.autosys.us> <18a1db030912061837w7ad4591fy9f8b26b9431f1fbd@mail.gmail.com> <20091207031351.GP11530@delora.autosys.us> Message-ID: <20091207040032.GQ11530@delora.autosys.us> and another using extra re features ... 1> Cmd = "java transform animals.txt ; echo $?" . "java transform animals.txt ; echo $?" . 2> {match, [Val,Ret]} = re:run( os:cmd(Cmd), "(?.*)(?[0-9])\\n$", [dotall,ungreedy,{capture,['VAL','RETCODE'],list}]). {match, ["Cat\nShark\n...", "1"]} 3> Ret. "1" 4> Val. "Cat\nShark\n..." 5> re:split(Val, "\n", [{return,list}]). ["Cat", "Shark", ...] the above presumes single digit return codes os:cmd/1 is not the only tool to get other program output; e.g. running via a port, or using jinterface. Or maybe the new NIF experimental feature in R13B03. ~M On Sun, Dec 06, 2009 at 07:13:52PM -0800, Michael McDaniel wrote: > one way ... > > > 1> L = re:split (os:cmd ("java transform animals.txt ; echo $?"), "\n"). > [<<"Cat">>, > <<"Shark">>, > ........ % a lot of animal names here (more than 1000) > <<"Wolf">>, > <<"1">>,<<>>] > > 2> Ret = lists:nth( 2, lists:reverse( L ) ) . > <<"1">> > 3> case Ret > 3> of <<"0">> -> do_something ; > 3> _ -> do_something_else > 3> end. > failure > > > read up on lists and re modules for different ways of playing with > the output > > ~Michael > > > On Mon, Dec 07, 2009 at 03:37:25AM +0100, zabrane Mikael wrote: > > Hi Michael ! > > > > I found a subtle problem when trying your solution when my program returns a > > text with one or more "\n". > > > > Eg: > > 1> re:split (os:cmd ("java transform animals.txt ; echo $?"), "\n"). > > [<<"Cat">>, > > <<"Shark">>, > > ........ % a lot of animal names here (more than 1000) > > <<"Wolf">>, > > <<"1">>,<<>>] > > 2> > > > > How then can I distinguish between my program output and the error code > > (which is at the end of the list) ? > > > > Thanks > > Zabrane > > > > 2009/12/5 Michael > > > > > on my Linux box ... > > > > > > $ erl > > > Erlang R13B03 (erts-5.7.4) [rq:1] [async-threads:0] [hipe] > > > [kernel-poll:false] > > > > > > Eshell V5.7.4 (abort with ^G) > > > 1> re:split(os:cmd("java x ; echo $?"),"\n"). > > > [<<"Exception in thread \"main\" java.lang.NoClassDefFoundError: x">>, > > > <<"1">>,<<>>] > > > 2> > > > > > > > > > On Sat, Dec 05, 2009 at 06:27:24PM +0100, zabrane Mikael wrote: > > > > Hi Sean ! > > > > > > > > Ok I see. But how then cal I handle error code in Erlang if my Java > > > program > > > > crash or returns something different from error code 0? > > > > > > > > Thanks > > > > Zabrane > > > > > > > > 2009/12/5 Sean Cribbs > > > > > > > > > zabrane Mikael wrote: > > > > > > > > > >> Hi List ! > > > > >> > > > > >> I've a small program written in "Java" which take a filename (input), > > > > >> proceed it, and print out > > > > >> a text (output). > > > > >> > > > > >> What's the best way to be able to access to that program from Erlang? > > > > >> My whish is get back the "output" as an Erlang binary. > > > > >> > > > > >> Thanks > > > > >> Zabrane > > > > >> > > > > >> > > > > >> > > > > > Use os:cmd/1, which returns a string/list - > > > > > http://erldocs.com/R13B03/kernel/os.html?search=os&i=5 > > > > > > > > > > Sean > > > > > > > > > > > ________________________________________________________________ > > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > > erlang-questions (at) erlang.org > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From kagato@REDACTED Mon Dec 7 05:51:18 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Sun, 6 Dec 2009 20:51:18 -0800 Subject: [erlang-questions] Best way to interface Erlang with Java code In-Reply-To: <20091207040032.GQ11530@delora.autosys.us> References: <18a1db030912050745r473683fboe722b1ec9a449d24@mail.gmail.com> <4B1A81FF.6050804@gmail.com> <18a1db030912050927o1faff113g3ffd5083779ba623@mail.gmail.com> <20091205182059.GE11530@delora.autosys.us> <18a1db030912061837w7ad4591fy9f8b26b9431f1fbd@mail.gmail.com> <20091207031351.GP11530@delora.autosys.us> <20091207040032.GQ11530@delora.autosys.us> Message-ID: <2A18EDDA-D9F8-48BB-A60A-8ED726754F4A@souja.net> I've been watching this thread and something's been nagging at me but I couldn't remember what it was. I remembered. I almost never use os:cmd, but use erlang:open_port/2 instead. It turns out you can do something like this: > Command = "my command executable", > Args = ["arg1","arg2","arg3"], > Cwd = "/some/directory", > Env = [ {"some_var","some_val"}, {"other_var","other_val"} ], > Port = open_port( {spawn_executable, Command}, [ {args,Args}, {cd, Cwd}, {env,Env}, exit_status ] ). This is pretty handy because: * It doesn't go through the shell unless you explicitly make it do so. * Commands or paths containing spaces are not a problem. * Args with spaces are not a problem. * Full control over the environment and cwd. * All data comes in as Erlang messages that can be "received". There are also a number of other options I didn't use which are quite handy: * Packet-mode: If you control the program being run, you can prepend chunks of data with their length and you don't have to worry about framing or partial reads. * Line-mode: Data is sent a line at a time. * EOF detection: You can receive a message when the file is closed. * You can set arg0, which is handy for some programs (busybox comes to mind). * nouse_stdio: Allows you to use file descriptors other than 0 and 1 to communicate with Erlang. * stderr__to_stdout: Easily captures stderr without any shell trickery. * binary: Get all data as binaries, this is exceptionally nice with packet mode. * hide: hides console window when using Windows Depending on your willingness to modify the Java program, you might be able to greatly simplify what you're doing. I suspect that it won't even require any regexps. Of the top of my head, I'd be inclined to use line mode, and take each line at a time. Then you just receive a bunch of {eol,Line} messages, with a {Port,{exit_status,Status}} message at the end. If you want to make it a bit more sophisticated, you could use packet mode with similar results. Also, have you looked at jinterface? It can be a Java program appear as an Erlang node. On Dec 6, 2009, at 8:00 PM, Michael McDaniel wrote: > and another using extra re features ... > > > 1> Cmd = "java transform animals.txt ; echo $?" . > "java transform animals.txt ; echo $?" . > 2> {match, [Val,Ret]} = > re:run( os:cmd(Cmd), > "(?.*)(?[0-9])\\n$", > [dotall,ungreedy,{capture,['VAL','RETCODE'],list}]). > {match, ["Cat\nShark\n...", "1"]} > 3> Ret. > "1" > 4> Val. > "Cat\nShark\n..." > 5> re:split(Val, "\n", [{return,list}]). > ["Cat", "Shark", ...] > > > the above presumes single digit return codes > > os:cmd/1 is not the only tool to get other program output; e.g. running > via a port, or using jinterface. Or maybe the new NIF experimental > feature in R13B03. > > > ~M > > > On Sun, Dec 06, 2009 at 07:13:52PM -0800, Michael McDaniel wrote: >> one way ... >> >> >> 1> L = re:split (os:cmd ("java transform animals.txt ; echo $?"), "\n"). >> [<<"Cat">>, >> <<"Shark">>, >> ........ % a lot of animal names here (more than 1000) >> <<"Wolf">>, >> <<"1">>,<<>>] >> >> 2> Ret = lists:nth( 2, lists:reverse( L ) ) . >> <<"1">> >> 3> case Ret >> 3> of <<"0">> -> do_something ; >> 3> _ -> do_something_else >> 3> end. >> failure >> >> >> read up on lists and re modules for different ways of playing with >> the output >> >> ~Michael >> >> >> On Mon, Dec 07, 2009 at 03:37:25AM +0100, zabrane Mikael wrote: >>> Hi Michael ! >>> >>> I found a subtle problem when trying your solution when my program returns a >>> text with one or more "\n". >>> >>> Eg: >>> 1> re:split (os:cmd ("java transform animals.txt ; echo $?"), "\n"). >>> [<<"Cat">>, >>> <<"Shark">>, >>> ........ % a lot of animal names here (more than 1000) >>> <<"Wolf">>, >>> <<"1">>,<<>>] >>> 2> >>> >>> How then can I distinguish between my program output and the error code >>> (which is at the end of the list) ? >>> >>> Thanks >>> Zabrane >>> >>> 2009/12/5 Michael >>> >>>> on my Linux box ... >>>> >>>> $ erl >>>> Erlang R13B03 (erts-5.7.4) [rq:1] [async-threads:0] [hipe] >>>> [kernel-poll:false] >>>> >>>> Eshell V5.7.4 (abort with ^G) >>>> 1> re:split(os:cmd("java x ; echo $?"),"\n"). >>>> [<<"Exception in thread \"main\" java.lang.NoClassDefFoundError: x">>, >>>> <<"1">>,<<>>] >>>> 2> >>>> >>>> >>>> On Sat, Dec 05, 2009 at 06:27:24PM +0100, zabrane Mikael wrote: >>>>> Hi Sean ! >>>>> >>>>> Ok I see. But how then cal I handle error code in Erlang if my Java >>>> program >>>>> crash or returns something different from error code 0? >>>>> >>>>> Thanks >>>>> Zabrane >>>>> >>>>> 2009/12/5 Sean Cribbs >>>>> >>>>>> zabrane Mikael wrote: >>>>>> >>>>>>> Hi List ! >>>>>>> >>>>>>> I've a small program written in "Java" which take a filename (input), >>>>>>> proceed it, and print out >>>>>>> a text (output). >>>>>>> >>>>>>> What's the best way to be able to access to that program from Erlang? >>>>>>> My whish is get back the "output" as an Erlang binary. >>>>>>> >>>>>>> Thanks >>>>>>> Zabrane >>>>>>> >>>>>>> >>>>>>> >>>>>> Use os:cmd/1, which returns a string/list - >>>>>> http://erldocs.com/R13B03/kernel/os.html?search=os&i=5 >>>>>> >>>>>> Sean >>>>>> >>>> >>>> ________________________________________________________________ >>>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>>> erlang-questions (at) erlang.org >>>> >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > -- Jayson Vantuyl kagato@REDACTED From max.lapshin@REDACTED Mon Dec 7 07:27:25 2009 From: max.lapshin@REDACTED (Max Lapshin) Date: Mon, 7 Dec 2009 09:27:25 +0300 Subject: [erlang-questions] Re: Port forwarding / managed web In-Reply-To: <20091206223612.GI25450@hezmatt.org> References: <20091206223612.GI25450@hezmatt.org> Message-ID: On Mon, Dec 7, 2009 at 1:36 AM, Matthew Palmer wrote: > Use a "real" webserver to accept the requests on port 80/443, do whatever > request decoding is required, and then use the internal proxy modules > (mod_proxy on Apache, HttpProxyModule for nginx) to pass the requests back > to the applications as required. It is very, very bad idea to hide erlang after Apache. Even the smallest and the worst web server on erlang will be much more superiour than Apache. From kagato@REDACTED Mon Dec 7 09:53:41 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Mon, 7 Dec 2009 00:53:41 -0800 Subject: test_server and timetraps Message-ID: <5B75AEBD-20AA-4B5B-AA7E-55586A2094BB@souja.net> Just to save anybody else the trouble, test_server has some... interesting behavior. I had tests with timeouts of 5 seconds that would run for 15 and still not be killed. This seemed odd, so I checked it out. Apparently, when certain options are turned on, the test_server will scale up your timeouts. Buried deep within the bowels of test_server, there is a sprinkling of code that determines a "multiplier" for your timetraps. Apparently, it considers running under code coverage reason to scale your timeout by a factor of 10! This was definitely a surprise. Although, I admit that the fact that running on VXworks increases timeouts by another factor 5 was good for a laugh. I decided to mail the list so that this would be on the webs for people to find. It turns out that it is documented in test_server, but not in common_test. Can somebody document this in common_test, so that people don't wonder why their timetraps seemingly never kick in? The built in testing / debugging / tracing under Erlang is absolutely wonderful, but it's so woefully documented that I'm surprised that anybody uses it. Let's just say a 12 minute timeout becoming a two hour timeout is not "expected behavior". :( -- Jayson Vantuyl kagato@REDACTED From erlang@REDACTED Mon Dec 7 10:45:13 2009 From: erlang@REDACTED (Joe Armstrong) Date: Mon, 7 Dec 2009 10:45:13 +0100 Subject: [erlang-questions] case statements really required?? In-Reply-To: <302990E9-B99B-4835-A5B9-644FD2506232@cs.otago.ac.nz> References: <4B190A5D.1030006@geodesic.com> <4B190CCC.1030504@gmail.com> <302990E9-B99B-4835-A5B9-644FD2506232@cs.otago.ac.nz> Message-ID: <9b08084c0912070145k1d7c643avf134bb4c5bf0d58c@mail.gmail.com> Originally, back in the days when Erlang was sub-set of Prolog and had only two users, Erlang had no case or if statements. These were added as a convenience - before this there were only pattern matching clauses. It's easy (though tedious) to transform code with a case statement like this: foo(X, Y) -> A = 1, B = 2, case X of a -> A + Y; b -> B + Y end. Into pure pattern matching code, like this: foo(X, Y) -> A = 1, B = 2, foo1(X, Y, {A,B}) foo1(a, Y, {A,B}) -> A + Y; foo1(b, Y, {A,B}) -> B + Y. The reason why case statements are nice is that the variable bindings created before 'case' was evaluated are available inside the body of the case statement (in my example the variables A and B). Without using a case statement these variable must be explicitly imported into the pattern matching code (these appeared as the tuple {A,B} in the call to foo1. Doing this correctly for all edge cases, when the function is complex and has multiple clauses is "a wee bit tricky (TM)" that's why the compiler does it for you. In fact what happens is exactly the opposite - Erlang pattern matching code is transformed to an internal form (which has a case statement) and is then optimized. Note the wording "and is then optimized." The question "are case/if statements more efficient than explicit function clauses?" is often asked. The answer is "it probably makes no measurable difference." In many cases the same logic expressed with a case statement or with pure pattern matching code results in identical VM code. If you can outsmart the pattern matching compiler then please tell us - it's probably a bug. In choosing between case/if and pure functions always choose the most beautiful code. One day you will have to read and maintain your code so write beautiful code with accurate descriptive function names. **Do not try to optimize your code** - that's the job of the pattern matching compiler. Write simple clear patterns, this gives the compiler the best chance to optimize things. If you have written simple clear patterns that you think should be efficient and find out that they are not efficient then please tell us - it might be a edge case in the pattern matching compiler that we need to fix to make better code. While we're on the subject remember that Erlang is built from expressions and every expression must have a value. That's why case and if should always return a value X = if Y > 0 -> .. end is most likely to be bad Erlang code, since X has no value if Y =< 0. The equivalent *is* legal in C - because C is a *statement* language and each statement is evaluated for its side effects - but it is not legal in Erlang (unless you really want your program to crash). If if you really want to crash then you should write: X = if Y > 0 -> ... true -> exit(...) end Why? - because when you read the code ten years later you might understand it. If you miss the explicit exit you will probably wonder why there was no true branch in the if statement. /Joe On Mon, Dec 7, 2009 at 2:29 AM, Richard O'Keefe wrote: >> kiran wrote: >>> >>> hi, >>> is it good to use case statements in functional language.. ?according to >>> me .. pattern matching-functions could do the task. >>> any commnets?? > > Multiclause pattern-matching functions and case expressions do exactly > the same thing; except for the error message you get when there is no > match either can be trivially converted to the other. > > You should consider questions like > > - can you give this part of your program a meaningful name? > ?[If so, it might make a good function.] > > - would this part of your program be useful elsewhere, > ?perhaps with a few constants replaced by variables? > ?[If so, it might make a good function.] > > - is the normal flow of your code obscured by bulky code that > ?could be moved elsewhere? > ?[If so, it might be useful to split it out as a function, or > ? you could use a literate programming tool, but in either case > ? you'll have to find a good name for it]. > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From kiran.khaladkar@REDACTED Mon Dec 7 10:18:35 2009 From: kiran.khaladkar@REDACTED (Kiran Khaladkar) Date: Mon, 07 Dec 2009 14:48:35 +0530 Subject: [erlang-questions] case statements really required?? In-Reply-To: <302990E9-B99B-4835-A5B9-644FD2506232@cs.otago.ac.nz> References: <4B190A5D.1030006@geodesic.com> <4B190CCC.1030504@gmail.com> <302990E9-B99B-4835-A5B9-644FD2506232@cs.otago.ac.nz> Message-ID: <4B1CC86B.5070604@geodesic.com> Richard O'Keefe wrote: >> kiran wrote: >>> hi, >>> is it good to use case statements in functional language.. >>> according to me .. pattern matching-functions could do the task. >>> any commnets?? > > Multiclause pattern-matching functions and case expressions do exactly > the same thing; except for the error message you get when there is no > match either can be trivially converted to the other. > > You should consider questions like > > - can you give this part of your program a meaningful name? > [If so, it might make a good function.] > > - would this part of your program be useful elsewhere, > perhaps with a few constants replaced by variables? > [If so, it might make a good function.] > > - is the normal flow of your code obscured by bulky code that > could be moved elsewhere? > [If so, it might be useful to split it out as a function, or > you could use a literate programming tool, but in either case > you'll have to find a good name for it]. > > thanks that was really helpful comment. I got that both case statements and pattern matching are both the same after looking at the object code :) of both. Erlang converts both case statements and function head matching to the same thing. From zabrane3@REDACTED Mon Dec 7 11:07:44 2009 From: zabrane3@REDACTED (zabrane Mikael) Date: Mon, 7 Dec 2009 11:07:44 +0100 Subject: [erlang-questions] Best way to interface Erlang with Java code In-Reply-To: <2A18EDDA-D9F8-48BB-A60A-8ED726754F4A@souja.net> References: <18a1db030912050745r473683fboe722b1ec9a449d24@mail.gmail.com> <4B1A81FF.6050804@gmail.com> <18a1db030912050927o1faff113g3ffd5083779ba623@mail.gmail.com> <20091205182059.GE11530@delora.autosys.us> <18a1db030912061837w7ad4591fy9f8b26b9431f1fbd@mail.gmail.com> <20091207031351.GP11530@delora.autosys.us> <20091207040032.GQ11530@delora.autosys.us> <2A18EDDA-D9F8-48BB-A60A-8ED726754F4A@souja.net> Message-ID: <18a1db030912070207s7fdb472dqd417e847ebaad1bf@mail.gmail.com> Many thanks guys ! 2009/12/7 Jayson Vantuyl > I've been watching this thread and something's been nagging at me but I > couldn't remember what it was. I remembered. I almost never use os:cmd, > but use erlang:open_port/2 instead. > > It turns out you can do something like this: > > > Command = "my command executable", > > Args = ["arg1","arg2","arg3"], > > Cwd = "/some/directory", > > Env = [ {"some_var","some_val"}, {"other_var","other_val"} ], > > Port = open_port( {spawn_executable, Command}, [ {args,Args}, {cd, Cwd}, > {env,Env}, exit_status ] ). > > This is pretty handy because: > > * It doesn't go through the shell unless you explicitly make it do so. > * Commands or paths containing spaces are not a problem. > * Args with spaces are not a problem. > * Full control over the environment and cwd. > * All data comes in as Erlang messages that can be "received". > > There are also a number of other options I didn't use which are quite > handy: > > * Packet-mode: If you control the program being run, you can prepend chunks > of data with their length and you don't have to worry about framing or > partial reads. > * Line-mode: Data is sent a line at a time. > * EOF detection: You can receive a message when the file is closed. > * You can set arg0, which is handy for some programs (busybox comes to > mind). > * nouse_stdio: Allows you to use file descriptors other than 0 and 1 to > communicate with Erlang. > * stderr__to_stdout: Easily captures stderr without any shell trickery. > * binary: Get all data as binaries, this is exceptionally nice with packet > mode. > * hide: hides console window when using Windows > > Depending on your willingness to modify the Java program, you might be able > to greatly simplify what you're doing. I suspect that it won't even require > any regexps. > > Of the top of my head, I'd be inclined to use line mode, and take each line > at a time. Then you just receive a bunch of {eol,Line} messages, with a > {Port,{exit_status,Status}} message at the end. If you want to make it a > bit more sophisticated, you could use packet mode with similar results. > > Also, have you looked at jinterface? It can be a Java program appear as an > Erlang node. > > On Dec 6, 2009, at 8:00 PM, Michael McDaniel wrote: > > > and another using extra re features ... > > > > > > 1> Cmd = "java transform animals.txt ; echo $?" . > > "java transform animals.txt ; echo $?" . > > 2> {match, [Val,Ret]} = > > re:run( os:cmd(Cmd), > > "(?.*)(?[0-9])\\n$", > > [dotall,ungreedy,{capture,['VAL','RETCODE'],list}]). > > {match, ["Cat\nShark\n...", "1"]} > > 3> Ret. > > "1" > > 4> Val. > > "Cat\nShark\n..." > > 5> re:split(Val, "\n", [{return,list}]). > > ["Cat", "Shark", ...] > > > > > > the above presumes single digit return codes > > > > os:cmd/1 is not the only tool to get other program output; e.g. running > > via a port, or using jinterface. Or maybe the new NIF experimental > > feature in R13B03. > > > > > > ~M > > > > > > On Sun, Dec 06, 2009 at 07:13:52PM -0800, Michael McDaniel wrote: > >> one way ... > >> > >> > >> 1> L = re:split (os:cmd ("java transform animals.txt ; echo $?"), "\n"). > >> [<<"Cat">>, > >> <<"Shark">>, > >> ........ % a lot of animal names here (more than 1000) > >> <<"Wolf">>, > >> <<"1">>,<<>>] > >> > >> 2> Ret = lists:nth( 2, lists:reverse( L ) ) . > >> <<"1">> > >> 3> case Ret > >> 3> of <<"0">> -> do_something ; > >> 3> _ -> do_something_else > >> 3> end. > >> failure > >> > >> > >> read up on lists and re modules for different ways of playing with > >> the output > >> > >> ~Michael > >> > >> > >> On Mon, Dec 07, 2009 at 03:37:25AM +0100, zabrane Mikael wrote: > >>> Hi Michael ! > >>> > >>> I found a subtle problem when trying your solution when my program > returns a > >>> text with one or more "\n". > >>> > >>> Eg: > >>> 1> re:split (os:cmd ("java transform animals.txt ; echo $?"), "\n"). > >>> [<<"Cat">>, > >>> <<"Shark">>, > >>> ........ % a lot of animal names here (more than 1000) > >>> <<"Wolf">>, > >>> <<"1">>,<<>>] > >>> 2> > >>> > >>> How then can I distinguish between my program output and the error code > >>> (which is at the end of the list) ? > >>> > >>> Thanks > >>> Zabrane > >>> > >>> 2009/12/5 Michael > >>> > >>>> on my Linux box ... > >>>> > >>>> $ erl > >>>> Erlang R13B03 (erts-5.7.4) [rq:1] [async-threads:0] [hipe] > >>>> [kernel-poll:false] > >>>> > >>>> Eshell V5.7.4 (abort with ^G) > >>>> 1> re:split(os:cmd("java x ; echo $?"),"\n"). > >>>> [<<"Exception in thread \"main\" java.lang.NoClassDefFoundError: x">>, > >>>> <<"1">>,<<>>] > >>>> 2> > >>>> > >>>> > >>>> On Sat, Dec 05, 2009 at 06:27:24PM +0100, zabrane Mikael wrote: > >>>>> Hi Sean ! > >>>>> > >>>>> Ok I see. But how then cal I handle error code in Erlang if my Java > >>>> program > >>>>> crash or returns something different from error code 0? > >>>>> > >>>>> Thanks > >>>>> Zabrane > >>>>> > >>>>> 2009/12/5 Sean Cribbs > >>>>> > >>>>>> zabrane Mikael wrote: > >>>>>> > >>>>>>> Hi List ! > >>>>>>> > >>>>>>> I've a small program written in "Java" which take a filename > (input), > >>>>>>> proceed it, and print out > >>>>>>> a text (output). > >>>>>>> > >>>>>>> What's the best way to be able to access to that program from > Erlang? > >>>>>>> My whish is get back the "output" as an Erlang binary. > >>>>>>> > >>>>>>> Thanks > >>>>>>> Zabrane > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>> Use os:cmd/1, which returns a string/list - > >>>>>> http://erldocs.com/R13B03/kernel/os.html?search=os&i=5 > >>>>>> > >>>>>> Sean > >>>>>> > >>>> > >>>> ________________________________________________________________ > >>>> erlang-questions mailing list. See http://www.erlang.org/faq.html > >>>> erlang-questions (at) erlang.org > >>>> > >> > >> ________________________________________________________________ > >> erlang-questions mailing list. See http://www.erlang.org/faq.html > >> erlang-questions (at) erlang.org > >> > > > > > > ________________________________________________________________ > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > erlang-questions (at) erlang.org > > > > > > -- > Jayson Vantuyl > kagato@REDACTED > > > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From kiszl@REDACTED Mon Dec 7 11:41:52 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Mon, 7 Dec 2009 11:41:52 +0100 (CET) Subject: [erlang-questions] on_load In-Reply-To: <3A6811C4-D5A5-43AB-B707-8F8CE0DA4BEE@rogvall.se> References: <3A6811C4-D5A5-43AB-B707-8F8CE0DA4BEE@rogvall.se> Message-ID: <44102.194.88.55.211.1260182512.squirrel@localhost> http://www.erlang.org/doc/reference_manual/code_loading.html "A process that calls any function in a module whose on_load function has not yet returned will be suspended until the on_load function has returned." Isn't there a deadlock with start() waiting for auto_start() to finish and vice versa? Regards, Zoltan. > I am trying the on_load feature. > > I did: > > -on_load(auto_start/0). > > In a generic server code. > > Then I defined auto_start as: > > %% called when module is loaded > auto_start() -> > io:format("auto_start\n"), > Result = start(), > io:format("result = ~p\n", [Result]), > true. > > > Where start/0 is the normal: > > start() -> > gen_server:start({local, ?SERVER}, ?MODULE, [], []). > > Question. > > Is this supposed to be working ? Why not? > Currently I get the the "auto_start" output and the the gen_server is > registered. > Apart from that it is hanging. > > > /Tony > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > > From garry@REDACTED Mon Dec 7 14:20:51 2009 From: garry@REDACTED (Garry Hodgson) Date: Mon, 07 Dec 2009 08:20:51 -0500 Subject: [erlang-questions] Best way to interface Erlang with Java code In-Reply-To: <2A18EDDA-D9F8-48BB-A60A-8ED726754F4A@souja.net> References: <18a1db030912050745r473683fboe722b1ec9a449d24@mail.gmail.com> <4B1A81FF.6050804@gmail.com> <18a1db030912050927o1faff113g3ffd5083779ba623@mail.gmail.com> <20091205182059.GE11530@delora.autosys.us> <18a1db030912061837w7ad4591fy9f8b26b9431f1fbd@mail.gmail.com> <20091207031351.GP11530@delora.autosys.us> <20091207040032.GQ11530@delora.autosys.us> <2A18EDDA-D9F8-48BB-A60A-8ED726754F4A@souja.net> Message-ID: <4B1D0133.7080502@research.att.com> Jayson Vantuyl wrote: > This is pretty handy because: > there's another thing that's really handy... > Then you just receive a bunch of {eol,Line} messages, with a {Port,{exit_status,Status}} message at the end. that's it. getting exit status of the program you ran is really important. i use a function built atop the port mechanism that returns a { Status, Output } tuple, and it's often the case that i don't care about Output unless Status is wrong. -- Garry Hodgson AT&T Chief Security Office (CSO) "This e-mail and any files transmitted with it are AT&T property, are confidential, and are intended solely for the use of the individual or entity to whom this e-mail is addressed. If you are not one of the named recipient(s) or otherwise have reason to believe that you have received this message in error, please notify the sender and delete this message immediately from your computer. Any other use, retention, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited." From peppe@REDACTED Mon Dec 7 15:18:17 2009 From: peppe@REDACTED (Peter Andersson) Date: Mon, 07 Dec 2009 15:18:17 +0100 Subject: [erlang-questions] test_server and timetraps In-Reply-To: <5B75AEBD-20AA-4B5B-AA7E-55586A2094BB@souja.net> References: <5B75AEBD-20AA-4B5B-AA7E-55586A2094BB@souja.net> Message-ID: <4B1D0EA9.7060603@erix.ericsson.se> Thanks for poiniting this out. I agree it has to be changed, or at least properly documented. Will do. /Peter Erlang/OTP, Ericsson AB Jayson Vantuyl wrote: > Just to save anybody else the trouble, test_server has some... interesting behavior. > > I had tests with timeouts of 5 seconds that would run for 15 and still not be killed. This seemed odd, so I checked it out. > > Apparently, when certain options are turned on, the test_server will scale up your timeouts. Buried deep within the bowels of test_server, there is a sprinkling of code that determines a "multiplier" for your timetraps. Apparently, it considers running under code coverage reason to scale your timeout by a factor of 10! This was definitely a surprise. Although, I admit that the fact that running on VXworks increases timeouts by another factor 5 was good for a laugh. > > I decided to mail the list so that this would be on the webs for people to find. > > It turns out that it is documented in test_server, but not in common_test. Can somebody document this in common_test, so that people don't wonder why their timetraps seemingly never kick in? The built in testing / debugging / tracing under Erlang is absolutely wonderful, but it's so woefully documented that I'm surprised that anybody uses it. Let's just say a 12 minute timeout becoming a two hour timeout is not "expected behavior". :( > > From kostis@REDACTED Mon Dec 7 15:01:36 2009 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 07 Dec 2009 15:01:36 +0100 Subject: [erlang-questions] Best practice for defining functions with edoc,erlc,eunit and the dialyzer In-Reply-To: <9b08084c0912020128w6d5e685dq2dd259e82806d2aa@mail.gmail.com> References: <9b08084c0912020128w6d5e685dq2dd259e82806d2aa@mail.gmail.com> Message-ID: <4B1D0AC0.9020605@cs.ntua.gr> Joe Armstrong wrote: > Best practice for writing documenting and testing code > > I'd like to try and define "best practice" for writing documenting and > testing Erlang code. I want to use: > > - only the tools supplied in the OTP release > > So I use: > > - eunit for unit testing > - the dialyzer for checking my code > - edoc for documenting things > - type specifications for specifying types > > These tools do not completely "play together" in a satisfactory manner, > so I'd like to define what I thing is "best practice" and hope that by doing > so the tools will converge. > > Let's suppose I want to define the good 'ol factorial. Here's a module > called elib1_best.erl. I've written it in such a way that it can be > processed by erlc,eunit,edoc and the dialyzer - read the footnotes > in brackets for an explanation. > > -module(elib1_best). %% [1] > > %% elib1_best: Best practice template for library modules [2] > %% Time-stamp: <2009-12-02 09:43:12 ejoearm> [3] > > %%---------------------------------------------------------------------- > %% Copyright (c) 2009 Joe Armstrong [4] > %% Copyright (c) 2009 Whoomph Software AB > %% > %% Permission is hereby granted, free of charge, to any person > %% obtaining a copy of this software and associated documentation > %% files (the "Software"), to deal in the Software without > %% restriction, including without limitation the rights to use, copy, > %% modify, merge, publish, distribute, sublicense, and/or sell copies > %% of the Software, and to permit persons to whom the Software is > %% furnished to do so, subject to the following conditions: > %% > %% The above copyright notice and this permission notice shall be > %% included in all copies or substantial portions of the Software. > %% > %% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, > %% EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF > %% MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND > %% NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS > %% BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN > %% ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN > %% CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE > %% SOFTWARE. > %%----------------------------------------------------------------------- > > -include_lib("eunit/include/eunit.hrl"). %% [5] > > -export([fac/1]). %% [6] > > > %% @doc fac(N) computes factorial(N) using a fast > %% iterative algorithm. [7] > > -spec fac(integer()) -> integer(). [8] > > fac(N) when is_integer(N), N >= 0 -> fac1(N, 1). > > fac1(0, K) -> K; > fac1(N, K) -> fac1(N-1, K*N). > > fac_test() -> %% [9] > 6 = fac(3), > 24 = fac(4). > > %% Notes: > %% [1] - module on line 1 > %% [2] - module comment > %% [3] - Time stamp auto generated by emacs. > %% Must be near start of file > %% [4] - Copyright (I always forget this, but adding a > %% copyright reduces the pain later > %% [5] - Needed for eunit > %% [6] - use export and NOT compile(export_all) > %% [7] - @doc comes first > %% [8] - -spec comes immediately *before* the function > %% [9] - test cases come immediately after the function > > %% end of module > ... > > Now let's see what happens: > > 1) Compiling > > erlc +warn_missing_spec -o ../ebin -W elib1_best.erl > > ./elib1_best.erl:0: Warning: missing specification for function test/0 > ./elib1_best.erl:44: Warning: missing specification for function fac_test/0 > > Best practice is to support type specifications for all exported > functions. But eunit magically adds a function test/0 and I really > don't want to have to add manual exports and type specs for > fac_test/0. > > [A fix is needed to erlc here, OR eunit can add type specs, > I think the latter is better - erlc should not need to know about eunit] I agree with you that it's eunit's job to add these specs, but note that this can be done automatically in a type accurate way only if there is some convention about user-supplied test functions. Your fac_test/0 function currently returns 24 so the appropriate spec for it is: -spec fac_test() -> 24. which is quite hard for eunit to generate. The "best practice" way to write test functions would be to make them return 'ok'. I.e., write the function as: fac_test() -> 6 = fac(3), 24 = fac(4), ok. > 2) Dialyzing > > dialyzer --src elib1_best.erl > Checking whether the PLT /home/ejoearm/.dialyzer_plt is up-to-date... yes > Proceeding with analysis... > Unknown functions: > eunit:test/1 > done in 0m0.32s > done (passed successfully) > > This is ok - I could add eunit to my plt if I wanted ... Yes. This can be done very easily with the command: dialyzer --add_to_plt --apps eunit > Now for questions. > > 1) Does this represent best practice? Is this the best way to > write code? - can anybody improve on this? Well, yes. One relatively minor problem is that the spec you specified for the function, though not wrong, does not accurately represent your intention. You wrote: -spec fac(integer()) -> integer(). fac(N) when is_integer(N), N >= 0 -> fac1(N, 1). fac1(0, K) -> K; fac1(N, K) -> fac1(N-1, K*N). and it's pretty clear from your code that do not intend that other modules use your fac/1 function with negative integers. Why not document this intention in the -spec? In fact, if you dialyze as follows: dialyzer -Wunderspecs elib1_best.erl dialyzer will tell you that: elib1_best.erl:38: Type specification elib1_best:fac(integer()) -> integer() is a supertype of the success typing: elib1_best:fac(non_neg_integer()) -> pos_integer() effectively prompting you to change the spec to: -spec fac(non_neg_integer()) -> pos_integer(). instead. > 2) If I write like this can I assume that one day edoc > and eunit and erlc will converge so that I get correctly displayed > types in edoc and no warnings in erlc etc? Yes. The only issue is when. Kostis From tony@REDACTED Mon Dec 7 16:37:49 2009 From: tony@REDACTED (Tony Rogvall) Date: Mon, 7 Dec 2009 16:37:49 +0100 Subject: [erlang-questions] on_load In-Reply-To: <44102.194.88.55.211.1260182512.squirrel@localhost> References: <3A6811C4-D5A5-43AB-B707-8F8CE0DA4BEE@rogvall.se> <44102.194.88.55.211.1260182512.squirrel@localhost> Message-ID: <46B88CD7-E230-44E4-9DE0-5814CC38E40E@rogvall.se> Thanks! I did a RTFM on myself ;-) As the paragraph is stated I surely created a dead lock. Maybe I should use a spawn to do what I was thinking of. /Tony On 7 dec 2009, at 11.41, Zoltan Lajos Kis wrote: > http://www.erlang.org/doc/reference_manual/code_loading.html > > "A process that calls any function in a module whose on_load function has > not yet returned will be suspended until the on_load function has > returned." > > Isn't there a deadlock with start() waiting for auto_start() to finish and > vice versa? > > Regards, > Zoltan. > > >> I am trying the on_load feature. >> >> I did: >> >> -on_load(auto_start/0). >> >> In a generic server code. >> >> Then I defined auto_start as: >> >> %% called when module is loaded >> auto_start() -> >> io:format("auto_start\n"), >> Result = start(), >> io:format("result = ~p\n", [Result]), >> true. >> >> >> Where start/0 is the normal: >> >> start() -> >> gen_server:start({local, ?SERVER}, ?MODULE, [], []). >> >> Question. >> >> Is this supposed to be working ? Why not? >> Currently I get the the "auto_start" output and the the gen_server is >> registered. >> Apart from that it is hanging. >> >> >> /Tony >> >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> >> > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From ulf.wiger@REDACTED Mon Dec 7 16:40:58 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Mon, 07 Dec 2009 16:40:58 +0100 Subject: list BIFs Message-ID: <4B1D220A.5020309@erlang-consulting.com> (I guess I should fork the git repos and do this myself, but then it won't happen this year...) I think it is quite appropriate that the following lists functions are implemented in C: lists:member/2 lists:reverse/2 lists:keymember/3 lists:keysearch/3 lists:keyfind/3 (append and subtract are also BIFs, of course) I think the list should be extended with the following: lists:keydelete/3 lists:keyreplace/4 lists:keystore/4 I did some benchmarking recently, comparing the use of a plain key-value list with that of dict. The plain list was quite competitive for read access up to a fairly large number of elements (depending on the ratio of building the list and accessing the elements, the list is competitive even for data sets of > 200 elements.) Since only the lookup functions are optimized, it gets trickier to judge when updates are involved as well. Making C implementations of the above functions is trivial, at least relatively speaking. I feel convinced that optimizing the most popular list update functions (perhaps also the basic lists:sort/1) would do much to speed up existing programs, and also extend the reach of straightforward list programming - a good thing IMHO. BR, Ulf W -- Ulf Wiger CTO, Erlang Training & Consulting Ltd http://www.erlang-consulting.com From james.hague@REDACTED Mon Dec 7 17:33:51 2009 From: james.hague@REDACTED (James Hague) Date: Mon, 7 Dec 2009 10:33:51 -0600 Subject: [erlang-questions] list BIFs In-Reply-To: <4B1D220A.5020309@erlang-consulting.com> References: <4B1D220A.5020309@erlang-consulting.com> Message-ID: > I think the list should be extended with the following: > > lists:keydelete/3 > lists:keyreplace/4 > lists:keystore/4 I'd also add lists:ukeymerge/3. From ulf.wiger@REDACTED Mon Dec 7 17:38:57 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Mon, 07 Dec 2009 17:38:57 +0100 Subject: Joe Armstrong speaks at Tail-f 10 December (Erlang User Group Meeting) Message-ID: <4B1D2FA1.3040004@erlang-consulting.com> Apologies for spamming the Erlang list, but since the invitation came out very late this time, I thought I'd make sure no one missed it: Call for the next Stockholm Erlang User Group Meeting. Time: Thursday, December 10, 18:00 Place: Tail-f Stockholm headquarters http://www.tail-f.com/contact-us/ Speaker: - Joe Armstrong, Ericsson AB: elib2 - an Erlang library We will round off the evening with an ErLounge at some nearby pub. Details about the ErLounge can be further discussed on the EUG Stockholm mailing list. Advance registration is required. http://erlang-consulting.com/etc/register?event=10+December+2009+Stockholm+Erlang+User+Group+Meeting See you there. Abstract: Elib2 is an Erlang library and a number of complete programs that make use of the library. The talk discusses: - the philosophy behind the library - what's in the library - my plans for the library I'll also show some of the programs that I have built using the library, with special attention to a full-text indexing application. -- Ulf Wiger CTO, Erlang Training & Consulting Ltd http://www.erlang-consulting.com From g@REDACTED Mon Dec 7 18:43:49 2009 From: g@REDACTED (Garrett Smith) Date: Mon, 7 Dec 2009 11:43:49 -0600 Subject: [erlang-questions] Re: Port forwarding / managed web In-Reply-To: References: <20091206223612.GI25450@hezmatt.org> Message-ID: On Mon, Dec 7, 2009 at 12:27 AM, Max Lapshin wrote: > On Mon, Dec 7, 2009 at 1:36 AM, Matthew Palmer wrote: >> Use a "real" webserver to accept the requests on port 80/443, do whatever >> request decoding is required, and then use the internal proxy modules >> (mod_proxy on Apache, HttpProxyModule for nginx) to pass the requests back >> to the applications as required. > > It is very, very bad idea to hide erlang after Apache. Even the > smallest and the worst web server on erlang > will be much more superiour than Apache. If this statement isn't flame bait, it's at least very odd. I'd discourage anyone from worrying about reverse proxy functions in Erlang until you bump into a problem that purpose built servers like Nginx or (the venerable) Apache+mod_proxy can't cope with. And even then, don't :) Garrett From kagato@REDACTED Mon Dec 7 18:47:16 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Mon, 7 Dec 2009 09:47:16 -0800 Subject: [erlang-questions] Re: Port forwarding / managed web In-Reply-To: References: <20091206223612.GI25450@hezmatt.org> Message-ID: <0DF9A9C2-C0B7-40BF-B7E1-73AD6C979465@souja.net> If your concern is performance, Matt is right. Apache can take a lot of parallelism out of the process to Erlang's detriment. Nginx, not so much, but it's still not necessary (although it's great for serving static assets along with proxying to Erlang). That said, for 99% of installations, I think Apache will hold up. Of course, ask a general question, get a general answer... On Dec 7, 2009, at 9:43 AM, Garrett Smith wrote: > On Mon, Dec 7, 2009 at 12:27 AM, Max Lapshin wrote: >> On Mon, Dec 7, 2009 at 1:36 AM, Matthew Palmer wrote: >>> Use a "real" webserver to accept the requests on port 80/443, do whatever >>> request decoding is required, and then use the internal proxy modules >>> (mod_proxy on Apache, HttpProxyModule for nginx) to pass the requests back >>> to the applications as required. >> >> It is very, very bad idea to hide erlang after Apache. Even the >> smallest and the worst web server on erlang >> will be much more superiour than Apache. > > If this statement isn't flame bait, it's at least very odd. > > I'd discourage anyone from worrying about reverse proxy functions in > Erlang until you bump into a problem that purpose built servers like > Nginx or (the venerable) Apache+mod_proxy can't cope with. And even > then, don't :) > > Garrett > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org -- Jayson Vantuyl kagato@REDACTED From jarrod@REDACTED Mon Dec 7 18:59:59 2009 From: jarrod@REDACTED (Jarrod Roberson) Date: Mon, 7 Dec 2009 12:59:59 -0500 Subject: Drive by mention of new features without explaination Message-ID: On the new page about NIF http://erlang.org/doc/man/erl_nif.html there is the following: "A better solution for a real module is to take advantage of the new attribute on_load to automatically load the NIF library when the module is loaded." Where can I find an example of how to use this new attribute? From bob@REDACTED Mon Dec 7 19:12:07 2009 From: bob@REDACTED (Bob Ippolito) Date: Mon, 7 Dec 2009 10:12:07 -0800 Subject: [erlang-questions] Drive by mention of new features without explaination In-Reply-To: References: Message-ID: <6a36e7290912071012s7e731391o47186bc32cab5675@mail.gmail.com> On Mon, Dec 7, 2009 at 9:59 AM, Jarrod Roberson wrote: > On the new page about NIF http://erlang.org/doc/man/erl_nif.html there > is the following: > "A better solution for a real module is to take advantage of the new > attribute on_load to automatically load the NIF library when the > module is loaded." > > Where can I find an example of how to use this new attribute? http://www.erlang.org/doc/reference_manual/code_loading.html#id2278452 -bob From kagato@REDACTED Mon Dec 7 20:33:52 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Mon, 7 Dec 2009 11:33:52 -0800 Subject: common_test Automatic Naming Message-ID: So, when I let common_test generate its HTML output, I get these names for my modules. I've got them in an Erlang-style libdir. So module foo comes out as lib.foo and has its tests at lib/foo-X.Y.Z/test/something_SUITE.erl. After doing some detective work, I determined that the name is generated by ct_run:get_name/1. I see that it appears to take the two directory names above the test directory as the name of the suite. What is the rationale behind this naming? Is there somewhere else I should put my tests? Is it ever going to be possible to override this naming scheme? Thanks, -- Jayson Vantuyl kagato@REDACTED From jarrod@REDACTED Mon Dec 7 20:43:51 2009 From: jarrod@REDACTED (Jarrod Roberson) Date: Mon, 7 Dec 2009 14:43:51 -0500 Subject: [erlang-questions] Drive by mention of new features without explaination In-Reply-To: <6a36e7290912071012s7e731391o47186bc32cab5675@mail.gmail.com> References: <6a36e7290912071012s7e731391o47186bc32cab5675@mail.gmail.com> Message-ID: > http://www.erlang.org/doc/reference_manual/code_loading.html#id2278452 thanks Bob for the link, following those instructions I got this far: // niftest.c #include "erl_nif.h" static ERL_NIF_TERM hello(ErlNifEnv* env) { return enif_make_string(env, "Hello world!"); } static ErlNifFunc nif_funcs[] = { {"hello", 0, hello} }; ERL_NIF_INIT(niftest,nif_funcs,NULL,NULL,NULL,NULL) ======================== %% niftest.erl -module(niftest). -export([hello/0]). -on_load(run_me/0). run_me() -> erlang:load_nif("./niftest", 0). hello() -> "NIF library not loaded". ======================== [jrod@REDACTED] [~] make clean all rm -f *.o *.beam niftest.so cc -arch x86_64 -O3 -fPIC -bundle -flat_namespace -undefined suppress -fno-common -Wall -I/Users/jrod/Downloads/otp_src_R13B03//erts/emulator/beam/ -c -o niftest.o niftest.c gcc -o niftest.so niftest.o -arch x86_64 -O3 -fPIC -bundle -flat_namespace -undefined suppress -fno-common -Wall erlc niftest.erl [jrod@REDACTED] [~] erl Erlang R13B03 (erts-5.7.4) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [kernel-poll:false] Eshell V5.7.4 (abort with ^G) 1> niftest:hello(). ** exception error: undefined function niftest:hello/0 2> I tried exporting the run_me/0 function as well with the same results? If I take out the -on_load(run_me/0). and add run_me/0 to the export it works. Any ideas what I am missing here? From jarrod@REDACTED Mon Dec 7 20:47:04 2009 From: jarrod@REDACTED (Jarrod Roberson) Date: Mon, 7 Dec 2009 14:47:04 -0500 Subject: [erlang-questions] Drive by mention of new features without explaination In-Reply-To: References: <6a36e7290912071012s7e731391o47186bc32cab5675@mail.gmail.com> Message-ID: On Mon, Dec 7, 2009 at 2:43 PM, Jarrod Roberson wrote: >> http://www.erlang.org/doc/reference_manual/code_loading.html#id2278452 > > thanks Bob for the link, following those instructions I got this far: > > // niftest.c > #include "erl_nif.h" > static ERL_NIF_TERM hello(ErlNifEnv* env) > { > ? ?return enif_make_string(env, "Hello world!"); > } > static ErlNifFunc nif_funcs[] = > { > ? ?{"hello", 0, hello} > }; > ERL_NIF_INIT(niftest,nif_funcs,NULL,NULL,NULL,NULL) > > ======================== > > %% niftest.erl > -module(niftest). > -export([hello/0]). > -on_load(run_me/0). > > run_me() -> > ? ? ?erlang:load_nif("./niftest", 0). > hello() -> > ? ? ?"NIF library not loaded". > > ======================== I figured it out! I needed to return true/false from the run_me/0 function! From rapsey@REDACTED Mon Dec 7 20:47:09 2009 From: rapsey@REDACTED (Rapsey) Date: Mon, 7 Dec 2009 20:47:09 +0100 Subject: [erlang-questions] Drive by mention of new features without explaination In-Reply-To: References: <6a36e7290912071012s7e731391o47186bc32cab5675@mail.gmail.com> Message-ID: <97619b170912071147r7ec85e9dt7052b0038516a671@mail.gmail.com> The on_load function has to return true. Otherwise module will not be loaded. Sergej On Mon, Dec 7, 2009 at 8:43 PM, Jarrod Roberson wrote: > > http://www.erlang.org/doc/reference_manual/code_loading.html#id2278452 > > thanks Bob for the link, following those instructions I got this far: > > // niftest.c > #include "erl_nif.h" > static ERL_NIF_TERM hello(ErlNifEnv* env) > { > return enif_make_string(env, "Hello world!"); > } > static ErlNifFunc nif_funcs[] = > { > {"hello", 0, hello} > }; > ERL_NIF_INIT(niftest,nif_funcs,NULL,NULL,NULL,NULL) > > ======================== > > %% niftest.erl > -module(niftest). > -export([hello/0]). > -on_load(run_me/0). > > run_me() -> > erlang:load_nif("./niftest", 0). > hello() -> > "NIF library not loaded". > > ======================== > > [jrod@REDACTED] [~] > make clean all > rm -f *.o *.beam niftest.so > cc -arch x86_64 -O3 -fPIC -bundle -flat_namespace -undefined suppress > -fno-common -Wall > -I/Users/jrod/Downloads/otp_src_R13B03//erts/emulator/beam/ -c -o > niftest.o niftest.c > gcc -o niftest.so niftest.o -arch x86_64 -O3 -fPIC -bundle > -flat_namespace -undefined suppress -fno-common -Wall > erlc niftest.erl > [jrod@REDACTED] [~] > erl > Erlang R13B03 (erts-5.7.4) [source] [64-bit] [smp:2:2] [rq:2] > [async-threads:0] [kernel-poll:false] > > Eshell V5.7.4 (abort with ^G) > 1> niftest:hello(). > ** exception error: undefined function niftest:hello/0 > 2> > > I tried exporting the run_me/0 function as well with the same results? > If I take out the -on_load(run_me/0). and add run_me/0 to the export it > works. > Any ideas what I am missing here? > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From kiszl@REDACTED Mon Dec 7 20:48:57 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Mon, 07 Dec 2009 20:48:57 +0100 Subject: [erlang-questions] Drive by mention of new features without explaination In-Reply-To: References: <6a36e7290912071012s7e731391o47186bc32cab5675@mail.gmail.com> Message-ID: <4B1D5C29.3060800@tmit.bme.hu> Jarrod Roberson wrote: >> http://www.erlang.org/doc/reference_manual/code_loading.html#id2278452 >> > > thanks Bob for the link, following those instructions I got this far: > > // niftest.c > #include "erl_nif.h" > static ERL_NIF_TERM hello(ErlNifEnv* env) > { > return enif_make_string(env, "Hello world!"); > } > static ErlNifFunc nif_funcs[] = > { > {"hello", 0, hello} > }; > ERL_NIF_INIT(niftest,nif_funcs,NULL,NULL,NULL,NULL) > > ======================== > > %% niftest.erl > -module(niftest). > -export([hello/0]). > -on_load(run_me/0). > > run_me() -> > erlang:load_nif("./niftest", 0). > hello() -> > "NIF library not loaded". > > ======================== > > [jrod@REDACTED] [~] > make clean all > rm -f *.o *.beam niftest.so > cc -arch x86_64 -O3 -fPIC -bundle -flat_namespace -undefined suppress > -fno-common -Wall > -I/Users/jrod/Downloads/otp_src_R13B03//erts/emulator/beam/ -c -o > niftest.o niftest.c > gcc -o niftest.so niftest.o -arch x86_64 -O3 -fPIC -bundle > -flat_namespace -undefined suppress -fno-common -Wall > erlc niftest.erl > [jrod@REDACTED] [~] > erl > Erlang R13B03 (erts-5.7.4) [source] [64-bit] [smp:2:2] [rq:2] > [async-threads:0] [kernel-poll:false] > > Eshell V5.7.4 (abort with ^G) > 1> niftest:hello(). > ** exception error: undefined function niftest:hello/0 > 2> > > I tried exporting the run_me/0 function as well with the same results? > If I take out the -on_load(run_me/0). and add run_me/0 to the export it works. > Any ideas what I am missing here? > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > I also overlooked this a few days ago :). The on_load function expects 'true' to be returned, whereas erlang:load_nif returns with 'ok' (which is definitely not 'true'). This will result in your module being unloaded. Solution: run_me() -> erlang:load_nif("./niftest", 0), true. Regards, Zoltan. From ulf.wiger@REDACTED Mon Dec 7 21:34:43 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Mon, 07 Dec 2009 21:34:43 +0100 Subject: [erlang-questions] Drive by mention of new features without explaination In-Reply-To: <4B1D5C29.3060800@tmit.bme.hu> References: <6a36e7290912071012s7e731391o47186bc32cab5675@mail.gmail.com> <4B1D5C29.3060800@tmit.bme.hu> Message-ID: <4B1D66E3.3010605@erlang-consulting.com> Zoltan Lajos Kis wrote: > > The on_load function expects 'true' to be returned, whereas > erlang:load_nif returns with 'ok' (which is definitely not 'true'). This > will result in your module being unloaded. > Solution: > > run_me() -> > erlang:load_nif("./niftest", 0), > true. Hmm... Given that the NIF support is flagged as experimental, could this perhaps be fixed? BR, Ulf W -- Ulf Wiger CTO, Erlang Training & Consulting Ltd http://www.erlang-consulting.com From kiszl@REDACTED Mon Dec 7 21:55:00 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Mon, 07 Dec 2009 21:55:00 +0100 Subject: [erlang-questions] Drive by mention of new features without explaination In-Reply-To: <4B1D66E3.3010605@erlang-consulting.com> References: <6a36e7290912071012s7e731391o47186bc32cab5675@mail.gmail.com> <4B1D5C29.3060800@tmit.bme.hu> <4B1D66E3.3010605@erlang-consulting.com> Message-ID: <4B1D6BA4.10408@tmit.bme.hu> Ulf Wiger wrote: > Zoltan Lajos Kis wrote: >> >> The on_load function expects 'true' to be returned, whereas >> erlang:load_nif returns with 'ok' (which is definitely not 'true'). >> This will result in your module being unloaded. >> Solution: >> >> run_me() -> >> erlang:load_nif("./niftest", 0), >> true. > > Hmm... > > Given that the NIF support is flagged as experimental, > could this perhaps be fixed? > > BR, > Ulf W I'd give a +1 on changing the on_load handler to expect 'ok' instead of 'true'. The documentation states that "there may be backward-incompatible changes in the feature in future releases.", so that should not be a problem. But there might be plans unknown to us with on_load that makes 'true' the preferable choice. Who knows... btw, we could use this for now: run_me() -> ok == erlang:load_nif("./niftest", 0). Regards, Zoltan. From rvirding@REDACTED Mon Dec 7 23:08:56 2009 From: rvirding@REDACTED (Robert Virding) Date: Mon, 7 Dec 2009 23:08:56 +0100 Subject: [erlang-questions] Drive by mention of new features without explaination In-Reply-To: <4B1D6BA4.10408@tmit.bme.hu> References: <6a36e7290912071012s7e731391o47186bc32cab5675@mail.gmail.com> <4B1D5C29.3060800@tmit.bme.hu> <4B1D66E3.3010605@erlang-consulting.com> <4B1D6BA4.10408@tmit.bme.hu> Message-ID: <3dbc6d1c0912071408r57f7fcccu6c3549dd02d65b23@mail.gmail.com> 2009/12/7 Zoltan Lajos Kis > > I'd give a +1 on changing the on_load handler to expect 'ok' instead of > 'true'. The documentation states that "there may be backward-incompatible > changes in the feature in future releases.", so that should not be a > problem. But there might be plans unknown to us with on_load that makes > 'true' the preferable choice. Who knows... > > btw, we could use this for now: > > run_me() -> > ok == erlang:load_nif("./niftest", 0). > If the on_load handler were to return 'ok' when it is successful then what should it return on failure, 'error'? It still can't return what erlang:load_nif does as its error returns are quite specific. And there might actually be people who use the on_load handler for other things than calling load_nif. Robert From kagato@REDACTED Mon Dec 7 23:23:19 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Mon, 7 Dec 2009 14:23:19 -0800 Subject: [erlang-questions] Drive by mention of new features without explaination In-Reply-To: <3dbc6d1c0912071408r57f7fcccu6c3549dd02d65b23@mail.gmail.com> References: <6a36e7290912071012s7e731391o47186bc32cab5675@mail.gmail.com> <4B1D5C29.3060800@tmit.bme.hu> <4B1D66E3.3010605@erlang-consulting.com> <4B1D6BA4.10408@tmit.bme.hu> <3dbc6d1c0912071408r57f7fcccu6c3549dd02d65b23@mail.gmail.com> Message-ID: <26ACAB17-0BBC-4D1B-B634-DF15323C7452@souja.net> > If the on_load handler were to return 'ok' when it is successful then what > should it return on failure, 'error'? It still can't return what > erlang:load_nif does as its error returns are quite specific. And there > might actually be people who use the on_load handler for other things than > calling load_nif. Actually, why can't it return {error,Reason}? gen_server's return all manner of custom {error,_} tuples that can be handled with fairly generic code because it's really a rather complete idiom. Why have false unload the module? It appears that there are broken semantics. As if "on_load" really is semantically closer to "should_load_and_convenient_side_effects". I'd much rather have on_load return either ok or some error that could be logged intelligently. Fitting in with load_nif is just a bonus. Additionally, {ok,_} might have other uses in the future. true / false pretty much makes any extension to the syntax yield a completely broken idiom. Conversely, what good does true / false do? It's rather arbitrary and certainly uninformative. At least being congruent with load_nif wouldn't be completely arbitrary. -- Jayson Vantuyl kagato@REDACTED From jeffm@REDACTED Mon Dec 7 23:28:18 2009 From: jeffm@REDACTED (jm) Date: Tue, 08 Dec 2009 09:28:18 +1100 Subject: [erlang-questions] Re: Port forwarding / managed web In-Reply-To: <0DF9A9C2-C0B7-40BF-B7E1-73AD6C979465@souja.net> References: <20091206223612.GI25450@hezmatt.org> <0DF9A9C2-C0B7-40BF-B7E1-73AD6C979465@souja.net> Message-ID: <4B1D8182.2070307@ghostgun.com> Jayson Vantuyl wrote: > If your concern is performance, Matt is right. Apache can take a lot of parallelism out of the process to Erlang's detriment. Nginx, not so much, but it's still not necessary (although it's great for serving static assets along with proxying to Erlang). > > That said, for 99% of installations, I think Apache will hold up. > > Of course, ask a general question, get a general answer... > > > If your headed to the high end (the other 1%). You can put a load balancer, such as an f5, in front which can then do any URL rewriting you need and redirect the request to a number of machines based on various metrics, eg load or connections, on what ever port you wish. This is over kill for the current application however. Jeff. From aduston@REDACTED Mon Dec 7 23:59:15 2009 From: aduston@REDACTED (adam) Date: Mon, 7 Dec 2009 14:59:15 -0800 (PST) Subject: Constantly archiving old mnesia records In-Reply-To: <15dc2b46-1efd-488e-865a-be987ae28fa2@k4g2000yqb.googlegroups.com> References: <15dc2b46-1efd-488e-865a-be987ae28fa2@k4g2000yqb.googlegroups.com> Message-ID: <2effa571-6e94-484f-a221-de912ecac4f2@n35g2000yqm.googlegroups.com> The solution I came up with: Every week, create a new table. Use this week's table and last week's table to check for duplicates. Each week, remove the table from the week before last. I created a table_manager server with a timer:interval to manage the table rotation. Hope this helps someone else (though I'm guessing it probably won't)! Adam On Nov 16, 7:34?pm, adam wrote: > I have an application in which I have several million new records > coming in each day, and I need to make sure that no duplicate ids get > past a certain point in the system. To do this, I'm using a > distributed mnesia database. > > Duplicates can only occur within a few days of each other, so I want > to ship all old ids off to an archive every week. I could do this by > simply selecting old records, iterating through, saving them somewhere > else, and deleting them, but I'm afraid of this locking the entire > table, and I'm also afraid that this will cause the db file to get > pretty bloated over time. > > The other way to do it is to make a module implementing the > mnesia_frag_hash callback behavior which would create a fragment > containing old records when I call mnesia:change_table_frag with > add_frag. Then perhaps I could just move the data using the filesystem > (?). > > Any suggestions for doing this? > > Thanks in advance! > Adam > > ________________________________________________________________ > erlang-questions mailing list. Seehttp://www.erlang.org/faq.html > erlang-questions (at) erlang.org From aduston@REDACTED Tue Dec 8 00:02:20 2009 From: aduston@REDACTED (adam) Date: Mon, 7 Dec 2009 15:02:20 -0800 (PST) Subject: The Unbearable Slowness of Some disc_only_copies Transactions In-Reply-To: <6371951e-9465-4330-9091-ed053548e420@u7g2000yqm.googlegroups.com> References: <6371951e-9465-4330-9091-ed053548e420@u7g2000yqm.googlegroups.com> Message-ID: Not sure if this will help anyone else, but there are two parts to the solution I used for this: 1) Use +A [Num threads] with erl to increase the number of asynchronous threads for IO. (Thanks to Valentin Micic for this one) 2) If using a file store like EBS, distribute the database across several EBS volumes. Adam On Dec 2, 10:24?pm, adam wrote: > We have running Erlang code that is executing about 30 transactions > per second. Each transaction puts a write lock on a couple of records, > then performs a read and a write. We need to hold several hundred > million records simultaneously. > > When using disc_copies tables, we can easily manage to run about 160 > transactions per second. We also see that each transaction takes an > average of about 750-1400 microseconds to run. Min time is 350 > microseconds, and max time seems to go between 30-100 milliseconds. > > However, with disc_only_copies tables, individual transaction time > ranges between 500 microseconds up to about 90 seconds(!). Why do > individual transactions sometimes take such a long time with > disc_only_copies? > > Thank you! > Adam > > ________________________________________________________________ > erlang-questions mailing list. Seehttp://www.erlang.org/faq.html > erlang-questions (at) erlang.org From aduston@REDACTED Tue Dec 8 00:09:47 2009 From: aduston@REDACTED (adam) Date: Mon, 7 Dec 2009 15:09:47 -0800 (PST) Subject: Replicating a distributed database Message-ID: It's interesting: I can't find an answer to this question anywhere. We have a table that has fragments evenly distributed between nodes A and B. We want to replicate these fragments to nodes C and D, which are on separate machines. I believe that the Mnesia API provides no way of accomplishing this without unseemly workarounds. Am I wrong? If I start an Mnesia cluster on nodes A, B, C, and D, then as soon as I create a fragmented table, Mnesia distributes the fragments evenly between nodes A, B, C, and D, so there's a lot of work required with add_table_copy to get the fragments in the right place. It appears that mnesia ignores the disc_only_copies option when creating a fragmented table, only paying attention to n_disc_only_copies in the frag_properties option, so I believe there's no nice way to order mnesia to put fragments on nodes A and B only. I can start an Mnesia cluster on nodes A and B, create the fragmented tables, then add nodes C and D and use add_table_copy. This appears to give correct results but is kind of an ugly solution. Am I missing some obvious way to accomplish this? Thank you, Adam From bernie@REDACTED Tue Dec 8 00:23:51 2009 From: bernie@REDACTED (Bernard Duggan) Date: Mon, 07 Dec 2009 18:23:51 -0500 Subject: [erlang-questions] Re: Constantly archiving old mnesia records In-Reply-To: <2effa571-6e94-484f-a221-de912ecac4f2@n35g2000yqm.googlegroups.com> References: <15dc2b46-1efd-488e-865a-be987ae28fa2@k4g2000yqb.googlegroups.com> <2effa571-6e94-484f-a221-de912ecac4f2@n35g2000yqm.googlegroups.com> Message-ID: <4B1D8E87.2030300@m5net.com> Actually, this is pretty similar to the problem we're going to be dealing with soon (except we shouldn't ever have duplicates). We don't need to archive the data at the moment, so I'm just running a sweeper process to clean up stuff older than a certain age, but that won't be the case in future versions. I have similar fears to you regarding holding table locks for a long period - not sure how it's going to pan out in practise under production loads - it's been not too bad at all in testing though. Currently the tack we're thinking of taking is to shift old stuff from erlang to either an SQL or perhaps couchDB system. This is possible in our system because the "old" and "current" data are likely to be accessed for totally separate and different purposes, so there's no need to provide some common interface or replicate anything. Always nice to hear other people's ideas on the matter though. Cheers, Bernard adam wrote: > The solution I came up with: > > Every week, create a new table. Use this week's table and last week's > table to check for duplicates. Each week, remove the table from the > week before last. > > I created a table_manager server with a timer:interval to manage the > table rotation. > > Hope this helps someone else (though I'm guessing it probably won't)! > > Adam > > > On Nov 16, 7:34 pm, adam wrote: > >> I have an application in which I have several million new records >> coming in each day, and I need to make sure that no duplicate ids get >> past a certain point in the system. To do this, I'm using a >> distributed mnesia database. >> >> Duplicates can only occur within a few days of each other, so I want >> to ship all old ids off to an archive every week. I could do this by >> simply selecting old records, iterating through, saving them somewhere >> else, and deleting them, but I'm afraid of this locking the entire >> table, and I'm also afraid that this will cause the db file to get >> pretty bloated over time. >> >> The other way to do it is to make a module implementing the >> mnesia_frag_hash callback behavior which would create a fragment >> containing old records when I call mnesia:change_table_frag with >> add_frag. Then perhaps I could just move the data using the filesystem >> (?). >> >> Any suggestions for doing this? >> >> Thanks in advance! >> Adam >> >> ________________________________________________________________ >> erlang-questions mailing list. Seehttp://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From andrey.paramonov@REDACTED Tue Dec 8 01:16:10 2009 From: andrey.paramonov@REDACTED (Andrey) Date: Mon, 7 Dec 2009 16:16:10 -0800 (PST) Subject: Lazy lists Message-ID: Erlang documentation gives the following definition for lazy (infinite) list: ints_from(N) -> fun() -> [N | ints_from(N+1)] end. I tried to implement basic operations like map, filter and fold using this function, and it was quite hard. On one the forums I found another definition (by Joe Armstrong, I believe): ints_from(K) -> [K | fun() -> ints_from(K+1) end]. With that one it's much easier to implement the functions above (at least for me). I'm wondering if anybody uses the first definition, and how map/filter/fold should look like then? What benefits does the first definition give us in comparison to the second one? Thanks, Andrey From g@REDACTED Tue Dec 8 01:28:46 2009 From: g@REDACTED (Garrett Smith) Date: Mon, 7 Dec 2009 18:28:46 -0600 Subject: [erlang-questions] Re: The Unbearable Slowness of Some disc_only_copies Transactions In-Reply-To: References: <6371951e-9465-4330-9091-ed053548e420@u7g2000yqm.googlegroups.com> Message-ID: Do you mean mount a single volume on multiple EBS partitions (e.g. raid-0) or to explicitly store different Mnesia tables/fragments on multiple volumes? On Mon, Dec 7, 2009 at 5:02 PM, adam wrote: > Not sure if this will help anyone else, but there are two parts to the > solution I used for this: > > 1) Use +A [Num threads] with erl to increase the number of > asynchronous threads for IO. (Thanks to Valentin Micic for this one) > 2) If using a file store like EBS, distribute the database across > several EBS volumes. > > Adam > > On Dec 2, 10:24?pm, adam wrote: >> We have running Erlang code that is executing about 30 transactions >> per second. Each transaction puts a write lock on a couple of records, >> then performs a read and a write. We need to hold several hundred >> million records simultaneously. >> >> When using disc_copies tables, we can easily manage to run about 160 >> transactions per second. We also see that each transaction takes an >> average of about 750-1400 microseconds to run. Min time is 350 >> microseconds, and max time seems to go between 30-100 milliseconds. >> >> However, with disc_only_copies tables, individual transaction time >> ranges between 500 microseconds up to about 90 seconds(!). Why do >> individual transactions sometimes take such a long time with >> disc_only_copies? >> >> Thank you! >> Adam >> >> ________________________________________________________________ >> erlang-questions mailing list. Seehttp://www.erlang.org/faq.html >> erlang-questions (at) erlang.org > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From ok@REDACTED Tue Dec 8 01:37:02 2009 From: ok@REDACTED (Richard O'Keefe) Date: Tue, 8 Dec 2009 13:37:02 +1300 Subject: [erlang-questions] Lazy lists In-Reply-To: References: Message-ID: I never really expected to mention coinductive data types in the Erlang mailing list... To support "lazy (infinite) list"s, you need a data type C(E) [C = container E = element] and a function view :: C(E) -> 0 + (E x C(E)) which we might express in Erlang as view(CE) ---> [] or view(CE) ---> [E | CE'] The representation from the Erlang documentation is C(E) = fun(() -> [] | [E | C(E)]) view(CE) = CE() The other representation is C(E) = [] | [E | fun(() -> C(E))] view(CE) = case CE of [] -> [] ; [X|F] -> [X|F()] end which has the down-side of evaluating one more element than you actually need. With the first representation, map(F, CE) -> fun (()) -> case CE() of [] -> [] ; [X|Xs] -> [F(X) | map(F, Xs)] end end. compared with map(F, L) -> case L of [] -> [] ; [X|Xs] -> [F(X) | map(F, Xs)] end. for an ordinary list. filter(P, CE) -> fun (()) -> case CE() of [] -> [] ; [X|Xs] -> case P(X) of true -> [X | filter(P, Xs)] ; false -> (filter(P, Xs))() end end end. compared with filter(P, L) -> case L of [] -> ; [X|Xs] -> case P(X) of true -> [X | filter(P, Xs)] ; false -> filter(P, Xs) end end. for an ordinary list. foldl(F, A, CE) -> case CE() of [] -> A ; [X|Xs] -> foldl(F, F(A,X), Xs) end. compared with foldl(F, A, L) -> case L of [] -> [] ; [X|Xs] -> foldl(F, F(A,X), Xs) end. for an ordinary list. Step 0: rewrite pattern matching to use case. Step 1: replace case L of [] -> E0 ; [X|Xs] -> E1 end with case view(L) of [] -> E0 ; [X|Xs] -> E1 end Step 2: if you have g(...), known to return a lazy list, in a context where a non-lazy result is required, replace it by view(g(...)). Step 3: if the result is a list, replace f(...) -> E. with f(...) -> fun () -> E end. From andrey.paramonov@REDACTED Tue Dec 8 02:11:53 2009 From: andrey.paramonov@REDACTED (Andrey) Date: Mon, 7 Dec 2009 17:11:53 -0800 (PST) Subject: Lazy lists In-Reply-To: References: Message-ID: <3349ffdd-31b2-47f7-b20f-207fc6d84c88@g12g2000yqa.googlegroups.com> Wow! Thanks a lot for such a quick and thorough response. From steven.charles.davis@REDACTED Tue Dec 8 02:21:56 2009 From: steven.charles.davis@REDACTED (Steve Davis) Date: Mon, 7 Dec 2009 17:21:56 -0800 (PST) Subject: Port forwarding / managed web In-Reply-To: <4B1D8182.2070307@ghostgun.com> References: <20091206223612.GI25450@hezmatt.org> <0DF9A9C2-C0B7-40BF-B7E1-73AD6C979465@souja.net> <4B1D8182.2070307@ghostgun.com> Message-ID: <605c1376-f8e1-4819-acc6-d35216d856d5@d20g2000yqh.googlegroups.com> IIRC Yaws has a module explicitly for using it as a reverse proxy... Would be interesting to see a standoff between that and Nginx/Apache. /s From mpalmer@REDACTED Tue Dec 8 03:26:25 2009 From: mpalmer@REDACTED (Matthew Palmer) Date: Tue, 8 Dec 2009 13:26:25 +1100 Subject: Port forwarding / managed web In-Reply-To: <605c1376-f8e1-4819-acc6-d35216d856d5@d20g2000yqh.googlegroups.com> References: <20091206223612.GI25450@hezmatt.org> <0DF9A9C2-C0B7-40BF-B7E1-73AD6C979465@souja.net> <4B1D8182.2070307@ghostgun.com> <605c1376-f8e1-4819-acc6-d35216d856d5@d20g2000yqh.googlegroups.com> Message-ID: <20091208022625.GS25450@hezmatt.org> On Mon, Dec 07, 2009 at 05:21:56PM -0800, Steve Davis wrote: > IIRC Yaws has a module explicitly for using it as a reverse proxy... > > Would be interesting to see a standoff between that and Nginx/Apache. There's every likelihood that in a high-capacity/throughput situation, yaws would perform admirably in comparison to the alternatives. I don't use nginx/Apache as a frontend webserver because it's necessarily the fastest gun in the west, though, I use it because it's got support for practically everything I'd want to do in a frontend webserver already built-in. - Matt From seancribbs@REDACTED Tue Dec 8 04:27:56 2009 From: seancribbs@REDACTED (Sean Cribbs) Date: Mon, 07 Dec 2009 22:27:56 -0500 Subject: [erlang-questions] Re: Port forwarding / managed web In-Reply-To: <605c1376-f8e1-4819-acc6-d35216d856d5@d20g2000yqh.googlegroups.com> References: <20091206223612.GI25450@hezmatt.org> <0DF9A9C2-C0B7-40BF-B7E1-73AD6C979465@souja.net> <4B1D8182.2070307@ghostgun.com> <605c1376-f8e1-4819-acc6-d35216d856d5@d20g2000yqh.googlegroups.com> Message-ID: <4B1DC7BC.8040106@gmail.com> Joe Williams gave a talk called "Webserver Deathmatch" at Erlang Factory SFBay 2009. I thought his findings were interesting. You can get more info here: http://www.erlang-factory.com/conference/SFBayAreaErlangFactory2009/speakers/joewilliams Sean Steve Davis wrote: > IIRC Yaws has a module explicitly for using it as a reverse proxy... > > Would be interesting to see a standoff between that and Nginx/Apache. > > /s > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > > From aduston@REDACTED Tue Dec 8 06:19:01 2009 From: aduston@REDACTED (adam) Date: Mon, 7 Dec 2009 21:19:01 -0800 (PST) Subject: The Unbearable Slowness of Some disc_only_copies Transactions In-Reply-To: References: <6371951e-9465-4330-9091-ed053548e420@u7g2000yqm.googlegroups.com> Message-ID: <5b85f9ca-7bd5-483b-bf4d-a1c73081e8f6@a32g2000yqm.googlegroups.com> Multiple volumes. We ended up creating several Erlang nodes on the same machine, one for each volume, then we relied on mnesia_frag to distribute table fragments evenly over the Erlang nodes, and hence over the EBS volumes. On Dec 7, 7:28?pm, Garrett Smith wrote: > Do you mean mount a single volume on multiple EBS partitions (e.g. > raid-0) or to explicitly store different Mnesia tables/fragments on > multiple volumes? > > > > On Mon, Dec 7, 2009 at 5:02 PM, adam wrote: > > Not sure if this will help anyone else, but there are two parts to the > > solution I used for this: > > > 1) Use +A [Num threads] with erl to increase the number of > > asynchronous threads for IO. (Thanks to Valentin Micic for this one) > > 2) If using a file store like EBS, distribute the database across > > several EBS volumes. > > > Adam > > > On Dec 2, 10:24?pm, adam wrote: > >> We have running Erlang code that is executing about 30 transactions > >> per second. Each transaction puts a write lock on a couple of records, > >> then performs a read and a write. We need to hold several hundred > >> million records simultaneously. > > >> When using disc_copies tables, we can easily manage to run about 160 > >> transactions per second. We also see that each transaction takes an > >> average of about 750-1400 microseconds to run. Min time is 350 > >> microseconds, and max time seems to go between 30-100 milliseconds. > > >> However, with disc_only_copies tables, individual transaction time > >> ranges between 500 microseconds up to about 90 seconds(!). Why do > >> individual transactions sometimes take such a long time with > >> disc_only_copies? > > >> Thank you! > >> Adam > > >> ________________________________________________________________ > >> erlang-questions mailing list. Seehttp://www.erlang.org/faq.html > >> erlang-questions (at) erlang.org > > > ________________________________________________________________ > > erlang-questions mailing list. Seehttp://www.erlang.org/faq.html > > erlang-questions (at) erlang.org > > ________________________________________________________________ > erlang-questions mailing list. Seehttp://www.erlang.org/faq.html > erlang-questions (at) erlang.org From bgustavsson@REDACTED Tue Dec 8 08:03:58 2009 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Tue, 8 Dec 2009 08:03:58 +0100 Subject: [erlang-questions] Drive by mention of new features without explaination In-Reply-To: <26ACAB17-0BBC-4D1B-B634-DF15323C7452@souja.net> References: <6a36e7290912071012s7e731391o47186bc32cab5675@mail.gmail.com> <4B1D5C29.3060800@tmit.bme.hu> <4B1D66E3.3010605@erlang-consulting.com> <4B1D6BA4.10408@tmit.bme.hu> <3dbc6d1c0912071408r57f7fcccu6c3549dd02d65b23@mail.gmail.com> <26ACAB17-0BBC-4D1B-B634-DF15323C7452@souja.net> Message-ID: <6672d0160912072303x67079907g7e1985e27e1178dc@mail.gmail.com> On Mon, Dec 7, 2009 at 11:23 PM, Jayson Vantuyl wrote: > Why have false unload the module? ?It appears that there are broken semantics. ?As if "on_load" really is semantically closer to "should_load_and_convenient_side_effects". ?I'd much rather have on_load return either ok or some error that could be logged intelligently. ?Fitting in with load_nif is just a bonus. It makes sense. Currently, if the on_load function returns anything but 'true', the module will be unloaded, so it is not really a true boolean anyway. Therefore, I suggest the following change for R13B04: The on_load function must return 'ok' if the function is to remain loaded. Returning any other value (or causing an exception) will cause the module to be unloaded. In addition, if the return value is {error,Anything}, a message will be written to the error_logger. Unless someone finds any problem with this, I'll probably implement the new semantics within a few days. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From hakan@REDACTED Tue Dec 8 08:22:41 2009 From: hakan@REDACTED (=?ISO-8859-1?Q?H=E5kan_Mattsson?=) Date: Tue, 8 Dec 2009 08:22:41 +0100 Subject: [erlang-questions] Replicating a distributed database In-Reply-To: References: Message-ID: <922d05850912072322q1709ddek7f42d76a7ccb1b@mail.gmail.com> On Tue, Dec 8, 2009 at 12:09 AM, adam wrote: > It's interesting: I can't find an answer to this question anywhere. We > have a table that has fragments evenly distributed between nodes A and > B. We want to replicate these fragments to nodes C and D, which are on > separate machines. I believe that the Mnesia API provides no way of > accomplishing this without unseemly workarounds. Am I wrong? > > If I start an Mnesia cluster on nodes A, B, C, and D, then as soon as > I create a fragmented table, Mnesia distributes the fragments evenly > between nodes A, B, C, and D, so there's a lot of work required with > add_table_copy to get the fragments in the right place. It appears > that mnesia ignores the disc_only_copies option when creating a > fragmented table, only paying attention to n_disc_only_copies in the > frag_properties option, so I believe there's no nice way to order > mnesia to put fragments on nodes A and B only. > > I can start an Mnesia cluster on nodes A and B, create the fragmented > tables, then add nodes C and D and use add_table_copy. This appears to > give correct results but is kind of an ugly solution. > > Am I missing some obvious way to accomplish this? Yes, use the node_pool option. It defaults to all nodes in the schema, but you can use it to control which nodes that initially will be used for the fragmented table. For example, this will create a table with 100 fragments distributed over the nodes a and b regardless of how many nodes that are known in the schema: mnesia:create_table(f, [{frag_properties, [{n_fragments, 100}, {n_disc_copies, 2}, {node_pool, [a@REDACTED, b@REDACTED]}]}]). Take a look at the Mnesia info before and after the call below. /H?kan --- H?kan Mattsson (0705-199 251) (a@REDACTED)10> mnesia:info(). ---> Processes holding locks <--- ---> Processes waiting for locks <--- ---> Participant transactions <--- ---> Coordinator transactions <--- ---> Uncertain transactions <--- ---> Active tables <--- schema : with 1 records occupying 432 words of mem ===> System info in version "4.4.12", debug level = none <=== opt_disc. Directory "/home/hakan/Mnesia.a@REDACTED" is used. use fallback at restart = false running db nodes = [d@REDACTED,b@REDACTED,c@REDACTED,a@REDACTED] stopped db nodes = [] master node tables = [] remote = [] ram_copies = [] disc_copies = [schema] disc_only_copies = [] [{a@REDACTED,disc_copies}, {b@REDACTED,disc_copies}, {c@REDACTED,disc_copies}, {d@REDACTED,disc_copies}] = [schema] 2 transactions committed, 0 aborted, 0 restarted, 0 logged to disc 0 held locks, 0 in queue; 0 local transactions, 0 remote 0 transactions waits for other nodes: [] ok (a@REDACTED)12> mnesia:create_table(f, [{frag_properties, [{n_fragments, 100}, {n_disc_copies, 2}, {node_pool, [a@REDACTED, b@REDACTED]}]}]). {atomic,ok} (a@REDACTED)13> mnesia:info(). ---> Processes holding locks <--- ---> Processes waiting for locks <--- ---> Participant transactions <--- ---> Coordinator transactions <--- ---> Uncertain transactions <--- ---> Active tables <--- f : with 0 records occupying 316 words of mem f_frag2 : with 0 records occupying 316 words of mem f_frag3 : with 0 records occupying 316 words of mem f_frag4 : with 0 records occupying 316 words of mem f_frag5 : with 0 records occupying 316 words of mem f_frag6 : with 0 records occupying 316 words of mem f_frag7 : with 0 records occupying 316 words of mem f_frag8 : with 0 records occupying 316 words of mem f_frag9 : with 0 records occupying 316 words of mem f_frag10 : with 0 records occupying 316 words of mem f_frag11 : with 0 records occupying 316 words of mem f_frag12 : with 0 records occupying 316 words of mem f_frag13 : with 0 records occupying 316 words of mem f_frag14 : with 0 records occupying 316 words of mem f_frag15 : with 0 records occupying 316 words of mem f_frag16 : with 0 records occupying 316 words of mem f_frag17 : with 0 records occupying 316 words of mem f_frag18 : with 0 records occupying 316 words of mem f_frag19 : with 0 records occupying 316 words of mem f_frag20 : with 0 records occupying 316 words of mem f_frag21 : with 0 records occupying 316 words of mem f_frag22 : with 0 records occupying 316 words of mem f_frag23 : with 0 records occupying 316 words of mem f_frag24 : with 0 records occupying 316 words of mem f_frag25 : with 0 records occupying 316 words of mem f_frag26 : with 0 records occupying 316 words of mem f_frag27 : with 0 records occupying 316 words of mem f_frag28 : with 0 records occupying 316 words of mem f_frag29 : with 0 records occupying 316 words of mem f_frag30 : with 0 records occupying 316 words of mem f_frag31 : with 0 records occupying 316 words of mem f_frag32 : with 0 records occupying 316 words of mem f_frag33 : with 0 records occupying 316 words of mem f_frag34 : with 0 records occupying 316 words of mem f_frag35 : with 0 records occupying 316 words of mem f_frag36 : with 0 records occupying 316 words of mem f_frag37 : with 0 records occupying 316 words of mem f_frag38 : with 0 records occupying 316 words of mem f_frag39 : with 0 records occupying 316 words of mem f_frag40 : with 0 records occupying 316 words of mem f_frag41 : with 0 records occupying 316 words of mem f_frag42 : with 0 records occupying 316 words of mem f_frag43 : with 0 records occupying 316 words of mem f_frag44 : with 0 records occupying 316 words of mem f_frag45 : with 0 records occupying 316 words of mem f_frag46 : with 0 records occupying 316 words of mem f_frag47 : with 0 records occupying 316 words of mem f_frag48 : with 0 records occupying 316 words of mem f_frag49 : with 0 records occupying 316 words of mem f_frag50 : with 0 records occupying 316 words of mem f_frag51 : with 0 records occupying 316 words of mem f_frag52 : with 0 records occupying 316 words of mem f_frag53 : with 0 records occupying 316 words of mem f_frag54 : with 0 records occupying 316 words of mem f_frag55 : with 0 records occupying 316 words of mem f_frag56 : with 0 records occupying 316 words of mem f_frag57 : with 0 records occupying 316 words of mem f_frag58 : with 0 records occupying 316 words of mem f_frag59 : with 0 records occupying 316 words of mem f_frag60 : with 0 records occupying 316 words of mem f_frag61 : with 0 records occupying 316 words of mem f_frag62 : with 0 records occupying 316 words of mem f_frag63 : with 0 records occupying 316 words of mem f_frag64 : with 0 records occupying 316 words of mem f_frag65 : with 0 records occupying 316 words of mem f_frag66 : with 0 records occupying 316 words of mem f_frag67 : with 0 records occupying 316 words of mem f_frag68 : with 0 records occupying 316 words of mem f_frag69 : with 0 records occupying 316 words of mem f_frag70 : with 0 records occupying 316 words of mem f_frag71 : with 0 records occupying 316 words of mem f_frag72 : with 0 records occupying 316 words of mem f_frag73 : with 0 records occupying 316 words of mem f_frag74 : with 0 records occupying 316 words of mem f_frag75 : with 0 records occupying 316 words of mem f_frag76 : with 0 records occupying 316 words of mem f_frag77 : with 0 records occupying 316 words of mem f_frag78 : with 0 records occupying 316 words of mem f_frag79 : with 0 records occupying 316 words of mem f_frag80 : with 0 records occupying 316 words of mem f_frag81 : with 0 records occupying 316 words of mem f_frag82 : with 0 records occupying 316 words of mem f_frag83 : with 0 records occupying 316 words of mem f_frag84 : with 0 records occupying 316 words of mem f_frag85 : with 0 records occupying 316 words of mem f_frag86 : with 0 records occupying 316 words of mem f_frag87 : with 0 records occupying 316 words of mem f_frag88 : with 0 records occupying 316 words of mem f_frag89 : with 0 records occupying 316 words of mem f_frag90 : with 0 records occupying 316 words of mem f_frag91 : with 0 records occupying 316 words of mem f_frag92 : with 0 records occupying 316 words of mem f_frag93 : with 0 records occupying 316 words of mem f_frag94 : with 0 records occupying 316 words of mem f_frag95 : with 0 records occupying 316 words of mem f_frag96 : with 0 records occupying 316 words of mem f_frag97 : with 0 records occupying 316 words of mem f_frag98 : with 0 records occupying 316 words of mem f_frag99 : with 0 records occupying 316 words of mem f_frag100 : with 0 records occupying 316 words of mem schema : with 101 records occupying 12167 words of mem ===> System info in version "4.4.12", debug level = none <=== opt_disc. Directory "/home/hakan/Mnesia.a@REDACTED" is used. use fallback at restart = false running db nodes = [d@REDACTED,b@REDACTED,c@REDACTED,a@REDACTED] stopped db nodes = [] master node tables = [] remote = [] ram_copies = [] disc_copies = [f,f_frag10,f_frag100,f_frag11,f_frag12,f_frag13, f_frag14,f_frag15,f_frag16,f_frag17,f_frag18,f_frag19, f_frag2,f_frag20,f_frag21,f_frag22,f_frag23,f_frag24, f_frag25,f_frag26,f_frag27,f_frag28,f_frag29,f_frag3, f_frag30,f_frag31,f_frag32,f_frag33,f_frag34,f_frag35, f_frag36,f_frag37,f_frag38,f_frag39,f_frag4,f_frag40, f_frag41,f_frag42,f_frag43,f_frag44,f_frag45,f_frag46, f_frag47,f_frag48,f_frag49,f_frag5,f_frag50,f_frag51, f_frag52,f_frag53,f_frag54,f_frag55,f_frag56,f_frag57, f_frag58,f_frag59,f_frag6,f_frag60,f_frag61,f_frag62, f_frag63,f_frag64,f_frag65,f_frag66,f_frag67,f_frag68, f_frag69,f_frag7,f_frag70,f_frag71,f_frag72,f_frag73, f_frag74,f_frag75,f_frag76,f_frag77,f_frag78,f_frag79, f_frag8,f_frag80,f_frag81,f_frag82,f_frag83,f_frag84, f_frag85,f_frag86,f_frag87,f_frag88,f_frag89,f_frag9, f_frag90,f_frag91,f_frag92,f_frag93,f_frag94,f_frag95, f_frag96,f_frag97,f_frag98,f_frag99,schema] disc_only_copies = [] [{a@REDACTED,disc_copies},{b@REDACTED,disc_copies}] = [f_frag100,f_frag99,f_frag98, f_frag97,f_frag96,f_frag95, f_frag94,f_frag93,f_frag92, f_frag91,f_frag90,f_frag89, f_frag88,f_frag87,f_frag86, f_frag85,f_frag84,f_frag83, f_frag82,f_frag81,f_frag80, f_frag79,f_frag78,f_frag77, f_frag76,f_frag75,f_frag74, f_frag73,f_frag72,f_frag71, f_frag70,f_frag69,f_frag68, f_frag67,f_frag66,f_frag65, f_frag64,f_frag63,f_frag62, f_frag61,f_frag60,f_frag59, f_frag58,f_frag57,f_frag56, f_frag55,f_frag54,f_frag53, f_frag52,f_frag51,f_frag50, f_frag49,f_frag48,f_frag47, f_frag46,f_frag45,f_frag44, f_frag43,f_frag42,f_frag41, f_frag40,f_frag39,f_frag38, f_frag37,f_frag36,f_frag35, f_frag34,f_frag33,f_frag32, f_frag31,f_frag30,f_frag29, f_frag28,f_frag27,f_frag26, f_frag25,f_frag24,f_frag23, f_frag22,f_frag21,f_frag20, f_frag19,f_frag18,f_frag17, f_frag16,f_frag15,f_frag14, f_frag13,f_frag12,f_frag11, f_frag10,f_frag9,f_frag8, f_frag7,f_frag6,f_frag5, f_frag4,f_frag3,f_frag2,f] [{a@REDACTED,disc_copies}, {b@REDACTED,disc_copies}, {c@REDACTED,disc_copies}, {d@REDACTED,disc_copies}] = [schema] 3 transactions committed, 1 aborted, 0 restarted, 1 logged to disc 0 held locks, 0 in queue; 0 local transactions, 0 remote 0 transactions waits for other nodes: [] ok (a@REDACTED)14> From max.lapshin@REDACTED Tue Dec 8 10:04:14 2009 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 8 Dec 2009 12:04:14 +0300 Subject: =?UTF-8?Q?Erlyvideo_=E2=80=94_current_status?= Message-ID: Hi. Since previous announce of erlyvideo reanimation, changed a lot. Currently erlyvideo is capable to stream flv files, mp4 h264/aac files (both types with fast seek, available by tricky mechanisms). RTMPT protocol implemented (badly designed tunneling of RTMP in HTTP). It can record video/audio from web camera via flash. It is possible to organize centralized video chat with it. It can use external MPEG TS stream as a video source, so you can use vlc as a transcoder filter after your camera to restream live content to WEB. Currently, RTSP/RTP is implemented to use Quicktime Broadcaster, but there are still problems. Original implementation of AMF format was changed to superior http://github.com/mujaheed/erlang-amf Preliminary support for plugins exists. In tested use cases, erlyvideo seems to be rather stable and leak-proof. From sverker@REDACTED Tue Dec 8 11:37:39 2009 From: sverker@REDACTED (Sverker Eriksson) Date: Tue, 08 Dec 2009 11:37:39 +0100 Subject: [erlang-questions] Drive by mention of new features without explaination In-Reply-To: <6672d0160912072303x67079907g7e1985e27e1178dc@mail.gmail.com> References: <6a36e7290912071012s7e731391o47186bc32cab5675@mail.gmail.com> <4B1D5C29.3060800@tmit.bme.hu> <4B1D66E3.3010605@erlang-consulting.com> <4B1D6BA4.10408@tmit.bme.hu> <3dbc6d1c0912071408r57f7fcccu6c3549dd02d65b23@mail.gmail.com> <26ACAB17-0BBC-4D1B-B634-DF15323C7452@souja.net> <6672d0160912072303x67079907g7e1985e27e1178dc@mail.gmail.com> Message-ID: <4B1E2C73.7070107@erix.ericsson.se> Bj?rn Gustavsson wrote: > Therefore, I suggest the following change for R13B04: > > The on_load function must return 'ok' if the function is to remain loaded. > > Returning any other value (or causing an exception) will cause the > module to be unloaded. > In addition, if the return value is {error,Anything}, a message will > be written to the error_logger. > > Actually load_nif returns {error, ReasonAtom, ReasonText} where the atom is "matchable" and the text human readable. Would it be better with {error, {Atom,Text}} maybe? And right now I recommend matching against 'ok' which will get you that error tuple in the face, at least when playing in the shell: on_load() -> ok = load_nif("./niftest", 0), true. 1> niftest:hello(). =ERROR REPORT==== 8-Dec-2009::11:01:37 === Error in process <0.35.0> with exit value: {{badmatch,{error,load_failed,"Failed to load NIF library ./niftest: './niftest.so: cannot open shared object file: No such file or directory'"}}, ** exception error: undefined function niftest:hello/0 2> /Sverker, Erlang/OTP Ericsson From bgustavsson@REDACTED Tue Dec 8 12:51:53 2009 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Tue, 8 Dec 2009 12:51:53 +0100 Subject: [erlang-questions] Drive by mention of new features without explaination In-Reply-To: <4B1E2C73.7070107@erix.ericsson.se> References: <6a36e7290912071012s7e731391o47186bc32cab5675@mail.gmail.com> <4B1D5C29.3060800@tmit.bme.hu> <4B1D66E3.3010605@erlang-consulting.com> <4B1D6BA4.10408@tmit.bme.hu> <3dbc6d1c0912071408r57f7fcccu6c3549dd02d65b23@mail.gmail.com> <26ACAB17-0BBC-4D1B-B634-DF15323C7452@souja.net> <6672d0160912072303x67079907g7e1985e27e1178dc@mail.gmail.com> <4B1E2C73.7070107@erix.ericsson.se> Message-ID: <6672d0160912080351wbf28112m3f5be40f7a7b735e@mail.gmail.com> On Tue, Dec 8, 2009 at 11:37 AM, Sverker Eriksson wrote: > Actually load_nif returns {error, ReasonAtom, ReasonText} where the atom is > "matchable" and the text human readable. Would it be better with {error, > {Atom,Text}} maybe? Yes, that would be better. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From hans.r.nilsson@REDACTED Tue Dec 8 17:50:12 2009 From: hans.r.nilsson@REDACTED (Hans Nilsson R) Date: Tue, 08 Dec 2009 17:50:12 +0100 Subject: NIF wishes Message-ID: <4B1E83C4.8090506@ericsson.com> I have been playing with the NIF facility in R13B03 and I have some comments. The implementation is very stable, as usual with experimental code from Erlang/OTP! And very fast.... I have a large binary which I pass into a nif, which processes a part of it and returns the result and the unprocessed part of the binary. The unprocessed part is then input to the nif again and so on. Wish 1: Now, in the nif, to make a copy of the unprocessed part and make a new binary is time consuming, so some function enif_make_sub_binary(env, bin, from, to) would be useful. Wish 2: When the nif shall return a part of the binary as a string or a binary, the functions enif_make_atom and enif_make_string assumes that the part is zero-terminated. It is of course possible to save the character, write a zero, call the enif-function and then write back the original character, but it is of course dangerous to modify in place in a binary... The alternative of copying the characters to a buffer is slow. Therefore I'd like to have some enif_make_string_n(env, char *p, int length) as well, analogous to the c-library functions strcpy and strncpy. /Hans Nilsson From mevans@REDACTED Tue Dec 8 18:03:12 2009 From: mevans@REDACTED (Evans, Matthew) Date: Tue, 8 Dec 2009 12:03:12 -0500 Subject: NIF vs. Linked-in Drivers Message-ID: Hi, Are there any guidelines as to the use of the new Erlang NIF vs. a linked-in port driver? We have an application that needs to access C code, and are currently thinking (and have used in the past) a linked-in port driver. Under what situations would that approach be better than a NIF, and visa versa? Also, we all know that a linked in driver can crash or lock the Erlang runtime system if the driver is poorly implemented. Do these risks still exist with NIFs? Thanks Matt From rapsey@REDACTED Tue Dec 8 18:04:10 2009 From: rapsey@REDACTED (Rapsey) Date: Tue, 8 Dec 2009 18:04:10 +0100 Subject: [erlang-questions] NIF wishes In-Reply-To: <4B1E83C4.8090506@ericsson.com> References: <4B1E83C4.8090506@ericsson.com> Message-ID: <97619b170912080904q5359d5afi75d45c8c7cb4afdb@mail.gmail.com> Speaking of binaries and NIF. If you send one to a NIF function, you get a direct pointer to the binary and can modify it in-place. How dangerous is this? Sergej On Tue, Dec 8, 2009 at 5:50 PM, Hans Nilsson R wrote: > I have been playing with the NIF facility in R13B03 and I have some > comments. The implementation is very stable, as usual with experimental code > from Erlang/OTP! And very fast.... > > I have a large binary which I pass into a nif, which processes a part of it > and returns the result and the unprocessed part of the binary. The > unprocessed part is then input to the nif again and so on. > > Wish 1: > Now, in the nif, to make a copy of the unprocessed part and make a new > binary is time consuming, so some function enif_make_sub_binary(env, bin, > from, to) would be useful. > > Wish 2: > When the nif shall return a part of the binary as a string or a binary, the > functions enif_make_atom and enif_make_string assumes that the part is > zero-terminated. It is of course possible to save the character, write a > zero, call the enif-function and then write back the original character, but > it is of course dangerous to modify in place in a binary... The alternative > of copying the characters to a buffer is slow. > > Therefore I'd like to have some enif_make_string_n(env, char *p, int > length) as well, analogous to the c-library functions strcpy and strncpy. > > /Hans Nilsson > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From rapsey@REDACTED Tue Dec 8 18:06:55 2009 From: rapsey@REDACTED (Rapsey) Date: Tue, 8 Dec 2009 18:06:55 +0100 Subject: [erlang-questions] NIF vs. Linked-in Drivers In-Reply-To: References: Message-ID: <97619b170912080906n33cf9911k31d6275e62518531@mail.gmail.com> NIF libraries are linked into erlang just like linked in drivers. If they crash, so does beam process. Sergej On Tue, Dec 8, 2009 at 6:03 PM, Evans, Matthew wrote: > Hi, > > Are there any guidelines as to the use of the new Erlang NIF vs. a > linked-in port driver? > > We have an application that needs to access C code, and are currently > thinking (and have used in the past) a linked-in port driver. Under what > situations would that approach be better than a NIF, and visa versa? > > Also, we all know that a linked in driver can crash or lock the Erlang > runtime system if the driver is poorly implemented. Do these risks still > exist with NIFs? > > Thanks > > Matt > From kiszl@REDACTED Tue Dec 8 18:23:58 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Tue, 08 Dec 2009 18:23:58 +0100 Subject: Erjang Message-ID: <4B1E8BAE.4090805@tmit.bme.hu> Hi all, I've just run into Erjang, "a JVM-based Erlang VM": http://wiki.github.com/krestenkrab/erjang . Has anyone happened to try this? Regards, Zoltan. From hans.r.nilsson@REDACTED Tue Dec 8 18:47:06 2009 From: hans.r.nilsson@REDACTED (Hans Nilsson R) Date: Tue, 08 Dec 2009 18:47:06 +0100 Subject: [erlang-questions] NIF wishes In-Reply-To: <97619b170912080904q5359d5afi75d45c8c7cb4afdb@mail.gmail.com> References: <4B1E83C4.8090506@ericsson.com> <97619b170912080904q5359d5afi75d45c8c7cb4afdb@mail.gmail.com> Message-ID: <4B1E911A.2020806@ericsson.com> If I remember correctly, large binaries are shared between processes in a separate area. So a change will stay in the binary both in the calling process and in other processes who have a reference to the binary or to parts of it. /Hans Nilsson Rapsey skrev: > Speaking of binaries and NIF. If you send one to a NIF function, you get a > direct pointer to the binary and can modify it in-place. How dangerous is > this? > > > Sergej > > On Tue, Dec 8, 2009 at 5:50 PM, Hans Nilsson R > wrote: > > >> I have been playing with the NIF facility in R13B03 and I have some >> comments. The implementation is very stable, as usual with experimental code >> from Erlang/OTP! And very fast.... >> >> I have a large binary which I pass into a nif, which processes a part of it >> and returns the result and the unprocessed part of the binary. The >> unprocessed part is then input to the nif again and so on. >> >> Wish 1: >> Now, in the nif, to make a copy of the unprocessed part and make a new >> binary is time consuming, so some function enif_make_sub_binary(env, bin, >> from, to) would be useful. >> >> Wish 2: >> When the nif shall return a part of the binary as a string or a binary, the >> functions enif_make_atom and enif_make_string assumes that the part is >> zero-terminated. It is of course possible to save the character, write a >> zero, call the enif-function and then write back the original character, but >> it is of course dangerous to modify in place in a binary... The alternative >> of copying the characters to a buffer is slow. >> >> Therefore I'd like to have some enif_make_string_n(env, char *p, int >> length) as well, analogous to the c-library functions strcpy and strncpy. >> >> /Hans Nilsson >> >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> >> > > From johann.hoechtl@REDACTED Tue Dec 8 18:47:35 2009 From: johann.hoechtl@REDACTED (=?ISO-8859-1?Q?Johann_H=F6chtl?=) Date: Tue, 8 Dec 2009 09:47:35 -0800 (PST) Subject: Erjang In-Reply-To: <4B1E8BAE.4090805@tmit.bme.hu> References: <4B1E8BAE.4090805@tmit.bme.hu> Message-ID: > Hi all, > > I've just run into Erjang, "a JVM-based Erlang VM":http://wiki.github.com/krestenkrab/erjang. Has anyone happened to try this? > Sorry to say no, and my personal opinion is, that it is not such a great idea, but this is solely based on 'personal feeling' rather than profound technical insight. I liked this quote best: "The big win will be running on a VM that does dynamic compilation, selective inlining, and all the performance that comes from that. With that be enough to out-weigh the various disadvantages? Time wil show." Given the trmendous work which has been done on Luajit2 and the vast improvements speedwise, I wonder I sthg. a least mildly comparabel could be done to the Beam VM. Is some work going on for HIPE or the VM in general? > Regards, > Zoltan. > > ________________________________________________________________ > erlang-questions mailing list. Seehttp://www.erlang.org/faq.html > erlang-questions (at) erlang.org From tony@REDACTED Tue Dec 8 18:58:44 2009 From: tony@REDACTED (Tony Arcieri) Date: Tue, 8 Dec 2009 10:58:44 -0700 Subject: [erlang-questions] Re: Erjang In-Reply-To: References: <4B1E8BAE.4090805@tmit.bme.hu> Message-ID: On Tue, Dec 8, 2009 at 10:47 AM, Johann H?chtl wrote: > Given the trmendous work which has been done on Luajit2 and the vast > improvements speedwise, I wonder I sthg. a least mildly comparabel > could be done to the Beam VM. Is some work going on for HIPE or the VM > in general? > HiPE is nowhere close to the JVM's HotSpot in terms of the types of optimizations in can perform. Among other things, the JVM's HotSpot can deoptimize. HiPE cannot, and for this reason HiPE cannot inline across modules, as a code change would require the inliner to deoptimize whenever code change occurs. Deoptimization also allows HotSpot to try aggressive optimizations which may actually lead to performance regressions or no noticeable improvements, in which case it can deoptimize and try again. -- Tony Arcieri Medioh! A Kudelski Brand From senthilkumar.peelikkampatti@REDACTED Tue Dec 8 18:59:52 2009 From: senthilkumar.peelikkampatti@REDACTED (Senthilkumar Peelikkampatti) Date: Tue, 8 Dec 2009 11:59:52 -0600 Subject: open_port issue Message-ID: <45d8e23d0912080959h76af2718v985259091fa5d33@mail.gmail.com> I wanted to call imagemagick's convert utility. Here Cmd is ="convert - -resize 100x100 jpg:-", this command tells image magic to read the binary data from Stdin and emit the result back to stdout, but I am not error "Unable to write back to output". Is this the correct way to use open_port? cmd(Cmd, Bin) -> Port = open_port({spawn, Cmd}, [stream, use_stdio, in, out, binary]), port_command(Port, Bin), TRef = erlang:start_timer(3000, self(), timeout), recv_data(Port, TRef, <<>>). recv_data(Port, TRef, Buf) -> receive {Port, {data, Bytes}} -> NewBuf = <>; {Port, {data, _}} -> return(Port, TRef, {error, efbig}); {Port, eof} when Buf /= <<>> -> return(Port, TRef, {ok, Buf}); {Port, eof} -> return(Port, TRef, {error, enodata}); {timeout, TRef, _} -> return(Port, TRef, {error, timeout}) end. return(Port, TRef, Result) -> case erlang:cancel_timer(TRef) of false -> receive {timeout, TRef, _} -> ok after 0 -> ok end; _ -> ok end, catch port_close(Port), Result. -- Regards, Senthilkumar Peelikkampatti, http://pmsenthilkumar.blogspot.com/ From sverker@REDACTED Tue Dec 8 19:49:18 2009 From: sverker@REDACTED (Sverker Eriksson) Date: Tue, 08 Dec 2009 19:49:18 +0100 Subject: [erlang-questions] NIF vs. Linked-in Drivers In-Reply-To: References: Message-ID: <4B1E9FAE.70308@erix.ericsson.se> Evans, Matthew wrote: > Hi, > > Are there any guidelines as to the use of the new Erlang NIF vs. a linked-in port driver? > > We have an application that needs to access C code, and are currently thinking (and have used in the past) a linked-in port driver. Under what situations would that approach be better than a NIF, and visa versa? > > A driver is definitely better if you want to be asynchronous and react on events from some "device". NIFs are by nature synchronous. You call them as any Erlang function and get a return value back. You will block the calling scheduler thread until the NIF returns, so you don't want to do too heavy computations in one call. Drivers currently have more support like threading and message sending to work around that, but the NIFs will most probably get at least some sort of support to be more "interruptable". /Sverker, Erlang/OTP Ericsson From sverker@REDACTED Tue Dec 8 20:04:50 2009 From: sverker@REDACTED (Sverker Eriksson) Date: Tue, 08 Dec 2009 20:04:50 +0100 Subject: [erlang-questions] NIF wishes In-Reply-To: <4B1E83C4.8090506@ericsson.com> References: <4B1E83C4.8090506@ericsson.com> Message-ID: <4B1EA352.3050407@erix.ericsson.se> Hans Nilsson R wrote: > enif_make_sub_binary(env, bin, from, to) would be useful. > Already on my todo list. > > Therefore I'd like to have some enif_make_string_n(env, char *p, int > length) as well, analogous to the c-library functions strcpy and strncpy. Sounds reasonable. You can however make your own by traversing the string backwards and call enif_make_list_cell. /Sverker, Erlang/OTP From navaneethanit@REDACTED Tue Dec 8 20:12:18 2009 From: navaneethanit@REDACTED (NavTux) Date: Tue, 8 Dec 2009 11:12:18 -0800 (PST) Subject: Final year project plan Message-ID: Hi Erlangies, Myself doing final year B.Tech [IT] I am going to do my final year project in erlang ,but i have only less time hardly 2 and half months because of my placement and training activities:-)I am learning a erlang as newbies,I need to get some idea from the experience people like you:-) I request you to give some suggestions and instructions that 'd be helpful to my project I need to know In what area i need to give the special importance for my learning of my project, and How to do the project within the time duration? From the.ajarn@REDACTED Tue Dec 8 20:21:46 2009 From: the.ajarn@REDACTED (Brentley Jones) Date: Tue, 8 Dec 2009 13:21:46 -0600 Subject: [erlang-questions] Final year project plan In-Reply-To: References: Message-ID: <6E5DB2A7-A8CD-4C94-98EF-2CCFF61FC15C@gmail.com> On Dec 8, 2009, at 1:12 PM, NavTux wrote: > Hi Erlangies, > > Myself doing final year B.Tech [IT] I am going to do my > final year project in erlang ,but i have > only less time hardly 2 and half months because of my placement and > training activities:-)I am learning a erlang as newbies,I need to get > some idea from the experience people like you:-) > > I request you to give some suggestions and instructions > that 'd be helpful to my project > > I need to know In what area i need to give the special > importance for my learning of my project, and How to do the project > within the time duration? > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > Funny, I semi-finished a paper on the basics of the Erlang language. This was for my B.S. in Applied Computer Science. Wish I could help you though, because with mine I didn't have to do a project, just a paper. My project will be when I do my Masters Thesis in two years. - Brentley Jones From navaneethanit@REDACTED Tue Dec 8 20:34:15 2009 From: navaneethanit@REDACTED (Navaneethan) Date: Wed, 9 Dec 2009 01:04:15 +0530 Subject: Final year project plan Message-ID: <4dde26ad0912081134g739c4711p883629bb56761a2b@mail.gmail.com> I have sent a private message to you,I am waiting for your reply of hospitality Brentley Jones wrote: > > Funny, I semi-finished a paper on the basics of the Erlang language. This > was for my B.S. in Applied Computer Science. Wish I could help you though, > because with mine I didn't have to do a project, just a paper. My project will > be when I do my Masters Thesis in two years. > > - Brentley Jones > -- regards, NavTux It blogs @ http://navaspot.wordpress.com From max.lapshin@REDACTED Tue Dec 8 21:08:36 2009 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 8 Dec 2009 23:08:36 +0300 Subject: [erlang-questions] NIF vs. Linked-in Drivers In-Reply-To: <4B1E9FAE.70308@erix.ericsson.se> References: <4B1E9FAE.70308@erix.ericsson.se> Message-ID: In my linked-in driver fork of sqlite3 driver, NIF function is absolutely unusable, because sqlite3 library will block calling process, thus all functions are executed in async thread. But linked-in driver is harder to implement. From ulf.wiger@REDACTED Tue Dec 8 21:15:18 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Tue, 08 Dec 2009 21:15:18 +0100 Subject: [erlang-questions] NIF vs. Linked-in Drivers In-Reply-To: References: <4B1E9FAE.70308@erix.ericsson.se> Message-ID: <4B1EB3D6.1040207@erlang-consulting.com> Max Lapshin wrote: > In my linked-in driver fork of sqlite3 driver, NIF function is > absolutely unusable, because sqlite3 library will block calling > process, > thus all functions are executed in async thread. > > But linked-in driver is harder to implement. If you have a limited number of instances of a blocking NIF, you could add that number of extra schedulers to the system when you start Erlang. Not sure if that would have any particular bad side-effects... perhaps the VM experts know? BR, Ulf W -- Ulf Wiger CTO, Erlang Training & Consulting Ltd http://www.erlang-consulting.com From max.lapshin@REDACTED Tue Dec 8 21:17:45 2009 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 8 Dec 2009 23:17:45 +0300 Subject: [erlang-questions] NIF vs. Linked-in Drivers In-Reply-To: <4B1EB3D6.1040207@erlang-consulting.com> References: <4B1E9FAE.70308@erix.ericsson.se> <4B1EB3D6.1040207@erlang-consulting.com> Message-ID: On Tue, Dec 8, 2009 at 11:15 PM, Ulf Wiger wrote: > If you have a limited number of instances of a blocking > NIF, you could add that number of extra schedulers to > the system when you start Erlang. Not sure if that would > have any particular bad side-effects... perhaps the VM > experts know? Linkedin driver subsystem has excelent capabilities to schedule long task on pool of threads. It seems, that it will be required to implement thread pool with NIF. Am I wrong? NIF is especially useable, while adding rare functions from system API, that are missed in ERTS. From clist@REDACTED Tue Dec 8 21:19:12 2009 From: clist@REDACTED (Angel Alvarez) Date: Tue, 8 Dec 2009 21:19:12 +0100 Subject: Erlang for sceptics Message-ID: <200912082119.12784.clist@uah.es> Ive just found this page: http://erlangforsceptics.com/book/ Hope his will help other newbees.... -- Agua para todo? No, Agua para Todos. ->>----------------------------------------------- Clist UAH a.k.a Angel ---------------------------------[www.uah.es]-<<-- Sex is a battle, love is war. From raould@REDACTED Tue Dec 8 21:27:17 2009 From: raould@REDACTED (Raoul Duke) Date: Tue, 8 Dec 2009 12:27:17 -0800 Subject: [erlang-questions] Erlang for sceptics In-Reply-To: <200912082119.12784.clist@uah.es> References: <200912082119.12784.clist@uah.es> Message-ID: <91a2ba3e0912081227o25eb631eq37a2f33d6b69f65@mail.gmail.com> > http://erlangforsceptics.com/book/ huh. gotta add that to my "top 10 completely inappropriately titled things ever". :-) From vances@REDACTED Tue Dec 8 22:51:01 2009 From: vances@REDACTED (Vance Shipley) Date: Tue, 8 Dec 2009 16:51:01 -0500 Subject: Happy Undecennial (11th) Anniversary Message-ID: <20091208215101.GC67538@h216-235-12-172.host.egate.net> On this day in 1998 Erlang/OTP was released as open source. http://web.archive.org/web/19991009002753/www.erlang.se/onlinenews/ErlangOTPos.shtml -- -Vance From erlangy@REDACTED Tue Dec 8 23:09:05 2009 From: erlangy@REDACTED (Michael McDaniel) Date: Tue, 8 Dec 2009 14:09:05 -0800 Subject: [erlang-questions] Happy Undecennial (11th) Anniversary In-Reply-To: <20091208215101.GC67538@h216-235-12-172.host.egate.net> References: <20091208215101.GC67538@h216-235-12-172.host.egate.net> Message-ID: <20091208220905.GM11530@delora.autosys.us> On Tue, Dec 08, 2009 at 04:51:01PM -0500, Vance Shipley wrote: > On this day in 1998 Erlang/OTP was released as open source. > > http://web.archive.org/web/19991009002753/www.erlang.se/onlinenews/ErlangOTPos.shtml > > -- > -Vance > ______________________________________________________________________ Thank you, Vance, for the history - I had never seen that link. ~Michael From thomasl_erlang@REDACTED Tue Dec 8 23:41:34 2009 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 8 Dec 2009 14:41:34 -0800 (PST) Subject: [erlang-questions] Re: Erjang In-Reply-To: References: <4B1E8BAE.4090805@tmit.bme.hu> Message-ID: <357899.15790.qm@web111410.mail.gq1.yahoo.com> ----- Original Message ---- > From: Tony Arcieri > To: Johann H?chtl > Cc: erlang-questions@REDACTED > Sent: Tue, December 8, 2009 6:58:44 PM > Subject: Re: [erlang-questions] Re: Erjang > > On Tue, Dec 8, 2009 at 10:47 AM, Johann H?chtl wrote: > > > Given the trmendous work which has been done on Luajit2 and the vast > > improvements speedwise, I wonder I sthg. a least mildly comparabel > > could be done to the Beam VM. Is some work going on for HIPE or the VM > > in general? > > > > HiPE is nowhere close to the JVM's HotSpot in terms of the types of > optimizations in can perform. > > Among other things, the JVM's HotSpot can deoptimize. HiPE cannot, and for > this reason HiPE cannot inline across modules, as a code change would > require the inliner to deoptimize whenever code change occurs. > Deoptimization also allows HotSpot to try aggressive optimizations which may > actually lead to performance regressions or no noticeable improvements, in > which case it can deoptimize and try again. (Note that it's been known since 1996 how to inline and optimize across modules in Erlang, with some preliminary experimental results in 2001 and 2003 even. See http://www.erlang.org/pipermail/erlang-questions/2008-November/039944.html for pointers.) As far as I can tell, the community currently seems pretty satisfied with performance, to the point of not even using Hipe a lot. The current compiler architecture seems to work best for small or medium-sized programs, but loses steam on big programs. With that said, I think there is still plenty of scope to improve performance. Languages like OCaml and Haskell seem to be running (rough estimate) 2x-10x faster on some benchmarks. A compiler like Stalin (for Scheme) also does extraordinarily well. So it's not like we've maxed out the hardware, and closing the gap seems worthwhile. I for one thus think it would be very interesting to see more work on optimization. The situation is pretty bright for the interested. There are lots of open source real apps to use as benchmarks these days, if so desired. (Downside: can also provide massive distractions.) Hipe is very solid at this point, it's easy to use it for comparisons, it's easy to examine the code generated, and the system includes a lot of work on machine code generation, linking, converting beam ops into low-level code, and so on, all of which quite possibly can be reused to quickly do a luajit competitor, or the infrastructure for one. (You may also need to do some further runtime system hacking.) Good luck! Best, Thomas From kagato@REDACTED Wed Dec 9 01:35:09 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Tue, 8 Dec 2009 16:35:09 -0800 Subject: [erlang-questions] Re: Erjang In-Reply-To: References: <4B1E8BAE.4090805@tmit.bme.hu> Message-ID: <71F58B0F-3C8E-4FDA-B0B2-360A9AC04E56@souja.net> The deoptimization thing is definitely interesting to watch. Here's a benchmark done by the JRuby guys (disclosure: I'm a shareholder and employee at their place of employment). http://www.engineyard.com/blog/2009/j-is-for-jvm-why-the-j-in-jruby/ What I find fascinating is the little blip at iteration #6 where hotspot tries something that doesn't work, then reverses it. Personally, I believe that functional languages are different enough that there are intelligent optimizations that are suitable for them at a high-level that are not suitable for optimization at the byte-code level (or suitable for other languages). That said, I don't think it matters because: 1. Those implementations are at such a high level that they would end up in the compiler anyway. 2. Most of them involve matching patterns in a way that is computationally intractable (until I get my Quantum Compiler!). 3. Nobody cares enough to put the resources into it that the JVM is getting. As such, I think a JVM-targetted Erlang would be very nice, if the JVM can get as good at lightweight processes and scheduling as Erlang itself is. One of the most striking things about Erlang for me was that almost all performance metrics are measured in microseconds--and anything larger would be inadequate. Most other languages (barring assembly or kernel-level C) end up measuring in milliseconds--and then they do it by repeating the test 1000 times and dividing. With Erlang it's possible to get microsecond measurements from a single run and feel pretty good about it. Until I see this out of the JVM, I think that the Erlang VM is the way to go. Even then, I don't see Ericsson embracing the JVM until you can say "Embedded Java" without eliciting laughter. I suspect the horror of Java on phones has been bad enough that it will be a long time until that happens. On Dec 8, 2009, at 9:58 AM, Tony Arcieri wrote: > On Tue, Dec 8, 2009 at 10:47 AM, Johann H?chtl wrote: > >> Given the trmendous work which has been done on Luajit2 and the vast >> improvements speedwise, I wonder I sthg. a least mildly comparabel >> could be done to the Beam VM. Is some work going on for HIPE or the VM >> in general? >> > > HiPE is nowhere close to the JVM's HotSpot in terms of the types of > optimizations in can perform. > > Among other things, the JVM's HotSpot can deoptimize. HiPE cannot, and for > this reason HiPE cannot inline across modules, as a code change would > require the inliner to deoptimize whenever code change occurs. > Deoptimization also allows HotSpot to try aggressive optimizations which may > actually lead to performance regressions or no noticeable improvements, in > which case it can deoptimize and try again. > > -- > Tony Arcieri > Medioh! A Kudelski Brand From smiskovic@REDACTED Wed Dec 9 01:53:42 2009 From: smiskovic@REDACTED (Slobodan Miskovic) Date: Tue, 08 Dec 2009 16:53:42 -0800 Subject: Mnesia could not write core file: system_limit Message-ID: <1260320022.5814.27.camel@aramis.mditinnovations.com> Hi all, one of our nodes just popped up the following error: Mnesia(node@REDACTED): ** ERROR ** (could not write core file: system_limit) ** FATAL ** Cannot open log file "/var/mnesia/invoice_item.DCL": {file_error, "/var/mnesia/invoice_item.DCL", system_limit} I naively tried mnesia:start() only to have the same error repeat but for a different table. Restarting the whole node it now seems ok (error hasn't popped up again) but... Problem is that it seems data is now missing from at least one of those tables. I have made a backup of the whole mnesia after the second failure, but I don't suppose that data in there somewhere. 1. What has caused this? There is plenty of space left on the device, process was running as root, ulimit reports unlimited. 2. Is the data really gone? I have enough information elsewhere to reconstruct the data, but would like to know where it has gone. 3. How to prevent this from happening again? Periodic backups would not help with this as I can not afford to loose data since last backup even if I was to do 1hr intervals. Would running another node on another system be assurance enough? I find it very strange that some data would get dropped (about 10k records out of 85k record table), is it a sign of a mnesia bug or is this something I should anticipate and work around? Some potentialy usefull System Info: - Erlang R12B4 - about 200 tables, 50% sets 50% bags, both ram and disc copies for each table - node takes about 1.2GB ram when data is loaded (I understand there is 2GB per table limit, or am I misguided) - du -sh /var/mnesia/ 343M /var/mnesia/ - Filesystem Size Used Avail Use% Mounted on /dev/md/1 233G 49G 184G 22% / - Slackware Linux 2.6.24.5-smp #2 SMP Wed Apr 30 13:41:38 CDT 2008 i686 Intel(R) Pentium(R) Dual CPU E2200 @ 2.20GHz GenuineIntel GNU/Linux - node did not generate erl_crash.dump as I brought it down via shell q(). The only trace I have is the error above and subsequent error reports of calls to mnesia failing {aborted, {node_not_running... Any help and pointers are highly appreciated. Thanks! Slobo From jasonwframe@REDACTED Wed Dec 9 05:08:54 2009 From: jasonwframe@REDACTED (Jason Frame) Date: Wed, 9 Dec 2009 14:08:54 +1000 Subject: using strings with NIF Message-ID: <9e2890c20912082008o47cc8bd4wcd73d0bda3344204@mail.gmail.com> Hi, I am trying to use a string as an argument with NIF. I can't work out how to extract the string on the c side though. Using a int is quite simple with the enif_get_int function but there doesn't seem be a similar function for strings. I have tried encoding a tuple with term_to_binary then using erl_decode and then use erl_element and the associated functions to extract the string. But it fails with a segfault and I'm sure there is probably a better way to do this. 1> c(niftest). {ok,niftest} 2> niftest:init(). ok 3> niftest:test(). Segmentation Fault (core dumped) -module(niftest). -export([init/0, hello/1, test/0]). init() -> erlang:load_nif("./niftest", 0). hello(_Value) -> "NIF library not loaded". test() -> hello(term_to_binary({"hello"})). /* niftest.c */ #include "erl_nif.h" #include "erl_interface.h" #include "ei.h" static ERL_NIF_TERM hello(ErlNifEnv* env, ERL_NIF_TERM al) { ErlNifBinary bin; ETERM *tuple; if (!enif_is_binary(env, al)) { return enif_make_badarg(env); } enif_inspect_binary(env, al, &bin); tuple = erl_decode(bin.data); // fails here return enif_make_string(env, "dummy value"); } static ErlNifFunc nif_funcs[] = { {"hello", 1, hello} }; ERL_NIF_INIT(niftest,nif_funcs,NULL,NULL,NULL,NULL) From jarrod@REDACTED Wed Dec 9 05:25:30 2009 From: jarrod@REDACTED (Jarrod Roberson) Date: Tue, 8 Dec 2009 23:25:30 -0500 Subject: [erlang-questions] using strings with NIF In-Reply-To: <9e2890c20912082008o47cc8bd4wcd73d0bda3344204@mail.gmail.com> References: <9e2890c20912082008o47cc8bd4wcd73d0bda3344204@mail.gmail.com> Message-ID: On Tue, Dec 8, 2009 at 11:08 PM, Jason Frame wrote: > Hi, > > I am trying to use a string as an argument with NIF. I can't work out > how to extract the string on the c side though. Using a int is quite > simple with the enif_get_int function but there doesn't seem be a > similar function for strings. I have tried encoding a tuple with > term_to_binary then using erl_decode and then use erl_element and the > associated functions to extract the string. But it fails with a > segfault and I'm sure there is probably a better way to do this. I could be wrong, but I would think that ERL_NIF_TERM enif_make_list(ErlNifEnv* env, unsigned cnt, ...) is what you want, since in Erlang "strings" are just lists of bytes. From jasonwframe@REDACTED Wed Dec 9 06:47:29 2009 From: jasonwframe@REDACTED (Jason Frame) Date: Wed, 9 Dec 2009 15:47:29 +1000 Subject: [erlang-questions] using strings with NIF In-Reply-To: References: <9e2890c20912082008o47cc8bd4wcd73d0bda3344204@mail.gmail.com> Message-ID: <9e2890c20912082147q340826ck37cfc9e4ac64edb3@mail.gmail.com> Thats not quite what I want as that will return a ERL_NIF_TERM. I have a ERL_NIF_TERM from the passed in function argument which should contain the string somehow and I need to decode that into a c style string ie. an array of char. On Wed, Dec 9, 2009 at 2:25 PM, Jarrod Roberson wrote: > On Tue, Dec 8, 2009 at 11:08 PM, Jason Frame wrote: >> Hi, >> >> I am trying to use a string as an argument with NIF. I can't work out >> how to extract the string on the c side though. Using a int is quite >> simple with the enif_get_int function but there doesn't seem be a >> similar function for strings. I have tried encoding a tuple with >> term_to_binary then using erl_decode and then use erl_element and the >> associated functions to extract the string. But it fails with a >> segfault and I'm sure there is probably a better way to do this. > > I could be wrong, but I would think that > > ERL_NIF_TERM enif_make_list(ErlNifEnv* env, unsigned cnt, ...) > > is what you want, since in Erlang "strings" are just lists of bytes. > From kiszl@REDACTED Wed Dec 9 08:51:24 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Wed, 9 Dec 2009 08:51:24 +0100 (CET) Subject: [erlang-questions] using strings with NIF In-Reply-To: <9e2890c20912082008o47cc8bd4wcd73d0bda3344204@mail.gmail.com> References: <9e2890c20912082008o47cc8bd4wcd73d0bda3344204@mail.gmail.com> Message-ID: <59928.194.88.55.211.1260345084.squirrel@localhost> > Hi, > > I am trying to use a string as an argument with NIF. I can't work out > how to extract the string on the c side though. Using a int is quite > simple with the enif_get_int function but there doesn't seem be a > similar function for strings. I have tried encoding a tuple with > term_to_binary then using erl_decode and then use erl_element and the > associated functions to extract the string. But it fails with a > segfault and I'm sure there is probably a better way to do this. > > 1> c(niftest). > {ok,niftest} > 2> niftest:init(). > ok > 3> niftest:test(). > Segmentation Fault (core dumped) > > -module(niftest). > -export([init/0, hello/1, test/0]). > init() -> > erlang:load_nif("./niftest", 0). > hello(_Value) -> > "NIF library not loaded". > test() -> > hello(term_to_binary({"hello"})). > > /* niftest.c */ > #include "erl_nif.h" > #include "erl_interface.h" > #include "ei.h" > > static ERL_NIF_TERM hello(ErlNifEnv* env, ERL_NIF_TERM al) > { > ErlNifBinary bin; > ETERM *tuple; > > if (!enif_is_binary(env, al)) { > return enif_make_badarg(env); > } > > enif_inspect_binary(env, al, &bin); > tuple = erl_decode(bin.data); // fails here > > return enif_make_string(env, "dummy value"); > } > static ErlNifFunc nif_funcs[] = > { > {"hello", 1, hello} > }; > ERL_NIF_INIT(niftest,nif_funcs,NULL,NULL,NULL,NULL) > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > Hi Jason, You seem to be mixing up the C API of NIF and Erl_Interface there. My guess is that this is not possible, as apparently NIF's use ERL_NIF_TERM while Erl_Interface uses ETERM for Erlang terms. I can be wrong though; if that's the case, throw an RTFM at me :-). Regarding strings, the best choice is to allocate a char*, and then iterate over your Erlang list with enif_get_list_cell, copying each char (i.e. int) one by one. Regards, Zoltan. From v@REDACTED Wed Dec 9 08:58:05 2009 From: v@REDACTED (Valentin Micic) Date: Wed, 9 Dec 2009 09:58:05 +0200 Subject: [erlang-questions] Mnesia could not write core file: system_limit In-Reply-To: <1260320022.5814.27.camel@aramis.mditinnovations.com> Message-ID: <20091209075815.34BCB3D0D5E@mail.pharos-avantgard.com> Just a wild guess... could it be that you're running out of available file descriptors? The error indicates that you cannot open a log file, which may be caused by this. V/ -----Original Message----- From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] On Behalf Of Slobodan Miskovic Sent: 09 December 2009 02:54 AM To: Erlang-Questions Questions Subject: [erlang-questions] Mnesia could not write core file: system_limit Hi all, one of our nodes just popped up the following error: Mnesia(node@REDACTED): ** ERROR ** (could not write core file: system_limit) ** FATAL ** Cannot open log file "/var/mnesia/invoice_item.DCL": {file_error, "/var/mnesia/invoice_item.DCL", system_limit} I naively tried mnesia:start() only to have the same error repeat but for a different table. Restarting the whole node it now seems ok (error hasn't popped up again) but... Problem is that it seems data is now missing from at least one of those tables. I have made a backup of the whole mnesia after the second failure, but I don't suppose that data in there somewhere. 1. What has caused this? There is plenty of space left on the device, process was running as root, ulimit reports unlimited. 2. Is the data really gone? I have enough information elsewhere to reconstruct the data, but would like to know where it has gone. 3. How to prevent this from happening again? Periodic backups would not help with this as I can not afford to loose data since last backup even if I was to do 1hr intervals. Would running another node on another system be assurance enough? I find it very strange that some data would get dropped (about 10k records out of 85k record table), is it a sign of a mnesia bug or is this something I should anticipate and work around? Some potentialy usefull System Info: - Erlang R12B4 - about 200 tables, 50% sets 50% bags, both ram and disc copies for each table - node takes about 1.2GB ram when data is loaded (I understand there is 2GB per table limit, or am I misguided) - du -sh /var/mnesia/ 343M /var/mnesia/ - Filesystem Size Used Avail Use% Mounted on /dev/md/1 233G 49G 184G 22% / - Slackware Linux 2.6.24.5-smp #2 SMP Wed Apr 30 13:41:38 CDT 2008 i686 Intel(R) Pentium(R) Dual CPU E2200 @ 2.20GHz GenuineIntel GNU/Linux - node did not generate erl_crash.dump as I brought it down via shell q(). The only trace I have is the error above and subsequent error reports of calls to mnesia failing {aborted, {node_not_running... Any help and pointers are highly appreciated. Thanks! Slobo ________________________________________________________________ erlang-questions mailing list. See http://www.erlang.org/faq.html erlang-questions (at) erlang.org From smiskovic@REDACTED Wed Dec 9 09:24:17 2009 From: smiskovic@REDACTED (Slobodan Miskovic) Date: Wed, 9 Dec 2009 00:24:17 -0800 Subject: [erlang-questions] Mnesia could not write core file: system_limit In-Reply-To: <20091209075815.34BCB3D0D5E@mail.pharos-avantgard.com> References: <20091209075815.34BCB3D0D5E@mail.pharos-avantgard.com> Message-ID: That is a possibility, node has been running for about 40 days, but i've had longer runs with no problem on the same system with similar loads. How would I check the FD usage of a running system? Is there a way to get notified if node is approaching the limit, in which case I could take some corrective action (such as restarting the node). Do open FDs get closed if a process dies? Perhaps that's where the leak is coming from. Biggest question that remains is why did mnesia lose data. I would understand losing whatever was going to be written when system_limit was reached, but I lost a lot of "old" data as well, data that was there for days, even weeks Thanks Slobo On 2009-12-08, at 11:58 PM, Valentin Micic wrote: > Just a wild guess... could it be that you're running out of available file > descriptors? The error indicates that you cannot open a log file, which may > be caused by this. > > V/ > > -----Original Message----- > From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] On > Behalf Of Slobodan Miskovic > Sent: 09 December 2009 02:54 AM > To: Erlang-Questions Questions > Subject: [erlang-questions] Mnesia could not write core file: system_limit > > Hi all, one of our nodes just popped up the following error: > > Mnesia(node@REDACTED): ** ERROR ** (could not write core file: > system_limit) > ** FATAL ** Cannot open log file "/var/mnesia/invoice_item.DCL": > {file_error, "/var/mnesia/invoice_item.DCL", system_limit} > > I naively tried mnesia:start() only to have the same error repeat but > for a different table. > > Restarting the whole node it now seems ok (error hasn't popped up again) > but... > > Problem is that it seems data is now missing from at least one of those > tables. I have made a backup of the whole mnesia after the second > failure, but I don't suppose that data in there somewhere. > > 1. What has caused this? There is plenty of space left on the device, > process was running as root, ulimit reports unlimited. > > 2. Is the data really gone? I have enough information elsewhere to > reconstruct the data, but would like to know where it has gone. > > 3. How to prevent this from happening again? Periodic backups would not > help with this as I can not afford to loose data since last backup even > if I was to do 1hr intervals. Would running another node on another > system be assurance enough? > > I find it very strange that some data would get dropped (about 10k > records out of 85k record table), is it a sign of a mnesia bug or is > this something I should anticipate and work around? > > Some potentialy usefull System Info: > - Erlang R12B4 > - about 200 tables, 50% sets 50% bags, both ram and disc copies for each > table > - node takes about 1.2GB ram when data is loaded (I understand there is > 2GB per table limit, or am I misguided) > - du -sh /var/mnesia/ > 343M /var/mnesia/ > > - Filesystem Size Used Avail Use% Mounted on > /dev/md/1 233G 49G 184G 22% / > > - Slackware Linux 2.6.24.5-smp #2 SMP Wed Apr 30 13:41:38 CDT 2008 i686 > Intel(R) Pentium(R) Dual CPU E2200 @ 2.20GHz GenuineIntel GNU/Linux > > - node did not generate erl_crash.dump as I brought it down via shell > q(). The only trace I have is the error above and subsequent error > reports of calls to mnesia failing {aborted, {node_not_running... > > > Any help and pointers are highly appreciated. > > Thanks! > Slobo From vasilij.savin@REDACTED Wed Dec 9 09:47:27 2009 From: vasilij.savin@REDACTED (Vasilij Savin) Date: Wed, 9 Dec 2009 00:47:27 -0800 (PST) Subject: Final year project plan In-Reply-To: References: Message-ID: Greetings, Doing a project with language you do not know is somewhat risky. You may end up spending more time learning language and programming tricks rather than developing your system. 2,5 months might be too short period of time to pull learning new language and finishing project. Have you had functional programming courses before? I do not want to sound discouraging, but speaking from personal experience, coming from OO/procedural background to Erlang is not easy. You will have to rethink many paradigms. I would suggest going through tutorials first of all and see if you feel comfortable programming in Erlang. In addition, I found that learning OTP is really good idea, as you can build quite robust applications without too much boilerplate code. There is plenty of decent documentation out there, so go ahead and study it. CommonTest is awesome for testing. Regards, Vasilij From erlang@REDACTED Wed Dec 9 10:35:55 2009 From: erlang@REDACTED (Joe Armstrong) Date: Wed, 9 Dec 2009 10:35:55 +0100 Subject: An Erlang like DNS service Message-ID: <9b08084c0912090135u4ce2db57i7a80cdad67c7cf58@mail.gmail.com> An Erlang DNS "like" facility I want something like dynamic DNS. How could be extend process registration to work outside the scope of a single Erlang node? (And I'm not talking distributed Erlang here). Let's suppose I have a program running on my machine I want my friends to be able to send messages to it. In my program all I'd like to say: dynamic_register(MyName, self()) MyName would be a logical name. My friend could say: Pid = dynamic_whereis(Name) To find out where the process is. This registration should survive as long as the process is alive. I should be able to link to and send mesaages to Pid. Having got a Pid I just want to say Pid ! Message and I want the message to be delivered to the registered process. Just as in DNS I guess this necessitates some form of administration - we don't want wild "address squatting" etc we need some certificates so we can prove who we are and so on. I think such a facility would be very useful, but it raises a whole lot of technical questions - how would you implement this? I guess there needs to be some integration with DNS then some deep magic in the port mapper daemon and some ipchains magic also some STUN/NAT traversal stuff. I view this not so much as a "killer application" but as a "killer enabler" just as DNS is the killer enabler for millions of applications. /Joe From sverker@REDACTED Wed Dec 9 10:41:37 2009 From: sverker@REDACTED (Sverker Eriksson) Date: Wed, 09 Dec 2009 10:41:37 +0100 Subject: [erlang-questions] using strings with NIF In-Reply-To: <9e2890c20912082008o47cc8bd4wcd73d0bda3344204@mail.gmail.com> References: <9e2890c20912082008o47cc8bd4wcd73d0bda3344204@mail.gmail.com> Message-ID: <4B1F70D1.3040703@erix.ericsson.se> Jason Frame wrote: > Hi, > > I am trying to use a string as an argument with NIF. I can't work out > how to extract the string on the c side though. Using a int is quite > simple with the enif_get_int function but there doesn't seem be a > similar function for strings. I've put enif_get_string on the ToDo. Here is a web site in some eastern language that has a "my_enif_get_string" implemented. I leave it up to you to figure out the copyrights :-) http://d.hatena.ne.jp/vostok92/20091201/1259680319 /Sverker, Erlang/OTP Ericsson From roberto.aloi@REDACTED Wed Dec 9 11:24:17 2009 From: roberto.aloi@REDACTED (Roberto Aloi) Date: Wed, 9 Dec 2009 10:24:17 +0000 (GMT) Subject: [erlang-questions] Mnesia could not write core file: system_limit In-Reply-To: <14388251.86831260353970519.JavaMail.root@zimbra> Message-ID: <18183467.86951260354257630.JavaMail.root@zimbra> Hi, a link that could be useful to investigate possible system limits occurring: http://www.erlang.org/doc/efficiency_guide/advanced.html#id2265856 Then, you might want to use (but you probably did already): * erlang:system_info() * erlang:memory() * length(processes()) * erlang:process_info/2 At least, this is what I would do... Regards, -- Roberto Aloi roberto.aloi@REDACTED http://www.erlang-consulting.com From jasonwframe@REDACTED Wed Dec 9 11:42:05 2009 From: jasonwframe@REDACTED (Jason Frame) Date: Wed, 9 Dec 2009 20:42:05 +1000 Subject: [erlang-questions] using strings with NIF In-Reply-To: <4B1F70D1.3040703@erix.ericsson.se> References: <9e2890c20912082008o47cc8bd4wcd73d0bda3344204@mail.gmail.com> <4B1F70D1.3040703@erix.ericsson.se> Message-ID: <9e2890c20912090242j7a2b7c02h26726a7229f5ff8f@mail.gmail.com> Thanks that code worked. On Wed, Dec 9, 2009 at 7:41 PM, Sverker Eriksson wrote: > Jason Frame wrote: >> >> Hi, >> >> I am trying to use a string as an argument with NIF. I can't work out >> how to extract the string on the c side though. Using a int is quite >> simple with the enif_get_int function but there doesn't seem be a >> similar function for strings. > > I've put enif_get_string on the ToDo. > > Here is a web site in some eastern language that has a "my_enif_get_string" > implemented. I leave it up to you to figure out the copyrights :-) > > http://d.hatena.ne.jp/vostok92/20091201/1259680319 > > > /Sverker, Erlang/OTP Ericsson > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From anton.krasovsky@REDACTED Wed Dec 9 11:54:52 2009 From: anton.krasovsky@REDACTED (Anton Krasovsky) Date: Wed, 9 Dec 2009 10:54:52 +0000 Subject: =?windows-1252?Q?Re=3A_=5Berlang=2Dquestions=5D_Erlyvideo_=97_current_status?= In-Reply-To: References: Message-ID: <46167e6a0912090254i79b5e413k2f993d5eda264b7@mail.gmail.com> Do you have any plans to support 3gp video as well? Anton On Tue, Dec 8, 2009 at 9:04 AM, Max Lapshin wrote: > Hi. Since previous announce of erlyvideo reanimation, changed a lot. > > Currently erlyvideo is capable to stream flv files, mp4 h264/aac files > ?(both types with fast seek, available by tricky mechanisms). > > RTMPT protocol implemented (badly designed tunneling of RTMP in HTTP). > > It can record video/audio from web camera via flash. It is possible to > organize centralized video chat with it. > > It can use external MPEG TS stream as a video source, so you can use > vlc as a transcoder filter after your camera to restream live content > to WEB. > Currently, RTSP/RTP is implemented to use Quicktime Broadcaster, but > there are still problems. > > Original implementation of AMF format was changed to superior > http://github.com/mujaheed/erlang-amf > > Preliminary support for plugins exists. > > In tested use cases, erlyvideo seems to be rather stable and leak-proof. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From kagato@REDACTED Wed Dec 9 11:54:59 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Wed, 9 Dec 2009 02:54:59 -0800 Subject: [erlang-questions] open_port issue In-Reply-To: <45d8e23d0912080959h76af2718v985259091fa5d33@mail.gmail.com> References: <45d8e23d0912080959h76af2718v985259091fa5d33@mail.gmail.com> Message-ID: It looks like the problem is that the port doesn't close the STDIN after writing the data. I tried it with "cat" and got data back, but it never exited. I eventually tested this from the command line and it looks like ImageMagick wants EOF. There doesn't seem to be a port_control for this. Obviously, this is bad. Also, does {spawn_executable,Command} work for anyone? I can't seem to get it to work. I ALWAYS get badarg, even when {spawn,_} works. On Dec 8, 2009, at 9:59 AM, Senthilkumar Peelikkampatti wrote: > I wanted to call imagemagick's convert utility. > > Here Cmd is ="convert - -resize 100x100 jpg:-", this command tells image > magic to read the binary data from Stdin and emit the result back to stdout, > but I am not error "Unable to write back to output". Is this the correct way > to use open_port? > > > cmd(Cmd, Bin) -> > > Port = open_port({spawn, Cmd}, [stream, use_stdio, in, out, binary]), > > port_command(Port, Bin), > > TRef = erlang:start_timer(3000, self(), timeout), > > recv_data(Port, TRef, <<>>). > > > recv_data(Port, TRef, Buf) -> > > receive > > {Port, {data, Bytes}} -> > > NewBuf = <>; > > {Port, {data, _}} -> > > return(Port, TRef, {error, efbig}); > > {Port, eof} when Buf /= <<>> -> > > return(Port, TRef, {ok, Buf}); > > {Port, eof} -> > > return(Port, TRef, {error, enodata}); > > {timeout, TRef, _} -> > > return(Port, TRef, {error, timeout}) > > end. > > > return(Port, TRef, Result) -> > > case erlang:cancel_timer(TRef) of > > false -> > > receive > > {timeout, TRef, _} -> > > ok > > after 0 -> > > ok > > end; > > _ -> > > ok > > end, > > catch port_close(Port), > > Result. > > -- > Regards, > Senthilkumar Peelikkampatti, > http://pmsenthilkumar.blogspot.com/ -- Jayson Vantuyl kagato@REDACTED From rapsey@REDACTED Wed Dec 9 12:23:25 2009 From: rapsey@REDACTED (Rapsey) Date: Wed, 9 Dec 2009 12:23:25 +0100 Subject: =?windows-1252?Q?Re=3A_=5Berlang=2Dquestions=5D_Erlyvideo_=97_current_status?= In-Reply-To: <46167e6a0912090254i79b5e413k2f993d5eda264b7@mail.gmail.com> References: <46167e6a0912090254i79b5e413k2f993d5eda264b7@mail.gmail.com> Message-ID: <97619b170912090323q4457e21eh44fcb9e07acde104@mail.gmail.com> 3gp container is basically mp4. It should work already. Sergej On Wed, Dec 9, 2009 at 11:54 AM, Anton Krasovsky wrote: > Do you have any plans to support 3gp video as well? > > Anton > > On Tue, Dec 8, 2009 at 9:04 AM, Max Lapshin wrote: > > Hi. Since previous announce of erlyvideo reanimation, changed a lot. > > > > Currently erlyvideo is capable to stream flv files, mp4 h264/aac files > > (both types with fast seek, available by tricky mechanisms). > > > > RTMPT protocol implemented (badly designed tunneling of RTMP in HTTP). > > > > It can record video/audio from web camera via flash. It is possible to > > organize centralized video chat with it. > > > > It can use external MPEG TS stream as a video source, so you can use > > vlc as a transcoder filter after your camera to restream live content > > to WEB. > > Currently, RTSP/RTP is implemented to use Quicktime Broadcaster, but > > there are still problems. > > > > Original implementation of AMF format was changed to superior > > http://github.com/mujaheed/erlang-amf > > > > Preliminary support for plugins exists. > > > > In tested use cases, erlyvideo seems to be rather stable and leak-proof. > > > > ________________________________________________________________ > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > erlang-questions (at) erlang.org > > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From max.lapshin@REDACTED Wed Dec 9 12:45:28 2009 From: max.lapshin@REDACTED (Max Lapshin) Date: Wed, 9 Dec 2009 14:45:28 +0300 Subject: =?UTF-8?Q?Re=3A_=5Berlang=2Dquestions=5D_Erlyvideo_=E2=80=94_current_status?= In-Reply-To: <97619b170912090323q4457e21eh44fcb9e07acde104@mail.gmail.com> References: <46167e6a0912090254i79b5e413k2f993d5eda264b7@mail.gmail.com> <97619b170912090323q4457e21eh44fcb9e07acde104@mail.gmail.com> Message-ID: On Wed, Dec 9, 2009 at 2:23 PM, Rapsey wrote: > 3gp container is basically mp4. It should work already. > Perhaps, only add support for proper file extension. However, it would be much better to add autodetection of file type. I'd only want to mention, that mp4v is absolutely unsupported: it is not H264, so flash will not play it. From kenji.rikitake@REDACTED Wed Dec 9 12:59:24 2009 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Wed, 9 Dec 2009 20:59:24 +0900 Subject: [erlang-questions] using strings with NIF In-Reply-To: <4B1F70D1.3040703@erix.ericsson.se> References: <9e2890c20912082008o47cc8bd4wcd73d0bda3344204@mail.gmail.com> <4B1F70D1.3040703@erix.ericsson.se> Message-ID: <20091209115924.GA2678@k2r.org> In the message <4B1F70D1.3040703@REDACTED> dated Wed, Dec 09, 2009 at 10:41:13AM +0100, Sverker Eriksson writes: > Here is a web site in some eastern language that has a > "my_enif_get_string" implemented. I leave it up to you to figure out the > copyrights :-) > > http://d.hatena.ne.jp/vostok92/20091201/1259680319 This page is written in Japanese and it's about a Tokyo Cabinet client as NIF. Kota Uenishi aka kuenishi's yatce is another Tokyo Cabinet client, now under migration to NIF. http://bitbucket.org/kuenishi/yatce/wiki/Home FYI Kenji Rikitake (I happen to read Japanese) From kenji.rikitake@REDACTED Wed Dec 9 13:05:21 2009 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Wed, 9 Dec 2009 21:05:21 +0900 Subject: [erlang-questions] An Erlang like DNS service In-Reply-To: <9b08084c0912090135u4ce2db57i7a80cdad67c7cf58@mail.gmail.com> References: <9b08084c0912090135u4ce2db57i7a80cdad67c7cf58@mail.gmail.com> Message-ID: <20091209120521.GA2889@k2r.org> For a global registry other than DNS, handle.net of CNRI has been popular for numbering academic publications (DOI identifier uses a part of handle.net namespace): http://www.handle.net/ BTW can a pid be globally unique? (or has that large numbering space?) Just a little thought. Kenji Rikitake In the message <9b08084c0912090135u4ce2db57i7a80cdad67c7cf58@REDACTED> dated Wed, Dec 09, 2009 at 10:35:31AM +0100, Joe Armstrong writes: > An Erlang DNS "like" facility > > I want something like dynamic DNS. > > How could be extend process registration to work outside > the scope of a single Erlang node? > > (And I'm not talking distributed Erlang here). > > Let's suppose I have a program running on my machine > I want my friends to be able to send messages to it. > > In my program all I'd like to say: > > dynamic_register(MyName, self()) > > MyName would be a logical name. > > My friend could say: > > Pid = dynamic_whereis(Name) > > To find out where the process is. > > This registration should survive as long as the process is alive. I > should be able to link to and send mesaages to Pid. > > Having got a Pid I just want to say Pid ! Message and I want the > message to be delivered to the registered process. > > Just as in DNS I guess this necessitates some form of administration - > we don't want wild "address squatting" etc we need some certificates > so we can prove who we are and so on. > > I think such a facility would be very useful, but it raises a whole > lot of technical questions - how would you implement this? > > I guess there needs to be some integration with DNS then some deep > magic in the port mapper daemon and some ipchains magic also some > STUN/NAT traversal stuff. > > I view this not so much as a "killer application" but as a "killer enabler" > just as DNS is the killer enabler for millions of applications. > > /Joe From hynek@REDACTED Wed Dec 9 13:23:42 2009 From: hynek@REDACTED (Hynek Vychodil) Date: Wed, 9 Dec 2009 13:23:42 +0100 Subject: [erlang-questions] Re: Erjang In-Reply-To: <4d08db370912090413q694ae122ie38a56768a9e3164@mail.gmail.com> References: <4B1E8BAE.4090805@tmit.bme.hu> <4d08db370912090413q694ae122ie38a56768a9e3164@mail.gmail.com> Message-ID: <4d08db370912090423g6483ea5ci510a6d636833ccd9@mail.gmail.com> On Tue, Dec 8, 2009 at 6:47 PM, Johann H?chtl wrote: > >> Hi all, >> >> I've just run into Erjang, "a JVM-based Erlang VM":http://wiki.github.com/krestenkrab/erjang. Has anyone happened to try this? >> > Sorry to say no, and my personal opinion is, that it is not such a > great idea, but this is solely based on 'personal feeling' rather than > profound technical insight. > > I liked this quote best: > > "The big win will be running on a VM that does dynamic compilation, > selective inlining, and all the performance that comes from that. With > that be enough to out-weigh the various disadvantages? Time wil show." > > Given the trmendous work which has been done on Luajit2 and the vast > improvements speedwise, I wonder I sthg. a least mildly comparabel > could be done to the Beam VM. Is some work going on for HIPE or the VM > in general? > >> Regards, >> Zoltan. >> I have thinking about it and mine decision is that JVM never get strong isolation, reliability and soft-real-time characteristics as Erlang have but Erlang VMs can improve their performance. I think that HiPE is great but it is little bit pushed to its limits. Great things happen to dynamic languages compiling this year and especially Trace Trees comes on mine mind. Applicate Trace Trees approach to Erlang should be next big thing. Unfortunately I'm not experienced enough to try prove it and doesn't heard of anybody else who even start thinking about it. -- --Hynek (Pichi) Vychodil P.S.: Sorry if you have got this message twice, I have some issues with using multiple gmail accounts and this mail conference. One of them must have changed something :-( From sverker@REDACTED Wed Dec 9 14:08:00 2009 From: sverker@REDACTED (Sverker Eriksson) Date: Wed, 09 Dec 2009 14:08:00 +0100 Subject: More NIF on github Message-ID: <4B1FA130.9060200@erix.ericsson.se> Some new NIF features pre-released on http://github.com/erlang/otp (branch ccase/r13b04_dev): INCOMPATIBLE changes: * Function prototypes of all NIFs changed to argc-argv style: ERL_NIF_TERM my_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) The purpose is to allow more than 3 function arguments but it's also turns out to be good for performance. You need to go through all your NIFs and change the function prototype as well as refer to argv[N-1] (for the Nth argument) instead of named argument variables. * erlang:load_nif has changed return value on failure from {error,A,S} to {error,{A,S}} New API functions: enif_make_double, enif_get_double enif_make_ref, enif_is_ref enif_make_existing_atom enif_is_atom enif_is_identical enif_compare enif_get_tuple Read more in erts/doc/src/erl_nif.xml. /Sverker, Erlang/OTP Ericsson From garry@REDACTED Wed Dec 9 14:26:52 2009 From: garry@REDACTED (Garry Hodgson) Date: Wed, 09 Dec 2009 08:26:52 -0500 Subject: [erlang-questions] Happy Undecennial (11th) Anniversary In-Reply-To: <20091208215101.GC67538@h216-235-12-172.host.egate.net> References: <20091208215101.GC67538@h216-235-12-172.host.egate.net> Message-ID: <4B1FA59C.6020804@research.att.com> Vance Shipley wrote: > On this day in 1998 Erlang/OTP was released as open source. > > http://web.archive.org/web/19991009002753/www.erlang.se/onlinenews/ErlangOTPos.shtml a good day, that. thanks for posting this, and many thanks to all who have been involved in making erlang what it is today. i'm curious, though. this was long enough ago that open source was not so common as today, and this was likely something of a leap of faith for Ericsson's management. does anyone here have any insight into how they have felt about this decision in retrospect? Did it achieve the stated goals for them as a company? it has clearly been a great thing for the software community, was it also great for Ericsson? -- Garry Hodgson AT&T Chief Security Office (CSO) "This e-mail and any files transmitted with it are AT&T property, are confidential, and are intended solely for the use of the individual or entity to whom this e-mail is addressed. If you are not one of the named recipient(s) or otherwise have reason to believe that you have received this message in error, please notify the sender and delete this message immediately from your computer. Any other use, retention, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited." From sverker@REDACTED Wed Dec 9 14:18:33 2009 From: sverker@REDACTED (Sverker Eriksson) Date: Wed, 09 Dec 2009 14:18:33 +0100 Subject: [erlang-questions] More NIF on github In-Reply-To: <4B1FA130.9060200@erix.ericsson.se> References: <4B1FA130.9060200@erix.ericsson.se> Message-ID: <4B1FA3A9.4090505@erix.ericsson.se> I wrote: > > The purpose is to allow more than 3 function arguments The purpose yes, the ability no. It just hit me that I had not removed the sanity check for max 3 arguments. What's not tested doesn't work. I'll be back. /Sverker, Erlang/OTP Ericsson From sverker@REDACTED Wed Dec 9 15:11:33 2009 From: sverker@REDACTED (Sverker Eriksson) Date: Wed, 09 Dec 2009 15:11:33 +0100 Subject: [erlang-questions] More NIF on github In-Reply-To: <4B1FA130.9060200@erix.ericsson.se> References: <4B1FA130.9060200@erix.ericsson.se> Message-ID: <4B1FB015.7060100@erix.ericsson.se> Now improved... to actually work: I wrote: > Some new NIF features pre-released on http://github.com/erlang/otp > (branch ccase/r13b04_dev): > > INCOMPATIBLE changes: > > * Function prototypes of all NIFs changed to argc-argv style: > > ERL_NIF_TERM my_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM > argv[]) > > The purpose is to allow more than 3 function arguments but it's > also turns out to be good for performance. > You need to go through all your NIFs and change the function > prototype as well as refer to argv[N-1] > (for the Nth argument) instead of named argument variables. > > * erlang:load_nif has changed return value on failure from {error,A,S} > to {error,{A,S}} > > > New API functions: > > enif_make_double, enif_get_double > enif_make_ref, enif_is_ref > enif_make_existing_atom > enif_is_atom > enif_is_identical > enif_compare > enif_get_tuple > > Read more in erts/doc/src/erl_nif.xml. > > /Sverker, Erlang/OTP Ericsson > From peppe@REDACTED Wed Dec 9 15:27:17 2009 From: peppe@REDACTED (Peter Andersson) Date: Wed, 09 Dec 2009 15:27:17 +0100 Subject: [erlang-questions] common_test Automatic Naming In-Reply-To: References: Message-ID: <4B1FB3C5.5070104@erix.ericsson.se> The thought behind the naming scheme is that the directory on the level above the test object directory is one that might represent a group of test objects (not necessarily OTP applications under lib), and for that reason is useful to include in the test name (i.e. it's included in the name because it *could* be useful info, not because it's necessary). Test names are described in the User's Guide (6.9 Log files), but it's not explained there *why* "TopLevelDir" is part of the name (noted). Maybe we could make it possible to configure the naming scheme in some practical way, or at least make it optional to exclude the top level directory in the test name. Or? What kind of override mechanism would you prefer to see in a future version of Comon Test? /Peter Ericsson AB, Erlang/OTP Jayson Vantuyl wrote: > So, when I let common_test generate its HTML output, I get these names for my modules. > > I've got them in an Erlang-style libdir. So module foo comes out as lib.foo and has its tests at lib/foo-X.Y.Z/test/something_SUITE.erl. > > After doing some detective work, I determined that the name is generated by ct_run:get_name/1. I see that it appears to take the two directory names above the test directory as the name of the suite. What is the rationale behind this naming? Is there somewhere else I should put my tests? Is it ever going to be possible to override this naming scheme? > > Thanks, > > From kagato@REDACTED Wed Dec 9 15:47:09 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Wed, 9 Dec 2009 06:47:09 -0800 Subject: [erlang-questions] common_test Automatic Naming In-Reply-To: <4B1FB3C5.5070104@erix.ericsson.se> References: <4B1FB3C5.5070104@erix.ericsson.se> Message-ID: Options, in order of my preference, would be: 1. Options 3, 4, and 6. 2. Options 3 and 4. 3. An option in the module itself. Perhaps in a comment, a.l.a edoc. This could end up being used by edoc for indexes as well, so maybe it would be best to ask whoever is responsible for that if they care. 4. Change it so that if the top-level-dir is lib, it will try the next directory up. This is more "hopeful heuristics", but I don't think it would be bad. It seems like "lib" can't ever be what somebody wants, right? :/ 5. Don't try to be smart about the top-level-dir at all. Backwards incompatible, but I'd be willing to be nobody cares. 6. A pluggable function, switchable with an option to run_test. On Dec 9, 2009, at 6:27 AM, Peter Andersson wrote: > > The thought behind the naming scheme is that the directory on the level > above the test object directory is one that might represent a group of > test objects (not necessarily OTP applications under lib), and for that > reason is useful to include in the test name (i.e. it's included in the > name because it *could* be useful info, not because it's necessary). > Test names are described in the User's Guide (6.9 Log files), but it's > not explained there *why* "TopLevelDir" is part of the name (noted). > Maybe we could make it possible to configure the naming scheme in some > practical way, or at least make it optional to exclude the top level > directory in the test name. Or? What kind of override mechanism would > you prefer to see in a future version of Comon Test? > > /Peter > > Ericsson AB, Erlang/OTP > > Jayson Vantuyl wrote: >> So, when I let common_test generate its HTML output, I get these names for my modules. >> >> I've got them in an Erlang-style libdir. So module foo comes out as lib.foo and has its tests at lib/foo-X.Y.Z/test/something_SUITE.erl. >> >> After doing some detective work, I determined that the name is generated by ct_run:get_name/1. I see that it appears to take the two directory names above the test directory as the name of the suite. What is the rationale behind this naming? Is there somewhere else I should put my tests? Is it ever going to be possible to override this naming scheme? >> >> Thanks, -- Jayson Vantuyl kagato@REDACTED From bernie@REDACTED Wed Dec 9 16:06:40 2009 From: bernie@REDACTED (Bernard Duggan) Date: Wed, 09 Dec 2009 10:06:40 -0500 Subject: [erlang-questions] Mnesia could not write core file: system_limit In-Reply-To: References: <20091209075815.34BCB3D0D5E@mail.pharos-avantgard.com> Message-ID: <4B1FBD00.5020902@m5net.com> Slobodan Miskovic wrote: > How would I check the FD usage of a running system? Quick way to check on linux is to count the number of entries in /proc//fd (excluding . and .. of course). The command "lsof -p " will also show you (although it lists a bunch of other things too and I can't remember off the top of my head how to filter just to file descriptors that contribute to the processes limit). > Is there a way to get notified if node is approaching the limit, in which case I could take some corrective action (such as restarting the node). > I'll leave that as an exercise for the reader ;) (Although an erlang process which periodically monitors it seems like it would be simple enough to implement). > Do open FDs get closed if a process dies? Perhaps that's where the leak is coming from. > In general, yes they do. However be aware that many operations in Erlang spawn a process, and they're not always cleaned up in the way you might expect (we found a particular case with long-lasting HTTP client connections where you have to explicitly shut them down, even if the process that initiated it had crashed). Basically, what you need to be concerned about is process leaks, not FD leaks per se. Cheers, Bernard From egil@REDACTED Wed Dec 9 16:48:22 2009 From: egil@REDACTED (=?ISO-8859-1?Q?Bj=F6rn-Egil_Dahlberg?=) Date: Wed, 09 Dec 2009 16:48:22 +0100 Subject: [erlang-questions] NIF vs. Linked-in Drivers In-Reply-To: <4B1EB3D6.1040207@erlang-consulting.com> References: <4B1E9FAE.70308@erix.ericsson.se> <4B1EB3D6.1040207@erlang-consulting.com> Message-ID: <4B1FC6C6.7020204@erix.ericsson.se> Ulf Wiger wrote: > Max Lapshin wrote: >> In my linked-in driver fork of sqlite3 driver, NIF function is >> absolutely unusable, because sqlite3 library will block calling >> process, >> thus all functions are executed in async thread. >> >> But linked-in driver is harder to implement. > > If you have a limited number of instances of a blocking > NIF, you could add that number of extra schedulers to > the system when you start Erlang. Not sure if that would > have any particular bad side-effects... perhaps the VM > experts know? One reason of why it is bad to have more schedulers then processing units is because of spinlocks. You can do it but it is far from optimal. Regards, Bj?rn-Egil Erlang/OTP From anton.krasovsky@REDACTED Wed Dec 9 17:05:26 2009 From: anton.krasovsky@REDACTED (Anton Krasovsky) Date: Wed, 9 Dec 2009 16:05:26 +0000 Subject: =?windows-1252?Q?Re=3A_=5Berlang=2Dquestions=5D_Erlyvideo_=97_current_status?= In-Reply-To: References: <46167e6a0912090254i79b5e413k2f993d5eda264b7@mail.gmail.com> <97619b170912090323q4457e21eh44fcb9e07acde104@mail.gmail.com> Message-ID: <46167e6a0912090805m68f3972em4d992a166b12c569@mail.gmail.com> Just to make it clearer, I saw a reference to RTSP and I'm interested to stream contents of 3gps over to RTSP. Would earlyvideo be applicable? Anton On Wed, Dec 9, 2009 at 11:45 AM, Max Lapshin wrote: > On Wed, Dec 9, 2009 at 2:23 PM, Rapsey wrote: >> 3gp container is basically mp4. It should work already. >> > > Perhaps, only add support for proper file extension. However, it would > be much better to add > autodetection of file type. > > I'd only want to mention, that mp4v is absolutely unsupported: it is > not H264, so flash will not play it. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From max.lapshin@REDACTED Wed Dec 9 17:08:34 2009 From: max.lapshin@REDACTED (Max Lapshin) Date: Wed, 9 Dec 2009 19:08:34 +0300 Subject: =?UTF-8?Q?Re=3A_=5Berlang=2Dquestions=5D_Erlyvideo_=E2=80=94_current_status?= In-Reply-To: <46167e6a0912090805m68f3972em4d992a166b12c569@mail.gmail.com> References: <46167e6a0912090254i79b5e413k2f993d5eda264b7@mail.gmail.com> <97619b170912090323q4457e21eh44fcb9e07acde104@mail.gmail.com> <46167e6a0912090805m68f3972em4d992a166b12c569@mail.gmail.com> Message-ID: On Wed, Dec 9, 2009 at 7:05 PM, Anton Krasovsky wrote: > Just to make it clearer, I saw a reference to RTSP and I'm interested > to stream contents of 3gps over to RTSP. Would earlyvideo be > applicable? Currently, I'm fighting with unusual H264 payload, produced by Quicktime Broadcaster. Erlyvideo need some work to support 3gp files, because they are coded with H263 codec and its layout differs from h264. It will be possible to stream this content after I finish work on RTP. From rapsey@REDACTED Wed Dec 9 17:38:28 2009 From: rapsey@REDACTED (Rapsey) Date: Wed, 9 Dec 2009 17:38:28 +0100 Subject: =?windows-1252?Q?Re=3A_=5Berlang=2Dquestions=5D_Erlyvideo_=97_current_status?= In-Reply-To: References: <46167e6a0912090254i79b5e413k2f993d5eda264b7@mail.gmail.com> <97619b170912090323q4457e21eh44fcb9e07acde104@mail.gmail.com> <46167e6a0912090805m68f3972em4d992a166b12c569@mail.gmail.com> Message-ID: <97619b170912090838t1a2ec6e3qdf9d482e855db634@mail.gmail.com> In what way unusual? I implemented RTP with quicktime broadcaster and I don't remember any strangeness. If you're having problems with anything you can contact me. Sergej On Wed, Dec 9, 2009 at 5:08 PM, Max Lapshin wrote: > On Wed, Dec 9, 2009 at 7:05 PM, Anton Krasovsky > wrote: > > Just to make it clearer, I saw a reference to RTSP and I'm interested > > to stream contents of 3gps over to RTSP. Would earlyvideo be > > applicable? > > Currently, I'm fighting with unusual H264 payload, produced by > Quicktime Broadcaster. > > Erlyvideo need some work to support 3gp files, because they are coded > with H263 codec > and its layout differs from h264. > > It will be possible to stream this content after I finish work on RTP. > From erlang@REDACTED Wed Dec 9 18:12:43 2009 From: erlang@REDACTED (Erik Reitsma) Date: Wed, 09 Dec 2009 18:12:43 +0100 Subject: wx on Linux x86_64 crashes Message-ID: <4B1FDA8B.4040503@ernovation.com> Hi, When I run wx under 64-bits Linux (Ubuntu 9.10), I get a failed assertion: $ erl Erlang R13B03 (erts-5.7.4) [source] [64-bit] [smp:4:4] [rq:4] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.7.4 (abort with ^G) 1> wx:new(). beam.smp: malloc.c:3074: sYSMALLOc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 * (sizeof(size_t))) - 1)) & ~((2 * (sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long)old_end & pagemask) == 0)' failed. Aborted $ uname -ra Linux myhost 2.6.31-16-generic #52-Ubuntu SMP Thu Dec 3 22:07:16 UTC 2009 x86_64 GNU/Linux Any ideas? I compiled from source... When I run R13B01 (compiled from source), on the same machine, it works. *Erik. From twoggle@REDACTED Wed Dec 9 19:19:34 2009 From: twoggle@REDACTED (Tim Fletcher) Date: Wed, 9 Dec 2009 10:19:34 -0800 (PST) Subject: Final year project plan In-Reply-To: References: Message-ID: > Doing a project with language you do not know is somewhat risky. You > may end up spending more time learning language and programming tricks > rather than developing your system. 2,5 months might be too short > period of time to pull learning new language and finishing project. That was my experience. I used Erlang for my final year university project, and whilst it helped get me started learning Erlang, i didn't spend nearly enough time on the academic side of things. > I need to know In what area i need to give the special > importance for my learning of my project You need to demonstrate your ability to think/analyse/critique etc, not your ability to code. So concentrate on the project report, not the code. Make sure you tackle the core hypothesis of whatever you're researching. Consider/explore alternative solutions. Demonstrate analytical thinking. > How to do the project within the time duration? Limit the scope of your project; you can always include ideas for things you wanted to do but did not have time to do in the "further work" section of the report. Manage your time well. Ask your supervisor for advice, and listen carefully. From jarrod@REDACTED Wed Dec 9 19:49:52 2009 From: jarrod@REDACTED (Jarrod Roberson) Date: Wed, 9 Dec 2009 13:49:52 -0500 Subject: [erlang-questions] An Erlang like DNS service In-Reply-To: <9b08084c0912090135u4ce2db57i7a80cdad67c7cf58@mail.gmail.com> References: <9b08084c0912090135u4ce2db57i7a80cdad67c7cf58@mail.gmail.com> Message-ID: On Wed, Dec 9, 2009 at 4:35 AM, Joe Armstrong wrote: > An Erlang DNS "like" facility > > I want something like dynamic DNS. > > How could be extend process registration to work outside > the scope of a single Erlang node? > Bonjour / Zeroconf and Wide Area Bonjour already address just this problem. I am currently working on a native Erlang multicast dns solution. From tanmaykm@REDACTED Wed Dec 9 19:51:09 2009 From: tanmaykm@REDACTED (tan) Date: Wed, 9 Dec 2009 10:51:09 -0800 (PST) Subject: ODBC error after SQL_NO_DATA_FOUND Message-ID: <1cefc2f9-6a7d-49d0-8ce0-d98de33c78c6@o9g2000prg.googlegroups.com> Hi, I have had a bit of trouble getting erlang to work with iodbc on Darwin (Mac Snow Leopard). I could get odbc to work only after configuring with --enable-darwin-64bit and getting odbcserver to statically link to iodbc. I am using postgresql as my database. The most recent trouble I faced seemed to be because of a call to SQLNumResultCols after getting a SQL_NO_DATA_FOUND during a table update/delete SQL. The odbcserver process exits with error whenever a statement generates SQL_NO_DATA_FOUND. Below is the trace log where the error happens. ================= trace start ====================== [000018.849750] odbcserver 7FFF707D2BE0 ENTER SQLExecDirect SQLHSTMT 0x10020ec60 SQLCHAR * 0x10020eb91 | update game_plays set story_id = 2, wher | | e play_id = 101 | SQLINTEGER -3 (SQL_NTS) [000018.851035] odbcserver 7FFF707D2BE0 EXIT SQLExecDirect with return code 100 (SQL_NO_DATA_FOUND) SQLHSTMT 0x10020ec60 SQLCHAR * 0x10020eb91 SQLINTEGER -3 (SQL_NTS) [000018.851071] odbcserver 7FFF707D2BE0 ENTER SQLNumResultCols SQLHSTMT 0x10020ec60 SQLSMALLINT * 0x7fff5fbfe8ee [000018.851098] odbcserver 7FFF707D2BE0 EXIT SQLNumResultCols with return code -1 (SQL_ERROR) SQLHSTMT 0x10020ec60 SQLSMALLINT * 0x7fff5fbfe8ee ================= trace end ====================== To circumvent the issue, I modified odbcserver.c (patch below) to prevent calls to SQLNumResultCols in such cases. Is this fix correct? Did anybody else face similar issues? Is there a better way for getting odbc to work instead of doing a 64bit compile and static linking with iodbc correct? Regards, Tan ================= patch file start ====================== 154c154 < static db_result_msg encode_result(db_state *state); --- > static db_result_msg encode_result(db_state *state, SQLRETURN sql_result); 588c588 < msg = encode_result(state); --- > msg = encode_result(state, result); 593c593 < msg = encode_result(state); --- > msg = encode_result(state, result); 815c815 < msg = encode_result(state); --- > msg = encode_result(state, SQL_SUCCESS); 980c980 < static db_result_msg encode_result(db_state *state) --- > static db_result_msg encode_result(db_state *state, SQLRETURN sql_result) 993c993,998 < DO_EXIT(EXIT_COLS); --- > if(SQL_NO_DATA_FOUND == sql_result) { > num_of_columns = 0; > } > else { > DO_EXIT(EXIT_COLS); > } 1007c1012,1017 < DO_EXIT(EXIT_ROWS); --- > if(SQL_NO_DATA_FOUND == sql_result) { > RowCountPtr = 0; > } > else { > DO_EXIT(EXIT_ROWS); > } ================= patch file end ====================== =============== my environment ======================== $ erl Erlang R13B03 (erts-5.7.4) [source] [64-bit] [smp:2:2] [rq:2] [async- threads:0] [kernel-poll:false] Eshell V5.7.4 (abort with ^G) $ uname -ap Darwin tanmac.local 10.2.0 Darwin Kernel Version 10.2.0: Tue Nov 3 10:37:10 PST 2009; root:xnu-1486.2.11~1/RELEASE_I386 i386 i386 ======================================= From matthew@REDACTED Wed Dec 9 19:58:51 2009 From: matthew@REDACTED (Matthew Sackman) Date: Wed, 9 Dec 2009 18:58:51 +0000 Subject: Port Driver, outputv, binaries. Message-ID: <20091209185851.GG2659@mrnibble.lshift.net> Hi, So I'm writing a port driver for a linked in binary. I've implemented outputv, and that seems to be working fine. In order to see what I'm being sent, I have the following in C: void dump_ev(ErlIOVec *ev) { printf("total size: %d\r\nvec len: %d\r\n", ev->size, ev->vsize); int idx; for (idx = 0; idx < ev->vsize; ++idx) { printf("iov[%d] = ", idx); SysIOVec iov = ev->iov[idx]; printf("[base = %p, len = %zd]\r\n", iov.iov_base, iov.iov_len); printf("binv[%d] = ", idx); if (NULL == ev->binv[idx]) { printf("NULL\r\n"); } else { ErlDrvBinary* bin = ev->binv[idx]; printf("[orig_bytes = %p; orig_size = %zd]\r\n", bin->orig_bytes, bin->orig_size); } } printf("done\r\n"); } which is called at the start of outputv: static void test_outputv(ErlDrvData drv_data, ErlIOVec *ev) { dump_ev(ev); ... } Now, in the shell, I do the following: 1> ok = erl_ddll:load_driver("ebin", "libtest"), Port = open_port({spawn_driver, libtest}, [binary]). 2> port_command(Port, [<<2>>,<<0,0,0,0,0,0,0,0>>,<<0>>,<<0>>,<<0>>]). And I get out the following: total size: 12 vec len: 6 iov[0] = [base = (nil), len = 0] binv[0] = NULL iov[1] = [base = 0x17a89b0, len = 1] binv[1] = [orig_bytes = 0x17a89b0; orig_size = 1] iov[2] = [base = 0x17a89e8, len = 8] binv[2] = [orig_bytes = 0x17a89e8; orig_size = 8] iov[3] = [base = 0x17a8a20, len = 1] binv[3] = [orig_bytes = 0x17a8a20; orig_size = 1] iov[4] = [base = 0x17a8a58, len = 1] binv[4] = [orig_bytes = 0x17a8a58; orig_size = 1] iov[5] = [base = 0x17a8a90, len = 1] binv[5] = [orig_bytes = 0x17a8a90; orig_size = 1] done Which makes a lot of sense - each arg corresponds to an entry in the iov and binv. That's all fine. Now, in some erlang code (a gen_server) I have this: init([]) -> erl_ddll:start(), ok = erl_ddll:load_driver("ebin", ?LIBNAME), Port = open_port({spawn_driver, ?LIBNAME}, [binary, stream]), {ok, Port}. handle_call({tune, BNum, APow, FPow, Opts}, _From, Port) -> Data = [<<2/native>>, <>, <>, <>, <>], port_command(Port, Data), ... Then in the shell I do this: 1> {ok, Pid} = test_drv:start_link(), gen_server:call(Pid, {tune, 0, 0, 0, 0}). and I get out: total size: 12 vec len: 2 iov[0] = [base = (nil), len = 0] binv[0] = NULL iov[1] = [base = 0x1faded0, len = 12] binv[1] = [orig_bytes = 0x1faded0; orig_size = 12] done Why on earth has it gone and pushed all those binaries into one big binary? What on earth is the actual behaviour meant to be? Where is it defined? How can I reliably pull args out of the iov and binv? Certainly the behaviour is different to that in http://www.erlang.org/pipermail/erlang-questions/2006-March/019818.html In short, WTF?! Matthew From erlang@REDACTED Wed Dec 9 21:12:49 2009 From: erlang@REDACTED (Joe Armstrong) Date: Wed, 9 Dec 2009 21:12:49 +0100 Subject: Announce: elib1 Message-ID: <9b08084c0912091212n3aba6ff9if128b1388e631975@mail.gmail.com> Announcing elib1 Elib1 was released today. Tomorrow I will present it at the Stockholm Erlounge. Elib1 is a library of Erlang modules and set of applications which use the modules. The Elib1 project now moves into phase 2 The phases of the project are: Phase 1: Define and implement a basic structure and a small number of applications Phase 2: Make project open source Phase 3: Write books Each phase will take about 2-3 years. The first attempt at a library contains modules for the following: xml parsing fast tuple I/O (to disk) full-text indexing http parsing telnet server json parsing porter stemming mysql native interface sha1 similar file locator screen manipulation miscellaneous missing functions (which should be in the standard libraries) accurate tagging of Erlang so it can be turned into browsable HTML (and more ...) The applications are divided it two areas. Supported and unsupported In supported: indexer - a full text indexing engine (this is the of near production quality) irc - and irc kit (includes a TCL wish interface) (somewhat incomplete) tagger - an application to turn erlang into browsable HTML drivers - example linked in and port drivers (currently broken) midi_drivers - mac os X only website - a webserver (used internally) versions - a way of munging module names to make them secure In unsupported: epeg - a peg grammar and parser combinators folding - Javascript folding editor/organiser (needs some work, not erlang :-) jpeg - image transformation in Erlang xml - some xml stuff I have attempted to use "best practise" in making the library. Using the dialyzer, eunit and edoc. This code is far from perfect or polished - but the basic way things fit together is defined. Rather than have 500 small libraries each with a few users and a few routines I'd like to see one library with a much large number of tightly integrated routines. The code is available at: http://github.com/joearms/elib1 /Joe Armstrong From zabrane3@REDACTED Wed Dec 9 21:51:12 2009 From: zabrane3@REDACTED (zabrane Mikael) Date: Wed, 9 Dec 2009 21:51:12 +0100 Subject: Announce: elib1 In-Reply-To: <9b08084c0912091212n3aba6ff9if128b1388e631975@mail.gmail.com> References: <9b08084c0912091212n3aba6ff9if128b1388e631975@mail.gmail.com> Message-ID: <18a1db030912091251j456ca963v4939c913ef8e1d6e@mail.gmail.com> Hi Joe ! Awesome. Could someone take notes for tomorrow, or share your presentation slides? Regards Zabrane. 2009/12/9 Joe Armstrong > Announcing elib1 > > Elib1 was released today. > > Tomorrow I will present it at the Stockholm Erlounge. > > Elib1 is a library of Erlang modules and set of applications which use > the modules. > > The Elib1 project now moves into phase 2 > > The phases of the project are: > > Phase 1: Define and implement a basic structure > and a small number of applications > Phase 2: Make project open source > Phase 3: Write books > > Each phase will take about 2-3 years. > > The first attempt at a library contains modules for the following: > > xml parsing > fast tuple I/O (to disk) > full-text indexing > http parsing > telnet server > json parsing > porter stemming > mysql native interface > sha1 > similar file locator > screen manipulation > miscellaneous missing functions (which should be in the standard > libraries) > accurate tagging of Erlang so it can be turned into browsable HTML > (and more ...) > > The applications are divided it two areas. Supported and unsupported > > In supported: > > indexer - a full text indexing engine (this is the of near > production quality) > irc - and irc kit (includes a TCL wish interface) > (somewhat incomplete) > tagger - an application to turn erlang into browsable HTML > drivers - example linked in and port drivers (currently broken) > midi_drivers - mac os X only > website - a webserver (used internally) > versions - a way of munging module names to make them secure > > In unsupported: > > epeg - a peg grammar and parser combinators > folding - Javascript folding editor/organiser (needs some work, > not erlang :-) > jpeg - image transformation in Erlang > xml - some xml stuff > > I have attempted to use "best practise" in making the library. Using > the dialyzer, eunit and edoc. > > This code is far from perfect or polished - but the basic way things > fit together > is defined. > > Rather than have 500 small libraries each with a few users and a few > routines I'd > like to see one library with a much large number of tightly integrated > routines. > > The code is available at: > > http://github.com/joearms/elib1 > > /Joe Armstrong > From bruce@REDACTED Wed Dec 9 22:33:16 2009 From: bruce@REDACTED (Bruce Fitzsimons) Date: Thu, 10 Dec 2009 10:33:16 +1300 Subject: End of year thanks to the OTP team Message-ID: <4B20179C.7010106@fitzsimons.org> Hi, I'd just like to echo Steve Davis' comments ("btw the github move, the beta website, and doc searching is all truly spectacular and highly appreciated") from the obscurely named "asn1ct out of date?" thread. Allowing contributions to Erlang while having it maintained as a stable commercial product is a hard balancing act, and the steady hand on the tiller is something everyone continues to benefit from -- it gives a high level of trust that new Erlang releases will work out of the box. The move to open up the Erlang development process further has been amazing. We've all been frustrated at times by our patches seemingly disappearing (and occasionally, really disappearing) while they were processed by the OTP team. The github process supports further acceleration of contributions and allows open and frank discussion of the merits. I'm not anticipating that all patch authors are going to be happy all the time, so I expect some robust discussion about this on-list as well over the coming years, but this is healthy and hopefully invigorating. So, thanks OTP team. You've done really well this year. Regards, Bruce PS Can we expect to see you on Twitter and Facebook next? :-) From the.ajarn@REDACTED Wed Dec 9 22:51:22 2009 From: the.ajarn@REDACTED (Brentley Jones) Date: Wed, 9 Dec 2009 15:51:22 -0600 Subject: [erlang-questions] End of year thanks to the OTP team In-Reply-To: <4B20179C.7010106@fitzsimons.org> References: <4B20179C.7010106@fitzsimons.org> Message-ID: On Dec 9, 2009, at 3:33 PM, Bruce Fitzsimons wrote: > Hi, > > I'd just like to echo Steve Davis' comments ("btw the github move, the beta website, and doc searching is all truly spectacular and highly appreciated") from the obscurely named "asn1ct out of date?" thread. > > Allowing contributions to Erlang while having it maintained as a stable commercial product is a hard balancing act, and the steady hand on the tiller is something everyone continues to benefit from -- it gives a high level of trust that new Erlang releases will work out of the box. > > The move to open up the Erlang development process further has been amazing. We've all been frustrated at times by our patches seemingly disappearing (and occasionally, really disappearing) while they were processed by the OTP team. The github process supports further acceleration of contributions and allows open and frank discussion of the merits. I'm not anticipating that all patch authors are going to be happy all the time, so I expect some robust discussion about this on-list as well over the coming years, but this is healthy and hopefully invigorating. > > So, thanks OTP team. You've done really well this year. > > Regards, > Bruce > > PS Can we expect to see you on Twitter and Facebook next? :-) > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From smiskovic@REDACTED Wed Dec 9 23:03:08 2009 From: smiskovic@REDACTED (Slobodan Miskovic) Date: Wed, 09 Dec 2009 14:03:08 -0800 Subject: [erlang-questions] Mnesia could not write core file: system_limit In-Reply-To: <4B1FBD00.5020902@m5net.com> References: <20091209075815.34BCB3D0D5E@mail.pharos-avantgard.com> <4B1FBD00.5020902@m5net.com> Message-ID: <1260396188.5814.44.camel@aramis.mditinnovations.com> On Wed, 2009-12-09 at 10:06 -0500, Bernard Duggan wrote: > > How would I check the FD usage of a running system? > Quick way to check on linux is to count the number of entries in > /proc//fd (excluding . and .. of course). Heh, thinking outside of the (VM) box - guess there is no query-able interface in Erlang for this? Linux is then indeed simple enough: {ok, FDList} = file:list_dir("/proc/self/fd"), length(FDList) What about other platforms, ie. Windows? > The command "lsof -p > " will also show you (although it lists a bunch of other things too > and I can't remember off the top of my head how to filter just to file > descriptors that contribute to the processes limit). > Would lsof (or similar mechanism) be preferable as I would get a list of open sockets and network connections which as I understand all contribute to the max open ports limit. Would I get all those in the /proc/.../fd list as well? > > Do open FDs get closed if a process dies? Perhaps that's where the leak is coming from. > > > In general, yes they do. However be aware that many operations in > Erlang spawn a process, and they're not always cleaned up in the way you > might expect (we found a particular case with long-lasting HTTP client > connections where you have to explicitly shut them down, even if the > process that initiated it had crashed). Basically, what you need to be > concerned about is process leaks, not FD leaks per se. Hm, I have embedded Yaws running, and occasionally processes terminate when invalid requests comes in. I would have thought those would have been really dead. I'll have to keep an eye on the running system to see if number of processes is rising. Thanks, Slobo From clist@REDACTED Wed Dec 9 23:03:54 2009 From: clist@REDACTED (Angel Alvarez) Date: Wed, 9 Dec 2009 23:03:54 +0100 Subject: more erlang articles (for newbees like me) Message-ID: <200912092303.55364.clist@uah.es> Hi lists Ive just found this intersting article about dynamo (reloaded) http://lethain.com/entry/2009/nov/30/hands-on-review-of-the-dynamo-paper/ and yes!! Keep the good work OTP Guys!! -- ->>----------------------------------------------- Clist UAH a.k.a Angel ---------------------------------[www.uah.es]-<<-- Mas vale POJO en mano que STRUTS volando. From zabrane3@REDACTED Wed Dec 9 23:51:46 2009 From: zabrane3@REDACTED (zabrane Mikael) Date: Wed, 9 Dec 2009 23:51:46 +0100 Subject: [erlang-questions] Best way to interface Erlang with Java code In-Reply-To: <20091207040032.GQ11530@delora.autosys.us> References: <18a1db030912050745r473683fboe722b1ec9a449d24@mail.gmail.com> <4B1A81FF.6050804@gmail.com> <18a1db030912050927o1faff113g3ffd5083779ba623@mail.gmail.com> <20091205182059.GE11530@delora.autosys.us> <18a1db030912061837w7ad4591fy9f8b26b9431f1fbd@mail.gmail.com> <20091207031351.GP11530@delora.autosys.us> <20091207040032.GQ11530@delora.autosys.us> Message-ID: <18a1db030912091451s5ff30186n4d8c546f931c7641@mail.gmail.com> Hi Erlangers ! Following your advices about "open_port" & "port_command", my Erlang interface to crontrol the small java example is working very well. Next step is to be able to send data to a "java" program that's waiting to read from "stdin". JAVA side ======== $ java print.java - % "-" mean read from "stdin" Erlang side ========= I've a binary string <<"Hello World">>, and simply want to send it to this "java" program (via port_command, but it doesn't work). The latter will just printout "Hello World" on the shell. Help, please !! Regards Zabrane 2009/12/7 Michael McDaniel > and another using extra re features ... > > > 1> Cmd = "java transform animals.txt ; echo $?" . > "java transform animals.txt ; echo $?" . > 2> {match, [Val,Ret]} = > re:run( os:cmd(Cmd), > "(?.*)(?[0-9])\\n$", > [dotall,ungreedy,{capture,['VAL','RETCODE'],list}]). > {match, ["Cat\nShark\n...", "1"]} > 3> Ret. > "1" > 4> Val. > "Cat\nShark\n..." > 5> re:split(Val, "\n", [{return,list}]). > ["Cat", "Shark", ...] > > > the above presumes single digit return codes > > os:cmd/1 is not the only tool to get other program output; e.g. running > via a port, or using jinterface. Or maybe the new NIF experimental > feature in R13B03. > > > ~M > > > On Sun, Dec 06, 2009 at 07:13:52PM -0800, Michael McDaniel wrote: > > one way ... > > > > > > 1> L = re:split (os:cmd ("java transform animals.txt ; echo $?"), "\n"). > > [<<"Cat">>, > > <<"Shark">>, > > ........ % a lot of animal names here (more than 1000) > > <<"Wolf">>, > > <<"1">>,<<>>] > > > > 2> Ret = lists:nth( 2, lists:reverse( L ) ) . > > <<"1">> > > 3> case Ret > > 3> of <<"0">> -> do_something ; > > 3> _ -> do_something_else > > 3> end. > > failure > > > > > > read up on lists and re modules for different ways of playing with > > the output > > > > ~Michael > > > > > > On Mon, Dec 07, 2009 at 03:37:25AM +0100, zabrane Mikael wrote: > > > Hi Michael ! > > > > > > I found a subtle problem when trying your solution when my program > returns a > > > text with one or more "\n". > > > > > > Eg: > > > 1> re:split (os:cmd ("java transform animals.txt ; echo $?"), "\n"). > > > [<<"Cat">>, > > > <<"Shark">>, > > > ........ % a lot of animal names here (more than 1000) > > > <<"Wolf">>, > > > <<"1">>,<<>>] > > > 2> > > > > > > How then can I distinguish between my program output and the error code > > > (which is at the end of the list) ? > > > > > > Thanks > > > Zabrane > > > > > > 2009/12/5 Michael > > > > > > > on my Linux box ... > > > > > > > > $ erl > > > > Erlang R13B03 (erts-5.7.4) [rq:1] [async-threads:0] [hipe] > > > > [kernel-poll:false] > > > > > > > > Eshell V5.7.4 (abort with ^G) > > > > 1> re:split(os:cmd("java x ; echo $?"),"\n"). > > > > [<<"Exception in thread \"main\" java.lang.NoClassDefFoundError: > x">>, > > > > <<"1">>,<<>>] > > > > 2> > > > > > > > > > > > > On Sat, Dec 05, 2009 at 06:27:24PM +0100, zabrane Mikael wrote: > > > > > Hi Sean ! > > > > > > > > > > Ok I see. But how then cal I handle error code in Erlang if my Java > > > > program > > > > > crash or returns something different from error code 0? > > > > > > > > > > Thanks > > > > > Zabrane > > > > > > > > > > 2009/12/5 Sean Cribbs > > > > > > > > > > > zabrane Mikael wrote: > > > > > > > > > > > >> Hi List ! > > > > > >> > > > > > >> I've a small program written in "Java" which take a filename > (input), > > > > > >> proceed it, and print out > > > > > >> a text (output). > > > > > >> > > > > > >> What's the best way to be able to access to that program from > Erlang? > > > > > >> My whish is get back the "output" as an Erlang binary. > > > > > >> > > > > > >> Thanks > > > > > >> Zabrane > > > > > >> > > > > > >> > > > > > >> > > > > > > Use os:cmd/1, which returns a string/list - > > > > > > http://erldocs.com/R13B03/kernel/os.html?search=os&i=5 > > > > > > > > > > > > Sean > > > > > > > > > > > > > > ________________________________________________________________ > > > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > > > erlang-questions (at) erlang.org > > > > > > > > ________________________________________________________________ > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > erlang-questions (at) erlang.org > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From bernie@REDACTED Thu Dec 10 00:00:11 2009 From: bernie@REDACTED (Bernard Duggan) Date: Wed, 09 Dec 2009 18:00:11 -0500 Subject: [erlang-questions] Mnesia could not write core file: system_limit In-Reply-To: <1260396188.5814.44.camel@aramis.mditinnovations.com> References: <20091209075815.34BCB3D0D5E@mail.pharos-avantgard.com> <4B1FBD00.5020902@m5net.com> <1260396188.5814.44.camel@aramis.mditinnovations.com> Message-ID: <4B202BFB.2010208@m5net.com> Slobodan Miskovic wrote: > Heh, thinking outside of the (VM) box - guess there is no query-able > interface in Erlang for this? Linux is then indeed simple enough: > {ok, FDList} = file:list_dir("/proc/self/fd"), > length(FDList) > Huh - never noticed the 'self' symlink - that's really handy :) As far as I know there's no specific interface in Erlang for this - I'd expect it to either be in maybe os: or erlang:, but I can't see anything there. > What about other platforms, ie. Windows? > Sorry, I can't help you there. > Would lsof (or similar mechanism) be preferable as I would get a list of > open sockets and network connections which as I understand all > contribute to the max open ports limit. Would I get all those in > the /proc/.../fd list as well? > /proc/self/fd should include all file descriptors that contribute to the process's limit - pipes, sockets, files etc. It's what we use for monitoring exactly this issue on some of our C++ code. > Hm, I have embedded Yaws running, and occasionally processes terminate > when invalid requests comes in. I would have thought those would have > been really dead. I'll have to keep an eye on the running system to see > if number of processes is rising. > Proces leaks are the memory leaks of Erlang - they're relatively easy to accidentally code if you're not careful. If you're running a long-running server app I'd suggest looking at providing an SNMP monitoring system to keep an eye on this kind of thing - Erlang's built-in SNMP stuff is a pain in the backside to initially set up, but once you've got it going it's trivial to add a lot of really informative information. Cheers, B From twoggle@REDACTED Thu Dec 10 00:11:49 2009 From: twoggle@REDACTED (Tim Fletcher) Date: Wed, 9 Dec 2009 15:11:49 -0800 (PST) Subject: Announce: elib1 In-Reply-To: <9b08084c0912091212n3aba6ff9if128b1388e631975@mail.gmail.com> References: <9b08084c0912091212n3aba6ff9if128b1388e631975@mail.gmail.com> Message-ID: > Rather than have 500 small libraries each with a few users and a > few routines I'd like to see one library with a much large number > of tightly integrated routines. Interesting strategy. What are the guidelines for deciding whether a piece of code should be included? Tim From mevans@REDACTED Thu Dec 10 00:09:43 2009 From: mevans@REDACTED (Evans, Matthew) Date: Wed, 9 Dec 2009 18:09:43 -0500 Subject: [erlang-questions] Mnesia could not write core file: system_limit In-Reply-To: <4B202BFB.2010208@m5net.com> References: <20091209075815.34BCB3D0D5E@mail.pharos-avantgard.com> <4B1FBD00.5020902@m5net.com> <1260396188.5814.44.camel@aramis.mditinnovations.com>,<4B202BFB.2010208@m5net.com> Message-ID: To handle process leaks (especially if you are using a gen_server / gen_fsm behaviour) I normally return a timeout from my handle_call, handle_info, handle_cast etc. functions. I have the time the process started and the time of the last event in my State record, and then have logic in the handle_info(timeout,State) function to cause the process to "self destruct" if it thinks it's been around too long. There is a small performance overhead of starting a timer in your process, but it does trap these sort of problems. Regards Matt ________________________________________ From: erlang-questions@REDACTED [erlang-questions@REDACTED] On Behalf Of Bernard Duggan [bernie@REDACTED] Sent: Wednesday, December 09, 2009 6:00 PM To: Slobodan Miskovic Cc: Erlang-Questions Questions Subject: Re: [erlang-questions] Mnesia could not write core file: system_limit Slobodan Miskovic wrote: > Heh, thinking outside of the (VM) box - guess there is no query-able > interface in Erlang for this? Linux is then indeed simple enough: > {ok, FDList} = file:list_dir("/proc/self/fd"), > length(FDList) > Huh - never noticed the 'self' symlink - that's really handy :) As far as I know there's no specific interface in Erlang for this - I'd expect it to either be in maybe os: or erlang:, but I can't see anything there. > What about other platforms, ie. Windows? > Sorry, I can't help you there. > Would lsof (or similar mechanism) be preferable as I would get a list of > open sockets and network connections which as I understand all > contribute to the max open ports limit. Would I get all those in > the /proc/.../fd list as well? > /proc/self/fd should include all file descriptors that contribute to the process's limit - pipes, sockets, files etc. It's what we use for monitoring exactly this issue on some of our C++ code. > Hm, I have embedded Yaws running, and occasionally processes terminate > when invalid requests comes in. I would have thought those would have > been really dead. I'll have to keep an eye on the running system to see > if number of processes is rising. > Proces leaks are the memory leaks of Erlang - they're relatively easy to accidentally code if you're not careful. If you're running a long-running server app I'd suggest looking at providing an SNMP monitoring system to keep an eye on this kind of thing - Erlang's built-in SNMP stuff is a pain in the backside to initially set up, but once you've got it going it's trivial to add a lot of really informative information. Cheers, B ________________________________________________________________ erlang-questions mailing list. See http://www.erlang.org/faq.html erlang-questions (at) erlang.org From vances@REDACTED Thu Dec 10 00:40:35 2009 From: vances@REDACTED (Vance Shipley) Date: Wed, 9 Dec 2009 18:40:35 -0500 Subject: [erlang-questions] Port Driver, outputv, binaries. In-Reply-To: <20091209185851.GG2659@mrnibble.lshift.net> References: <20091209185851.GG2659@mrnibble.lshift.net> Message-ID: <20091209234031.GA56014@h216-235-12-172.host.egate.net> Mathew, You'll find this thread helpful: http://www.erlang.org/pipermail/erlang-questions/2002-October/005858.html On Wed, Dec 09, 2009 at 06:58:51PM +0000, Matthew Sackman wrote: } Why on earth has it gone and pushed all those binaries into one big } binary? What on earth is the actual behaviour meant to be? Where is it } defined? How can I reliably pull args out of the iov and binv? -- -Vance From puzza007@REDACTED Thu Dec 10 01:04:56 2009 From: puzza007@REDACTED (Paul Oliver) Date: Thu, 10 Dec 2009 00:04:56 +0000 Subject: [erlang-questions] ODBC error after SQL_NO_DATA_FOUND In-Reply-To: <1cefc2f9-6a7d-49d0-8ce0-d98de33c78c6@o9g2000prg.googlegroups.com> References: <1cefc2f9-6a7d-49d0-8ce0-d98de33c78c6@o9g2000prg.googlegroups.com> Message-ID: Hi Tan, This looks like it could be similar to the bug I observed in http://github.com/erlang/otp/commit/f3b6a575fceb957805c3b8d8af796a749cbad61c. In fact, it looks like you could easily modify that patch to work in your case. Check http://msdn.microsoft.com/en-us/library/ms716219%28VS.85%29.aspx for details. Cheers, Paul. On Wed, Dec 9, 2009 at 6:51 PM, tan wrote: > Hi, > > I have had a bit of trouble getting erlang to work with iodbc on > Darwin (Mac Snow Leopard). I could get odbc to work only after > configuring with --enable-darwin-64bit and getting odbcserver to > statically link to iodbc. I am using postgresql as my database. > > The most recent trouble I faced seemed to be because of a call to > SQLNumResultCols after getting a SQL_NO_DATA_FOUND during a table > update/delete SQL. The odbcserver process exits with error whenever a > statement generates SQL_NO_DATA_FOUND. Below is the trace log where > the error happens. > > ================= trace start ====================== > [000018.849750] > odbcserver ? ? ?7FFF707D2BE0 ENTER SQLExecDirect > ? ? ? ? ? ? ? ?SQLHSTMT ? ? ? ? ?0x10020ec60 > ? ? ? ? ? ? ? ?SQLCHAR ? ? ? ? * 0x10020eb91 > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| update game_plays set story_id = 2, wher | > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| e play_id = 101 ?| > ? ? ? ? ? ? ? ?SQLINTEGER ? ? ? ?-3 (SQL_NTS) > > [000018.851035] > odbcserver ? ? ?7FFF707D2BE0 EXIT ?SQLExecDirect with return code 100 > (SQL_NO_DATA_FOUND) > ? ? ? ? ? ? ? ?SQLHSTMT ? ? ? ? ?0x10020ec60 > ? ? ? ? ? ? ? ?SQLCHAR ? ? ? ? * 0x10020eb91 > ? ? ? ? ? ? ? ?SQLINTEGER ? ? ? ?-3 (SQL_NTS) > > [000018.851071] > odbcserver ? ? ?7FFF707D2BE0 ENTER SQLNumResultCols > ? ? ? ? ? ? ? ?SQLHSTMT ? ? ? ? ?0x10020ec60 > ? ? ? ? ? ? ? ?SQLSMALLINT ? ? * 0x7fff5fbfe8ee > > [000018.851098] > odbcserver ? ? ?7FFF707D2BE0 EXIT ?SQLNumResultCols with return code > -1 (SQL_ERROR) > ? ? ? ? ? ? ? ?SQLHSTMT ? ? ? ? ?0x10020ec60 > ? ? ? ? ? ? ? ?SQLSMALLINT ? ? * 0x7fff5fbfe8ee > ================= trace end ====================== > > > > To circumvent the issue, I modified odbcserver.c (patch below) to > prevent calls to SQLNumResultCols in such cases. > > Is this fix correct? > Did anybody else face similar issues? > Is there a better way for getting odbc to work instead of doing a > 64bit compile and static linking with iodbc correct? > > Regards, > Tan > > > ================= patch file start ====================== > 154c154 > < static db_result_msg encode_result(db_state *state); > --- >> static db_result_msg encode_result(db_state *state, SQLRETURN sql_result); > 588c588 > < ? ? ? msg = encode_result(state); > --- >> ? ? ? msg = encode_result(state, result); > 593c593 > < ? ? ? ? ? msg = encode_result(state); > --- >> ? ? ? ? ? msg = encode_result(state, result); > 815c815 > < ? ? ? ? ? ? ? ? ? ? msg = encode_result(state); > --- >> ? ? ? ? ? ? ? ? ? ? msg = encode_result(state, SQL_SUCCESS); > 980c980 > < static db_result_msg encode_result(db_state *state) > --- >> static db_result_msg encode_result(db_state *state, SQLRETURN sql_result) > 993c993,998 > < ? ? ? DO_EXIT(EXIT_COLS); > --- >> ? ? ? if(SQL_NO_DATA_FOUND == sql_result) { >> ? ? ? ? ? ? ? num_of_columns = 0; >> ? ? ? } >> ? ? ? else { >> ? ? ? ? ? ? ? DO_EXIT(EXIT_COLS); >> ? ? ? } > 1007c1012,1017 > < ? ? ? DO_EXIT(EXIT_ROWS); > --- >> ? ? ? if(SQL_NO_DATA_FOUND == sql_result) { >> ? ? ? ? ? ? ? RowCountPtr = 0; >> ? ? ? } >> ? ? ? else { >> ? ? ? ? ? ? ? DO_EXIT(EXIT_ROWS); >> ? ? ? } > ================= patch file end ====================== > > > =============== my environment ======================== > $ erl > Erlang R13B03 (erts-5.7.4) [source] [64-bit] [smp:2:2] [rq:2] [async- > threads:0] [kernel-poll:false] > > Eshell V5.7.4 ?(abort with ^G) > > > $ uname -ap > Darwin tanmac.local 10.2.0 Darwin Kernel Version 10.2.0: Tue Nov ?3 > 10:37:10 PST 2009; root:xnu-1486.2.11~1/RELEASE_I386 i386 i386 > ======================================= > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From erlang@REDACTED Thu Dec 10 08:27:27 2009 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 10 Dec 2009 08:27:27 +0100 Subject: [erlang-questions] Re: Announce: elib1 In-Reply-To: References: <9b08084c0912091212n3aba6ff9if128b1388e631975@mail.gmail.com> Message-ID: <9b08084c0912092327j33da42f8ja4e967eba0aba62e@mail.gmail.com> The new code should be significantly different from the existing code - ie I don't want many modules doing almost the same thing. It should contain many cross module calls to other modules in the library. It should be well documented, typed, and have test cases. The goal is that using the library most applications should be able to make a lot of library calls. Every time you are writing an application and you think "this should be in a library" you check and find - yes it is - and if it's not you put it in the library. There's a much larger set of guidelines in the library itself - and a description of the mechanism by which new code gets into the library. /Joe On Thu, Dec 10, 2009 at 12:11 AM, Tim Fletcher wrote: >> Rather than have 500 small libraries each with a few users and a >> few routines I'd like to see one library with a much large number >> of tightly integrated routines. > > Interesting strategy. What are the guidelines for deciding whether a > piece of code should be included? > > > Tim > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From jilani@REDACTED Thu Dec 10 10:46:33 2009 From: jilani@REDACTED (Jilani Khaldi) Date: Thu, 10 Dec 2009 10:46:33 +0100 Subject: [erlang-questions] Announce: elib1 In-Reply-To: <9b08084c0912091212n3aba6ff9if128b1388e631975@mail.gmail.com> References: <9b08084c0912091212n3aba6ff9if128b1388e631975@mail.gmail.com> Message-ID: <4B20C379.10408@cheapnet.it> > mysql native interface Why not Postgres or Firebird RDBMS? They are a lot better than MySQL, even regarding licence. JiK -- Jilani KHALDI --------------------- http://www.iiiaugusta.com From erlang@REDACTED Thu Dec 10 10:48:52 2009 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 10 Dec 2009 10:48:52 +0100 Subject: [erlang-questions] Announce: elib1 In-Reply-To: <4B20C379.10408@cheapnet.it> References: <9b08084c0912091212n3aba6ff9if128b1388e631975@mail.gmail.com> <4B20C379.10408@cheapnet.it> Message-ID: <9b08084c0912100148l50ea519fn516319659132617e@mail.gmail.com> On Thu, Dec 10, 2009 at 10:46 AM, Jilani Khaldi wrote: >> ? ?mysql native interface > > Why not Postgres or Firebird RDBMS? They are a lot better than MySQL, even > regarding licence. Life is too short ... Feel free to contribute the appropriate code /Joe > JiK > -- > Jilani KHALDI > --------------------- > http://www.iiiaugusta.com > From gleber.p@REDACTED Thu Dec 10 11:03:15 2009 From: gleber.p@REDACTED (Gleb Peregud) Date: Thu, 10 Dec 2009 11:03:15 +0100 Subject: [erlang-questions] Announce: elib1 In-Reply-To: <9b08084c0912091212n3aba6ff9if128b1388e631975@mail.gmail.com> References: <9b08084c0912091212n3aba6ff9if128b1388e631975@mail.gmail.com> Message-ID: <14f0e3620912100203t44b0dfc1pd0898e2b3d310a8a@mail.gmail.com> On Wed, Dec 9, 2009 at 21:12, Joe Armstrong wrote: > Rather than have 500 small libraries each with a few users and a few > routines I'd > like to see one library with a much large number of tightly integrated routines. Why not create general rules, specifications, unified structure and build system for these libraries, use package manager (e.g. epm [1]) and let everyone contribute under the umbrella of one main project? I.e. there's a elib1 project, which is a set of core libraries, and other libraries would be dependencies of it. If someone is willing to become the part of the whole maintainer of the meta project checks if it conforms to the rules. If it does then he adds this subproject as a dependency to elib1. 1: http://github.com/JacobVorreuter/epm From tony@REDACTED Thu Dec 10 11:12:36 2009 From: tony@REDACTED (Tony Rogvall) Date: Thu, 10 Dec 2009 11:12:36 +0100 Subject: [erlang-questions] Port Driver, outputv, binaries. In-Reply-To: <20091209185851.GG2659@mrnibble.lshift.net> References: <20091209185851.GG2659@mrnibble.lshift.net> Message-ID: <534ABD4C-848D-41EE-80E9-B47A24EB91A1@rogvall.se> Hi! Yes, the behavior is a bit strange. But there a number of parameters the control how binaries and io vectors are constructed. There are 3 types of binary representations internally: - Heap binaries Binary data is on the process heap. This type of binary is constructed when data is less than 64 bytes (may be changed!) - Proc binaries Binary data is on the global heap. ProcBins are reference counted and are mark and sweep kind of things. - Sub binaries Sub binaries refer to either a part of a ProcBin or a part of a SubBin. When the compiler compiles binaries they may end up in different flavors, depending on size and if they are constant or not. When the shell constructs binaries the result may sometimes be a ProcBin when you really expected a HeapBin to show up. In your case you really wanted a ProcBin but I thought that a HeapBin should have been there ;-) The shell actually constructed a SubBin pointing to a ProcBin maybe some one at the OTP team knows why!? Next when the runtime system constructs the io vector it will preserve ProcBins and put them in the vector for zero copy mode. HeapBins are copied in the same way as characters lists. Everything that is not ProcBin is (internally) copied in to a new binary. Then the io vector entry will point to parts of that binary. Note that vectors are only broken up if the runtime hits a ProcBin. Example: [1,2,3,<<100,101,102>>,[5,6,7],<>, 8,9,10,<>] Will generate create one area with NewBin = <<1,2,3,100,101,102,5,6,7,8,9,10>> and the vector will look something like this (sketchy): iov[0].base = 0 iov[0].len = 0 binv[0] = 0 ( Index 0 is reserved packet byte stuff, header injection) iov[1].base = &NewBin iov[1].len = 9 binv[1] = NewBin iov[2].base = &ProcBin1 iov[2].len = size(ProcBin1) binv[2] = ProcBin1; iov[3].base = &NewBin + 9 iov[3].len = 3 binv[3] = NewBin iov[4].base = &ProcBin2 iov[4].len = size(ProcBin2) binv[4] = ProcBin2 To summarize. You can not assume how the vector will look like. The idea is that the runtime system will try to "help" you do zero copy on "large" binaries. /Tony On 9 dec 2009, at 19.58, Matthew Sackman wrote: > Hi, > > So I'm writing a port driver for a linked in binary. I've implemented > outputv, and that seems to be working fine. > > In order to see what I'm being sent, I have the following in C: > > void dump_ev(ErlIOVec *ev) { > printf("total size: %d\r\nvec len: %d\r\n", ev->size, ev->vsize); > int idx; > for (idx = 0; idx < ev->vsize; ++idx) { > printf("iov[%d] = ", idx); > SysIOVec iov = ev->iov[idx]; > printf("[base = %p, len = %zd]\r\n", iov.iov_base, iov.iov_len); > printf("binv[%d] = ", idx); > if (NULL == ev->binv[idx]) { > printf("NULL\r\n"); > } else { > ErlDrvBinary* bin = ev->binv[idx]; > printf("[orig_bytes = %p; orig_size = %zd]\r\n", bin->orig_bytes, bin->orig_size); > } > } > printf("done\r\n"); > } > > which is called at the start of outputv: > > static void test_outputv(ErlDrvData drv_data, ErlIOVec *ev) > { > dump_ev(ev); > ... > } > > Now, in the shell, I do the following: > > 1> ok = erl_ddll:load_driver("ebin", "libtest"), Port = open_port({spawn_driver, libtest}, [binary]). > 2> port_command(Port, [<<2>>,<<0,0,0,0,0,0,0,0>>,<<0>>,<<0>>,<<0>>]). > > And I get out the following: > > total size: 12 > vec len: 6 > iov[0] = [base = (nil), len = 0] > binv[0] = NULL > iov[1] = [base = 0x17a89b0, len = 1] > binv[1] = [orig_bytes = 0x17a89b0; orig_size = 1] > iov[2] = [base = 0x17a89e8, len = 8] > binv[2] = [orig_bytes = 0x17a89e8; orig_size = 8] > iov[3] = [base = 0x17a8a20, len = 1] > binv[3] = [orig_bytes = 0x17a8a20; orig_size = 1] > iov[4] = [base = 0x17a8a58, len = 1] > binv[4] = [orig_bytes = 0x17a8a58; orig_size = 1] > iov[5] = [base = 0x17a8a90, len = 1] > binv[5] = [orig_bytes = 0x17a8a90; orig_size = 1] > done > > Which makes a lot of sense - each arg corresponds to an entry in the iov > and binv. That's all fine. > > Now, in some erlang code (a gen_server) I have this: > > init([]) -> > erl_ddll:start(), > ok = erl_ddll:load_driver("ebin", ?LIBNAME), > Port = open_port({spawn_driver, ?LIBNAME}, [binary, stream]), > {ok, Port}. > > handle_call({tune, BNum, APow, FPow, Opts}, _From, Port) -> > Data = [<<2/native>>, > <>, > <>, > <>, > <>], > port_command(Port, Data), > ... > > Then in the shell I do this: > > 1> {ok, Pid} = test_drv:start_link(), gen_server:call(Pid, {tune, 0, 0, 0, 0}). > > and I get out: > > total size: 12 > vec len: 2 > iov[0] = [base = (nil), len = 0] > binv[0] = NULL > iov[1] = [base = 0x1faded0, len = 12] > binv[1] = [orig_bytes = 0x1faded0; orig_size = 12] > done > > Why on earth has it gone and pushed all those binaries into one big > binary? What on earth is the actual behaviour meant to be? Where is it > defined? How can I reliably pull args out of the iov and binv? Certainly > the behaviour is different to that in > http://www.erlang.org/pipermail/erlang-questions/2006-March/019818.html > > In short, WTF?! > > Matthew > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From erlang@REDACTED Thu Dec 10 11:21:18 2009 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 10 Dec 2009 11:21:18 +0100 Subject: web sockets almost working .... Message-ID: <9b08084c0912100221s647256e9q671935fd12defb67@mail.gmail.com> Very exciting - web sockets is partially working - this is very very very exciting But I can't get past the handshake ... This posting http://blog.chromium.org/2009/12/web-sockets-now-available-in-google.html Got me pretty excited - I happen to have the latest chrome browser as so a little test was in order ... The handshake is described in http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-55#page-22 So I set up a local web server on port 2246 that serves up this page Then I have a server on port 1234 using this code -module(local_server). -compile(export_all). start() -> {ok, Listen} = gen_tcp:listen(1234, [{packet,0}, {reuseaddr,true}, {active, true}]), spawn(fun() -> par_connect(Listen) end). par_connect(Listen) -> {ok, Socket} = gen_tcp:accept(Listen), spawn(fun() -> par_connect(Listen) end), wait(Socket). wait(Socket) -> receive {tcp, Socket, Data} -> io:format("received:~p~n",[Data]), Msg = prefix() ++ "WebSocket-Origin: http://localhost:2246\r\n" ++ "WebSocket-Location: ws://localhost:1234\r\n\r\n", gen_tcp:send(Socket, Msg), loop(Socket); Any -> io:format("Received:~p~n",[Any]), wait(Socket) end. prefix() -> "HTTP/1.1 101 Web Socket Protocol Handshake\r\nUpgrade: WebSocket\r\nConnection: Upgrade\r\n". loop(Socket) -> receive {tcp, Socket, Data} -> io:format("received:~p~n",[Data]), loop(Socket); Any -> io:format("Received:~p~n",[Any]), loop(Socket) end. It's beginning to work but now the handshake fails. Very exciting stuff. Be the first to get this working and tell us how /Joe From bgustavsson@REDACTED Thu Dec 10 11:37:02 2009 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Thu, 10 Dec 2009 11:37:02 +0100 Subject: [erlang-questions] Port Driver, outputv, binaries. In-Reply-To: <534ABD4C-848D-41EE-80E9-B47A24EB91A1@rogvall.se> References: <20091209185851.GG2659@mrnibble.lshift.net> <534ABD4C-848D-41EE-80E9-B47A24EB91A1@rogvall.se> Message-ID: <6672d0160912100237t11ee7515m236e5a63661fe397@mail.gmail.com> On Thu, Dec 10, 2009 at 11:12 AM, Tony Rogvall wrote: > ? ? ? ?This type of binary is constructed when data is less than 64 bytes (may be changed!) Yes, it may theoretically be changed, but we have no plans to do so because we have no good reason to change it and it would break code that depends on the value. > The shell actually constructed a SubBin pointing to a > ProcBin maybe some one at the OTP team knows why!? Yes. :-) The reason is that the eval_bits module that the shell uses to evaluate binary syntax expressions appends to a binary, and appending to a binary always force a reference-counted binary to be created. The different kind of binaries are described in the Efficiency Guide: http://www.erlang.org/doc/efficiency_guide/binaryhandling.html -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From kiran.khaladkar@REDACTED Thu Dec 10 12:06:40 2009 From: kiran.khaladkar@REDACTED (Kiran Khaladkar) Date: Thu, 10 Dec 2009 16:36:40 +0530 Subject: Preventing calling some functions Message-ID: <4B20D640.3030902@geodesic.com> hi, I have a server written in which i allow erlang plugins also. But the problem is i dont want the plugin code the call certain functions such as 'gen_tcp:listen' etc .. The plugin writer should not be able to call certain functions thought he might know all the erlang lib. Can anyone suggest a way to do such a thing?? regards, From peppe@REDACTED Thu Dec 10 11:38:04 2009 From: peppe@REDACTED (Peter Andersson) Date: Thu, 10 Dec 2009 11:38:04 +0100 Subject: [erlang-questions] common_test Automatic Naming In-Reply-To: References: <4B1FB3C5.5070104@erix.ericsson.se> Message-ID: <4B20CF8C.3040602@erix.ericsson.se> Thanks a lot for the input! I'll take your suggestions into consideration and put it on the Common Test to-do-list. /Peter Jayson Vantuyl wrote: > Options, in order of my preference, would be: > > 1. Options 3, 4, and 6. > 2. Options 3 and 4. > 3. An option in the module itself. Perhaps in a comment, a.l.a edoc. This could end up being used by edoc for indexes as well, so maybe it would be best to ask whoever is responsible for that if they care. > 4. Change it so that if the top-level-dir is lib, it will try the next directory up. This is more "hopeful heuristics", but I don't think it would be bad. It seems like "lib" can't ever be what somebody wants, right? :/ > 5. Don't try to be smart about the top-level-dir at all. Backwards incompatible, but I'd be willing to be nobody cares. > 6. A pluggable function, switchable with an option to run_test. > > On Dec 9, 2009, at 6:27 AM, Peter Andersson wrote: > > > > > The thought behind the naming scheme is that the directory on the level > > above the test object directory is one that might represent a group of > > test objects (not necessarily OTP applications under lib), and for that > > reason is useful to include in the test name (i.e. it's included in the > > name because it *could* be useful info, not because it's necessary). > > Test names are described in the User's Guide (6.9 Log files), but it's > > not explained there *why* "TopLevelDir" is part of the name (noted). > > Maybe we could make it possible to configure the naming scheme in some > > practical way, or at least make it optional to exclude the top level > > directory in the test name. Or? What kind of override mechanism would > > you prefer to see in a future version of Comon Test? > > > > /Peter > > > > Ericsson AB, Erlang/OTP > > > > Jayson Vantuyl wrote: > >> So, when I let common_test generate its HTML output, I get these names for my modules. > >> > >> I've got them in an Erlang-style libdir. So module foo comes out as lib.foo and has its tests at lib/foo-X.Y.Z/test/something_SUITE.erl. > >> > >> After doing some detective work, I determined that the name is generated by ct_run:get_name/1. I see that it appears to take the two directory names above the test directory as the name of the suite. What is the rationale behind this naming? Is there somewhere else I should put my tests? Is it ever going to be possible to override this naming scheme? > >> > >> Thanks, > > From matthew@REDACTED Thu Dec 10 12:20:07 2009 From: matthew@REDACTED (Matthew Sackman) Date: Thu, 10 Dec 2009 11:20:07 +0000 Subject: [erlang-questions] Port Driver, outputv, binaries. In-Reply-To: <534ABD4C-848D-41EE-80E9-B47A24EB91A1@rogvall.se> References: <20091209185851.GG2659@mrnibble.lshift.net> <534ABD4C-848D-41EE-80E9-B47A24EB91A1@rogvall.se> Message-ID: <20091210112007.GA30835@mrnibble.lshift.net> Hi Tony, Thank you very much for your email - that's very helpful. I have one further question: If I construct and send a binary with port_command, can I be guaranteed that it'll not be split across two or more different binvs? Eg a) port_command(Port, [<<1,2,3>>]), or b) port_command(Port, [<<"foo">>]), or c) port_command(Port, [<<"foo",0>>]), or c) is particularly important to me because I've noticed that if you send a string down, it doesn't get null terminated, so sticking the extra 0 on the end is very important. It would be somewhat horrendous if that 0 could end up in a different binv entry from the "foo". How about: d) D = <<1>>, port_command(Port, [<>/binary, <<"wibble">>/binary>>]) Is it safe to rely a binary being an atomic unit? Matthew From matthew@REDACTED Thu Dec 10 12:23:53 2009 From: matthew@REDACTED (Matthew Sackman) Date: Thu, 10 Dec 2009 11:23:53 +0000 Subject: [erlang-questions] Port Driver, outputv, binaries. In-Reply-To: <20091209234031.GA56014@h216-235-12-172.host.egate.net> References: <20091209185851.GG2659@mrnibble.lshift.net> <20091209234031.GA56014@h216-235-12-172.host.egate.net> Message-ID: <20091210112353.GB30835@mrnibble.lshift.net> Vance, On Wed, Dec 09, 2009 at 06:40:35PM -0500, Vance Shipley wrote: > You'll find this thread helpful: > > http://www.erlang.org/pipermail/erlang-questions/2002-October/005858.html You wouldn't believe the amount of time I've spent googling without coming across this thread. Many thanks, Matthew From jilani@REDACTED Thu Dec 10 12:28:24 2009 From: jilani@REDACTED (Jilani Khaldi) Date: Thu, 10 Dec 2009 12:28:24 +0100 Subject: [erlang-questions] Announce: elib1 In-Reply-To: <9b08084c0912100148l50ea519fn516319659132617e@mail.gmail.com> References: <9b08084c0912091212n3aba6ff9if128b1388e631975@mail.gmail.com> <4B20C379.10408@cheapnet.it> <9b08084c0912100148l50ea519fn516319659132617e@mail.gmail.com> Message-ID: <4B20DB58.8000909@cheapnet.it> Joe Armstrong wrote: > On Thu, Dec 10, 2009 at 10:46 AM, Jilani Khaldi wrote: >>> mysql native interface >> Why not Postgres or Firebird RDBMS? They are a lot better than MySQL, even >> regarding licence. > > Life is too short ... For Postgres the driver has already been written. http://github.com/noss/pgsql/tree > Feel free to contribute the appropriate code If you are instead interested in Firebird (www.ibphoenix.com), I will contribute to write the driver. JiK -- Jilani KHALDI --------------------- http://www.iiiaugusta.com From antoine.koener@REDACTED Thu Dec 10 13:13:30 2009 From: antoine.koener@REDACTED (Antoine Koener) Date: Thu, 10 Dec 2009 13:13:30 +0100 Subject: [erlang-questions] web sockets almost working .... In-Reply-To: <9b08084c0912100221s647256e9q671935fd12defb67@mail.gmail.com> References: <9b08084c0912100221s647256e9q671935fd12defb67@mail.gmail.com> Message-ID: <1c89b3a10912100413t34d1c791l555f58bc76e2decd@mail.gmail.com> Hi Joe, io:format("received:~p~n",[Data]), > Msg = prefix() ++ > "WebSocket-Origin: http://localhost:2246\r\n" ++ > "WebSocket-Location: ws://localhost:1234\r\n\r\n", > gen_tcp:send(Socket, Msg), > > May be use a full URL instead of "WebSocket-Location: ws://localhost:1234\r\n\r\n", i.e. "WebSocket-Location: ws://localhost:1234/path/to/your/script\r\n\r\n", ? I can't test at the moment my christmas cents... From antoine.koener@REDACTED Thu Dec 10 13:20:37 2009 From: antoine.koener@REDACTED (Antoine Koener) Date: Thu, 10 Dec 2009 13:20:37 +0100 Subject: [erlang-questions] Announce: elib1 In-Reply-To: <4B20DB58.8000909@cheapnet.it> References: <9b08084c0912091212n3aba6ff9if128b1388e631975@mail.gmail.com> <4B20C379.10408@cheapnet.it> <9b08084c0912100148l50ea519fn516319659132617e@mail.gmail.com> <4B20DB58.8000909@cheapnet.it> Message-ID: <1c89b3a10912100420h1b76b8f3xc67d3711c830905@mail.gmail.com> On Thu, Dec 10, 2009 at 12:28 PM, Jilani Khaldi wrote: > Joe Armstrong wrote: > >> On Thu, Dec 10, 2009 at 10:46 AM, Jilani Khaldi >> wrote: >> >>> mysql native interface >>>> >>> Why not Postgres or Firebird RDBMS? They are a lot better than MySQL, >>> even >>> regarding licence. >>> >> >> Life is too short ... >> > For Postgres the driver has already been written. > http://github.com/noss/pgsql/tree > > It would be nice to have some drivers that conforms with OTP. For mysql it exists: http://code.google.com/p/erlang-mysql-driver/ for example. From colm.dougan@REDACTED Thu Dec 10 13:34:17 2009 From: colm.dougan@REDACTED (Colm Dougan) Date: Thu, 10 Dec 2009 12:34:17 +0000 Subject: [erlang-questions] web sockets almost working .... In-Reply-To: <9b08084c0912100221s647256e9q671935fd12defb67@mail.gmail.com> References: <9b08084c0912100221s647256e9q671935fd12defb67@mail.gmail.com> Message-ID: <24d4f39c0912100434s7b774cdex8d41fe4b811beeec@mail.gmail.com> Joe, On Thu, Dec 10, 2009 at 10:21 AM, Joe Armstrong wrote: > Very exciting - web sockets is partially working - this is very very > very exciting > > But I can't get past the handshake ... It appears to make a difference if you add a trailing slash after WebSocket-Location, i.e. : "WebSocket-Location: ws://localhost:1234/\r\n\r\n", Now I get : Eshell V5.7.4 (abort with ^G) 1> local_server:start(). <0.33.0> 2> received:"GET / HTTP/1.1\r\nUpgrade: WebSocket\r\nConnection: Upgrade\r\nHost: localhost:1234\r\nOrigin: http://localhost:2246\r\n\r\n" 2> received:[0,104,101,108,108,111,32,102,114,111,109,32,116,104,101,32,98,114, 111,119,115,101,114,255] Colm From erlang@REDACTED Thu Dec 10 13:56:28 2009 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 10 Dec 2009 13:56:28 +0100 Subject: [erlang-questions] web sockets almost working .... In-Reply-To: <24d4f39c0912100434s7b774cdex8d41fe4b811beeec@mail.gmail.com> References: <9b08084c0912100221s647256e9q671935fd12defb67@mail.gmail.com> <24d4f39c0912100434s7b774cdex8d41fe4b811beeec@mail.gmail.com> Message-ID: <9b08084c0912100456m5bc0e9b5lfd5bd732930fb53f@mail.gmail.com> Thanks now it works beautifully, I've enclosed listings below. First reflection - this is amazing - the overhead is tiny and there is no parsing headers etc. The erlang just had to send [0] ... bytes .. [255] and it ended up in the browser. This will kill Ajax, keep-alive connections etc, now all google has to do is ship the parse trees of HTML pages instead of *text* and browsers can skip parsing and concentrate on rendering and stuff will go fast ... Now somebody just has to be the first to implement http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-65 in Erlang /Joe The web page is now: And the erlang is: -module(local_server). -compile(export_all). start() -> {ok, Listen} = gen_tcp:listen(1234, [{packet,0}, {reuseaddr,true}, {active, true}]), spawn(fun() -> par_connect(Listen) end). par_connect(Listen) -> {ok, Socket} = gen_tcp:accept(Listen), spawn(fun() -> par_connect(Listen) end), wait(Socket). wait(Socket) -> receive {tcp, Socket, Data} -> io:format("received:~p~n",[Data]), Msg = prefix() ++ "WebSocket-Origin: http://localhost:2246\r\n" ++ "WebSocket-Location: ws://localhost:1234/\r\n\r\n", gen_tcp:send(Socket, Msg), loop(Socket); Any -> io:format("Received:~p~n",[Any]), wait(Socket) end. prefix() -> "HTTP/1.1 101 Web Socket Protocol Handshake\r\nUpgrade: WebSocket\r\nConnection: Upgrade\r\n". loop(Socket) -> receive {tcp, Socket, Data} -> Data1 = unframe(Data), io:format("received:~p~n",[Data1]), gen_tcp:send(Socket, [0] ++ "hello from erlang" ++ [255]), loop(Socket); Any -> io:format("Received:~p~n",[Any]), loop(Socket) end. unframe([0|T]) -> unframe1(T). unframe1([255]) -> []; unframe1([H|T]) -> [H|unframe1(T)]. On Thu, Dec 10, 2009 at 1:34 PM, Colm Dougan wrote: > Joe, > > On Thu, Dec 10, 2009 at 10:21 AM, Joe Armstrong wrote: >> Very exciting - web sockets is partially working - this is very very >> very exciting >> >> But I can't get past the handshake ... > > It appears to make a difference if you add a trailing slash after > WebSocket-Location, i.e. : > > ? "WebSocket-Location: ws://localhost:1234/\r\n\r\n", > > Now I get : > > Eshell V5.7.4 ?(abort with ^G) > 1> local_server:start(). > <0.33.0> > 2> received:"GET / HTTP/1.1\r\nUpgrade: WebSocket\r\nConnection: > Upgrade\r\nHost: localhost:1234\r\nOrigin: > http://localhost:2246\r\n\r\n" > 2> received:[0,104,101,108,108,111,32,102,114,111,109,32,116,104,101,32,98,114, > ? ? ? ? ?111,119,115,101,114,255] > > Colm > From johann.hoechtl@REDACTED Thu Dec 10 14:21:58 2009 From: johann.hoechtl@REDACTED (=?ISO-8859-1?Q?Johann_H=F6chtl?=) Date: Thu, 10 Dec 2009 05:21:58 -0800 (PST) Subject: web sockets almost working .... In-Reply-To: <9b08084c0912100456m5bc0e9b5lfd5bd732930fb53f@mail.gmail.com> References: <9b08084c0912100221s647256e9q671935fd12defb67@mail.gmail.com> <24d4f39c0912100434s7b774cdex8d41fe4b811beeec@mail.gmail.com> <9b08084c0912100456m5bc0e9b5lfd5bd732930fb53f@mail.gmail.com> Message-ID: On Dec 10, 1:56?pm, Joe Armstrong wrote: > Thanks now it works beautifully, I've enclosed listings below. > > First reflection - this is amazing - the overhead is tiny and there is > no parsing > headers etc. The erlang just had to send > > [0] ... bytes .. [255] and it ended up in the browser. > > This will kill Ajax, keep-alive connections etc, now all google has to > do is ship > the parse trees of HTML pages instead of *text* and browsers can skip parsing > and concentrate on rendering and stuff will go fast ... > This is incredibly awsome! I am sure this will inevitably change the way we think about the web, clouds, the whole client-server architecture in general within a short timespan. Johann From v@REDACTED Thu Dec 10 14:31:16 2009 From: v@REDACTED (Valentin Micic) Date: Thu, 10 Dec 2009 15:31:16 +0200 Subject: FW: [erlang-questions] Mnesia could not write core file: system_limit Message-ID: <20091210133131.B8CC63D0D60@mail.pharos-avantgard.com> -----Original Message----- From: Valentin Micic [mailto:v@REDACTED] Sent: 10 December 2009 03:06 PM To: 'Evans, Matthew' Subject: RE: [erlang-questions] Mnesia could not write core file: system_limit Process leaks? Never heard of it ;-) There is a very simple way to establish how many file descriptors are used. Assuming that FD = port(), one should be able to establish this by simply calling: length( erlang:ports() ). Not that all ports are created equal, but this figure would roughly correspond to a number of file descriptors (e.g. open files and sockets) in use. You may increase a number of file descriptors available to a particular OS user, hence elrang run-time (VM); however, you would still be required to ensure that Erlang emulator has access to them by setting ERL_MAX_PORTS environment variable to appropriate value. V/ -----Original Message----- From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] On Behalf Of Evans, Matthew Sent: 10 December 2009 01:10 AM To: Bernard Duggan; Slobodan Miskovic Cc: Erlang-Questions Questions Subject: RE: [erlang-questions] Mnesia could not write core file: system_limit To handle process leaks (especially if you are using a gen_server / gen_fsm behaviour) I normally return a timeout from my handle_call, handle_info, handle_cast etc. functions. I have the time the process started and the time of the last event in my State record, and then have logic in the handle_info(timeout,State) function to cause the process to "self destruct" if it thinks it's been around too long. There is a small performance overhead of starting a timer in your process, but it does trap these sort of problems. Regards Matt ________________________________________ From: erlang-questions@REDACTED [erlang-questions@REDACTED] On Behalf Of Bernard Duggan [bernie@REDACTED] Sent: Wednesday, December 09, 2009 6:00 PM To: Slobodan Miskovic Cc: Erlang-Questions Questions Subject: Re: [erlang-questions] Mnesia could not write core file: system_limit Slobodan Miskovic wrote: > Heh, thinking outside of the (VM) box - guess there is no query-able > interface in Erlang for this? Linux is then indeed simple enough: > {ok, FDList} = file:list_dir("/proc/self/fd"), > length(FDList) > Huh - never noticed the 'self' symlink - that's really handy :) As far as I know there's no specific interface in Erlang for this - I'd expect it to either be in maybe os: or erlang:, but I can't see anything there. > What about other platforms, ie. Windows? > Sorry, I can't help you there. > Would lsof (or similar mechanism) be preferable as I would get a list of > open sockets and network connections which as I understand all > contribute to the max open ports limit. Would I get all those in > the /proc/.../fd list as well? > /proc/self/fd should include all file descriptors that contribute to the process's limit - pipes, sockets, files etc. It's what we use for monitoring exactly this issue on some of our C++ code. > Hm, I have embedded Yaws running, and occasionally processes terminate > when invalid requests comes in. I would have thought those would have > been really dead. I'll have to keep an eye on the running system to see > if number of processes is rising. > Proces leaks are the memory leaks of Erlang - they're relatively easy to accidentally code if you're not careful. If you're running a long-running server app I'd suggest looking at providing an SNMP monitoring system to keep an eye on this kind of thing - Erlang's built-in SNMP stuff is a pain in the backside to initially set up, but once you've got it going it's trivial to add a lot of really informative information. Cheers, B ________________________________________________________________ erlang-questions mailing list. See http://www.erlang.org/faq.html erlang-questions (at) erlang.org ________________________________________________________________ erlang-questions mailing list. See http://www.erlang.org/faq.html erlang-questions (at) erlang.org From erlang@REDACTED Thu Dec 10 14:32:23 2009 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 10 Dec 2009 14:32:23 +0100 Subject: [erlang-questions] web sockets almost working .... In-Reply-To: <3A4E08D0-6213-4D56-9F8B-DB670F0C9399@souja.net> References: <9b08084c0912100221s647256e9q671935fd12defb67@mail.gmail.com> <24d4f39c0912100434s7b774cdex8d41fe4b811beeec@mail.gmail.com> <9b08084c0912100456m5bc0e9b5lfd5bd732930fb53f@mail.gmail.com> <3A4E08D0-6213-4D56-9F8B-DB670F0C9399@souja.net> Message-ID: <9b08084c0912100532r1b557ff8ide15e509f2484e75@mail.gmail.com> On Thu, Dec 10, 2009 at 2:19 PM, Jayson Vantuyl wrote: > I don't know if I'd call that an AJAX killer just yet. ?Particularly, until IE has a usable implementation. But I think it will kill ajax and comet and all that crap. Ajax is painful if you only want to send very small amounts of data, you still have to spend all your time parsing the http headers. Comet and long-poll etc will die since they are totally unecessary. What I hope will happen that Google will pre-empt some action in firefox and this will push Microsoft into action - I can't understand why this has taken so long after all it's merely a question of *removing* code from the browser and giving access to the low-level socket interface. It will make applications symmetric - anything that involved pushing data to the client was tricky hence the horrific workarounds that comet and long-poll involved - now things like chat in the browser become symmetric push/pull applications. About time say I - I've waited years for this. /Joe > > Also, I find this to be a really odd spec, because the "bytes" part is not "bytes", but it's supposed to be UTF-8. ?It seems odd to use binary framing around UTF-8 with something that looks like a web connection and runs over the same ports as HTTP. ?It looks to me like AJAX isn't dying, but rather HTTP. ?After all, I can't imagine why they would pick UTF-8 unless they wanted to encode header-style data or, surprise, XML! ?Even the framing is unfriendly to full, binary protocols. > > I, personally, would have preferred an actual framed, byte-level protocol over HTTP-lite. ?:( Yup - they could have sent a variable length header, containing the length length (N) followed by N bytes - but that would be too easy ... > > On Dec 10, 2009, at 4:56 AM, Joe Armstrong wrote: > >> Thanks now it works beautifully, I've enclosed listings below. >> >> First reflection - this is amazing - the overhead is tiny and there is >> no parsing >> headers etc. The erlang just had to send >> >> [0] ... bytes .. [255] and it ended up in the browser. >> >> This will kill Ajax, keep-alive connections etc, now all google has to >> do is ship >> the parse trees of HTML pages instead of *text* and browsers can skip parsing >> and concentrate on rendering and stuff will go fast ... >> >> Now somebody just has to be the first to implement >> http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-65 >> in Erlang >> >> /Joe >> >> The web page is now: >> >> >> >> ? >> >> >> And the erlang is: >> >> -module(local_server). >> -compile(export_all). >> >> start() -> >> ? ?{ok, Listen} = gen_tcp:listen(1234, [{packet,0}, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?{reuseaddr,true}, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?{active, true}]), >> ? ?spawn(fun() -> par_connect(Listen) end). >> >> par_connect(Listen) -> >> ? ?{ok, Socket} = gen_tcp:accept(Listen), >> ? ?spawn(fun() -> par_connect(Listen) end), >> ? ?wait(Socket). >> >> wait(Socket) -> >> ? ?receive >> ? ? ? {tcp, Socket, Data} -> >> ? ? ? ? ? io:format("received:~p~n",[Data]), >> ? ? ? ? ? Msg = prefix() ++ >> ? ? ? ? ? ? ? "WebSocket-Origin: http://localhost:2246\r\n" ++ >> ? ? ? ? ? ? ? "WebSocket-Location: ws://localhost:1234/\r\n\r\n", >> ? ? ? ? ? gen_tcp:send(Socket, Msg), >> ? ? ? ? ? loop(Socket); >> ? ? ? Any -> >> ? ? ? ? ? io:format("Received:~p~n",[Any]), >> ? ? ? ? ? wait(Socket) >> ? ?end. >> >> prefix() -> >> ? ?"HTTP/1.1 101 Web Socket Protocol Handshake\r\nUpgrade: >> WebSocket\r\nConnection: Upgrade\r\n". >> >> loop(Socket) -> >> ? ?receive >> ? ? ? {tcp, Socket, Data} -> >> ? ? ? ? ? Data1 = unframe(Data), >> ? ? ? ? ? io:format("received:~p~n",[Data1]), >> ? ? ? ? ? gen_tcp:send(Socket, [0] ++ "hello from erlang" ++ [255]), >> ? ? ? ? ? loop(Socket); >> ? ? ? Any -> >> ? ? ? ? ? io:format("Received:~p~n",[Any]), >> ? ? ? ? ? loop(Socket) >> ? ?end. >> >> unframe([0|T]) -> unframe1(T). >> >> unframe1([255]) -> []; >> unframe1([H|T]) -> [H|unframe1(T)]. >> >> >> >> >> On Thu, Dec 10, 2009 at 1:34 PM, Colm Dougan wrote: >>> Joe, >>> >>> On Thu, Dec 10, 2009 at 10:21 AM, Joe Armstrong wrote: >>>> Very exciting - web sockets is partially working - this is very very >>>> very exciting >>>> >>>> But I can't get past the handshake ... >>> >>> It appears to make a difference if you add a trailing slash after >>> WebSocket-Location, i.e. : >>> >>> ? "WebSocket-Location: ws://localhost:1234/\r\n\r\n", >>> >>> Now I get : >>> >>> Eshell V5.7.4 ?(abort with ^G) >>> 1> local_server:start(). >>> <0.33.0> >>> 2> received:"GET / HTTP/1.1\r\nUpgrade: WebSocket\r\nConnection: >>> Upgrade\r\nHost: localhost:1234\r\nOrigin: >>> http://localhost:2246\r\n\r\n" >>> 2> received:[0,104,101,108,108,111,32,102,114,111,109,32,116,104,101,32,98,114, >>> ? ? ? ? ?111,119,115,101,114,255] >>> >>> Colm >>> >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> > > > > -- > Jayson Vantuyl > kagato@REDACTED > > > > > > From max.lapshin@REDACTED Thu Dec 10 14:42:11 2009 From: max.lapshin@REDACTED (Max Lapshin) Date: Thu, 10 Dec 2009 16:42:11 +0300 Subject: [erlang-questions] web sockets almost working .... In-Reply-To: <9b08084c0912100532r1b557ff8ide15e509f2484e75@mail.gmail.com> References: <9b08084c0912100221s647256e9q671935fd12defb67@mail.gmail.com> <24d4f39c0912100434s7b774cdex8d41fe4b811beeec@mail.gmail.com> <9b08084c0912100456m5bc0e9b5lfd5bd732930fb53f@mail.gmail.com> <3A4E08D0-6213-4D56-9F8B-DB670F0C9399@souja.net> <9b08084c0912100532r1b557ff8ide15e509f2484e75@mail.gmail.com> Message-ID: I don't think, that this technology will kill anything because of many problems with routers, proxy servers, antiviruses. Do you know, how antivirus handle endless HTTP stream? It waits request end, save to disk and check there. This is why endless-http is dead. We are using RTMP in our production. It is a statefull binary protocol. It is 100% unreliable, because lots of corporate proxies don't allow it. And these proxies will not allow websockets. From johann.hoechtl@REDACTED Thu Dec 10 14:49:34 2009 From: johann.hoechtl@REDACTED (=?ISO-8859-1?Q?Johann_H=F6chtl?=) Date: Thu, 10 Dec 2009 05:49:34 -0800 (PST) Subject: Announce: elib1 In-Reply-To: <14f0e3620912100203t44b0dfc1pd0898e2b3d310a8a@mail.gmail.com> References: <9b08084c0912091212n3aba6ff9if128b1388e631975@mail.gmail.com> <14f0e3620912100203t44b0dfc1pd0898e2b3d310a8a@mail.gmail.com> Message-ID: On Dec 10, 11:03?am, Gleb Peregud wrote: > Why not create general rules, specifications, unified structure and > build system for these libraries, use package manager (e.g. epm [1]) > and let everyone contribute under the umbrella of one main project? > I would very much second this. Having an agreed common denominator how a project is set up, is one of the strenghts of Haskell and cabal. Maybe hierarchical modules would be a win too. > I.e. there's a elib1 project, which is a set of core libraries, and > other libraries would be dependencies of it. If someone is willing to > become the part of the whole maintainer of the meta project checks if > it conforms to the rules. If it does then he adds this subproject as a > dependency to elib1. > > 1:http://github.com/JacobVorreuter/epm > > ________________________________________________________________ > erlang-questions mailing list. Seehttp://www.erlang.org/faq.html > erlang-questions (at) erlang.org From bgustavsson@REDACTED Thu Dec 10 15:18:36 2009 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Thu, 10 Dec 2009 15:18:36 +0100 Subject: Change in the on_load mechanism Message-ID: <6672d0160912100618t66fe8e21pbfedf3de1990c29e@mail.gmail.com> I have now changed the expected return value for an on_load function as described here: http://github.com/erlang/otp/commit/7390bb7c178f3bed10283ef15065cea3bdc11090 Compared to my suggestion in another discussion thread, there is a slight change. There will be a message sent to the error_logger if anything else than an atom is returned. That way, exceptions will always cause an error_logger message. By explicitly returning an atom (other than 'ok'), you can silently prevent the module from loading. You can try out the new on_load mechanism by building from the 'pu' branch (which will also include Sverker's update of the NIFs). If you have any comments or suggestions regarding this change, please send them as soon as possible. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From tony@REDACTED Thu Dec 10 14:30:12 2009 From: tony@REDACTED (Tony Rogvall) Date: Thu, 10 Dec 2009 14:30:12 +0100 Subject: [erlang-questions] Port Driver, outputv, binaries. In-Reply-To: <20091210112007.GA30835@mrnibble.lshift.net> References: <20091209185851.GG2659@mrnibble.lshift.net> <534ABD4C-848D-41EE-80E9-B47A24EB91A1@rogvall.se> <20091210112007.GA30835@mrnibble.lshift.net> Message-ID: Hi! On 10 dec 2009, at 12.20, Matthew Sackman wrote: > Hi Tony, > > Thank you very much for your email - that's very helpful. > > I have one further question: > > If I construct and send a binary with port_command, can I be guaranteed > that it'll not be split across two or more different binvs? > My guess is that you could probably assume that a single binary will not be split up. But how knows ;-) > Eg > > a) port_command(Port, [<<1,2,3>>]), or > b) port_command(Port, [<<"foo">>]), or > c) port_command(Port, [<<"foo",0>>]), or > > c) is particularly important to me because I've noticed that if you send > a string down, it doesn't get null terminated, so sticking the extra 0 > on the end is very important. It would be somewhat horrendous if that 0 > could end up in a different binv entry from the "foo". > The part with adding cstring zero termination sounds a bit error prone and dangerous. I would suggest a length byte (bytes) and checking and use an API where you pass length instead. (strncpy/memcpy instead of strcpy etc) > How about: > > d) D = <<1>>, port_command(Port, [<>/binary, <<"wibble">>/binary>>]) > > Is it safe to rely a binary being an atomic unit? > If you mean that the binary parts are not split? then yes. But as you know the binaries may be ProcBin or HeapBin (you do not really know) /Tony > From the.ajarn@REDACTED Thu Dec 10 15:41:58 2009 From: the.ajarn@REDACTED (Brentley Jones) Date: Thu, 10 Dec 2009 08:41:58 -0600 Subject: [erlang-questions] Preventing calling some functions In-Reply-To: <4B20D640.3030902@geodesic.com> References: <4B20D640.3030902@geodesic.com> Message-ID: On Dec 10, 2009, at 5:06 AM, Kiran Khaladkar wrote: > hi, > I have a server written in which i allow erlang plugins also. But the problem is i dont want the plugin code the call certain functions such as 'gen_tcp:listen' etc .. The plugin writer should not be able to call certain functions thought he might know all the erlang lib. > Can anyone suggest a way to do such a thing?? > regards, > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > Now, don't take what I say as definitive, since I'm still sort of new to Erlang myself, but I don't think that what you are asking is currently possible. I myself was asking the same question just a couple says ago [1], with the same intent as you (I want to have plugins/scripts that are sandboxed). One solution would be the implementation of reified environments [2]. I personally believe that their implementation would allow for a much safer Erlang, allowing for the possibility of sandboxed environments that know only about modules that you want it to know about. For example, the plugins could be exposed only to your custom modules plus a few BIFs, if you so wanted. Maybe someone knows something that I don't though. - Brentley Jones [1] http://groups.google.com/group/erlang-programming/browse_frm/thread/e0b6a4b60ce03469/b07ec46a989bcd9c [2] http://www.erlang.org/pipermail/erlang-questions/2006-November/023879.html From schramm.ingo@REDACTED Thu Dec 10 16:14:13 2009 From: schramm.ingo@REDACTED (ingo.schramm) Date: Thu, 10 Dec 2009 07:14:13 -0800 (PST) Subject: web sockets almost working .... In-Reply-To: References: <9b08084c0912100221s647256e9q671935fd12defb67@mail.gmail.com> <24d4f39c0912100434s7b774cdex8d41fe4b811beeec@mail.gmail.com> <9b08084c0912100456m5bc0e9b5lfd5bd732930fb53f@mail.gmail.com> <3A4E08D0-6213-4D56-9F8B-DB670F0C9399@souja.net> <9b08084c0912100532r1b557ff8ide15e509f2484e75@mail.gmail.com> Message-ID: Is somebody already doing web sockets in Erlang? I just read the specs today and thought it could be a good practice to learn more about Erlang during the last weeks of the year. But I'm doing Erlang for just a few months now and there might be some senior doing stuff like this in a day. Ingo From tanmaykm@REDACTED Thu Dec 10 16:31:56 2009 From: tanmaykm@REDACTED (Tanmay K. Mohapatra) Date: Thu, 10 Dec 2009 21:01:56 +0530 Subject: [erlang-questions] ODBC error after SQL_NO_DATA_FOUND In-Reply-To: References: <1cefc2f9-6a7d-49d0-8ce0-d98de33c78c6@o9g2000prg.googlegroups.com> Message-ID: <785f88f70912100731i389b7435s6a83d4b23954c6e5@mail.gmail.com> Hi Paul, Thanks for the pointers. I have attached a couple of new patches, one one R13B03 and the other over commit f3b6a575fceb957805c3b8d8af796a749cbad61c. I'm new here and don't understand the code fully yet. Though my particular case is behaving fine now, I'm not sure if I have fixed/tested all conditions. I had to revert back a change done in get_diagnos where the loop should break after SQLGetDiagRec returns SQL_NO_DATA. Reagrds, Tan On Thu, Dec 10, 2009 at 5:34 AM, Paul Oliver wrote: > Hi Tan, > > This looks like it could be similar to the bug I observed in > > http://github.com/erlang/otp/commit/f3b6a575fceb957805c3b8d8af796a749cbad61c > . > In fact, it looks like you could easily modify that patch to work in > your case. Check > http://msdn.microsoft.com/en-us/library/ms716219%28VS.85%29.aspx for > details. > > Cheers, > Paul. > > On Wed, Dec 9, 2009 at 6:51 PM, tan wrote: > > Hi, > > > > I have had a bit of trouble getting erlang to work with iodbc on > > Darwin (Mac Snow Leopard). I could get odbc to work only after > > configuring with --enable-darwin-64bit and getting odbcserver to > > statically link to iodbc. I am using postgresql as my database. > > > > The most recent trouble I faced seemed to be because of a call to > > SQLNumResultCols after getting a SQL_NO_DATA_FOUND during a table > > update/delete SQL. The odbcserver process exits with error whenever a > > statement generates SQL_NO_DATA_FOUND. Below is the trace log where > > the error happens. > > > > ================= trace start ====================== > > [000018.849750] > > odbcserver 7FFF707D2BE0 ENTER SQLExecDirect > > SQLHSTMT 0x10020ec60 > > SQLCHAR * 0x10020eb91 > > | update game_plays set story_id = 2, > wher | > > | e play_id = 101 | > > SQLINTEGER -3 (SQL_NTS) > > > > [000018.851035] > > odbcserver 7FFF707D2BE0 EXIT SQLExecDirect with return code 100 > > (SQL_NO_DATA_FOUND) > > SQLHSTMT 0x10020ec60 > > SQLCHAR * 0x10020eb91 > > SQLINTEGER -3 (SQL_NTS) > > > > [000018.851071] > > odbcserver 7FFF707D2BE0 ENTER SQLNumResultCols > > SQLHSTMT 0x10020ec60 > > SQLSMALLINT * 0x7fff5fbfe8ee > > > > [000018.851098] > > odbcserver 7FFF707D2BE0 EXIT SQLNumResultCols with return code > > -1 (SQL_ERROR) > > SQLHSTMT 0x10020ec60 > > SQLSMALLINT * 0x7fff5fbfe8ee > > ================= trace end ====================== > > > > > > > > To circumvent the issue, I modified odbcserver.c (patch below) to > > prevent calls to SQLNumResultCols in such cases. > > > > Is this fix correct? > > Did anybody else face similar issues? > > Is there a better way for getting odbc to work instead of doing a > > 64bit compile and static linking with iodbc correct? > > > > Regards, > > Tan > > > > > > ================= patch file start ====================== > > 154c154 > > < static db_result_msg encode_result(db_state *state); > > --- > >> static db_result_msg encode_result(db_state *state, SQLRETURN > sql_result); > > 588c588 > > < msg = encode_result(state); > > --- > >> msg = encode_result(state, result); > > 593c593 > > < msg = encode_result(state); > > --- > >> msg = encode_result(state, result); > > 815c815 > > < msg = encode_result(state); > > --- > >> msg = encode_result(state, SQL_SUCCESS); > > 980c980 > > < static db_result_msg encode_result(db_state *state) > > --- > >> static db_result_msg encode_result(db_state *state, SQLRETURN > sql_result) > > 993c993,998 > > < DO_EXIT(EXIT_COLS); > > --- > >> if(SQL_NO_DATA_FOUND == sql_result) { > >> num_of_columns = 0; > >> } > >> else { > >> DO_EXIT(EXIT_COLS); > >> } > > 1007c1012,1017 > > < DO_EXIT(EXIT_ROWS); > > --- > >> if(SQL_NO_DATA_FOUND == sql_result) { > >> RowCountPtr = 0; > >> } > >> else { > >> DO_EXIT(EXIT_ROWS); > >> } > > ================= patch file end ====================== > > > > > > =============== my environment ======================== > > $ erl > > Erlang R13B03 (erts-5.7.4) [source] [64-bit] [smp:2:2] [rq:2] [async- > > threads:0] [kernel-poll:false] > > > > Eshell V5.7.4 (abort with ^G) > > > > > > $ uname -ap > > Darwin tanmac.local 10.2.0 Darwin Kernel Version 10.2.0: Tue Nov 3 > > 10:37:10 PST 2009; root:xnu-1486.2.11~1/RELEASE_I386 i386 i386 > > ======================================= > > > > > > ________________________________________________________________ > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > erlang-questions (at) erlang.org > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: patchfile.f3b6a575fceb957805c3b8d8af796a749cbad61c Type: application/octet-stream Size: 1098 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: patchfile.R13B03 Type: application/octet-stream Size: 2283 bytes Desc: not available URL: From rapsey@REDACTED Thu Dec 10 16:32:59 2009 From: rapsey@REDACTED (Rapsey) Date: Thu, 10 Dec 2009 16:32:59 +0100 Subject: [erlang-questions] web sockets almost working .... In-Reply-To: References: <9b08084c0912100221s647256e9q671935fd12defb67@mail.gmail.com> <24d4f39c0912100434s7b774cdex8d41fe4b811beeec@mail.gmail.com> <9b08084c0912100456m5bc0e9b5lfd5bd732930fb53f@mail.gmail.com> <3A4E08D0-6213-4D56-9F8B-DB670F0C9399@souja.net> <9b08084c0912100532r1b557ff8ide15e509f2484e75@mail.gmail.com> Message-ID: <97619b170912100732p520f1963te1f11e12dcdd9ca4@mail.gmail.com> Isn't it designed to work through HTTP? It's definitely a much better solution than what is available for comet. Sergej On Thu, Dec 10, 2009 at 2:42 PM, Max Lapshin wrote: > I don't think, that this technology will kill anything because of many > problems with routers, proxy servers, antiviruses. > > Do you know, how antivirus handle endless HTTP stream? It waits > request end, save to disk and check there. This is why > endless-http is dead. > > We are using RTMP in our production. It is a statefull binary > protocol. It is 100% unreliable, because lots of corporate proxies > don't allow it. And these proxies will not allow websockets. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From max.lapshin@REDACTED Thu Dec 10 16:38:16 2009 From: max.lapshin@REDACTED (Max Lapshin) Date: Thu, 10 Dec 2009 18:38:16 +0300 Subject: [erlang-questions] web sockets almost working .... In-Reply-To: <97619b170912100732p520f1963te1f11e12dcdd9ca4@mail.gmail.com> References: <9b08084c0912100221s647256e9q671935fd12defb67@mail.gmail.com> <24d4f39c0912100434s7b774cdex8d41fe4b811beeec@mail.gmail.com> <9b08084c0912100456m5bc0e9b5lfd5bd732930fb53f@mail.gmail.com> <3A4E08D0-6213-4D56-9F8B-DB670F0C9399@souja.net> <9b08084c0912100532r1b557ff8ide15e509f2484e75@mail.gmail.com> <97619b170912100732p520f1963te1f11e12dcdd9ca4@mail.gmail.com> Message-ID: On Thu, Dec 10, 2009 at 6:32 PM, Rapsey wrote: > Isn't it designed to work through HTTP? It's definitely a much better > solution than what is available for comet. > Either I've missed something from documentation, either there is told about statefull connection. From tony@REDACTED Thu Dec 10 16:40:27 2009 From: tony@REDACTED (Tony Arcieri) Date: Thu, 10 Dec 2009 08:40:27 -0700 Subject: [erlang-questions] web sockets almost working .... In-Reply-To: References: <9b08084c0912100221s647256e9q671935fd12defb67@mail.gmail.com> <24d4f39c0912100434s7b774cdex8d41fe4b811beeec@mail.gmail.com> <9b08084c0912100456m5bc0e9b5lfd5bd732930fb53f@mail.gmail.com> <3A4E08D0-6213-4D56-9F8B-DB670F0C9399@souja.net> <9b08084c0912100532r1b557ff8ide15e509f2484e75@mail.gmail.com> Message-ID: On Thu, Dec 10, 2009 at 6:42 AM, Max Lapshin wrote: > And these proxies will not allow websockets. > With reverse HTTP how do you distinguish websockets from normal HTTP requests? -- Tony Arcieri Medioh! A Kudelski Brand From schramm.ingo@REDACTED Thu Dec 10 16:41:13 2009 From: schramm.ingo@REDACTED (ingo.schramm) Date: Thu, 10 Dec 2009 07:41:13 -0800 (PST) Subject: web sockets almost working .... In-Reply-To: <97619b170912100732p520f1963te1f11e12dcdd9ca4@mail.gmail.com> References: <9b08084c0912100221s647256e9q671935fd12defb67@mail.gmail.com> <24d4f39c0912100434s7b774cdex8d41fe4b811beeec@mail.gmail.com> <9b08084c0912100456m5bc0e9b5lfd5bd732930fb53f@mail.gmail.com> <3A4E08D0-6213-4D56-9F8B-DB670F0C9399@souja.net> <9b08084c0912100532r1b557ff8ide15e509f2484e75@mail.gmail.com> <97619b170912100732p520f1963te1f11e12dcdd9ca4@mail.gmail.com> Message-ID: <5c9e1853-527a-4354-99fa-8eca1271ae7c@b2g2000yqi.googlegroups.com> No. It just has a HTTP handshake. Then it switches and uses a new protocol: web sockets. On Dec 10, 4:32?pm, Rapsey wrote: > Isn't it designed to work through HTTP? It's definitely a much better > solution than what is available for comet. From rumata-estor@REDACTED Thu Dec 10 16:51:00 2009 From: rumata-estor@REDACTED (Dmitry Belyaev) Date: Thu, 10 Dec 2009 18:51:00 +0300 Subject: [erlang-questions] web sockets almost working .... In-Reply-To: <97619b170912100732p520f1963te1f11e12dcdd9ca4@mail.gmail.com> References: <9b08084c0912100221s647256e9q671935fd12defb67@mail.gmail.com> <24d4f39c0912100434s7b774cdex8d41fe4b811beeec@mail.gmail.com> <9b08084c0912100456m5bc0e9b5lfd5bd732930fb53f@mail.gmail.com> <3A4E08D0-6213-4D56-9F8B-DB670F0C9399@souja.net> <9b08084c0912100532r1b557ff8ide15e509f2484e75@mail.gmail.com> <97619b170912100732p520f1963te1f11e12dcdd9ca4@mail.gmail.com> Message-ID: <1260460260.17442.5.camel@rumbuntu> If this feature worked through HTTP then server side would have to extract message from HTTP packet. In example shown there was no games with HTTP. What about proxy servers, I hope they will be redesigned to let WS work. On Thu, 2009-12-10 at 16:32 +0100, Rapsey wrote: > Isn't it designed to work through HTTP? It's definitely a much better > solution than what is available for comet. > > > Sergej > > On Thu, Dec 10, 2009 at 2:42 PM, Max Lapshin wrote: > > > I don't think, that this technology will kill anything because of many > > problems with routers, proxy servers, antiviruses. > > > > Do you know, how antivirus handle endless HTTP stream? It waits > > request end, save to disk and check there. This is why > > endless-http is dead. > > > > We are using RTMP in our production. It is a statefull binary > > protocol. It is 100% unreliable, because lots of corporate proxies > > don't allow it. And these proxies will not allow websockets. > > > > ________________________________________________________________ > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > erlang-questions (at) erlang.org > > > > From max.lapshin@REDACTED Thu Dec 10 16:55:36 2009 From: max.lapshin@REDACTED (Max Lapshin) Date: Thu, 10 Dec 2009 18:55:36 +0300 Subject: [erlang-questions] web sockets almost working .... In-Reply-To: <1260460260.17442.5.camel@rumbuntu> References: <9b08084c0912100221s647256e9q671935fd12defb67@mail.gmail.com> <24d4f39c0912100434s7b774cdex8d41fe4b811beeec@mail.gmail.com> <9b08084c0912100456m5bc0e9b5lfd5bd732930fb53f@mail.gmail.com> <3A4E08D0-6213-4D56-9F8B-DB670F0C9399@souja.net> <9b08084c0912100532r1b557ff8ide15e509f2484e75@mail.gmail.com> <97619b170912100732p520f1963te1f11e12dcdd9ca4@mail.gmail.com> <1260460260.17442.5.camel@rumbuntu> Message-ID: On Thu, Dec 10, 2009 at 6:51 PM, Dmitry Belyaev wrote: > If this feature worked through HTTP then server side would have to > extract message from HTTP packet. In example shown there was no games > with HTTP. > > What about proxy servers, I hope they will be redesigned to let WS work. Look, from server point of view, there is no difference between comet and web socket. Differs only the common time of being connected. From senthilkumar.peelikkampatti@REDACTED Thu Dec 10 17:01:27 2009 From: senthilkumar.peelikkampatti@REDACTED (Senthilkumar Peelikkampatti) Date: Thu, 10 Dec 2009 10:01:27 -0600 Subject: [erlang-questions] web sockets almost working .... In-Reply-To: References: <9b08084c0912100221s647256e9q671935fd12defb67@mail.gmail.com> <24d4f39c0912100434s7b774cdex8d41fe4b811beeec@mail.gmail.com> <9b08084c0912100456m5bc0e9b5lfd5bd732930fb53f@mail.gmail.com> <3A4E08D0-6213-4D56-9F8B-DB670F0C9399@souja.net> <9b08084c0912100532r1b557ff8ide15e509f2484e75@mail.gmail.com> <97619b170912100732p520f1963te1f11e12dcdd9ca4@mail.gmail.com> <1260460260.17442.5.camel@rumbuntu> Message-ID: <45d8e23d0912100801o621ab79ew11fe8e84f2de3006@mail.gmail.com> Joe, Thanks for heads up. We are working on websocket and repository is setup at http://github.com/sendtopms/erlwebsockserver. Initial target is Mochiweb and we are planning for supporting other app servers like inet and yaws. --Senthil On Thu, Dec 10, 2009 at 9:55 AM, Max Lapshin wrote: > On Thu, Dec 10, 2009 at 6:51 PM, Dmitry Belyaev wrote: >> If this feature worked through HTTP then server side would have to >> extract message from HTTP packet. In example shown there was no games >> with HTTP. >> >> What about proxy servers, I hope they will be redesigned to let WS work. > > Look, from server point of view, there is no difference between comet > and web socket. > Differs only the common time of being connected. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > -- Regards, Senthilkumar Peelikkampatti, http://pmsenthilkumar.blogspot.com/ From erlang@REDACTED Thu Dec 10 17:08:55 2009 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 10 Dec 2009 17:08:55 +0100 Subject: [erlang-questions] web sockets almost working .... In-Reply-To: <45d8e23d0912100801o621ab79ew11fe8e84f2de3006@mail.gmail.com> References: <9b08084c0912100221s647256e9q671935fd12defb67@mail.gmail.com> <24d4f39c0912100434s7b774cdex8d41fe4b811beeec@mail.gmail.com> <9b08084c0912100456m5bc0e9b5lfd5bd732930fb53f@mail.gmail.com> <3A4E08D0-6213-4D56-9F8B-DB670F0C9399@souja.net> <9b08084c0912100532r1b557ff8ide15e509f2484e75@mail.gmail.com> <97619b170912100732p520f1963te1f11e12dcdd9ca4@mail.gmail.com> <1260460260.17442.5.camel@rumbuntu> <45d8e23d0912100801o621ab79ew11fe8e84f2de3006@mail.gmail.com> Message-ID: <9b08084c0912100808l166d0cf0r650b91a0aaee52f1@mail.gmail.com> Brilliant - the race is on - then add a json/erlang term format abstartionn layer on top of the raw socket interface. Another group should do an in-line chat engine Use a DHT for the users and we could make an infinitly scabale IRC engine :-) /Joe On Thu, Dec 10, 2009 at 5:01 PM, Senthilkumar Peelikkampatti wrote: > ?Joe, > ? ? Thanks for heads up. We are working on websocket and repository > ?is setup at http://github.com/sendtopms/erlwebsockserver. Initial > ?target is Mochiweb and we are planning for supporting other app > ?servers like inet and yaws. > > --Senthil > > On Thu, Dec 10, 2009 at 9:55 AM, Max Lapshin wrote: >> On Thu, Dec 10, 2009 at 6:51 PM, Dmitry Belyaev wrote: >>> If this feature worked through HTTP then server side would have to >>> extract message from HTTP packet. In example shown there was no games >>> with HTTP. >>> >>> What about proxy servers, I hope they will be redesigned to let WS work. >> >> Look, from server point of view, there is no difference between comet >> and web socket. >> Differs only the common time of being connected. >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> > > > > -- > Regards, > Senthilkumar Peelikkampatti, > http://pmsenthilkumar.blogspot.com/ > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From senthilkumar.peelikkampatti@REDACTED Thu Dec 10 17:17:08 2009 From: senthilkumar.peelikkampatti@REDACTED (Senthilkumar Peelikkampatti) Date: Thu, 10 Dec 2009 10:17:08 -0600 Subject: [erlang-questions] web sockets almost working .... In-Reply-To: <9b08084c0912100808l166d0cf0r650b91a0aaee52f1@mail.gmail.com> References: <9b08084c0912100221s647256e9q671935fd12defb67@mail.gmail.com> <9b08084c0912100456m5bc0e9b5lfd5bd732930fb53f@mail.gmail.com> <3A4E08D0-6213-4D56-9F8B-DB670F0C9399@souja.net> <9b08084c0912100532r1b557ff8ide15e509f2484e75@mail.gmail.com> <97619b170912100732p520f1963te1f11e12dcdd9ca4@mail.gmail.com> <1260460260.17442.5.camel@rumbuntu> <45d8e23d0912100801o621ab79ew11fe8e84f2de3006@mail.gmail.com> <9b08084c0912100808l166d0cf0r650b91a0aaee52f1@mail.gmail.com> Message-ID: <45d8e23d0912100817m4a88edabu8f2f5b436ab1cb33@mail.gmail.com> Perfect. Inherent nature of the Erlang (message passing and its concurrency handling) is perfect fit for Websocket. Json would have been easy without resorting to json modules if it is available as BIF in erlang as you suggested earlier somewhere, nontheless it is not big deal to provide json capability and we will certainly do it. Thanks Joe. On Thu, Dec 10, 2009 at 10:08 AM, Joe Armstrong wrote: > Brilliant - the race is on ?- then add a json/erlang term format > abstartionn layer on top > of the raw socket interface. > > Another group should do an in-line chat engine > > Use a DHT for the users and we could make an infinitly scabale IRC engine :-) > > /Joe > > > > > On Thu, Dec 10, 2009 at 5:01 PM, Senthilkumar Peelikkampatti > wrote: >> ?Joe, >> ? ? Thanks for heads up. We are working on websocket and repository >> ?is setup at http://github.com/sendtopms/erlwebsockserver. Initial >> ?target is Mochiweb and we are planning for supporting other app >> ?servers like inet and yaws. >> >> --Senthil >> >> On Thu, Dec 10, 2009 at 9:55 AM, Max Lapshin wrote: >>> On Thu, Dec 10, 2009 at 6:51 PM, Dmitry Belyaev wrote: >>>> If this feature worked through HTTP then server side would have to >>>> extract message from HTTP packet. In example shown there was no games >>>> with HTTP. >>>> >>>> What about proxy servers, I hope they will be redesigned to let WS work. >>> >>> Look, from server point of view, there is no difference between comet >>> and web socket. >>> Differs only the common time of being connected. >>> >>> ________________________________________________________________ >>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>> erlang-questions (at) erlang.org >>> >>> >> >> >> >> -- >> Regards, >> Senthilkumar Peelikkampatti, >> http://pmsenthilkumar.blogspot.com/ >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> > -- Regards, Senthilkumar Peelikkampatti, http://pmsenthilkumar.blogspot.com/ From mikael.laaksonen@REDACTED Thu Dec 10 17:18:42 2009 From: mikael.laaksonen@REDACTED (Mikael Laaksonen) Date: Thu, 10 Dec 2009 17:18:42 +0100 Subject: Yaws_soap_lib and wsdl imports Message-ID: <1C99D95E-E31E-4C37-B0D9-A328CF1B2A51@gmail.com> Hello, I am have trouble working with wsdl-files in yaws_soap_lib when they have import-statements. Does yaws handle import statements in wsdl:s? An example taken from: http://www.ibm.com/developerworks/xml/library/ws-tip-imports.html Thankful for all help. /Mikael Laakosnen ps. Sorry if I'm spamming but I can't seem get my post through. ------------------------------------------------------------------------- (ml@REDACTED)10> yaws_soap_lib:initModel("[...path_to_fil...]/listing4.wsdl"). ** exited: {{badmatch,{error,"Include file not found (undefined)"}}, [{yaws_soap_lib,addSchemas,5}, {yaws_soap_lib,parseWsdls,5}, {yaws_soap_lib,initModel2,5}, {erl_eval,do_apply,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** ------------------------------------------------------------------------- Listings4 ------------------------------------------------------------------------- --------------------------------------------------------------------- Listings5 --------------------------------------------------------------------- From garry@REDACTED Thu Dec 10 17:19:15 2009 From: garry@REDACTED (Garry Hodgson) Date: Thu, 10 Dec 2009 11:19:15 -0500 Subject: [erlang-questions] Best way to interface Erlang with Java code In-Reply-To: <18a1db030912091451s5ff30186n4d8c546f931c7641@mail.gmail.com> References: <18a1db030912050745r473683fboe722b1ec9a449d24@mail.gmail.com> <4B1A81FF.6050804@gmail.com> <18a1db030912050927o1faff113g3ffd5083779ba623@mail.gmail.com> <20091205182059.GE11530@delora.autosys.us> <18a1db030912061837w7ad4591fy9f8b26b9431f1fbd@mail.gmail.com> <20091207031351.GP11530@delora.autosys.us> <20091207040032.GQ11530@delora.autosys.us> <18a1db030912091451s5ff30186n4d8c546f931c7641@mail.gmail.com> Message-ID: <4B211F83.7010705@research.att.com> zabrane Mikael wrote: > I've a binary string <<"Hello World">>, and simply want to send it to this > "java" program (via port_command, but it doesn't work). The latter will just > printout "Hello World" on the shell. > > Help, please !! there's not much anyone can do to help with so little information. we need to see stripped down code, description of what happens, etc. -- Garry Hodgson Lead Member of Technical Staff AT&T Chief Security Office (CSO) "This e-mail and any files transmitted with it are AT&T property, are confidential, and are intended solely for the use of the individual or entity to whom this e-mail is addressed. If you are not one of the named recipient(s) or otherwise have reason to believe that you have received this message in error, please notify the sender and delete this message immediately from your computer. Any other use, retention, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited." From B.Candler@REDACTED Thu Dec 10 16:57:08 2009 From: B.Candler@REDACTED (Brian Candler) Date: Thu, 10 Dec 2009 15:57:08 +0000 Subject: Help with erl_parse / epp Message-ID: <20091210155708.GA20461@uk.tiscali.com> I am trying to parse erlang into abstract form and then back into erlang source. Here's the code I'm trying to run: -module(rfe_cmd). -export([erl2erl/0]). erl2erl() -> [Fname] = init:get_plain_arguments(), {ok, File} = file:read_file(Fname), {ok, Tokens, _} = erl_scan:string(binary_to_list(File)), {ok, Form} = erl_parse:parse_form(Tokens), io:put_chars(erl_pp:form(Form)), ok. and the startup script 'erl2erl': #!/bin/sh erl -pa ebin -pa ../ebin -noshell -s rfe_cmd erl2erl -s init stop -extra "$@" It works when run on a simple input file, such as f (A) -> A+B; f ([B]) -> length(B). However it barfs when run against its own source. {"init terminating in do_boot",{{badmatch,{error,{2,erl_parse,["syntax error before: ","'-'"]}}},[{rfe_cmd,erl2erl,0},{init,start_it,1},{init,start_em,1}]}} I think it's something to do with the -module / -export directives. If I do {ok, Forms} = epp:parse_file(Fname, [], []), lists:foreach(fun(Z) -> io:put_chars(erl_pp:form(Z)) end, Forms). then it seems to work. Is this the "right" way to handle it? That is, erl_parse can only handle a single form rather than a complete source file? If that's true, then how does epp know where the boundaries are between the functions (forms) in a file, before it's actually parsed? Thanks, Brian. From senthilkumar.peelikkampatti@REDACTED Thu Dec 10 17:36:09 2009 From: senthilkumar.peelikkampatti@REDACTED (Senthilkumar Peelikkampatti) Date: Thu, 10 Dec 2009 10:36:09 -0600 Subject: [erlang-questions] web sockets almost working .... In-Reply-To: <45d8e23d0912100817m4a88edabu8f2f5b436ab1cb33@mail.gmail.com> References: <9b08084c0912100221s647256e9q671935fd12defb67@mail.gmail.com> <3A4E08D0-6213-4D56-9F8B-DB670F0C9399@souja.net> <9b08084c0912100532r1b557ff8ide15e509f2484e75@mail.gmail.com> <97619b170912100732p520f1963te1f11e12dcdd9ca4@mail.gmail.com> <1260460260.17442.5.camel@rumbuntu> <45d8e23d0912100801o621ab79ew11fe8e84f2de3006@mail.gmail.com> <9b08084c0912100808l166d0cf0r650b91a0aaee52f1@mail.gmail.com> <45d8e23d0912100817m4a88edabu8f2f5b436ab1cb33@mail.gmail.com> Message-ID: <45d8e23d0912100836u7ca180e5n8e70b8110264e9c8@mail.gmail.com> Firefox and Websocket, Firefox also implemented Websocket but code is still in trunck for almost an year. It is the first one before chrome implemented but it the chrome came to market first. Whole history can be found at https://bugzilla.mozilla.org/show_bug.cgi?id=472529. On Thu, Dec 10, 2009 at 10:17 AM, Senthilkumar Peelikkampatti wrote: > Perfect. Inherent nature of the Erlang (message passing and its > concurrency handling) is perfect fit for Websocket. Json would have > been easy without resorting to json modules if it is available as BIF > in erlang as you suggested earlier somewhere, nontheless it is not big > deal to provide json capability and we will certainly do it. > Thanks Joe. > > On Thu, Dec 10, 2009 at 10:08 AM, Joe Armstrong wrote: >> Brilliant - the race is on ?- then add a json/erlang term format >> abstartionn layer on top >> of the raw socket interface. >> >> Another group should do an in-line chat engine >> >> Use a DHT for the users and we could make an infinitly scabale IRC engine :-) >> >> /Joe >> >> >> >> >> On Thu, Dec 10, 2009 at 5:01 PM, Senthilkumar Peelikkampatti >> wrote: >>> ?Joe, >>> ? ? Thanks for heads up. We are working on websocket and repository >>> ?is setup at http://github.com/sendtopms/erlwebsockserver. Initial >>> ?target is Mochiweb and we are planning for supporting other app >>> ?servers like inet and yaws. >>> >>> --Senthil >>> >>> On Thu, Dec 10, 2009 at 9:55 AM, Max Lapshin wrote: >>>> On Thu, Dec 10, 2009 at 6:51 PM, Dmitry Belyaev wrote: >>>>> If this feature worked through HTTP then server side would have to >>>>> extract message from HTTP packet. In example shown there was no games >>>>> with HTTP. >>>>> >>>>> What about proxy servers, I hope they will be redesigned to let WS work. >>>> >>>> Look, from server point of view, there is no difference between comet >>>> and web socket. >>>> Differs only the common time of being connected. >>>> >>>> ________________________________________________________________ >>>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>>> erlang-questions (at) erlang.org >>>> >>>> >>> >>> >>> >>> -- >>> Regards, >>> Senthilkumar Peelikkampatti, >>> http://pmsenthilkumar.blogspot.com/ >>> >>> ________________________________________________________________ >>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>> erlang-questions (at) erlang.org >>> >>> >> > > > > -- > Regards, > Senthilkumar Peelikkampatti, > http://pmsenthilkumar.blogspot.com/ > -- Regards, Senthilkumar Peelikkampatti, http://pmsenthilkumar.blogspot.com/ From hynek@REDACTED Thu Dec 10 17:39:15 2009 From: hynek@REDACTED (Hynek Vychodil) Date: Thu, 10 Dec 2009 17:39:15 +0100 Subject: [erlang-questions] web sockets almost working .... In-Reply-To: <45d8e23d0912100817m4a88edabu8f2f5b436ab1cb33@mail.gmail.com> References: <9b08084c0912100221s647256e9q671935fd12defb67@mail.gmail.com> <3A4E08D0-6213-4D56-9F8B-DB670F0C9399@souja.net> <9b08084c0912100532r1b557ff8ide15e509f2484e75@mail.gmail.com> <97619b170912100732p520f1963te1f11e12dcdd9ca4@mail.gmail.com> <1260460260.17442.5.camel@rumbuntu> <45d8e23d0912100801o621ab79ew11fe8e84f2de3006@mail.gmail.com> <9b08084c0912100808l166d0cf0r650b91a0aaee52f1@mail.gmail.com> <45d8e23d0912100817m4a88edabu8f2f5b436ab1cb33@mail.gmail.com> Message-ID: <4d08db370912100839k47f66ec0qb1eab0d9b896e06f@mail.gmail.com> I have read it's specification and payload of currently defined frames must be valid utf-8. It is little bit annoying. I would like fill frames with BERT or UFB. Implement BERT-RPC or UBF-RPC sounds great for me. Implementation of BERT or UBF in V8 should be considerable fast. On Thu, Dec 10, 2009 at 5:17 PM, Senthilkumar Peelikkampatti wrote: > Perfect. Inherent nature of the Erlang (message passing and its > concurrency handling) is perfect fit for Websocket. Json would have > been easy without resorting to json modules if it is available as BIF > in erlang as you suggested earlier somewhere, nontheless it is not big > deal to provide json capability and we will certainly do it. > Thanks Joe. > > On Thu, Dec 10, 2009 at 10:08 AM, Joe Armstrong wrote: >> Brilliant - the race is on ?- then add a json/erlang term format >> abstartionn layer on top >> of the raw socket interface. >> >> Another group should do an in-line chat engine >> >> Use a DHT for the users and we could make an infinitly scabale IRC engine :-) >> >> /Joe >> >> >> >> >> On Thu, Dec 10, 2009 at 5:01 PM, Senthilkumar Peelikkampatti >> wrote: >>> ?Joe, >>> ? ? Thanks for heads up. We are working on websocket and repository >>> ?is setup at http://github.com/sendtopms/erlwebsockserver. Initial >>> ?target is Mochiweb and we are planning for supporting other app >>> ?servers like inet and yaws. >>> >>> --Senthil >>> >>> On Thu, Dec 10, 2009 at 9:55 AM, Max Lapshin wrote: >>>> On Thu, Dec 10, 2009 at 6:51 PM, Dmitry Belyaev wrote: >>>>> If this feature worked through HTTP then server side would have to >>>>> extract message from HTTP packet. In example shown there was no games >>>>> with HTTP. >>>>> >>>>> What about proxy servers, I hope they will be redesigned to let WS work. >>>> >>>> Look, from server point of view, there is no difference between comet >>>> and web socket. >>>> Differs only the common time of being connected. >>>> >>>> ________________________________________________________________ >>>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>>> erlang-questions (at) erlang.org >>>> >>>> >>> >>> >>> >>> -- >>> Regards, >>> Senthilkumar Peelikkampatti, >>> http://pmsenthilkumar.blogspot.com/ >>> >>> ________________________________________________________________ >>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>> erlang-questions (at) erlang.org >>> >>> >> > > > > -- > Regards, > Senthilkumar Peelikkampatti, > http://pmsenthilkumar.blogspot.com/ > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try Good Data now for free: www.gooddata.com From andrew@REDACTED Thu Dec 10 17:48:33 2009 From: andrew@REDACTED (Andrew Thompson) Date: Thu, 10 Dec 2009 11:48:33 -0500 Subject: [erlang-questions] ODBC error after SQL_NO_DATA_FOUND In-Reply-To: <785f88f70912100731i389b7435s6a83d4b23954c6e5@mail.gmail.com> References: <1cefc2f9-6a7d-49d0-8ce0-d98de33c78c6@o9g2000prg.googlegroups.com> <785f88f70912100731i389b7435s6a83d4b23954c6e5@mail.gmail.com> Message-ID: <20091210164832.GI1969@hijacked.us> On Thu, Dec 10, 2009 at 09:01:56PM +0530, Tanmay K. Mohapatra wrote: > Hi Paul, > > Thanks for the pointers. I have attached a couple of new patches, one one > R13B03 and the other over commit f3b6a575fceb957805c3b8d8af796a749cbad61c. > > I'm new here and don't understand the code fully yet. Though my particular > case is behaving fine now, I'm not sure if I have fixed/tested all > conditions. I had to revert back a change done in get_diagnos where the loop > should break after SQLGetDiagRec returns SQL_NO_DATA. > Could you please regenerate with diff -u so the patches are more readable? Andrew From jacob.vorreuter@REDACTED Thu Dec 10 17:52:21 2009 From: jacob.vorreuter@REDACTED (Jacob Vorreuter) Date: Thu, 10 Dec 2009 08:52:21 -0800 Subject: [erlang-questions] Help with erl_parse / epp In-Reply-To: <20091210155708.GA20461@uk.tiscali.com> References: <20091210155708.GA20461@uk.tiscali.com> Message-ID: Yes, erl_pp:form/1 expects a single form as its input. Once the source code is tokenized it is easy to group the tokens into forms. Every form ends with the {dot, LINE} token. Does that answer your question? You can check out my EUC presentation if you're interested in this kind of stuff: http://jacobvorreuter.com/hacking-erlang-at-euc-2009 Jake On Thu, Dec 10, 2009 at 7:57 AM, Brian Candler wrote: > I am trying to parse erlang into abstract form and then back into erlang > source. Here's the code I'm trying to run: > > -module(rfe_cmd). > -export([erl2erl/0]). > erl2erl() -> > [Fname] = init:get_plain_arguments(), > {ok, File} = file:read_file(Fname), > {ok, Tokens, _} = erl_scan:string(binary_to_list(File)), > {ok, Form} = erl_parse:parse_form(Tokens), > io:put_chars(erl_pp:form(Form)), > ok. > > and the startup script 'erl2erl': > > #!/bin/sh > erl -pa ebin -pa ../ebin -noshell -s rfe_cmd erl2erl -s init stop -extra > "$@" > > It works when run on a simple input file, such as > > f (A) -> A+B; > f ([B]) -> length(B). > > However it barfs when run against its own source. > > {"init terminating in do_boot",{{badmatch,{error,{2,erl_parse,["syntax > error > before: > ","'-'"]}}},[{rfe_cmd,erl2erl,0},{init,start_it,1},{init,start_em,1}]}} > > I think it's something to do with the -module / -export directives. > > If I do > > {ok, Forms} = epp:parse_file(Fname, [], []), > lists:foreach(fun(Z) -> io:put_chars(erl_pp:form(Z)) end, Forms). > > then it seems to work. Is this the "right" way to handle it? That is, > erl_parse can only handle a single form rather than a complete source file? > > If that's true, then how does epp know where the boundaries are between > the functions (forms) in a file, before it's actually parsed? > > Thanks, > > Brian. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From B.Candler@REDACTED Thu Dec 10 18:40:22 2009 From: B.Candler@REDACTED (Brian Candler) Date: Thu, 10 Dec 2009 17:40:22 +0000 Subject: [erlang-questions] Help with erl_parse / epp In-Reply-To: <4B212D19.7070108@gmail.com> References: <20091210155708.GA20461@uk.tiscali.com> <4B212D19.7070108@gmail.com> Message-ID: <20091210174022.GA23683@uk.tiscali.com> On Thu, Dec 10, 2009 at 06:17:13PM +0100, Richard Carlsson wrote: > It scans until it has found a "full stop" token, (represented > as {dot,Line}). In the source, this is a '.' character followed > by whitespace or eof. For example: Thank you, I see now. Is there a particular reason why it's better to do it there, rather than in the grammar? i.e. forms -> forms form. forms -> form. From zabrane3@REDACTED Thu Dec 10 19:06:57 2009 From: zabrane3@REDACTED (zabrane Mikael) Date: Thu, 10 Dec 2009 19:06:57 +0100 Subject: [erlang-questions] Best way to interface Erlang with Java code In-Reply-To: <4B211F83.7010705@research.att.com> References: <18a1db030912050745r473683fboe722b1ec9a449d24@mail.gmail.com> <4B1A81FF.6050804@gmail.com> <18a1db030912050927o1faff113g3ffd5083779ba623@mail.gmail.com> <20091205182059.GE11530@delora.autosys.us> <18a1db030912061837w7ad4591fy9f8b26b9431f1fbd@mail.gmail.com> <20091207031351.GP11530@delora.autosys.us> <20091207040032.GQ11530@delora.autosys.us> <18a1db030912091451s5ff30186n4d8c546f931c7641@mail.gmail.com> <4B211F83.7010705@research.att.com> Message-ID: <18a1db030912101006v760a6f7dl7cc70b4e8e9bd008@mail.gmail.com> Hi Garry! Jayson write a nice tutorial to help me fix that at: http://needlesslymessianic.com/2009/12/10/using-ports-to-communicate-with-external-programs Unfortunately, it doesnt seem work with my Java program. there's not much anyone can do to help with so little information. we need > to see stripped down code, description of what happens, etc. So here are more details of what I want to achieve: $ cat foo.txt Hello World # open the file "foo.txt", and printout what the file contains to "stdout" $ java my_java_program foot.txt Hello World # notice the dash "-". When set, it means the same as before, but read from stdin, and printout anything to stdout $ cat foot.txt | java my_java_program - Hello World What I'd like to get is very simple. Send a string from an Erlang port to this java program and let it read it from stdin (with "-"). Then, the java program send back the same string to the Erlang port. Schematically =========== % notice the "-" at the, I need to control the Java program and let it read from "stdin" as shown before Port = open_port({spawn, " java my_java_program - "}, [options goes here]), port_command(Port, "Hello World"), loop(Port, <<>>). and collecte what the "Java" program send back (I'm expecting the same "Hello World"): loop(Port, Bin) -> receive {Port, {data, Bin}} -> loop(Port, [Bin | Data]); {Port, {exit_status, Status}} -> {exit_status, Status, list_to_binary([lists:reverse(Data)])}; Any -> {error, Any} end. But this doesnt sems work at all. Regards Zabrane From jarrod@REDACTED Thu Dec 10 19:13:55 2009 From: jarrod@REDACTED (Jarrod Roberson) Date: Thu, 10 Dec 2009 13:13:55 -0500 Subject: [erlang-questions] web sockets almost working .... In-Reply-To: <4d08db370912100839k47f66ec0qb1eab0d9b896e06f@mail.gmail.com> References: <9b08084c0912100221s647256e9q671935fd12defb67@mail.gmail.com> <9b08084c0912100532r1b557ff8ide15e509f2484e75@mail.gmail.com> <97619b170912100732p520f1963te1f11e12dcdd9ca4@mail.gmail.com> <1260460260.17442.5.camel@rumbuntu> <45d8e23d0912100801o621ab79ew11fe8e84f2de3006@mail.gmail.com> <9b08084c0912100808l166d0cf0r650b91a0aaee52f1@mail.gmail.com> <45d8e23d0912100817m4a88edabu8f2f5b436ab1cb33@mail.gmail.com> <4d08db370912100839k47f66ec0qb1eab0d9b896e06f@mail.gmail.com> Message-ID: On Thu, Dec 10, 2009 at 11:39 AM, Hynek Vychodil wrote: > I have read it's specification and payload of currently defined frames > must be valid utf-8. It is little bit annoying. I would like fill > frames with BERT or UFB. Implement BERT-RPC or UBF-RPC sounds great > for me. Implementation of BERT or UBF in V8 should be considerable > fast. > yeah I wish they would quit redefining new protocols, I try and use BEEP when ever possible. It is way more featureful than this new web sockets stuff from a developers point of view. It handles most cases and you can transport text or binary or whatever you want. From per.melin@REDACTED Thu Dec 10 20:13:52 2009 From: per.melin@REDACTED (Per Melin) Date: Thu, 10 Dec 2009 20:13:52 +0100 Subject: [erlang-questions] web sockets almost working .... In-Reply-To: <9b08084c0912100532r1b557ff8ide15e509f2484e75@mail.gmail.com> References: <9b08084c0912100221s647256e9q671935fd12defb67@mail.gmail.com> <24d4f39c0912100434s7b774cdex8d41fe4b811beeec@mail.gmail.com> <9b08084c0912100456m5bc0e9b5lfd5bd732930fb53f@mail.gmail.com> <3A4E08D0-6213-4D56-9F8B-DB670F0C9399@souja.net> <9b08084c0912100532r1b557ff8ide15e509f2484e75@mail.gmail.com> Message-ID: On Thu, Dec 10, 2009 at 2:32 PM, Joe Armstrong wrote: > What I hope will happen that Google will pre-empt some action in firefox and > this will push Microsoft into action - I can't understand why this has > taken so long In the real world site owners are beginning to get their hopes up about dropping support for IE6, an eight year old browser, soon. Hopefully we don't have to wait as long as eight years for IE7's market share to dwindle enough to be ignorable, but I'm not holding my breath waiting for ajax and comet to be superseded in any practical setting. (I have two deployed apps using combinations of forever-frames, long polling and other HTTP/browser abuses, and it's a disgusting mess.) From zabrane3@REDACTED Thu Dec 10 21:06:47 2009 From: zabrane3@REDACTED (zabrane Mikael) Date: Thu, 10 Dec 2009 21:06:47 +0100 Subject: [erlang-questions] Best way to interface Erlang with Java code In-Reply-To: <943087C4-8D59-4503-84F2-C57427181E91@souja.net> References: <18a1db030912050745r473683fboe722b1ec9a449d24@mail.gmail.com> <4B1A81FF.6050804@gmail.com> <18a1db030912050927o1faff113g3ffd5083779ba623@mail.gmail.com> <20091205182059.GE11530@delora.autosys.us> <18a1db030912061837w7ad4591fy9f8b26b9431f1fbd@mail.gmail.com> <20091207031351.GP11530@delora.autosys.us> <20091207040032.GQ11530@delora.autosys.us> <18a1db030912091451s5ff30186n4d8c546f931c7641@mail.gmail.com> <4B211F83.7010705@research.att.com> <943087C4-8D59-4503-84F2-C57427181E91@souja.net> Message-ID: <18a1db030912101206y492273edq211b24a375851b6b@mail.gmail.com> HI guys ! Your prototype worked very well with shell script command (using "read"), but not when calling my "java" program inside it. This is why I need more help please. I found this thread that seems close to my problem, but no solution is proposed: http://groups.google.com/group/erlang-programming/browse_thread/thread/b3a048ccfec8d5bc Regards Zabrane 2009/12/10 Jayson Vantuyl > I already sent him a working prototype that should have what he needed. I > also blogged about it here: > > > http://needlesslymessianic.com/2009/12/10/using-ports-to-communicate-with-external-programs > > On Dec 10, 2009, at 8:19 AM, Garry Hodgson wrote: > > zabrane Mikael wrote: > > I've a binary string <<"Hello World">>, and simply want to send it to this > > "java" program (via port_command, but it doesn't work). The latter will > just > > printout "Hello World" on the shell. > > Help, please !! > > > there's not much anyone can do to help with so little information. we need > to see stripped down code, description of what happens, etc. > > > -- > Garry Hodgson > Lead Member of Technical Staff > AT&T Chief Security Office (CSO) > > "This e-mail and any files transmitted with it are AT&T property, are > confidential, and are intended solely for the use of the individual or > entity to whom this e-mail is addressed. If you are not one of the named > recipient(s) or otherwise have reason to believe that you have received this > message in error, please notify the sender and delete this message > immediately from your computer. Any other use, retention, dissemination, > forwarding, printing, or copying of this e-mail is strictly prohibited." > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > > From zabrane3@REDACTED Thu Dec 10 21:13:56 2009 From: zabrane3@REDACTED (zabrane Mikael) Date: Thu, 10 Dec 2009 21:13:56 +0100 Subject: [erlang-questions] Best way to interface Erlang with Java code In-Reply-To: References: <18a1db030912050745r473683fboe722b1ec9a449d24@mail.gmail.com> <18a1db030912050927o1faff113g3ffd5083779ba623@mail.gmail.com> <20091205182059.GE11530@delora.autosys.us> <18a1db030912061837w7ad4591fy9f8b26b9431f1fbd@mail.gmail.com> <20091207031351.GP11530@delora.autosys.us> <20091207040032.GQ11530@delora.autosys.us> <18a1db030912091451s5ff30186n4d8c546f931c7641@mail.gmail.com> <4B211F83.7010705@research.att.com> <18a1db030912101006v760a6f7dl7cc70b4e8e9bd008@mail.gmail.com> Message-ID: <18a1db030912101213o7947a3e8tb48a85dbd82548f0@mail.gmail.com> 2009/12/10 Jayson Vantuyl > Is the Java program set to read one line at a time? Otherwise, it may be > blocking waiting for end-of-file, which Erlang never would generate (since > it doesn't close STDIN unless you kill the port). No no. The Java program doesnt block: $ curl http://www.erlang.com | java my_java_program - | head -10 Regards Zabrane From zabrane3@REDACTED Thu Dec 10 21:15:10 2009 From: zabrane3@REDACTED (zabrane Mikael) Date: Thu, 10 Dec 2009 21:15:10 +0100 Subject: [erlang-questions] Best way to interface Erlang with Java code In-Reply-To: <36654F96-7259-48F9-949D-8958304A4BC9@souja.net> References: <18a1db030912050745r473683fboe722b1ec9a449d24@mail.gmail.com> <20091205182059.GE11530@delora.autosys.us> <18a1db030912061837w7ad4591fy9f8b26b9431f1fbd@mail.gmail.com> <20091207031351.GP11530@delora.autosys.us> <20091207040032.GQ11530@delora.autosys.us> <18a1db030912091451s5ff30186n4d8c546f931c7641@mail.gmail.com> <4B211F83.7010705@research.att.com> <943087C4-8D59-4503-84F2-C57427181E91@souja.net> <18a1db030912101206y492273edq211b24a375851b6b@mail.gmail.com> <36654F96-7259-48F9-949D-8958304A4BC9@souja.net> Message-ID: <18a1db030912101215n4c6c25d3re97d0fb5f7b02097@mail.gmail.com> Thanks for the advice. I'll do. 2009/12/10 Jayson Vantuyl > Can you rewrite your Java program to not require end-of-file, but rather to > look for a sentinel value that you could manually send? The problem is that > port programs don't currently have a mechanism to close their STDIN. > > On Dec 10, 2009, at 12:06 PM, zabrane Mikael wrote: > > > HI guys ! > > > > Your prototype worked very well with shell script command (using "read"), > > but not when calling my "java" program inside it. > > > > This is why I need more help please. > > > > I found this thread that seems close to my problem, but no solution is > > proposed: > > > http://groups.google.com/group/erlang-programming/browse_thread/thread/b3a048ccfec8d5bc > > > > Regards > > Zabrane > > > > > > 2009/12/10 Jayson Vantuyl > > > >> I already sent him a working prototype that should have what he needed. > I > >> also blogged about it here: > >> > >> > >> > http://needlesslymessianic.com/2009/12/10/using-ports-to-communicate-with-external-programs > >> > >> On Dec 10, 2009, at 8:19 AM, Garry Hodgson wrote: > >> > >> zabrane Mikael wrote: > >> > >> I've a binary string <<"Hello World">>, and simply want to send it to > this > >> > >> "java" program (via port_command, but it doesn't work). The latter will > >> just > >> > >> printout "Hello World" on the shell. > >> > >> Help, please !! > >> > >> > >> there's not much anyone can do to help with so little information. we > need > >> to see stripped down code, description of what happens, etc. > >> > >> > >> -- > >> Garry Hodgson > >> Lead Member of Technical Staff > >> AT&T Chief Security Office (CSO) > >> > >> "This e-mail and any files transmitted with it are AT&T property, are > >> confidential, and are intended solely for the use of the individual or > >> entity to whom this e-mail is addressed. If you are not one of the named > >> recipient(s) or otherwise have reason to believe that you have received > this > >> message in error, please notify the sender and delete this message > >> immediately from your computer. Any other use, retention, dissemination, > >> forwarding, printing, or copying of this e-mail is strictly prohibited." > >> > >> ________________________________________________________________ > >> erlang-questions mailing list. See http://www.erlang.org/faq.html > >> erlang-questions (at) erlang.org > >> > >> > >> > > > > -- > Jayson Vantuyl > kagato@REDACTED > > > > > > From garry@REDACTED Thu Dec 10 21:48:02 2009 From: garry@REDACTED (Garry Hodgson) Date: Thu, 10 Dec 2009 15:48:02 -0500 Subject: [erlang-questions] Best way to interface Erlang with Java code In-Reply-To: <18a1db030912101006v760a6f7dl7cc70b4e8e9bd008@mail.gmail.com> References: <18a1db030912050745r473683fboe722b1ec9a449d24@mail.gmail.com> <4B1A81FF.6050804@gmail.com> <18a1db030912050927o1faff113g3ffd5083779ba623@mail.gmail.com> <20091205182059.GE11530@delora.autosys.us> <18a1db030912061837w7ad4591fy9f8b26b9431f1fbd@mail.gmail.com> <20091207031351.GP11530@delora.autosys.us> <20091207040032.GQ11530@delora.autosys.us> <18a1db030912091451s5ff30186n4d8c546f931c7641@mail.gmail.com> <4B211F83.7010705@research.att.com> <18a1db030912101006v760a6f7dl7cc70b4e8e9bd008@mail.gmail.com> Message-ID: <4B215E82.7050209@research.att.com> zabrane Mikael wrote: > loop(Port, <<>>). > > and collecte what the "Java" program send back (I'm expecting the same > "Hello World"): > > loop(Port, Bin) -> > receive > {Port, {data, Bin}} -> > loop(Port, [Bin | Data]); > {Port, {exit_status, Status}} -> > {exit_status, Status, list_to_binary([lists:reverse(Data)])}; > Any -> > {error, Any} > end. you should fix your loop call, as well. note that when you first call it, you're passing it a binary. then, your receive call pattern matches on that same binary. then you call it recursively, passing it a list of binaries. problem there. -- Garry Hodgson Lead Member of Technical Staff AT&T Chief Security Office (CSO) "This e-mail and any files transmitted with it are AT&T property, are confidential, and are intended solely for the use of the individual or entity to whom this e-mail is addressed. If you are not one of the named recipient(s) or otherwise have reason to believe that you have received this message in error, please notify the sender and delete this message immediately from your computer. Any other use, retention, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited." From zabrane3@REDACTED Thu Dec 10 22:01:50 2009 From: zabrane3@REDACTED (zabrane Mikael) Date: Thu, 10 Dec 2009 22:01:50 +0100 Subject: [erlang-questions] Best way to interface Erlang with Java code In-Reply-To: <4B215E82.7050209@research.att.com> References: <18a1db030912050745r473683fboe722b1ec9a449d24@mail.gmail.com> <18a1db030912050927o1faff113g3ffd5083779ba623@mail.gmail.com> <20091205182059.GE11530@delora.autosys.us> <18a1db030912061837w7ad4591fy9f8b26b9431f1fbd@mail.gmail.com> <20091207031351.GP11530@delora.autosys.us> <20091207040032.GQ11530@delora.autosys.us> <18a1db030912091451s5ff30186n4d8c546f931c7641@mail.gmail.com> <4B211F83.7010705@research.att.com> <18a1db030912101006v760a6f7dl7cc70b4e8e9bd008@mail.gmail.com> <4B215E82.7050209@research.att.com> Message-ID: <18a1db030912101301o583a2115u230ca7e2758924df@mail.gmail.com> Thanks for pointing that out. I was outside ... the Erlang code is correct Garry. 2009/12/10 Garry Hodgson > zabrane Mikael wrote: > > loop(Port, <<>>). >> >> and collecte what the "Java" program send back (I'm expecting the same >> "Hello World"): >> >> loop(Port, Bin) -> >> receive >> {Port, {data, Bin}} -> >> loop(Port, [Bin | Data]); >> {Port, {exit_status, Status}} -> >> {exit_status, Status, list_to_binary([lists:reverse(Data)])}; >> Any -> >> {error, Any} >> end. >> > > you should fix your loop call, as well. > note that when you first call it, you're passing it a binary. > then, your receive call pattern matches on that same binary. > then you call it recursively, passing it a list of binaries. > > problem there. > > > > -- > Garry Hodgson > Lead Member of Technical Staff > AT&T Chief Security Office (CSO) > > "This e-mail and any files transmitted with it are AT&T property, are > confidential, and are intended solely for the use of the individual or > entity to whom this e-mail is addressed. If you are not one of the named > recipient(s) or otherwise have reason to believe that you have received this > message in error, please notify the sender and delete this message > immediately from your computer. Any other use, retention, dissemination, > forwarding, printing, or copying of this e-mail is strictly prohibited." > From tony@REDACTED Thu Dec 10 22:13:15 2009 From: tony@REDACTED (Tony Arcieri) Date: Thu, 10 Dec 2009 14:13:15 -0700 Subject: [erlang-questions] web sockets almost working .... In-Reply-To: References: <9b08084c0912100221s647256e9q671935fd12defb67@mail.gmail.com> <24d4f39c0912100434s7b774cdex8d41fe4b811beeec@mail.gmail.com> <9b08084c0912100456m5bc0e9b5lfd5bd732930fb53f@mail.gmail.com> <3A4E08D0-6213-4D56-9F8B-DB670F0C9399@souja.net> <9b08084c0912100532r1b557ff8ide15e509f2484e75@mail.gmail.com> <97619b170912100732p520f1963te1f11e12dcdd9ca4@mail.gmail.com> <1260460260.17442.5.camel@rumbuntu> Message-ID: On Thu, Dec 10, 2009 at 8:55 AM, Max Lapshin wrote: > Look, from server point of view, there is no difference between comet > and web socket. > Differs only the common time of being connected. > Comet uses "long polling". The client connects, sends a request, and the server doesn't respond until an event is occurred. The client socket can time out, in which case it reconnects. When the client gets a response, it consumes it and closes the socket. Once the event is processed, the client makes a new long polling connection to the server. Websockets let you use RHTTP. The client connects, sends a request to switch to RHTTP, then becomes an HTTP server. This is a true push model, as opposed to Comet long polling. The remote can push an unlimited number of events back to the client via RHTTP, as the client is now acting as a server. The connection between the client and server is never dropped unless something goes wrong, as opposed to Comet where the connection is dropped once per event at a minimum. -- Tony Arcieri Medioh! A Kudelski Brand From clist@REDACTED Thu Dec 10 23:37:03 2009 From: clist@REDACTED (Angel Alvarez) Date: Thu, 10 Dec 2009 23:37:03 +0100 Subject: questions about lists module implementations. Message-ID: <200912102337.04047.clist@uah.es> Hi Im reading otp sources trying to check my skills as i progress onto the language. Two function got my attention: %% reverse(L) reverse all elements in the list L. Is now a BIF! -spec reverse([T]) -> [T]. reverse([] = L) -> L; reverse([_] = L) -> L; reverse([A, B]) -> [B, A]; reverse([A, B | L]) -> lists:reverse(L, [B, A]). %reverse([H|T], Y) -> % reverse(T, [H|Y]); %reverse([], X) -> X. Well, in fact is not clear for me why current function is a BIF (do BIF functions have precedence over erlang coded ones?) cause being a BIF i dont understand why is still on the lists module source... Is there a risk of calling the wrong function if you make a function named like a BIF? i think of mytest:reverse vs reverse (BIF). why is better than the previous incarnation (commented out).? The second issue comes from the strange way seq is defined. Is that a form of loop unrolling? -spec seq(integer(), integer()) -> [integer()]. seq(First, Last) when is_integer(First), is_integer(Last), First-1 =< Last -> seq_loop(Last-First+1, Last, []). seq_loop(N, X, L) when N >= 4 -> seq_loop(N-4, X-4, [X-3,X-2,X-1,X|L]); seq_loop(N, X, L) when N >= 2 -> seq_loop(N-2, X-2, [X-1,X|L]); seq_loop(1, X, L) -> [X|L]; seq_loop(0, _, L) -> L. /Angel -- Agua para todo? No, Agua para Todos. ->>----------------------------------------------- Clist UAH a.k.a Angel ---------------------------------[www.uah.es]-<<-- From rvirding@REDACTED Fri Dec 11 01:36:33 2009 From: rvirding@REDACTED (Robert Virding) Date: Fri, 11 Dec 2009 01:36:33 +0100 Subject: [erlang-questions] Help with erl_parse / epp In-Reply-To: <20091210174022.GA23683@uk.tiscali.com> References: <20091210155708.GA20461@uk.tiscali.com> <4B212D19.7070108@gmail.com> <20091210174022.GA23683@uk.tiscali.com> Message-ID: <3dbc6d1c0912101636t3c1357a7s23688aa14022b86e@mail.gmail.com> 2009/12/10 Brian Candler > On Thu, Dec 10, 2009 at 06:17:13PM +0100, Richard Carlsson wrote: > > It scans until it has found a "full stop" token, (represented > > as {dot,Line}). In the source, this is a '.' character followed > > by whitespace or eof. For example: > > Thank you, I see now. > > Is there a particular reason why it's better to do it there, rather than in > the grammar? i.e. > > forms -> forms form. > forms -> form. > It is much more versatile if you have it parse one form at a time. Robert From ok@REDACTED Fri Dec 11 03:06:03 2009 From: ok@REDACTED (Richard O'Keefe) Date: Fri, 11 Dec 2009 15:06:03 +1300 Subject: [erlang-questions] questions about lists module implementations. In-Reply-To: <200912102337.04047.clist@uah.es> References: <200912102337.04047.clist@uah.es> Message-ID: On Dec 11, 2009, at 11:37 AM, Angel Alvarez wrote: > > The second issue comes from the strange way seq is defined. > Is that a form of loop unrolling? > > > -spec seq(integer(), integer()) -> [integer()]. > > seq(First, Last) > when is_integer(First), is_integer(Last), First-1 =< Last -> > seq_loop(Last-First+1, Last, []). > > seq_loop(N, X, L) when N >= 4 -> > seq_loop(N-4, X-4, [X-3,X-2,X-1,X|L]); > seq_loop(N, X, L) when N >= 2 -> > seq_loop(N-2, X-2, [X-1,X|L]); > seq_loop(1, X, L) -> > [X|L]; > seq_loop(0, _, L) -> > L. It is precisely an unrolled loop. Not something you want to do in user code, but justifiable in library code if measurements show it pays off. (If you want to see library code chock full of stuff no sane programmer wants to write, but quite justifiably so, take a look at the LAPACK sources some day.) From aduston@REDACTED Fri Dec 11 06:05:28 2009 From: aduston@REDACTED (adam) Date: Thu, 10 Dec 2009 21:05:28 -0800 (PST) Subject: Replicating a distributed database In-Reply-To: <922d05850912072322q1709ddek7f42d76a7ccb1b@mail.gmail.com> References: <922d05850912072322q1709ddek7f42d76a7ccb1b@mail.gmail.com> Message-ID: Ah, okay, got it. I somehow missed the node_pool option. I can do that, then use add_table_copy with each fragment individually to replicate them. Very honored to hear back from a member of the core mnesia team, btw. Thank you. Adam On Dec 8, 2:22?am, H?kan Mattsson wrote: > On Tue, Dec 8, 2009 at 12:09 AM, adam wrote: > > It's interesting: I can't find an answer to this question anywhere. We > > have a table that has fragments evenly distributed between nodes A and > > B. We want to replicate these fragments to nodes C and D, which are on > > separate machines. I believe that the Mnesia API provides no way of > > accomplishing this without unseemly workarounds. Am I wrong? > > > If I start an Mnesia cluster on nodes A, B, C, and D, then as soon as > > I create a fragmented table, Mnesia distributes the fragments evenly > > between nodes A, B, C, and D, so there's a lot of work required with > > add_table_copy to get the fragments in the right place. It appears > > that mnesia ignores the disc_only_copies option when creating a > > fragmented table, only paying attention to n_disc_only_copies in the > > frag_properties option, so I believe there's no nice way to order > > mnesia to put fragments on nodes A and B only. > > > I can start an Mnesia cluster on nodes A and B, create the fragmented > > tables, then add nodes C and D and use add_table_copy. This appears to > > give correct results but is kind of an ugly solution. > > > Am I missing some obvious way to accomplish this? > > Yes, use the node_pool option. It defaults to all nodes in the schema, but you > can use it to control which nodes that initially will be used for the fragmented > table. > > For example, this will create a table with 100 fragments distributed > over the nodes > a and b regardless of how many nodes that are known in the schema: > > mnesia:create_table(f, [{frag_properties, [{n_fragments, 100}, > {n_disc_copies, 2}, > > {node_pool, [a@REDACTED, b@REDACTED]}]}]). > > Take a look at the Mnesia info before and after the call below. > > /H?kan > --- > H?kan Mattsson (0705-199 251) > > (a@REDACTED)10> mnesia:info(). > ---> Processes holding locks <--- > ---> Processes waiting for locks <--- > ---> Participant transactions <--- > ---> Coordinator transactions <--- > ---> Uncertain transactions <--- > ---> Active tables <--- > schema ? ? ? ? : with 1 ? ? ? ?records occupying 432 ? ? ?words of mem > ===> System info in version "4.4.12", debug level = none <=== > opt_disc. Directory "/home/hakan/Mnesia.a@REDACTED" is used. > use fallback at restart = false > running db nodes ? = [d@REDACTED,b@REDACTED,c@REDACTED,a@REDACTED] > stopped db nodes ? = [] > master node tables = [] > remote ? ? ? ? ? ? = [] > ram_copies ? ? ? ? = [] > disc_copies ? ? ? ?= [schema] > disc_only_copies ? = [] > [{a@REDACTED,disc_copies}, > ?{b@REDACTED,disc_copies}, > ?{c@REDACTED,disc_copies}, > ?{d@REDACTED,disc_copies}] = [schema] > 2 transactions committed, 0 aborted, 0 restarted, 0 logged to disc > 0 held locks, 0 in queue; 0 local transactions, 0 remote > 0 transactions waits for other nodes: [] > ok > (a@REDACTED)12> mnesia:create_table(f, [{frag_properties, [{n_fragments, > 100}, {n_disc_copies, 2}, {node_pool, [a@REDACTED, b@REDACTED]}]}]). > {atomic,ok} > (a@REDACTED)13> mnesia:info(). ---> Processes holding locks <--- > ---> Processes waiting for locks <--- > ---> Participant transactions <--- > ---> Coordinator transactions <--- > ---> Uncertain transactions <--- > ---> Active tables <--- > f ? ? ? ? ? ? ?: with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag2 ? ? ? ?: with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag3 ? ? ? ?: with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag4 ? ? ? ?: with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag5 ? ? ? ?: with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag6 ? ? ? ?: with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag7 ? ? ? ?: with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag8 ? ? ? ?: with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag9 ? ? ? ?: with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag10 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag11 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag12 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag13 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag14 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag15 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag16 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag17 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag18 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag19 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag20 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag21 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag22 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag23 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag24 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag25 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag26 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag27 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag28 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag29 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag30 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag31 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag32 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag33 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag34 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag35 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag36 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag37 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag38 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag39 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag40 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag41 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag42 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag43 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag44 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag45 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag46 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag47 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag48 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag49 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag50 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag51 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag52 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag53 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag54 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag55 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag56 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag57 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag58 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag59 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag60 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag61 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag62 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag63 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag64 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag65 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag66 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag67 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag68 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag69 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag70 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag71 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag72 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag73 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag74 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag75 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag76 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag77 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag78 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag79 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag80 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag81 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag82 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag83 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag84 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag85 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag86 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag87 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag88 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag89 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag90 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag91 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag92 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag93 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag94 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag95 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag96 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag97 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag98 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag99 ? ? ? : with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > f_frag100 ? ? ?: with 0 ? ? ? ?records occupying 316 ? ? ?words of mem > schema ? ? ? ? : with 101 ? ? ?records occupying 12167 ? ?words of mem > ===> System info in version "4.4.12", debug level = none <=== > opt_disc. Directory "/home/hakan/Mnesia.a@REDACTED" is used. > use fallback at restart = false > running db nodes ? = [d@REDACTED,b@REDACTED,c@REDACTED,a@REDACTED] > stopped db nodes ? = [] > master node tables = [] > remote ? ? ? ? ? ? = [] > ram_copies ? ? ? ? = [] > disc_copies ? ? ? ?= [f,f_frag10,f_frag100,f_frag11,f_frag12,f_frag13, > ? ? ? ? ? ? ? ? ? ? ? f_frag14,f_frag15,f_frag16,f_frag17,f_frag18,f_frag19, > ? ? ? ? ? ? ? ? ? ? ? f_frag2,f_frag20,f_frag21,f_frag22,f_frag23,f_frag24, > ? ? ? ? ? ? ? ? ? ? ? f_frag25,f_frag26,f_frag27,f_frag28,f_frag29,f_frag3, > ? ? ? ? ? ? ? ? ? ? ? f_frag30,f_frag31,f_frag32,f_frag33,f_frag34,f_frag35, > ? ? ? ? ? ? ? ? ? ? ? f_frag36,f_frag37,f_frag38,f_frag39,f_frag4,f_frag40, > ? ? ? ? ? ? ? ? ? ? ? f_frag41,f_frag42,f_frag43,f_frag44,f_frag45,f_frag46, > ? ? ? ? ? ? ? ? ? ? ? f_frag47,f_frag48,f_frag49,f_frag5,f_frag50,f_frag51, > ? ? ? ? ? ? ? ? ? ? ? f_frag52,f_frag53,f_frag54,f_frag55,f_frag56,f_frag57, > ? ? ? ? ? ? ? ? ? ? ? f_frag58,f_frag59,f_frag6,f_frag60,f_frag61,f_frag62, > ? ? ? ? ? ? ? ? ? ? ? f_frag63,f_frag64,f_frag65,f_frag66,f_frag67,f_frag68, > ? ? ? ? ? ? ? ? ? ? ? f_frag69,f_frag7,f_frag70,f_frag71,f_frag72,f_frag73, > ? ? ? ? ? ? ? ? ? ? ? f_frag74,f_frag75,f_frag76,f_frag77,f_frag78,f_frag79, > ? ? ? ? ? ? ? ? ? ? ? f_frag8,f_frag80,f_frag81,f_frag82,f_frag83,f_frag84, > ? ? ? ? ? ? ? ? ? ? ? f_frag85,f_frag86,f_frag87,f_frag88,f_frag89,f_frag9, > ? ? ? ? ? ? ? ? ? ? ? f_frag90,f_frag91,f_frag92,f_frag93,f_frag94,f_frag95, > ? ? ? ? ? ? ? ? ? ? ? f_frag96,f_frag97,f_frag98,f_frag99,schema] > disc_only_copies ? = [] > [{a@REDACTED,disc_copies},{b@REDACTED,disc_copies}] = [f_frag100,f_frag99,f_frag98, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag97,f_frag96,f_frag95, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag94,f_frag93,f_frag92, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag91,f_frag90,f_frag89, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag88,f_frag87,f_frag86, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag85,f_frag84,f_frag83, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag82,f_frag81,f_frag80, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag79,f_frag78,f_frag77, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag76,f_frag75,f_frag74, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag73,f_frag72,f_frag71, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag70,f_frag69,f_frag68, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag67,f_frag66,f_frag65, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag64,f_frag63,f_frag62, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag61,f_frag60,f_frag59, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag58,f_frag57,f_frag56, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag55,f_frag54,f_frag53, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag52,f_frag51,f_frag50, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag49,f_frag48,f_frag47, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag46,f_frag45,f_frag44, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag43,f_frag42,f_frag41, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag40,f_frag39,f_frag38, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag37,f_frag36,f_frag35, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag34,f_frag33,f_frag32, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag31,f_frag30,f_frag29, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag28,f_frag27,f_frag26, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag25,f_frag24,f_frag23, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag22,f_frag21,f_frag20, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag19,f_frag18,f_frag17, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag16,f_frag15,f_frag14, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag13,f_frag12,f_frag11, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag10,f_frag9,f_frag8, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag7,f_frag6,f_frag5, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?f_frag4,f_frag3,f_frag2,f] > [{a@REDACTED,disc_copies}, > ?{b@REDACTED,disc_copies}, > ?{c@REDACTED,disc_copies}, > ?{d@REDACTED,disc_copies}] = [schema] > 3 transactions committed, 1 aborted, 0 restarted, 1 logged to disc > 0 held locks, 0 in queue; 0 local transactions, 0 remote > 0 transactions waits for other nodes: [] > ok > (a@REDACTED)14> > > ________________________________________________________________ > erlang-questions mailing list. Seehttp://www.erlang.org/faq.html > erlang-questions (at) erlang.org From bgustavsson@REDACTED Fri Dec 11 06:44:42 2009 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Fri, 11 Dec 2009 06:44:42 +0100 Subject: [erlang-questions] questions about lists module implementations. In-Reply-To: <200912102337.04047.clist@uah.es> References: <200912102337.04047.clist@uah.es> Message-ID: <6672d0160912102144r48db793cn827327d3f2808db2@mail.gmail.com> On Thu, Dec 10, 2009 at 11:37 PM, Angel Alvarez wrote: > %% reverse(L) reverse all elements in the list L. Is now a BIF! The comment is badly phrased. lists:reverse/1 is ordinary Erlang code. lists:reverse/2 is a BIF. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From rapsey@REDACTED Fri Dec 11 07:12:52 2009 From: rapsey@REDACTED (Rapsey) Date: Fri, 11 Dec 2009 07:12:52 +0100 Subject: [Erlyaws-list] yaws by-passes appmod after cashing In-Reply-To: <20091211005609.159690@gmx.net> References: <20091211005609.159690@gmx.net> Message-ID: <97619b170912102212p1ed00b5dwa802532e53b7e724@mail.gmail.com> Well it is a bit of a strange way to handle requests. If you have a root appmod, why not just handle everything in the appmod? If it helps, my appmod out script looks like this: % all static files are in static directory out(#arg{appmoddata = "static/" ++ _} = A) -> {page, [$/|A#arg.appmoddata]}; % scripts do something, but don't produce an output (always a redirect to an appmod page) out(#arg{appmoddata = "script/" ++ Rem} = A) -> my_scripts:out(Rem, A); out(#arg{appmoddata = "profile"} = A) -> display_profile(A); out(#arg{appmoddata = "register"} = A) -> display_register(A); .... Registration for instance, POST is always to /script/register, which tries to perform a registration, if successful it redirects to the next page, if unsuccessful it redirects to /register (setting an error cookie) to display the registration form again. Sergej On Fri, Dec 11, 2009 at 1:56 AM, "J?rg Maushake" wrote: > Hello, can anyone give some support? > > I've to admit that iam relatively new to erlang. > Yesterday i did some yaws experiments: > > I configured a module to be a root appmod and expected this appmod to be > invoked for all requests. > This seemed to work fine at first glance but then i explored the following > (Yaws-1.85) > The case > 1) user submits a form (method post) > 2) yaws invokes the appmod > 3) the appmod's out function returns {page, "/something.yaws"} > 4) yaws processes "/something.yaws" and cashes the outcome (the cashed > outcome includes url type yaws not appmod) > 5) browser displays the outcome to user > 6) user steps back to the form using the browser back button and > re-submits the form (and enters some different values prior to submitting) > 7) yaws handles the 'POST' and looks up the cashed outcome with the > url-type yaws and not appmod > 8) yaws does not invoke the appmod. So the appmod can't process the input > parameters. > > Is there a bug tracking system available where i should enter this > observation ? > > Thanks in advance > > Regards J?rg Maushake > -- > Preisknaller: GMX DSL Flatrate f?r nur 16,99 Euro/mtl.! > http://portal.gmx.net/de/go/dsl02 > > > ------------------------------------------------------------------------------ > Return on Information: > Google Enterprise Search pays you back > Get the facts. > http://p.sf.net/sfu/google-dev2dev > _______________________________________________ > Erlyaws-list mailing list > Erlyaws-list@REDACTED > https://lists.sourceforge.net/lists/listinfo/erlyaws-list > From kenji.rikitake@REDACTED Fri Dec 11 08:48:54 2009 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Fri, 11 Dec 2009 16:48:54 +0900 Subject: Tidier - when is the public release? Message-ID: <20091211074854.GA36351@k2r.org> I've just read the following two papers of Konstantinos (Kostis) Sagonas and Thanassis Avgerinos, which are also a very good example of Erlang refactoring and coding styles: Sagonas, K. and Avgerinos, T. 2009. Automatic refactoring of Erlang programs. In Proceedings of the 11th ACM SIGPLAN Conference on Principles and Practice of Declarative Programming (Coimbra, Portugal, September 07 - 09, 2009). PPDP '09. ACM, New York, NY, 13-24. DOI= http://doi.acm.org/10.1145/1599410.1599414 Also available at: http://www.ece.cmu.edu/~aavgerin/papers/PPDP09.pdf Avgerinos, T. and Sagonas, K. 2009. Cleaning up Erlang code is a dirty job but somebody's gotta do it. In Proceedings of the 8th ACM SIGPLAN Workshop on ERLANG (Edinburgh, Scotland, September 05 - 05, 2009). ERLANG '09. ACM, New York, NY, 1-10. DOI= http://doi.acm.org/10.1145/1596600.1596602 Also available at: http://www.ece.cmu.edu/~aavgerin/papers/Erlang09.pdf So my question: when will be the first public release of Tidier? I really want to give it a try, after reading the paper. Kenji Rikitake From hakan@REDACTED Fri Dec 11 09:47:13 2009 From: hakan@REDACTED (=?ISO-8859-1?Q?H=E5kan_Mattsson?=) Date: Fri, 11 Dec 2009 09:47:13 +0100 Subject: [erlang-questions] Re: Replicating a distributed database In-Reply-To: References: <922d05850912072322q1709ddek7f42d76a7ccb1b@mail.gmail.com> Message-ID: <922d05850912110047j5d4908e0wb20442a8a24c42df@mail.gmail.com> On Fri, Dec 11, 2009 at 6:05 AM, adam wrote: > Ah, okay, got it. I somehow missed the node_pool option. I can do > that, then use add_table_copy with each fragment individually to > replicate them. It is simpler than that. You do not need to use mnesia:add_table_copy/3 if you want to create a fragmented table where all fragments are replicated to 2 given nodes. This command mnesia:create_table(f, [{frag_properties, [{n_fragments, 100}, {n_disc_copies, 2}, {node_pool, [a@REDACTED, b@REDACTED]}]}]). will create a table with 100 fragments where each fragment will have 2 replicas (one on node a and the other on node b) with storage type disc_copies. /H?kan From B.Candler@REDACTED Fri Dec 11 10:57:43 2009 From: B.Candler@REDACTED (Brian Candler) Date: Fri, 11 Dec 2009 09:57:43 +0000 Subject: [erlang-questions] Help with erl_parse / epp In-Reply-To: References: <20091210155708.GA20461@uk.tiscali.com> Message-ID: <20091211095742.GA8773@uk.tiscali.com> On Thu, Dec 10, 2009 at 08:52:21AM -0800, Jacob Vorreuter wrote: > You can check out my EUC presentation if you're interested in this kind of > stuff: http://jacobvorreuter.com/hacking-erlang-at-euc-2009 This is very helpful, thank you. I also discovered erl_pp - it's cool to be able to take your "dingbats" language and turn it back into erlang source :-) I have one more question if you don't mind. In the documentation of the abstract form, it says that if a module is compiled with debug_info, the abstract form is available as a "chunk" named abstract_code. Is it possible to get at this at runtime, after a module has been loaded? I found beam_lib:chunks, but I have only been able to get it to work with the beam *file* rather than the loaded module. 7> l(rfe_cmd). {module,rfe_cmd} 8> beam_lib:chunks(rfe_cmd, [abstract_code]). {error,beam_lib,{file_error,"rfe_cmd.beam",enoent}} 9> beam_lib:version(rfe_cmd). {error,beam_lib,{file_error,"rfe_cmd.beam",enoent}} Clearly, it's trying to read from the beam file, As it happens, the beam file is under ebin/, which is in my -pa(th). It works if I give the full filename: 10> beam_lib:chunks("ebin/rfe_cmd.beam", [abstract_code]). But is it possible to get this chunk from the from the loaded module, or is it too late by that stage? BTW, I am running R13B01 as packaged by Ubuntu Karmic. Thanks, Brian. From erlang@REDACTED Fri Dec 11 11:07:38 2009 From: erlang@REDACTED (Joe Armstrong) Date: Fri, 11 Dec 2009 11:07:38 +0100 Subject: [erlang-questions] Preventing calling some functions In-Reply-To: References: <4B20D640.3030902@geodesic.com> Message-ID: <9b08084c0912110207r7c2b6653p85738250583c57dd@mail.gmail.com> It's a but tricky but doable. You need to do a parse transform of the source code, the parse transform can decide which functions are legal. Suppose you don' t want to call gen_tcp:listen then you do a parse transform that looks for gen_tcp:listen and replaces it with exit(badArg) or whatever. Now suppose somebody want to break this and writes: F = list_to_atom("listen"), receive {From, M} -> M:F(...) You transform this into: F = list_to_atom("listen"), receive {From, M} -> check_call(M, F, ...) where check_call(gen_tcp, listen, ...) -> exit(badArg); check_call(M, F, A) -> apply(M, F, A) Certain checks can be done statically, others at run time. Sandboxing things like spawn and list_to_atom which are potentially dangerous is much more difficult - so it all depends on what you want to do. There is also a technique for allowing two plugins to use the same namespace without colliding The basic idea is to transform the module name to the MD5 of the module content in a consistent way. I have experimented with this, see: http://github.com/joearms/elib1/blob/master/supported/versions/versions.html The general problem is difficult - which is probably why there are no standard libraries for this. Specific problems like "only dissallowing calls to gen_tcop:listen" is easier (though there might be some problem with dynamic code upgrade, I haven't thought so much about Cheers /Joe On Thu, Dec 10, 2009 at 3:41 PM, Brentley Jones wrote: > > On Dec 10, 2009, at 5:06 AM, Kiran Khaladkar wrote: > >> hi, >> I have a server written in which i allow erlang plugins also. But the problem is i dont want the plugin code the call certain functions such as 'gen_tcp:listen' etc .. The plugin writer should not be able to call certain functions thought he might know all the erlang lib. >> Can anyone suggest a way to do such a thing?? >> regards, >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> > > Now, don't take what I say as definitive, since I'm still sort of new to Erlang myself, but I don't think that what you are asking is currently possible. I myself was asking the same question just a couple says ago [1], with the same intent as you (I want to have plugins/scripts that are sandboxed). > > One solution would be the implementation of reified environments [2]. I personally believe that their implementation would allow for a much safer Erlang, allowing for the possibility of sandboxed environments that know only about modules that you want it to know about. For example, the plugins could be exposed only to your custom modules plus a few BIFs, if you so wanted. > > Maybe someone knows something that I don't though. > > - Brentley Jones > > > [1] http://groups.google.com/group/erlang-programming/browse_frm/thread/e0b6a4b60ce03469/b07ec46a989bcd9c > > [2] http://www.erlang.org/pipermail/erlang-questions/2006-November/023879.html > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From erlang@REDACTED Fri Dec 11 11:26:32 2009 From: erlang@REDACTED (Joe Armstrong) Date: Fri, 11 Dec 2009 11:26:32 +0100 Subject: Erlang in the mist Message-ID: <9b08084c0912110226o61499b3t618a6197abf89f64@mail.gmail.com> I want to build an Erlang mist. I want to experiment with "many" Erlangs on one machine (note *not* distributed Erlang). So I need to be able to start and stop the Erlangs and manage them. Questions: - Anybody got any code that does this? - How many Erlangs per Gigabyte can I start? (assume they just start and do nothing) - Where does standard output go when there is nobody to watch? /Joe From vladdu55@REDACTED Fri Dec 11 11:31:57 2009 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 11 Dec 2009 11:31:57 +0100 Subject: [erlang-questions] Preventing calling some functions In-Reply-To: <9b08084c0912110207r7c2b6653p85738250583c57dd@mail.gmail.com> References: <4B20D640.3030902@geodesic.com> <9b08084c0912110207r7c2b6653p85738250583c57dd@mail.gmail.com> Message-ID: <95be1d3b0912110231q171c07fk8bcda97fefac2eeb@mail.gmail.com> Hi, On Fri, Dec 11, 2009 at 11:07, Joe Armstrong wrote: > It's a but tricky but doable. > You need to do a parse transform of the source code, the parse transform can > decide which functions are legal. This only addresses calling code, but one might even want to be able to filter out certain processes so that messages can't be sent to them (given that many APIs can be bypassed by directly sending a message to the process that handles the functionality). This is much more difficult to do. If the plugin doesn't use processes, then it's possible to filter out all 'send's with the parse transform above, but if they must be able to communicate with some processes but not with others, then the current architecture makes it difficult without support from the VM. It is interesting to think about creating "process sandboxes" inside the VM, where processes aren't allowed to communicate across the boundaries (some API should allow to specify exceptions, otherwise they would be utterly useless). This can be achieved today by using a separate VM and a custom communication layer, but it feels too heavyweight if we are talking about running possibly many small plugins. best regards, Vlad From puzza007@REDACTED Fri Dec 11 11:34:57 2009 From: puzza007@REDACTED (Paul Oliver) Date: Fri, 11 Dec 2009 10:34:57 +0000 Subject: ODBC memory errors on 32 bit Linux. Message-ID: Hi all, I'm getting glibc memory corruption errors using R13B03 on 32-bit Ubuntu. I notice an old-ish Trapexit post that mentions these on 64-bit Linux (http://www.trapexit.org/forum/viewtopic.php?p=43983). Has anyone else come across these recently? If so, is there anything I can try to prevent this? poliver@REDACTED:/space/poliver/otp_src_R13B03$ grep CONFIG_X86_[36] /boot/config-2.6.31-16-generic CONFIG_X86_32=y # CONFIG_X86_64 is not set CONFIG_X86_32_SMP=y # CONFIG_X86_32_NON_STANDARD is not set poliver@REDACTED:/space/poliver/otp_src_R13B03$ glibc detected *** /opt/otp_R13B03/lib/erlang/lib/odbc-2.10.6/priv/bin/odbcserver: malloc(): memory corruption: 0x09186250 *** See the attached log for a full backtrace. Cheers, Paul. -------------- next part -------------- A non-text attachment was scrubbed... Name: backtrace.log Type: text/x-log Size: 7162 bytes Desc: not available URL: From w.a.de.jong@REDACTED Fri Dec 11 11:49:01 2009 From: w.a.de.jong@REDACTED (Willem de Jong) Date: Fri, 11 Dec 2009 11:49:01 +0100 Subject: [erlang-questions] Yaws_soap_lib and wsdl imports In-Reply-To: <1C99D95E-E31E-4C37-B0D9-A328CF1B2A51@gmail.com> References: <1C99D95E-E31E-4C37-B0D9-A328CF1B2A51@gmail.com> Message-ID: <407d9ef80912110249j7112864dm3896d6e242a9958c@mail.gmail.com> Hi, It does handle imports statements, but with limitations ... I had a look at it, and I think there are 2 problems with this example: - it imports the schema for XMLSchema without giving a location. This could easily be fixed, but it would't solve the other problem: - in the Schema part of Listing4, a reference is made to a type from Listing5. This doesn't work right now, and it is not so easy to fix this. In general, I would say that in such a case it would be better practice to import it by means of an XSD import, rather than a WSDL import. Since this WSDL is just an example from a website, I am not very keen to spend a lot of time on it. Do you have a concrete problem? If so, you could maybe send me the actual WSDL (or a version that reproduces the problem). Regards, Willem On Thu, Dec 10, 2009 at 5:18 PM, Mikael Laaksonen < mikael.laaksonen@REDACTED> wrote: > Hello, > I am have trouble working with wsdl-files in yaws_soap_lib when they have > import-statements. Does yaws handle import statements in wsdl:s? > > An example taken from: > http://www.ibm.com/developerworks/xml/library/ws-tip-imports.html > > Thankful for all help. > > /Mikael Laakosnen > > > ps. Sorry if I'm spamming but I can't seem get my post through. > > > ------------------------------------------------------------------------- > (ml@REDACTED)10> yaws_soap_lib:initModel("[...path_to_fil...]/listing4.wsdl"). > ** exited: {{badmatch,{error,"Include file not found (undefined)"}}, > [{yaws_soap_lib,addSchemas,5}, > {yaws_soap_lib,parseWsdls,5}, > {yaws_soap_lib,initModel2,5}, > {erl_eval,do_apply,5}, > {shell,exprs,6}, > {shell,eval_loop,3}]} ** > > > > ------------------------------------------------------------------------- > Listings4 > ------------------------------------------------------------------------- > > xmlns:tns="urn:listing4" > xmlns:listing5="urn:listing5" > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> > > > > > xmlns:listing5="urn:listing5" > xmlns:xsd="http://www.w3.org/2001/XMLSchema"> > > > > > > > > type="listing5:Phone" > /> > > > > > > > > > > > > > > > > type="listing5:Phone" > /> > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > Listings5 > --------------------------------------------------------------------- > > > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" > xmlns:xsd="http://www.w3.org/2001/XMLSchema"> > > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"> > > > > > > > > > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From vladdu55@REDACTED Fri Dec 11 11:58:37 2009 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 11 Dec 2009 11:58:37 +0100 Subject: "typer" documentaion Message-ID: <95be1d3b0912110258ic267249k99b4787efd94fed7@mail.gmail.com> Hi, Is there a reason why typer has no documentation and isn't even mentioned in the docs? Not even the search engine at demo.erlang.org finds any reference... regards, Vlad From kostis@REDACTED Fri Dec 11 12:06:24 2009 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 11 Dec 2009 12:06:24 +0100 Subject: [erlang-questions] Tidier - when is the public release? In-Reply-To: <20091211074854.GA36351@k2r.org> References: <20091211074854.GA36351@k2r.org> Message-ID: <4B2227B0.502@cs.ntua.gr> Kenji Rikitake wrote: > I've just read the following two papers of Konstantinos (Kostis) Sagonas > and Thanassis Avgerinos, which are also a very good example of Erlang > refactoring and coding styles: Thanks for your kind comments! Of course I am very partial, but I strongly recommend reading the following two papers to anybody interested in writing better Erlang programs. > Sagonas, K. and Avgerinos, T. 2009. Automatic refactoring of Erlang > programs. In Proceedings of the 11th ACM SIGPLAN Conference on > Principles and Practice of Declarative Programming (Coimbra, Portugal, > September 07 - 09, 2009). PPDP '09. ACM, New York, NY, 13-24. DOI= > http://doi.acm.org/10.1145/1599410.1599414 > Also available at: > http://www.ece.cmu.edu/~aavgerin/papers/PPDP09.pdf > > Avgerinos, T. and Sagonas, K. 2009. Cleaning up Erlang code is a dirty > job but somebody's gotta do it. In Proceedings of the 8th ACM SIGPLAN > Workshop on ERLANG (Edinburgh, Scotland, September 05 - 05, > 2009). ERLANG '09. ACM, New York, NY, 1-10. DOI= > http://doi.acm.org/10.1145/1596600.1596602 > Also available at: > http://www.ece.cmu.edu/~aavgerin/papers/Erlang09.pdf > > So my question: when will be the first public release of Tidier? > > I really want to give it a try, after reading the paper. We have no current plans to make tidier freely available as a tool that users can download. (Though to a very small number of companies and individuals who have been very eager to try the tool on their code bases and have contacted us privately, we have sold user licenses.) However, we strongly want to encourage the /free use of tidier/ in open source Erlang code bases. It has long been on our TODO list to create a web site for tidier where users can upload their code and either get it back cleaned up automatically or interactively clean up their code by cherry-picking the refactorings that they fancy. Unfortunately, this plan has not materialized, partly due to being extremely busy with other stuff (for example, this is what happens when one starts a Ph.D. in another country) but mostly due to the lab machines that would host the site being in a state of upgrade for a long time now. If all goes as planned, we expect that we'll have the site for tidier up and running sometime in the beginning of January. There will be an announcement on this list. Till then -- or for projects which are not open source -- obtaining a user license is the only available option. Kostis From roberto.aloi@REDACTED Fri Dec 11 12:28:24 2009 From: roberto.aloi@REDACTED (Roberto Aloi) Date: Fri, 11 Dec 2009 11:28:24 +0000 (GMT) Subject: [erlang-questions] Tidier - when is the public release? In-Reply-To: <4B2227B0.502@cs.ntua.gr> Message-ID: <23888550.92881260530904961.JavaMail.root@zimbra> Hi Kostis, > It has long been on our TODO list to create a > web site for tidier where users can upload their code and either get it > back cleaned up automatically or interactively clean up their code by > cherry-picking the refactorings that they fancy. This would be simply great. Are you planning to offer a set of API for such a service? -- Roberto Aloi roberto.aloi@REDACTED http://www.erlang-consulting.com From bengt.kleberg@REDACTED Fri Dec 11 13:07:48 2009 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 11 Dec 2009 13:07:48 +0100 Subject: [erlang-questions] Erlang in the mist In-Reply-To: <9b08084c0912110226o61499b3t618a6197abf89f64@mail.gmail.com> References: <9b08084c0912110226o61499b3t618a6197abf89f64@mail.gmail.com> Message-ID: <1260533269.9474.17.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Greetings, The problem has (partly) been solved for Solaris. See http://erlang.org/doc/man/run_erl.html bengt PS Thank you very much for a most interesting Erlang User Group presentation yesterday. DS On Fri, 2009-12-11 at 11:26 +0100, Joe Armstrong wrote: > I want to build an Erlang mist. > > I want to experiment with "many" Erlangs > on one machine (note *not* distributed Erlang). > > So I need to be able to start and stop the Erlangs and manage them. > > Questions: > > - Anybody got any code that does this? > - How many Erlangs per Gigabyte can I start? (assume they just > start and do nothing) > - Where does standard output go when there is nobody to watch? > > > /Joe > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From max.lapshin@REDACTED Fri Dec 11 13:16:25 2009 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 11 Dec 2009 15:16:25 +0300 Subject: [erlang-questions] Erlang in the mist In-Reply-To: <1260533269.9474.17.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> References: <9b08084c0912110226o61499b3t618a6197abf89f64@mail.gmail.com> <1260533269.9474.17.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Message-ID: On Fri, Dec 11, 2009 at 3:07 PM, Bengt Kleberg wrote: > Greetings, > > The problem has (partly) been solved for Solaris. See > http://erlang.org/doc/man/run_erl.html > Haven't you tried to adapt erlang to run with runit. It closes stdin and this seems to crash erlang. From marc@REDACTED Fri Dec 11 13:22:50 2009 From: marc@REDACTED (Marc Worrell) Date: Fri, 11 Dec 2009 13:22:50 +0100 Subject: The Erlang CMS Zotonic version 0.2.0 has been released. Message-ID: <0120DED4-4155-4672-A76F-8CDB83812F2A@worrell.nl> Hello Erlang users, We are proud to announce our second release, Zotonic 0.2.0. The zip file can be downloaded from Google code: http://code.google.com/p/zotonic/downloads/list Please read on for the release notes. Kind regards, The zotonic team, Marc Worrell Tim Benniks Arjan Scherpenisse Zotonic, release 0.2.0, released on 2009-12-11 ---------------------------------------------- * New modules: ** mod_broadcast Send system messages to all users which are currently logged in in the Zotonic admin. ** mod_calendar Shows event resources in a week-overview, and generates ICalendar feeds. ** mod_mailinglist Module which allows you to define groups of recipients and send mailings to them. Can also send via the unix sendmail program. ** mod_twitter Receives feeds for Zotonic persons, using the Twitter streaming API. * New core features: ** "catinclude" and "all catinclude" tags These include templates based on the category of a resource. Used in the admin to create custom fields based on category. http://zotonic.com/documentation/760/catinclude ** Query search model Generate lists of resources on the fly. Used in mod_atom_feed to generate atom feeds, and has an API entrypoint, /api/search. http://zotonic.com/documentation/761/the-query-search-model ** More template filters: in_future, in_past, rand, twitter, escape_ical * Bugfixes: ** Dynamic postgresql pool size, based on system load (issue #4) ** Issue in postgres pooling on stresstesting (#15) ** Uploaded files now get a proper mime type and extension (#5) ** And other issues: #2, #3, #9, #11, #14, #19, #20 From maruthavanan_s@REDACTED Fri Dec 11 14:50:14 2009 From: maruthavanan_s@REDACTED (maruthavanan s) Date: Fri, 11 Dec 2009 08:50:14 -0500 Subject: Read and delete file Message-ID: Hi, I am opening a file using file and I read the file line by line using io:get_line. But after reading this line I need to delete the read line from the file. Appreciate you help. Thanks, Marutha From bengt.kleberg@REDACTED Fri Dec 11 15:44:52 2009 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 11 Dec 2009 15:44:52 +0100 Subject: [erlang-questions] Read and delete file In-Reply-To: References: Message-ID: <1260542692.9474.35.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Greetings, The simplest way, if you can have the whole file in memory, would be to read all lines, handle a single line and then write all the remaining lines out to the file. Then repeat. Use file:read_file/1 (split the line from the binary) and file:write_file/2. bengt On Fri, 2009-12-11 at 08:50 -0500, maruthavanan s wrote: > Hi, > > I am opening a file using file and I read the file line by line using io:get_line. > But after reading this line I need to delete the read line from the file. > > Appreciate you help. > > Thanks, > Marutha > From vladdu55@REDACTED Fri Dec 11 15:57:45 2009 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 11 Dec 2009 15:57:45 +0100 Subject: dialyzer option -Wrace_conditions is not documented Message-ID: <95be1d3b0912110657g52463183y2302645c914ee440@mail.gmail.com> --apps is not documented either. Only the release notes mention them... best regards, Vlad From kostis@REDACTED Fri Dec 11 16:01:59 2009 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 11 Dec 2009 16:01:59 +0100 Subject: [erlang-questions] dialyzer option -Wrace_conditions is not documented In-Reply-To: <95be1d3b0912110657g52463183y2302645c914ee440@mail.gmail.com> References: <95be1d3b0912110657g52463183y2302645c914ee440@mail.gmail.com> Message-ID: <4B225EE7.6070802@cs.ntua.gr> Vlad Dumitrescu wrote: > --apps is not documented either. > > Only the release notes mention them... The issue has been discussed in this list before and has already been fixed in the development version. The R13B04 manual will include documentation about these options. Kostis From vladdu55@REDACTED Fri Dec 11 16:01:57 2009 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 11 Dec 2009 16:01:57 +0100 Subject: status of EEPs Message-ID: <95be1d3b0912110701q269aac6at666356a6e2baf88b@mail.gmail.com> Hi, I was about to ask why there is no documentation regarding -type and -spec except for the EEP 8 text, but looking closer I see that the EEP isn't even accepted. And even those that have been accepted and finalized are still marked as "draft". Shouldn't the EEPs that are part of the distribution (even as experimental implementations) be marked somehow as such? And shouldn't the documentation explain them, in the worst case by linking to the EEP text? Other experimental features are documented... What is really the status of EEP8? Simply put, is it just a miss, or is there a reason for this? best regards, Vlad From vladdu55@REDACTED Fri Dec 11 16:03:05 2009 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 11 Dec 2009 16:03:05 +0100 Subject: [erlang-questions] dialyzer option -Wrace_conditions is not documented In-Reply-To: <4B225EE7.6070802@cs.ntua.gr> References: <95be1d3b0912110657g52463183y2302645c914ee440@mail.gmail.com> <4B225EE7.6070802@cs.ntua.gr> Message-ID: <95be1d3b0912110703g13acf4bdp838f8c55aeca66de@mail.gmail.com> On Fri, Dec 11, 2009 at 16:01, Kostis Sagonas wrote: > The issue has been discussed in this list before and has already been > fixed in the development version. The R13B04 manual will include > documentation about these options. Oh, sorry for the noise, I missed that... regards, Vlad From doug.fort@REDACTED Fri Dec 11 16:16:07 2009 From: doug.fort@REDACTED (Doug Fort) Date: Fri, 11 Dec 2009 10:16:07 -0500 Subject: new ssl vs embedded mode Message-ID: <5db086ad0912110716j134c7dfbha2393eccce56e56e@mail.gmail.com> Our company (SpiderOak) is developing an SSL proxy in Erlang. We have discovered that the new ssl implementation {ssl_imp, new} is much more efficient for our purposes than the standard ssl. Everything works fine in interactive mode, but when we try to run the release in embedded mode we fail trying to read the certificate: SSL: 995: error:{badmatch,{error,undef}} [{ssl_manager,cache_pem_file,1}, {ssl_certificate, file_to_certificats,1}, {ssl_connection,init_certificates,4}, {ssl_connection,ssl_init,2}, {ssl_connection,init,1}, {gen_fsm,init_it,6}, {proc_lib,init_p_do_apply,3}] AFAIK the ssl_manager is not used by new_ssl. If we comment out the {ssl_imp, new} in ssl:listen, once again everything works fine. So my question is: is it just too early to mess with new_ssl, or is there some way to work around this? Thanks -- Doug Fort, Consulting Programmer http://www.dougfort.com Sent from Arlington, VA, United States From james.hague@REDACTED Fri Dec 11 16:31:19 2009 From: james.hague@REDACTED (James Hague) Date: Fri, 11 Dec 2009 09:31:19 -0600 Subject: inlining math:pi() Message-ID: I tend to use math:pi/0 a lot in code I'm writing. The math module is essentially all BIFs, except math:pi/0, which is simple: pi() -> 3.1415926535897932. If this constant could simply be inlined at compile time, it would improve the generated code quite a bit. Two examples: 1. "math:pi() * 2" could be a constant, instead of a call to an external function and causing a float to be heap allocated. 2. "{100.0, 50.0, math:pi()}" could be a constant term, instead of having to be constructed at runtime. Perhaps there's a more general need for what are essentially "constant BIFs"? James From hynek@REDACTED Fri Dec 11 17:23:02 2009 From: hynek@REDACTED (Hynek Vychodil) Date: Fri, 11 Dec 2009 17:23:02 +0100 Subject: [erlang-questions] Erlang in the mist In-Reply-To: References: <9b08084c0912110226o61499b3t618a6197abf89f64@mail.gmail.com> <1260533269.9474.17.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Message-ID: <4d08db370912110823x64d36a45j314cd853c3c30496@mail.gmail.com> On Fri, Dec 11, 2009 at 1:16 PM, Max Lapshin wrote: > On Fri, Dec 11, 2009 at 3:07 PM, Bengt Kleberg > wrote: >> Greetings, >> >> The problem has (partly) been solved for Solaris. See >> http://erlang.org/doc/man/run_erl.html >> > > > Haven't you tried to adapt erlang to run with runit. It closes stdin > and this seems to crash erlang. > > Have you tried -noinput option? -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try Good Data now for free: www.gooddata.com From kiran.khaladkar@REDACTED Fri Dec 11 16:39:03 2009 From: kiran.khaladkar@REDACTED (Kiran Khaladkar) Date: Fri, 11 Dec 2009 21:09:03 +0530 Subject: [erlang-questions] Preventing calling some functions In-Reply-To: <95be1d3b0912110231q171c07fk8bcda97fefac2eeb@mail.gmail.com> References: <4B20D640.3030902@geodesic.com> <9b08084c0912110207r7c2b6653p85738250583c57dd@mail.gmail.com> <95be1d3b0912110231q171c07fk8bcda97fefac2eeb@mail.gmail.com> Message-ID: <4B226797.9070007@geodesic.com> Vlad Dumitrescu wrote: > Hi, > > On Fri, Dec 11, 2009 at 11:07, Joe Armstrong wrote: > >> It's a but tricky but doable. >> You need to do a parse transform of the source code, the parse transform can >> decide which functions are legal. >> > > This only addresses calling code, but one might even want to be able > to filter out certain processes so that messages can't be sent to them > (given that many APIs can be bypassed by directly sending a message to > the process that handles the functionality). > > This is much more difficult to do. If the plugin doesn't use > processes, then it's possible to filter out all 'send's with the parse > transform above, but if they must be able to communicate with some > processes but not with others, then the current architecture makes it > difficult without support from the VM. > > It is interesting to think about creating "process sandboxes" inside > the VM, where processes aren't allowed to communicate across the > boundaries (some API should allow to specify exceptions, otherwise > they would be utterly useless). This can be achieved today by using a > separate VM and a custom communication layer, but it feels too > heavyweight if we are talking about running possibly many small > plugins. > > best regards, > Vlad > i suggest ideal solution could be using spown_opts for setting some flags in VM to define what a process can/cannot do :) for the time being i will have to go ahead with the code transforms as Joe suggested thanks guys, From tony@REDACTED Fri Dec 11 18:30:57 2009 From: tony@REDACTED (Tony Arcieri) Date: Fri, 11 Dec 2009 10:30:57 -0700 Subject: [erlang-questions] inlining math:pi() In-Reply-To: References: Message-ID: Use a macro? On Fri, Dec 11, 2009 at 8:31 AM, James Hague wrote: > I tend to use math:pi/0 a lot in code I'm writing. The math module is > essentially all BIFs, except math:pi/0, which is simple: > > pi() -> 3.1415926535897932. > > If this constant could simply be inlined at compile time, it would > improve the generated code quite a bit. Two examples: > > 1. "math:pi() * 2" could be a constant, instead of a call to an > external function and causing a float to be heap allocated. > 2. "{100.0, 50.0, math:pi()}" could be a constant term, instead of > having to be constructed at runtime. > > Perhaps there's a more general need for what are essentially "constant > BIFs"? > > James > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > -- Tony Arcieri Medioh! A Kudelski Brand From n.decker@REDACTED Fri Dec 11 18:39:31 2009 From: n.decker@REDACTED (Decker, Nils) Date: Fri, 11 Dec 2009 18:39:31 +0100 Subject: AW: [erlang-questions] Preventing calling some functions In-Reply-To: <4B226797.9070007@geodesic.com> References: <4B20D640.3030902@geodesic.com> <9b08084c0912110207r7c2b6653p85738250583c57dd@mail.gmail.com> <95be1d3b0912110231q171c07fk8bcda97fefac2eeb@mail.gmail.com> <4B226797.9070007@geodesic.com> Message-ID: > -----Urspr?ngliche Nachricht----- > Von: erlang-questions@REDACTED > [mailto:erlang-questions@REDACTED] Im Auftrag von Kiran Khaladkar > Gesendet: Freitag, 11. Dezember 2009 16:39 > An: Vlad Dumitrescu > Cc: Joe Armstrong; Brentley Jones; erlang-questions@REDACTED > Betreff: Re: [erlang-questions] Preventing calling some functions > i suggest > ideal solution could be using spown_opts for setting some > flags in VM to define what a process can/cannot do :) for the > time being i will have to go ahead with the code transforms > as Joe suggested thanks guys, A while ago while reading "Pure functional data structures" from Chris Okasaki i tried to find a way to implement them in erlang. A lot of those structures depend on lazy evaluation. The result of the evaluation has to replace the deferred value in the original datastructure to avoid evaluating it many times. This update does not change the meaning but the representation of the structure. >From my point of view two things would be needed: - a way to replace a fun () -> ... end somewhere in the datastructure with the result of this function. This breaks erlangs immutable values and possibly the GC and other things? - a "no side effect" mode of evaluation for the funs. Any bifs doing sideeffects, spawn, send, get, put would be disallowed. This mode would be nice for untrusted code too... (btw: list_to_atom would be disallowed, list_to_existing_atom could be allowed) This model gets difficult when a datastructure is sent to another process. Probably the only practical way would be to copy the whole structure (like it is now) and reevaluate the deferred values in all processes seperately. Nils Decker From kagato@REDACTED Fri Dec 11 20:01:19 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Fri, 11 Dec 2009 11:01:19 -0800 Subject: [erlang-questions] Help with erl_parse / epp In-Reply-To: <20091211095742.GA8773@uk.tiscali.com> References: <20091210155708.GA20461@uk.tiscali.com> <20091211095742.GA8773@uk.tiscali.com> Message-ID: <4B955E04-CCA6-448A-A1E0-A448D45184B1@souja.net> I don't think that it's possible to extract the chunk from the loaded module, but you can easily get the path to the beam file that was loaded with code:which/1. Note that some modules are "built-in" (i.e. pre-loaded in Erlang parlance). These modules return the atom 'preloaded', but otherwise, you can easily get that beam file. Good luck. On Dec 11, 2009, at 1:57 AM, Brian Candler wrote: > But is it possible to get this chunk from the from the loaded module, or is > it too late by that stage? > > BTW, I am running R13B01 as packaged by Ubuntu Karmic. > > Thanks, > > Brian. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org -- Jayson Vantuyl kagato@REDACTED From tanmaykm@REDACTED Fri Dec 11 20:27:17 2009 From: tanmaykm@REDACTED (Tanmay K. Mohapatra) Date: Sat, 12 Dec 2009 00:57:17 +0530 Subject: [erlang-questions] ODBC error after SQL_NO_DATA_FOUND In-Reply-To: <785f88f70912100731i389b7435s6a83d4b23954c6e5@mail.gmail.com> References: <1cefc2f9-6a7d-49d0-8ce0-d98de33c78c6@o9g2000prg.googlegroups.com> <785f88f70912100731i389b7435s6a83d4b23954c6e5@mail.gmail.com> Message-ID: <785f88f70912111127l4e641708h76d337a5dcd50158@mail.gmail.com> Hi Andrew, I've re attached patches with diff -u. Thanks! Tan -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: patchfile.f3b6a575fceb957805c3b8d8af796a749cbad61c Type: application/octet-stream Size: 2855 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: patchfile.R13B03 Type: application/octet-stream Size: 4642 bytes Desc: not available URL: From thomasl_erlang@REDACTED Fri Dec 11 19:28:45 2009 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Fri, 11 Dec 2009 10:28:45 -0800 (PST) Subject: AW: [erlang-questions] Preventing calling some functions In-Reply-To: References: <4B20D640.3030902@geodesic.com> <9b08084c0912110207r7c2b6653p85738250583c57dd@mail.gmail.com> <95be1d3b0912110231q171c07fk8bcda97fefac2eeb@mail.gmail.com> <4B226797.9070007@geodesic.com> Message-ID: <812382.68261.qm@web111404.mail.gq1.yahoo.com> ----- Original Message ---- > - a "no side effect" mode of evaluation for the funs. Any bifs doing > sideeffects, spawn, > send, get, put would be disallowed. This mode would be nice for untrusted code > too... > (btw: list_to_atom would be disallowed, list_to_existing_atom could be > allowed) Incidentally, disallowing visible side-effects (though mildly different from the above) could also serve as a cornerstone when implementing deep guards. I think this feature could be implemented under the hood by a bitmask, perhaps just a single bit. Set a bit in the mask when you're running a pure computation. Test the bit(s) before running a side-effect and throw an exception if purity was required. Save and restore the bitmask when entering/exiting such a scope. Best, Thomas From clist@REDACTED Fri Dec 11 20:44:06 2009 From: clist@REDACTED (Angel Alvarez) Date: Fri, 11 Dec 2009 20:44:06 +0100 Subject: [erlang-questions] Erlang in the mist In-Reply-To: <9b08084c0912110226o61499b3t618a6197abf89f64@mail.gmail.com> References: <9b08084c0912110226o61499b3t618a6197abf89f64@mail.gmail.com> Message-ID: <200912112044.06990.clist@uah.es> El Viernes, 11 de Diciembre de 2009 Joe Armstrong escribi?: > I want to build an Erlang mist. > > I want to experiment with "many" Erlangs > on one machine (note *not* distributed Erlang). > > So I need to be able to start and stop the Erlangs and manage them. > > Questions: > > - Anybody got any code that does this? > - How many Erlangs per Gigabyte can I start? (assume they just > start and do nothing) > - Where does standard output go when there is nobody to watch? > > > /Joe Some days ago, the lists was discussing about massive erlang distribution "problems" (well in fact someone said more than 100 erlang VMs is not common but i think someone will eventually require it). I was thinking about a common scenario in order to compare results and this required a common script just to lunch a lot of erlang VMs so you could test and measure distribution on one node at least). Ive just seen a i7 on media mark so maybe Intel SCCS is not so far... But a bunch of erlangs VMs on one node seems like waste of RAM mainly IMHO for: - Now one VM can drive several CPUS up to maybe 16 cores or so - Spawning a lot of erlang OS process is a bad unles the one VM can fork other VMs and let the OS do page sharing. I was thinking something like a very big node with far more that 4 GB RAM and 16 or more CPUS where 1 erlang 32bit cant fully use all resources but spawning many VMs in not optimal as you lose page sharing .. Im testing usage like this... for a in $(seq 1 100) do erl -sname node$a -noshell -detached -setcookie abcd1234 +A 16 +K true ; done and controlling those vms with for a in $(seq 1 100) ; do /usr/lib/erlang/lib/erl_interface-3.6.2/bin/erl_call -v -h node0 -sname node$a -c abcd1234 -q; done just to see memory usage Can Linux optimize two independent invocation of one process by "copy on write" tricks or you need those processes being father and children by means of fork call? with something like "erl -fork 20 ..." you could fork another 20 instances of erlang (standalone or distributed) and enjoy of page sharing between all instances. You can fully utilize all cores without over exercise erlang schedulers and cope all memory beyond 4GB with 32bit VMs instances... with this approach you can test mist or cloud or whatever gas you want even in a laptop ... The next thing will be to launch 100 instances and run a ring test... > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > -- No imprima este correo si no es necesario. El medio ambiente est? en nuestras manos. ->>----------------------------------------------- Clist UAH a.k.a Angel ---------------------------------[www.uah.es]-<<-- MySQL4: Bien, Usa transacciones solo si no necesitas velocidad. From B.Candler@REDACTED Fri Dec 11 20:44:35 2009 From: B.Candler@REDACTED (Brian Candler) Date: Fri, 11 Dec 2009 19:44:35 +0000 Subject: [erlang-questions] Help with erl_parse / epp In-Reply-To: <4B955E04-CCA6-448A-A1E0-A448D45184B1@souja.net> References: <4B955E04-CCA6-448A-A1E0-A448D45184B1@souja.net> Message-ID: <20091211194435.GA24932@uk.tiscali.com> On Fri, Dec 11, 2009 at 11:01:19AM -0800, Jayson Vantuyl wrote: > I don't think that it's possible to extract the chunk from the loaded > module, but you can easily get the path to the beam file that was loaded > with code:which/1. OK, I think that will do the trick, thanks. Thinking about it, it probably wouldn't make sense for the VM to load the abstract code chunk anyway. Thanks to all for the help. Cheers, Brian. From kiszl@REDACTED Fri Dec 11 20:54:18 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Fri, 11 Dec 2009 20:54:18 +0100 Subject: [erlang-questions] inlining math:pi() In-Reply-To: References: Message-ID: <4B22A36A.1000703@tmit.bme.hu> Or a parse transform? :) Tony Arcieri wrote: > Use a macro? > > On Fri, Dec 11, 2009 at 8:31 AM, James Hague wrote: > > >> I tend to use math:pi/0 a lot in code I'm writing. The math module is >> essentially all BIFs, except math:pi/0, which is simple: >> >> pi() -> 3.1415926535897932. >> >> If this constant could simply be inlined at compile time, it would >> improve the generated code quite a bit. Two examples: >> >> 1. "math:pi() * 2" could be a constant, instead of a call to an >> external function and causing a float to be heap allocated. >> 2. "{100.0, 50.0, math:pi()}" could be a constant term, instead of >> having to be constructed at runtime. >> >> Perhaps there's a more general need for what are essentially "constant >> BIFs"? >> >> James >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> >> > > > From kagato@REDACTED Fri Dec 11 20:58:14 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Fri, 11 Dec 2009 11:58:14 -0800 Subject: [erlang-questions] Erlang in the mist In-Reply-To: <200912112044.06990.clist@uah.es> References: <9b08084c0912110226o61499b3t618a6197abf89f64@mail.gmail.com> <200912112044.06990.clist@uah.es> Message-ID: > Can Linux optimize two independent invocation of one process by "copy on write" tricks or you need those processes > being father and children by means of fork call? As I recall, when the ELF loader in Linux loads a binary, it does so by mmap'ing it into the process address space (effectively copy-on-write). Due to the way that Linux's VM does mmap, the same pages should be loaded into every binary, and they should be copy-on-write as well. So, yes, it should be optimized; and, no, you shouldn't be required to fork them from the same parent. -- Jayson Vantuyl kagato@REDACTED From peter@REDACTED Fri Dec 11 21:00:59 2009 From: peter@REDACTED (Peter Sabaini) Date: Fri, 11 Dec 2009 21:00:59 +0100 Subject: [erlang-questions] Erlang in the mist In-Reply-To: <9b08084c0912110226o61499b3t618a6197abf89f64@mail.gmail.com> References: <9b08084c0912110226o61499b3t618a6197abf89f64@mail.gmail.com> Message-ID: <1260561659.15302.22.camel@gram.local> On Fri, 2009-12-11 at 11:26 +0100, Joe Armstrong wrote: > I want to build an Erlang mist. > > I want to experiment with "many" Erlangs > on one machine (note *not* distributed Erlang). > > So I need to be able to start and stop the Erlangs and manage them. > > Questions: > > - Anybody got any code that does this? FWIW, I dug up and cleaned a Python script I used for mass starting Erlang VMs. I uploaded it to http://sabaini.at/src/mass-start-erl.py Use it like this: % python2.6 mass-start-erl.py -c 20 -b /usr/local/bin/erl \ -e "+B -noinput -run erlangtest start 2000" This would start 20 VMs, running "erlangtest:start(2000)". Some usage info (mail probably breaks formatting, sorry): % python2.6 mass-start-erl.py -h Usage: mass-start-erl.py [options] Options: -h, --help show this help message and exit -c STARTNODES, --start-nodes=STARTNODES number of nodes to start, default: 10 -l LOGFN, --logfn=LOGFN log output to LOG -m, --node-log log messages go to one file per VM, default: use single file (line buffered) -n NODENAME, --node-name=NODENAME template for nodename of the form 'n-%s', where %s is replaced with a counter; if unset, node starts without a name -b ERLBIN, --erlbin=ERLBIN path to erlang binary, default: /usr/bin/erl -e ERLOPTIONS, --erlopts=ERLOPTIONS options passed verbatim to the erl binary (dont forget to quote), defaults to '+B -noinput', disabling reading from stdin and Erlangs signal handling -t TIMETOLIVE, --time-to-live=TIMETOLIVE kill VMs after timeout seconds, default: live forever -s SLEEP, --sleep=SLEEP slow startup: sleep seconds between VM starts, default I'm entirely unsure if the script works on non-Unices, and it's probably buggy :-) > - How many Erlangs per Gigabyte can I start? (assume they just > start and do nothing) On my box I (Linux 2.6, 64bit, 6Gb RAM, 8Gb swap) I've run 200 nodes without much trouble. > - Where does standard output go when there is nobody to watch? With the script above, I either log everything (stdout, stderr) to one file or open a logfile for each VM peter. > > /Joe > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part URL: From kagato@REDACTED Fri Dec 11 21:08:35 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Fri, 11 Dec 2009 12:08:35 -0800 Subject: Common Test Log Categories Message-ID: <23D5C875-12BD-4010-944E-28CEA120DEE9@souja.net> When using the logging functions in CT, I've noticed that there is a Category parameter. It seems like the only usage I can find just uses the atom "default". Are there any other categories? How do they show up? Where is this documented? Thanks, -- Jayson Vantuyl kagato@REDACTED From adam@REDACTED Fri Dec 11 21:19:35 2009 From: adam@REDACTED (Adam Duston) Date: Fri, 11 Dec 2009 15:19:35 -0500 Subject: [erlang-questions] Re: Replicating a distributed database In-Reply-To: <922d05850912110047j5d4908e0wb20442a8a24c42df@mail.gmail.com> References: <922d05850912072322q1709ddek7f42d76a7ccb1b@mail.gmail.com> <922d05850912110047j5d4908e0wb20442a8a24c42df@mail.gmail.com> Message-ID: <52220f230912111219m1292c53bkd13326a38b8dbc7b@mail.gmail.com> H?kan, Thank you for your message. > will create a table with 100 fragments where each fragment will > have 2 replicas (one on node a and the other on node b) with We need "master" fragments on nodes a and b, with replicas on c and d. I believe mnesia:add_table_copy/3 is the only way to go for this scenario. You see, we need to do this because we're using disc_only_copies and we're splitting the fragments across two disks. Plus there are more than 1,024 fragments, and we don't want to recompile the OS kernel to allow for a greater number of open file descriptors per process. Nodes a and b run on machine 1 whereas nodes c and d run on machine 2, hence the replication. Thank you again, Adam 2009/12/11 H?kan Mattsson : > On Fri, Dec 11, 2009 at 6:05 AM, adam wrote: >> Ah, okay, got it. I somehow missed the node_pool option. I can do >> that, then use add_table_copy with each fragment individually to >> replicate them. > > It is simpler than that. You do not need to use mnesia:add_table_copy/3 > if you want to create a fragmented table where all fragments are > replicated to 2 given nodes. This command > > ?mnesia:create_table(f, [{frag_properties, [{n_fragments, 100}, > ?{n_disc_copies, 2}, {node_pool, [a@REDACTED, b@REDACTED]}]}]). > > will create a table with 100 fragments where each fragment will > have 2 replicas (one on node a and the other on node b) with > storage type disc_copies. > > /H?kan > -- Founder, langolab.com adam@REDACTED 312-375-9879 Skype: aduston From james.hague@REDACTED Fri Dec 11 21:21:25 2009 From: james.hague@REDACTED (James Hague) Date: Fri, 11 Dec 2009 14:21:25 -0600 Subject: [erlang-questions] inlining math:pi() In-Reply-To: References: Message-ID: > Use a macro? That's what I did. I have a ?PI macro in my tiny little prelude file that I include in most modules. But I thought I'd bring it up, as math:pi/0 already exists as part of the standard library. James From tony@REDACTED Fri Dec 11 23:26:29 2009 From: tony@REDACTED (Tony Arcieri) Date: Fri, 11 Dec 2009 15:26:29 -0700 Subject: [erlang-questions] inlining math:pi() In-Reply-To: References: Message-ID: On Fri, Dec 11, 2009 at 1:21 PM, James Hague wrote: > That's what I did. I have a ?PI macro in my tiny little prelude file > that I include in most modules. Cool, problem solved! > But I thought I'd bring it up, as > math:pi/0 already exists as part of the standard library. > The best way to leverage that appropriately would be for HiPE to support inlining across modules. -- Tony Arcieri Medioh! A Kudelski Brand From dgud@REDACTED Sat Dec 12 00:31:33 2009 From: dgud@REDACTED (Dan Gudmundsson) Date: Sat, 12 Dec 2009 00:31:33 +0100 Subject: [erlang-questions] new ssl vs embedded mode In-Reply-To: <5db086ad0912110716j134c7dfbha2393eccce56e56e@mail.gmail.com> References: <5db086ad0912110716j134c7dfbha2393eccce56e56e@mail.gmail.com> Message-ID: <93df43b60912111531o1d5e0da2heda61de0df987e66@mail.gmail.com> On Fri, Dec 11, 2009 at 4:16 PM, Doug Fort wrote: > Our company (SpiderOak) is developing an SSL proxy in Erlang. We have > discovered that the new ssl implementation {ssl_imp, new} is much more > efficient for our purposes than the standard ssl. > Cool we have done something right then. > Everything works fine in interactive mode, but when we try to run the > release in embedded mode we fail trying to read the certificate: > > SSL: 995: error:{badmatch,{error,undef}} [{ssl_manager,cache_pem_file,1}, > {ssl_certificate, file_to_certificats,1}, > {ssl_connection,init_certificates,4}, {ssl_connection,ssl_init,2}, > {ssl_connection,init,1}, {gen_fsm,init_it,6}, {proc_lib,init_p_do_apply,3}] > > AFAIK the ssl_manager is not used by new_ssl. And we seem to have done some bad things as well. > If we comment out the {ssl_imp, new} in ssl:listen, once again everything > works fine. > > So my question is: is it just too early to mess with new_ssl, or is there > some way to work around this? It should be ok for usage now, I don't have any known faults prior to this one. But I have not much feedback either. I'll take a look at the problem next week, I will not debug ssl on Friday night :-) /Dan > Thanks > > > -- > Doug Fort, Consulting Programmer > http://www.dougfort.com > Sent from Arlington, VA, United States > From mjtruog@REDACTED Sat Dec 12 06:44:15 2009 From: mjtruog@REDACTED (Michael Truog) Date: Fri, 11 Dec 2009 21:44:15 -0800 Subject: [erlang-questions] inlining math:pi() In-Reply-To: <4B22A36A.1000703@tmit.bme.hu> References: <4B22A36A.1000703@tmit.bme.hu> Message-ID: <4B232DAF.5050600@gmail.com> Yes, you would want these links to solutions: http://forum.trapexit.org/viewtopic.php?p=20260 (patch here: http://dukesoferl.blogspot.com/2009/09/removing-warnings-from-ctexpand.html) (other usage here: http://dukesoferl.blogspot.com/2009/08/metaprogramming-with-ctexpand.html) Zoltan Lajos Kis wrote: > Or a parse transform? :) > > Tony Arcieri wrote: >> Use a macro? >> >> On Fri, Dec 11, 2009 at 8:31 AM, James Hague >> wrote: >> >> >>> I tend to use math:pi/0 a lot in code I'm writing. The math module is >>> essentially all BIFs, except math:pi/0, which is simple: >>> >>> pi() -> 3.1415926535897932. >>> >>> If this constant could simply be inlined at compile time, it would >>> improve the generated code quite a bit. Two examples: >>> >>> 1. "math:pi() * 2" could be a constant, instead of a call to an >>> external function and causing a float to be heap allocated. >>> 2. "{100.0, 50.0, math:pi()}" could be a constant term, instead of >>> having to be constructed at runtime. >>> >>> Perhaps there's a more general need for what are essentially "constant >>> BIFs"? >>> >>> James >>> >>> ________________________________________________________________ >>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>> erlang-questions (at) erlang.org >>> >>> >>> >> >> >> > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From senthilkumar.peelikkampatti@REDACTED Sat Dec 12 08:22:45 2009 From: senthilkumar.peelikkampatti@REDACTED (Senthilkumar Peelikkampatti) Date: Sat, 12 Dec 2009 01:22:45 -0600 Subject: Erlwebsockserver - a mochiweb Websocket server Message-ID: <45d8e23d0912112322h481ea2d5yb0b1d156d5c2354d@mail.gmail.com> Hi All, I have just checked in Erlwebsockserver the code with example which is mochiweb adapted. It is far from perfect and it is certainly important milestone to run on well known Mochiweb. Code is now available at http://github.com/sendtopms/Erlwebsockserver -- Senthilkumar Peelikkampatti, http://pmsenthilkumar.blogspot.com/ From maruthavanan_s@REDACTED Sat Dec 12 11:18:50 2009 From: maruthavanan_s@REDACTED (maruthavanan s) Date: Sat, 12 Dec 2009 05:18:50 -0500 Subject: [erlang-questions] Read and delete file In-Reply-To: <1260542692.9474.35.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> References: ,<1260542692.9474.35.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Message-ID: Hi, The file is huge so I cannot take and keep it in memory. Regards, Marutha > To: > From: bengt.kleberg@REDACTED > CC: erlang-questions@REDACTED > Date: Fri, 11 Dec 2009 15:44:52 +0100 > Subject: Re: [erlang-questions] Read and delete file > > Greetings, > > The simplest way, if you can have the whole file in memory, would be to > read all lines, handle a single line and then write all the remaining > lines out to the file. Then repeat. > Use file:read_file/1 (split the line from the binary) and > file:write_file/2. > > > bengt > > On Fri, 2009-12-11 at 08:50 -0500, maruthavanan s wrote: > > Hi, > > > > I am opening a file using file and I read the file line by line using io:get_line. > > But after reading this line I need to delete the read line from the file. > > > > Appreciate you help. > > > > Thanks, > > Marutha > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From kagato@REDACTED Sat Dec 12 11:40:37 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Sat, 12 Dec 2009 02:40:37 -0800 Subject: [erlang-questions] Read and delete file In-Reply-To: References: ,<1260542692.9474.35.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Message-ID: <09BCE83B-A1C3-47DD-BBCD-BAD223C8239B@souja.net> Under Unix, there is no good way to delete a line from the front of a file. You can truncate the file (shorten it, cutting lines off at the end), but not from the front. If you're willing to do it all on disk (possibly with multiple copies of the data), it can be done, but it's hard to make a recommendation without knowing exactly what you're doing. On Dec 12, 2009, at 2:18 AM, maruthavanan s wrote: > > Hi, > > The file is huge so I cannot take and keep it in memory. > > Regards, > Marutha > >> To: >> From: bengt.kleberg@REDACTED >> CC: erlang-questions@REDACTED >> Date: Fri, 11 Dec 2009 15:44:52 +0100 >> Subject: Re: [erlang-questions] Read and delete file >> >> Greetings, >> >> The simplest way, if you can have the whole file in memory, would be to >> read all lines, handle a single line and then write all the remaining >> lines out to the file. Then repeat. >> Use file:read_file/1 (split the line from the binary) and >> file:write_file/2. >> >> >> bengt >> >> On Fri, 2009-12-11 at 08:50 -0500, maruthavanan s wrote: >>> Hi, >>> >>> I am opening a file using file and I read the file line by line using io:get_line. >>> But after reading this line I need to delete the read line from the file. >>> >>> Appreciate you help. >>> >>> Thanks, >>> Marutha >>> >> >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> > From garry@REDACTED Sun Dec 13 02:23:52 2009 From: garry@REDACTED (Garry Hodgson) Date: Sat, 12 Dec 2009 20:23:52 -0500 Subject: [erlang-questions] inlining math:pi() In-Reply-To: References: Message-ID: <4B244228.3060704@research.att.com> James Hague wrote: >> Use a macro? >> > > That's what I did. I have a ?PI macro in my tiny little prelude file > that I include in most modules. But I thought I'd bring it up, as > math:pi/0 already exists as part of the standard library. not to mention that ?PI is kinda ugly. -- Garry Hodgson AT&T Chief Security Office (CSO) "This e-mail and any files transmitted with it are AT&T property, are confidential, and are intended solely for the use of the individual or entity to whom this e-mail is addressed. If you are not one of the named recipient(s) or otherwise have reason to believe that you have received this message in error, please notify the sender and delete this message immediately from your computer. Any other use, retention, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited." From mazen.harake@REDACTED Sun Dec 13 07:40:41 2009 From: mazen.harake@REDACTED (Mazen Harake) Date: Sun, 13 Dec 2009 08:40:41 +0200 Subject: [erlang-questions] Read and delete file In-Reply-To: References: Message-ID: <4B248C69.3050501@erlang-consulting.com> Hi, May I ask why you need to remove the first line? In some cases I've been involved in something similar we have done one of the following (AFAIR): * Don't delete the line, move an index. If need for failover handling then make the index value persistent * Write to a "rest" file meaning that assuming you are reading line by line (and not deleting) you can (when finished) write the rest of the file to another file, close the one you have opened and then overwrite it with the temporary one. Regards, /Mazen On 11/12/2009 15:50, maruthavanan s wrote: > Hi, > > I am opening a file using file and I read the file line by line using io:get_line. > But after reading this line I need to delete the read line from the file. > > Appreciate you help. > > Thanks, > Marutha > > From mazen.harake@REDACTED Sun Dec 13 07:49:02 2009 From: mazen.harake@REDACTED (Mazen Harake) Date: Sun, 13 Dec 2009 08:49:02 +0200 Subject: [erlang-questions] Preventing calling some functions In-Reply-To: <4B20D640.3030902@geodesic.com> References: <4B20D640.3030902@geodesic.com> Message-ID: <4B248E5E.60900@erlang-consulting.com> Hi, I'm curious to why you want to have this restriction in place? The only thing I can come up with is if you have a proprietary reason. If you don't then I am _really_ curious because I don't see why restricting a user to do what ever he/she wants is of any benefit (assuming that we are talking about plugins now)? Regards, /Mazen On 10/12/2009 13:06, Kiran Khaladkar wrote: > hi, > I have a server written in which i allow erlang plugins also. But the > problem is i dont want the plugin code the call certain functions such > as 'gen_tcp:listen' etc .. The plugin writer should not be able to > call certain functions thought he might know all the erlang lib. > Can anyone suggest a way to do such a thing?? > regards, > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From kenji.rikitake@REDACTED Sun Dec 13 09:50:55 2009 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Sun, 13 Dec 2009 17:50:55 +0900 Subject: [erlang-questions] Tidier - when is the public release? In-Reply-To: <23888550.92881260530904961.JavaMail.root@zimbra> References: <4B2227B0.502@cs.ntua.gr> <23888550.92881260530904961.JavaMail.root@zimbra> Message-ID: <20091213085055.GA66771@k2r.org> Thanks for the answer Kostis. It's nice to know the authors of Tidier will at least give us a chance to test the power (and I understand the licensing requirement too). As Roberto writes, having an API will be a huge strength. For the time being it's very good to follow the writing style in the paper BTW. Kenji Rikitake From vasilij.savin@REDACTED Sun Dec 13 10:31:51 2009 From: vasilij.savin@REDACTED (Vasilij Savin) Date: Sun, 13 Dec 2009 11:31:51 +0200 Subject: [erlang-questions] Preventing calling some functions In-Reply-To: <4B248E5E.60900@erlang-consulting.com> References: <4B20D640.3030902@geodesic.com> <4B248E5E.60900@erlang-consulting.com> Message-ID: Hej Mazen, Actually there several valid reason for restricting access. First of all, security, you do not want every plugin to be able to access sensitive services to prevent malicious sabotage through plugins. Secondly, the quality of plugins is not guaranteed and they might inadvertently crash the system due to bugs in them. Regards, Vasilij Savin On Sun, Dec 13, 2009 at 8:49 AM, Mazen Harake < mazen.harake@REDACTED> wrote: > Hi, > > I'm curious to why you want to have this restriction in place? The only > thing I can come up with is if you have a proprietary reason. If you don't > then I am _really_ curious because I don't see why restricting a user to do > what ever he/she wants is of any benefit (assuming that we are talking about > plugins now)? > > Regards, > > /Mazen > > > > On 10/12/2009 13:06, Kiran Khaladkar wrote: > >> hi, >> I have a server written in which i allow erlang plugins also. But the >> problem is i dont want the plugin code the call certain functions such as >> 'gen_tcp:listen' etc .. The plugin writer should not be able to call certain >> functions thought he might know all the erlang lib. >> Can anyone suggest a way to do such a thing?? >> regards, >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From kiszl@REDACTED Sun Dec 13 10:55:18 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Sun, 13 Dec 2009 10:55:18 +0100 Subject: [erlang-questions] Preventing calling some functions In-Reply-To: References: <4B20D640.3030902@geodesic.com> <4B248E5E.60900@erlang-consulting.com> Message-ID: <4B24BA06.2070204@tmit.bme.hu> Hi, I don't see why I should have more trust and confidence in the creator of the server application itself then in the creator of a plugin. If I want to restrict a plugin from doing something particular on my machines, I would restrict the server itself in the first place. Your second point sounds like "defensive programming". See: http://www.erlang.se/doc/programming_rules.shtml#HDR11 Regards, Zoltan. Vasilij Savin wrote: > Hej Mazen, > > Actually there several valid reason for restricting access. > > First of all, security, you do not want every plugin to be able to access > sensitive services to prevent malicious sabotage through plugins. > > Secondly, the quality of plugins is not guaranteed and they might > inadvertently crash the system due to bugs in them. > > Regards, > Vasilij Savin > > > On Sun, Dec 13, 2009 at 8:49 AM, Mazen Harake < > mazen.harake@REDACTED> wrote: > > >> Hi, >> >> I'm curious to why you want to have this restriction in place? The only >> thing I can come up with is if you have a proprietary reason. If you don't >> then I am _really_ curious because I don't see why restricting a user to do >> what ever he/she wants is of any benefit (assuming that we are talking about >> plugins now)? >> >> Regards, >> >> /Mazen >> >> >> >> On 10/12/2009 13:06, Kiran Khaladkar wrote: >> >> >>> hi, >>> I have a server written in which i allow erlang plugins also. But the >>> problem is i dont want the plugin code the call certain functions such as >>> 'gen_tcp:listen' etc .. The plugin writer should not be able to call certain >>> functions thought he might know all the erlang lib. >>> Can anyone suggest a way to do such a thing?? >>> regards, >>> >>> ________________________________________________________________ >>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>> erlang-questions (at) erlang.org >>> >>> >>> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> >> > > From mazen.harake@REDACTED Sun Dec 13 13:41:01 2009 From: mazen.harake@REDACTED (Mazen Harake) Date: Sun, 13 Dec 2009 14:41:01 +0200 Subject: [erlang-questions] Preventing calling some functions In-Reply-To: <4B24BA06.2070204@tmit.bme.hu> References: <4B20D640.3030902@geodesic.com> <4B248E5E.60900@erlang-consulting.com> <4B24BA06.2070204@tmit.bme.hu> Message-ID: <4B24E0DD.9010506@erlang-consulting.com> Hej, As Zoltan is pointing out and IMHO I don't see any benefit at all in "protecting" the system from "bad" plugins, I would rather restrict the application itself. If you allow plugins that will provide some kind of RPC like feature or a server of some sort etc then I can understand but my point was simply that if you are just making a plugin-system for your application then restricting it that way just cripples it and doesn't give any additional "security". Proprietary software I can understand more if you want to limit but still this is not giving you very much benefit anyway since malicious code can be put in there anyway. So on the first count; I understand what you mean but I disagree that it should be handled on that level. I would put it on the admin's responsibility to use "safe" plugins instead. On the second count; the same really, you harm (restriction harms) more then you benefit IMHO. Anyway... my 2 cents. I was just curious :) BR, /Mazen On 13/12/2009 11:55, Zoltan Lajos Kis wrote: > Hi, > > I don't see why I should have more trust and confidence in the creator > of the server application itself then in the creator of a plugin. > If I want to restrict a plugin from doing something particular on my > machines, I would restrict the server itself in the first place. > > Your second point sounds like "defensive programming". See: > http://www.erlang.se/doc/programming_rules.shtml#HDR11 > > Regards, > Zoltan. > > Vasilij Savin wrote: >> Hej Mazen, >> >> Actually there several valid reason for restricting access. >> >> First of all, security, you do not want every plugin to be able to >> access >> sensitive services to prevent malicious sabotage through plugins. >> >> Secondly, the quality of plugins is not guaranteed and they might >> inadvertently crash the system due to bugs in them. >> >> Regards, >> Vasilij Savin >> >> >> On Sun, Dec 13, 2009 at 8:49 AM, Mazen Harake < >> mazen.harake@REDACTED> wrote: >> >>> Hi, >>> >>> I'm curious to why you want to have this restriction in place? The only >>> thing I can come up with is if you have a proprietary reason. If you >>> don't >>> then I am _really_ curious because I don't see why restricting a >>> user to do >>> what ever he/she wants is of any benefit (assuming that we are >>> talking about >>> plugins now)? >>> >>> Regards, >>> >>> /Mazen >>> >>> >>> >>> On 10/12/2009 13:06, Kiran Khaladkar wrote: >>> >>>> hi, >>>> I have a server written in which i allow erlang plugins also. But the >>>> problem is i dont want the plugin code the call certain functions >>>> such as >>>> 'gen_tcp:listen' etc .. The plugin writer should not be able to >>>> call certain >>>> functions thought he might know all the erlang lib. >>>> Can anyone suggest a way to do such a thing?? >>>> regards, >>>> >>>> ________________________________________________________________ >>>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>>> erlang-questions (at) erlang.org >>>> >>>> >>> ________________________________________________________________ >>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>> erlang-questions (at) erlang.org >>> >>> >> > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From mike_k_houghton@REDACTED Sun Dec 13 13:09:45 2009 From: mike_k_houghton@REDACTED (mike h) Date: Sun, 13 Dec 2009 12:09:45 +0000 (GMT) Subject: Advice Message-ID: <602883.65786.qm@web27806.mail.ukl.yahoo.com> Hi All, I've just started learning Erland and I'm really excited by it! I have a couple of questions. I have a lot of experience in OO languages and quite a bit in some of the imperative/functional hybrids like Ruby etc. My main interest in Erlang is in it's concurrent and distributed capabilities, so, which of the two main Erlang books would folk reccommend? (I think I'm right in saying there are currently just two main books, one by Oreilly and one by Erlang's designer) Next question is a bit more open ended. I have a particular interest in tuple spaces (JavaSpaces, Linda, Rinda etc) and their implementation and application.. And I want to use Erlang to implement a tuple space server and client. At the moment I've not really yet got into the Erlang 'mindset' but my initial idea is to use a process to represent a Tuple and have one process as the space server and a message to that server would create a tuple (ie process) based on the message details. Any comments, advice, pointers to existing implementations of a tuple space etc etc would be welcome, Thanks Mike From kagato@REDACTED Sun Dec 13 14:40:52 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Sun, 13 Dec 2009 05:40:52 -0800 Subject: [erlang-questions] Preventing calling some functions In-Reply-To: <4B24BA06.2070204@tmit.bme.hu> References: <4B20D640.3030902@geodesic.com> <4B248E5E.60900@erlang-consulting.com> <4B24BA06.2070204@tmit.bme.hu> Message-ID: <80748497-218F-4510-A768-68EC225FBDB2@souja.net> > Hi, > > I don't see why I should have more trust and confidence in the creator of the server application itself then in the creator of a plugin. > If I want to restrict a plugin from doing something particular on my machines, I would restrict the server itself in the first place. I don't particularly buy this. I think that there are plenty of reasons to lock-down a plug-in that have nothing to do with trusting the author or not. If security is at all a concern, it's perfectly reasonable to attempt to achieve a high-level of compartmentalization between components. The principle of least privilege is a good one, even within an application. The plug-in author doesn't have to be malicious for her code to be abused. > Your second point sounds like "defensive programming". See: http://www.erlang.se/doc/programming_rules.shtml#HDR11 I heartily agree on this point. -- Jayson Vantuyl kagato@REDACTED From kagato@REDACTED Sun Dec 13 14:45:23 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Sun, 13 Dec 2009 05:45:23 -0800 Subject: [erlang-questions] Advice In-Reply-To: <602883.65786.qm@web27806.mail.ukl.yahoo.com> References: <602883.65786.qm@web27806.mail.ukl.yahoo.com> Message-ID: Honestly, you might do better to just use Mnesia as the backend for a tuple-space. It's distributed and has all of the features. Otherwise, I wouldn't probably make each tuple is a process. If distribution isn't a goal, you might consider using ets tables. They're lightning fast and you can do pretty powerful queries on them using ets:match and friends. I can't currently think of a big advantage to using processes as tuples, although I admit that the objects-as-processes model is a good way to move from OOP to FP. Good luck. On Dec 13, 2009, at 4:09 AM, mike h wrote: > Hi All, > > I've just started learning Erland and I'm really excited by it! > I have a couple of questions. > > I have a lot of experience in OO languages and quite a bit in some of the imperative/functional hybrids like Ruby etc. My main interest in Erlang is in it's concurrent and distributed capabilities, so, which of the two main Erlang books would folk reccommend? (I think I'm right in saying there are currently just two main books, one by Oreilly and one by Erlang's designer) > > Next question is a bit more open ended. I have a particular interest in tuple spaces (JavaSpaces, Linda, Rinda etc) and their implementation and application.. And I want to use Erlang to implement a tuple space server and client. At the moment I've not really yet got into the Erlang 'mindset' but my initial idea is to use a process to represent a Tuple and have one process as the space server and a message to that server would create a tuple (ie process) based on the message details. > > Any comments, advice, pointers to existing implementations of a tuple space etc etc would be welcome, > > Thanks > > Mike -- Jayson Vantuyl kagato@REDACTED From vasilij.savin@REDACTED Sun Dec 13 15:09:48 2009 From: vasilij.savin@REDACTED (Vasilij Savin) Date: Sun, 13 Dec 2009 15:09:48 +0100 Subject: [erlang-questions] Advice In-Reply-To: <602883.65786.qm@web27806.mail.ukl.yahoo.com> References: <602883.65786.qm@web27806.mail.ukl.yahoo.com> Message-ID: Greetings, We are about to finish our project developing Erlang Cluster and I think we actually use something that you are thinking about. In a nutshell, we have Mnesia for storing data tuples, that is controlled by one process and everybody who wants to get a tuple requests it from the controlling process (no direct access to mnesia). Then this tuple is assigned in Mnesia transaction and sent to requester. Mnesia gives you plenty of things for free, so perhaps it is better not to reinvent the wheel, unless there are good reasons to do so. Regarding books, can not recommend either. We had I think O'Reillys book throughout project, but it was not as useful as online documentation for us. YMMV. Armstrong's book is quite heavy in technical details and is more of reference manual. Hope that helps. Regards, Vasilij Savin On Sun, Dec 13, 2009 at 2:45 PM, Jayson Vantuyl wrote: > Honestly, you might do better to just use Mnesia as the backend for a > tuple-space. It's distributed and has all of the features. > > Otherwise, I wouldn't probably make each tuple is a process. If > distribution isn't a goal, you might consider using ets tables. They're > lightning fast and you can do pretty powerful queries on them using > ets:match and friends. > > I can't currently think of a big advantage to using processes as tuples, > although I admit that the objects-as-processes model is a good way to move > from OOP to FP. > > Good luck. > > On Dec 13, 2009, at 4:09 AM, mike h wrote: > > > Hi All, > > > > I've just started learning Erland and I'm really excited by it! > > I have a couple of questions. > > > > I have a lot of experience in OO languages and quite a bit in some of the > imperative/functional hybrids like Ruby etc. My main interest in Erlang is > in it's concurrent and distributed capabilities, so, which of the two main > Erlang books would folk reccommend? (I think I'm right in saying there are > currently just two main books, one by Oreilly and one by Erlang's designer) > > > > Next question is a bit more open ended. I have a particular interest in > tuple spaces (JavaSpaces, Linda, Rinda etc) and their implementation and > application.. And I want to use Erlang to implement a tuple space server and > client. At the moment I've not really yet got into the Erlang 'mindset' but > my initial idea is to use a process to represent a Tuple and have one > process as the space server and a message to that server would create a > tuple (ie process) based on the message details. > > > > Any comments, advice, pointers to existing implementations of a tuple > space etc etc would be welcome, > > > > Thanks > > > > Mike > > -- > Jayson Vantuyl > kagato@REDACTED > > > > > > From vasilij.savin@REDACTED Sun Dec 13 15:24:39 2009 From: vasilij.savin@REDACTED (Vasilij Savin) Date: Sun, 13 Dec 2009 15:24:39 +0100 Subject: [erlang-questions] Preventing calling some functions In-Reply-To: <80748497-218F-4510-A768-68EC225FBDB2@souja.net> References: <4B20D640.3030902@geodesic.com> <4B248E5E.60900@erlang-consulting.com> <4B24BA06.2070204@tmit.bme.hu> <80748497-218F-4510-A768-68EC225FBDB2@souja.net> Message-ID: Greetings, Let's take a look at example. We have some server/application like Facebook and allow third-party plugins. Would you allow all and everybody to mess up with the core functionality that is there? I would really not trust explicitly other programmers that much, because even unintended mistake would crash the system probably and also it allows 3rd party authors to take shortcuts and take shortcuts instead of using suggested APIs. I do not think it is defensive programming, because it should be some sort of built-in mechanism that prevents 'unauthorised' calls. Though at this moment I do not think there is such thing, since the intent during creation of Erlang was quite different. Regards, Vasilij Savin On Sun, Dec 13, 2009 at 2:40 PM, Jayson Vantuyl wrote: > > Hi, > > > > I don't see why I should have more trust and confidence in the creator of > the server application itself then in the creator of a plugin. > > If I want to restrict a plugin from doing something particular on my > machines, I would restrict the server itself in the first place. > I don't particularly buy this. I think that there are plenty of reasons to > lock-down a plug-in that have nothing to do with trusting the author or not. > If security is at all a concern, it's perfectly reasonable to attempt to > achieve a high-level of compartmentalization between components. The > principle of least privilege is a good one, even within an application. The > plug-in author doesn't have to be malicious for her code to be abused. > > > Your second point sounds like "defensive programming". See: http://www.ercore > team can get stuck maintaining old APIs because third-party > lang.se/doc/programming_rules.shtml#HDR11 > I heartily agree on this point. > > > -- > Jayson Vantuyl > kagato@REDACTED > > > > > > From kiszl@REDACTED Sun Dec 13 16:09:21 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Sun, 13 Dec 2009 16:09:21 +0100 Subject: [erlang-questions] Preventing calling some functions In-Reply-To: References: <4B20D640.3030902@geodesic.com> <4B248E5E.60900@erlang-consulting.com> <4B24BA06.2070204@tmit.bme.hu> <80748497-218F-4510-A768-68EC225FBDB2@souja.net> Message-ID: <4B2503A1.1060004@tmit.bme.hu> Hi, It seems we were talking about different stories then :). I thought you meant a server that is to be run by anybody and third-party plugins that can be run along. For example Apache http server and the mod_rewrite "plugin". Facebook is of course a completely different story. Here you are mixing your own code with others' code. I believe in this case the question of trust I raised quite applies. At least I suppose you have more confidence in your "Facebook" server than in the third party applications. In such a case your best bet is to define a communication channel between your server and external applications, and have the apps run separated from your main server. For example I think you have to run your Facebook application on your own machine, while it can communicate with Facebook over HTTP only. People experienced in the Java (EE?) way of doing this might have other ideas as well ... Regards, Zoltan. Vasilij Savin wrote: > Greetings, > > Let's take a look at example. We have some server/application like > Facebook and allow third-party plugins. Would you allow all and > everybody to mess up with the core functionality that is there? I > would really not trust explicitly other programmers that much, because > even unintended mistake would crash the system probably and also it > allows 3rd party authors to take shortcuts and take shortcuts instead > of using suggested APIs. > > I do not think it is defensive programming, because it should be some > sort of built-in mechanism that prevents 'unauthorised' calls. Though > at this moment I do not think there is such thing, since the intent > during creation of Erlang was quite different. > > Regards, > Vasilij Savin > > > On Sun, Dec 13, 2009 at 2:40 PM, Jayson Vantuyl > wrote: > > > Hi, > > > > I don't see why I should have more trust and confidence in the > creator of the server application itself then in the creator of a > plugin. > > If I want to restrict a plugin from doing something particular > on my machines, I would restrict the server itself in the first place. > I don't particularly buy this. I think that there are plenty of > reasons to lock-down a plug-in that have nothing to do with > trusting the author or not. If security is at all a concern, it's > perfectly reasonable to attempt to achieve a high-level of > compartmentalization between components. The principle of least > privilege is a good one, even within an application. The plug-in > author doesn't have to be malicious for her code to be abused. > > > Your second point sounds like "defensive programming". See: > http://www.ercore team can get stuck maintaining old APIs because > third-party lang.se/doc/programming_rules.shtml#HDR11 > > I heartily agree on this point. > > > -- > Jayson Vantuyl > kagato@REDACTED > > > > > > From leap@REDACTED Sun Dec 13 16:15:29 2009 From: leap@REDACTED (Michael Turner) Date: Sun, 13 Dec 2009 15:15:29 +0000 Subject: Advice In-Reply-To: Message-ID: "Armstrong's book is quite heavy in technical details and is more of reference manual." I don't know why, but I'm finding it a very pleasant tutorial. It reads very smoothly. It might have more value in some ways as a reference, but that's clearly not the book's main purpose. -michael turner ============ Greetings, We are about to finish our project developing Erlang Cluster and I think we actually use something that you are thinking about. In a nutshell, we have Mnesia for storing data tuples, that is controlled by one process and everybody who wants to get a tuple requests it from the controlling process (no direct access to mnesia). Then this tuple is assigned in Mnesia transaction and sent to requester. Mnesia gives you plenty of things for free, so perhaps it is better not to reinvent the wheel, unless there are good reasons to do so. Regarding books, can not recommend either. We had I think O'Reillys book throughout project, but it was not as useful as online documentation for us. YMMV. Armstrong's book is quite heavy in technical details and is more of reference manual. Hope that helps. Regards, Vasilij Savin On Sun, Dec 13, 2009 at 2:45 PM, Jayson Vantuyl wrote: > Honestly, you might do better to just use Mnesia as the backend for a > tuple-space. It's distributed and has all of the features. > > Otherwise, I wouldn't probably make each tuple is a process. If > distribution isn't a goal, you might consider using ets tables. They're > lightning fast and you can do pretty powerful queries on them using > ets:match and friends. > > I can't currently think of a big advantage to using processes as tuples, > although I admit that the objects-as-processes model is a good way to move > from OOP to FP. > > Good luck. > > On Dec 13, 2009, at 4:09 AM, mike h wrote: > > > Hi All, > > > > I've just started learning Erland and I'm really excited by it! > > I have a couple of questions. > > > > I have a lot of experience in OO languages and quite a bit in some of the > imperative/functional hybrids like Ruby etc. My main interest in Erlang is > in it's concurrent and distributed capabilities, so, which of the two main > Erlang books would folk reccommend? (I think I'm right in saying there are > currently just two main books, one by Oreilly and one by Erlang's designer) > > > > Next question is a bit more open ended. I have a particular interest in > tuple spaces (JavaSpaces, Linda, Rinda etc) and their implementation and > application.. And I want to use Erlang to implement a tuple space server and > client. At the moment I've not really yet got into the Erlang 'mindset' but > my initial idea is to use a process to represent a Tuple and have one > process as the space server and a message to that server would create a > tuple (ie process) based on the message details. > > > > Any comments, advice, pointers to existing implementations of a tuple > space etc etc would be welcome, > > > > Thanks > > > > Mike > > -- > Jayson Vantuyl > kagato@REDACTED > > > > > > From hynek@REDACTED Sun Dec 13 19:13:56 2009 From: hynek@REDACTED (Hynek Vychodil) Date: Sun, 13 Dec 2009 19:13:56 +0100 Subject: [erlang-questions] Advice In-Reply-To: <602883.65786.qm@web27806.mail.ukl.yahoo.com> References: <602883.65786.qm@web27806.mail.ukl.yahoo.com> Message-ID: <4d08db370912131013n54364f8ckafe6e8e9e90b2cf3@mail.gmail.com> Hi, I have bought both Joe's Programming Erlang and Cesarini and Thompson's Erlang Programming books and I enjoy both. First is more about Why?, second is more about How?. First is more like technical manual, second is more like education material. First is more scientific, second is more teaching, but both are perfect. Chose on your taste. If you want learn more about Why? I can recommend you Joe's thesis as bonus for free. On Sun, Dec 13, 2009 at 1:09 PM, mike h wrote: > Hi All, > > I've just started learning Erland and I'm really excited by it! > I have a couple of questions. > > I have a lot of experience in OO languages and quite a bit in some of the imperative/functional hybrids like Ruby etc. My main interest in Erlang is in it's concurrent and ?distributed capabilities, so, ?which of the two main Erlang books would folk reccommend? ?(I think I'm right in saying there are currently just two main books, one by Oreilly and one by Erlang's designer) > > Next question is a bit more open ended. I have a particular interest in tuple spaces ?(JavaSpaces, Linda, Rinda etc) and their implementation and application.. And I want to use Erlang to implement a tuple space server and client. At the moment I've not really yet ?got into the Erlang 'mindset' but my initial idea is to use a process to represent a Tuple and have one process as the space server and a message to that server would create a tuple (ie process) based on the message details. > > Any comments, advice, pointers to existing implementations of a tuple space etc etc would be welcome, > > Thanks > > Mike > > > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try Good Data now for free: www.gooddata.com From jeraymond@REDACTED Sun Dec 13 19:23:27 2009 From: jeraymond@REDACTED (Jeremy Raymond) Date: Sun, 13 Dec 2009 13:23:27 -0500 Subject: Avoiding a bottleneck (nitrogen+yaws, app logic, couchbeam+couchdb) Message-ID: <59da11980912131023q36ab2138h9de32b468a85a3c4@mail.gmail.com> Hello, I'm building a web application using nitrogen+yaws as the front end and using couchbeam+couchdb as the back end. In the middle will by my application logic. I plan to have a module to be the data access API in front of couchbeam+couchdb. From the looks of things yaws and couchdb will scale for what I need, but I'm looking for some advice on how to structure my data access module. If I make this a typical gen_server then won't I be bottlenecked with my data module will be running on a single thread? Does it make more sense to not use gen_server in this case and use a straight functional module instead so that the data access module code runs on the calling thread (yaws)? Any general ideas on a high level design for the data access module would be appreciated. Thanks, Jeremy From ok@REDACTED Mon Dec 14 00:33:28 2009 From: ok@REDACTED (Richard O'Keefe) Date: Mon, 14 Dec 2009 12:33:28 +1300 Subject: AW: [erlang-questions] Preventing calling some functions In-Reply-To: References: <4B20D640.3030902@geodesic.com> <9b08084c0912110207r7c2b6653p85738250583c57dd@mail.gmail.com> <95be1d3b0912110231q171c07fk8bcda97fefac2eeb@mail.gmail.com> <4B226797.9070007@geodesic.com> Message-ID: <581557FF-F96B-4899-928D-ECCDD2153DD9@cs.otago.ac.nz> On Dec 12, 2009, at 6:39 AM, Decker, Nils wrote: > From my point of view two things would be needed: > - a way to replace a fun () -> ... end somewhere in the > datastructure with the > result of this function. This breaks erlangs immutable values and > possibly > the GC and other things? That's not really what you want. What you want is more like Scheme's (delay Expression), not a fun. (There is, after all, a big difference between an unevaluated expression that evaluates to a fun and the fun it evaluates to.) And you want pattern matching and a bunch of built-ins to to automatically (force -) delayed expressions. As in Scheme, the run-time representation of a delayed expression might _contain_ a fun, but that's not the same as _being_ one. However, graph rewriting does boil down to destructively updating a data structure at run time, and yes, that could give some Erlang garbage collectors trouble. Perhaps before such changes are made to Erlang we should look for efficient data structure that _don't_ rely on lazy evaluation. I once proposed a -pure([f/n, ...]) declaration to Fergus O'Brien, inspired by the ?-pure directive in NU Prolog. Tracking this through code changes seemed like more trouble than it was worth, at the time. > > - a "no side effect" mode of evaluation for the funs. Any bifs doing > sideeffects, spawn, > send, get, put would be disallowed. Purity checked at *compile time* is far nicer, because it means you only need the one evaluation mode and don't have to spend any time at all checking at run time. From vasilij.savin@REDACTED Mon Dec 14 01:24:38 2009 From: vasilij.savin@REDACTED (Vasilij Savin) Date: Mon, 14 Dec 2009 02:24:38 +0200 Subject: [erlang-questions] Avoiding a bottleneck (nitrogen+yaws, app logic, couchbeam+couchdb) In-Reply-To: <59da11980912131023q36ab2138h9de32b468a85a3c4@mail.gmail.com> References: <59da11980912131023q36ab2138h9de32b468a85a3c4@mail.gmail.com> Message-ID: Greetings, I can tell you about the solution we used in similar situation. It does not mean it is optimal, but it was the best we came up with. Each gen_server call to db interface will generate a separate handler thread that will work with couchDB directly. You will need to pass both PID and NodeID though. Then your client will have to wait for message from that server thread using standard messaging or if it is gen_server itself - using handle_info. This way interface between DB and frontend hopefully will not be bottleneck, or at least should scale as each request will be handled by separate thread. I would like to ask others to give opinion on this solution. Regards, Vasilij Savin From rvirding@REDACTED Mon Dec 14 01:16:34 2009 From: rvirding@REDACTED (Robert Virding) Date: Mon, 14 Dec 2009 01:16:34 +0100 Subject: New version of LFE, Lisp Flavoured Erlang, for R13B03 Message-ID: <3dbc6d1c0912131616y1cd8cbc7r7a4c64e01313e493@mail.gmail.com> This version, v0.5.1, contains a fix which allows it to run under R13B03 which had made incompatible internal changes in the compiler. Thanks to Matt Stancliff for pointing it out and providing a fix. It all also contains a new example file. The new version can be found on trapexit.org, and on github: http://forum.trapexit.org/viewtopic.php?p=51719#51719 http://github.com/rvirding/lfe Robert From ok@REDACTED Mon Dec 14 02:20:02 2009 From: ok@REDACTED (Richard O'Keefe) Date: Mon, 14 Dec 2009 14:20:02 +1300 Subject: [erlang-questions] Advice In-Reply-To: <602883.65786.qm@web27806.mail.ukl.yahoo.com> References: <602883.65786.qm@web27806.mail.ukl.yahoo.com> Message-ID: <6C6AFFB5-3872-4CA3-B75D-E10EBE649DC0@cs.otago.ac.nz> On Dec 14, 2009, at 1:09 AM, mike h wrote: > I have a lot of experience in OO languages and quite a bit in some > of the imperative/functional hybrids like Ruby etc. My main interest > in Erlang is in it's concurrent and distributed capabilities, so, > which of the two main Erlang books would folk reccommend? (I think > I'm right in saying there are currently just two main books, one by > Oreilly and one by Erlang's designer) All the Erlang books are good ones. > > > Next question is a bit more open ended. I have a particular interest > in tuple spaces (JavaSpaces, Linda, Rinda etc) and their > implementation and application.. And I want to use Erlang to > implement a tuple space server and client. Ask yourself the question: "in what ways (that I care about) is a tuple space different from a Dets or Mnesia table?" From zabrane3@REDACTED Mon Dec 14 04:54:11 2009 From: zabrane3@REDACTED (zabrane Mikael) Date: Mon, 14 Dec 2009 04:54:11 +0100 Subject: Hadoop (HDFS) like filesystem in Erlang Message-ID: <18a1db030912131954i7064b80ctfc6c40e3db17519@mail.gmail.com> HI List ! Is there an implementation of HDFS ( http://hadoop.apache.org/common/docs/current/hdfs_shell.html) in Erlang? Or even something similar in design somewhere? I'd like to have a distributed FS on top of my Linux "ext3" FS ! Ideas are welcome ... Regards Zabrane From zerthurd@REDACTED Mon Dec 14 06:11:02 2009 From: zerthurd@REDACTED (Maxim Treskin) Date: Mon, 14 Dec 2009 11:11:02 +0600 Subject: [erlang-questions] Hadoop (HDFS) like filesystem in Erlang In-Reply-To: <18a1db030912131954i7064b80ctfc6c40e3db17519@mail.gmail.com> References: <18a1db030912131954i7064b80ctfc6c40e3db17519@mail.gmail.com> Message-ID: There is fuse-implementation of Hadoop: http://wiki.apache.org/hadoop/MountableHDFS and you can use regular file-operations to interact with it. -- Maxim Treskin From zabrane3@REDACTED Mon Dec 14 07:12:39 2009 From: zabrane3@REDACTED (zabrane Mikael) Date: Mon, 14 Dec 2009 07:12:39 +0100 Subject: [erlang-questions] Hadoop (HDFS) like filesystem in Erlang In-Reply-To: References: <18a1db030912131954i7064b80ctfc6c40e3db17519@mail.gmail.com> Message-ID: <18a1db030912132212n1d580353od6e919f3fbbc365c@mail.gmail.com> Hi Maxim, I'm currently using that solution on my Linux box, but using FUSE slow down the performance sometimes. This is why I'm asking for an Erlang rewrite of an Hadoop like FS. Regards Zabrane 2009/12/14 Maxim Treskin > There is fuse-implementation of Hadoop: > http://wiki.apache.org/hadoop/MountableHDFS > and you can use regular file-operations to interact with it. > > -- > Maxim Treskin > From shenyute@REDACTED Mon Dec 14 08:36:05 2009 From: shenyute@REDACTED (Yu-Teh Shen) Date: Mon, 14 Dec 2009 15:36:05 +0800 Subject: about Erlang C Node monitor Message-ID: <65055d7c0912132336r1a8898q41d01a9fca3fc2e2@mail.gmail.com> I have read doc about how to write a simple C node. But what I should do if I want to *monitor* the C node like all other Erlang node and make erlang *connects*, *net_adm:ping* works? I think I need to handle the message in my C node loop. But which file I should check to find out the format of communication to Erlang Node. Could anyone give me some direction? Thanks a lot! Ex: ---------------------------------------- while(1) { got = erl_receive_msg(fd, buf, BUFSIZE, &emsg); printf("got =%d\n", got); if (got == ERL_TICK) { /* ignore */ } else if(got == ERL_ERROR) { break; } else { if(emsg.type == ERL_REG_SEND) { // check whether it's the monitor message // or it's the normal message which i should handle } } } Shen, Yu-Teh From kostis@REDACTED Mon Dec 14 09:27:09 2009 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 14 Dec 2009 10:27:09 +0200 Subject: [erlang-questions] "typer" documentaion In-Reply-To: <95be1d3b0912110258ic267249k99b4787efd94fed7@mail.gmail.com> References: <95be1d3b0912110258ic267249k99b4787efd94fed7@mail.gmail.com> Message-ID: <4B25F6DD.9060906@cs.ntua.gr> Vlad Dumitrescu wrote: > Hi, > > Is there a reason why typer has no documentation and isn't even > mentioned in the docs? Not even the search engine at demo.erlang.org > finds any reference... Good question. I guess it's our fault rather than Erlang/OTP's because the only thing we have written on typer is a paper describing it. However, note that typer is not designed to have any Erlang API; instead it's a shell command. For those interested in using it, a short description about its options can be obtained by typing: typer --help Disclaimer: currently, we do not have any test suite for typer. We will try to write a test suite and proper documentation for the tool for R13B04. But we would not mind if some user beats us to it. We also welcome user feedback. Kostis From sysop@REDACTED Mon Dec 14 09:48:33 2009 From: sysop@REDACTED (Matt Stancliff) Date: Mon, 14 Dec 2009 00:48:33 -0800 Subject: [erlang-questions] about Erlang C Node monitor In-Reply-To: <65055d7c0912132336r1a8898q41d01a9fca3fc2e2@mail.gmail.com> References: <65055d7c0912132336r1a8898q41d01a9fca3fc2e2@mail.gmail.com> Message-ID: <73A7CDBF-080D-4705-9747-CD1B458754EC@mindspring.com> Yu-Teh, On Dec 13, 2009, at 11:36 PM, Yu-Teh Shen wrote: > But what I should do if I want to *monitor* the C node like all > other Erlang > node and make erlang *connects*, *net_adm:ping* works? You can use erlang:monitor_node to monitor C nodes. Handling net_adm:ping in a C node takes a few steps. Here is what I use: main processing loop: ===== ETERM *gen_call = erl_format("~a", "$gen_call"); while (loop) { got = erl_receive_msg(fd, buf, BUFSIZE, &emsg); if (got == ERL_TICK) { /* ignore */ } else if (got == ERL_ERROR) { loop = 0; } else { if (emsg.type == ERL_REG_SEND) { msg = erl_element(1, emsg.msg); if (erl_match(_something_i_want_, msg)) { /* blah */ } else if (erl_match(gen_call, msg)) { process_gen_call(fd, emsg.from, emsg.msg); } } } erl_free_term(msg); erl_free_term(emsg.msg); erl_free_term(emsg.to); erl_free_term(emsg.from); } erl_free_term(gen_call); ===== Then, process_gen_call is: ===== /* gen_call with is_auth is for handling net_adm:ping responses. The incoming message looks like: {'$gen_call', {, #Ref<2394.0.0>}, {is_auth, bob3@REDACTED}} You must respond with the reference (element 2 of tuple 2) and "yes" */ static void process_gen_call(int fd, ETERM *from, ETERM *msg) { ETERM *is_auth = erl_format("~a", "is_auth"); ETERM *args = erl_element(3, msg); ETERM *arg1 = erl_element(1, args); if (erl_match(is_auth, arg1)) { ETERM *fromp = erl_element(2, msg); ETERM *resp = erl_format("{~w, yes}", erl_element(2, fromp)); erl_send(fd, from, resp); erl_free_compound(resp); erl_free_term(fromp); } erl_free_term(args); erl_free_term(arg1); erl_free_term(is_auth); } ===== Hope that helps, -Matt -- Matt Stancliff San Jose, CA AIM: seijimr iPhone: 678-591-9337 "The best way to predict the future is to invent it." --Alan Kay From kenji.rikitake@REDACTED Mon Dec 14 09:59:03 2009 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Mon, 14 Dec 2009 17:59:03 +0900 Subject: [erlang-questions] Advice In-Reply-To: <4d08db370912131013n54364f8ckafe6e8e9e90b2cf3@mail.gmail.com> References: <602883.65786.qm@web27806.mail.ukl.yahoo.com> <4d08db370912131013n54364f8ckafe6e8e9e90b2cf3@mail.gmail.com> Message-ID: <20091214085903.GA84794@k2r.org> Joe's Programming Erlang is like K&R for C for its terseness; and Francesco/Simon's Erlang Programming is more like "C: A Reference Manual" at least to me for its attempt to explain historical reasons of how Erlang evolves. You may learn different things from each book. I still learn many things from both. Joe's PhD thesis is another thoughtful article to find out "why erlang". Erlang's Github repository, the Ericsson's reference manual(s), and the source code are of course precisely more in detail. Kenji Rikitake From kostis@REDACTED Mon Dec 14 10:02:36 2009 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 14 Dec 2009 11:02:36 +0200 Subject: [erlang-questions] status of EEPs In-Reply-To: <95be1d3b0912110701q269aac6at666356a6e2baf88b@mail.gmail.com> References: <95be1d3b0912110701q269aac6at666356a6e2baf88b@mail.gmail.com> Message-ID: <4B25FF2C.6020906@cs.ntua.gr> Vlad Dumitrescu wrote: > Hi, > > I was about to ask why there is no documentation regarding -type and > -spec except for the EEP 8 text, but looking closer I see that the EEP > isn't even accepted. And even those that have been accepted and > finalized are still marked as "draft". > > Shouldn't the EEPs that are part of the distribution (even as > experimental implementations) be marked somehow as such? > And shouldn't the documentation explain them, in the worst case by > linking to the EEP text? Other experimental features are documented... > What is really the status of EEP8? > > Simply put, is it just a miss, or is there a reason for this? There are many reasons for this (i.e., it's intentional). In short: we are currently working on a major extension of EEP8 that will remove one of its main limitations. We are also contemplating on changing some aspect of the EEP which, depending on how we do the change, may not be compatible with the current text of the EEP. However, users can expect that the core of the -spec and -type language will stay unchanged. Sorry for being a bit cryptic. Full details to follow when the dust is settled. Kostis From vladdu55@REDACTED Mon Dec 14 10:37:46 2009 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 14 Dec 2009 10:37:46 +0100 Subject: [erlang-questions] status of EEPs In-Reply-To: <4B25FF2C.6020906@cs.ntua.gr> References: <95be1d3b0912110701q269aac6at666356a6e2baf88b@mail.gmail.com> <4B25FF2C.6020906@cs.ntua.gr> Message-ID: <95be1d3b0912140137l6c18fef1l295ac95cd758f6d8@mail.gmail.com> On Mon, Dec 14, 2009 at 10:02, Kostis Sagonas wrote: > There are many reasons for this (i.e., it's intentional). > .... > Sorry for being a bit cryptic. ?Full details to follow when the dust is > settled. No problem. Thanks for the answer! best regards, Vlad From zambal@REDACTED Mon Dec 14 11:03:52 2009 From: zambal@REDACTED (zambal) Date: Mon, 14 Dec 2009 02:03:52 -0800 (PST) Subject: Accessing private data in a NIF C module Message-ID: I could not found any information about if one needs to do any manual locking when accessing data via enif_get_data(env) in an exported NIF function. Does anybody know if this is needed? thanks, vincent From leap@REDACTED Mon Dec 14 12:21:42 2009 From: leap@REDACTED (Michael Turner) Date: Mon, 14 Dec 2009 11:21:42 +0000 Subject: Advice In-Reply-To: <20091214085903.GA84794@k2r.org> Message-ID: On 12/14/2009, "Kenji Rikitake" wrote: >Joe's Programming Erlang is like K&R for C for its terseness; and >Francesco/Simon's Erlang Programming is more like "C: A Reference >Manual" at least to me for its attempt to explain historical reasons of >how Erlang evolves. You may learn different things from each book. I >still learn many things from both. Joe's PhD thesis is another >thoughtful article to find out "why erlang". Honestly, Erlang is so different from most languages that it's probably a good idea to just keep reading everything by the experts, to help make the concepts and syntax gel in your mind. The book I've been *practicing* from, however, is Joe's. I don't know about Kenji's characterization of Francesco&Simon. But K&R was, I always thought, one of the best programming language books ever written, and it's not a bad comparison, even if K&R is a little drier. Then again, I like brevity in a programmer's manual, within reason. YMMV. >Erlang's Github repository, the Ericsson's reference manual(s), and the >source code are of course precisely more in detail. The Erricsson references online can't be beat for detail, but the writing could use some work. For example, I needed a "sleep" for something. I searched on "sleep". I ended up in the timer module section, which says, in its introduction, "All timer functions return immediately, regardless of work carried out by another process." No qualification, like "unless stated otherwise". At first I thought I was looking in the wrong manual section. But on a hunch (arising mostly from a distrust of the manual, having seen a fair amount of confusing and low-quality description in it already), I looked at timer:sleep/1 anyway. Yep: there, at the end of sleep/1's description, you see it: "Naturally, this function does not return immediately." Uh-huh. Naturally. It's not the only such problem in the reference manual. I can see scope for improvements almost everywhere I look, actually. One of my earliest questions to the list was, basically, "How can I help improve the documentation?" But maybe that got lost in everything else I was saying at the time. -michael turner From sverker@REDACTED Mon Dec 14 12:19:05 2009 From: sverker@REDACTED (Sverker Eriksson) Date: Mon, 14 Dec 2009 12:19:05 +0100 Subject: [erlang-questions] Accessing private data in a NIF C module In-Reply-To: References: Message-ID: <4B261F29.1090008@erix.ericsson.se> zambal wrote: > I could not found any information about if one needs to do any manual > locking when accessing data via enif_get_data(env) in an exported NIF > function. Does anybody know if this is needed? > Yes, you need to do your own locking on any data structures that you introduce yourself and access either through enif_get_data() or static variables. The callbacks load, reload, upgrade and unload are however thread safe. I will add more about this in the erl_nif documentation for next release. /Sverker, Erlang/OTP Ericsson From zambal@REDACTED Mon Dec 14 14:29:33 2009 From: zambal@REDACTED (zambal) Date: Mon, 14 Dec 2009 05:29:33 -0800 (PST) Subject: Accessing private data in a NIF C module In-Reply-To: <4B261F29.1090008@erix.ericsson.se> References: <4B261F29.1090008@erix.ericsson.se> Message-ID: <5970f865-e80b-4e37-a812-76c6cd8c1b10@k19g2000yqc.googlegroups.com> Thanks for the info. So using NIF is a bit dangerous indeed ;-) but I guess it's mainly intended for small side-effect free functions. - vincent On 14 dec, 12:19, Sverker Eriksson wrote: > zambal wrote: > > I could not found any information about if one needs to do any manual > > locking when accessing data via enif_get_data(env) in an exported NIF > > function. Does anybody know if this is needed? > > Yes, you need to do your own locking on any data structures that you > introduce yourself and access either through enif_get_data() or static > variables. The callbacks load, reload, upgrade and unload are however > thread safe. > > I will add more about this in the erl_nif documentation for next release. > > /Sverker, Erlang/OTP Ericsson > > ________________________________________________________________ > erlang-questions mailing list. Seehttp://www.erlang.org/faq.html > erlang-questions (at) erlang.org From bgustavsson@REDACTED Mon Dec 14 15:16:30 2009 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Mon, 14 Dec 2009 15:16:30 +0100 Subject: [erlang-questions] Re: Advice In-Reply-To: References: <20091214085903.GA84794@k2r.org> Message-ID: <6672d0160912140616i2e2ff64dk2f6f45b94b761d69@mail.gmail.com> On Mon, Dec 14, 2009 at 12:21 PM, Michael Turner wrote: > It's not the only such problem in the reference manual. ?I can see scope > for improvements almost everywhere I look, actually. ?One of my earliest > questions to the list was, basically, "How can I help improve the > documentation?" ?But maybe that got lost in everything else I was > saying at the time. Or perhaps because we didn't have a good answer at the time? We have an answer now: http://wiki.github.com/erlang/otp/submitting-patches Basically, all submitted patches are included in the 'pu' branch within a workday (unless they are obviously wrong or inappropriate) to make sure that no patch is forgotten. When a patch has been verified to be OTP worthy, it will be graduated (merged to the development branch for the next release). -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From dgud@REDACTED Mon Dec 14 16:17:11 2009 From: dgud@REDACTED (Dan Gudmundsson) Date: Mon, 14 Dec 2009 16:17:11 +0100 Subject: [erlang-questions] new ssl vs embedded mode In-Reply-To: <93df43b60912111531o1d5e0da2heda61de0df987e66@mail.gmail.com> References: <5db086ad0912110716j134c7dfbha2393eccce56e56e@mail.gmail.com> <93df43b60912111531o1d5e0da2heda61de0df987e66@mail.gmail.com> Message-ID: <93df43b60912140717t51308807t89e5223af053ba53@mail.gmail.com> Hi Doug On Sat, Dec 12, 2009 at 12:31 AM, Dan Gudmundsson wrote: >> SSL: 995: error:{badmatch,{error,undef}} [{ssl_manager,cache_pem_file,1}, >> {ssl_certificate, file_to_certificats,1}, >> {ssl_connection,init_certificates,4}, {ssl_connection,ssl_init,2}, >> {ssl_connection,init,1}, {gen_fsm,init_it,6}, {proc_lib,init_p_do_apply,3}] >> >> AFAIK the ssl_manager is not used by new_ssl. > ssl_manager is used by the new ssl, and the call seems correct to me. Have you remembered to load the public_key application, which is required by ssl if new_ssl is used? /Dan From doug.fort@REDACTED Mon Dec 14 16:32:28 2009 From: doug.fort@REDACTED (Doug Fort) Date: Mon, 14 Dec 2009 10:32:28 -0500 Subject: [erlang-questions] new ssl vs embedded mode In-Reply-To: <93df43b60912140717t51308807t89e5223af053ba53@mail.gmail.com> References: <5db086ad0912110716j134c7dfbha2393eccce56e56e@mail.gmail.com> <93df43b60912111531o1d5e0da2heda61de0df987e66@mail.gmail.com> <93df43b60912140717t51308807t89e5223af053ba53@mail.gmail.com> Message-ID: <5db086ad0912140732q6c4a890epb40ffdd96a18bdf7@mail.gmail.com> On Mon, Dec 14, 2009 at 10:17 AM, Dan Gudmundsson wrote: > Hi Doug > > On Sat, Dec 12, 2009 at 12:31 AM, Dan Gudmundsson > wrote: > >> SSL: 995: error:{badmatch,{error,undef}} > [{ssl_manager,cache_pem_file,1}, > >> {ssl_certificate, file_to_certificats,1}, > >> {ssl_connection,init_certificates,4}, {ssl_connection,ssl_init,2}, > >> {ssl_connection,init,1}, {gen_fsm,init_it,6}, > {proc_lib,init_p_do_apply,3}] > >> > >> AFAIK the ssl_manager is not used by new_ssl. > > > > ssl_manager is used by the new ssl, and the call seems correct to me. > > Have you remembered to load the public_key application, > which is required by ssl if new_ssl is used? > > aha! That's it! It works fine in embedded mode when I add {public_key, "0.4"} to the release file. Sorry about the confusion and thanks for your help. -- Doug Fort, Consulting Programmer http://www.dougfort.com Sent from Arlington, VA, United States From attila.r.nohl@REDACTED Mon Dec 14 16:37:33 2009 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Mon, 14 Dec 2009 16:37:33 +0100 Subject: [erlang-questions] new ssl vs embedded mode In-Reply-To: <5db086ad0912140732q6c4a890epb40ffdd96a18bdf7@mail.gmail.com> References: <5db086ad0912110716j134c7dfbha2393eccce56e56e@mail.gmail.com> <93df43b60912111531o1d5e0da2heda61de0df987e66@mail.gmail.com> <93df43b60912140717t51308807t89e5223af053ba53@mail.gmail.com> <5db086ad0912140732q6c4a890epb40ffdd96a18bdf7@mail.gmail.com> Message-ID: <401d3ba30912140737k30425b8aq9a869b1b06278a17@mail.gmail.com> 2009/12/14, Doug Fort : > On Mon, Dec 14, 2009 at 10:17 AM, Dan Gudmundsson [...] >> Have you remembered to load the public_key application, >> which is required by ssl if new_ssl is used? >> >> aha! That's it! It works fine in embedded mode when I add {public_key, > "0.4"} to the release file. Sorry about the confusion and thanks for your > help. By the way, wouldn't it be feasible if ssl would automatically start public_key and crypto? Some really stupid errors could be avoided (guess what application I forgot to start)... From doug.fort@REDACTED Mon Dec 14 16:53:43 2009 From: doug.fort@REDACTED (Doug Fort) Date: Mon, 14 Dec 2009 10:53:43 -0500 Subject: [erlang-questions] new ssl vs embedded mode In-Reply-To: <401d3ba30912140737k30425b8aq9a869b1b06278a17@mail.gmail.com> References: <5db086ad0912110716j134c7dfbha2393eccce56e56e@mail.gmail.com> <93df43b60912111531o1d5e0da2heda61de0df987e66@mail.gmail.com> <93df43b60912140717t51308807t89e5223af053ba53@mail.gmail.com> <5db086ad0912140732q6c4a890epb40ffdd96a18bdf7@mail.gmail.com> <401d3ba30912140737k30425b8aq9a869b1b06278a17@mail.gmail.com> Message-ID: <5db086ad0912140753p2197d574p31a89aab8b883a9a@mail.gmail.com> On Mon, Dec 14, 2009 at 10:37 AM, Attila Rajmund Nohl < attila.r.nohl@REDACTED> wrote: > 2009/12/14, Doug Fort : > > On Mon, Dec 14, 2009 at 10:17 AM, Dan Gudmundsson > [...] > >> Have you remembered to load the public_key application, > >> which is required by ssl if new_ssl is used? > >> > >> aha! That's it! It works fine in embedded mode when I add {public_key, > > "0.4"} to the release file. Sorry about the confusion and thanks for your > > help. > > By the way, wouldn't it be feasible if ssl would automatically start > public_key and crypto? Some really stupid errors could be avoided > (guess what application I forgot to start)... > > The problem is not starting them, but having them available in embedded mode. See 1.4 here http://www.erlang.org/doc/system_principles/system_principles.html Even if there were some way to start them implicitly, I would rather have them declared explicitly in the release file (now that I know). -- Doug Fort, Consulting Programmer http://www.dougfort.com Sent from Arlington, VA, United States From goran.bage@REDACTED Mon Dec 14 16:56:02 2009 From: goran.bage@REDACTED (=?UTF-8?B?R8O2cmFuIELDpWdl?=) Date: Mon, 14 Dec 2009 16:56:02 +0100 Subject: erlang emacs mode question Message-ID: <4B266012.1020807@mobilearts.com> Hi, Is there a reason why the erlang emacs mode treats comment (^C^C) and un-comment (^C^U) asymmetrical, comment adds '%% ' and uncomment removes '%'. Pretty annoying if you ask me (but who would even think of doing that :-). It used to work by adding only '%' earlier (maybe very much earlier like in R9 or so). Cheers -- -- Goran --------------------- May the Snow be with you -------- Goran Bage MobileArts www.mobilearts.se Tjarhovsgatan 56 SE-116 28 STOCKHOLM Sweden goran.bage@REDACTED phone: +46 733 358405 From dangud@REDACTED Mon Dec 14 17:10:16 2009 From: dangud@REDACTED (Dan Gudmundsson) Date: Mon, 14 Dec 2009 17:10:16 +0100 Subject: [erlang-questions] erlang emacs mode question In-Reply-To: <4B266012.1020807@mobilearts.com> References: <4B266012.1020807@mobilearts.com> Message-ID: <93df43b60912140810i535b66fdm9e60c3fa26271209@mail.gmail.com> On Mon, Dec 14, 2009 at 4:56 PM, G?ran B?ge wrote: > Hi, > > Is there a reason why the erlang emacs mode treats comment (^C^C) and > un-comment > (^C^U) asymmetrical, comment adds '%% ' and uncomment removes '%'. Pretty > annoying if you ask me (but who would even think of doing that :-). It used > to work by adding only '%' earlier (maybe very much earlier like in R9 or > so). Have you tried the latest erlang mode, on github or in R13B03? Both ^U^C^C and ^C^U works for me. /Dan PS: There are a lot of changes in the latest release of the erlang emacs mode, so if we broke something please report or even better post a patch. From schramm.ingo@REDACTED Mon Dec 14 17:43:45 2009 From: schramm.ingo@REDACTED (ingo.schramm) Date: Mon, 14 Dec 2009 08:43:45 -0800 (PST) Subject: Higher Order Modules Message-ID: <06936539-4cc1-4ba4-abce-fec5d09d0a01@z41g2000yqz.googlegroups.com> I wonder if parameterized modules are really intended to do OOP stuff only. It seems to be possible to use this feature to implement something like higher order modules, modules parameterized by other modules. As an example I could write a monoid module like this: >>> -module(monoid,[Impl]). -export([op/2,cmp/2,get_id/0,get_member/0,is_member/1,proof/0]). %% ------ INTERFACE ----- % apply monoid operation op(A,B) -> case members([A,B]) of true -> Impl:op(A,B); false -> undef end. % compare two values if they are equal or not cmp(A,B) -> case members([A,B]) of true -> Impl:cmp(A,B); false -> undef end. % get the identity or neutral element get_id() -> Impl:get_id(). % get an arbitrary member element get_member() -> Impl:get_member(). % test whether A is a member or not is_member(A) -> case Impl:is_member(A) of true -> Impl:is_member(Impl:op(A,Impl:get_id())); false -> false end. % give proof of monoid laws proof() -> prove_all() %% ------ PRIVATE ------ prove() -> I = Impl:get_id(), A = Impl:get_member(), B = A, Op = prove_closed(A,B), C = op(A,B), Assoc = prove_assoc(A,B,C), Id = prove_identity(N,A), neg(lists:member(false,[Op,Assoc,Id])). prove_closed(A,B) -> Impl:is_member(Impl:op(A,B)). prove_assoc(A,B,C) -> Impl:op(Impl:op(A,B), C) =:= Impl:op(A, Impl:op(B,C)). prove_identity(I,A) -> 0 =:= Impl:cmp(A,Impl:op(I,A)). neg(true) -> false; neg(false) -> true. % empty set is always member members([]) -> true; members(L = [A|_]) -> neg(lists:member(false, [ is_member(X) || X <- L])). <<< Next I could write a module representing the additive monoid of natural numbers (including zero): >>> -module(n_add). -export([op/2,cmp/2,get_id/0,get_member/0,is_member/1]). op(A,B) -> A + B. cmp(A,B) when A =/= B -> -1; cmp(A,B) when A =:= B -> 0. get_id() -> 0. get_member() -> 1. is_member(A) when is_integer(A), A < 0 -> false; is_member(A) when is_integer(A), A >= 0 -> true; is_member(_A) -> false. <<< And then I use it: --- 1> M = monoid:new(n_add). {monoid,n_add} 2> M:proof(). true 3> M:op(1,2). 3 --- Another implementation may do matrix operations. It is also easy to add more structure, for example to turn the monoid into a group by adding op_inverse/2. Does that make any sense? Ingo From kiszl@REDACTED Mon Dec 14 18:08:12 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Mon, 14 Dec 2009 18:08:12 +0100 Subject: [erlang-questions] Higher Order Modules In-Reply-To: <06936539-4cc1-4ba4-abce-fec5d09d0a01@z41g2000yqz.googlegroups.com> References: <06936539-4cc1-4ba4-abce-fec5d09d0a01@z41g2000yqz.googlegroups.com> Message-ID: <4B2670FC.8070400@tmit.bme.hu> ingo.schramm wrote: > I wonder if parameterized modules are really intended to do OOP stuff > only. It seems to be possible to use this feature to implement > something like higher order modules, modules parameterized by other > modules. > > As an example I could write a monoid module like this: > > > -module(monoid,[Impl]). > -export([op/2,cmp/2,get_id/0,get_member/0,is_member/1,proof/0]). > > %% ------ INTERFACE ----- > > % apply monoid operation > op(A,B) -> > case members([A,B]) of > true -> Impl:op(A,B); > false -> undef > end. > > % compare two values if they are equal or not > cmp(A,B) -> > case members([A,B]) of > true -> Impl:cmp(A,B); > false -> undef > end. > > % get the identity or neutral element > get_id() -> > Impl:get_id(). > > % get an arbitrary member element > get_member() -> > Impl:get_member(). > > % test whether A is a member or not > is_member(A) -> > case Impl:is_member(A) of > true -> > Impl:is_member(Impl:op(A,Impl:get_id())); > false -> > false > end. > > % give proof of monoid laws > proof() -> > prove_all() > > %% ------ PRIVATE ------ > > prove() -> > I = Impl:get_id(), > A = Impl:get_member(), > B = A, > Op = prove_closed(A,B), > C = op(A,B), > Assoc = prove_assoc(A,B,C), > Id = prove_identity(N,A), > neg(lists:member(false,[Op,Assoc,Id])). > > prove_closed(A,B) -> > Impl:is_member(Impl:op(A,B)). > > prove_assoc(A,B,C) -> > Impl:op(Impl:op(A,B), C) =:= Impl:op(A, Impl:op(B,C)). > > prove_identity(I,A) -> > 0 =:= Impl:cmp(A,Impl:op(I,A)). > > neg(true) -> false; > neg(false) -> true. > > % empty set is always member > members([]) -> > true; > members(L = [A|_]) -> > neg(lists:member(false, [ is_member(X) || X <- L])). > > <<< > > Next I could write a module representing the additive monoid of > natural numbers (including zero): > > > -module(n_add). > -export([op/2,cmp/2,get_id/0,get_member/0,is_member/1]). > > op(A,B) -> > A + B. > > cmp(A,B) when A =/= B -> > -1; > cmp(A,B) when A =:= B -> > 0. > > get_id() -> > 0. > > get_member() -> > 1. > > is_member(A) when is_integer(A), A < 0 -> > false; > is_member(A) when is_integer(A), A >= 0 -> > true; > is_member(_A) -> > false. > <<< > > And then I use it: > --- > 1> M = monoid:new(n_add). > {monoid,n_add} > 2> M:proof(). > true > 3> M:op(1,2). > 3 > --- > > Another implementation may do matrix operations. It is also easy to > add more structure, for example to turn the monoid into a group by > adding op_inverse/2. > > Does that make any sense? > > Ingo > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > Smells like the abstract factory pattern. Or is this dependency injection ? :-) Z. From schramm.ingo@REDACTED Mon Dec 14 18:13:07 2009 From: schramm.ingo@REDACTED (ingo.schramm) Date: Mon, 14 Dec 2009 09:13:07 -0800 (PST) Subject: Higher Order Modules In-Reply-To: <4B2670FC.8070400@tmit.bme.hu> References: <06936539-4cc1-4ba4-abce-fec5d09d0a01@z41g2000yqz.googlegroups.com> <4B2670FC.8070400@tmit.bme.hu> Message-ID: Or strategy? Or OCaml Functors? :) Ingo On Dec 14, 6:08?pm, Zoltan Lajos Kis wrote: > ingo.schramm wrote: > > I wonder if parameterized modules are really intended to do OOP stuff > > only. It seems to be possible to use this feature to implement > > something like higher order modules, modules parameterized by other > > modules. > > > As an example I could write a monoid module like this: > > > -module(monoid,[Impl]). > > -export([op/2,cmp/2,get_id/0,get_member/0,is_member/1,proof/0]). > > > %% ------ INTERFACE ----- > > > % apply monoid operation > > op(A,B) -> > > ? ? case members([A,B]) of > > ? ? ? ? true ?-> Impl:op(A,B); > > ? ? ? ? false -> undef > > ? ? end. > > > % compare two values if they are equal or not > > cmp(A,B) -> > > ? ? case members([A,B]) of > > ? ? ? ? true ?-> Impl:cmp(A,B); > > ? ? ? ? false -> undef > > ? ? end. > > > % get the identity or neutral element > > get_id() -> > > ? ? Impl:get_id(). > > > % get an arbitrary member element > > get_member() -> > > ? ? Impl:get_member(). > > > % test whether A is a member or not > > is_member(A) -> > > ? ? case Impl:is_member(A) of > > ? ? ? ? true -> > > ? ? ? ? ? ? Impl:is_member(Impl:op(A,Impl:get_id())); > > ? ? ? ? false -> > > ? ? ? ? ? ? false > > ? ? end. > > > % give proof of monoid laws > > proof() -> > > ? ? prove_all() > > > %% ------ PRIVATE ------ > > > prove() -> > > ? ? I = Impl:get_id(), > > ? ? A = Impl:get_member(), > > ? ? B = A, > > ? ? Op = prove_closed(A,B), > > ? ? C = op(A,B), > > ? ? Assoc = prove_assoc(A,B,C), > > ? ? Id = prove_identity(N,A), > > ? ? neg(lists:member(false,[Op,Assoc,Id])). > > > prove_closed(A,B) -> > > ? ? Impl:is_member(Impl:op(A,B)). > > > prove_assoc(A,B,C) -> > > ? ? Impl:op(Impl:op(A,B), C) =:= Impl:op(A, Impl:op(B,C)). > > > prove_identity(I,A) -> > > ? ? 0 =:= Impl:cmp(A,Impl:op(I,A)). > > > neg(true) -> false; > > neg(false) -> true. > > > % empty set is always member > > members([]) -> > > ? ? true; > > members(L = [A|_]) -> > > ? ? neg(lists:member(false, [ is_member(X) || X <- L])). > > > <<< > > > Next I could write a module representing the additive monoid of > > natural numbers (including zero): > > > -module(n_add). > > -export([op/2,cmp/2,get_id/0,get_member/0,is_member/1]). > > > op(A,B) -> > > ? ? A + B. > > > cmp(A,B) when A =/= B -> > > ? ? -1; > > cmp(A,B) when A =:= B -> > > ? ? 0. > > > get_id() -> > > ? ? 0. > > > get_member() -> > > ? ? 1. > > > is_member(A) when is_integer(A), A < 0 -> > > ? ? false; > > is_member(A) when is_integer(A), A >= 0 -> > > ? ? true; > > is_member(_A) -> > > ? ? false. > > <<< > > > And then I use it: > > --- > > 1> M = monoid:new(n_add). > > {monoid,n_add} > > 2> M:proof(). > > true > > 3> M:op(1,2). > > 3 > > --- > > > Another implementation may do matrix operations. It is also easy to > > add more structure, for example to turn the monoid into a group by > > adding op_inverse/2. > > > Does that make any sense? > > > Ingo > > > ________________________________________________________________ > > erlang-questions mailing list. Seehttp://www.erlang.org/faq.html > > erlang-questions (at) erlang.org > > Smells like the abstract factory pattern. Or is this dependency > injection ? :-) > > Z. > > ________________________________________________________________ > erlang-questions mailing list. Seehttp://www.erlang.org/faq.html > erlang-questions (at) erlang.org From goran.bage@REDACTED Mon Dec 14 17:36:31 2009 From: goran.bage@REDACTED (=?ISO-8859-1?Q?G=F6ran_B=E5ge?=) Date: Mon, 14 Dec 2009 17:36:31 +0100 Subject: [erlang-questions] erlang emacs mode question In-Reply-To: <93df43b60912140810i535b66fdm9e60c3fa26271209@mail.gmail.com> References: <4B266012.1020807@mobilearts.com> <93df43b60912140810i535b66fdm9e60c3fa26271209@mail.gmail.com> Message-ID: <4B26698F.4000208@mobilearts.com> Thanks Dan, Yes it worked in R13B03, adding '%% ' and removing '%% '. Just my kind of timing bringing it up just when it was fixed, it's been bugging me for quite some time before I got around to asking:-). We are very slow moving to new releases as we have long lived products running out there, we still have some R9 based ones and I've not run R13 before, just installed it as a matter of fact. Cheers --G?ran Dan Gudmundsson wrote: > On Mon, Dec 14, 2009 at 4:56 PM, G?ran B?ge wrote: >> Hi, >> >> Is there a reason why the erlang emacs mode treats comment (^C^C) and >> un-comment >> (^C^U) asymmetrical, comment adds '%% ' and uncomment removes '%'. Pretty >> annoying if you ask me (but who would even think of doing that :-). It used >> to work by adding only '%' earlier (maybe very much earlier like in R9 or >> so). > > Have you tried the latest erlang mode, on github or in R13B03? > > Both ^U^C^C and ^C^U works for me. > > /Dan > PS: There are a lot of changes in the latest release of the erlang emacs mode, > so if we broke something please report or even better post a patch. -- -- Goran --------------------- May the Snow be with you -------- Goran Bage MobileArts www.mobilearts.se Tjarhovsgatan 56 SE-116 28 STOCKHOLM Sweden goran.bage@REDACTED phone: +46 733 358405 From jeraymond@REDACTED Mon Dec 14 19:13:04 2009 From: jeraymond@REDACTED (Jeremy Raymond) Date: Mon, 14 Dec 2009 13:13:04 -0500 Subject: [erlang-questions] Avoiding a bottleneck (nitrogen+yaws, app logic, couchbeam+couchdb) In-Reply-To: References: <59da11980912131023q36ab2138h9de32b468a85a3c4@mail.gmail.com> Message-ID: <59da11980912141013q7cdc7f0wd1b07f66d4625bbe@mail.gmail.com> Hi, Thanks I didn't think of this, but it seems reasonable. In your db interface did you return the PID of the worker back to the calling interface so it would know who to expect the response back from or just accept any response back of the correct type? Thanks, Jeremy On Sun, Dec 13, 2009 at 7:24 PM, Vasilij Savin wrote: > Greetings, > > I can tell you about the solution we used in similar situation. It does not > mean it is optimal, but it was the best we came up with. > > Each gen_server call to db interface will generate a separate handler > thread that will work with couchDB directly. You will need to pass both PID > and NodeID though. Then your client will have to wait for message from that > server thread using standard messaging or if it is gen_server itself - using > handle_info. > > This way interface between DB and frontend hopefully will not be > bottleneck, or at least should scale as each request will be handled by > separate thread. > > I would like to ask others to give opinion on this solution. > > Regards, > Vasilij Savin > From leaf.pub1@REDACTED Mon Dec 14 20:07:35 2009 From: leaf.pub1@REDACTED (Leaf Petersen) Date: Mon, 14 Dec 2009 11:07:35 -0800 Subject: Call For Participation: DAMP 2010 Message-ID: We hope to have good participation as usual from the Erlang community at the DAMP workshop in Madrid. Come by to share your thoughts, or just to see what's happening. Cheers, Leaf Petersen (General Chair) DAMP 2010: Workshop on Declarative Aspects of Multicore Programming Madrid, SPAIN (colocated with POPL 2010) January 19, 2010 damp10.cs.nmsu.edu The advent of multicore architectures has profoundly increased the importance of research in parallel computing. Modern platforms are becoming more complex and heterogenous and novel solutions are needed to account for their peculiarities. Multicore architectures will differ in significant ways from their multisocket predecessors. For example, the communication to compute bandwidth ratio is likely to be higher, which will positively impact performance. More generally, multicore architectures introduce several new dimensions of variability in both performance guarantees and architectural contracts, such as the memory model, that may not stabilize for several generations of product. Programs written in functional or (constraint-)logic programming languages, or in other highly declarative languages with a controlled use of side effects, can greatly simplify parallel programming. Such declarative programming allows for a deterministic semantics even when the underlying implementation might be highly non-deterministic. In addition to simplifying programming this can simplify debugging and analyzing correctness. DAMP 2010 is the fifth in a series of one-day workshops seeking to explore ideas in declarative programming language design that will greatly simplify programming for multicore architectures, and more generally for tightly coupled parallel architectures. DAMP seeks to gather together researchers in declarative approaches to parallel programming and to foster cross fertilization across different approaches. Preliminary Program: ==================== Tuesday January 19th, 2010: Invited Talk [9:00-10:00] * Parallelizing Constraint Programs. Laurent Michel (University of Connecticut) Coffee Break [10:00-10:30] Session 1 [10:30-11:30] * PASTHA - Parallelizing Stencil Calculations in Haskell Michael Lesniak * Ypnos: Declarative Parallel Structured Grid Programming Dominic Orchard, Alan Mycroft, Max Bolingbroke Coffee Break [11:30-12:00] Session 2 [12:00-13:00] * SequenceL: Transparency and Multi-core Parallelism Brad Nemanich, Daniel Cooke, Nelson Rushton * Efficient Parallel Programming in Poly/ML and Isabelle/ML David Matthews, Makarius Wenzel Lunch (PROVIDED by the Conference) [13:00-14:30] Session 3 [14:30-15:30] * S-Net for Multi-Memory Multicores Clemens Grelck, Jukka Julku, Frank Penczek * Compress-and-Conquer for Optimal Multicore Computing Z. George Mou, Hai Liu, Paul Hudak Coffee Break [15:30-16:00] Sesssion 4 [16:00-17:00] * Lightweight Ansynchrony using Parasitic Threads KC Sivaramakrishnan, Lukasz Ziarek, Raghavendra Prasad, Suresh Jagannathan * A Parallel ASP Instantiator Based on DLV Simona Perri, Francesco Ricca, Marco Sirianni Invited Talk [17:00-18:00] * Declarative Data-Parallel Programming with the Accellerator System Satnam Singh (Microsoft Research) URL: ==== http://damp10.cs.nmsu.edu From vasilij.savin@REDACTED Mon Dec 14 20:21:51 2009 From: vasilij.savin@REDACTED (Vasilij Savin) Date: Mon, 14 Dec 2009 21:21:51 +0200 Subject: [erlang-questions] Avoiding a bottleneck (nitrogen+yaws, app logic, couchbeam+couchdb) In-Reply-To: <59da11980912141013q7cdc7f0wd1b07f66d4625bbe@mail.gmail.com> References: <59da11980912131023q36ab2138h9de32b468a85a3c4@mail.gmail.com> <59da11980912141013q7cdc7f0wd1b07f66d4625bbe@mail.gmail.com> Message-ID: Greetings, We expect proper response and do not return PID back. Command looks like this RequesterPID ! {response, ResponseData} where ResponseData is record sent. Regards, Vasilij Savin On Mon, Dec 14, 2009 at 8:13 PM, Jeremy Raymond wrote: > Hi, > > Thanks I didn't think of this, but it seems reasonable. In your db > interface did you return the PID of the worker back to the calling interface > so it would know who to expect the response back from or just accept any > response back of the correct type? > > > Thanks, > > Jeremy > > > On Sun, Dec 13, 2009 at 7:24 PM, Vasilij Savin wrote: > >> Greetings, >> >> I can tell you about the solution we used in similar situation. It does >> not mean it is optimal, but it was the best we came up with. >> >> Each gen_server call to db interface will generate a separate handler >> thread that will work with couchDB directly. You will need to pass both PID >> and NodeID though. Then your client will have to wait for message from that >> server thread using standard messaging or if it is gen_server itself - using >> handle_info. >> >> This way interface between DB and frontend hopefully will not be >> bottleneck, or at least should scale as each request will be handled by >> separate thread. >> >> I would like to ask others to give opinion on this solution. >> >> Regards, >> Vasilij Savin >> > > From bruce@REDACTED Mon Dec 14 20:37:07 2009 From: bruce@REDACTED (Bruce Fitzsimons) Date: Tue, 15 Dec 2009 08:37:07 +1300 Subject: [erlang-patches] What's cooking in erlang/otp (2009-12-14) In-Reply-To: <4B264409.5030701@gmail.com> References: <4B264409.5030701@gmail.com> Message-ID: <4B2693E3.9020404@fitzsimons.org> Bj?rn Gustavsson wrote: > > Raimo (the maintainer of the sctp code in OTP) is quite busy > with the new erlang.org site (demo.erlang.org), so there might > be a while before he will look at this branch, but it will > definitely happen before the next release. > Thanks for all the updates Bj?rn. demo.erlang.org is looking good, and served by Erlang (inets/eptic) rather than Apache. Best of luck with the eventual launch. Regards, Bruce From jeraymond@REDACTED Mon Dec 14 21:16:11 2009 From: jeraymond@REDACTED (Jeremy Raymond) Date: Mon, 14 Dec 2009 15:16:11 -0500 Subject: [erlang-questions] Avoiding a bottleneck (nitrogen+yaws, app logic, couchbeam+couchdb) In-Reply-To: References: <59da11980912131023q36ab2138h9de32b468a85a3c4@mail.gmail.com> <59da11980912141013q7cdc7f0wd1b07f66d4625bbe@mail.gmail.com> Message-ID: <59da11980912141216w7942a97epc7349f1f46d4e87b@mail.gmail.com> Hello, In your design of the requester, does the requester timeout while waiting for the db if it doesn't receive a timely response or do you handle db errors another way? Thanks, Jeremy On Mon, Dec 14, 2009 at 2:21 PM, Vasilij Savin wrote: > Greetings, > > We expect proper response and do not return PID back. Command looks like > this > RequesterPID ! {response, ResponseData} > > where ResponseData is record sent. > > Regards, > Vasilij Savin > > > > On Mon, Dec 14, 2009 at 8:13 PM, Jeremy Raymond wrote: > >> Hi, >> >> Thanks I didn't think of this, but it seems reasonable. In your db >> interface did you return the PID of the worker back to the calling interface >> so it would know who to expect the response back from or just accept any >> response back of the correct type? >> >> >> Thanks, >> >> Jeremy >> >> >> On Sun, Dec 13, 2009 at 7:24 PM, Vasilij Savin wrote: >> >>> Greetings, >>> >>> I can tell you about the solution we used in similar situation. It does >>> not mean it is optimal, but it was the best we came up with. >>> >>> Each gen_server call to db interface will generate a separate handler >>> thread that will work with couchDB directly. You will need to pass both PID >>> and NodeID though. Then your client will have to wait for message from that >>> server thread using standard messaging or if it is gen_server itself - using >>> handle_info. >>> >>> This way interface between DB and frontend hopefully will not be >>> bottleneck, or at least should scale as each request will be handled by >>> separate thread. >>> >>> I would like to ask others to give opinion on this solution. >>> >>> Regards, >>> Vasilij Savin >>> >> >> > From MARTIN.LOGAN@REDACTED Mon Dec 14 23:28:55 2009 From: MARTIN.LOGAN@REDACTED (Logan, Martin) Date: Mon, 14 Dec 2009 16:28:55 -0600 Subject: [erlang-questions] erlang emacs mode question In-Reply-To: <4B26698F.4000208@mobilearts.com> Message-ID: BTW, the erlware erlang mode "erlware-mode" is much better than the erlang mode. Many bugs have been fixed and the skeletons are all edoc'd. It has been well maintained for over 2 years and is now way ahead IMHO. You can find it at erlware.org or over at the google code site code.google.com/p/erlware-mode Cheers, Martin On 12/14/09 10:36 AM, "G?ran B?ge" wrote: Thanks Dan, Yes it worked in R13B03, adding '%% ' and removing '%% '. Just my kind of timing bringing it up just when it was fixed, it's been bugging me for quite some time before I got around to asking:-). We are very slow moving to new releases as we have long lived products running out there, we still have some R9 based ones and I've not run R13 before, just installed it as a matter of fact. Cheers --G?ran Dan Gudmundsson wrote: > On Mon, Dec 14, 2009 at 4:56 PM, G?ran B?ge wrote: >> Hi, >> >> Is there a reason why the erlang emacs mode treats comment (^C^C) and >> un-comment >> (^C^U) asymmetrical, comment adds '%% ' and uncomment removes '%'. Pretty >> annoying if you ask me (but who would even think of doing that :-). It used >> to work by adding only '%' earlier (maybe very much earlier like in R9 or >> so). > > Have you tried the latest erlang mode, on github or in R13B03? > > Both ^U^C^C and ^C^U works for me. > > /Dan > PS: There are a lot of changes in the latest release of the erlang emacs mode, > so if we broke something please report or even better post a patch. -- -- Goran --------------------- May the Snow be with you -------- Goran Bage MobileArts www.mobilearts.se Tjarhovsgatan 56 SE-116 28 STOCKHOLM Sweden goran.bage@REDACTED phone: +46 733 358405 ________________________________________________________________ erlang-questions mailing list. See http://www.erlang.org/faq.html erlang-questions (at) erlang.org From daveb@REDACTED Tue Dec 15 00:33:35 2009 From: daveb@REDACTED (Dave Bryson) Date: Mon, 14 Dec 2009 17:33:35 -0600 Subject: WebSocket impl for Mochiweb Message-ID: <22389591-5169-4E72-AA4F-93F39CEA776D@miceda.org> Like many others, the WebSocket bug bit me. So I've implemented a little add on for Mochiweb. Basically the module wraps the mochiweb_socket_server and allows you to write WebSocket based apps similar to how you'd write a regular web application in Mochiweb. Here's an example from the source code: -module(basic_websocket). -export([start/1, stop/0, loop/1]). start(Options) -> Loop = fun (WebSocket) -> ?MODULE:loop(WebSocket) end, mochiweb_websocket:start([{name, ?MODULE}, {loop, Loop} | Options]). stop() -> mochiweb_websocket:stop(?MODULE). loop(WebSocket) -> %% Get the data sent from the client Data = WebSocket:get_data(), %% This is a little echo service. The "client-connected" is just our implementation %% for this example. See priv/www/index.html case Data of "client-connected" -> WebSocket:send("You are connected!"); %% Other messages go here Other -> Msg = "You Said: " ++ Other, WebSocket:send(Msg) end. You can find the source here: http://github.com/davebryson/erlang_websocket This is just a quick bit of code, but it seems to work fine for playing around. Dave From kaiduanx@REDACTED Tue Dec 15 00:55:48 2009 From: kaiduanx@REDACTED (Kaiduan Xie) Date: Mon, 14 Dec 2009 18:55:48 -0500 Subject: wx in OTP13B03 failed to build on Ubuntu 8.10 Message-ID: kaiduanx@REDACTED:~/otp_src_R13B03/lib/wx$ ./configure checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking for g++... g++ checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking for ranlib... ranlib checking how to run the C preprocessor... gcc -E configure: Building for linux-gnu checking for mixed cygwin and native VC++ environment... no checking for mixed cygwin and native MinGW environment... no checking if we mix cygwin with any native compiler... no checking for egrep... grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking for void *... yes checking size of void *... 4 checking for erl... yes checking for erlc... yes configure: ERL ROOT DIR: /usr/local/lib/erlang checking for debug build of wxWidgets... checking for wx-config... /usr/bin/wx-config checking for wxWidgets version >= 2.8.4 (--unicode --debug=yes)... yes (version 2.8.8) checking for wxWidgets static library... no checking for standard build of wxWidgets... checking for wx-config... (cached) /usr/bin/wx-config checking for wxWidgets version >= 2.8.4 (--unicode --debug=no)... yes (version 2.8.8) checking for wxWidgets static library... no checking GL/gl.h usability... yes checking GL/gl.h presence... yes checking for GL/gl.h... yes checking OpenGL/gl.h usability... no checking OpenGL/gl.h presence... no checking for OpenGL/gl.h... no checking if wxwidgets have opengl support... no checking for GLintptr... yes checking for GLintptrARB... yes checking for GLchar... yes checking for GLcharARB... yes checking for GLhalfARB... yes checking for GLint64EXT... yes checking GLU Callbacks uses Tiger Style... no checking for wx/stc/stc.h... no configure: WARNING: Can not find wx/stc/stc.h checking if we can link wxwidgets programs... no configure: WARNING: Can not link wx program are all developer packages installed? configure: error: Cannot build wxErlang driver, see ./CONF_INFO for information kaiduanx@REDACTED:~/otp_src_R13B03/lib/wx$ FYI, include files for wx are in /usr/include/wx-2.8/wx, lib files are in /usr/lib. kaiduanx@REDACTED:~$ wx-config --cppflags -I/usr/lib/wx/include/base-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DwxUSE_GUI=0 kaiduanx@REDACTED:~$ wx-config --libs -pthread -Wl,-Bsymbolic-functions -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8 kaiduanx@REDACTED:~$ wx-config --libs static -pthread -Wl,-Bsymbolic-functions -lwx_baseu_static-2.8 -lwx_baseu-2.8 kaiduanx@REDACTED:~$ wx-config --version-full 2.8.8.0 kaiduanx@REDACTED:~$ ls /usr/include/wx-2.8/wx/stc/stc.h /usr/include/wx-2.8/wx/stc/stc.h kaiduanx@REDACTED:~$ Did anyone get luck to build wx on Ubuntu 8.10? I want to try reltool out. Thanks, kaiduan From vik@REDACTED Tue Dec 15 01:19:49 2009 From: vik@REDACTED (Vik Olliver) Date: Tue, 15 Dec 2009 13:19:49 +1300 Subject: [erlang-questions] wx in OTP13B03 failed to build on Ubuntu 8.10 In-Reply-To: References: Message-ID: <4B26D625.5070805@catalyst.net.nz> Kaiduan Xie wrote: > Did anyone get luck to build wx on Ubuntu 8.10? I want to try reltool out. No, but have you got libwxgtk2.4-dev installed? Vik :v) From kaiduanx@REDACTED Tue Dec 15 01:47:02 2009 From: kaiduanx@REDACTED (Kaiduan Xie) Date: Mon, 14 Dec 2009 19:47:02 -0500 Subject: [erlang-questions] wx in OTP13B03 failed to build on Ubuntu 8.10 In-Reply-To: <4B26D625.5070805@catalyst.net.nz> References: <4B26D625.5070805@catalyst.net.nz> Message-ID: Vik, The problem was resolved after installing libwxgtk2.8-dev, thanks a lot for helping out. kaiduan On Mon, Dec 14, 2009 at 7:19 PM, Vik Olliver wrote: > Kaiduan Xie wrote: >> >> Did anyone get luck to build wx on Ubuntu 8.10? I want to try reltool out. > > No, but have you got libwxgtk2.4-dev installed? > > Vik :v) > From shenyute@REDACTED Tue Dec 15 02:35:38 2009 From: shenyute@REDACTED (Yu-Teh Shen) Date: Tue, 15 Dec 2009 09:35:38 +0800 Subject: [erlang-questions] about Erlang C Node monitor In-Reply-To: <73A7CDBF-080D-4705-9747-CD1B458754EC@mindspring.com> References: <65055d7c0912132336r1a8898q41d01a9fca3fc2e2@mail.gmail.com> <73A7CDBF-080D-4705-9747-CD1B458754EC@mindspring.com> Message-ID: <65055d7c0912141735t1918954cvf6529b484ef8142a@mail.gmail.com> Hi Matt, Thanks a lot! It help me a lot~ Shen, Yu-Teh On Mon, Dec 14, 2009 at 4:48 PM, Matt Stancliff wrote: > Yu-Teh, > > > On Dec 13, 2009, at 11:36 PM, Yu-Teh Shen wrote: > >> But what I should do if I want to *monitor* the C node like all other >> Erlang >> node and make erlang *connects*, *net_adm:ping* works? >> > > You can use erlang:monitor_node to monitor C nodes. > > Handling net_adm:ping in a C node takes a few steps. Here is what I use: > > main processing loop: > ===== > ETERM *gen_call = erl_format("~a", "$gen_call"); > > while (loop) { > > got = erl_receive_msg(fd, buf, BUFSIZE, &emsg); > if (got == ERL_TICK) { > /* ignore */ > } else if (got == ERL_ERROR) { > loop = 0; > > } > else { > if (emsg.type == ERL_REG_SEND) { > msg = erl_element(1, emsg.msg); > if (erl_match(_something_i_want_, msg)) { > /* blah */ > } > else if (erl_match(gen_call, msg)) { > process_gen_call(fd, emsg.from, emsg.msg); > } > } > } > erl_free_term(msg); > erl_free_term(emsg.msg); > erl_free_term(emsg.to); > erl_free_term(emsg.from); > } > erl_free_term(gen_call); > ===== > > Then, process_gen_call is: > ===== > /* gen_call with is_auth is for handling net_adm:ping responses. > The incoming message looks like: > {'$gen_call', {, #Ref<2394.0.0>}, > {is_auth, bob3@REDACTED}} > You must respond with the reference (element 2 of tuple 2) and "yes" > */ > static void process_gen_call(int fd, ETERM *from, ETERM *msg) { > ETERM *is_auth = erl_format("~a", "is_auth"); > ETERM *args = erl_element(3, msg); > ETERM *arg1 = erl_element(1, args); > if (erl_match(is_auth, arg1)) { > ETERM *fromp = erl_element(2, msg); > ETERM *resp = erl_format("{~w, yes}", erl_element(2, fromp)); > erl_send(fd, from, resp); > erl_free_compound(resp); > erl_free_term(fromp); > } > erl_free_term(args); > erl_free_term(arg1); > erl_free_term(is_auth); > } > ===== > > > Hope that helps, > > -Matt > -- > Matt Stancliff San Jose, CA > AIM: seijimr iPhone: 678-591-9337 > "The best way to predict the future is to invent it." --Alan Kay > > From vik@REDACTED Tue Dec 15 02:36:09 2009 From: vik@REDACTED (Vik Olliver) Date: Tue, 15 Dec 2009 14:36:09 +1300 Subject: [erlang-questions] wx in OTP13B03 failed to build on Ubuntu 8.10 In-Reply-To: References: <4B26D625.5070805@catalyst.net.nz> Message-ID: <4B26E809.9020206@catalyst.net.nz> Kaiduan Xie wrote: > Vik, > > The problem was resolved after installing libwxgtk2.8-dev, thanks a > lot for helping out. Glad to hear it, and you're quite welcome. Vik :v) From kagato@REDACTED Tue Dec 15 07:15:12 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Mon, 14 Dec 2009 22:15:12 -0800 Subject: [erlang-questions] Read and delete file In-Reply-To: References: ,<1260542692.9474.35.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> ,<09BCE83B-A1C3-47DD-BBCD-BAD223C8239B@souja.net> Message-ID: <2C136388-1272-47E9-8EC5-16FB1C8E5E6A@souja.net> Do you have control over the file? Can you rotate between files automatically? This is easy. Deleting lines from the beginning of the file requires rewriting the whole file. It's just the way that files are. Sorry. On Dec 14, 2009, at 10:06 PM, maruthavanan s wrote: > Hi, > > My requirement is quite simple, > > I have a large file which contains numbers and I shall take those numbers process the numbers and delete the processsed numbers. There are was where I can pause this process at certain conditions and resume when user instructs me to do so. > > Regards, > Marutha > > > From: kagato@REDACTED > > Date: Sat, 12 Dec 2009 02:40:37 -0800 > > CC: bengt.kleberg@REDACTED; erlang-questions@REDACTED > > To: maruthavanan_s@REDACTED > > Subject: Re: [erlang-questions] Read and delete file > > > > Under Unix, there is no good way to delete a line from the front of a file. You can truncate the file (shorten it, cutting lines off at the end), but not from the front. > > > > If you're willing to do it all on disk (possibly with multiple copies of the data), it can be done, but it's hard to make a recommendation without knowing exactly what you're doing. > > > > On Dec 12, 2009, at 2:18 AM, maruthavanan s wrote: > > > > > > > > Hi, > > > > > > The file is huge so I cannot take and keep it in memory. > > > > > > Regards, > > > Marutha > > > > > >> To: > > >> From: bengt.kleberg@REDACTED > > >> CC: erlang-questions@REDACTED > > >> Date: Fri, 11 Dec 2009 15:44:52 +0100 > > >> Subject: Re: [erlang-questions] Read and delete file > > >> > > >> Greetings, > > >> > > >> The simplest way, if you can have the whole file in memory, would be to > > >> read all lines, handle a single line and then write all the remaining > > >> lines out to the file. Then repeat. > > >> Use file:read_file/1 (split the line from the binary) and > > >> file:write_file/2. > > >> > > >> > > >> bengt > > >> > > >> On Fri, 2009-12-11 at 08:50 -0500, maruthavanan s wrote: > > >>> Hi, > > >>> > > >>> I am opening a file using file and I read the file line by line using io:get_line. > > >>> But after reading this line I need to delete the read line from the file. > > >>> > > >>> Appreciate you help. > > >>> > > >>> Thanks, > > >>> Marutha > > >>> > > >> > > >> > > >> ________________________________________________________________ > > >> erlang-questions mailing list. See http://www.erlang.org/faq.html > > >> erlang-questions (at) erlang.org > > >> > > > > > > > > > ________________________________________________________________ > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > erlang-questions (at) erlang.org > > -- Jayson Vantuyl kagato@REDACTED From maruthavanan_s@REDACTED Tue Dec 15 07:06:57 2009 From: maruthavanan_s@REDACTED (maruthavanan s) Date: Tue, 15 Dec 2009 01:06:57 -0500 Subject: [erlang-questions] Read and delete file In-Reply-To: <09BCE83B-A1C3-47DD-BBCD-BAD223C8239B@souja.net> References: ,<1260542692.9474.35.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> ,<09BCE83B-A1C3-47DD-BBCD-BAD223C8239B@souja.net> Message-ID: Hi, My requirement is quite simple, I have a large file which contains numbers and I shall take those numbers process the numbers and delete the processsed numbers. There are was where I can pause this process at certain conditions and resume when user instructs me to do so. Regards, Marutha > From: kagato@REDACTED > Date: Sat, 12 Dec 2009 02:40:37 -0800 > CC: bengt.kleberg@REDACTED; erlang-questions@REDACTED > To: maruthavanan_s@REDACTED > Subject: Re: [erlang-questions] Read and delete file > > Under Unix, there is no good way to delete a line from the front of a file. You can truncate the file (shorten it, cutting lines off at the end), but not from the front. > > If you're willing to do it all on disk (possibly with multiple copies of the data), it can be done, but it's hard to make a recommendation without knowing exactly what you're doing. > > On Dec 12, 2009, at 2:18 AM, maruthavanan s wrote: > > > > > Hi, > > > > The file is huge so I cannot take and keep it in memory. > > > > Regards, > > Marutha > > > >> To: > >> From: bengt.kleberg@REDACTED > >> CC: erlang-questions@REDACTED > >> Date: Fri, 11 Dec 2009 15:44:52 +0100 > >> Subject: Re: [erlang-questions] Read and delete file > >> > >> Greetings, > >> > >> The simplest way, if you can have the whole file in memory, would be to > >> read all lines, handle a single line and then write all the remaining > >> lines out to the file. Then repeat. > >> Use file:read_file/1 (split the line from the binary) and > >> file:write_file/2. > >> > >> > >> bengt > >> > >> On Fri, 2009-12-11 at 08:50 -0500, maruthavanan s wrote: > >>> Hi, > >>> > >>> I am opening a file using file and I read the file line by line using io:get_line. > >>> But after reading this line I need to delete the read line from the file. > >>> > >>> Appreciate you help. > >>> > >>> Thanks, > >>> Marutha > >>> > >> > >> > >> ________________________________________________________________ > >> erlang-questions mailing list. See http://www.erlang.org/faq.html > >> erlang-questions (at) erlang.org > >> > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From dangud@REDACTED Tue Dec 15 09:32:29 2009 From: dangud@REDACTED (Dan Gudmundsson) Date: Tue, 15 Dec 2009 09:32:29 +0100 Subject: [erlang-questions] erlang emacs mode question In-Reply-To: References: <4B26698F.4000208@mobilearts.com> Message-ID: <93df43b60912150032r537d1262u4efc8aa4546d11c4@mail.gmail.com> Hi Martin I guess you haven't tested the new erlang mode either :-) or have you incorporated the fixes we have done? I used the erlware version myself before Kenneth hit me hard and told me to fix our version and apply the patches we had received. The one thing I miss is the edoc skeltons which you have and that you broke out the skeletons to a separate file. I don't use distel either so maybe your variant works better with that. But I have "stolen" some of the fixes you had and done many more and added several large patches from Anders Dahlin and Tomas Abrahamsson into which I think is a better version. Hopefully now with erlang on github we can join our efforts again, so that we can get the best of the two things. I know that our support of the emacs mode havn't been the best and when time is tight the emacs mode get down prioritized. It will probably happen again but now with erlang on github available it should be easier to apply the improvements the community makes. Cheers (I think I owe you one) /Dan On Mon, Dec 14, 2009 at 11:28 PM, Logan, Martin wrote: > BTW, ?the erlware erlang mode ?erlware-mode? is much better than the erlang > mode. ?Many bugs have been fixed and the skeletons are all edoc?d. ?It has > been well maintained for over 2 years and is now way ahead IMHO. ?You can > find it at erlware.org or over at the google code site > code.google.com/p/erlware-mode > > Cheers, > Martin > > > On 12/14/09 10:36 AM, "G?ran B?ge" wrote: > > Thanks Dan, > > Yes it worked in R13B03, adding '%% ' and removing '%% '. Just my kind > of timing bringing it up just when it was fixed, it's been bugging me for > quite some time before I got around to asking:-). We are very slow > moving to new releases as we have long lived products running out there, > we still have some R9 based ones and I've not run R13 before, just installed > it as a matter of fact. > > Cheers > --G?ran > > Dan Gudmundsson wrote: >> On Mon, Dec 14, 2009 at 4:56 PM, G?ran B?ge >> ?wrote: >>> Hi, >>> >>> Is there a reason why the erlang emacs mode treats comment (^C^C) and >>> un-comment >>> (^C^U) asymmetrical, comment adds '%% ' and uncomment removes '%'. Pretty >>> annoying if you ask me (but who would even think of doing that :-). It >>> used >>> to work by adding only '%' earlier (maybe very much earlier like in R9 or >>> so). >> >> Have you tried the latest erlang mode, on github or in R13B03? >> >> Both ^U^C^C and ^C^U works for me. >> >> /Dan >> PS: There are a lot of changes in the latest release of the erlang emacs >> mode, >> ????????so if we broke something please report or even better post a >> patch. > > -- > -- Goran > --------------------- May the Snow be with you -------- > ??Goran Bage ????????MobileArts ???????www.mobilearts.se > ??Tjarhovsgatan 56 ?SE-116 28 STOCKHOLM ??????????Sweden > ??goran.bage@REDACTED ????????phone: +46 733 358405 > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > > From erlang@REDACTED Tue Dec 15 09:50:24 2009 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 15 Dec 2009 09:50:24 +0100 Subject: [erlang-questions] WebSocket impl for Mochiweb In-Reply-To: <22389591-5169-4E72-AA4F-93F39CEA776D@miceda.org> References: <22389591-5169-4E72-AA4F-93F39CEA776D@miceda.org> Message-ID: <9b08084c0912150050o4f9b21a5m895940bb6d53320e@mail.gmail.com> Sweet. You have a nice way of encapsulating the interface in a Fun. Now all we need is a javascript IRC client that talks web-sockets and a server that understands the IRC protocol, and a backend based on a DHT (like riak) and we have a high scalable robust p2p architecture for chat/whatever !!! I can contribute a IRC server that is pretty basic (it's almost done) Just need riak integration and a javascript client. /Joe On Tue, Dec 15, 2009 at 12:33 AM, Dave Bryson wrote: > Like many others, the WebSocket bug bit me. So I've implemented a little add > on for Mochiweb. Basically the module wraps the mochiweb_socket_server and > allows you to write WebSocket based apps similar to how you'd write a > regular web application in Mochiweb. ?Here's an example from the source > code: > > -module(basic_websocket). > -export([start/1, stop/0, loop/1]). > > start(Options) -> > ? ?Loop = fun (WebSocket) -> > ? ? ? ? ? ? ? ? ? ?MODULE:loop(WebSocket) > ? ? ? ? ? end, > ? ?mochiweb_websocket:start([{name, ?MODULE}, {loop, Loop} | Options]). > > stop() -> > ? ?mochiweb_websocket:stop(?MODULE). > > loop(WebSocket) -> > ? ?%% Get the data sent from the client > ? ?Data = WebSocket:get_data(), > > ? ?%% This is a little echo service. ?The "client-connected" is just our > implementation > ? ?%% for this example. ?See priv/www/index.html > ? ?case Data of > ? ? ? ?"client-connected" -> > ? ? ? ? ? ?WebSocket:send("You are connected!"); > ? ? ? ?%% Other messages go here > ? ? ? ?Other -> > ? ? ? ? ? ?Msg = "You Said: " ++ Other, > ? ? ? ? ? ?WebSocket:send(Msg) > ? ?end. > > > You can find the source here: ?http://github.com/davebryson/erlang_websocket > > This is just a quick bit of code, but it seems to work fine for playing > around. > > Dave > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From torben.lehoff@REDACTED Tue Dec 15 09:52:27 2009 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Tue, 15 Dec 2009 09:52:27 +0100 Subject: Getting typer to work for me Message-ID: Hi. I have the following code: -module(ups). -export([fup/1]). -spec fup(integer()) -> {'ok',integer()} | 'wrong'. fup(1) -> {ok,2}; fup(_) -> not_okay. And I sort of expected that typer would find the problem in the fup(_) case, but I have to use dialyzer -Wspecdiffs --src ups.erl in order to get the warning I want (namely that the code does not match the spec), but the dialyzer docs warns against using this option. Am I asking too much? Should I shake off more of my SML heritage? Am I doing something wrong? Any advice appreciated! Cheers, Torben -- http://www.linkedin.com/in/torbenhoffmann From bengt.kleberg@REDACTED Tue Dec 15 10:03:15 2009 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 15 Dec 2009 10:03:15 +0100 Subject: clarify: Is it a good idea to use xmerl_xml? Message-ID: <1260867795.5153.15.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Greetings, Can/Should I use xmerl_xml when building a simple XML document? When looking at the documentation for XMERL the module xmerl_xml is not mentioned. However, it does appear to be quite helpful when starting out with simple XML exports. See this link for an example: http://stackoverflow.com/questions/1227241/building-an-xmerl-document-in-erlang bengt From vasilij.savin@REDACTED Tue Dec 15 10:38:36 2009 From: vasilij.savin@REDACTED (Vasilij Savin) Date: Tue, 15 Dec 2009 10:38:36 +0100 Subject: [erlang-questions] Avoiding a bottleneck (nitrogen+yaws, app logic, couchbeam+couchdb) In-Reply-To: <59da11980912141216w7942a97epc7349f1f46d4e87b@mail.gmail.com> References: <59da11980912131023q36ab2138h9de32b468a85a3c4@mail.gmail.com> <59da11980912141013q7cdc7f0wd1b07f66d4625bbe@mail.gmail.com> <59da11980912141216w7942a97epc7349f1f46d4e87b@mail.gmail.com> Message-ID: There is a set timeout. Because, if there is no data to send, we let client to timeout and ask again. Errors are just logged locally and not propagated to client. Regards, Vasilij Savin From kostis@REDACTED Tue Dec 15 10:45:11 2009 From: kostis@REDACTED (Kostis Sagonas) Date: Tue, 15 Dec 2009 11:45:11 +0200 Subject: [erlang-questions] Getting typer to work for me In-Reply-To: References: Message-ID: <4B275AA7.5060409@cs.ntua.gr> Torben Hoffmann wrote: > Hi. > > I have the following code: > > -module(ups). > > -export([fup/1]). > > -spec fup(integer()) -> {'ok',integer()} | 'wrong'. > > fup(1) -> > {ok,2}; > fup(_) -> > not_okay. > > And I sort of expected that typer would find the problem in the fup(_) case, > but I have to use > dialyzer -Wspecdiffs --src ups.erl > in order to get the warning I want (namely that the code does not match the > spec), but the dialyzer docs warns against using this option. > > Am I asking too much? Yes, you are. Granted that currently typer does not have proper documentation, so it's morally OK to fantasize whatever you want about what you like typer to do to your code ;-), but the fact is that typer is supposed to be just a type annotator of Erlang code, not a tool that detects type errors. Dialyzer is the tool that is supposed to do the latter. Typer works as follows: You start with a (partially spec-annotated) set of Erlang files. If the file(s) have some specs for some functions and these specs are not totally bogus, these are trusted and all that typer does is to generate specs for the rest of the functions in these files. Only if the specs cannot possibly be correct will typer complain about them. Your spec does not have that property: as far as the type system is concerned you have just specified something which is more constrained than it needs to be for the input argument and more general than reality in the function's returned. But there is no serious problem here. Try changing the spec to something really wrong: -spec fup(integer()) -> {'ok',atom()} | 'wrong'. and you will see that typer does indeed complain. Also, try the file without the spec and you will see that typer will give you the inferred success typing: -spec fup(_) -> 'not_okay' | {'ok',2}. But typer will never return anything that differs from specs which are already present in the file. These are simply returned as is. Hope this explains things, Kostis PS. Unrelated to the above, but the next version of dialyzer will report a warning in the case of your program without the use of -Wspecdiffs. From torben.lehoff@REDACTED Tue Dec 15 10:56:40 2009 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Tue, 15 Dec 2009 10:56:40 +0100 Subject: [erlang-questions] Getting typer to work for me In-Reply-To: <4B275AA7.5060409@cs.ntua.gr> References: <4B275AA7.5060409@cs.ntua.gr> Message-ID: On Tue, Dec 15, 2009 at 10:45, Kostis Sagonas wrote: > Torben Hoffmann wrote: > >> Hi. >> >> I have the following code: >> >> -module(ups). >> >> -export([fup/1]). >> >> -spec fup(integer()) -> {'ok',integer()} | 'wrong'. >> >> fup(1) -> >> {ok,2}; >> fup(_) -> >> not_okay. >> >> And I sort of expected that typer would find the problem in the fup(_) >> case, >> but I have to use >> dialyzer -Wspecdiffs --src ups.erl >> in order to get the warning I want (namely that the code does not match >> the >> spec), but the dialyzer docs warns against using this option. >> >> Am I asking too much? >> > > Yes, you are. > I thought as much ;-) > > Granted that currently typer does not have proper documentation, so it's > morally OK to fantasize whatever you want about what you like typer to do to > your code ;-), but the fact is that typer is supposed to be just a type > annotator of Erlang code, not a tool that detects type errors. Dialyzer is > the tool that is supposed to do the latter. > I got that a bit mixed up, so I will put my faith in Dialyzer going forward instead. Anyway, what is a man without a dream?!?! > > Typer works as follows: You start with a (partially spec-annotated) set of > Erlang files. If the file(s) have some specs for some functions and these > specs are not totally bogus, these are trusted and all that typer does is to > generate specs for the rest of the functions in these files. > Only if the specs cannot possibly be correct will typer complain about > them. Your spec does not have that property: as far as the type system is > concerned you have just specified something which is more constrained than > it needs to be for the input argument and more general than reality in the > function's returned. But there is no serious problem here. > > Try changing the spec to something really wrong: > > -spec fup(integer()) -> {'ok',atom()} | 'wrong'. > > and you will see that typer does indeed complain. > > Also, try the file without the spec and you will see that typer will give > you the inferred success typing: > > -spec fup(_) -> 'not_okay' | {'ok',2}. > > But typer will never return anything that differs from specs which are > already present in the file. These are simply returned as is. > > Hope this explains things, > It does - I actually did all of the above while waiting for the answer from above. I see a use for typer, but I will more likely fall in love with dialyzer instead. > > PS. Unrelated to the above, but the next version of dialyzer will report a > warning in the case of your program without the use of -Wspecdiffs. > That sounds like a good way of adding a little more type formalism to Erlang - in some situations the type information is actually worth quite a bit. Thanks for a very good explanation, Torben -- http://www.linkedin.com/in/torbenhoffmann From kostis@REDACTED Tue Dec 15 11:29:14 2009 From: kostis@REDACTED (Kostis Sagonas) Date: Tue, 15 Dec 2009 12:29:14 +0200 Subject: [erlang-questions] Getting typer to work for me In-Reply-To: References: <4B275AA7.5060409@cs.ntua.gr> Message-ID: <4B2764FA.5090600@cs.ntua.gr> Torben Hoffmann wrote: > On Tue, Dec 15, 2009 at 10:45, Kostis Sagonas wrote: > >> ... BIG SNIP .... >> >> But typer will never return anything that differs from specs which are >> already present in the file. These are simply returned as is. >> >> Hope this explains things, > > It does - I actually did all of the above while waiting for the answer from > above. I see a use for typer, but I will more likely fall in love with > dialyzer instead. Indeed, dialyzer is the tool to fall in love with. But typer also has a place in the Erlang tool chain. Once you have properly dialyzed your application and it does not contain any remaining discrepancies, typer can help you add -spec annotations to your code. These specs will most likely need to be manually refined, but use of typer may save you lots of time in adding proper specs. Not earthshaking, but it may help you improve your relationship with your real love as -type and -spec declarations typically allow dialyzer to detect more type errors. See also a paper from dialyzer's homepage that advocates and documents the process we recommend to dialyzer users: http://www.it.uu.se/research/group/hipe/dialyzer/publications/wrangler.pdf Cheers, Kostis From leap@REDACTED Tue Dec 15 11:33:58 2009 From: leap@REDACTED (Michael Turner) Date: Tue, 15 Dec 2009 10:33:58 +0000 Subject: How do I get the atom under which a process is registered? Message-ID: You can register processes under atoms, which I like very much. (Maybe too much: it's a little like having global variables.) But I haven't found a function like "registered_under/1" that, given a pid, returns an atom if the process is registered with one. (It can throw an exception or return false, if it's not registered. I don't really care which.) I can see how to write a function like that, if necessary. I'm just wondering if such a function already exists. Maybe I'm looking in the wrong place, or maybe it's undocumented. -michael turner From hakan@REDACTED Tue Dec 15 11:39:52 2009 From: hakan@REDACTED (=?ISO-8859-1?Q?H=E5kan_Mattsson?=) Date: Tue, 15 Dec 2009 11:39:52 +0100 Subject: [erlang-questions] How do I get the atom under which a process is registered? In-Reply-To: References: Message-ID: <922d05850912150239v4ad59aa9n2fd6c998ec1dac5a@mail.gmail.com> 3> Pid = whereis(user). <0.25.0> 4> process_info(Pid, registered_name). {registered_name,user} /H?kan On Tue, Dec 15, 2009 at 11:33 AM, Michael Turner wrote: > > You can register processes under atoms, which I like very much. ?(Maybe > too much: it's a little like having global variables.) But I haven't > found a function like "registered_under/1" that, given a pid, returns > an atom if the process is registered with one. ?(It can throw an > exception or return false, if it's not registered. ?I don't really > care which.) > > I can see how to write a function like that, if necessary. ?I'm just > wondering if such a function already exists. ?Maybe I'm looking in the > wrong place, or maybe it's undocumented. > > -michael turner From hynek@REDACTED Tue Dec 15 11:43:41 2009 From: hynek@REDACTED (Hynek Vychodil) Date: Tue, 15 Dec 2009 11:43:41 +0100 Subject: [erlang-questions] How do I get the atom under which a process is registered? In-Reply-To: References: Message-ID: <4d08db370912150243s6cbd7f8exa46d6fc52e173378@mail.gmail.com> See http://www.erlang.org/doc/man/erlang.html#process_info-2 and 'registered_name' Item On Tue, Dec 15, 2009 at 11:33 AM, Michael Turner wrote: > > You can register processes under atoms, which I like very much. ?(Maybe > too much: it's a little like having global variables.) But I haven't > found a function like "registered_under/1" that, given a pid, returns > an atom if the process is registered with one. ?(It can throw an > exception or return false, if it's not registered. ?I don't really > care which.) > > I can see how to write a function like that, if necessary. ?I'm just > wondering if such a function already exists. ?Maybe I'm looking in the > wrong place, or maybe it's undocumented. > > -michael turner > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try Good Data now for free: www.gooddata.com From rtrlists@REDACTED Tue Dec 15 12:44:54 2009 From: rtrlists@REDACTED (Robert Raschke) Date: Tue, 15 Dec 2009 11:44:54 +0000 Subject: [erlang-questions] clarify: Is it a good idea to use xmerl_xml? In-Reply-To: <1260867795.5153.15.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> References: <1260867795.5153.15.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Message-ID: <6a3ae47e0912150344x552e839p20aa10cb5f3cfa04@mail.gmail.com> Hi Bengt, On Tue, Dec 15, 2009 at 9:03 AM, Bengt Kleberg wrote: > Greetings, > > Can/Should I use xmerl_xml when building a simple XML document? > > When looking at the documentation for XMERL the module xmerl_xml is not > mentioned. However, it does appear to be quite helpful when starting out > with simple XML exports. See this link for an example: > > http://stackoverflow.com/questions/1227241/building-an-xmerl-document-in-erlang > > > bengt > > I use xmerl:export_simple([My_Tree], xmerl_xml) as well as xmerl:export_simple([My_Tree], xmerl_xml, [{prolog, [My_Prolog_String]}]) in production code. It is documented as part of the xmerl user guide in section 1.5 Example: Create XML Out Of Arbitrary Data (at least in R12B, haven't yet managed to upgrade to R13 yet). Robby From torben.lehoff@REDACTED Tue Dec 15 12:56:41 2009 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Tue, 15 Dec 2009 12:56:41 +0100 Subject: [erlang-questions] Getting typer to work for me In-Reply-To: <4B2764FA.5090600@cs.ntua.gr> References: <4B275AA7.5060409@cs.ntua.gr> <4B2764FA.5090600@cs.ntua.gr> Message-ID: On Tue, Dec 15, 2009 at 11:29, Kostis Sagonas wrote: > Torben Hoffmann wrote: > >> On Tue, Dec 15, 2009 at 10:45, Kostis Sagonas wrote: >> >> ... BIG SNIP .... >>> >>> >>> But typer will never return anything that differs from specs which are >>> already present in the file. These are simply returned as is. >>> >>> Hope this explains things, >>> >> >> It does - I actually did all of the above while waiting for the answer >> from >> above. I see a use for typer, but I will more likely fall in love with >> dialyzer instead. >> > > Indeed, dialyzer is the tool to fall in love with. > > But typer also has a place in the Erlang tool chain. Once you have > properly dialyzed your application and it does not contain any remaining > discrepancies, typer can help you add -spec annotations to your code. These > specs will most likely need to be manually refined, but use of typer may > save you lots of time in adding proper specs. Not earthshaking, but it may > help you improve your relationship with your real love as -type and -spec > declarations typically allow dialyzer to detect more type errors. > You are right, but I can only manage one mistress... ;-) > > See also a paper from dialyzer's homepage that advocates and documents the > process we recommend to dialyzer users: > > http://www.it.uu.se/research/group/hipe/dialyzer/publications/wrangler.pdf > Read it already - I like the process and I am going to use that. Cheers, Torben > > > Cheers, > Kostis > -- http://www.linkedin.com/in/torbenhoffmann From jeraymond@REDACTED Tue Dec 15 13:06:19 2009 From: jeraymond@REDACTED (Jeremy Raymond) Date: Tue, 15 Dec 2009 07:06:19 -0500 Subject: [erlang-questions] Avoiding a bottleneck (nitrogen+yaws, app logic, couchbeam+couchdb) In-Reply-To: References: <59da11980912131023q36ab2138h9de32b468a85a3c4@mail.gmail.com> <59da11980912141013q7cdc7f0wd1b07f66d4625bbe@mail.gmail.com> <59da11980912141216w7942a97epc7349f1f46d4e87b@mail.gmail.com> Message-ID: <59da11980912150406t7fdcc429mb3589193fceb5088@mail.gmail.com> Ok, thanks again. This strategy seems sound, I'll give it a try. Jeremy On Tue, Dec 15, 2009 at 4:38 AM, Vasilij Savin wrote: > There is a set timeout. Because, if there is no data to send, we let client > to timeout and ask again. > > Errors are just logged locally and not propagated to client. > > Regards, > Vasilij Savin > From anders@REDACTED Tue Dec 15 13:35:05 2009 From: anders@REDACTED (Anders Dahlin) Date: Tue, 15 Dec 2009 13:35:05 +0100 Subject: [erlang-questions] erlang emacs mode question In-Reply-To: <93df43b60912150032r537d1262u4efc8aa4546d11c4@mail.gmail.com> References: <4B26698F.4000208@mobilearts.com> <93df43b60912150032r537d1262u4efc8aa4546d11c4@mail.gmail.com> Message-ID: <4B278279.2070704@dahlinenergy.se> The one bug I know about in the emacs mode released with R13B03 is that in a fully qualified function call where the function name is identical to an existing BIF, the function name will be highlighted as a BIF. Example: in foo:hd(X) ?hd? will be highlighted. The new emacs mode supports emacs 21.3 and later versions. It should compile without warnings on 21.3, 22.x and 23.x. If support for 21.3 could be dropped, elisp regexps used for various things in the mode could be improved, but a large company closely involved with Erlang/OTP is stuck on 21.3, so that's not an option :) Probably the most visual differences are the changes to the syntax highlighting (there's a fourth level and the known set of bifs, guards, keywords etc are near complete) and the fixes to the indentation (guards and type defs improved a lot). Regarding the skeletons, I'd prefer an option to use edoc compatible or not. Probably type defs should be added as well. Another difference is not being able to switch between ?old style comment indentations?. I did not add that since I think the new style is simply wrong (IMHO), but it's of course easy to add. For those who like to have different length of the separators used in the skeletons, there's a non-document setting that can be used (the default value is 70): ;; Set the length of the skeleton separators. (setq erlang-skel-separator-length 90) It would be interesting to know which versions of emacs that the erlang community thinks should be supported and also if there's any functionality missing. /Anders On 2009-12-15 09:32, Dan Gudmundsson wrote: > Hi Martin > > I guess you haven't tested the new erlang mode either :-) > or have you incorporated the fixes we have done? > > I used the erlware version myself before Kenneth hit me hard and told > me to fix our version and apply the patches we had received. > > The one thing I miss is the edoc skeltons which you have and that you broke > out the skeletons to a separate file. > I don't use distel either so maybe your variant works better with that. > > But I have "stolen" some of the fixes you had and done many more and added > several large patches from Anders Dahlin and Tomas Abrahamsson into > which I think > is a better version. > > Hopefully now with erlang on github we can join our efforts again, so > that we can > get the best of the two things. I know that our support of the emacs > mode havn't been > the best and when time is tight the emacs mode get down prioritized. > It will probably happen again but now with erlang on github available > it should be easier to > apply the improvements the community makes. > > Cheers (I think I owe you one) > /Dan > > On Mon, Dec 14, 2009 at 11:28 PM, Logan, Martin wrote: >> BTW, the erlware erlang mode ?erlware-mode? is much better than the erlang >> mode. Many bugs have been fixed and the skeletons are all edoc?d. It has >> been well maintained for over 2 years and is now way ahead IMHO. You can >> find it at erlware.org or over at the google code site >> code.google.com/p/erlware-mode >> >> Cheers, >> Martin >> >> >> On 12/14/09 10:36 AM, "G?ran B?ge" wrote: >> >> Thanks Dan, >> >> Yes it worked in R13B03, adding '%% ' and removing '%% '. Just my kind >> of timing bringing it up just when it was fixed, it's been bugging me for >> quite some time before I got around to asking:-). We are very slow >> moving to new releases as we have long lived products running out there, >> we still have some R9 based ones and I've not run R13 before, just installed >> it as a matter of fact. >> >> Cheers >> --G?ran >> >> Dan Gudmundsson wrote: >>> On Mon, Dec 14, 2009 at 4:56 PM, G?ran B?ge >>> wrote: >>>> Hi, >>>> >>>> Is there a reason why the erlang emacs mode treats comment (^C^C) and >>>> un-comment >>>> (^C^U) asymmetrical, comment adds '%% ' and uncomment removes '%'. Pretty >>>> annoying if you ask me (but who would even think of doing that :-). It >>>> used >>>> to work by adding only '%' earlier (maybe very much earlier like in R9 or >>>> so). >>> >>> Have you tried the latest erlang mode, on github or in R13B03? >>> >>> Both ^U^C^C and ^C^U works for me. >>> >>> /Dan >>> PS: There are a lot of changes in the latest release of the erlang emacs >>> mode, >>> so if we broke something please report or even better post a >>> patch. >> >> -- >> -- Goran >> --------------------- May the Snow be with you -------- >> Goran Bage MobileArts www.mobilearts.se >> Tjarhovsgatan 56 SE-116 28 STOCKHOLM Sweden >> goran.bage@REDACTED phone: +46 733 358405 >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> >> > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From erlang@REDACTED Tue Dec 15 14:48:05 2009 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 15 Dec 2009 14:48:05 +0100 Subject: [erlang-questions] erlang emacs mode question In-Reply-To: References: <4B26698F.4000208@mobilearts.com> Message-ID: <9b08084c0912150548r3d5ae7bbof2118fd19ae15cfd@mail.gmail.com> I'd missed this. Seems to work very nicely apart from a bug in func9 - tab on the commented line indents like this: func9(Term, [${|T]) -> % above should be highlighted correctly % all function body lines should not indent further on tab T. And not like this: func9(Term, [${|T]) -> % above should be highlighted correctly % all function body lines should not indent further on tab T. On Mon, Dec 14, 2009 at 11:28 PM, Logan, Martin wrote: > BTW, ?the erlware erlang mode "erlware-mode" is much better than the erlang mode. ?Many bugs have been fixed and the skeletons are all edoc'd. ?It has been well maintained for over 2 years and is now way ahead IMHO. ?You can find it at erlware.org or over at the google code site code.google.com/p/erlware-mode > > Cheers, > Martin > > > On 12/14/09 10:36 AM, "G?ran B?ge" wrote: > > Thanks Dan, > > Yes it worked in R13B03, adding '%% ' and removing '%% '. Just my kind > of timing bringing it up just when it was fixed, it's been bugging me for > quite some time before I got around to asking:-). We are very slow > moving to new releases as we have long lived products running out there, > we still have some R9 based ones and I've not run R13 before, just installed > it as a matter of fact. > > Cheers > --G?ran > > Dan Gudmundsson wrote: >> On Mon, Dec 14, 2009 at 4:56 PM, G?ran B?ge ?wrote: >>> Hi, >>> >>> Is there a reason why the erlang emacs mode treats comment (^C^C) and >>> un-comment >>> (^C^U) asymmetrical, comment adds '%% ' and uncomment removes '%'. Pretty >>> annoying if you ask me (but who would even think of doing that :-). It used >>> to work by adding only '%' earlier (maybe very much earlier like in R9 or >>> so). >> >> Have you tried the latest erlang mode, on github or in R13B03? >> >> Both ^U^C^C and ^C^U works for me. >> >> /Dan >> PS: There are a lot of changes in the latest release of the erlang emacs mode, >> ? ? ? ? so if we broke something please report or even better post a patch. > > -- > -- Goran > --------------------- May the Snow be with you -------- > ?Goran Bage ? ? ? ? MobileArts ? ? ? ?www.mobilearts.se > ?Tjarhovsgatan 56 ?SE-116 28 STOCKHOLM ? ? ? ? ? Sweden > ?goran.bage@REDACTED ? ? ? ? phone: +46 733 358405 > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > > From erlang@REDACTED Tue Dec 15 14:51:07 2009 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 15 Dec 2009 14:51:07 +0100 Subject: [erlang-questions] erlang emacs mode question In-Reply-To: <9b08084c0912150548r3d5ae7bbof2118fd19ae15cfd@mail.gmail.com> References: <4B26698F.4000208@mobilearts.com> <9b08084c0912150548r3d5ae7bbof2118fd19ae15cfd@mail.gmail.com> Message-ID: <9b08084c0912150551o7df18fge14022c9d5c68e67@mail.gmail.com> Sorry last posting got posted too early when I hit a tab :-) The line following ${, moves too far to the right when I hit tab I guess it's confused by the ${ (With comment-multi-line = true) /Joe On Tue, Dec 15, 2009 at 2:48 PM, Joe Armstrong wrote: > I'd missed this. Seems to work very nicely apart from a bug in func9 - > tab on the commented line indents > like this: > > func9(Term, [${|T]) -> > ? ? ? ? ? ? % above should be highlighted correctly > ? ? ? ? ? ? % all function body lines should not indent further on tab > ? ? ? ? ? ? T. > > > And not like this: > > func9(Term, [${|T]) -> > % above should be highlighted correctly > ? ? ? ? ? ? % all function body lines should not indent further on tab > ? ? ? ? ? ? T. > > On Mon, Dec 14, 2009 at 11:28 PM, Logan, Martin wrote: >> BTW, ?the erlware erlang mode "erlware-mode" is much better than the erlang mode. ?Many bugs have been fixed and the skeletons are all edoc'd. ?It has been well maintained for over 2 years and is now way ahead IMHO. ?You can find it at erlware.org or over at the google code site code.google.com/p/erlware-mode >> >> Cheers, >> Martin >> >> >> On 12/14/09 10:36 AM, "G?ran B?ge" wrote: >> >> Thanks Dan, >> >> Yes it worked in R13B03, adding '%% ' and removing '%% '. Just my kind >> of timing bringing it up just when it was fixed, it's been bugging me for >> quite some time before I got around to asking:-). We are very slow >> moving to new releases as we have long lived products running out there, >> we still have some R9 based ones and I've not run R13 before, just installed >> it as a matter of fact. >> >> Cheers >> --G?ran >> >> Dan Gudmundsson wrote: >>> On Mon, Dec 14, 2009 at 4:56 PM, G?ran B?ge ?wrote: >>>> Hi, >>>> >>>> Is there a reason why the erlang emacs mode treats comment (^C^C) and >>>> un-comment >>>> (^C^U) asymmetrical, comment adds '%% ' and uncomment removes '%'. Pretty >>>> annoying if you ask me (but who would even think of doing that :-). It used >>>> to work by adding only '%' earlier (maybe very much earlier like in R9 or >>>> so). >>> >>> Have you tried the latest erlang mode, on github or in R13B03? >>> >>> Both ^U^C^C and ^C^U works for me. >>> >>> /Dan >>> PS: There are a lot of changes in the latest release of the erlang emacs mode, >>> ? ? ? ? so if we broke something please report or even better post a patch. >> >> -- >> -- Goran >> --------------------- May the Snow be with you -------- >> ?Goran Bage ? ? ? ? MobileArts ? ? ? ?www.mobilearts.se >> ?Tjarhovsgatan 56 ?SE-116 28 STOCKHOLM ? ? ? ? ? Sweden >> ?goran.bage@REDACTED ? ? ? ? phone: +46 733 358405 >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> >> > From hakan@REDACTED Tue Dec 15 15:03:50 2009 From: hakan@REDACTED (=?ISO-8859-1?Q?H=E5kan_Mattsson?=) Date: Tue, 15 Dec 2009 15:03:50 +0100 Subject: [erlang-questions] erlang emacs mode question In-Reply-To: <9b08084c0912150548r3d5ae7bbof2118fd19ae15cfd@mail.gmail.com> References: <4B26698F.4000208@mobilearts.com> <9b08084c0912150548r3d5ae7bbof2118fd19ae15cfd@mail.gmail.com> Message-ID: <922d05850912150603h3cde53fdk3f895e6c0bfbea7d@mail.gmail.com> This works as a breeze in the R13B03 Emacs mode. func9(Term, [${|T]) -> %% above should be highlighted correctly %% all function body lines should not indent further on tab T. /H?kan On Tue, Dec 15, 2009 at 2:48 PM, Joe Armstrong wrote: > I'd missed this. Seems to work very nicely apart from a bug in func9 - > tab on the commented line indents > like this: > > func9(Term, [${|T]) -> > ? ? ? ? ? ? % above should be highlighted correctly > ? ? ? ? ? ? % all function body lines should not indent further on tab > ? ? ? ? ? ? T. > > > And not like this: > > func9(Term, [${|T]) -> > % above should be highlighted correctly > ? ? ? ? ? ? % all function body lines should not indent further on tab > ? ? ? ? ? ? T. > > On Mon, Dec 14, 2009 at 11:28 PM, Logan, Martin wrote: >> BTW, ?the erlware erlang mode "erlware-mode" is much better than the erlang mode. ?Many bugs have been fixed and the skeletons are all edoc'd. ?It has been well maintained for over 2 years and is now way ahead IMHO. ?You can find it at erlware.org or over at the google code site code.google.com/p/erlware-mode >> >> Cheers, >> Martin >> >> >> On 12/14/09 10:36 AM, "G?ran B?ge" wrote: >> >> Thanks Dan, >> >> Yes it worked in R13B03, adding '%% ' and removing '%% '. Just my kind >> of timing bringing it up just when it was fixed, it's been bugging me for >> quite some time before I got around to asking:-). We are very slow >> moving to new releases as we have long lived products running out there, >> we still have some R9 based ones and I've not run R13 before, just installed >> it as a matter of fact. >> >> Cheers >> --G?ran >> >> Dan Gudmundsson wrote: >>> On Mon, Dec 14, 2009 at 4:56 PM, G?ran B?ge ?wrote: >>>> Hi, >>>> >>>> Is there a reason why the erlang emacs mode treats comment (^C^C) and >>>> un-comment >>>> (^C^U) asymmetrical, comment adds '%% ' and uncomment removes '%'. Pretty >>>> annoying if you ask me (but who would even think of doing that :-). It used >>>> to work by adding only '%' earlier (maybe very much earlier like in R9 or >>>> so). >>> >>> Have you tried the latest erlang mode, on github or in R13B03? >>> >>> Both ^U^C^C and ^C^U works for me. >>> >>> /Dan >>> PS: There are a lot of changes in the latest release of the erlang emacs mode, >>> ? ? ? ? so if we broke something please report or even better post a patch. >> >> -- >> -- Goran >> --------------------- May the Snow be with you -------- >> ?Goran Bage ? ? ? ? MobileArts ? ? ? ?www.mobilearts.se >> ?Tjarhovsgatan 56 ?SE-116 28 STOCKHOLM ? ? ? ? ? Sweden >> ?goran.bage@REDACTED ? ? ? ? phone: +46 733 358405 From als@REDACTED Tue Dec 15 17:24:21 2009 From: als@REDACTED (Anthony Shipman) Date: Wed, 16 Dec 2009 03:24:21 +1100 Subject: [erlang-questions] erlang emacs mode question In-Reply-To: <922d05850912150603h3cde53fdk3f895e6c0bfbea7d@mail.gmail.com> References: <4B26698F.4000208@mobilearts.com> <9b08084c0912150548r3d5ae7bbof2118fd19ae15cfd@mail.gmail.com> <922d05850912150603h3cde53fdk3f895e6c0bfbea7d@mail.gmail.com> Message-ID: <200912160324.21445.als@iinet.net.au> Here are things I would like to see in an emacs mode: Put {} and [] and () and <<>> in different colours/weights so that data structures and code is more readable. Put variables in bold so that they are distinct from atoms etc. -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From MARTIN.LOGAN@REDACTED Tue Dec 15 17:30:11 2009 From: MARTIN.LOGAN@REDACTED (Logan, Martin) Date: Tue, 15 Dec 2009 10:30:11 -0600 Subject: [erlang-questions] erlang emacs mode question In-Reply-To: <93df43b60912150032r537d1262u4efc8aa4546d11c4@mail.gmail.com> References: <4B26698F.4000208@mobilearts.com> <93df43b60912150032r537d1262u4efc8aa4546d11c4@mail.gmail.com> Message-ID: <77C1226CCC2F7C41B022662F4775DABC57005CBAC4@EGEXCMB01.oww.root.lcl> :-) Well I am glad that the regular mode benefited from it. The thanks for the Erlware mode really goes out to Dave Peticolas who owns it and maintains it quite well. He has added quite a lot of new support for things like flymake and a bunch of other cool stuff which does not spring to mind right now. Perhaps there is a way we can collaborate more actively now with Erlang up on github as you say. Cheers, Martin P.S I will take that "owe me one" in the form of a beer next year at EUC ;-) -----Original Message----- From: Dan Gudmundsson [mailto:dangud@REDACTED] Sent: Tuesday, December 15, 2009 2:32 AM To: Logan, Martin Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] erlang emacs mode question Hi Martin I guess you haven't tested the new erlang mode either :-) or have you incorporated the fixes we have done? I used the erlware version myself before Kenneth hit me hard and told me to fix our version and apply the patches we had received. The one thing I miss is the edoc skeltons which you have and that you broke out the skeletons to a separate file. I don't use distel either so maybe your variant works better with that. But I have "stolen" some of the fixes you had and done many more and added several large patches from Anders Dahlin and Tomas Abrahamsson into which I think is a better version. Hopefully now with erlang on github we can join our efforts again, so that we can get the best of the two things. I know that our support of the emacs mode havn't been the best and when time is tight the emacs mode get down prioritized. It will probably happen again but now with erlang on github available it should be easier to apply the improvements the community makes. Cheers (I think I owe you one) /Dan On Mon, Dec 14, 2009 at 11:28 PM, Logan, Martin wrote: > BTW, ?the erlware erlang mode "erlware-mode" is much better than the erlang > mode. ?Many bugs have been fixed and the skeletons are all edoc'd. ?It has > been well maintained for over 2 years and is now way ahead IMHO. ?You can > find it at erlware.org or over at the google code site > code.google.com/p/erlware-mode > > Cheers, > Martin > > > On 12/14/09 10:36 AM, "G?ran B?ge" wrote: > > Thanks Dan, > > Yes it worked in R13B03, adding '%% ' and removing '%% '. Just my kind > of timing bringing it up just when it was fixed, it's been bugging me for > quite some time before I got around to asking:-). We are very slow > moving to new releases as we have long lived products running out there, > we still have some R9 based ones and I've not run R13 before, just installed > it as a matter of fact. > > Cheers > --G?ran > > Dan Gudmundsson wrote: >> On Mon, Dec 14, 2009 at 4:56 PM, G?ran B?ge >> ?wrote: >>> Hi, >>> >>> Is there a reason why the erlang emacs mode treats comment (^C^C) and >>> un-comment >>> (^C^U) asymmetrical, comment adds '%% ' and uncomment removes '%'. Pretty >>> annoying if you ask me (but who would even think of doing that :-). It >>> used >>> to work by adding only '%' earlier (maybe very much earlier like in R9 or >>> so). >> >> Have you tried the latest erlang mode, on github or in R13B03? >> >> Both ^U^C^C and ^C^U works for me. >> >> /Dan >> PS: There are a lot of changes in the latest release of the erlang emacs >> mode, >> ????????so if we broke something please report or even better post a >> patch. > > -- > -- Goran > --------------------- May the Snow be with you -------- > ??Goran Bage ????????MobileArts ???????www.mobilearts.se > ??Tjarhovsgatan 56 ?SE-116 28 STOCKHOLM ??????????Sweden > ??goran.bage@REDACTED ????????phone: +46 733 358405 > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > > From christophe.romain@REDACTED Tue Dec 15 18:01:44 2009 From: christophe.romain@REDACTED (Christophe Romain) Date: Tue, 15 Dec 2009 18:01:44 +0100 Subject: [erlang-questions] Erlang on Windows from USB In-Reply-To: <1259605755.2790.118.camel@info01.REGNA> References: <1259600282.2790.101.camel@info01.REGNA> <535117ab0911300908i7b890b6g36f63164de5d79aa@mail.gmail.com> <20091130173614.GC11530@delora.autosys.us> <1259605755.2790.118.camel@info01.REGNA> Message-ID: <20091215170144.GA22142@localhost> >For this, he can't install anything, and needs to get it >working from USB, to develop from his work. just download CEAN http://cean.process-one.net/downloads/ take the developper installer if you need your USB key working regardless of OS, download REPOS distribution, else download windows or whatever distribution you need. I dayly ise erlang on an USB key, switching from windows/mac/linux/bsd with the same codebase/installation using CEAN. From glpunzi@REDACTED Tue Dec 15 18:50:26 2009 From: glpunzi@REDACTED (Giuseppe Luigi Punzi) Date: Tue, 15 Dec 2009 18:50:26 +0100 Subject: [erlang-questions] Erlang on Windows from USB In-Reply-To: <20091215170144.GA22142@localhost> References: <1259600282.2790.101.camel@info01.REGNA> <535117ab0911300908i7b890b6g36f63164de5d79aa@mail.gmail.com> <20091130173614.GC11530@delora.autosys.us> <1259605755.2790.118.camel@info01.REGNA> <20091215170144.GA22142@localhost> Message-ID: <1260899427.5807.15.camel@info01.REGNA> El mar, 15-12-2009 a las 18:01 +0100, Christophe Romain escribi?: > >For this, he can't install anything, and needs to get it > >working from USB, to develop from his work. > > just download CEAN > http://cean.process-one.net/downloads/ > take the developper installer > if you need your USB key working regardless of OS, download REPOS > distribution, else download windows or whatever distribution you need. > > I dayly ise erlang on an USB key, switching from windows/mac/linux/bsd > with the same codebase/installation using CEAN. Hi, when have time I will give a try. Thanks, From dale@REDACTED Tue Dec 15 19:13:12 2009 From: dale@REDACTED (Dale Harvey) Date: Tue, 15 Dec 2009 18:13:12 +0000 Subject: [erlang-questions] erlang emacs mode question In-Reply-To: <77C1226CCC2F7C41B022662F4775DABC57005CBAC4@EGEXCMB01.oww.root.lcl> References: <4B26698F.4000208@mobilearts.com> <93df43b60912150032r537d1262u4efc8aa4546d11c4@mail.gmail.com> <77C1226CCC2F7C41B022662F4775DABC57005CBAC4@EGEXCMB01.oww.root.lcl> Message-ID: while people are mentioning feature requests, I would love to be able to make -spec( not quite as visually distracting/prominent as they are now but thanks for the work, Ive been using erlware mode for a while now, would love to see it get folder back in to core erlang 2009/12/15 Logan, Martin > :-) Well I am glad that the regular mode benefited from it. The thanks > for the Erlware mode really goes out to Dave Peticolas who owns it and > maintains it quite well. He has added quite a lot of new support for things > like flymake and a bunch of other cool stuff which does not spring to mind > right now. > > Perhaps there is a way we can collaborate more actively now with Erlang up > on github as you say. > > Cheers, > Martin > > P.S I will take that "owe me one" in the form of a beer next year at EUC > ;-) > > -----Original Message----- > From: Dan Gudmundsson [mailto:dangud@REDACTED] > Sent: Tuesday, December 15, 2009 2:32 AM > To: Logan, Martin > Cc: erlang-questions@REDACTED > Subject: Re: [erlang-questions] erlang emacs mode question > > Hi Martin > > I guess you haven't tested the new erlang mode either :-) > or have you incorporated the fixes we have done? > > I used the erlware version myself before Kenneth hit me hard and told > me to fix our version and apply the patches we had received. > > The one thing I miss is the edoc skeltons which you have and that you broke > out the skeletons to a separate file. > I don't use distel either so maybe your variant works better with that. > > But I have "stolen" some of the fixes you had and done many more and added > several large patches from Anders Dahlin and Tomas Abrahamsson into > which I think > is a better version. > > Hopefully now with erlang on github we can join our efforts again, so > that we can > get the best of the two things. I know that our support of the emacs > mode havn't been > the best and when time is tight the emacs mode get down prioritized. > It will probably happen again but now with erlang on github available > it should be easier to > apply the improvements the community makes. > > Cheers (I think I owe you one) > /Dan > > On Mon, Dec 14, 2009 at 11:28 PM, Logan, Martin > wrote: > > BTW, the erlware erlang mode "erlware-mode" is much better than the > erlang > > mode. Many bugs have been fixed and the skeletons are all edoc'd. It > has > > been well maintained for over 2 years and is now way ahead IMHO. You can > > find it at erlware.org or over at the google code site > > code.google.com/p/erlware-mode > > > > Cheers, > > Martin > > > > > > On 12/14/09 10:36 AM, "G?ran B?ge" wrote: > > > > Thanks Dan, > > > > Yes it worked in R13B03, adding '%% ' and removing '%% '. Just my kind > > of timing bringing it up just when it was fixed, it's been bugging me for > > quite some time before I got around to asking:-). We are very slow > > moving to new releases as we have long lived products running out there, > > we still have some R9 based ones and I've not run R13 before, just > installed > > it as a matter of fact. > > > > Cheers > > --G?ran > > > > Dan Gudmundsson wrote: > >> On Mon, Dec 14, 2009 at 4:56 PM, G?ran B?ge > >> wrote: > >>> Hi, > >>> > >>> Is there a reason why the erlang emacs mode treats comment (^C^C) and > >>> un-comment > >>> (^C^U) asymmetrical, comment adds '%% ' and uncomment removes '%'. > Pretty > >>> annoying if you ask me (but who would even think of doing that :-). It > >>> used > >>> to work by adding only '%' earlier (maybe very much earlier like in R9 > or > >>> so). > >> > >> Have you tried the latest erlang mode, on github or in R13B03? > >> > >> Both ^U^C^C and ^C^U works for me. > >> > >> /Dan > >> PS: There are a lot of changes in the latest release of the erlang emacs > >> mode, > >> so if we broke something please report or even better post a > >> patch. > > > > -- > > -- Goran > > --------------------- May the Snow be with you -------- > > Goran Bage MobileArts www.mobilearts.se > > Tjarhovsgatan 56 SE-116 28 STOCKHOLM Sweden > > goran.bage@REDACTED phone: +46 733 358405 > > > > ________________________________________________________________ > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > erlang-questions (at) erlang.org > > > > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From erlang@REDACTED Tue Dec 15 20:37:53 2009 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 15 Dec 2009 20:37:53 +0100 Subject: [erlang-questions] erlang emacs mode question In-Reply-To: References: <4B26698F.4000208@mobilearts.com> <93df43b60912150032r537d1262u4efc8aa4546d11c4@mail.gmail.com> <77C1226CCC2F7C41B022662F4775DABC57005CBAC4@EGEXCMB01.oww.root.lcl> Message-ID: <9b08084c0912151137k5efad939t85471b1b76cc21e0@mail.gmail.com> I have a feature request. Integrate with org-mode http://orgmode.org/ Org-mode is amazing "some people spend their entire life in org-mode" - it turns emacs into a proper folding editor/organiser. Warning: org-mode is addictive What I'd like is "org mode erlang editing" hit tab on the first line of a function definition hides or reveals the body of the function. hit meta-uparrow on the first line of a function move the function up in the file. This could be integrated with a refactoring program to move functions between modules with one keystroke /Joe On Tue, Dec 15, 2009 at 7:13 PM, Dale Harvey wrote: > while people are mentioning feature requests, I would love to be able to > make > -spec( not quite as visually distracting/prominent as they are now > > but thanks for the work, Ive been using erlware mode for a while now, would > love to see it get folder back in to core erlang > > 2009/12/15 Logan, Martin > >> :-) ?Well I am glad that the regular mode benefited from it. ?The thanks >> for the Erlware mode really goes out to Dave Peticolas who owns it and >> maintains it quite well. He has added quite a lot of new support for things >> like flymake and a bunch of other cool stuff which does not spring to mind >> right now. >> >> Perhaps there is a way we can collaborate more actively now with Erlang up >> on github as you say. >> >> Cheers, >> Martin >> >> P.S I will take that "owe me one" in the form of a beer next year at EUC >> ;-) >> >> -----Original Message----- >> From: Dan Gudmundsson [mailto:dangud@REDACTED] >> Sent: Tuesday, December 15, 2009 2:32 AM >> To: Logan, Martin >> Cc: erlang-questions@REDACTED >> Subject: Re: [erlang-questions] erlang emacs mode question >> >> Hi Martin >> >> I guess you haven't tested the new erlang mode either :-) >> or have you incorporated the fixes we have done? >> >> I used the erlware version myself before Kenneth hit me hard and told >> me to fix our version and apply the patches we had received. >> >> The one thing I miss is the edoc skeltons which you have and that you broke >> out the skeletons to a separate file. >> I don't use distel either so maybe your variant works better with that. >> >> But I have "stolen" some of the fixes you had and done many more and added >> several large patches from Anders Dahlin and Tomas Abrahamsson into >> which I think >> is a better version. >> >> Hopefully now with erlang on github we can join our efforts again, so >> that we can >> get the best of the two things. I know that our support of the emacs >> mode havn't been >> the best and when time is tight the emacs mode get down prioritized. >> It will probably happen again but now with erlang on github available >> it should be easier to >> apply the improvements the community makes. >> >> Cheers (I think I owe you one) >> /Dan >> >> On Mon, Dec 14, 2009 at 11:28 PM, Logan, Martin >> wrote: >> > BTW, ?the erlware erlang mode "erlware-mode" is much better than the >> erlang >> > mode. ?Many bugs have been fixed and the skeletons are all edoc'd. ?It >> has >> > been well maintained for over 2 years and is now way ahead IMHO. ?You can >> > find it at erlware.org or over at the google code site >> > code.google.com/p/erlware-mode >> > >> > Cheers, >> > Martin >> > >> > >> > On 12/14/09 10:36 AM, "G?ran B?ge" wrote: >> > >> > Thanks Dan, >> > >> > Yes it worked in R13B03, adding '%% ' and removing '%% '. Just my kind >> > of timing bringing it up just when it was fixed, it's been bugging me for >> > quite some time before I got around to asking:-). We are very slow >> > moving to new releases as we have long lived products running out there, >> > we still have some R9 based ones and I've not run R13 before, just >> installed >> > it as a matter of fact. >> > >> > Cheers >> > --G?ran >> > >> > Dan Gudmundsson wrote: >> >> On Mon, Dec 14, 2009 at 4:56 PM, G?ran B?ge >> >> ?wrote: >> >>> Hi, >> >>> >> >>> Is there a reason why the erlang emacs mode treats comment (^C^C) and >> >>> un-comment >> >>> (^C^U) asymmetrical, comment adds '%% ' and uncomment removes '%'. >> Pretty >> >>> annoying if you ask me (but who would even think of doing that :-). It >> >>> used >> >>> to work by adding only '%' earlier (maybe very much earlier like in R9 >> or >> >>> so). >> >> >> >> Have you tried the latest erlang mode, on github or in R13B03? >> >> >> >> Both ^U^C^C and ^C^U works for me. >> >> >> >> /Dan >> >> PS: There are a lot of changes in the latest release of the erlang emacs >> >> mode, >> >> ? ? ? ? so if we broke something please report or even better post a >> >> patch. >> > >> > -- >> > -- Goran >> > --------------------- May the Snow be with you -------- >> > ? Goran Bage ? ? ? ? MobileArts ? ? ? ?www.mobilearts.se >> > ? Tjarhovsgatan 56 ?SE-116 28 STOCKHOLM ? ? ? ? ? Sweden >> > ? goran.bage@REDACTED ? ? ? ? phone: +46 733 358405 >> > >> > ________________________________________________________________ >> > erlang-questions mailing list. See http://www.erlang.org/faq.html >> > erlang-questions (at) erlang.org >> > >> > >> > >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> > From kagato@REDACTED Tue Dec 15 20:58:17 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Tue, 15 Dec 2009 11:58:17 -0800 Subject: Appropriate Content-Type for Erlang Source Message-ID: <09A1854A-8EFB-4C2D-9517-83975E0ED57D@souja.net> What's the appropriate content-type (i.e. MIME type) for Erlang source (and, for that matter, Erlang BEAM files)? I suspect the answer is text/plain (and application/octet-stream, respectively). That said, I'd prefer to have something more descriptive. Maybe text/x-erlang (and application/x-beam-vm for starters. For that matter, Erlang could apply to get an officially registered Content-Type. For starters, it seems we could maybe get Debian to add an official mime-type for Erlang just by sending an e-mail (to mime-support@REDACTED apparently). Is this appealing to anybody, or do I just have MIME on the brain? -- Jayson Vantuyl kagato@REDACTED From luke@REDACTED Tue Dec 15 23:06:31 2009 From: luke@REDACTED (Luke Gorrie) Date: Tue, 15 Dec 2009 23:06:31 +0100 Subject: erlang with uclibc experience? Message-ID: <1d0fb8fc0912151406i41ab927dq26ef17b66d8fca3@mail.gmail.com> Howdy! Does anyone have experience using Erlang with uClibc? Any words of wisdom? Especially interested in high volume TCP/IP networking apps. From cerieljacobs@REDACTED Tue Dec 15 23:54:59 2009 From: cerieljacobs@REDACTED (Ceriel Jacobs) Date: Tue, 15 Dec 2009 23:54:59 +0100 Subject: OTP13B03 failed to build on OS X 10.6 in 64-bit with duplicate symbol _saved_program_buf in obj/i686-apple-darwin10/opt/smp/erl_pbifs.o and obj/i686-apple-darwin10/opt/smp/erl_main.o Message-ID: <8A2C91DE-993C-43BA-BB87-646D4387A3AD@gmail.com> How did anyone succeed to build OTP13B03 on Mac OS X 10.6 in 64-bit (optimized) mode? Environment: Processor: Intel Core2Duo OS: 10.6.2 (Snow Leopard) Xcode: 3.2.1 GCC: 4.2.1 Used command to configure: $ MACOSX_DEPLOYMENT_TARGET=10.6 \ CFLAGS="-fast -arch x86_64 -march=nocona -mtune=generic -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6" \ LDFLAGS="-fast -arch x86_64 -march=nocona -mtune=generic -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6" \ ./configure \ '--disable-erlang-mandir' \ '--enable-m64-build' \ '--enable-darwin-64bit' \ '--build=i686-apple-darwin10' The resulting output (error message): gcc -o /Users/user/src/otp_src_R13B03/bin/i686-apple-darwin10/beam.smp \ -m64 -fast -arch x86_64 -march=nocona -mtune=generic -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 obj/i686-apple-darwin10/opt/smp/erl_main.o obj/i686-apple-darwin10/opt/smp/preload.o obj/i686-apple-darwin10/opt/smp/erl_pbifs.o obj/i686-apple-darwin10/opt/smp/benchmark.o obj/i686-apple-darwin10/opt/smp/erl_alloc.o obj/i686-apple-darwin10/opt/smp/erl_mtrace.o obj/i686-apple-darwin10/opt/smp/erl_alloc_util.o obj/i686-apple-darwin10/opt/smp/erl_goodfit_alloc.o obj/i686-apple-darwin10/opt/smp/erl_bestfit_alloc.o obj/i686-apple-darwin10/opt/smp/erl_afit_alloc.o obj/i686-apple-darwin10/opt/smp/erl_instrument.o obj/i686-apple-darwin10/opt/smp/erl_init.o obj/i686-apple-darwin10/opt/smp/erl_atom_table.o obj/i686-apple-darwin10/opt/smp/erl_bif_table.o obj/i686-apple-darwin10/opt/smp/erl_bif_ddll.o obj/i686-apple-darwin10/opt/smp/erl_bif_guard.o obj/i686-apple-darwin10/opt/smp/erl_bif_info.o obj/i686-apple-darwin10/opt/smp/erl_bif_op.o obj/i686-apple-darwin10/opt/smp/erl_bif_os.o obj/i686-apple-darwin10/opt/smp/erl_bif_lists.o obj/i686-apple-darwin10/opt/smp/erl_bif_trace.o obj/i686-apple-darwin10/opt/smp/erl_bif_wrap.o obj/i686-apple-darwin10/opt/smp/erl_trace.o obj/i686-apple-darwin10/opt/smp/copy.o obj/i686-apple-darwin10/opt/smp/utils.o obj/i686-apple-darwin10/opt/smp/bif.o obj/i686-apple-darwin10/opt/smp/io.o obj/i686-apple-darwin10/opt/smp/erl_printf_term.o obj/i686-apple-darwin10/opt/smp/erl_debug.o obj/i686-apple-darwin10/opt/smp/erl_md5.o obj/i686-apple-darwin10/opt/smp/erl_message.o obj/i686-apple-darwin10/opt/smp/erl_process.o obj/i686-apple-darwin10/opt/smp/erl_process_dict.o obj/i686-apple-darwin10/opt/smp/erl_process_lock.o obj/i686-apple-darwin10/opt/smp/erl_port_task.o obj/i686-apple-darwin10/opt/smp/erl_arith.o obj/i686-apple-darwin10/opt/smp/time.o obj/i686-apple-darwin10/opt/smp/erl_time_sup.o obj/i686-apple-darwin10/opt/smp/external.o obj/i686-apple-darwin10/opt/smp/dist.o obj/i686-apple-darwin10/opt/smp/binary.o obj/i686-apple-darwin10/opt/smp/erl_db.o obj/i686-apple-darwin10/opt/smp/erl_db_util.o obj/i686-apple-darwin10/opt/smp/erl_db_hash.o obj/i686-apple-darwin10/opt/smp/erl_db_tree.o obj/i686-apple-darwin10/opt/smp/fix_alloc.o obj/i686-apple-darwin10/opt/smp/big.o obj/i686-apple-darwin10/opt/smp/hash.o obj/i686-apple-darwin10/opt/smp/index.o obj/i686-apple-darwin10/opt/smp/atom.o obj/i686-apple-darwin10/opt/smp/module.o obj/i686-apple-darwin10/opt/smp/export.o obj/i686-apple-darwin10/opt/smp/register.o obj/i686-apple-darwin10/opt/smp/break.o obj/i686-apple-darwin10/opt/smp/erl_async.o obj/i686-apple-darwin10/opt/smp/erl_lock_check.o obj/i686-apple-darwin10/opt/smp/erl_gc.o obj/i686-apple-darwin10/opt/smp/erl_lock_count.o obj/i686-apple-darwin10/opt/smp/erl_nmgc.o obj/i686-apple-darwin10/opt/smp/erl_posix_str.o obj/i686-apple-darwin10/opt/smp/erl_bits.o obj/i686-apple-darwin10/opt/smp/erl_math.o obj/i686-apple-darwin10/opt/smp/erl_fun.o obj/i686-apple-darwin10/opt/smp/erl_bif_port.o obj/i686-apple-darwin10/opt/smp/erl_term.o obj/i686-apple-darwin10/opt/smp/erl_node_tables.o obj/i686-apple-darwin10/opt/smp/erl_monitors.obj/i686-apple-darwin10/opt/smp/erl_process_dump.o obj/i686-apple-darwin10/opt/smp/erl_obsolete.o obj/i686-apple-darwin10/opt/smp/erl_bif_timer.o obj/i686-apple-darwin10/opt/smp/erl_drv_thread.o obj/i686-apple-darwin10/opt/smp/erl_bif_chksum.o obj/i686-apple-darwin10/opt/smp/erl_bif_re.o obj/i686-apple-darwin10/opt/smp/erl_unicode.o obj/i686-apple-darwin10/opt/smp/packet_parser.o obj/i686-apple-darwin10/opt/smp/safe_hash.o obj/i686-apple-darwin10/opt/smp/erl_zlib.o obj/i686-apple-darwin10/opt/smp/erl_nif.o obj/i686-apple-darwin10/opt/smp/beam_emu.o obj/i686-apple-darwin10/opt/smp/beam_opcodes.o obj/i686-apple-darwin10/opt/smp/beam_load.o obj/i686-apple-darwin10/opt/smp/beam_bif_load.o obj/i686-apple-darwin10/opt/smp/beam_debug.o obj/i686-apple-darwin10/opt/smp/beam_bp.o obj/i686-apple-darwin10/opt/smp/beam_catches.o obj/i686-apple-darwin10/opt/smp/sys.o obj/i686-apple-darwin10/opt/smp/driver_tab.o obj/i686-apple-darwin10/opt/smp/unix_efile.o obj/i686-apple-darwin10/opt/smp/gzio.o obj/i686-apple-darwin10/opt/smp/elib_malloc.o obj/i686-apple-darwin10/opt/smp/elib_memmove.o obj/i686-apple-darwin10/opt/smp/sys_float.o obj/i686-apple-darwin10/opt/smp/sys_time.o obj/i686-apple-darwin10/opt/smp/erl_poll.kp.o obj/i686-apple-darwin10/opt/smp/erl_check_io.kp.o obj/i686-apple-darwin10/opt/smp/erl_poll.nkp.o obj/i686-apple-darwin10/opt/smp/erl_check_io.nkp.o obj/i686-apple-darwin10/opt/smp/erl_mseg.o obj/i686-apple-darwin10/opt/smp/erl_unix_sys_ddll.o obj/i686-apple-darwin10/opt/smp/erl_mtrace_sys_wrap.o obj/i686-apple-darwin10/opt/smp/efile_drv.o obj/i686-apple-darwin10/opt/smp/inet_drv.o obj/i686-apple-darwin10/opt/smp/zlib_drv.o obj/i686-apple-darwin10/opt/smp/ram_file_drv.o obj/i686-apple-darwin10/opt/smp/ttsl_drv.o -lutil -ldl -lm -lncurses -L../lib/internal/i686-apple-darwin10 /Users/user/src/otp_src_R13B03/erts/emulator/zlib/obj/i686-apple-darwin10/opt/libz.a /Users/user/src/otp_src_R13B03/erts/emulator/pcre/obj/i686-apple-darwin10/opt/libepcre.a -lethread -lpthread -lerts_internal_r ld: duplicate symbol _saved_program_buf in obj/i686-apple-darwin10/opt/smp/erl_pbifs.o and obj/i686-apple-darwin10/opt/smp/erl_main.o collect2: ld returned 1 exit status make[3]: *** [/Users/user/src/otp_src_R13B03/bin/i686-apple-darwin10/beam.smp] Error 1 make[2]: *** [opt] Error 2 make[1]: *** [smp] Error 2 make: *** [emulator] Error 2 From kagato@REDACTED Wed Dec 16 01:21:58 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Tue, 15 Dec 2009 16:21:58 -0800 Subject: Rotating A List Message-ID: <8EF10F86-B65F-4FF8-B2B4-E51946CCE33A@souja.net> I recently did some attended SF Erlounge, which was quite a nice event. In addition to watching an excellent presentation on Erlang in the GitHub rebuild, I also fielded a few questions from some of the newer people. One of them had a pretty simple request: * manage a list * pull items off the front, but rotate them to the back This seemed interesting but simple, so I wrote put a version together to demonstrate for him. Figuring that sharing is caring, I blogged it to. You can read it here: http://needlesslymessianic.com/2009/12/15/gen_server-example Hopefully this is useful for people. Have a lot of fun, and special thanks to Tipin Chang for the idea. -- Jayson Vantuyl kagato@REDACTED From jeraymond@REDACTED Wed Dec 16 02:06:35 2009 From: jeraymond@REDACTED (Jeremy Raymond) Date: Tue, 15 Dec 2009 20:06:35 -0500 Subject: Failing Makefile build on EUnit test failures Message-ID: <59da11980912151706s78c5eba2qc6e055aae01f75bf@mail.gmail.com> Hello, I have a make file that runs my EUnit tests like this: eunit: ${EUNIT_OBJ} erl -noshell -pa ebin -eval 'eunit:test(${TEST_MODULES}, [verbose])' -s init stop What I'd like to happen is have my build fail if any of the eunit tests fail however even if tests fail the build suceeds (the command to run the tests returns 0?). How can I make my build fail if the tests fail, and pass if the tests pass? Thanks, Jeremy From jeraymond@REDACTED Wed Dec 16 02:10:08 2009 From: jeraymond@REDACTED (Jeremy Raymond) Date: Tue, 15 Dec 2009 20:10:08 -0500 Subject: Automated Erlang Builds with CruiseControl Message-ID: <59da11980912151710w412472edw134078cd667c42f4@mail.gmail.com> Hello, I've automated my build process using CruiseControl to build my Erlang project. The build works fine but my EUnit test output isn't recognized unit tests. Has anyone done this before and know how to get the EUnit test output to show? Thanks, Jeremy From chandrashekhar.mullaparthi@REDACTED Wed Dec 16 02:24:07 2009 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Wed, 16 Dec 2009 01:24:07 +0000 Subject: [erlang-questions] Rotating A List In-Reply-To: <8EF10F86-B65F-4FF8-B2B4-E51946CCE33A@souja.net> References: <8EF10F86-B65F-4FF8-B2B4-E51946CCE33A@souja.net> Message-ID: 2009/12/16 Jayson Vantuyl > I recently did some attended SF Erlounge, which was quite a nice event. In > addition to watching an excellent presentation on Erlang in the GitHub > rebuild, I also fielded a few questions from some of the newer people. One > of them had a pretty simple request: > > * manage a list > * pull items off the front, but rotate them to the back > Did you consider using the queue module in the gen_server? You seem to have reinvented the core of queue! Chandru From andrew@REDACTED Wed Dec 16 02:29:53 2009 From: andrew@REDACTED (Andrew Thompson) Date: Tue, 15 Dec 2009 20:29:53 -0500 Subject: [erlang-questions] Failing Makefile build on EUnit test failures In-Reply-To: <59da11980912151706s78c5eba2qc6e055aae01f75bf@mail.gmail.com> References: <59da11980912151706s78c5eba2qc6e055aae01f75bf@mail.gmail.com> Message-ID: <20091216012953.GB9916@hijacked.us> On Tue, Dec 15, 2009 at 08:06:35PM -0500, Jeremy Raymond wrote: > Hello, > > I have a make file that runs my EUnit tests like this: > > eunit: ${EUNIT_OBJ} > erl -noshell -pa ebin -eval 'eunit:test(${TEST_MODULES}, [verbose])' -s > init stop > > What I'd like to happen is have my build fail if any of the eunit tests fail > however even if tests fail the build suceeds (the command to run the tests > returns 0?). How can I make my build fail if the tests fail, and pass if the >tests pass? Try something like: erl -noshell -pa ebin -eval 'halt(case eunit:test([module], [verbose]) of ok -> 0; _ -> 1 end).' Instead? eunit:test() returns ok or error, so we have to map those to error codes we pass to halt(). Andrew From kagato@REDACTED Wed Dec 16 02:43:31 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Tue, 15 Dec 2009 17:43:31 -0800 Subject: [erlang-questions] Rotating A List In-Reply-To: References: <8EF10F86-B65F-4FF8-B2B4-E51946CCE33A@souja.net> Message-ID: <3D6B198C-EA0E-4B2B-AA33-8519CC6C2E82@souja.net> I did. The primary reason I didn't use it is because: * I wanted to emphasize the functional nature of gen_server. * I wanted to show how to use a raw list for this particular user. * I wanted to show an example of using gen_server:reply/2. * I wanted to have a simple example that showed the division between server implementation and API. * It would have been slower. Note that the queue:drop/1 is O(1) amortized because of the way it handles list:reverse/1. Without using gen_server:reply/2 the way I did, the client could block on the reverse when it didn't really need to do so. Queue would have been slightly easier, but it wouldn't have been nearly as instructive. :) On Dec 15, 2009, at 5:24 PM, Chandru wrote: > 2009/12/16 Jayson Vantuyl > I recently did some attended SF Erlounge, which was quite a nice event. In addition to watching an excellent presentation on Erlang in the GitHub rebuild, I also fielded a few questions from some of the newer people. One of them had a pretty simple request: > > * manage a list > * pull items off the front, but rotate them to the back > > Did you consider using the queue module in the gen_server? You seem to have reinvented the core of queue! > > Chandru -- Jayson Vantuyl kagato@REDACTED From steven.charles.davis@REDACTED Wed Dec 16 03:39:23 2009 From: steven.charles.davis@REDACTED (Steve Davis) Date: Tue, 15 Dec 2009 18:39:23 -0800 (PST) Subject: Appropriate Content-Type for Erlang Source In-Reply-To: <09A1854A-8EFB-4C2D-9517-83975E0ED57D@souja.net> References: <09A1854A-8EFB-4C2D-9517-83975E0ED57D@souja.net> Message-ID: <095820dc-46d7-4a39-b038-6d276039070d@g23g2000vbr.googlegroups.com> c uses text/plain or text/x-c c++ uses text/plain java uses text/plain or text/x-java-source ...so it seems there's no real consensus. If I were asked I'd say erlang is closest in purity and practical goals to c, so I'd probably opt for text/plain and text/erlang --- though it may be more useful to lobby for binary erlang term format or ubf since these are designed for network transfer. Since the term "bert" makes me squirm I'd probably suggest application/etf or application/ubf for those two. regards, /s On Dec 15, 1:58?pm, Jayson Vantuyl wrote: > What's the appropriate content-type (i.e. MIME type) for Erlang source (and, for that matter, Erlang BEAM files)? > > I suspect the answer is text/plain (and application/octet-stream, respectively). > > That said, I'd prefer to have something more descriptive. ?Maybe text/x-erlang (and application/x-beam-vm for starters. ?For that matter, Erlang could apply to get an officially registered Content-Type. ?For starters, it seems we could maybe get Debian to add an official mime-type for Erlang just by sending an e-mail (to mime-supp...@REDACTED apparently). ?Is this appealing to anybody, or do I just have MIME on the brain? > > -- > Jayson Vantuyl > kag...@REDACTED > > ________________________________________________________________ > erlang-questions mailing list. Seehttp://www.erlang.org/faq.html > erlang-questions (at) erlang.org From dave@REDACTED Wed Dec 16 03:54:15 2009 From: dave@REDACTED (Dave Peticolas) Date: Tue, 15 Dec 2009 18:54:15 -0800 Subject: [erlang-questions] erlang emacs mode question In-Reply-To: <77C1226CCC2F7C41B022662F4775DABC57005CBAC4@EGEXCMB01.oww.root.lcl> References: <4B26698F.4000208@mobilearts.com> <93df43b60912150032r537d1262u4efc8aa4546d11c4@mail.gmail.com> <77C1226CCC2F7C41B022662F4775DABC57005CBAC4@EGEXCMB01.oww.root.lcl> Message-ID: <4B284BD7.1080403@krondo.com> I'm glad the default mode is now getting some love. Going forward, I think it would be best to combine efforts and avoid a separate fork if possible, it's just easier for everyone that way. It sounds like the main remaining difference is the skeletons? Is there any plan to roll the erlware skeletons into the main version? And did you also incorporate flymake support? That's really quite handy. thanks, dave Logan, Martin wrote: > :-) Well I am glad that the regular mode benefited from it. The thanks for the Erlware mode really goes out to Dave Peticolas who owns it and maintains it quite well. He has added quite a lot of new support for things like flymake and a bunch of other cool stuff which does not spring to mind right now. > > Perhaps there is a way we can collaborate more actively now with Erlang up on github as you say. > > Cheers, > Martin > > P.S I will take that "owe me one" in the form of a beer next year at EUC ;-) > > -----Original Message----- > From: Dan Gudmundsson [mailto:dangud@REDACTED] > Sent: Tuesday, December 15, 2009 2:32 AM > To: Logan, Martin > Cc: erlang-questions@REDACTED > Subject: Re: [erlang-questions] erlang emacs mode question > > Hi Martin > > I guess you haven't tested the new erlang mode either :-) > or have you incorporated the fixes we have done? > > I used the erlware version myself before Kenneth hit me hard and told > me to fix our version and apply the patches we had received. > > The one thing I miss is the edoc skeltons which you have and that you broke > out the skeletons to a separate file. > I don't use distel either so maybe your variant works better with that. > > But I have "stolen" some of the fixes you had and done many more and added > several large patches from Anders Dahlin and Tomas Abrahamsson into > which I think > is a better version. > > Hopefully now with erlang on github we can join our efforts again, so > that we can > get the best of the two things. I know that our support of the emacs > mode havn't been > the best and when time is tight the emacs mode get down prioritized. > It will probably happen again but now with erlang on github available > it should be easier to > apply the improvements the community makes. > > Cheers (I think I owe you one) > /Dan > > On Mon, Dec 14, 2009 at 11:28 PM, Logan, Martin wrote: >> BTW, the erlware erlang mode "erlware-mode" is much better than the erlang >> mode. Many bugs have been fixed and the skeletons are all edoc'd. It has >> been well maintained for over 2 years and is now way ahead IMHO. You can >> find it at erlware.org or over at the google code site >> code.google.com/p/erlware-mode >> >> Cheers, >> Martin >> >> >> On 12/14/09 10:36 AM, "G?ran B?ge" wrote: >> >> Thanks Dan, >> >> Yes it worked in R13B03, adding '%% ' and removing '%% '. Just my kind >> of timing bringing it up just when it was fixed, it's been bugging me for >> quite some time before I got around to asking:-). We are very slow >> moving to new releases as we have long lived products running out there, >> we still have some R9 based ones and I've not run R13 before, just installed >> it as a matter of fact. >> >> Cheers >> --G?ran >> >> Dan Gudmundsson wrote: >>> On Mon, Dec 14, 2009 at 4:56 PM, G?ran B?ge >>> wrote: >>>> Hi, >>>> >>>> Is there a reason why the erlang emacs mode treats comment (^C^C) and >>>> un-comment >>>> (^C^U) asymmetrical, comment adds '%% ' and uncomment removes '%'. Pretty >>>> annoying if you ask me (but who would even think of doing that :-). It >>>> used >>>> to work by adding only '%' earlier (maybe very much earlier like in R9 or >>>> so). >>> Have you tried the latest erlang mode, on github or in R13B03? >>> >>> Both ^U^C^C and ^C^U works for me. >>> >>> /Dan >>> PS: There are a lot of changes in the latest release of the erlang emacs >>> mode, >>> so if we broke something please report or even better post a >>> patch. >> -- >> -- Goran >> --------------------- May the Snow be with you -------- >> Goran Bage MobileArts www.mobilearts.se >> Tjarhovsgatan 56 SE-116 28 STOCKHOLM Sweden >> goran.bage@REDACTED phone: +46 733 358405 >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> >> > From dangud@REDACTED Wed Dec 16 08:30:08 2009 From: dangud@REDACTED (Dan Gudmundsson) Date: Wed, 16 Dec 2009 08:30:08 +0100 Subject: [erlang-questions] erlang emacs mode question In-Reply-To: <4B284BD7.1080403@krondo.com> References: <4B26698F.4000208@mobilearts.com> <93df43b60912150032r537d1262u4efc8aa4546d11c4@mail.gmail.com> <77C1226CCC2F7C41B022662F4775DABC57005CBAC4@EGEXCMB01.oww.root.lcl> <4B284BD7.1080403@krondo.com> Message-ID: <93df43b60912152330v1f2fe07erdc4bfc416217b1a6@mail.gmail.com> My plan was to fix the bugs that I could, and depend on the community to add new cool stuff and fix the hard parts that I can't. So please send patches/improvements and I promise to be more active and give them some love. /Dan On Wed, Dec 16, 2009 at 3:54 AM, Dave Peticolas wrote: > I'm glad the default mode is now getting some love. Going forward, > I think it would be best to combine efforts and avoid a separate > fork if possible, it's just easier for everyone that way. It sounds > like the main remaining difference is the skeletons? Is there any > plan to roll the erlware skeletons into the main version? And did > you also incorporate flymake support? That's really quite handy. > > thanks, > dave > > > Logan, Martin wrote: >> >> :-) ?Well I am glad that the regular mode benefited from it. ?The thanks >> for the Erlware mode really goes out to Dave Peticolas who owns it and >> maintains it quite well. He has added quite a lot of new support for things >> like flymake and a bunch of other cool stuff which does not spring to mind >> right now. >> Perhaps there is a way we can collaborate more actively now with Erlang up >> on github as you say. >> >> Cheers, >> Martin >> >> P.S I will take that "owe me one" in the form of a beer next year at EUC >> ;-) >> -----Original Message----- >> From: Dan Gudmundsson [mailto:dangud@REDACTED] Sent: Tuesday, December >> 15, 2009 2:32 AM >> To: Logan, Martin >> Cc: erlang-questions@REDACTED >> Subject: Re: [erlang-questions] erlang emacs mode question >> >> Hi Martin >> >> I guess you haven't tested the new erlang mode either :-) >> or have you incorporated the fixes we have done? >> >> I used the erlware version myself before Kenneth hit me hard and told >> me to fix our version and apply the patches we had received. >> >> The one thing I miss is the edoc skeltons which you have and that you >> broke >> out the skeletons to a separate file. >> I don't use distel either so maybe your variant works better with that. >> >> But I have "stolen" some of the fixes you had and done many more and added >> several large patches from Anders Dahlin and Tomas Abrahamsson into >> which I think >> is a better version. >> >> Hopefully now with erlang on github we can join our efforts again, so >> that we can >> get the best of the two things. I know that our support of the emacs >> mode havn't been >> the best and when time is tight the emacs mode get down prioritized. >> It will probably happen again but now with erlang on github available >> it should be easier to >> apply the improvements the community makes. >> >> Cheers (I think I owe you one) >> /Dan >> >> On Mon, Dec 14, 2009 at 11:28 PM, Logan, Martin >> wrote: >>> >>> BTW, ?the erlware erlang mode "erlware-mode" is much better than the >>> erlang >>> mode. ?Many bugs have been fixed and the skeletons are all edoc'd. ?It >>> has >>> been well maintained for over 2 years and is now way ahead IMHO. ?You can >>> find it at erlware.org or over at the google code site >>> code.google.com/p/erlware-mode >>> >>> Cheers, >>> Martin >>> >>> >>> On 12/14/09 10:36 AM, "G?ran B?ge" wrote: >>> >>> Thanks Dan, >>> >>> Yes it worked in R13B03, adding '%% ' and removing '%% '. Just my kind >>> of timing bringing it up just when it was fixed, it's been bugging me for >>> quite some time before I got around to asking:-). We are very slow >>> moving to new releases as we have long lived products running out there, >>> we still have some R9 based ones and I've not run R13 before, just >>> installed >>> it as a matter of fact. >>> >>> Cheers >>> --G?ran >>> >>> Dan Gudmundsson wrote: >>>> >>>> On Mon, Dec 14, 2009 at 4:56 PM, G?ran B?ge >>>> ?wrote: >>>>> >>>>> Hi, >>>>> >>>>> Is there a reason why the erlang emacs mode treats comment (^C^C) and >>>>> un-comment >>>>> (^C^U) asymmetrical, comment adds '%% ' and uncomment removes '%'. >>>>> Pretty >>>>> annoying if you ask me (but who would even think of doing that :-). It >>>>> used >>>>> to work by adding only '%' earlier (maybe very much earlier like in R9 >>>>> or >>>>> so). >>>> >>>> Have you tried the latest erlang mode, on github or in R13B03? >>>> >>>> Both ^U^C^C and ^C^U works for me. >>>> >>>> /Dan >>>> PS: There are a lot of changes in the latest release of the erlang emacs >>>> mode, >>>> ? ? ? ?so if we broke something please report or even better post a >>>> patch. >>> >>> -- >>> -- Goran >>> --------------------- May the Snow be with you -------- >>> ?Goran Bage ? ? ? ? MobileArts ? ? ? ?www.mobilearts.se >>> ?Tjarhovsgatan 56 ?SE-116 28 STOCKHOLM ? ? ? ? ? Sweden >>> ?goran.bage@REDACTED ? ? ? ? phone: +46 733 358405 >>> >>> ________________________________________________________________ >>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>> erlang-questions (at) erlang.org >>> >>> >>> >> > > From clist@REDACTED Wed Dec 16 10:01:23 2009 From: clist@REDACTED (Angel Alvarez) Date: Wed, 16 Dec 2009 10:01:23 +0100 Subject: [erlang-questions] Failing Makefile build on EUnit test failures In-Reply-To: <59da11980912151706s78c5eba2qc6e055aae01f75bf@mail.gmail.com> References: <59da11980912151706s78c5eba2qc6e055aae01f75bf@mail.gmail.com> Message-ID: <200912161001.24299.clist@uah.es> El Mi?rcoles, 16 de Diciembre de 2009 02:06:35 Jeremy Raymond escribi?: > Hello, > > I have a make file that runs my EUnit tests like this: > > eunit: ${EUNIT_OBJ} > erl -noshell -pa ebin -eval 'eunit:test(${TEST_MODULES}, [verbose])' -s > init stop > > What I'd like to happen is have my build fail if any of the eunit tests fail > however even if tests fail the build suceeds (the command to run the tests > returns 0?). How can I make my build fail if the tests fail, and pass if the > tests pass? > > > Thanks, > > Jeremy > add erlang:halt(ErrorCode) so the VM signals ErrorCode to the OS on exit -- Este correo no tiene dibujos. Las formas extra?as en la pantalla son letras. __________________________________________ Clist UAH a.k.a Angel __________________________________________ Sex is a battle, love is war. From clist@REDACTED Wed Dec 16 10:06:35 2009 From: clist@REDACTED (Angel Alvarez) Date: Wed, 16 Dec 2009 10:06:35 +0100 Subject: [erlang-questions] Failing Makefile build on EUnit test failures In-Reply-To: <59da11980912151706s78c5eba2qc6e055aae01f75bf@mail.gmail.com> References: <59da11980912151706s78c5eba2qc6e055aae01f75bf@mail.gmail.com> Message-ID: <200912161006.36121.clist@uah.es> El Mi?rcoles, 16 de Diciembre de 2009 02:06:35 Jeremy Raymond escribi?: > Hello, > > I have a make file that runs my EUnit tests like this: > > eunit: ${EUNIT_OBJ} > erl -noshell -pa ebin -eval 'eunit:test(${TEST_MODULES}, [verbose])' -s > init stop > > What I'd like to happen is have my build fail if any of the eunit tests fail > however even if tests fail the build suceeds (the command to run the tests > returns 0?). How can I make my build fail if the tests fail, and pass if the > tests pass? > > > Thanks, > > Jeremy > Also sinosuke@REDACTED:~/Tmp/kt> erl -noshell -eval "erlang:halt(0)" && echo Ok Ok sinosuke@REDACTED:~/Tmp/kt> erl -noshell -eval "erlang:halt(1)" && echo Ok And using init:stop you allow apps to shutdown nicely... sinosuke@REDACTED:~/Tmp/kt> erl -noshell -eval "init:stop(0)" && echo Ok Ok sinosuke@REDACTED:~/Tmp/kt> erl -noshell -eval "init:stop(1)" && echo Ok -- No imprima este correo si no es necesario. El medio ambiente est? en nuestras manos. __________________________________________ Clist UAH a.k.a Angel __________________________________________ Vivimos en un sociedad exquisitamente dependiente de la ciencia y la tecnolog?a, cuando muy poco gente conoce algo de la ciencia ? de la tecnolog?a. From sverker@REDACTED Wed Dec 16 11:03:41 2009 From: sverker@REDACTED (Sverker Eriksson) Date: Wed, 16 Dec 2009 11:03:41 +0100 Subject: [erlang-questions] OTP13B03 failed to build on OS X 10.6 in 64-bit with duplicate symbol _saved_program_buf in obj/i686-apple-darwin10/opt/smp/erl_pbifs.o and obj/i686-apple-darwin10/opt/smp/erl_main.o In-Reply-To: <8A2C91DE-993C-43BA-BB87-646D4387A3AD@gmail.com> References: <8A2C91DE-993C-43BA-BB87-646D4387A3AD@gmail.com> Message-ID: <4B28B07D.4010309@erix.ericsson.se> Ceriel Jacobs wrote: > How did anyone succeed to build OTP13B03 on Mac OS X 10.6 in 64-bit (optimized) mode? > > > ld: duplicate symbol _saved_program_buf in obj/i686-apple-darwin10/opt/smp/erl_pbifs.o and obj/i686-apple-darwin10/opt/smp/erl_main.o > collect2: ld returned 1 exit status > make[3]: *** [/Users/user/src/otp_src_R13B03/bin/i686-apple-darwin10/beam.smp] Error 1 > make[2]: *** [opt] Error 2 > make[1]: *** [smp] Error 2 > make: *** [emulator] Error 2 > Try remove this line from erts/emulator/beam/global.h: struct erl_heap_fragment* saved_program_buf; Looks like a residue from something removed and should not be there. /Sverker, Erlang/OTP Ericsson From jeraymond@REDACTED Wed Dec 16 13:05:08 2009 From: jeraymond@REDACTED (Jeremy Raymond) Date: Wed, 16 Dec 2009 07:05:08 -0500 Subject: [erlang-questions] Failing Makefile build on EUnit test failures In-Reply-To: <200912161006.36121.clist@uah.es> References: <59da11980912151706s78c5eba2qc6e055aae01f75bf@mail.gmail.com> <200912161006.36121.clist@uah.es> Message-ID: <59da11980912160405tf8de480i78e172cc20609c16@mail.gmail.com> Thanks Andrew, Angel. Using halt as suggested works like I need it to. Jeremy On Wed, Dec 16, 2009 at 4:06 AM, Angel Alvarez wrote: > El Mi?rcoles, 16 de Diciembre de 2009 02:06:35 Jeremy Raymond escribi?: > > Hello, > > > > I have a make file that runs my EUnit tests like this: > > > > eunit: ${EUNIT_OBJ} > > erl -noshell -pa ebin -eval 'eunit:test(${TEST_MODULES}, [verbose])' > -s > > init stop > > > > What I'd like to happen is have my build fail if any of the eunit tests > fail > > however even if tests fail the build suceeds (the command to run the > tests > > returns 0?). How can I make my build fail if the tests fail, and pass if > the > > tests pass? > > > > > > Thanks, > > > > Jeremy > > > > Also > > sinosuke@REDACTED:~/Tmp/kt> erl -noshell -eval "erlang:halt(0)" && echo Ok > Ok > > sinosuke@REDACTED:~/Tmp/kt> erl -noshell -eval "erlang:halt(1)" && echo Ok > > > And using init:stop you allow apps to shutdown nicely... > > > sinosuke@REDACTED:~/Tmp/kt> erl -noshell -eval "init:stop(0)" && echo Ok > Ok > > sinosuke@REDACTED:~/Tmp/kt> erl -noshell -eval "init:stop(1)" && echo Ok > > > -- > No imprima este correo si no es necesario. El medio ambiente est? en > nuestras manos. > __________________________________________ > > Clist UAH a.k.a Angel > __________________________________________ > Vivimos en un sociedad exquisitamente dependiente de la ciencia y la > tecnolog?a, cuando muy poco gente conoce algo de la ciencia ? de la > tecnolog?a. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From jeraymond@REDACTED Wed Dec 16 13:13:40 2009 From: jeraymond@REDACTED (Jeremy Raymond) Date: Wed, 16 Dec 2009 07:13:40 -0500 Subject: Automated Erlang Builds with CruiseControl In-Reply-To: <59da11980912151710w412472edw134078cd667c42f4@mail.gmail.com> References: <59da11980912151710w412472edw134078cd667c42f4@mail.gmail.com> Message-ID: <59da11980912160413i31d63852m9d5ec7bff738c5df@mail.gmail.com> Hi, It looks like CruiseControl only understands JUnit XML output. Is there any way to get EUnit to output test results in a different format, or does EUnit have some sort of hook where I could write my own result formatter? Thanks, Jeremy On Tue, Dec 15, 2009 at 8:10 PM, Jeremy Raymond wrote: > Hello, > > I've automated my build process using CruiseControl to build my Erlang > project. The build works fine but my EUnit test output isn't recognized unit > tests. Has anyone done this before and know how to get the EUnit test output > to show? > > > Thanks, > > Jeremy > From erlang@REDACTED Wed Dec 16 13:17:33 2009 From: erlang@REDACTED (Joe Armstrong) Date: Wed, 16 Dec 2009 13:17:33 +0100 Subject: websockets and erlang Message-ID: <9b08084c0912160417g4c352929g90122a587b5b052c@mail.gmail.com> After a little experimentation I've got websockets and erlang playing together. This means we can now do pure asynchronous I/O with a browser - no long-poll, no comet, no server-polling, no ajax and a major source of server inefficiency (HTTP header parsing) is totally eliminated. Summary: On your web page you write
In Erlang you say Browser ! {send, "tag1 ! XYZ"} Then the inside of the div is set to the string XYZ This presupposes that you have Google chrome, a local web server and a web page with some suitable javascript to decode the incoming messages. read more about this on my blog http://armstrongonsoftware.blogspot.com/2009/12/comet-is-dead-long-live-websockets.html /Joe From magnus@REDACTED Wed Dec 16 13:20:35 2009 From: magnus@REDACTED (Magnus Henoch) Date: Wed, 16 Dec 2009 12:20:35 +0000 Subject: Automated Erlang Builds with CruiseControl In-Reply-To: <59da11980912151710w412472edw134078cd667c42f4@mail.gmail.com> (Jeremy Raymond's message of "Tue, 15 Dec 2009 20:10:08 -0500") References: <59da11980912151710w412472edw134078cd667c42f4@mail.gmail.com> Message-ID: <84r5qvkt4c.fsf@linux-b2a3.site> Jeremy Raymond writes: > I've automated my build process using CruiseControl to build my Erlang > project. The build works fine but my EUnit test output isn't recognized unit > tests. Has anyone done this before and know how to get the EUnit test output > to show? Try the eunit_surefire module: http://www.erlang.org/doc/man/eunit_surefire.html It outputs results in an XML format commonly called the "JUnit" format. (From what I've read, it seems it was actually invented for Ant, but never implemented in JUnit itself.) -- Magnus Henoch, magnus@REDACTED Erlang Training and Consulting http://www.erlang-consulting.com/ From romain.lenglet@REDACTED Wed Dec 16 13:21:40 2009 From: romain.lenglet@REDACTED (Romain Lenglet) Date: Wed, 16 Dec 2009 21:21:40 +0900 Subject: [erlang-questions] Failing Makefile build on EUnit test failures In-Reply-To: <200912161006.36121.clist@uah.es> References: <59da11980912151706s78c5eba2qc6e055aae01f75bf@mail.gmail.com> <200912161006.36121.clist@uah.es> Message-ID: <4B28D0D4.8030309@berabera.info> Unfortunately, init:stop/1 is relatively new, and older versions of OTP have only init:stop/0. To be compatible with older versions of OTP, you have only two choices: - call halt/1, which does not flush the standard output (which is an important drawback in the case of EUnit, as the test's output is often essential for debugging and is often truncated when calling halt/1 just after a test); - call init:stop/0, which always exits with code 0 but flushes the standard output; in that case, you have to transmit the result of the test through other means, e.g. by writing a result code into a file with file:write(), etc. and handle it in the calling script or Makefile. I use the latter solution in the integration of EUnit into Autoconf/Autotest. You may want to use that solution: http://www.berabera.info/en/node/194 BR, -- Romain Lenglet Angel Alvarez wrote: > El Mi?rcoles, 16 de Diciembre de 2009 02:06:35 Jeremy Raymond escribi?: >> Hello, >> >> I have a make file that runs my EUnit tests like this: >> >> eunit: ${EUNIT_OBJ} >> erl -noshell -pa ebin -eval 'eunit:test(${TEST_MODULES}, [verbose])' -s >> init stop >> >> What I'd like to happen is have my build fail if any of the eunit tests fail >> however even if tests fail the build suceeds (the command to run the tests >> returns 0?). How can I make my build fail if the tests fail, and pass if the >> tests pass? >> >> >> Thanks, >> >> Jeremy >> > > Also > > sinosuke@REDACTED:~/Tmp/kt> erl -noshell -eval "erlang:halt(0)" && echo Ok > Ok > > sinosuke@REDACTED:~/Tmp/kt> erl -noshell -eval "erlang:halt(1)" && echo Ok > > > And using init:stop you allow apps to shutdown nicely... > > > sinosuke@REDACTED:~/Tmp/kt> erl -noshell -eval "init:stop(0)" && echo Ok > Ok > > sinosuke@REDACTED:~/Tmp/kt> erl -noshell -eval "init:stop(1)" && echo Ok > > From cowboymathu@REDACTED Wed Dec 16 13:25:37 2009 From: cowboymathu@REDACTED (MAthuvathanan Mou.) Date: Wed, 16 Dec 2009 18:25:37 +0600 Subject: Is it a best practice to have table_name and record same? Message-ID: <90b4299d0912160425m410445bw6f913d968229c02d@mail.gmail.com> Hi all, I have record with two parameters like -record(user, {name, password}). I am using above record for a user table. I need to create another table country_code with country and code. Is it all correct to re-use above record for country_code as well or else do I have to create another record like -record(country_code, {country, code}). Or else, should I create a common record with two parmeters like -record(two_params, {first, second}). Which one is good practice? Thanks -- Mathuvathanan Mou. From freza@REDACTED Wed Dec 16 14:18:43 2009 From: freza@REDACTED (Jachym Holecek) Date: Wed, 16 Dec 2009 13:18:43 +0000 Subject: [erlang-questions] Is it a best practice to have table_name and record same? In-Reply-To: <90b4299d0912160425m410445bw6f913d968229c02d@mail.gmail.com> References: <90b4299d0912160425m410445bw6f913d968229c02d@mail.gmail.com> Message-ID: <20091216131843.GA25838@hanele> Hello, [quoted text rearranged for convenience] # MAthuvathanan Mou. 2009-12-16: > I have record with two parameters like > > -record(user, {name, password}). > > I am using above record for a user table. > > I need to create another table country_code with country and code. > > Is it all correct to re-use above record for country_code as well This would indeed be an extremely nasty thing to do. > Or else, should I create a common record with two parmeters like > > -record(two_params, {first, second}). Perhaps justifiable in some cases, but not in yours. Users and countries are entirely different kinds of things, so I'd say treat them as such. "Premature abstraction is the root of all evil!" ;-) > or else do I have to create another record like > > -record(country_code, {country, code}). This is the way to go. Gives you readable source code and more flexibility than the above options (imagine wanting to extend user/country with new columns later on). And to answer the general question: Keeping record name same as table name is convenient and makes code easy to understand, so I'd stick with that most of the time. Also, nothing wrong with reusing the same record for multiple tables (if you have a good reason to keep the tables separate), as long as they host exactly the same kind of things. Regards, -- Jachym From jeraymond@REDACTED Wed Dec 16 14:26:17 2009 From: jeraymond@REDACTED (Jeremy Raymond) Date: Wed, 16 Dec 2009 08:26:17 -0500 Subject: [erlang-questions] Re: Automated Erlang Builds with CruiseControl In-Reply-To: <84r5qvkt4c.fsf@linux-b2a3.site> References: <59da11980912151710w412472edw134078cd667c42f4@mail.gmail.com> <84r5qvkt4c.fsf@linux-b2a3.site> Message-ID: <59da11980912160526h5ed24636m5c3cb0cb1465fe1f@mail.gmail.com> Actually the version of Erlang I'm using is newer and has init:stop/1 available. I've update my build script to use it. Thanks again, Jeremy On Wed, Dec 16, 2009 at 7:20 AM, Magnus Henoch wrote: > Jeremy Raymond writes: > > > I've automated my build process using CruiseControl to build my Erlang > > project. The build works fine but my EUnit test output isn't recognized > unit > > tests. Has anyone done this before and know how to get the EUnit test > output > > to show? > > Try the eunit_surefire module: > http://www.erlang.org/doc/man/eunit_surefire.html > > It outputs results in an XML format commonly called the "JUnit" format. > (From what I've read, it seems it was actually invented for Ant, but > never implemented in JUnit itself.) > > -- > Magnus Henoch, magnus@REDACTED > Erlang Training and Consulting > http://www.erlang-consulting.com/ > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From jeraymond@REDACTED Wed Dec 16 14:27:07 2009 From: jeraymond@REDACTED (Jeremy Raymond) Date: Wed, 16 Dec 2009 08:27:07 -0500 Subject: [erlang-questions] Re: Automated Erlang Builds with CruiseControl In-Reply-To: <59da11980912160526h5ed24636m5c3cb0cb1465fe1f@mail.gmail.com> References: <59da11980912151710w412472edw134078cd667c42f4@mail.gmail.com> <84r5qvkt4c.fsf@linux-b2a3.site> <59da11980912160526h5ed24636m5c3cb0cb1465fe1f@mail.gmail.com> Message-ID: <59da11980912160527t51993d3dx3e30cb0957b25e6c@mail.gmail.com> Oops, wrong thread. On Wed, Dec 16, 2009 at 8:26 AM, Jeremy Raymond wrote: > Actually the version of Erlang I'm using is newer and has init:stop/1 > available. I've update my build script to use it. > > Thanks again, > > Jeremy > > > On Wed, Dec 16, 2009 at 7:20 AM, Magnus Henoch < > magnus@REDACTED> wrote: > >> Jeremy Raymond writes: >> >> > I've automated my build process using CruiseControl to build my Erlang >> > project. The build works fine but my EUnit test output isn't recognized >> unit >> > tests. Has anyone done this before and know how to get the EUnit test >> output >> > to show? >> >> Try the eunit_surefire module: >> http://www.erlang.org/doc/man/eunit_surefire.html >> >> It outputs results in an XML format commonly called the "JUnit" format. >> (From what I've read, it seems it was actually invented for Ant, but >> never implemented in JUnit itself.) >> >> -- >> Magnus Henoch, magnus@REDACTED >> Erlang Training and Consulting >> http://www.erlang-consulting.com/ >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> > From jeraymond@REDACTED Wed Dec 16 14:27:51 2009 From: jeraymond@REDACTED (Jeremy Raymond) Date: Wed, 16 Dec 2009 08:27:51 -0500 Subject: [erlang-questions] Failing Makefile build on EUnit test failures In-Reply-To: <4B28D0D4.8030309@berabera.info> References: <59da11980912151706s78c5eba2qc6e055aae01f75bf@mail.gmail.com> <200912161006.36121.clist@uah.es> <4B28D0D4.8030309@berabera.info> Message-ID: <59da11980912160527w654b278bu5b0a9ea48e348d20@mail.gmail.com> Hello - init:stop/1 is available on the version of Erlang I have. Thanks! On Wed, Dec 16, 2009 at 7:21 AM, Romain Lenglet < romain.lenglet@REDACTED> wrote: > Unfortunately, init:stop/1 is relatively new, and older versions of OTP > have only init:stop/0. To be compatible with older versions of OTP, you have > only two choices: > > - call halt/1, which does not flush the standard output (which is an > important drawback in the case of EUnit, as the test's output is often > essential for debugging and is often truncated when calling halt/1 just > after a test); > > - call init:stop/0, which always exits with code 0 but flushes the standard > output; in that case, you have to transmit the result of the test through > other means, e.g. by writing a result code into a file with file:write(), > etc. and handle it in the calling script or Makefile. > > I use the latter solution in the integration of EUnit into > Autoconf/Autotest. You may want to use that solution: > http://www.berabera.info/en/node/194 > > BR, > -- > Romain Lenglet > > > Angel Alvarez wrote: > >> El Mi?rcoles, 16 de Diciembre de 2009 02:06:35 Jeremy Raymond escribi?: >> >>> Hello, >>> >>> I have a make file that runs my EUnit tests like this: >>> >>> eunit: ${EUNIT_OBJ} >>> erl -noshell -pa ebin -eval 'eunit:test(${TEST_MODULES}, [verbose])' >>> -s >>> init stop >>> >>> What I'd like to happen is have my build fail if any of the eunit tests >>> fail >>> however even if tests fail the build suceeds (the command to run the >>> tests >>> returns 0?). How can I make my build fail if the tests fail, and pass if >>> the >>> tests pass? >>> >>> >>> Thanks, >>> >>> Jeremy >>> >>> >> Also >> >> sinosuke@REDACTED:~/Tmp/kt> erl -noshell -eval "erlang:halt(0)" && echo Ok >> Ok >> >> sinosuke@REDACTED:~/Tmp/kt> erl -noshell -eval "erlang:halt(1)" && echo Ok >> >> >> And using init:stop you allow apps to shutdown nicely... >> >> >> sinosuke@REDACTED:~/Tmp/kt> erl -noshell -eval "init:stop(0)" && echo Ok >> Ok >> >> sinosuke@REDACTED:~/Tmp/kt> erl -noshell -eval "init:stop(1)" && echo Ok >> >> >> > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From peppe@REDACTED Wed Dec 16 14:42:52 2009 From: peppe@REDACTED (Peter Andersson) Date: Wed, 16 Dec 2009 14:42:52 +0100 Subject: [erlang-questions] Common Test Log Categories In-Reply-To: <23D5C875-12BD-4010-944E-28CEA120DEE9@souja.net> References: <23D5C875-12BD-4010-944E-28CEA120DEE9@souja.net> Message-ID: <4B28E3DC.7030804@erix.ericsson.se> Sorry Jayson, didn't see your question until now. Here's where it's documented: http://www.erlang.org/doc/apps/common_test/run_test_chapter.html#id2267439 /Peter Ericsson AB, Erlang/OTP Jayson Vantuyl wrote: > When using the logging functions in CT, I've noticed that there is a Category parameter. It seems like the only usage I can find just uses the atom "default". > > Are there any other categories? How do they show up? Where is this documented? > > Thanks, > > From bengt.kleberg@REDACTED Wed Dec 16 14:27:08 2009 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 16 Dec 2009 14:27:08 +0100 Subject: [erlang-questions] Is it a best practice to have table_name and record same? In-Reply-To: <90b4299d0912160425m410445bw6f913d968229c02d@mail.gmail.com> References: <90b4299d0912160425m410445bw6f913d968229c02d@mail.gmail.com> Message-ID: <1260970028.4762.28.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Greetings, Please use a new record: -record(country_code, {country, code}). It helps the readability of your code. bengt On Wed, 2009-12-16 at 18:25 +0600, MAthuvathanan Mou. wrote: > Hi all, > > I have record with two parameters like > > -record(user, {name, password}). > > I am using above record for a user table. > > I need to create another table country_code with country and code. > > Is it all correct to re-use above record for country_code as well or else do > I have to create another record like > > -record(country_code, {country, code}). > > Or else, should I create a common record with two parmeters like > > -record(two_params, {first, second}). > > Which one is good practice? > > Thanks > From mike_k_houghton@REDACTED Wed Dec 16 13:54:52 2009 From: mike_k_houghton@REDACTED (mike h) Date: Wed, 16 Dec 2009 12:54:52 +0000 (GMT) Subject: Advice In-Reply-To: References: Message-ID: <337001.38945.qm@web27802.mail.ukl.yahoo.com> Thanks for all your comments - I've ordered Joe's book and will no doubt get the OReilly book as well :) Mike ________________________________ From: Michael Turner To: Vasilij Savin ; mike h Cc: "erlang-questions@REDACTED" Sent: Sun, 13 December, 2009 15:15:29 Subject: Re: Advice "Armstrong's book is quite heavy in technical details and is more of reference manual." I don't know why, but I'm finding it a very pleasant tutorial.? It reads very smoothly.? It might have more value in some ways as a reference, but that's clearly not the book's main purpose. -michael turner ============ Greetings, We are about to finish our project developing Erlang Cluster and I think we actually use something that you are thinking about. In a nutshell, we have Mnesia for storing data tuples, that is controlled by one process and everybody who wants to get a tuple requests it from the controlling process (no direct access to mnesia). Then this tuple is assigned in Mnesia transaction and sent to requester. Mnesia gives you plenty of things for free, so perhaps it is better not to reinvent the wheel, unless there are good reasons to do so. Regarding books, can not recommend either. We had I think O'Reillys book throughout project, but it was not as useful as online documentation for us. YMMV. Armstrong's book is quite heavy in technical details and is more of reference manual. Hope that helps. Regards, Vasilij Savin On Sun, Dec 13, 2009 at 2:45 PM, Jayson Vantuyl wrote: > Honestly, you might do better to just use Mnesia as the backend for a > tuple-space. It's distributed and has all of the features. > > Otherwise, I wouldn't probably make each tuple is a process. If > distribution isn't a goal, you might consider using ets tables. They're > lightning fast and you can do pretty powerful queries on them using > ets:match and friends. > > I can't currently think of a big advantage to using processes as tuples, > although I admit that the objects-as-processes model is a good way to move > from OOP to FP. > > Good luck. > > On Dec 13, 2009, at 4:09 AM, mike h wrote: > > > Hi All, > > > > I've just started learning Erland and I'm really excited by it! > > I have a couple of questions. > > > > I have a lot of experience in OO languages and quite a bit in some of the > imperative/functional hybrids like Ruby etc. My main interest in Erlang is > in it's concurrent and distributed capabilities, so, which of the two main > Erlang books would folk reccommend? (I think I'm right in saying there are > currently just two main books, one by Oreilly and one by Erlang's designer) > > > > Next question is a bit more open ended. I have a particular interest in > tuple spaces (JavaSpaces, Linda, Rinda etc) and their implementation and > application.. And I want to use Erlang to implement a tuple space server and > client. At the moment I've not really yet got into the Erlang 'mindset' but > my initial idea is to use a process to represent a Tuple and have one > process as the space server and a message to that server would create a > tuple (ie process) based on the message details. > > > > Any comments, advice, pointers to existing implementations of a tuple > space etc etc would be welcome, > > > > Thanks > > > > Mike > > -- > Jayson Vantuyl > kagato@REDACTED > > > > > > From steven.charles.davis@REDACTED Wed Dec 16 14:56:51 2009 From: steven.charles.davis@REDACTED (Steve Davis) Date: Wed, 16 Dec 2009 05:56:51 -0800 (PST) Subject: Is it a best practice to have table_name and record same? In-Reply-To: <90b4299d0912160425m410445bw6f913d968229c02d@mail.gmail.com> References: <90b4299d0912160425m410445bw6f913d968229c02d@mail.gmail.com> Message-ID: <5e3b9602-e805-486d-928d-418061e698d2@o9g2000vbj.googlegroups.com> On Dec 16, 6:25?am, "MAthuvathanan Mou." wrote: > Hi all, > > I have record with two parameters like > > -record(user, {name, password}). > > I am using above record for a user table. > > I need to create another table country_code with country and code. > > Is it all correct to re-use above record for country_code as well or else do No. > I have to create another record like > > -record(country_code, {country, code}). > Yes. > Or else, should I create a common record with two parmeters like > > -record(two_params, {first, second}). > No. > Which one is good practice? > Only the second one. Consider, for example... Username: United States Password: USA ...and all other sorts of confusion. /s From jeraymond@REDACTED Wed Dec 16 15:29:06 2009 From: jeraymond@REDACTED (Jeremy Raymond) Date: Wed, 16 Dec 2009 09:29:06 -0500 Subject: [erlang-questions] Re: Automated Erlang Builds with CruiseControl In-Reply-To: <84r5qvkt4c.fsf@linux-b2a3.site> References: <59da11980912151710w412472edw134078cd667c42f4@mail.gmail.com> <84r5qvkt4c.fsf@linux-b2a3.site> Message-ID: <59da11980912160629x5d1d7bbbyc09823b0d657ad57@mail.gmail.com> Thanks a lot Magnus, this does exactly what I needed. CruiseControl does indeed recognize this output. Jeremy On Wed, Dec 16, 2009 at 7:20 AM, Magnus Henoch wrote: > Jeremy Raymond writes: > > > I've automated my build process using CruiseControl to build my Erlang > > project. The build works fine but my EUnit test output isn't recognized > unit > > tests. Has anyone done this before and know how to get the EUnit test > output > > to show? > > Try the eunit_surefire module: > http://www.erlang.org/doc/man/eunit_surefire.html > > It outputs results in an XML format commonly called the "JUnit" format. > (From what I've read, it seems it was actually invented for Ant, but > never implemented in JUnit itself.) > > -- > Magnus Henoch, magnus@REDACTED > Erlang Training and Consulting > http://www.erlang-consulting.com/ > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From cerieljacobs@REDACTED Wed Dec 16 16:21:28 2009 From: cerieljacobs@REDACTED (Ceriel Jacobs) Date: Wed, 16 Dec 2009 16:21:28 +0100 Subject: [erlang-questions] OTP13B03 failed to make parallel on OS X 10.6 in 64-bit: ld: duplicate symbol in libei.a(ei_portio.o) (ei_connect.o) In-Reply-To: <4B28B07D.4010309@erix.ericsson.se> References: <8A2C91DE-993C-43BA-BB87-646D4387A3AD@gmail.com> <4B28B07D.4010309@erix.ericsson.se> Message-ID: <49C29A7F-6281-4F46-863B-F39CAF7AB6C4@gmail.com> Thanks, after removing the line from erts/emulator/beam/global.h, the ./configure runs without breaking. Though a parallel 'make -j2' does not run without errors. Q1: Is a parallel build supported or explicitly not? Seven times, this "cc1: error: too many filenames given. Type cc1 --help for usage" occurs. An example: gcc -MM -MG -mdynamic-no-pic -m64 -fast -arch x86_64 -march=nocona -mtune=generic -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -I/Users/user/src/otp_src_R13B03/erts/i686-apple-darwin10 -no-cpp-precomp -DHAVE_CONFIG_H -Wall -Wstrict-prototypes -Wmissing-prototypes -Wdeclaration-after-statement -DUSE_THREADS -D_THREAD_SAFE -D_REENTRANT -Ii686-apple-darwin10/opt/plain -Ibeam -Isys/unix -Isys/common -Ii686-apple-darwin10 -Izlib -Ipcre -Ihipe -I../include -I../include/i686-apple-darwin10 -I../include/internal -I../include/internal/i686-apple-darwin10 -Idrivers/common beam/atom.c beam/beam_bif_load.c beam/beam_bp.c beam/beam_catches.c beam/beam_debug.c beam/beam_emu.c beam/beam_load.c beam/benchmark.c beam/bif.c beam/big.c beam/binary.c beam/break.c beam/copy.c beam/dist.c beam/elib_malloc.c beam/elib_memmove.c beam/erl_afit_alloc.c beam/erl_alloc.c beam/erl_alloc_util.c beam/erl_arith.c beam/erl_async.c beam/erl_bestfit_alloc.c beam/erl_bif_chksum.c beam/erl_bif_ddll.c beam/erl_bif_guard.c beam/erl_bif_info.c beam/erl_bif_lists.c beam/erl_bif_op.c beam/erl_bif_os.c beam/erl_bif_port.c beam/erl_bif_re.c beam/erl_bif_timer.c beam/erl_bif_trace.c beam/erl_bits.c beam/erl_db.c beam/erl_db_hash.c beam/erl_db_tree.c beam/erl_db_util.c beam/erl_debug.c beam/erl_drv_thread.c beam/erl_fun.c beam/erl_gc.c beam/erl_goodfit_alloc.c beam/erl_init.c beam/erl_instrument.c beam/erl_lock_check.c beam/erl_lock_count.c beam/erl_math.c beam/erl_md5.c beam/erl_message.c beam/erl_monitors.c beam/erl_mtrace.c beam/erl_nif.c beam/erl_nmgc.c beam/erl_node_tables.c beam/erl_obsolete.c beam/erl_port_task.c beam/erl_posix_str.c beam/erl_printf_term.c beam/erl_process.c beam/erl_process_dict.c beam/erl_process_dump.c beam/erl_process_lock.c beam/erl_resolv_dns.c beam/erl_resolv_nodns.c beam/erl_term.c beam/erl_time_sup.c beam/erl_trace.c beam/erl_unicode.c beam/erl_zlib.c beam/export.c beam/external.c beam/fix_alloc.c beam/hash.c beam/index.c beam/io.c beam/module.c beam/packet_parser.c beam/register.c beam/safe_hashcd /Users/user/src/otp_src_R13B03/erts/lib_src && make opt .c beam/time.c beam/utils.c \ | sed 's|^\([^:]*:\)|$(OBJDIR)/\1|g;s|i686-apple-darwin10/opt/plain/|$(TTF_DIR)/|g;s|\([ ]\)/Users/user/src/otp_src_R13B03/|\1$(ERL_TOP)/|g;s|^/Users/user/src/otp_src_R13B03/|$(ERL_TOP)/|g;s|$(OBJDIR)/erl_poll.o|$(OBJDIR)/erl_poll.kp.o $(OBJDIR)/erl_poll.nkp.o|g;s|$(OBJDIR)/erl_check_io.o|$(OBJDIR)/erl_check_io.kp.o $(OBJDIR)/erl_check_io.nkp.o|g' > i686-apple-darwin10/depend.mk make -f i686-apple-darwin10/Makefile TYPE=opt /bin/mkdir -p obj/i686-apple-darwin10/opt cc1: error: too many filenames given. Type cc1 --help for usage Let me start over again: 'sudo make clean', './configure ...' and 'make' (now without -j) The "cc1: error: too many filenames given." errors are still there. Now the make stops with a 'ld: duplicate symbol' error: gcc -fast -arch x86_64 -march=nocona -mtune=generic -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -DEI_64BIT -no-cpp-precomp -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -fno-strict-aliasing -I. -I../include -Iconnect -Iencode -Idecode -Imisc -Iepmd -Iregistry -Ii686-apple-darwin10 -Ilegacy -D_REENTRANT -D_THREAD_SAFE -DPOSIX_THREADS -fast -arch x86_64 -march=nocona -mtune=generic -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -o /Users/user/src/otp_src_R13B03/lib/erl_interface/bin/i686-apple-darwin10/erl_call prog/erl_call.c prog/erl_start.c \ -L/Users/user/src/otp_src_R13B03/lib/erl_interface/obj/i686-apple-darwin10 -lei -lpthread ld: duplicate symbol _ei_tracelevel in /Users/user/src/otp_src_R13B03/lib/erl_interface/obj/i686-apple-darwin10/libei.a(ei_portio.o) and /Users/user/src/otp_src_R13B03/lib/erl_interface/obj/i686-apple-darwin10/libei.a(ei_connect.o) collect2: ld returned 1 exit status make[4]: *** [/Users/user/src/otp_src_R13B03/lib/erl_interface/bin/i686-apple-darwin10/erl_call] Error 1 make[3]: *** [opt] Error 2 make[2]: *** [opt] Error 2 make[1]: *** [opt] Error 2 make: *** [libs] Error 2 Q2: Any suggestions how to pass beyond this barrier? ~Ceriel Jacobs On 16 dec 2009, at 11:03 Sverker Eriksson wrote: > Try remove this line from erts/emulator/beam/global.h: > > struct erl_heap_fragment* saved_program_buf; From erlang@REDACTED Wed Dec 16 16:22:02 2009 From: erlang@REDACTED (Joe Armstrong) Date: Wed, 16 Dec 2009 16:22:02 +0100 Subject: websockets and erlang Message-ID: <9b08084c0912160722q583c6713l4cfcacebafc0a349@mail.gmail.com> This mail seemed to get lost, so I'm sending it again ... After a little experimentation I've got websockets and erlang playing together. This means we can now do pure asynchronous I/O with a browser - no long-poll, no comet, no server-polling, no ajax and a major source of server inefficiency (HTTP header parsing) is totally eliminated. Summary: On your web page you write
In Erlang you say Browser ! {send, "tag1 ! XYZ"} Then the inside of the div is set to the string XYZ This presupposes that you have Google chrome, a local web server and a web page with some suitable javascript to decode the incoming messages. read more about this on my blog http://armstrongonsoftware.blogspot.com/2009/12/comet-is-dead-long-live-websockets.html /Joe From bgustavsson@REDACTED Wed Dec 16 16:50:19 2009 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Wed, 16 Dec 2009 16:50:19 +0100 Subject: [erlang-questions] OTP13B03 failed to make parallel on OS X 10.6 in 64-bit: ld: duplicate symbol in libei.a(ei_portio.o) (ei_connect.o) In-Reply-To: <49C29A7F-6281-4F46-863B-F39CAF7AB6C4@gmail.com> References: <8A2C91DE-993C-43BA-BB87-646D4387A3AD@gmail.com> <4B28B07D.4010309@erix.ericsson.se> <49C29A7F-6281-4F46-863B-F39CAF7AB6C4@gmail.com> Message-ID: <6672d0160912160750v76695f0er8b565431052c2edd@mail.gmail.com> On Wed, Dec 16, 2009 at 4:21 PM, Ceriel Jacobs wrote: > Though a parallel 'make -j2' does not run without errors. > Q1: Is a parallel build supported or explicitly not? No. Parallel build does not work, unfortunately. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From sverker@REDACTED Wed Dec 16 17:01:53 2009 From: sverker@REDACTED (Sverker Eriksson) Date: Wed, 16 Dec 2009 17:01:53 +0100 Subject: [erlang-questions] OTP13B03 failed to make parallel on OS X 10.6 in 64-bit: ld: duplicate symbol in libei.a(ei_portio.o) (ei_connect.o) In-Reply-To: <49C29A7F-6281-4F46-863B-F39CAF7AB6C4@gmail.com> References: <8A2C91DE-993C-43BA-BB87-646D4387A3AD@gmail.com> <4B28B07D.4010309@erix.ericsson.se> <49C29A7F-6281-4F46-863B-F39CAF7AB6C4@gmail.com> Message-ID: <4B290471.5090005@erix.ericsson.se> Ceriel Jacobs wrote: > ld: duplicate symbol _ei_tracelevel > > Q2: Any suggestions how to pass beyond this barrier? > > Change lib/erl_interface/src/misc/ei_internal.h from int ei_tracelevel; to extern int ei_tracelevel; Seems your linker is less forgiving with duplicate definitions of global variables. How many more are we going to find... /Sverker, Erlang/OTP Ericsson From cerieljacobs@REDACTED Wed Dec 16 17:08:14 2009 From: cerieljacobs@REDACTED (Ceriel Jacobs) Date: Wed, 16 Dec 2009 17:08:14 +0100 Subject: [erlang-questions] OTP13B03 failed to make parallel on OS X 10.6 in 64-bit: ld: duplicate symbol in libei.a(ei_portio.o) (ei_connect.o) In-Reply-To: <6672d0160912160750v76695f0er8b565431052c2edd@mail.gmail.com> References: <8A2C91DE-993C-43BA-BB87-646D4387A3AD@gmail.com> <4B28B07D.4010309@erix.ericsson.se> <49C29A7F-6281-4F46-863B-F39CAF7AB6C4@gmail.com> <6672d0160912160750v76695f0er8b565431052c2edd@mail.gmail.com> Message-ID: <722A54AF-7426-4AA7-A5C0-C27CC8D38B3A@gmail.com> This useful information would fit the 'readme' file, somewhere near 'step 5'. Anyhow, thanks for the fast answer. ~Ceriel Jacobs Op 16 dec 2009, om 16:50 heeft Bj?rn Gustavsson het volgende geschreven: > On Wed, Dec 16, 2009 at 4:21 PM, Ceriel Jacobs wrote: > >> Though a parallel 'make -j2' does not run without errors. >> Q1: Is a parallel build supported or explicitly not? > > No. Parallel build does not work, unfortunately. > > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bgustavsson@REDACTED Wed Dec 16 17:16:55 2009 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Wed, 16 Dec 2009 17:16:55 +0100 Subject: [erlang-questions] OTP13B03 failed to make parallel on OS X 10.6 in 64-bit: ld: duplicate symbol in libei.a(ei_portio.o) (ei_connect.o) In-Reply-To: <722A54AF-7426-4AA7-A5C0-C27CC8D38B3A@gmail.com> References: <8A2C91DE-993C-43BA-BB87-646D4387A3AD@gmail.com> <4B28B07D.4010309@erix.ericsson.se> <49C29A7F-6281-4F46-863B-F39CAF7AB6C4@gmail.com> <6672d0160912160750v76695f0er8b565431052c2edd@mail.gmail.com> <722A54AF-7426-4AA7-A5C0-C27CC8D38B3A@gmail.com> Message-ID: <6672d0160912160816g771bd014tf2360ba31054e77e@mail.gmail.com> 2009/12/16 Ceriel Jacobs : > This useful information would fit the > 'readme' file, somewhere near 'step 5'. I hope that we will have parallel builds working before the R13B04 release. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From egil@REDACTED Wed Dec 16 19:12:47 2009 From: egil@REDACTED (=?ISO-8859-1?Q?Bj=F6rn-Egil_Dahlberg?=) Date: Wed, 16 Dec 2009 19:12:47 +0100 Subject: [erlang-questions] OTP13B03 failed to make parallel on OS X 10.6 in 64-bit: ld: duplicate symbol in libei.a(ei_portio.o) (ei_connect.o) In-Reply-To: <4B290471.5090005@erix.ericsson.se> References: <8A2C91DE-993C-43BA-BB87-646D4387A3AD@gmail.com> <4B28B07D.4010309@erix.ericsson.se> <49C29A7F-6281-4F46-863B-F39CAF7AB6C4@gmail.com> <4B290471.5090005@erix.ericsson.se> Message-ID: <4B29231F.1040005@erix.ericsson.se> Sverker Eriksson wrote: > Ceriel Jacobs wrote: >> ld: duplicate symbol _ei_tracelevel >> >> Q2: Any suggestions how to pass beyond this barrier? >> >> > Change lib/erl_interface/src/misc/ei_internal.h from > > int ei_tracelevel; > > to > > extern int ei_tracelevel; > > Seems your linker is less forgiving with duplicate definitions of global > variables. How many more are we going to find... This fix now on git://github.com/psyeugenic/otp.git pr/ei_extern_fix It will probably make it into erlang/otp r13b04_dev tonight or tomorrow. Regards, Bj?rn-Egil Erlang/OTP From james.aimonetti@REDACTED Wed Dec 16 20:09:23 2009 From: james.aimonetti@REDACTED (James Aimonetti) Date: Wed, 16 Dec 2009 14:09:23 -0500 Subject: Generating Primes and the O'Neill paper Message-ID: <4B293063.7010500@gmail.com> I have been working the Project Euler problems and wanted to see what the list thought about my implementation of a prime number generator that is based off the Melissa O'Neill paper[1]. I also used a lazy list idea from one of Joe Armstrong's suggestions[2] concerning a Euler problem. My implementation uses the priority queue (page 7 of the PDF), and I'm using a skew heap I found[3] on this list to accomplish that, which I modified to handle key-value pairs instead of just keys. I made a pastie[4] to view the code. I tried to stay true to the Haskell version in the paper but had to modify some parts. I don't know Haskell so I easily could have lost something in the translation. Oh, the function is called queue because I was playing with other methods, like the unfaithful sieve, but I've only included the queue/1 in the pastie. I am going to try the wheel and other optimizations talked about in the paper, but wanted a sanity check from the gurus that my Erlang is decent and the implementation isn't totally bunk. Thanks in advance for any advice or corrections. [1] - http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf [2] - http://www.erlang.org/cgi-bin/ezmlm-cgi?4:mss:177:khdaceipfabbicmifdhf [3] - http://www.erlang.org/pipermail/erlang-questions/2007-August/028769.html [4] - http://pastie.org/746050 -- James Aimonetti mobile: 314.809.6307 work: 540.459.2220 email: james.aimonetti@REDACTED website: http://jamesaimonetti.com From cerieljacobs@REDACTED Wed Dec 16 20:38:47 2009 From: cerieljacobs@REDACTED (Ceriel Jacobs) Date: Wed, 16 Dec 2009 20:38:47 +0100 Subject: [erlang-questions] OTP13B03 failed to make parallel on OS X 10.6 in 64-bit: ld: duplicate symbol _debug in debuglog.o and esock.o In-Reply-To: <4B29231F.1040005@erix.ericsson.se> References: <8A2C91DE-993C-43BA-BB87-646D4387A3AD@gmail.com> <4B28B07D.4010309@erix.ericsson.se> <49C29A7F-6281-4F46-863B-F39CAF7AB6C4@gmail.com> <4B290471.5090005@erix.ericsson.se> <4B29231F.1040005@erix.ericsson.se> Message-ID: <283187F2-F2CC-4F6A-8A71-5F5443C95E9D@gmail.com> The next error message is: gcc -m64 -fast -arch x86_64 -march=nocona -mtune=generic -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -I/Users/ceriel/src/otp_src_R13B03/erts/i686-apple-darwin10 -no-cpp-precomp -o ../priv/bin/i686-apple-darwin10/ssl_esock ../priv/obj/i686-apple-darwin10/esock.o ../priv/obj/i686-apple-darwin10/debuglog.o ../priv/obj/i686-apple-darwin10/esock_poll.o ../priv/obj/i686-apple-darwin10/esock_osio.o ../priv/obj/i686-apple-darwin10/esock_utils.o ../priv/obj/i686-apple-darwin10/esock_posix_str.o ../priv/obj/i686-apple-darwin10/esock_openssl.o -lutil -ldl -lm -L/opt/local/lib -lssl -lcrypto ld: duplicate symbol _debug in ../priv/obj/i686-apple-darwin10/debuglog.o and ../priv/obj/i686-apple-darwin10/esock.o collect2: ld returned 1 exit status make[4]: *** [../priv/bin/i686-apple-darwin10/ssl_esock] Error 1 make[3]: *** [opt] Error 2 make[2]: *** [opt] Error 2 make[1]: *** [opt] Error 2 make: *** [libs] Error 2 ~Ceriel Op 16 dec 2009, om 19:12 heeft Bj?rn-Egil Dahlberg het volgende geschreven: > >> Seems your linker is less forgiving with duplicate definitions of global variables. How many more are we going to find... From cerieljacobs@REDACTED Wed Dec 16 21:39:07 2009 From: cerieljacobs@REDACTED (Ceriel Jacobs) Date: Wed, 16 Dec 2009 21:39:07 +0100 Subject: Why is the compiler optimization CFLAG -O2 enforced for epmd, epmd_cli, epmd_srv, esock, debuglog, esock_poll, esock_osio, esock_utils, esock_posix_str, esock_openssl Message-ID: <9D73C4F5-FA81-49A6-809A-93699EA8C319@gmail.com> My preference is to set compiler optimization flag -fast (on Mac OS X GCC 4.2.1). Why are there in the erlang build 10 compiler lines where the compiler optimization flag -O2 is enforced? 1. epmd.c 2. epmd_cli.c 3. epmd_srv.c 4. esock.c 5. debuglog.c 6. esock_poll.c 7. esock_osio.c 8. esock_utils.c 9. esock_posix_str.c 10. esock_openssl.c How/why can the user (best) (not) (try to) override this -O2 with a flag of own choice? ~Ceriel From illo@REDACTED Wed Dec 16 22:05:05 2009 From: illo@REDACTED (Illo de Illis) Date: Wed, 16 Dec 2009 22:05:05 +0100 Subject: [erlang-questions] OTP13B03 failed to make parallel on OS X 10.6 in 64-bit: ld: duplicate symbol _debug in debuglog.o and esock.o In-Reply-To: <283187F2-F2CC-4F6A-8A71-5F5443C95E9D@gmail.com> References: <8A2C91DE-993C-43BA-BB87-646D4387A3AD@gmail.com> <4B28B07D.4010309@erix.ericsson.se> <49C29A7F-6281-4F46-863B-F39CAF7AB6C4@gmail.com> <4B290471.5090005@erix.ericsson.se> <4B29231F.1040005@erix.ericsson.se> <283187F2-F2CC-4F6A-8A71-5F5443C95E9D@gmail.com> Message-ID: <64073E5D-62C8-49D7-9959-A827A5D5D55A@totalwire.it> On Dec 16, 2009, at 8:38 PM, Ceriel Jacobs wrote: > The next error message is: > > gcc -m64 -fast -arch x86_64 -march=nocona -mtune=generic -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -I/Users/ceriel/src/otp_src_R13B03/erts/i686-apple-darwin10 -no-cpp-precomp -o ../priv/bin/i686-apple-darwin10/ssl_esock ../priv/obj/i686-apple-darwin10/esock.o ../priv/obj/i686-apple-darwin10/debuglog.o ../priv/obj/i686-apple-darwin10/esock_poll.o ../priv/obj/i686-apple-darwin10/esock_osio.o ../priv/obj/i686-apple-darwin10/esock_utils.o ../priv/obj/i686-apple-darwin10/esock_posix_str.o ../priv/obj/i686-apple-darwin10/esock_openssl.o -lutil -ldl -lm -L/opt/local/lib -lssl -lcrypto > ld: duplicate symbol _debug in ../priv/obj/i686-apple-darwin10/debuglog.o and ../priv/obj/i686-apple-darwin10/esock.o > collect2: ld returned 1 exit status > make[4]: *** [../priv/bin/i686-apple-darwin10/ssl_esock] Error 1 > make[3]: *** [opt] Error 2 > make[2]: *** [opt] Error 2 > make[1]: *** [opt] Error 2 > make: *** [libs] Error 2 Try and edit files lib/ssl/c_src/debuglog.h and lib/ssl/esock_ssl.h and prepend an 'extern' to every definition in order to change them to declarations. Ciao, Illo. From illo@REDACTED Wed Dec 16 22:08:12 2009 From: illo@REDACTED (Illo de Illis) Date: Wed, 16 Dec 2009 22:08:12 +0100 Subject: [erlang-questions] OTP13B03 failed to make parallel on OS X 10.6 in 64-bit: ld: duplicate symbol _debug in debuglog.o and esock.o In-Reply-To: <64073E5D-62C8-49D7-9959-A827A5D5D55A@totalwire.it> References: <8A2C91DE-993C-43BA-BB87-646D4387A3AD@gmail.com> <4B28B07D.4010309@erix.ericsson.se> <49C29A7F-6281-4F46-863B-F39CAF7AB6C4@gmail.com> <4B290471.5090005@erix.ericsson.se> <4B29231F.1040005@erix.ericsson.se> <283187F2-F2CC-4F6A-8A71-5F5443C95E9D@gmail.com> <64073E5D-62C8-49D7-9959-A827A5D5D55A@totalwire.it> Message-ID: On Dec 16, 2009, at 10:05 PM, Illo de Illis wrote: > On Dec 16, 2009, at 8:38 PM, Ceriel Jacobs wrote: > >> The next error message is: >> >> gcc -m64 -fast -arch x86_64 -march=nocona -mtune=generic -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -I/Users/ceriel/src/otp_src_R13B03/erts/i686-apple-darwin10 -no-cpp-precomp -o ../priv/bin/i686-apple-darwin10/ssl_esock ../priv/obj/i686-apple-darwin10/esock.o ../priv/obj/i686-apple-darwin10/debuglog.o ../priv/obj/i686-apple-darwin10/esock_poll.o ../priv/obj/i686-apple-darwin10/esock_osio.o ../priv/obj/i686-apple-darwin10/esock_utils.o ../priv/obj/i686-apple-darwin10/esock_posix_str.o ../priv/obj/i686-apple-darwin10/esock_openssl.o -lutil -ldl -lm -L/opt/local/lib -lssl -lcrypto >> ld: duplicate symbol _debug in ../priv/obj/i686-apple-darwin10/debuglog.o and ../priv/obj/i686-apple-darwin10/esock.o >> collect2: ld returned 1 exit status >> make[4]: *** [../priv/bin/i686-apple-darwin10/ssl_esock] Error 1 >> make[3]: *** [opt] Error 2 >> make[2]: *** [opt] Error 2 >> make[1]: *** [opt] Error 2 >> make: *** [libs] Error 2 > > Try and edit files lib/ssl/c_src/debuglog.h and lib/ssl/esock_ssl.h and prepend an 'extern' to every definition in order to change them to declarations. Sorry, I meant lib/ssl/c_src/esock_ssl.h Ciao, Illo. From clist@REDACTED Wed Dec 16 23:29:43 2009 From: clist@REDACTED (Angel Alvarez) Date: Wed, 16 Dec 2009 23:29:43 +0100 Subject: [erlang-questions] Generating Primes and the O'Neill paper In-Reply-To: <4B293063.7010500@gmail.com> References: <4B293063.7010500@gmail.com> Message-ID: <200912162329.43844.clist@uah.es> El Mi?rcoles, 16 de Diciembre de 2009 James Aimonetti escribi?: > I have been working the Project Euler problems and wanted to see what > the list thought about my implementation of a prime number generator > that is based off the Melissa O'Neill paper[1]. I also used a lazy list > idea from one of Joe Armstrong's suggestions[2] concerning a Euler > problem. My implementation uses the priority queue (page 7 of the PDF), > and I'm using a skew heap I found[3] on this list to accomplish that, > which I modified to handle key-value pairs instead of just keys. > > I made a pastie[4] to view the code. > > I tried to stay true to the Haskell version in the paper but had to > modify some parts. I don't know Haskell so I easily could have lost > something in the translation. > > Oh, the function is called queue because I was playing with other > methods, like the unfaithful sieve, but I've only included the queue/1 > in the pastie. I am going to try the wheel and other optimizations > talked about in the paper, but wanted a sanity check from the gurus that > my Erlang is decent and the implementation isn't totally bunk. > > Thanks in advance for any advice or corrections. > > [1] - http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf > [2] - http://www.erlang.org/cgi-bin/ezmlm-cgi?4:mss:177:khdaceipfabbicmifdhf > [3] - > http://www.erlang.org/pipermail/erlang-questions/2007-August/028769.html > [4] - http://pastie.org/746050 > Hi this paper is very interesting, but being novice icant hardly say you something about your code. Maybe you can check mine for a multiprocess approach. Ive include my try on this "genuine" erathostenes sieve. every worker stores one prime and properly crosses off on the fly when the numbers are testet. Its a kind of lazy as it creates new worker in demand... With my code you can do a naive exercise: sinosuke@REDACTED:~/Documents/Personal/Erlang/Code/primality> erlc multi_erathostenes.erl sinosuke@REDACTED:~/Documents/Personal/Erlang/Code/primality> erl Erlang R13B01 (erts-5.7.2) [source] [rq:1] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.7.2 (abort with ^G) 1> OnePID=spawn(multi_erathostenes,worker,[2,4]). <0.35.0> 2> [ OnePID ! {test,X} || X <- [3,4,5,6,7,8,9,10,11]]. [Worker of prime: 2 (4)] Spawn new worker for Prime: 3 [Worker of prime: 2 (4)] Found composite: 4 [Worker of prime: 2 (6)] passing along: 5 [Worker of prime: 2 (6)] Found composite: 6 [Worker of prime: 3 (9)] Spawn new worker for Prime: 5 [Worker of prime: 2 (8)] passing along: 7 [Worker of prime: 2 (8)] Found composite: 8 [Worker of prime: 3 (9)] passing along: 7 [Worker of prime: 2 (10)] passing along: 9 [Worker of prime: 5 (25)] Spawn new worker for Prime: 7 [Worker of prime: 2 (10)] Found composite: 10 [Worker of prime: 3 (9)] Found composite: 9 [Worker of prime: 2 (12)] passing along: 11 [Worker of prime: 3 (12)] passing along: 11 [Worker of prime: 5 (25)] passing along: 11 [Worker of prime: 7 (49)] Spawn new worker for Prime: 11 /Angel -- Agua para todo? No, Agua para Todos. ->>----------------------------------------------- Clist UAH a.k.a Angel ---------------------------------[www.uah.es]-<<-- -------------- next part -------------- % Multi "Genuine" Erathostenes % 02 03 05 07 11 13 17 % P 02 -> 04 % P 03 04 -> 09 % C 04 == 04 09 % P 05 06 09 -> 25 % C 06 == 06 09 25 % P 07 08 09 25 -> 49 % C 08 == 08 09 25 49 % C 09 10 == 09 25 49 % C 10 == 10 12 25 49 % P 11 12 12 25 49 -> 121 % C 12 == 12 == 12 25 49 121 % P 13 14 15 25 49 121 -> 169 % C 14 == 14 15 25 49 121 169 % C 15 16 == 15 25 49 121 169 % C 16 == 16 18 25 49 121 169 % P 17 18 18 25 49 121 169 -> 289 -module(multi_erathostenes). -compile(export_all). worker(Prime,UpperBound)-> receive {test,Number} -> case Number == UpperBound of true -> io:format("[Worker of prime: ~w (~w)] Found composite: ~w~n",[Prime,UpperBound,Number]), worker(Prime,UpperBound + Prime); false -> io:format("[Worker of prime: ~w (~w)] Spawn new worker for Prime: ~w~n",[Prime,UpperBound,Number]), NextPID =spawn(?MODULE,worker,[Number,Number*Number]), worker(Prime,UpperBound,NextPID) end end. worker(Prime,UpperBound,NextPID) -> receive {test,Number} -> case Number == UpperBound of true -> io:format("[Worker of prime: ~w (~w)] Found composite: ~w~n",[Prime,UpperBound,Number]), worker(Prime,UpperBound + Prime,NextPID); false -> io:format("[Worker of prime: ~w (~w)] passing along: ~w~n",[Prime,UpperBound,Number]), NextPID ! {test,Number}, worker(Prime,UpperBound,NextPID) end end. % main(LimiteSuperior) -> % FirstWorkerPID = spawn(?MODULE, worker,[2,4]), % PID_Generador = spawn(?MODULE, generador_inicial, [LimiteSuperior,self()]), % PID_Worker = pool:pspawn(?MODULE, worker,[1,PID_Acumulador,?MAXPRIMES,[] ]), % T1 = erlang:now(), % Alimentador_PID = spawn(?MODULE, alimentador,[PID_Generador,PID_Worker]), % PID_Generador ! done, % receive % {primes,Numero,Lista} -> % io:format("[Main] Parando proceso [Acumulador]!~n"), % PID_Acumulador ! done % end, % Total = lists:foldl( fun(X,Acc) -> Acc + X end,0,Lista), % T2 = erlang:now(), % T = timer:now_diff(T2,T1), % io:format("[Main] Calcular la suma de los ~w primos hasta ~w : ~w ~n ha tomado ~w microsegundos~n",[Numero,LimiteSuperior,Total,T]). From clist@REDACTED Thu Dec 17 00:03:52 2009 From: clist@REDACTED (Angel Alvarez) Date: Thu, 17 Dec 2009 00:03:52 +0100 Subject: [erlang-questions] Generating Primes and the O'Neill paper In-Reply-To: <200912162329.43844.clist@uah.es> References: <4B293063.7010500@gmail.com> <200912162329.43844.clist@uah.es> Message-ID: <200912170003.52195.clist@uah.es> Opps !! 15 is not prime is'nt it? Ive include an improved version... compare(X,Y) -> case X == Y of true -> equal; false -> case X > Y of true -> greater; false -> smaller end end. is there a better way of writing this test? /Angel El Mi?rcoles, 16 de Diciembre de 2009 Angel Alvarez escribi?: > El Mi?rcoles, 16 de Diciembre de 2009 James Aimonetti escribi?: > > I have been working the Project Euler problems and wanted to see what > > the list thought about my implementation of a prime number generator > > that is based off the Melissa O'Neill paper[1]. I also used a lazy list > > idea from one of Joe Armstrong's suggestions[2] concerning a Euler > > problem. My implementation uses the priority queue (page 7 of the PDF), > > and I'm using a skew heap I found[3] on this list to accomplish that, > > which I modified to handle key-value pairs instead of just keys. > > > > I made a pastie[4] to view the code. > > > > I tried to stay true to the Haskell version in the paper but had to > > modify some parts. I don't know Haskell so I easily could have lost > > something in the translation. > > > > Oh, the function is called queue because I was playing with other > > methods, like the unfaithful sieve, but I've only included the queue/1 > > in the pastie. I am going to try the wheel and other optimizations > > talked about in the paper, but wanted a sanity check from the gurus that > > my Erlang is decent and the implementation isn't totally bunk. > > > > Thanks in advance for any advice or corrections. > > > > [1] - http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf > > [2] - http://www.erlang.org/cgi-bin/ezmlm-cgi?4:mss:177:khdaceipfabbicmifdhf > > [3] - > > http://www.erlang.org/pipermail/erlang-questions/2007-August/028769.html > > [4] - http://pastie.org/746050 > > > Hi this paper is very interesting, but being novice icant hardly say you > something about your code. Maybe you can check mine for a > multiprocess approach. > > Ive include my try on this "genuine" erathostenes sieve. > > every worker stores one prime and properly crosses off on the fly when the numbers > are testet. Its a kind of lazy as it creates new worker in demand... > > With my code you can do a naive exercise: > > sinosuke@REDACTED:~/Documents/Personal/Erlang/Code/primality> erlc multi_erathostenes.erl > sinosuke@REDACTED:~/Documents/Personal/Erlang/Code/primality> erl > Erlang R13B01 (erts-5.7.2) [source] [rq:1] [async-threads:0] [hipe] [kernel-poll:false] > > Eshell V5.7.2 (abort with ^G) > > 1> OnePID=spawn(multi_erathostenes,worker,[2,4]). > <0.35.0> > 2> [ OnePID ! {test,X} || X <- [3,4,5,6,7,8,9,10,11]]. > > [Worker of prime: 2 (4)] Spawn new worker for Prime: 3 > [Worker of prime: 2 (4)] Found composite: 4 > [Worker of prime: 2 (6)] passing along: 5 > [Worker of prime: 2 (6)] Found composite: 6 > [Worker of prime: 3 (9)] Spawn new worker for Prime: 5 > [Worker of prime: 2 (8)] passing along: 7 > [Worker of prime: 2 (8)] Found composite: 8 > [Worker of prime: 3 (9)] passing along: 7 > [Worker of prime: 2 (10)] passing along: 9 > [Worker of prime: 5 (25)] Spawn new worker for Prime: 7 > [Worker of prime: 2 (10)] Found composite: 10 > [Worker of prime: 3 (9)] Found composite: 9 > [Worker of prime: 2 (12)] passing along: 11 > [Worker of prime: 3 (12)] passing along: 11 > [Worker of prime: 5 (25)] passing along: 11 > [Worker of prime: 7 (49)] Spawn new worker for Prime: 11 > > > /Angel -- No imprima este correo si no es necesario. El medio ambiente est? en nuestras manos. ->>----------------------------------------------- Clist UAH a.k.a Angel ---------------------------------[www.uah.es]-<<-- T? lo compras, yo lo copio. Todo legal. -------------- next part -------------- % Multi "Genuine" Erathostenes % 02 03 05 07 11 13 17 % P 02 -> 04 % P 03 04 -> 09 % C 04 == 04 09 % P 05 06 09 -> 25 % C 06 == 06 09 25 % P 07 08 09 25 -> 49 % C 08 == 08 09 25 49 % C 09 10 == 09 25 49 % C 10 == 10 12 25 49 % P 11 12 12 25 49 -> 121 % C 12 == 12 12 25 49 121 % P 13 14 15 25 49 121 -> 169 % C 14 == 14 15 25 49 121 169 % C 15 16 == 15 25 49 121 169 % C 16 == 16 18 25 49 121 169 % P 17 18 18 25 49 121 169 -> 289 -module(multi_erathostenes). -compile(export_all). compare(X,Y) -> case X == Y of true -> equal; false -> case X > Y of true -> greater; false -> smaller end end. worker(Prime,UpperBound)-> receive {test,Number} -> case compare(Number,UpperBound) of equal -> io:format("[Worker of prime: ~w (~w)] Found composite: ~w~n",[Prime,UpperBound,Number]), worker(Prime,UpperBound + Prime); smaller -> io:format("[Worker of prime: ~w (~w)] Spawn new worker for Prime: ~w~n",[Prime,UpperBound,Number]), NextPID =spawn(?MODULE,worker,[Number,Number*Number]), worker(Prime,UpperBound,NextPID) end end. worker(Prime,UpperBound,NextPID) -> receive {test,Number} -> case compare(Number,UpperBound) of equal -> io:format("[Worker of prime: ~w (~w)] Found composite: ~w~n",[Prime,UpperBound,Number]), worker(Prime,UpperBound + Prime,NextPID); smaller -> io:format("[Worker of prime: ~w (~w)] passing along: ~w~n",[Prime,UpperBound,Number]), NextPID ! {test,Number}, worker(Prime,UpperBound,NextPID); greater -> io:format("[Worker of prime: ~w (~w)] passing along: ~w~n",[Prime,UpperBound,Number]), NextPID ! {test,Number}, worker(Prime,UpperBound+Prime,NextPID) end end. % main(LimiteSuperior) -> % FirstWorkerPID = spawn(?MODULE, worker,[2,4]), % PID_Generador = spawn(?MODULE, generador_inicial, [LimiteSuperior,self()]), % PID_Worker = pool:pspawn(?MODULE, worker,[1,PID_Acumulador,?MAXPRIMES,[] ]), % T1 = erlang:now(), % Alimentador_PID = spawn(?MODULE, alimentador,[PID_Generador,PID_Worker]), % PID_Generador ! done, % receive % {primes,Numero,Lista} -> % io:format("[Main] Parando proceso [Acumulador]!~n"), % PID_Acumulador ! done % end, % Total = lists:foldl( fun(X,Acc) -> Acc + X end,0,Lista), % T2 = erlang:now(), % T = timer:now_diff(T2,T1), % io:format("[Main] Calcular la suma de los ~w primos hasta ~w : ~w ~n ha tomado ~w microsegundos~n",[Numero,LimiteSuperior,Total,T]). From roberto@REDACTED Thu Dec 17 00:10:51 2009 From: roberto@REDACTED (Roberto Ostinelli) Date: Thu, 17 Dec 2009 00:10:51 +0100 Subject: [erlang-questions] Generating Primes and the O'Neill paper In-Reply-To: <200912170003.52195.clist@uah.es> References: <4B293063.7010500@gmail.com> <200912162329.43844.clist@uah.es> <200912170003.52195.clist@uah.es> Message-ID: > > compare(X,Y) -> > ? ? ? ?case X == Y of > ? ? ? ? ? ? ? ?true -> > ? ? ? ? ? ? ? ? ? ? ? ?equal; > ? ? ? ? ? ? ? ?false -> > ? ? ? ? ? ? ? ? ? ? ? ?case X > Y of > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?true -> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?greater; > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?false -> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?smaller > ? ? ? ? ? ? ? ? ? ? ? ?end > ? ? ? ?end. > > is there a better way of writing this test? why not simply: compare(X,Y) when X > Y -> greater; compare(X,Y) when X < Y -> smaller; compare(X,Y) -> equal. r. From clist@REDACTED Thu Dec 17 00:32:06 2009 From: clist@REDACTED (Angel Alvarez) Date: Thu, 17 Dec 2009 00:32:06 +0100 Subject: [erlang-questions] Generating Primes and the O'Neill paper In-Reply-To: References: <4B293063.7010500@gmail.com> <200912170015.08379.clist@uah.es> Message-ID: <200912170032.06458.clist@uah.es> ive changed the code to use your last assertion. Im blindly running the code up to 1000000 just for fun but the top output seems confusing for me. beam process has 16m on the SWAP column but overall swap usage is only 96k, so whats really SWAP means? top - 00:23:27 up 7:18, 7 users, load average: 1.11, 0.77, 0.46 Tasks: 188 total, 3 running, 185 sleeping, 0 stopped, 0 zombie Cpu0 : 15.1%us, 1.6%sy, 0.1%ni, 80.9%id, 2.0%wa, 0.1%hi, 0.2%si, 0.0%st Mem: 1026752k total, 915292k used, 111460k free, 55128k buffers Swap: 2104504k total, 96k used, 2104408k free, 409480k cached PID USER PR NI VIRT RES SHR CODE DATA S SWAP %CPU %MEM TIME+ TIME COMMAND 30829 sinosuke 25 0 58352 40m 1968 1488 53m R 16m 97.0 4.1 4:29.41 4:29 beam 30883 root 15 0 2316 1156 840 84 472 R 1160 0.7 0.1 0:03.11 0:03 top /angel El Jueves, 17 de Diciembre de 2009 Roberto Ostinelli escribi?: > >> why not simply: > >> > >> compare(X,Y) when X > Y -> greater; > >> compare(X,Y) when X < Y -> smaller; > >> compare(X,Y) -> equal. > > > > > > Thanks!! ?I forget it was erlang!! > > > > > > the last one can be > > compare(X,X) -> equal.? > > sure. > > though, if you are optimizing, i suspect compare(X,Y) might have one > matching call less to go [since it's a generic fallback], so probably > the fastest version would be something like > > compare(X,Y) when X > Y -> greater; > compare(X,Y) when X < Y -> smaller; > compare(_, _) -> equal. > > r. > -- Agua para todo? No, Agua para Todos. ->>----------------------------------------------- Clist UAH a.k.a Angel ---------------------------------[www.uah.es]-<<-- Hoy no has conseguido la iluminaci?n divina. No importa ma??na ser? otro d?a... From kenji.rikitake@REDACTED Thu Dec 17 03:06:06 2009 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Thu, 17 Dec 2009 11:06:06 +0900 Subject: Binary list pattern maching direction? Message-ID: <20091217020606.GA33868@k2r.org> I've been using the following Erlang binary list matching pattern for quite a while. Actually, this piece of code below as a shell command sequence is originally from ssh_sftpd.erl in the ssh module of R13B02 (and maybe later). My question: * The variables on the left-hand side of the matching operator (=) match from left to right. Is this guaranteed or documented anywhere in Erlang reference manual(s)? Answers or references appreciated. -- begin -- 2> <> = <<0,0,0,5,10,11,12,13,14,15,16,17>>. <<0,0,0,5,10,11,12,13,14,15,16,17>> 3> Len. 5 4> Msg. <<10,11,12,13,14>> 5> Rest. <<15,16,17>> -- end -- Kenji Rikitake From dave@REDACTED Thu Dec 17 03:38:47 2009 From: dave@REDACTED (Dave Peticolas) Date: Wed, 16 Dec 2009 18:38:47 -0800 Subject: [erlang-questions] erlang emacs mode question In-Reply-To: <93df43b60912152330v1f2fe07erdc4bfc416217b1a6@mail.gmail.com> References: <4B26698F.4000208@mobilearts.com> <93df43b60912150032r537d1262u4efc8aa4546d11c4@mail.gmail.com> <77C1226CCC2F7C41B022662F4775DABC57005CBAC4@EGEXCMB01.oww.root.lcl> <4B284BD7.1080403@krondo.com> <93df43b60912152330v1f2fe07erdc4bfc416217b1a6@mail.gmail.com> Message-ID: <4B2999B7.2090900@krondo.com> Will do. I'll take a look and see what else might be moved into the main mode and send you some patches. Dan Gudmundsson wrote: > My plan was to fix the bugs that I could, and depend on the community > to add new cool stuff and fix the hard parts that I can't. > > So please send patches/improvements and I promise to be more active > and give them some love. > > /Dan > > On Wed, Dec 16, 2009 at 3:54 AM, Dave Peticolas wrote: >> I'm glad the default mode is now getting some love. Going forward, >> I think it would be best to combine efforts and avoid a separate >> fork if possible, it's just easier for everyone that way. It sounds >> like the main remaining difference is the skeletons? Is there any >> plan to roll the erlware skeletons into the main version? And did >> you also incorporate flymake support? That's really quite handy. >> >> thanks, >> dave >> >> >> Logan, Martin wrote: >>> :-) Well I am glad that the regular mode benefited from it. The thanks >>> for the Erlware mode really goes out to Dave Peticolas who owns it and >>> maintains it quite well. He has added quite a lot of new support for things >>> like flymake and a bunch of other cool stuff which does not spring to mind >>> right now. >>> Perhaps there is a way we can collaborate more actively now with Erlang up >>> on github as you say. >>> >>> Cheers, >>> Martin >>> >>> P.S I will take that "owe me one" in the form of a beer next year at EUC >>> ;-) >>> -----Original Message----- >>> From: Dan Gudmundsson [mailto:dangud@REDACTED] Sent: Tuesday, December >>> 15, 2009 2:32 AM >>> To: Logan, Martin >>> Cc: erlang-questions@REDACTED >>> Subject: Re: [erlang-questions] erlang emacs mode question >>> >>> Hi Martin >>> >>> I guess you haven't tested the new erlang mode either :-) >>> or have you incorporated the fixes we have done? >>> >>> I used the erlware version myself before Kenneth hit me hard and told >>> me to fix our version and apply the patches we had received. >>> >>> The one thing I miss is the edoc skeltons which you have and that you >>> broke >>> out the skeletons to a separate file. >>> I don't use distel either so maybe your variant works better with that. >>> >>> But I have "stolen" some of the fixes you had and done many more and added >>> several large patches from Anders Dahlin and Tomas Abrahamsson into >>> which I think >>> is a better version. >>> >>> Hopefully now with erlang on github we can join our efforts again, so >>> that we can >>> get the best of the two things. I know that our support of the emacs >>> mode havn't been >>> the best and when time is tight the emacs mode get down prioritized. >>> It will probably happen again but now with erlang on github available >>> it should be easier to >>> apply the improvements the community makes. >>> >>> Cheers (I think I owe you one) >>> /Dan >>> >>> On Mon, Dec 14, 2009 at 11:28 PM, Logan, Martin >>> wrote: >>>> BTW, the erlware erlang mode "erlware-mode" is much better than the >>>> erlang >>>> mode. Many bugs have been fixed and the skeletons are all edoc'd. It >>>> has >>>> been well maintained for over 2 years and is now way ahead IMHO. You can >>>> find it at erlware.org or over at the google code site >>>> code.google.com/p/erlware-mode >>>> >>>> Cheers, >>>> Martin >>>> >>>> >>>> On 12/14/09 10:36 AM, "G?ran B?ge" wrote: >>>> >>>> Thanks Dan, >>>> >>>> Yes it worked in R13B03, adding '%% ' and removing '%% '. Just my kind >>>> of timing bringing it up just when it was fixed, it's been bugging me for >>>> quite some time before I got around to asking:-). We are very slow >>>> moving to new releases as we have long lived products running out there, >>>> we still have some R9 based ones and I've not run R13 before, just >>>> installed >>>> it as a matter of fact. >>>> >>>> Cheers >>>> --G?ran >>>> >>>> Dan Gudmundsson wrote: >>>>> On Mon, Dec 14, 2009 at 4:56 PM, G?ran B?ge >>>>> wrote: >>>>>> Hi, >>>>>> >>>>>> Is there a reason why the erlang emacs mode treats comment (^C^C) and >>>>>> un-comment >>>>>> (^C^U) asymmetrical, comment adds '%% ' and uncomment removes '%'. >>>>>> Pretty >>>>>> annoying if you ask me (but who would even think of doing that :-). It >>>>>> used >>>>>> to work by adding only '%' earlier (maybe very much earlier like in R9 >>>>>> or >>>>>> so). >>>>> Have you tried the latest erlang mode, on github or in R13B03? >>>>> >>>>> Both ^U^C^C and ^C^U works for me. >>>>> >>>>> /Dan >>>>> PS: There are a lot of changes in the latest release of the erlang emacs >>>>> mode, >>>>> so if we broke something please report or even better post a >>>>> patch. >>>> -- >>>> -- Goran >>>> --------------------- May the Snow be with you -------- >>>> Goran Bage MobileArts www.mobilearts.se >>>> Tjarhovsgatan 56 SE-116 28 STOCKHOLM Sweden >>>> goran.bage@REDACTED phone: +46 733 358405 >>>> >>>> ________________________________________________________________ >>>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>>> erlang-questions (at) erlang.org >>>> >>>> >>>> >> > From cerieljacobs@REDACTED Thu Dec 17 05:12:11 2009 From: cerieljacobs@REDACTED (Ceriel Jacobs) Date: Thu, 17 Dec 2009 05:12:11 +0100 Subject: [erlang-questions] OTP13B03 failed to make parallel on OS X 10.6 in 64-bit: ld: duplicate symbol _debug in debuglog.o and esock.o In-Reply-To: <64073E5D-62C8-49D7-9959-A827A5D5D55A@totalwire.it> References: <8A2C91DE-993C-43BA-BB87-646D4387A3AD@gmail.com> <4B28B07D.4010309@erix.ericsson.se> <49C29A7F-6281-4F46-863B-F39CAF7AB6C4@gmail.com> <4B290471.5090005@erix.ericsson.se> <4B29231F.1040005@erix.ericsson.se> <283187F2-F2CC-4F6A-8A71-5F5443C95E9D@gmail.com> <64073E5D-62C8-49D7-9959-A827A5D5D55A@totalwire.it> Message-ID: <29954324-65C5-48F1-B2FF-B8C799C136C0@gmail.com> That doesn't sound like a good idea to me: 1. I am not a C programmer, I don't know what a definition in C is; in other words I don't know what I am editing in such a header file 2. With me editing in my local files, will bring back these errors every new release On 16 dec 2009, at 22:05 Illo de Illis wrote: > Try and edit files lib/ssl/c_src/debuglog.h and lib/ssl/esock_ssl.h and prepend an 'extern' to every definition in order to change them to declarations. From litaocheng@REDACTED Thu Dec 17 09:12:21 2009 From: litaocheng@REDACTED (litao cheng) Date: Thu, 17 Dec 2009 16:12:21 +0800 Subject: distribution utility like python distutils? Message-ID: hi, all I'm an erlang programmer, usually, I use reltool to build my target system, but I feel it so complex and not stable. I hope erlang can support some tool/library like python distutils, we can distribute our module or otp application simply. erlang website can also have some subject like pypi (python package index), I think those can promote the erlang package growning. I think we need an standard mechanism for all developer. best regards litao cheng From sverker@REDACTED Thu Dec 17 10:57:06 2009 From: sverker@REDACTED (Sverker Eriksson) Date: Thu, 17 Dec 2009 10:57:06 +0100 Subject: [erlang-questions] OTP13B03 failed to make parallel on OS X 10.6 in 64-bit: ld: duplicate symbol _debug in debuglog.o and esock.o In-Reply-To: <283187F2-F2CC-4F6A-8A71-5F5443C95E9D@gmail.com> References: <8A2C91DE-993C-43BA-BB87-646D4387A3AD@gmail.com> <4B28B07D.4010309@erix.ericsson.se> <49C29A7F-6281-4F46-863B-F39CAF7AB6C4@gmail.com> <4B290471.5090005@erix.ericsson.se> <4B29231F.1040005@erix.ericsson.se> <283187F2-F2CC-4F6A-8A71-5F5443C95E9D@gmail.com> Message-ID: <4B2A0072.70607@erix.ericsson.se> Ceriel Jacobs wrote: > The next error message is: > > gcc -m64 -fast -arch x86_64 -march=nocona -mtune=generic -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -I/Users/ceriel/src/otp_src_R13B03/erts/i686-apple-darwin10 -no-cpp-precomp -o ../priv/bin/i686-apple-darwin10/ssl_esock ../priv/obj/i686-apple-darwin10/esock.o ../priv/obj/i686-apple-darwin10/debuglog.o ../priv/obj/i686-apple-darwin10/esock_poll.o ../priv/obj/i686-apple-darwin10/esock_osio.o ../priv/obj/i686-apple-darwin10/esock_utils.o ../priv/obj/i686-apple-darwin10/esock_posix_str.o ../priv/obj/i686-apple-darwin10/esock_openssl.o -lutil -ldl -lm -L/opt/local/lib -lssl -lcrypto > ld: duplicate symbol _debug Just add "extern " at these places (and we will add them for next release): lib/ssl/c_src/debuglog.h: 37,40c37,40 < int debug; < int debugmsg; < FILE *ssllogfp; < FILE *__locallogfp; --- > extern int debug; > extern int debugmsg; > extern FILE *ssllogfp; > extern FILE *__locallogfp; lib/ssl/c_src/esock_ssl.h: 37c37 < char *esock_ssl_errstr; --- > extern char *esock_ssl_errstr; 40c40 < int ephemeral_rsa, ephemeral_dh; --- > extern int ephemeral_rsa, ephemeral_dh; 43c43 < int protocol_version; --- > extern int protocol_version; /Sverker, Erlang/OTP Ericsson From erlang@REDACTED Thu Dec 17 11:07:37 2009 From: erlang@REDACTED (Illo de' Illis) Date: Thu, 17 Dec 2009 11:07:37 +0100 Subject: [erlang-questions] OTP13B03 failed to make parallel on OS X 10.6 in 64-bit: ld: duplicate symbol _debug in debuglog.o and esock.o In-Reply-To: <29954324-65C5-48F1-B2FF-B8C799C136C0@gmail.com> References: <8A2C91DE-993C-43BA-BB87-646D4387A3AD@gmail.com> <4B28B07D.4010309@erix.ericsson.se> <49C29A7F-6281-4F46-863B-F39CAF7AB6C4@gmail.com> <4B290471.5090005@erix.ericsson.se> <4B29231F.1040005@erix.ericsson.se> <283187F2-F2CC-4F6A-8A71-5F5443C95E9D@gmail.com> <64073E5D-62C8-49D7-9959-A827A5D5D55A@totalwire.it> <29954324-65C5-48F1-B2FF-B8C799C136C0@gmail.com> Message-ID: On Dec 17, 2009, at 5:12 AM, Ceriel Jacobs wrote: > On 16 dec 2009, at 22:05 Illo de Illis wrote: >> Try and edit files lib/ssl/c_src/debuglog.h and lib/ssl/esock_ssl.h and prepend an 'extern' to every definition in order to change them to declarations. > That doesn't sound like a good idea to me: > 1. I am not a C programmer, I don't know what a definition in C is; in other words I don't know what I am editing in such a header file > 2. With me editing in my local files, will bring back these errors every new release Looks like erlang developers are in the process of cleaning up the duplicate symbols for the next release, so I guess you won't have to do it again in R13B04. I've attached a patch file that does the job. Ciao, Illo. -------------- next part -------------- A non-text attachment was scrubbed... Name: patch Type: application/octet-stream Size: 5291 bytes Desc: not available URL: From mikpe@REDACTED Thu Dec 17 11:39:54 2009 From: mikpe@REDACTED (Mikael Pettersson) Date: Thu, 17 Dec 2009 11:39:54 +0100 Subject: [erlang-questions] OTP13B03 failed to make parallel on OS X 10.6 in 64-bit: ld: duplicate symbol _debug in debuglog.o and esock.o In-Reply-To: References: <8A2C91DE-993C-43BA-BB87-646D4387A3AD@gmail.com> <4B28B07D.4010309@erix.ericsson.se> <49C29A7F-6281-4F46-863B-F39CAF7AB6C4@gmail.com> <4B290471.5090005@erix.ericsson.se> <4B29231F.1040005@erix.ericsson.se> <283187F2-F2CC-4F6A-8A71-5F5443C95E9D@gmail.com> <64073E5D-62C8-49D7-9959-A827A5D5D55A@totalwire.it> <29954324-65C5-48F1-B2FF-B8C799C136C0@gmail.com> Message-ID: <19242.2682.739660.179394@pilspetsen.it.uu.se> Illo de' Illis writes: > On Dec 17, 2009, at 5:12 AM, Ceriel Jacobs wrote: > > On 16 dec 2009, at 22:05 Illo de Illis wrote: > >> Try and edit files lib/ssl/c_src/debuglog.h and lib/ssl/esock_ssl.h and prepend an 'extern' to every definition in order to change them to declarations. > > That doesn't sound like a good idea to me: > > 1. I am not a C programmer, I don't know what a definition in C is; in other words I don't know what I am editing in such a header file > > 2. With me editing in my local files, will bring back these errors every new release > > Looks like erlang developers are in the process of cleaning up the duplicate symbols for the next release, so I guess you won't have to do it again in R13B04. > I've attached a patch file that does the job. > > Ciao, > Illo. > > diff --git erts/emulator/beam/global.h erts/emulator/beam/global.h > index 62a788c..87e83e3 100644 > --- erts/emulator/beam/global.h > +++ erts/emulator/beam/global.h > @@ -1658,7 +1658,7 @@ void erts_bif_trace_init(void); > /* > ** Call_trace uses this API for the parameter matching functions > */ > - struct erl_heap_fragment* saved_program_buf; > +/* struct erl_heap_fragment* saved_program_buf; */ > > #define MatchSetRef(MPSP) \ > do { \ > diff --git lib/erl_interface/src/misc/ei_internal.h lib/erl_interface/src/misc/ei_internal.h > index 9f51d1f..f7805ef 100644 > --- lib/erl_interface/src/misc/ei_internal.h > +++ lib/erl_interface/src/misc/ei_internal.h > @@ -149,7 +149,7 @@ > {if (ei_tracelevel >= 5) ei_trace_printf(NAME,1,FORMAT,ARG1,ARG2,ARG3,ARG4, \ > ARG5,ARG6,ARG7);} > > -int ei_tracelevel; > +extern int ei_tracelevel; extern in variable declarations in .h files is correct (and not having the extern there is almost always incorrect). > -void open_ssllog(char *path); > -void close_ssllog(void); > -FILE *openlog(char *); > -void closelog(FILE *); > -int __debugprintf(const char *, ...); > -int __debugprintclistf(const char *, ...); > -int __debuglogf(const char *, ...); > +extern void open_ssllog(char *path); > +extern void close_ssllog(void); > +extern FILE *openlog(char *); > +extern void closelog(FILE *); > +extern int __debugprintf(const char *, ...); > +extern int __debugprintclistf(const char *, ...); > +extern int __debuglogf(const char *, ...); extern in function declarations in .h files is not needed and just plain redundant. From erlang@REDACTED Thu Dec 17 11:54:05 2009 From: erlang@REDACTED (Illo de' Illis) Date: Thu, 17 Dec 2009 11:54:05 +0100 Subject: [erlang-questions] OTP13B03 failed to make parallel on OS X 10.6 in 64-bit: ld: duplicate symbol _debug in debuglog.o and esock.o In-Reply-To: <19242.2682.739660.179394@pilspetsen.it.uu.se> References: <8A2C91DE-993C-43BA-BB87-646D4387A3AD@gmail.com> <4B28B07D.4010309@erix.ericsson.se> <49C29A7F-6281-4F46-863B-F39CAF7AB6C4@gmail.com> <4B290471.5090005@erix.ericsson.se> <4B29231F.1040005@erix.ericsson.se> <283187F2-F2CC-4F6A-8A71-5F5443C95E9D@gmail.com> <64073E5D-62C8-49D7-9959-A827A5D5D55A@totalwire.it> <29954324-65C5-48F1-B2FF-B8C799C136C0@gmail.com> <19242.2682.739660.179394@pilspetsen.it.uu.se> Message-ID: <3C482290-B710-4EF4-B4A7-45993780BDD3@trainedmonkeys.net> On Dec 17, 2009, at 11:39 AM, Mikael Pettersson wrote: [...] > extern in function declarations in .h files is not needed > and just plain redundant. Yeah, I know, it's plain redundant but fairly descriptive, in fact I will be using /extern/ for function declarations in header files for the time being. I wasn't suggesting the erlang core team to apply my patch to the OTP source tree[1], I just run a quick git-diff of my tree and posted it for Ceriel Jacobs to compile his sources. You can safely remove the /extern/ from function declarations and repost the patch if you feel the urge to. Ciao, Illo. From phmander@REDACTED Thu Dec 17 12:05:59 2009 From: phmander@REDACTED (Peter-Henry Mander) Date: Thu, 17 Dec 2009 11:05:59 +0000 Subject: Parallel Make in OTP Message-ID: <38e3b9f40912170305h5437d21dhac263289ba60506a@mail.gmail.com> Hi Gentlepeople, There's a thread on erlang-bugs list discussing "Recursive Make Considered Harmful" [1] Which inspired me while I struggled with parallel make in our T-Build system in T-Mobile [2]. Despite the lack of activity on Code.Google.Com, I actively maintain T-Build in house. I want to put my oar in and respectfully ask not to ditch Gnu Make in OTP. It's a much maligned beast with an ugly syntax, but it's a phenomenally powerful one. Other build tools just don't cut it. Having make --jobs fail on the OTP build is an itch I yearn to scratch for a long time. There are currently 317 Makefiles in OTP, and I want to reduce it to only one, like in T-Build. Once it is updated, the single Makefile will not need further editing to accommodate new files in the build, as Make can search the whole project to resolve all dependencies. I can't get my hand dirty just yet, paid work must be done first. Pete. [1] http://miller.emu.id.au/pmiller/books/rmch/ [2] http://code.google.com/p/erlang-t-build/ From ulf.wiger@REDACTED Thu Dec 17 12:24:18 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Thu, 17 Dec 2009 12:24:18 +0100 Subject: tab completion and word killing in the shell Message-ID: <4B2A14E2.2030203@erlang-consulting.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 As a substitute for sleeping one night, I thought I'd tackle an old nuisance - that tab completion in the shell doesn't work for quoted module and function names.* I have something that works for functions now, and almost for modules (trying to change the existing code as little as possible), but the function edlin:over_word is also used for other purposes... As a consequence of my fix, when I place the cursor on a quoted atom and hit -D (kill word), the quotes are killed as well. I am willing to think of this as an improvement, but thought I'd ask the rest of you first. In other words, 1> hello:'world' If you place the cursor on the first ' and hit kill word, you end up with 1> hello:' in the unpatched version, and 1> hello: in mine. If you place the cursor on the w, and hit kill word, 1> hello:'' in the unpatched version, and 1> hello:' in mine. I assume that very few people use these features of the shell, and I have never heard any complaints, but still, does anyone have very strong feelings about how this should work? BR, Ulf W * Yeah, I know, you're not supposed to use quoted function names, but sometimes, it is done. ORBER has both quoted module names and function names. Xmerl and Yecc both use quoted function names, as does exprecs. It was for exprecs in particular that I think it's painful not to have working tab completion, since the functions are useful, but a bit awkward to write. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAksqFOIACgkQtqqFieqzed2qygCg4GusadjiBZon6nToY72jqq6i EO4AoKaOHBOhAjrFDAgL5oH/fwB9u4dv =Oiht -----END PGP SIGNATURE----- From erlang@REDACTED Thu Dec 17 12:34:12 2009 From: erlang@REDACTED (Illo de' Illis) Date: Thu, 17 Dec 2009 12:34:12 +0100 Subject: [erlang-questions] OTP13B03 failed to make parallel on OS X 10.6 in 64-bit: ld: duplicate symbol _debug in debuglog.o and esock.o In-Reply-To: <3C482290-B710-4EF4-B4A7-45993780BDD3@trainedmonkeys.net> References: <8A2C91DE-993C-43BA-BB87-646D4387A3AD@gmail.com> <4B28B07D.4010309@erix.ericsson.se> <49C29A7F-6281-4F46-863B-F39CAF7AB6C4@gmail.com> <4B290471.5090005@erix.ericsson.se> <4B29231F.1040005@erix.ericsson.se> <283187F2-F2CC-4F6A-8A71-5F5443C95E9D@gmail.com> <64073E5D-62C8-49D7-9959-A827A5D5D55A@totalwire.it> <29954324-65C5-48F1-B2FF-B8C799C136C0@gmail.com> <19242.2682.739660.179394@pilspetsen.it.uu.se> <3C482290-B710-4EF4-B4A7-45993780BDD3@trainedmonkeys.net> Message-ID: <0D5A17E7-CFEA-49B3-B10C-63BAA74DCBE5@trainedmonkeys.net> On Dec 17, 2009, at 11:54 AM, Illo de' Illis wrote: > On Dec 17, 2009, at 11:39 AM, Mikael Pettersson wrote: > [...] >> extern in function declarations in .h files is not needed >> and just plain redundant. > > Yeah, I know, it's plain redundant but fairly descriptive, in fact I will be using /extern/ for function declarations in header files for the time being. > I wasn't suggesting the erlang core team to apply my patch to the OTP source tree[1], I just run a quick git-diff of my tree and posted it for Ceriel Jacobs to compile his sources. You can safely remove the /extern/ from function declarations and repost the patch if you feel the urge to. I'm afraid my previous answer sounds a bit harsh so I'll rephrase: Actually, I always prepend /extern/ to prototypes declaration in C header files because I believe it to be consistent somehow. This time, though, it happened because I fixed the bad headers by running a quick and dirty /sed/ command with a simple substitution regex, knowing it wouldn't have done any harm by having the OTP sources coding style changed by that /extern/ for now. Ciao, Illo. From clist@REDACTED Thu Dec 17 13:26:49 2009 From: clist@REDACTED (Angel Alvarez) Date: Thu, 17 Dec 2009 13:26:49 +0100 Subject: Generating Primes and the O'Neill paper, my final version, critique welcome Message-ID: <200912171326.49760.clist@uah.es> Hi This a my final version on erlang for the O'Neill paper and the message from James Aimonetti. Ive include synchronous calls between workers to avoid filling up mailboxes. code is very barebones to keep it simple if anyone wants to see how it works :-P I hope James will find it interesting and iwll be much pleased to ear any advices from the gurus on this code. /Angel -- No imprima este correo si no es necesario. El medio ambiente est? en nuestras manos. __________________________________________ Clist UAH a.k.a Angel __________________________________________ Money is a good standard. Micro$oft. -------------- next part -------------- % "Genuine" Erathostenes sieve in erlang % based on http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf % 2009 Angel Alvarez % % Process 1 2 3 4 5 6 7 .... % % 02 03 05 07 11 13 17 % P 02 -> 04 % P 03 04 -> 09 % C 04 == 04 09 % P 05 06 09 -> 25 % C 06 == 06 09 25 % P 07 08 09 25 -> 49 % C 08 == 08 09 25 49 % C 09 10 == 09 25 49 % C 10 == 10 12 25 49 % P 11 12 12 25 49 -> 121 % C 12 == 12 12 25 49 121 % P 13 14 15 25 49 121 -> 169 % C 14 == 14 15 25 49 121 169 % C 15 16 == 15 25 49 121 169 % C 16 == 16 18 25 49 121 169 % P 17 18 18 25 49 121 169 -> 289 -module(multi_erathostenes). -author("angel@REDACTED"). -compile(export_all). compare(X,Y) when X > Y -> greater; compare(X,Y) when X < Y -> smaller; compare(_,_) -> equal. worker(Prime,UpperBound)-> receive {test,Number,ParentPID} -> ParentPID ! ok, case compare(Number,UpperBound) of equal -> % io:format("[Worker of prime: ~w (~w)] Found composite: ~w~n",[Prime,UpperBound,Number]), worker(Prime,UpperBound + Prime); smaller -> io:format("[Worker of prime: ~w (~w)] Spawn new worker for Prime: ~w~n",[Prime,UpperBound,Number]), NextPID =spawn(?MODULE,worker,[Number,Number*Number]), worker(Prime,UpperBound,NextPID) end; stop -> noop end. worker(Prime,UpperBound,NextPID) -> receive {test,Number,ParentPID} -> ParentPID ! ok, case compare(Number,UpperBound) of equal -> % io:format("[Worker of prime: ~w (~w)] Found composite: ~w~n",[Prime,UpperBound,Number]), worker(Prime,UpperBound + Prime,NextPID); smaller -> % io:format("[Worker of prime: ~w (~w)] passing along: ~w~n",[Prime,UpperBound,Number]), NextPID ! {test,Number,self()}, receive ok -> ok end, worker(Prime,UpperBound,NextPID); greater -> % io:format("[Worker of prime: ~w (~w)] passing along: ~w~n",[Prime,UpperBound,Number]), NextPID ! {test,Number,self()}, receive ok -> ok end, worker(Prime,UpperBound+Prime,NextPID) end; stop -> NextPID ! stop, noop end. start(N) -> OnePID=spawn(?MODULE,worker,[2,4]), cicle(3,N,OnePID). cicle(Last,Last,Worker) -> Worker ! stop; cicle(Current,Last,Worker) -> Worker ! {test,Current,self()}, receive ok -> ok end, cicle(Current+1,Last,Worker). From erlang@REDACTED Thu Dec 17 15:03:30 2009 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 17 Dec 2009 15:03:30 +0100 Subject: long delays in messages to this group Message-ID: <9b08084c0912170603h1e002459ge545b88ac196dce7@mail.gmail.com> What's up? I posted to erlang-questons@REDACTED from erlang@REDACTED and it took 22 hours before the mail went out to the group. What's up - is this a known problem? /Joe From cerieljacobs@REDACTED Thu Dec 17 16:28:26 2009 From: cerieljacobs@REDACTED (Ceriel Jacobs) Date: Thu, 17 Dec 2009 16:28:26 +0100 Subject: [erlang-questions] OTP13B03 failed to make parallel on OS X 10.6 in 64-bit: ld: duplicate symbol _debug in debuglog.o and esock.o In-Reply-To: References: <8A2C91DE-993C-43BA-BB87-646D4387A3AD@gmail.com> <4B28B07D.4010309@erix.ericsson.se> <49C29A7F-6281-4F46-863B-F39CAF7AB6C4@gmail.com> <4B290471.5090005@erix.ericsson.se> <4B29231F.1040005@erix.ericsson.se> <283187F2-F2CC-4F6A-8A71-5F5443C95E9D@gmail.com> <64073E5D-62C8-49D7-9959-A827A5D5D55A@totalwire.it> <29954324-65C5-48F1-B2FF-B8C799C136C0@gmail.com> Message-ID: The patch has been applied. 'make clean', './configure ...', 'make' and finally 'make install', has finally installed erlang. Thanks for your help. Op 17 dec 2009, om 11:07 heeft Illo de' Illis het volgende geschreven: > I've attached a patch file that does the job. > From ms@REDACTED Thu Dec 17 16:55:36 2009 From: ms@REDACTED (Martin Scholl) Date: Thu, 17 Dec 2009 16:55:36 +0100 Subject: [erlang-questions] Parallel Make in OTP In-Reply-To: <38e3b9f40912170305h5437d21dhac263289ba60506a@mail.gmail.com> References: <38e3b9f40912170305h5437d21dhac263289ba60506a@mail.gmail.com> Message-ID: <4B2A5478.7060305@diskware.net> Hello all, Peter-Henry Mander wrote: > Hi Gentlepeople, > > There's a thread on erlang-bugs list discussing "Recursive Make > Considered Harmful" [1] Which inspired me while I struggled with > parallel make in our T-Build system in T-Mobile [2]. Despite the lack > of activity on Code.Google.Com, I actively maintain T-Build in house. > > I want to put my oar in and respectfully ask not to ditch Gnu Make in > OTP. It's a much maligned beast with an ugly syntax, but it's a > phenomenally powerful one. Other build tools just don't cut it. Having > make --jobs fail on the OTP build is an itch I yearn to scratch for a > long time. Actually, I'd like to be a heretic here and proclaim: there is a better build tool: CMake[1]. I know the pros and cons of having another build-dependency for Erlang, but I can state, CMake is serving us really well on our Erlang-based projects so far. It is fast, almost declarative like make, cross-plattform, etc. -- and it is really easy and straight-forward to manage a project with a structure like current otp-codebase. Given a suitable set of macros, building a Erlang application can be easy as this: ERL_ADD_PROJECT(AppName Version DEPS ) ERL_BUILD(AppName ) ERL_ADD_PROJECT would then generate the .rel-file for you, ERL_BUILD would build it and upon installation time, install your app into -, etc. Furthermore, CMake would make it really easy, to extend the erlang code-base with your own custom inhouse applications. You would simply start coding in otp/lib/, and your code gets automagically included into the build set without writing any line of CMake code. Given the distributed nature of Git, this could be really helpful. Testing your code with the latest erlang version, supporting multiple erlang versions, etc. would be just a `git merge' away and you are done. Just my 2 cents, Martin From ms@REDACTED Thu Dec 17 17:08:59 2009 From: ms@REDACTED (Martin Scholl) Date: Thu, 17 Dec 2009 17:08:59 +0100 Subject: [erlang-questions] Parallel Make in OTP In-Reply-To: <4B2A5478.7060305@diskware.net> References: <38e3b9f40912170305h5437d21dhac263289ba60506a@mail.gmail.com> <4B2A5478.7060305@diskware.net> Message-ID: <4B2A579B.2040002@diskware.net> I missed to provide link [1]: http://cmake.org/ Martin From kagato@REDACTED Thu Dec 17 17:21:45 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Thu, 17 Dec 2009 08:21:45 -0800 Subject: [erlang-questions] Parallel Make in OTP In-Reply-To: <4B2A579B.2040002@diskware.net> References: <38e3b9f40912170305h5437d21dhac263289ba60506a@mail.gmail.com> <4B2A5478.7060305@diskware.net> <4B2A579B.2040002@diskware.net> Message-ID: Regardless of what make we use, it would be really handy to get dependency generation in the compiler. For example, gcc has a -M option that will create a .d file, containing a Make compatible list of dependencies. This is one of the main problems I have generating proper Makefiles, as it's not easy to determine which .hrl files are included, especially when you're playing with the LIBDIR (which I do). On Dec 17, 2009, at 8:08 AM, Martin Scholl wrote: > I missed to provide link [1]: http://cmake.org/ > > > Martin > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > -- Jayson Vantuyl kagato@REDACTED From clist@REDACTED Thu Dec 17 17:47:44 2009 From: clist@REDACTED (Angel Alvarez) Date: Thu, 17 Dec 2009 17:47:44 +0100 Subject: [erlang-questions] long delays in messages to this group In-Reply-To: <9b08084c0912170603h1e002459ge545b88ac196dce7@mail.gmail.com> References: <9b08084c0912170603h1e002459ge545b88ac196dce7@mail.gmail.com> Message-ID: <200912171747.45034.clist@uah.es> Hi yesterday you said some message was gone so you did resend it in fact we receive that message twice.. El Jueves, 17 de Diciembre de 2009 Joe Armstrong escribi?: > What's up? > > I posted to erlang-questons@REDACTED from erlang@REDACTED and it > took 22 hours before the mail went out to the group. > > What's up - is this a known problem? > > /Joe > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > -- Agua para todo? No, Agua para Todos. ->>----------------------------------------------- Clist UAH a.k.a Angel ---------------------------------[www.uah.es]-<<-- From roberto.aloi@REDACTED Thu Dec 17 17:59:13 2009 From: roberto.aloi@REDACTED (Roberto Aloi) Date: Thu, 17 Dec 2009 16:59:13 +0000 (GMT) Subject: [erlang-questions] long delays in messages to this group In-Reply-To: <200912171747.45034.clist@uah.es> Message-ID: <10847290.13871261069153781.JavaMail.root@zimbra> Hi Joe, The Gmail web client won't show you the message you sent to the mailing list, even if you are subscribed to that mailing list. It will appear to you when someone actually answer you. I realized this after a while, the first time. Maybe it's also your case... :) Cheers, --- Roberto Aloi roberto.aloi@REDACTED http://www.erlang-consulting.com From g@REDACTED Thu Dec 17 18:51:23 2009 From: g@REDACTED (Garrett Smith) Date: Thu, 17 Dec 2009 11:51:23 -0600 Subject: [erlang-questions] distribution utility like python distutils? In-Reply-To: References: Message-ID: On Thu, Dec 17, 2009 at 2:12 AM, litao cheng wrote: > hi, all > I'm an erlang programmer, usually, I use reltool to build my target system, > but I feel it so complex and not stable. > I hope erlang can support some tool/library like python distutils, we can > distribute our module or otp application > simply. erlang website can also have some subject like pypi (python package > index), I think those can promote the erlang package > growning. I think we need an standard mechanism for all developer. Timely question. Martin Logan presented OTP fundamentals and referenced a couple tools that go along with the dev/deploy/maintain lifecycle for OTP applications: Per your question, I believe Faxien is good fit: http://www.erlware.org/tools/faxien/index.html For streamlining builds of OTP apps: http://www.erlware.org/tools/sinan/index.html I haven't used these myself, but will definitely be checking them out. As a fellow Python developer, and someone who appreciates the ease of consuming Python packages via 'easy_install', I'd be interested to get your take on these Erlware tools. Garrett From rob@REDACTED Thu Dec 17 18:56:22 2009 From: rob@REDACTED (Rob Charlton) Date: Thu, 17 Dec 2009 17:56:22 +0000 Subject: [erlang-questions] long delays in messages to this group In-Reply-To: <9b08084c0912170603h1e002459ge545b88ac196dce7@mail.gmail.com> References: <9b08084c0912170603h1e002459ge545b88ac196dce7@mail.gmail.com> Message-ID: <4B2A70C6.2090908@erlang-consulting.com> I found that when posting to the list using a different email (not gmail) my messages sometimes took a very long time (many hours) to show up. Now I've signed up again and switched to my @erlang-consulting email they show up much more quickly. I wondered if my email got preferential treatment because it had "erlang" in it but I guess you've disproved that now! ;) Rob Joe Armstrong wrote: > What's up? > > I posted to erlang-questons@REDACTED from erlang@REDACTED and it > took 22 hours before the mail went out to the group. > > What's up - is this a known problem? > > /Joe > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > -- Erlang Training and Consulting Ltd www.erlang-consulting.com From kagato@REDACTED Thu Dec 17 19:07:18 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Thu, 17 Dec 2009 10:07:18 -0800 Subject: Getting Dependencies for Erlang Files Message-ID: <4093C767-8BD4-4F62-881C-E7FB44157276@souja.net> Not content to wait for an answer, I wrote a rough escript that will use the same functions the compiler uses to extract dependencies. Well, at least it gets .hrl files for .erl files. I was surprising to discover is not everything the compiler can compile, but that's another story. You can read about the script and download it in my latest blog post: http://needlesslymessianic.com/2009/12/17/finding-dependencies-for-erlang-code Enjoy! -- Jayson Vantuyl kagato@REDACTED From mbj@REDACTED Thu Dec 17 21:15:52 2009 From: mbj@REDACTED (Martin Bjorklund) Date: Thu, 17 Dec 2009 21:15:52 +0100 (CET) Subject: [erlang-questions] erlang emacs mode question In-Reply-To: <9b08084c0912151137k5efad939t85471b1b76cc21e0@mail.gmail.com> References: <77C1226CCC2F7C41B022662F4775DABC57005CBAC4@EGEXCMB01.oww.root.lcl> <9b08084c0912151137k5efad939t85471b1b76cc21e0@mail.gmail.com> Message-ID: <20091217.211552.244977081.mbj@tail-f.com> Hi, Joe Armstrong wrote: > What I'd like is "org mode erlang editing" > > hit tab on the first line of a function definition hides or reveals > the body of the function. > hit meta-uparrow on the first line of a function move the function up > in the file. You can configure outline mode to do this, sort of. Put this in .emacs. Instead of as you suggested, use C-left / C-right. This way it shows / hides each function clause as a separate item, but you probably want to treat the complete function as one entity. I'm sure it is doable... (defun show-onelevel () "show entry and children in outline mode" (interactive) (show-entry) (show-children)) (defun my-outline-bindings () "sets shortcut bindings for outline minor mode" (interactive) (local-set-key [C-up] 'outline-previous-visible-heading) (local-set-key [C-down] 'outline-next-visible-heading) (local-set-key [C-left] 'hide-subtree) (local-set-key [C-right] 'show-onelevel)) (add-hook 'outline-minor-mode-hook 'my-outline-bindings) (add-hook 'erlang-mode-hook '(lambda () (outline-minor-mode) (setq outline-regexp (concat "^-?" erlang-atom-regexp "\\s *(")))) [ref: http://www.emacswiki.org/emacs/EasyCodeOutline] /martin From erlang@REDACTED Thu Dec 17 21:39:38 2009 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 17 Dec 2009 21:39:38 +0100 Subject: [erlang-questions] erlang emacs mode question In-Reply-To: <20091217.211552.244977081.mbj@tail-f.com> References: <77C1226CCC2F7C41B022662F4775DABC57005CBAC4@EGEXCMB01.oww.root.lcl> <9b08084c0912151137k5efad939t85471b1b76cc21e0@mail.gmail.com> <20091217.211552.244977081.mbj@tail-f.com> Message-ID: <9b08084c0912171239v7d00e838j6ad8cf605d060bb8@mail.gmail.com> Wow - amazing - thanks /Joe On Thu, Dec 17, 2009 at 9:15 PM, Martin Bjorklund wrote: > Hi, > > Joe Armstrong wrote: >> What I'd like is "org mode erlang editing" >> >> hit tab on the first line of a function definition hides or reveals >> the body of the function. >> hit meta-uparrow on the first line of a function move the function up >> in the file. > > You can configure outline mode to do this, sort of. ?Put this in > .emacs. ?Instead of as you suggested, use C-left / C-right. > > This way it shows / hides each function clause as a separate item, but > you probably want to treat the complete function as one entity. ?I'm > sure it is doable... > > > (defun show-onelevel () > ?"show entry and children in outline mode" > ?(interactive) > ?(show-entry) > ?(show-children)) > > (defun my-outline-bindings () > ?"sets shortcut bindings for outline minor mode" > ?(interactive) > ?(local-set-key [C-up] 'outline-previous-visible-heading) > ?(local-set-key [C-down] 'outline-next-visible-heading) > ?(local-set-key [C-left] 'hide-subtree) > ?(local-set-key [C-right] 'show-onelevel)) > > (add-hook > ?'outline-minor-mode-hook > ?'my-outline-bindings) > > (add-hook > ?'erlang-mode-hook > ?'(lambda () > ? ?(outline-minor-mode) > ? ?(setq outline-regexp > ? ? ? ? ?(concat "^-?" erlang-atom-regexp "\\s *(")))) > > [ref: http://www.emacswiki.org/emacs/EasyCodeOutline] > > > > /martin > From mevans@REDACTED Thu Dec 17 23:48:39 2009 From: mevans@REDACTED (Evans, Matthew) Date: Thu, 17 Dec 2009 17:48:39 -0500 Subject: inets http library enhancement Message-ID: Hi, The ibrowse library has had a recent enhancement to allow a user to pass their own socket options. I was wondering if it would be possible to enhance the Erlang inets http (client) library with similar functionality. For example, we have a client that requires we set the IP TOS value (for DSCP marking) on all outgoing packets. Since this capability is missing in the http library we are forced to add a patch to the existing code. It would be great if a future releases had this functionality. For example: http:request(get, {Url, TransferHeader}, [{timeout,30000}], [{version,1.1}, {stream,self}, {sync,false}, {socket_opts,[{tos,87},{recbuf,65000}]}]) Thanks Matt From bgustavsson@REDACTED Fri Dec 18 09:00:26 2009 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Fri, 18 Dec 2009 09:00:26 +0100 Subject: [erlang-questions] Getting Dependencies for Erlang Files In-Reply-To: <4093C767-8BD4-4F62-881C-E7FB44157276@souja.net> References: <4093C767-8BD4-4F62-881C-E7FB44157276@souja.net> Message-ID: <6672d0160912180000p550dc433xc0da460421f69a12@mail.gmail.com> On Thu, Dec 17, 2009 at 7:07 PM, Jayson Vantuyl wrote: > Not content to wait for an answer, I wrote a rough escript that will use the same functions the compiler uses to extract dependencies. ?Well, at least it gets .hrl files for .erl files. ?I was surprising to discover is not everything the compiler can compile, but that's another story. > There is currently a topic branch in the git reposiotory by Jean-S?bastien P?dron to generate dependencies: http://github.com/erlang/otp/commit/c0734e8a85270d08beda34c4e28aed21b350fb18 Feedback would be welcome, both positive ("I have tested it, and it does everything I expect it to do") and negative ("It does not correctly handle the following..."), or suggestions for improvements. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From ciprian.craciun@REDACTED Fri Dec 18 09:20:27 2009 From: ciprian.craciun@REDACTED (Ciprian Dorin, Craciun) Date: Fri, 18 Dec 2009 10:20:27 +0200 Subject: [erlang-questions] Getting Dependencies for Erlang Files In-Reply-To: <6672d0160912180000p550dc433xc0da460421f69a12@mail.gmail.com> References: <4093C767-8BD4-4F62-881C-E7FB44157276@souja.net> <6672d0160912180000p550dc433xc0da460421f69a12@mail.gmail.com> Message-ID: <8e04b5820912180020r2ab0fae5maa18b139361f09e7@mail.gmail.com> 2009/12/18 Bj?rn Gustavsson : > On Thu, Dec 17, 2009 at 7:07 PM, Jayson Vantuyl wrote: >> Not content to wait for an answer, I wrote a rough escript that will use the same functions the compiler uses to extract dependencies. ?Well, at least it gets .hrl files for .erl files. ?I was surprising to discover is not everything the compiler can compile, but that's another story. >> > > There is currently a topic branch in the git reposiotory by > Jean-S?bastien P?dron > to generate dependencies: > > http://github.com/erlang/otp/commit/c0734e8a85270d08beda34c4e28aed21b350fb18 > > Feedback would be welcome, both positive ("I have tested it, and it > does everything I expect it to do") and negative ("It does not correctly handle > the following..."), or suggestions for improvements. > > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB Hy all! It seems that lately there was a lot of discussions on this mailing list about Erlang or Erlang related build systems... It just happens that I've also made my own (very simple and still in an alpha version). :) But back to the problem... My solution to extracting include dependencies in Erlang .erl source files was much simpler (and maybe quicker), and that is using sed: ~~~~~ (part of my makefile generator) cat "${_file}" \ | grep -E -e '^\s*-include\s*\(\s*"\s*[^"]+\s*"\s*\)\s*.' \ | sed -E -e 's|^.*"\s*([^"]+)\s*".*$|'"${application__outputs__ebin__path}/${_beam_name} : "'applications__hrl__\1|' \ || true ~~~~~ It spits out something like: ~~~~~ $(json__outputs__ebin__path)/json.beam : applications__hrl__json.hrl $(json__outputs__ebin__path)/json.beam : applications__hrl__transcript.hrl ~~~~~ The `hrl__something.hrl` target is generated by another part of my build system, like: ~~~~~ applications__hrl__json.hrl :: $(json__outputs__src__path)/json.hrl applications__hrl__json.hrl :: $(json__outputs__include__path)/json.hrl ~~~~~ Ciprian. From maruthavanan_s@REDACTED Fri Dec 18 10:32:32 2009 From: maruthavanan_s@REDACTED (maruthavanan s) Date: Fri, 18 Dec 2009 04:32:32 -0500 Subject: Increase in heap size Message-ID: Hi, I have a old code written by some one else, this is not a OTP, start()-> receive {data,Data}-> process_data(Data); end, start(). After I run my system this process heap size is increase to enourmous extent with bigger values of reductions. I could not understand reductions. Is this not a good programing practice? What would be the right way? what should I do to optimize this? Please help. Regards, Marutha From freza@REDACTED Fri Dec 18 12:05:02 2009 From: freza@REDACTED (Jachym Holecek) Date: Fri, 18 Dec 2009 12:05:02 +0100 Subject: [erlang-questions] Parallel Make in OTP In-Reply-To: <38e3b9f40912170305h5437d21dhac263289ba60506a@mail.gmail.com> References: <38e3b9f40912170305h5437d21dhac263289ba60506a@mail.gmail.com> Message-ID: <20091218110502.GA1006@hanele> Hi Pete, long time no see, how are you? # Peter-Henry Mander 2009-12-17: > There's a thread on erlang-bugs list discussing "Recursive Make > Considered Harmful" [1] Which inspired me while I struggled with > parallel make in our T-Build system in T-Mobile [2]. Despite the lack > of activity on Code.Google.Com, I actively maintain T-Build in house. This looks good! The download process isn't quite straightforward, following the instructions misses the Template/Template-2.0 dirs, so perhaps the Projects checkout needs to be done recursively. Looking forward to seeing an updated version, I'd be insterested in supporting git in addition to svn. > I want to put my oar in and respectfully ask not to ditch Gnu Make in > OTP. It's a much maligned beast with an ugly syntax, but it's a > phenomenally powerful one. Other build tools just don't cut it. Side note: Actually, bmake[1] can cut a lot of things. The way it's traditionally used is the "good old" recursive make, which I agree is rather suboptimal. Regards, -- Jachym [1] http://netbsd.gw.com/cgi-bin/man-cgi?make++NetBSD-current From egarrulo@REDACTED Fri Dec 18 12:27:28 2009 From: egarrulo@REDACTED (egarrulo) Date: Fri, 18 Dec 2009 11:27:28 +0000 Subject: Proper environment setting to compile Distel on Windows? Message-ID: <9bd8a08a0912180327i7a2b888er3666684d2ed2110f@mail.gmail.com> Hello, building Distel on Cygwin fails: $ make erlc -W -o ebin +debug_info src/distel.erl c:/DOCUME~1/XXXXXX~1.OFF/distel-4.03/ebin/distel.bea#: error writing file src/distel.erl:277: Warning: tuple/1 obsolete src/distel.erl:359: Warning: integer/1 obsolete src/distel.erl:361: Warning: list/1 obsolete src/distel.erl:363: Warning: atom/1 obsolete src/distel.erl:379: Warning: list/1 obsolete src/distel.erl:388: Warning: atom/1 obsolete src/distel.erl:565: Warning: atom/1 obsolete src/distel.erl:783: Warning: list/1 obsolete src/distel.erl:783: Warning: list/1 obsolete src/distel.erl:849: Warning: list/1 obsolete src/distel.erl:901: Warning: atom/1 obsolete src/distel.erl:901: Warning: atom/1 obsolete src/distel.erl:907: Warning: atom/1 obsolete make: *** [ebin/distel.beam] Error 1 I think it's because of "c:/DOCUME~1/XXXXXX~1.OFF" not being a correct Cygwin path. However, $HOME is properly set: $ echo $HOME /cygdrive/c/DOCUME~1/XXXXXX~1.OFF I've tried setting Windows' %HOME% to /cygdrive/c/DOCUME~1/XXXXXX~1.OFF as well and restarting Cygwin, but that doesn't change anything. Any hint where make takes its "c:/DOCUME~1/XXXXXX~1.OFF"? Thanks. From phmander@REDACTED Fri Dec 18 15:14:38 2009 From: phmander@REDACTED (Peter-Henry Mander) Date: Fri, 18 Dec 2009 14:14:38 +0000 Subject: [erlang-questions] Parallel Make in OTP In-Reply-To: <20091218110502.GA1006@hanele> References: <38e3b9f40912170305h5437d21dhac263289ba60506a@mail.gmail.com> <20091218110502.GA1006@hanele> Message-ID: <38e3b9f40912180614g1a302a6ble46bee0ea960402d@mail.gmail.com> Hi J?chym, I agree that the GoogleCode T-Build stuff is clunky. I'm revising T-Build at the moment, and I'm dissatisfied with it. I'm confident that I can scan for dependencies using a single Makefile, and not have to resort to the weird nested include files. T-Build is too complex. All a project should need is one Makefile. At the moment, adding new applications to a build means inserting symlinks, so it's not entirely hands-free. I want the Makefile to be immutable, capable of scanning for additions, deletions, and -include*(). dependencies (although that may still require a bit of Bash voodoo under the covers). As long as the project directory structure is similar, it should all Just Work. I'm aiming for zero Makefile maintenance, which I believe is desirable regardless which build system is used. I've heard many suggestions of replacements for Make, but a lot of them don't have any difference or enhancement that warrants jumping ship. Most seem to be changes in style more than in substance (but someone prove me wrong, please). Apart from Sinan, maybe. But I've not looked at it hard enough. Considering the "old school" methods and process that we use in T-Mobile, Sinan's agile style is also a leap in culture which, I found from experience in the Previous Place, is much harder to push in a company. On a tangent: What if a declarative, rules based system was available in Erlang (someone's going to tell me there is one, for sure!), what other projects besides a drop-in replacement for a parallel, distributed Make could be made possible? Pete. On 12/18/09, Jachym Holecek wrote: > Hi Pete, > > long time no see, how are you? > > # Peter-Henry Mander 2009-12-17: >> There's a thread on erlang-bugs list discussing "Recursive Make >> Considered Harmful" [1] Which inspired me while I struggled with >> parallel make in our T-Build system in T-Mobile [2]. Despite the lack >> of activity on Code.Google.Com, I actively maintain T-Build in house. > > This looks good! The download process isn't quite straightforward, > following the instructions misses the Template/Template-2.0 dirs, > so perhaps the Projects checkout needs to be done recursively. > > Looking forward to seeing an updated version, I'd be insterested > in supporting git in addition to svn. > >> I want to put my oar in and respectfully ask not to ditch Gnu Make in >> OTP. It's a much maligned beast with an ugly syntax, but it's a >> phenomenally powerful one. Other build tools just don't cut it. > > Side note: Actually, bmake[1] can cut a lot of things. The way it's > traditionally used is the "good old" recursive make, which I agree > is rather suboptimal. > > Regards, > -- Jachym > > [1] http://netbsd.gw.com/cgi-bin/man-cgi?make++NetBSD-current > From egarrulo@REDACTED Fri Dec 18 16:21:47 2009 From: egarrulo@REDACTED (egarrulo) Date: Fri, 18 Dec 2009 15:21:47 +0000 Subject: http:request: cannot connect behind proxy? Message-ID: <9bd8a08a0912180721h77200f4ey7af893fb0cb57bf@mail.gmail.com> Hello, I'm trying to get a HTML document and I'm behind a proxy, but my request keeps timing out. I'm following directions found at http://erlang.mirror.su.se/documentation/doc-5.7.3/lib/inets-5.1.3/doc/html/http_client.html Here is the code: -module (test). -compile([export_all]). -define (URL, "http://www.google.it"). main()-> inets:start(), http:set_options([{proxy, {{"10.249.69.41", 8080}, ["localhost"]}}]), { ok, {_Status, _Headers, Body }} = http:request (?URL). Tested on Erlang-R13B01 + Windows XP. Any help? Thanks. From jeraymond@REDACTED Fri Dec 18 17:37:34 2009 From: jeraymond@REDACTED (Jeremy Raymond) Date: Fri, 18 Dec 2009 11:37:34 -0500 Subject: Using Dialyzer on Ubuntu 9.10? Message-ID: <59da11980912180837n7f19f919la96e28ed4d592998@mail.gmail.com> Hello, I'm attempting to run dialyzer on my code on Ubuntu 9.10 with the Erlang version (R13B01) that ships with Ubuntu. Dialyzer tells me I need to build my plt file. When I attempt to do so by running the command: dialyzer --build_plt -r /usr/lib/erlang/lib/{compiler-*,kernel-*,dialyzer-*,erts-*,stdlib-*}/ebin I get the error message, 'dialyzer: Could not get abstract code for file...'. Searching online it seems that the debug info has been stripped out of the beam files of the Erlang shipped with Ubuntu to reduce the size as per: https://bugs.launchpad.net/ubuntu/+source/erlang/+bug/385093. Do I need to download/compiler Erlang myself with the debug info to use dialyzer or am I missing something here (can I find the debug info somewhere else)? Thanks, Jeremy From erlangy@REDACTED Fri Dec 18 17:43:21 2009 From: erlangy@REDACTED (Michael) Date: Fri, 18 Dec 2009 08:43:21 -0800 Subject: [erlang-questions] Using Dialyzer on Ubuntu 9.10? In-Reply-To: <59da11980912180837n7f19f919la96e28ed4d592998@mail.gmail.com> References: <59da11980912180837n7f19f919la96e28ed4d592998@mail.gmail.com> Message-ID: <20091218164320.GD11530@delora.autosys.us> On Fri, Dec 18, 2009 at 11:37:34AM -0500, Jeremy Raymond wrote: > Hello, > > I'm attempting to run dialyzer on my code on Ubuntu 9.10 with the Erlang > version (R13B01) that ships with Ubuntu. Dialyzer tells me I need to build > my plt file. When I attempt to do so by running the command: > > dialyzer --build_plt -r > /usr/lib/erlang/lib/{compiler-*,kernel-*,dialyzer-*,erts-*,stdlib-*}/ebin > > I get the error message, 'dialyzer: Could not get abstract code for > file...'. Searching online it seems that the debug info has been stripped > out of the beam files of the Erlang shipped with Ubuntu to reduce the size > as per: https://bugs.launchpad.net/ubuntu/+source/erlang/+bug/385093. > > Do I need to download/compiler Erlang myself with the debug info to use > dialyzer or am I missing something here (can I find the debug info somewhere > else)? > > > Thanks, > > Jeremy ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ does this work ? ... $ dialyzer --build_plt --apps compiler kernel dialyzer erts stdlib ~Michael From senthilkumar.peelikkampatti@REDACTED Fri Dec 18 17:49:09 2009 From: senthilkumar.peelikkampatti@REDACTED (Senthilkumar Peelikkampatti) Date: Fri, 18 Dec 2009 10:49:09 -0600 Subject: Imagemagick erlang port Message-ID: <45d8e23d0912180849r1788178as425c6ce1e02a5936@mail.gmail.com> Hi, I found image magick driver for so many other languages but not able to find one for Erlang :-) For those not familiar with ImageMagick, it is image manipulation tool which converts one format to another and also does somany other things. Moer here http://imagemagick.com/script/index.php. I used this extensively for Captacha and image transformation but with script utility and erlang:port_command. But for me, it looks like a hack. Has anybody developed Erlang interface? Anybody interested in writing interface in erlang? It would be great addition to Joe's elib library. -- Regards, Senthilkumar Peelikkampatti, http://pmsenthilkumar.blogspot.com/ From kostis@REDACTED Fri Dec 18 17:52:07 2009 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 18 Dec 2009 18:52:07 +0200 Subject: [erlang-questions] Using Dialyzer on Ubuntu 9.10? In-Reply-To: <59da11980912180837n7f19f919la96e28ed4d592998@mail.gmail.com> References: <59da11980912180837n7f19f919la96e28ed4d592998@mail.gmail.com> Message-ID: <4B2BB337.1090004@cs.ntua.gr> Jeremy Raymond wrote: > Hello, > > I'm attempting to run dialyzer on my code on Ubuntu 9.10 with the Erlang > version (R13B01) that ships with Ubuntu. Dialyzer tells me I need to build > my plt file. When I attempt to do so by running the command: > > dialyzer --build_plt -r > /usr/lib/erlang/lib/{compiler-*,kernel-*,dialyzer-*,erts-*,stdlib-*}/ebin > > I get the error message, 'dialyzer: Could not get abstract code for > file...'. Searching online it seems that the debug info has been stripped > out of the beam files of the Erlang shipped with Ubuntu to reduce the size > as per: https://bugs.launchpad.net/ubuntu/+source/erlang/+bug/385093. > > Do I need to download/compiler Erlang myself with the debug info to use > dialyzer or am I missing something here (can I find the debug info somewhere > else)? I think you should do yourself a favour and scrap the Ubuntu Erlang package and instead go for installing yourself the source version of R13B03, which builds .beam files with debug_info in them (as it should). Besides the ability to run dialyzer on your code, you will end up with a better/newer Erlang system. The installation process itself should be trivial. Kostis From jeraymond@REDACTED Fri Dec 18 18:03:47 2009 From: jeraymond@REDACTED (Jeremy Raymond) Date: Fri, 18 Dec 2009 12:03:47 -0500 Subject: [erlang-questions] Using Dialyzer on Ubuntu 9.10? In-Reply-To: <20091218164320.GD11530@delora.autosys.us> References: <59da11980912180837n7f19f919la96e28ed4d592998@mail.gmail.com> <20091218164320.GD11530@delora.autosys.us> Message-ID: <59da11980912180903vdf4a7a5ne954da5d775975b2@mail.gmail.com> No: dialyzer: Unknown option: --apps On Fri, Dec 18, 2009 at 11:43 AM, Michael wrote: > On Fri, Dec 18, 2009 at 11:37:34AM -0500, Jeremy Raymond wrote: > > Hello, > > > > I'm attempting to run dialyzer on my code on Ubuntu 9.10 with the Erlang > > version (R13B01) that ships with Ubuntu. Dialyzer tells me I need to > build > > my plt file. When I attempt to do so by running the command: > > > > dialyzer --build_plt -r > > /usr/lib/erlang/lib/{compiler-*,kernel-*,dialyzer-*,erts-*,stdlib-*}/ebin > > > > I get the error message, 'dialyzer: Could not get abstract code for > > file...'. Searching online it seems that the debug info has been stripped > > out of the beam files of the Erlang shipped with Ubuntu to reduce the > size > > as per: https://bugs.launchpad.net/ubuntu/+source/erlang/+bug/385093. > > > > Do I need to download/compiler Erlang myself with the debug info to use > > dialyzer or am I missing something here (can I find the debug info > somewhere > > else)? > > > > > > Thanks, > > > > Jeremy > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > does this work ? ... > > $ dialyzer --build_plt --apps compiler kernel dialyzer erts stdlib > > > ~Michael > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From antoine.koener@REDACTED Fri Dec 18 18:04:34 2009 From: antoine.koener@REDACTED (Koener Antoine) Date: Fri, 18 Dec 2009 18:04:34 +0100 Subject: [erlang-questions] Imagemagick erlang port In-Reply-To: <45d8e23d0912180849r1788178as425c6ce1e02a5936@mail.gmail.com> References: <45d8e23d0912180849r1788178as425c6ce1e02a5936@mail.gmail.com> Message-ID: Hi, On Dec 18, 2009, at 17:49 , Senthilkumar Peelikkampatti wrote: > Hi, > I found image magick driver for so many other languages but > not able to find one for Erlang :-) > For those not familiar with ImageMagick, it is image manipulation tool > which converts one format to another and also does somany other > things. Moer here http://imagemagick.com/script/index.php. You should look at graphic magick http://www.graphicsmagick.org/benchmarks.html ImageMagick is full of memory leaks; and performance problems. > I used this extensively for Captacha and image transformation but with > script utility and erlang:port_command. But for me, it looks like a > hack. Has anybody developed Erlang interface? Anybody interested in using erlang:port_command is far from a hack; many software are designed to be used that way. It might be a hack whenever you need to transfer massive binary data with this interface but while data consists only in simple command lines, you win simple implementation and security. Restarting a port that's closed is trivial. I use ghostscript for creating pdf png or whatever format it supports using postcript as language (generated by erlang) and never had any problem with that... > writing interface in erlang? It would be great addition to Joe's elib > library. > > -- > Regards, > Senthilkumar Peelikkampatti, > http://pmsenthilkumar.blogspot.com/ > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From anton.krasovsky@REDACTED Fri Dec 18 18:24:01 2009 From: anton.krasovsky@REDACTED (Anton Krasovsky) Date: Fri, 18 Dec 2009 17:24:01 +0000 Subject: [erlang-questions] Imagemagick erlang port In-Reply-To: References: <45d8e23d0912180849r1788178as425c6ce1e02a5936@mail.gmail.com> Message-ID: <46167e6a0912180924m2e9446fep3b991d5a5105035a@mail.gmail.com> I'm using graphicsmagick as well, with temp files and os:cmd(). Would be interesting to see something more flexible, the command line interface is a bit limiting. Regards, Anton On Fri, Dec 18, 2009 at 5:04 PM, Koener Antoine wrote: > Hi, > > On Dec 18, 2009, at 17:49 , Senthilkumar Peelikkampatti wrote: > >> Hi, >> ? ? ?I found image magick driver for so many other ?languages but >> not able to find one for Erlang :-) >> For those not familiar with ImageMagick, it is image manipulation tool >> which converts one format to another and also does somany other >> things. Moer here http://imagemagick.com/script/index.php. > > You should look at > graphic magick > > http://www.graphicsmagick.org/benchmarks.html > From lcastro@REDACTED Fri Dec 18 17:46:34 2009 From: lcastro@REDACTED (Laura Milagros Castro Souto) Date: Fri, 18 Dec 2009 17:46:34 +0100 Subject: [erlang-questions] Using Dialyzer on Ubuntu 9.10? In-Reply-To: <59da11980912180837n7f19f919la96e28ed4d592998@mail.gmail.com> References: <59da11980912180837n7f19f919la96e28ed4d592998@mail.gmail.com> Message-ID: <200912181746.37963.lcastro@udc.es> Hello Jeremy: > Do I need to download/compiler Erlang myself with the debug info to use > dialyzer or am I missing something here (can I find the debug info > somewhere else)? I run myself into exactly the same situation a few weeks ago. I might be mistaken but I think you need to either download the sources and compile Erlang yourself (with the proper configuration), or else download the .deb files from another distribution which may be packaged with different compilation options. The latter is what I did, specifically Debian package files. Regards, -- Laura M. Castro MADS Group - Computer Science Department University of A Corunna http://www.madsgroup.org/staff/laura/index_en.html -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: This is a digitally signed message part. URL: From jeraymond@REDACTED Fri Dec 18 19:14:33 2009 From: jeraymond@REDACTED (Jeremy Raymond) Date: Fri, 18 Dec 2009 13:14:33 -0500 Subject: [erlang-questions] Using Dialyzer on Ubuntu 9.10? In-Reply-To: <200912181746.37963.lcastro@udc.es> References: <59da11980912180837n7f19f919la96e28ed4d592998@mail.gmail.com> <200912181746.37963.lcastro@udc.es> Message-ID: <59da11980912181014g68d3a7bfv161d169fd9f82c67@mail.gmail.com> I've successfully downloaded, compiled, and installed R13B03. Dialyzer is currently building the plt file. The Ubuntu default Erlang install is located at: /usr/{bin, lib/erlang, etc} and the version I built myself goes to /usr/local/{bin, lib/erlang, etc} so there's no conflict on the install. In the future when I download a newer Erlang version, compile it and install it again, do I need to manually delete the old install (if I want the same location) or will the new version do the right thing on make install and just overwrite the current install? Thanks, Jeremy 2009/12/18 Laura Milagros Castro Souto > > Hello Jeremy: > > > Do I need to download/compiler Erlang myself with the debug info to use > > dialyzer or am I missing something here (can I find the debug info > > somewhere else)? > > I run myself into exactly the same situation a few weeks ago. I > might be > mistaken but I think you need to either download the sources and compile > Erlang yourself (with the proper configuration), or else download the .deb > files > from another distribution which may be packaged with different compilation > options. The latter is what I did, specifically Debian package files. > > Regards, > > -- > Laura M. Castro > MADS Group - Computer Science Department > University of A Corunna > http://www.madsgroup.org/staff/laura/index_en.html > From mevans@REDACTED Fri Dec 18 19:18:40 2009 From: mevans@REDACTED (Evans, Matthew) Date: Fri, 18 Dec 2009 13:18:40 -0500 Subject: [erlang-questions] Increase in heap size In-Reply-To: References: , Message-ID: Hi, First, don't worry about the number of reductions. That's just telling you that your process is doing something. As a general coding style, most programmers would frown upon having case statements that are nested more than 2 deep (some even complain about 1 deep). You should think about calling other functions within those case statements, and maybe making use of guards too. What I would also recommend is removing the tail - recursive call to start() at the end of the start() function, and instead ensure that the recursive call is made at the end of each branch in the case statement(s). foo(Arg1, Arg2) -> case Arg1 of init -> {Res1,Res2} = do_something(Arg1, Arg2), foo(Res1,Res2); _ -> foo(Arg1,Arg2) end. A big no-no is that you have no default case in the receive statement. This WILL cause an explosive growth of the heap since messages that don't match will remain on the message queue. ________________________________ From: maruthavanan s [mailto:maruthavanan_s@REDACTED] Sent: Friday, December 18, 2009 10:51 AM To: Evans, Matthew Subject: RE: [erlang-questions] Increase in heap size Hi, Thanks for your reply, I am developing a TCP client which receives data from a server and processes it in the start module. I have attached the entire code with this mail. Help me to optimize because it runs for more than 10 hrs and memory consumption is growing leading to degradation. Thanks, Marutha > From: mevans@REDACTED > To: maruthavanan_s@REDACTED > Date: Fri, 18 Dec 2009 08:17:25 -0500 > Subject: RE: [erlang-questions] Increase in heap size > > I guess we would need to see what process_data/1 is doing to answer honestly. > > My guess is that that function is calling start() within its body. If so then you have something that will almost certainly cause the heap to grow. > > What you should do is: > > start()-> > receive > {data,Data}-> > process_data(Data), > start(); > _ -> > start() > end. > > And ensure process_data/1 returns rather than calls start() - although with the mods above that isn't so important now. > > ________________________________________ > From: erlang-questions@REDACTED [erlang-questions@REDACTED] On Behalf Of maruthavanan s [maruthavanan_s@REDACTED] > Sent: Friday, December 18, 2009 4:32 AM > To: erlang-questions@REDACTED > Subject: [erlang-questions] Increase in heap size > > Hi, > > I have a old code written by some one else, this is not a OTP, > > start()-> > receive > {data,Data}-> > process_data(Data); > end, > start(). > > After I run my system this process heap size is increase to enourmous extent with bigger values of reductions. > > I could not understand reductions. Is this not a good programing practice? What would be the right way? what should I do to optimize this? > > Please help. > > Regards, > Marutha From bernie@REDACTED Fri Dec 18 19:25:37 2009 From: bernie@REDACTED (Bernard Duggan) Date: Fri, 18 Dec 2009 13:25:37 -0500 Subject: [erlang-questions] Using Dialyzer on Ubuntu 9.10? In-Reply-To: <59da11980912181014g68d3a7bfv161d169fd9f82c67@mail.gmail.com> References: <59da11980912180837n7f19f919la96e28ed4d592998@mail.gmail.com> <200912181746.37963.lcastro@udc.es> <59da11980912181014g68d3a7bfv161d169fd9f82c67@mail.gmail.com> Message-ID: <4B2BC921.70304@m5net.com> Jeremy Raymond wrote: > I've successfully downloaded, compiled, and installed R13B03. Dialyzer is > currently building the plt file. > > The Ubuntu default Erlang install is located at: > /usr/{bin, lib/erlang, etc} > and the version I built myself goes to > /usr/local/{bin, lib/erlang, etc} > so there's no conflict on the install. > I'd strongly recommend removing the packaged install unless you have a really good reason to keep it, because otherwise at some point I'll guarantee you that that parallel installation will trip you up. > In the future when I download a newer Erlang version, compile it and install > it again, do I need to manually delete the old install (if I want the same > location) or will the new version do the right thing on make install and > just overwrite the current install? > You don't really need to manually delete it (at least not in my empirical experience), but what you'll find is that the /usr/local/lib/erlang/lib directory will continue to acquire more and more subdirectories, since they're named by the version of the library, so the new ones won't overwrite the old ones. Erlang will always correctly select the newest one, so it's more of a tidiness issue than any problem with functionality. I don't have a nice solution for this, unfortunately - there doesn't seem to be an 'uninstall' make target...anyone got a suggestion? Cheers, Bernard From rumata-estor@REDACTED Fri Dec 18 19:40:38 2009 From: rumata-estor@REDACTED (Dmitry Belyaev) Date: Fri, 18 Dec 2009 21:40:38 +0300 Subject: [erlang-questions] Increase in heap size In-Reply-To: References: Message-ID: <1261161638.23362.2.camel@rumbuntu> What is the last statement in process_data/1? If it looks like process_data(Data) -> ... start(). then there is no tail-recursion. On Fri, 2009-12-18 at 04:32 -0500, maruthavanan s wrote: > Hi, > > I have a old code written by some one else, this is not a OTP, > > start()-> > receive > {data,Data}-> > process_data(Data); > end, > start(). > > After I run my system this process heap size is increase to enourmous extent with bigger values of reductions. > > I could not understand reductions. Is this not a good programing practice? What would be the right way? what should I do to optimize this? > > Please help. > > Regards, > Marutha > From jeraymond@REDACTED Fri Dec 18 19:43:45 2009 From: jeraymond@REDACTED (Jeremy Raymond) Date: Fri, 18 Dec 2009 13:43:45 -0500 Subject: [erlang-questions] Using Dialyzer on Ubuntu 9.10? In-Reply-To: <4B2BC921.70304@m5net.com> References: <59da11980912180837n7f19f919la96e28ed4d592998@mail.gmail.com> <200912181746.37963.lcastro@udc.es> <59da11980912181014g68d3a7bfv161d169fd9f82c67@mail.gmail.com> <4B2BC921.70304@m5net.com> Message-ID: <59da11980912181043q6293d63dh6a71ba7bb8ba8952@mail.gmail.com> I was keeping the packaged install because I have other installed packages (couchdb) dependent upon it. On Fri, Dec 18, 2009 at 1:25 PM, Bernard Duggan wrote: > Jeremy Raymond wrote: > > I've successfully downloaded, compiled, and installed R13B03. Dialyzer is > > currently building the plt file. > > > > The Ubuntu default Erlang install is located at: > > /usr/{bin, lib/erlang, etc} > > and the version I built myself goes to > > /usr/local/{bin, lib/erlang, etc} > > so there's no conflict on the install. > > > I'd strongly recommend removing the packaged install unless you have a > really good reason to keep it, because otherwise at some point I'll > guarantee you that that parallel installation will trip you up. > > > In the future when I download a newer Erlang version, compile it and > install > > it again, do I need to manually delete the old install (if I want the > same > > location) or will the new version do the right thing on make install and > > just overwrite the current install? > > > You don't really need to manually delete it (at least not in my > empirical experience), but what you'll find is that the > /usr/local/lib/erlang/lib directory will continue to acquire more and > more subdirectories, since they're named by the version of the library, > so the new ones won't overwrite the old ones. Erlang will always > correctly select the newest one, so it's more of a tidiness issue than > any problem with functionality. > > I don't have a nice solution for this, unfortunately - there doesn't > seem to be an 'uninstall' make target...anyone got a suggestion? > > Cheers, > > Bernard > From clist@REDACTED Fri Dec 18 22:12:21 2009 From: clist@REDACTED (Angel Alvarez) Date: Fri, 18 Dec 2009 22:12:21 +0100 Subject: [erlang-questions] Increase in heap size In-Reply-To: References: Message-ID: <200912182212.22208.clist@uah.es> El Viernes, 18 de Diciembre de 2009 maruthavanan s escribi?: > > Hi, > > I have a old code written by some one else, this is not a OTP, > > start()-> > receive > {data,Data}-> > process_data(Data); > end, > start(). > > After I run my system this process heap size is increase to enourmous extent with bigger values of reductions. > > I could not understand reductions. Is this not a good programing practice? What would be the right way? what should I do to optimize this? > > Please help. > > Regards, > Marutha > i seems there is no return values from process_data(Data) so you are using side-efects to alter state? In that case a spawn(?MODULE,process_data,[Data]) will free your processs to receive more mesages while process_data is running on another process (and will free memory when this new process finishes). While is known that erlang can suffer from massive amounts of messages in a mailbox combined with selective receive what is considered a bad practice is to send messages asyncronously from external sources like sockets and in general whatever source of message you use is preferable to have some degree of flow control. using {active, once} on a listening socket can mitigate the problem (look on the archives for many examples on this). Joe has a simple tcp example on his pages (i cant remember the URL) anyone has suitable examples at hand? /Angel -- Agua para todo? No, Agua para Todos. ->>----------------------------------------------- Clist UAH a.k.a Angel ---------------------------------[www.uah.es]-<<-- Warning: Microsoft_bribery.ISO contains OOXML code. From hynek@REDACTED Fri Dec 18 23:04:08 2009 From: hynek@REDACTED (Hynek Vychodil) Date: Fri, 18 Dec 2009 23:04:08 +0100 Subject: How configure and debug Erlang networking Message-ID: <4d08db370912181404r369ce826wed5e949a2191f37@mail.gmail.com> Hello, I often stuck in problem with Erlang networking and I don't know how debug problem and solve it. For example I start VM with erl -sname server and than another one on same HW erl -sname client. I can see client@REDACTED and server@REDACTED node names in prompts and than I do (client@REDACTED)1> net_adm:ping('server@REDACTED'). pang and got pang. What shall I do now? What is best practice to trace down networking problem? I know that there is some problem with my_host resolution but I would like know systematic way how to deal with it. Beside this I also remember that there is some Erlang specific networking and name resolving configuration and It was repeatly mentioned here in mailing list but I can't find proper search criteria to find it. I have spend more than hour searching documentation (erl, epmd, inets, ...) and this mailing list without success. It is really frustrating. I would appreciate any help with it. Also some mnemotechnic which help me in future will be welcome. With best regards -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try Good Data now for free: www.gooddata.com From erlangy@REDACTED Fri Dec 18 23:16:47 2009 From: erlangy@REDACTED (Michael) Date: Fri, 18 Dec 2009 14:16:47 -0800 Subject: [erlang-questions] How configure and debug Erlang networking In-Reply-To: <4d08db370912181404r369ce826wed5e949a2191f37@mail.gmail.com> References: <4d08db370912181404r369ce826wed5e949a2191f37@mail.gmail.com> Message-ID: <20091218221647.GH11530@delora.autosys.us> On Fri, Dec 18, 2009 at 11:04:08PM +0100, Hynek Vychodil wrote: > Hello, > I often stuck in problem with Erlang networking and I don't know how > debug problem and solve it. For example I start VM with erl -sname > server and than another one on same HW erl -sname client. I can see > client@REDACTED and server@REDACTED node names in prompts and than I do > > (client@REDACTED)1> net_adm:ping('server@REDACTED'). > pang > > and got pang. What shall I do now? What is best practice to trace down > networking problem? I know that there is some problem with my_host > resolution but I would like know systematic way how to deal with it. > Beside this I also remember that there is some Erlang specific > networking and name resolving configuration and It was repeatly > mentioned here in mailing list but I can't find proper search criteria > to find it. I have spend more than hour searching documentation (erl, > epmd, inets, ...) and this mailing list without success. It is really > frustrating. > > I would appreciate any help with it. Also some mnemotechnic which help > me in future will be welcome. > > With best regards > > -- > --Hynek (Pichi) Vychodil ________________________________________________________________ this search was useful erlang pang network how to debug See "Why won't my distributed Erlang nodes Communicate?" 9.8 http://erlang.org/faq/faq.html ~Michael From nesrait@REDACTED Fri Dec 18 23:19:45 2009 From: nesrait@REDACTED (=?ISO-8859-1?Q?Davide_Marqu=EAs?=) Date: Fri, 18 Dec 2009 22:19:45 +0000 Subject: [erlang-questions] Imagemagick erlang port In-Reply-To: <46167e6a0912180924m2e9446fep3b991d5a5105035a@mail.gmail.com> References: <45d8e23d0912180849r1788178as425c6ce1e02a5936@mail.gmail.com> <46167e6a0912180924m2e9446fep3b991d5a5105035a@mail.gmail.com> Message-ID: <523869a70912181419h159a6c2i110c598c4c8a5254@mail.gmail.com> The Zotonic CMS (http://zotonic.com/) has some modules (z_media_preview.erl, z_media_preview_server.erl) to interface with ImageMagick. The code is a bit "web-biased" but you should be able to extract the bits you want (I started this process but haven't had time to complete it - I'll send you the files anyway). On Fri, Dec 18, 2009 at 5:24 PM, Anton Krasovsky wrote: > I'm using graphicsmagick as well, with temp files and os:cmd(). Would > be interesting to see something more flexible, the command line > interface is a bit limiting. > > Regards, > Anton > > On Fri, Dec 18, 2009 at 5:04 PM, Koener Antoine > wrote: > > Hi, > > > > On Dec 18, 2009, at 17:49 , Senthilkumar Peelikkampatti wrote: > > > >> Hi, > >> I found image magick driver for so many other languages but > >> not able to find one for Erlang :-) > >> For those not familiar with ImageMagick, it is image manipulation tool > >> which converts one format to another and also does somany other > >> things. Moer here http://imagemagick.com/script/index.php. > > > > You should look at > > graphic magick > > > > http://www.graphicsmagick.org/benchmarks.html > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From nesrait@REDACTED Fri Dec 18 23:40:24 2009 From: nesrait@REDACTED (=?ISO-8859-1?Q?Davide_Marqu=EAs?=) Date: Fri, 18 Dec 2009 22:40:24 +0000 Subject: Web Sockets on Yaws/ewgi Message-ID: <523869a70912181440k7b0040ay9e2578024d3c4edc@mail.gmail.com> Hi all, Yet another Web Sockets implementation, this time for Yaws: http://github.com/davide/yaws/ And if you prefer an ewgi approach: http://github.com/davide/ewgi This one works on Yaws and Mochiweb. I'd like to get it working on Inets but I still haven't figured out a way to prevent Inets from closing the socket (any tips are welcome! :)). Cheers and enjoy the web socket weekend! Davide :) From kiszl@REDACTED Sat Dec 19 10:43:49 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Sat, 19 Dec 2009 10:43:49 +0100 Subject: [erlang-questions] How configure and debug Erlang networking In-Reply-To: <4d08db370912181404r369ce826wed5e949a2191f37@mail.gmail.com> References: <4d08db370912181404r369ce826wed5e949a2191f37@mail.gmail.com> Message-ID: <4B2CA055.10707@tmit.bme.hu> The hosts file is .hosts.erlang, see: http://www.erlang.org/doc/man/net_adm.html#id2330060 . net_adm:host_file(). (and net_adm:world().) will tell you if this file is used. If you start epmd in debug mode ("epmd -d") you can see if the VMs properly connect. erl_epmd:names() can also return the node names registered in epmd at any time. Also you can try manually connecting to the other host by calling net_kernel:connect(Host). Regards, Zoltan Hynek Vychodil wrote: > Hello, > I often stuck in problem with Erlang networking and I don't know how > debug problem and solve it. For example I start VM with erl -sname > server and than another one on same HW erl -sname client. I can see > client@REDACTED and server@REDACTED node names in prompts and than I do > > (client@REDACTED)1> net_adm:ping('server@REDACTED'). > pang > > and got pang. What shall I do now? What is best practice to trace down > networking problem? I know that there is some problem with my_host > resolution but I would like know systematic way how to deal with it. > Beside this I also remember that there is some Erlang specific > networking and name resolving configuration and It was repeatly > mentioned here in mailing list but I can't find proper search criteria > to find it. I have spend more than hour searching documentation (erl, > epmd, inets, ...) and this mailing list without success. It is really > frustrating. > > I would appreciate any help with it. Also some mnemotechnic which help > me in future will be welcome. > > With best regards > > From kiszl@REDACTED Sat Dec 19 10:55:25 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Sat, 19 Dec 2009 10:55:25 +0100 Subject: [erlang-questions] Web Sockets on Yaws/ewgi In-Reply-To: <523869a70912181440k7b0040ay9e2578024d3c4edc@mail.gmail.com> References: <523869a70912181440k7b0040ay9e2578024d3c4edc@mail.gmail.com> Message-ID: <4B2CA30D.2010703@tmit.bme.hu> Hi Davide, May I ask you what is the reason of not using Erlang records in ewgi? You seem to be reimplementing record handling there on purpose. Using records would render most of your getter/setter macros and functions unnecessary saving you a few hundred lines of code. Also the API would be much more straightforward to use. At least for me :). Regards, Zoltan. Davide Marqu?s wrote: > Hi all, > > Yet another Web Sockets implementation, this time for Yaws: > http://github.com/davide/yaws/ > > And if you prefer an ewgi approach: > http://github.com/davide/ewgi > This one works on Yaws and Mochiweb. > I'd like to get it working on Inets but I still haven't figured out a way > to prevent Inets from closing the socket (any tips are welcome! :)). > > Cheers and enjoy the web socket weekend! > Davide :) > > From lovei@REDACTED Sat Dec 19 11:50:09 2009 From: lovei@REDACTED (Lovei Laszlo) Date: Sat, 19 Dec 2009 11:50:09 +0100 Subject: [erlang-questions] Using Dialyzer on Ubuntu 9.10? In-Reply-To: <4B2BB337.1090004@cs.ntua.gr> References: <59da11980912180837n7f19f919la96e28ed4d592998@mail.gmail.com> <4B2BB337.1090004@cs.ntua.gr> Message-ID: <4B2CAFE1.9020403@elte.hu> Kostis Sagonas wrote: > Jeremy Raymond wrote: >> >> Do I need to download/compiler Erlang myself with the debug info to use >> dialyzer or am I missing something here (can I find the debug info >> somewhere >> else)? > > I think you should do yourself a favour and scrap the Ubuntu Erlang > package and instead go for installing yourself the source version of > R13B03, which builds .beam files with debug_info in them (as it should). Why does Dialyzer not support building plt from source code? It would be an easy solution to install the packaged OTP sources and generate the plt from them. > Besides the ability to run dialyzer on your code, you will end up with a > better/newer Erlang system. The installation process itself should be > trivial. You have a point here, but using packaged software has its own advantages too, and Erlang packages in Debian are getting better and better. (Maybe there will be packages built with debug_info sometime, who knows.) Laszlo From kiszl@REDACTED Sat Dec 19 11:57:18 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Sat, 19 Dec 2009 11:57:18 +0100 Subject: [erlang-questions] Using Dialyzer on Ubuntu 9.10? In-Reply-To: <4B2CAFE1.9020403@elte.hu> References: <59da11980912180837n7f19f919la96e28ed4d592998@mail.gmail.com> <4B2BB337.1090004@cs.ntua.gr> <4B2CAFE1.9020403@elte.hu> Message-ID: <4B2CB18E.4030805@tmit.bme.hu> Lovei Laszlo wrote: > Kostis Sagonas wrote: >> Jeremy Raymond wrote: >>> >>> Do I need to download/compiler Erlang myself with the debug info to use >>> dialyzer or am I missing something here (can I find the debug info >>> somewhere >>> else)? >> >> I think you should do yourself a favour and scrap the Ubuntu Erlang >> package and instead go for installing yourself the source version of >> R13B03, which builds .beam files with debug_info in them (as it should). > > Why does Dialyzer not support building plt from source code? It would > be an easy solution to install the packaged OTP sources and generate > the plt from them. > >> Besides the ability to run dialyzer on your code, you will end up >> with a better/newer Erlang system. The installation process itself >> should be trivial. > > You have a point here, but using packaged software has its own > advantages too, and Erlang packages in Debian are getting better and > better. (Maybe there will be packages built with debug_info sometime, > who knows.) > > > Laszlo > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > I still believe the best of both worlds would be to package a pre-built plt along with Erlang. But I have no idea how packaging works, so this might be less trivial than it sounds... Regards, Zoltan. From kostis@REDACTED Sat Dec 19 12:05:00 2009 From: kostis@REDACTED (Kostis Sagonas) Date: Sat, 19 Dec 2009 13:05:00 +0200 Subject: [erlang-questions] Using Dialyzer on Ubuntu 9.10? In-Reply-To: <4B2CAFE1.9020403@elte.hu> References: <59da11980912180837n7f19f919la96e28ed4d592998@mail.gmail.com> <4B2BB337.1090004@cs.ntua.gr> <4B2CAFE1.9020403@elte.hu> Message-ID: <4B2CB35C.6030506@cs.ntua.gr> Lovei Laszlo wrote: > Kostis Sagonas wrote: >> Jeremy Raymond wrote: >>> >>> Do I need to download/compiler Erlang myself with the debug info to use >>> dialyzer or am I missing something here (can I find the debug info >>> somewhere >>> else)? >> >> I think you should do yourself a favour and scrap the Ubuntu Erlang >> package and instead go for installing yourself the source version of >> R13B03, which builds .beam files with debug_info in them (as it should). > > Why does Dialyzer not support building plt from source code? It does. But I doubt that the Ubuntu erlang package includes the source code for libs. > It would be > an easy solution to install the packaged OTP sources and generate the > plt from them. > >> Besides the ability to run dialyzer on your code, you will end up with >> a better/newer Erlang system. The installation process itself should >> be trivial. > > You have a point here, but using packaged software has its own > advantages too, and Erlang packages in Debian are getting better and > better. (Maybe there will be packages built with debug_info sometime, > who knows.) In Debian yes. In Ubuntu not. Apparently, the Ubuntu people who decided distributing erlang without debug_info do not fully understand the consequences of their action (and their excuse is lame). Somebody who cares about Ubuntu should tell them. Kostis From lovei@REDACTED Sat Dec 19 12:29:40 2009 From: lovei@REDACTED (Lovei Laszlo) Date: Sat, 19 Dec 2009 12:29:40 +0100 Subject: [erlang-questions] Using Dialyzer on Ubuntu 9.10? In-Reply-To: <4B2CB35C.6030506@cs.ntua.gr> References: <59da11980912180837n7f19f919la96e28ed4d592998@mail.gmail.com> <4B2BB337.1090004@cs.ntua.gr> <4B2CAFE1.9020403@elte.hu> <4B2CB35C.6030506@cs.ntua.gr> Message-ID: <4B2CB924.8010305@elte.hu> Kostis Sagonas ?rta: > Lovei Laszlo wrote: >> >> Why does Dialyzer not support building plt from source code? > > It does. That's great, how can I do that? "dialyzer --src --build_plt" says "Byte code compiled with debug_info is needed to build the PLT" (at least versions 1.9.2 and 2.1.0). > But I doubt that the Ubuntu erlang package includes the source > code for libs. Well, it doesn't, but at least there is a separate erlang-src package which contains all the sources. (So much for preserving disk space/bandwidth by excluding debug_info...) Laszlo From hynek@REDACTED Sat Dec 19 15:15:21 2009 From: hynek@REDACTED (Hynek Vychodil) Date: Sat, 19 Dec 2009 15:15:21 +0100 Subject: [erlang-questions] How configure and debug Erlang networking In-Reply-To: <4B2CA055.10707@tmit.bme.hu> References: <4d08db370912181404r369ce826wed5e949a2191f37@mail.gmail.com> <4B2CA055.10707@tmit.bme.hu> Message-ID: <4d08db370912190615o3c260333rb4fbc88d4849cf82@mail.gmail.com> Thanks, it was very helpful. It pointed me to proper documentation including http://www.erlang.org/doc/apps/erts/inet_cfg.html which cleared all of mine confusion. On Sat, Dec 19, 2009 at 10:43 AM, Zoltan Lajos Kis wrote: > The hosts file is .hosts.erlang, see: > http://www.erlang.org/doc/man/net_adm.html#id2330060 . > net_adm:host_file(). (and net_adm:world().) will tell you if this file is > used. > > If you start epmd in debug mode ("epmd -d") you can see if the VMs properly > connect. > erl_epmd:names() can also return the node names registered in epmd at any > time. > > Also you can try manually connecting to the other host by calling > net_kernel:connect(Host). > > Regards, > Zoltan > > Hynek Vychodil wrote: >> >> Hello, >> I often stuck in problem with Erlang networking and I don't know how >> debug problem and solve it. For example I start VM with erl -sname >> server and than another one on same HW erl -sname client. I can see >> client@REDACTED and server@REDACTED node names in prompts and than I do >> >> (client@REDACTED)1> net_adm:ping('server@REDACTED'). >> pang >> >> and got pang. What shall I do now? What is best practice to trace down >> networking problem? I know that there is some problem with my_host >> resolution but I would like know systematic way how to deal with it. >> Beside this I also remember that there is some Erlang specific >> networking and name resolving configuration and It was repeatly >> mentioned here in mailing list but I can't find proper search criteria >> to find it. I have spend more than hour searching documentation (erl, >> epmd, inets, ...) and this mailing list without success. It is really >> frustrating. >> >> I would appreciate any help with it. Also some mnemotechnic which help >> me in future will be welcome. >> >> With best regards >> >> > > -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try Good Data now for free: www.gooddata.com From mikma264@REDACTED Sat Dec 19 16:10:49 2009 From: mikma264@REDACTED (Mikael Magnusson) Date: Sat, 19 Dec 2009 16:10:49 +0100 Subject: [erlang-questions] Using Dialyzer on Ubuntu 9.10? In-Reply-To: <4B2CB35C.6030506@cs.ntua.gr> References: <59da11980912180837n7f19f919la96e28ed4d592998@mail.gmail.com> <4B2BB337.1090004@cs.ntua.gr> <4B2CAFE1.9020403@elte.hu> <4B2CB35C.6030506@cs.ntua.gr> Message-ID: <1261235449.2919.10.camel@reyes.hem.za.org> On Sat, 2009-12-19 at 13:05 +0200, Kostis Sagonas wrote: > Lovei Laszlo wrote: > > Kostis Sagonas wrote: > >> Besides the ability to run dialyzer on your code, you will end up with > >> a better/newer Erlang system. The installation process itself should > >> be trivial. > > > > You have a point here, but using packaged software has its own > > advantages too, and Erlang packages in Debian are getting better and > > better. (Maybe there will be packages built with debug_info sometime, > > who knows.) > > In Debian yes. In Ubuntu not. Apparently, the Ubuntu people who > decided distributing erlang without debug_info do not fully understand > the consequences of their action (and their excuse is lame). Somebody > who cares about Ubuntu should tell them. > > Kostis > According to the change logs the patch that disables debug info in Ubuntu 9.10 was inherited from Debian: http://packages.debian.org/changelogs/pool/main/e/erlang/erlang_13.b.2.1-dfsg-1/changelog http://changelogs.ubuntu.com/changelogs/pool/main/e/erlang/erlang_13.b.1-dfsg-2ubuntu1/changelog /Mikael From doug.fort@REDACTED Sat Dec 19 17:01:19 2009 From: doug.fort@REDACTED (Doug Fort) Date: Sat, 19 Dec 2009 11:01:19 -0500 Subject: Identifying modules to load in a release file Message-ID: <5db086ad0912190801h29eddff1ybeff0fa181e3ab5a@mail.gmail.com> How can one identify which library modules to put in the .rel file? For example, if a process uses the ets term storage, you must add {mnesia, "4.4.12"} to the release file. I suspect I'm missing something obvious, but I haven't found a straightforward way determine this. -- Doug Fort, Consulting Programmer http://www.dougfort.com Sent from Arlington, VA, United States From dale@REDACTED Sat Dec 19 17:45:48 2009 From: dale@REDACTED (Dale Harvey) Date: Sat, 19 Dec 2009 16:45:48 +0000 Subject: [erlang-questions] Identifying modules to load in a release file In-Reply-To: <5db086ad0912190801h29eddff1ybeff0fa181e3ab5a@mail.gmail.com> References: <5db086ad0912190801h29eddff1ybeff0fa181e3ab5a@mail.gmail.com> Message-ID: I believe you only need to put in applications which require to be started in order for your app to work, so mnesia / crypto / ssl / sasl are common, ets isnt required (I also use it to add non standard library paths to the build, not sure if thats best practice) 2009/12/19 Doug Fort > How can one identify which library modules to put in the .rel file? For > example, if a process uses the ets term storage, you must add {mnesia, > "4.4.12"} to the release file. I suspect I'm missing something obvious, but > I haven't found a straightforward way determine this. > > -- > Doug Fort, Consulting Programmer > http://www.dougfort.com > Sent from Arlington, VA, United States > From jeraymond@REDACTED Sat Dec 19 18:25:59 2009 From: jeraymond@REDACTED (Jeremy Raymond) Date: Sat, 19 Dec 2009 12:25:59 -0500 Subject: [erlang-questions] Using Dialyzer on Ubuntu 9.10? In-Reply-To: <1261235449.2919.10.camel@reyes.hem.za.org> References: <59da11980912180837n7f19f919la96e28ed4d592998@mail.gmail.com> <4B2BB337.1090004@cs.ntua.gr> <4B2CAFE1.9020403@elte.hu> <4B2CB35C.6030506@cs.ntua.gr> <1261235449.2919.10.camel@reyes.hem.za.org> Message-ID: <59da11980912190925j2611c726k959eedcb56b16034@mail.gmail.com> You're right - it looks like it was taken out in Debian in 1:13.b.1-dfsg-2 but restored in 1:13.b.1-dfsg-6: * Restored debug info in beam files for default build. It's better to use more space than to ship broken modules (debugger, dialyzer)... However Ubuntu (obviously) is still without them. I posted a question on the Ubuntu bug related to this asking if they've included them anywhere else as an alternative as they discussed this in the issue. Jeremy On Sat, Dec 19, 2009 at 10:10 AM, Mikael Magnusson wrote: > On Sat, 2009-12-19 at 13:05 +0200, Kostis Sagonas wrote: > > Lovei Laszlo wrote: > > > Kostis Sagonas wrote: > > >> Besides the ability to run dialyzer on your code, you will end up with > > >> a better/newer Erlang system. The installation process itself should > > >> be trivial. > > > > > > You have a point here, but using packaged software has its own > > > advantages too, and Erlang packages in Debian are getting better and > > > better. (Maybe there will be packages built with debug_info sometime, > > > who knows.) > > > > In Debian yes. In Ubuntu not. Apparently, the Ubuntu people who > > decided distributing erlang without debug_info do not fully understand > > the consequences of their action (and their excuse is lame). Somebody > > who cares about Ubuntu should tell them. > > > > Kostis > > > > According to the change logs the patch that disables debug info in > Ubuntu 9.10 was inherited from Debian: > > > http://packages.debian.org/changelogs/pool/main/e/erlang/erlang_13.b.2.1-dfsg-1/changelog > > http://changelogs.ubuntu.com/changelogs/pool/main/e/erlang/erlang_13.b.1-dfsg-2ubuntu1/changelog > > /Mikael > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From jeraymond@REDACTED Sat Dec 19 18:34:09 2009 From: jeraymond@REDACTED (Jeremy Raymond) Date: Sat, 19 Dec 2009 12:34:09 -0500 Subject: [erlang-questions] Using Dialyzer on Ubuntu 9.10? In-Reply-To: <59da11980912190925j2611c726k959eedcb56b16034@mail.gmail.com> References: <59da11980912180837n7f19f919la96e28ed4d592998@mail.gmail.com> <4B2BB337.1090004@cs.ntua.gr> <4B2CAFE1.9020403@elte.hu> <4B2CB35C.6030506@cs.ntua.gr> <1261235449.2919.10.camel@reyes.hem.za.org> <59da11980912190925j2611c726k959eedcb56b16034@mail.gmail.com> Message-ID: <59da11980912190934o478d76c1vf29f9b164ea469c@mail.gmail.com> I've submitted a bug against Ubuntu to see if they'll put the debug info back in. Feel free to tag this issue as 'affecting you' if interested. https://bugs.launchpad.net/ubuntu/+source/erlang/+bug/498558 Jeremy On Sat, Dec 19, 2009 at 12:25 PM, Jeremy Raymond wrote: > You're right - it looks like it was taken out in Debian in 1:13.b.1-dfsg-2 > but restored in 1:13.b.1-dfsg-6: > > * Restored debug info in beam files for default build. It's better to use > more space than to ship broken modules (debugger, dialyzer)... > > However Ubuntu (obviously) is still without them. I posted a question on > the Ubuntu bug related to this asking if they've included them anywhere > else as an alternative as they discussed this in the issue. > > Jeremy > > On Sat, Dec 19, 2009 at 10:10 AM, Mikael Magnusson wrote: > >> On Sat, 2009-12-19 at 13:05 +0200, Kostis Sagonas wrote: >> > Lovei Laszlo wrote: >> > > Kostis Sagonas wrote: >> > >> Besides the ability to run dialyzer on your code, you will end up >> with >> > >> a better/newer Erlang system. The installation process itself should >> > >> be trivial. >> > > >> > > You have a point here, but using packaged software has its own >> > > advantages too, and Erlang packages in Debian are getting better and >> > > better. (Maybe there will be packages built with debug_info sometime, >> > > who knows.) >> > >> > In Debian yes. In Ubuntu not. Apparently, the Ubuntu people who >> > decided distributing erlang without debug_info do not fully understand >> > the consequences of their action (and their excuse is lame). Somebody >> > who cares about Ubuntu should tell them. >> > >> > Kostis >> > >> >> According to the change logs the patch that disables debug info in >> Ubuntu 9.10 was inherited from Debian: >> >> >> http://packages.debian.org/changelogs/pool/main/e/erlang/erlang_13.b.2.1-dfsg-1/changelog >> >> http://changelogs.ubuntu.com/changelogs/pool/main/e/erlang/erlang_13.b.1-dfsg-2ubuntu1/changelog >> >> /Mikael >> >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> > From kiszl@REDACTED Sat Dec 19 19:16:35 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Sat, 19 Dec 2009 19:16:35 +0100 Subject: [erlang-questions] Identifying modules to load in a release file In-Reply-To: <5db086ad0912190801h29eddff1ybeff0fa181e3ab5a@mail.gmail.com> References: <5db086ad0912190801h29eddff1ybeff0fa181e3ab5a@mail.gmail.com> Message-ID: <4B2D1883.7040806@tmit.bme.hu> All modules should be be grouped into applications. Mnesia is an application, however ets is just a module: it is part of the stdlib application. Each application has a .app file (usually in the ebin dir) that tells the version of the application and lists other applications it depends on. Basically if you ever have an application:start(App) in your sources, it should go here. An example my_app.app, that shows the app is version 0.1, and depends on four applications: {application, my_app, [{description, "My Application"}, {vsn, "0.1"}, ... {applications, [mnesia, sasl, stdlib, kernel]}, ... ] }. Based on these files you should be able to gather the list of all applications you would like to start, and applications they depend on. You can get the version of each application from the .app file (or from the directory name). So the 0.1 release of my_thing for R13B03 should look like: {release, {"my_thing", "0.1"}, {erts, "5.7.4"}, [{my_app, "0.1"}, {mnesia, "4.4.12"}, {sasl, "2.1.8"}, {stdlib, "1.16.4"}, {kernel, "2.13.4"} ] }. Regards, Zoltan. PS.: I guess kernel and stdlib is started anyway, so you don't need to explicitly list them. It probably doesn't make any harm though. Doug Fort wrote: > How can one identify which library modules to put in the .rel file? For > example, if a process uses the ets term storage, you must add {mnesia, > "4.4.12"} to the release file. I suspect I'm missing something obvious, but > I haven't found a straightforward way determine this. > > From doug.fort@REDACTED Sat Dec 19 19:23:50 2009 From: doug.fort@REDACTED (Doug Fort) Date: Sat, 19 Dec 2009 13:23:50 -0500 Subject: [erlang-questions] Identifying modules to load in a release file In-Reply-To: <4B2D1883.7040806@tmit.bme.hu> References: <5db086ad0912190801h29eddff1ybeff0fa181e3ab5a@mail.gmail.com> <4B2D1883.7040806@tmit.bme.hu> Message-ID: <5db086ad0912191023w5bf44f1v3ef1205a2754495a@mail.gmail.com> On Sat, Dec 19, 2009 at 1:16 PM, Zoltan Lajos Kis wrote: > All modules should be be grouped into applications. Mnesia is an > application, however ets is just a module: it is part of the stdlib > application. > > Each application has a .app file (usually in the ebin dir) that tells the > version of the application and lists other applications it depends on. > Basically if you ever have an application:start(App) in your sources, it > should go here. > An example my_app.app, that shows the app is version 0.1, and depends on > four applications: > > {application, my_app, > [{description, "My Application"}, > {vsn, "0.1"}, > ... > {applications, [mnesia, sasl, stdlib, kernel]}, > ... > ] > }. > > Based on these files you should be able to gather the list of all > applications you would like to start, and applications they depend on. > How do I find the applications they depend on? That's my real question. I have an application that works fine in interactive mode, but one of its event handlers doesn't work right in embedded mode. I assume there's something I'm failing to load, but I am anumable to tell what it is from the documentation. > You can get the version of each application from the .app file (or from the > directory name). > So the 0.1 release of my_thing for R13B03 should look like: > > {release, {"my_thing", "0.1"}, {erts, "5.7.4"}, > [{my_app, "0.1"}, > {mnesia, "4.4.12"}, > {sasl, "2.1.8"}, > {stdlib, "1.16.4"}, > {kernel, "2.13.4"} > ] > }. > > Regards, > Zoltan. > > PS.: I guess kernel and stdlib is started anyway, so you don't need to > explicitly list them. It probably doesn't make any harm though. > > > Doug Fort wrote: > >> How can one identify which library modules to put in the .rel file? For >> example, if a process uses the ets term storage, you must add {mnesia, >> "4.4.12"} to the release file. I suspect I'm missing something obvious, >> but >> I haven't found a straightforward way determine this. >> >> >> > > -- Doug Fort, Consulting Programmer http://www.dougfort.com From kiszl@REDACTED Sat Dec 19 19:29:15 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Sat, 19 Dec 2009 19:29:15 +0100 Subject: [erlang-questions] Identifying modules to load in a release file In-Reply-To: <5db086ad0912191023w5bf44f1v3ef1205a2754495a@mail.gmail.com> References: <5db086ad0912190801h29eddff1ybeff0fa181e3ab5a@mail.gmail.com> <4B2D1883.7040806@tmit.bme.hu> <5db086ad0912191023w5bf44f1v3ef1205a2754495a@mail.gmail.com> Message-ID: <4B2D1B7B.8010209@tmit.bme.hu> Doug Fort wrote: > > > On Sat, Dec 19, 2009 at 1:16 PM, Zoltan Lajos Kis > wrote: > > All modules should be be grouped into applications. Mnesia is an > application, however ets is just a module: it is part of the > stdlib application. > > Each application has a .app file (usually in the ebin dir) that > tells the version of the application and lists other applications > it depends on. > Basically if you ever have an application:start(App) in your > sources, it should go here. > An example my_app.app, that shows the app is version 0.1, and > depends on four applications: > > {application, my_app, > [{description, "My Application"}, > {vsn, "0.1"}, > ... > {applications, [mnesia, sasl, stdlib, kernel]}, > ... > ] > }. > > Based on these files you should be able to gather the list of all > applications you would like to start, and applications they depend on. > > > How do I find the applications they depend on? That's my real > question. I have an application that works fine in interactive mode, > but one of its event handlers doesn't work right in embedded mode. I > assume there's something I'm failing to load, but I am anumable to > tell what it is from the documentation. That should result in an undefined function error for the module which is not loaded. Run code:which(Module). in interactive mode; that should point you to the application. > > > > > You can get the version of each application from the .app file (or > from the directory name). > So the 0.1 release of my_thing for R13B03 should look like: > > {release, {"my_thing", "0.1"}, {erts, "5.7.4"}, > [{my_app, "0.1"}, > {mnesia, "4.4.12"}, > {sasl, "2.1.8"}, > {stdlib, "1.16.4"}, > {kernel, "2.13.4"} > ] > }. > > Regards, > Zoltan. > > PS.: I guess kernel and stdlib is started anyway, so you don't > need to explicitly list them. It probably doesn't make any harm > though. > > > Doug Fort wrote: > > How can one identify which library modules to put in the .rel > file? For > example, if a process uses the ets term storage, you must add > {mnesia, > "4.4.12"} to the release file. I suspect I'm missing something > obvious, but > I haven't found a straightforward way determine this. > > > > > > > > -- > Doug Fort, Consulting Programmer > http://www.dougfort.com From nesrait@REDACTED Sat Dec 19 20:16:10 2009 From: nesrait@REDACTED (=?ISO-8859-1?Q?Davide_Marqu=EAs?=) Date: Sat, 19 Dec 2009 19:16:10 +0000 Subject: [erlang-questions] Web Sockets on Yaws/ewgi In-Reply-To: <4B2CA30D.2010703@tmit.bme.hu> References: <523869a70912181440k7b0040ay9e2578024d3c4edc@mail.gmail.com> <4B2CA30D.2010703@tmit.bme.hu> Message-ID: <523869a70912191116g377d0e85vbd5c4a42826908e8@mail.gmail.com> Hi Zoltan, May I ask you what is the reason of not using Erlang records in ewgi? You > seem to be reimplementing record handling there on purpose. > Using records would render most of your getter/setter macros and functions > unnecessary saving you a few hundred lines of code. > I'm a later arrival at the ewgi party, but I can tell there was a lot of care in designing the specification [1]. :) At this point (I think the following is still accurate) the representation matches records and parametrized modules. And using the words of others [2]: > 3. I have come to like the spec as it is now as the record definition >> really >> gives the implementor a set of options, you can >> > 3.a access fields through tuple pattern matching, or >> element(N,ewgi_request) >> 3.b access fields using records >> 3.c access field using the API access functions (and creating responses) >> 3.d write a parameterized module mapping with the same name as the record >> and use getters and setters or other functions (like in Mochiweb). If you >> have a record like >> -record(ewgi_response, { >> status, >> headers=[], >> message_body, >> err >> }). >> >> you can write a parameterized module >> -module(ewgi_response, [Status, Headers, MessageBody, Err]). >> -export([get_status/0]) >> get_status() -> Status >> >> If you then create a record A=#ewgi_response{status=?OK} you can use it as >> parameterized module with A:get_status(), as far as I understood it. Kind >> of >> a dual nature. >> > When receiving a ewgi_context() you can treat in any one of those different ways. The advantage of using the provided functions is that your code becomes future proof. Also the API would be much more straightforward to use. At least for me :). > We'll have to agree on disagreeing on that one. ;) [1] you can follow the various developments over at http://groups.google.com/group/ewgi [2] http://groups.google.com/group/ewgi/browse_thread/thread/4d1cd7b811e2a3db/991fbbf9cf93abe6 Cheers, Davide :) From lovei@REDACTED Sat Dec 19 22:00:56 2009 From: lovei@REDACTED (Lovei Laszlo) Date: Sat, 19 Dec 2009 22:00:56 +0100 Subject: [erlang-questions] Using Dialyzer on Ubuntu 9.10? In-Reply-To: References: <59da11980912180837n7f19f919la96e28ed4d592998@mail.gmail.com> <4B2BB337.1090004@cs.ntua.gr> <4B2CAFE1.9020403@elte.hu> Message-ID: <4B2D3F08.8040204@elte.hu> Tobias Lindahl wrote: > 2009/12/19 Lovei Laszlo : >> Why does Dialyzer not support building plt from source code? > Actually it does. You just need to provide the --src to do this. I believe you that it is capable to support it, but it doesn't do so. The "--src" and "--build_plt" options are simply not accepted together. (I have tried it before asking, really.) > The problem, however, is that you also need to provide all includes, > defines and such that exists in the Makefiles. Thanks, this explains all. Laszlo From elliot.murphy@REDACTED Sun Dec 20 05:54:30 2009 From: elliot.murphy@REDACTED (Elliot Murphy) Date: Sat, 19 Dec 2009 23:54:30 -0500 Subject: [erlang-questions] Using Dialyzer on Ubuntu 9.10? In-Reply-To: <4B2CB35C.6030506@cs.ntua.gr> References: <59da11980912180837n7f19f919la96e28ed4d592998@mail.gmail.com> <4B2BB337.1090004@cs.ntua.gr> <4B2CAFE1.9020403@elte.hu> <4B2CB35C.6030506@cs.ntua.gr> Message-ID: <595970ad0912192054v3b3bc166m332bc6d53840c613@mail.gmail.com> 2009/12/19 Kostis Sagonas : > Lovei Laszlo wrote: >> You have a point here, but using packaged software has its own advantages >> too, and Erlang packages in Debian are getting better and better. (Maybe >> there will be packages built with debug_info sometime, who knows.) Hi Lovei! I made a PPA with the Ubuntu Erlang package rebuilt with debug info a few minutes ago. https://edge.launchpad.net/~erlang-dev/+archive/ppa If you go to that page it will explain how to add the PPA to your Ubuntu system, you should then be able to update and get a rebuilt erlang package installed that included debug info. I have no experience using Dialyzer myself, so I haven't confirmed that the package works although I expect it to. If you or someone else can confirm that the package works and actually contains the debug info I'd appreciate that. > In Debian yes. ?In Ubuntu not. ?Apparently, the Ubuntu people who decided > distributing erlang without debug_info do not fully understand the > consequences of their action (and their excuse is lame). ?Somebody who cares > about Ubuntu should tell them. Wow Kostis that's a rather rude comment. What is the lame excuse that you are talking about? From my firsthand knowledge of the situation in both Debian and Ubuntu as it evolved (and speaking as the manager of the dev team that petitioned to have Erlang included in the default Ubuntu install), the Ubuntu developers do understand the consequences, which are that building a smaller runtime made the erlang packages small enough that we could fit them and CouchDB onto the LiveCD and ship CouchDB installed by default for all desktop Ubuntu installs. I realize this creates an inconvenience for Erlang developers who aren't building Erlang from source, and just never got around to setting up an alternate PPA. I do care about making Erlang development easy on Ubuntu (although I am not an official Ubuntu developer), which is why I'm working on setting up this PPA at 11:45 PM on a saturday night. Jeremy, although I first noticed this discussion because of following erlang-questions, I really appreciate you submitting that bug report to Ubuntu and including all the details. I think the bug should be closed as wontfix, and I hope the PPA that I set up helps solve the problem. In fact, I'm open to working on getting newer releases of Erlang into that or a similar PPA to make life even better for people who are doing erlang development work on Ubuntu. My full response in the bug is available here: https://bugs.edge.launchpad.net/ubuntu/+source/erlang/+bug/498558/comments/2 -- Elliot Murphy | https://launchpad.net/~statik/ From leap@REDACTED Sun Dec 20 06:33:44 2009 From: leap@REDACTED (Michael Turner) Date: Sun, 20 Dec 2009 05:33:44 +0000 Subject: "Erlang as a First Language" -- crazy? or just stupid? Message-ID: That's what I'm wondering. I'm holding out for a possible Answer #3: "Sure, at least if they are smart enough." I might have "smart enough" covered. I'm working on a project in the overlap between cognitive science and linguistics. These people aren't necessarily math-heavy (on the linguistics side, anyway), but they can tolerate odd notations, abstruse jargon and fine conceptual distinctions that would evoke only dread, if not nausea, in ordinary folk. I've been evaluating Erlang for this project in the only way I think possible: after having identified what's important and what's not in a language/system for this project, and seeing that Erlang roughly matches up, I started writing modeling code. Here's where the matchup is clearly bad, from a lifecycle point of view: Erlang is still a small minority language. Sure, it's possible that a mini-gold-rush is starting for it, and if so, that's good for Erlang, mid- to long-term. But in my experience, the sudden appearance of money can make the programmer supply situation worse in research circles: hackers in academia start getting head-hunted ferociously. What I'm working on is likely to remain a lab creature for years, if it's viable at all. Somebody besides me has got to be able to support it, eventually if not sooner. So I'm thinking maybe the more adept users might be good candidates for the role of programmers as well. But you see the problem: it might mean that Erlang is effectively their first language. Maybe they had a little exposure in high school or an elementary programming course in college. At most. And maybe that experience even turned them off a little. What are the first-language learnability issues with Erlang? I'm poorly qualified to think about this. Although I wouldn't say I learn programming languages quickly, I don't have major blocks either. Over the last 40 years, I've probably written something more significant than "Hello, world" in more languages than I have fingers. When I run across a term like "atom", I think, "probably lisp-like", and I'm off to the races. I never really hacked Prolog, but having done it a little helped a lot with with Erlang. Even Pascal helped: that nagging little terminator-vs-separator distinction with semicolons and whatnot had migrated up into my ulnar tendons since college (so *that's* why they hurt sometimes!), but made it back down to my fingers pretty quickly when called. So taking up Erlang in my mid-fifties is only making me think, "Why didn't I start with it before my hair went totally grey?" Maybe this isn't the best list for asking this question, because probably most of you are like me anyway, in spirit if not in age. But I can't think where else to ask. -michael turner From tony@REDACTED Sun Dec 20 06:59:46 2009 From: tony@REDACTED (Tony Arcieri) Date: Sat, 19 Dec 2009 22:59:46 -0700 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: References: Message-ID: On Sat, Dec 19, 2009 at 10:33 PM, Michael Turner wrote: > That's what I'm wondering. I'm holding out for a possible Answer #3: > "Sure, at least if they are smart enough." > If you want to start with a functional language you might be better off starting with something like Scheme: http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/ -- Tony Arcieri Medioh! A Kudelski Brand From corticalcomputer@REDACTED Sun Dec 20 08:41:57 2009 From: corticalcomputer@REDACTED (G.S.) Date: Sat, 19 Dec 2009 23:41:57 -0800 Subject: Running Erlang on POWER5,6,7 vs Core 2, i7... Message-ID: <2a67d3ff0912192341y316beddre9ae90fa9923dfab@mail.gmail.com> Anyone has any experience on running Erlang for highly distributed (thousands or millions of processes) systems on POWER and i7 CPUs? and can share their experience and comparisons? Regards, -Gene From rapsey@REDACTED Sun Dec 20 08:46:09 2009 From: rapsey@REDACTED (Rapsey) Date: Sun, 20 Dec 2009 08:46:09 +0100 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: References: Message-ID: <97619b170912192346r59c5a0b2yd62fdc5d36556ad3@mail.gmail.com> People manage to have Perl as their first language and still turn into competent developers. I don't see a reason why not Erlang as a first language. Sergej On Sun, Dec 20, 2009 at 6:59 AM, Tony Arcieri wrote: > On Sat, Dec 19, 2009 at 10:33 PM, Michael Turner wrote: > > > That's what I'm wondering. I'm holding out for a possible Answer #3: > > "Sure, at least if they are smart enough." > > > > If you want to start with a functional language you might be better off > starting with something like Scheme: > > http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/ > > -- > Tony Arcieri > Medioh! A Kudelski Brand > From egarrulo@REDACTED Sun Dec 20 09:09:34 2009 From: egarrulo@REDACTED (egarrulo) Date: Sun, 20 Dec 2009 09:09:34 +0100 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: References: Message-ID: <9bd8a08a0912200009u7bc3c3f9y62198c9c783bdc49@mail.gmail.com> Erlang is not suitable for beginners. The language is simple enough, however tool support and API documentation aren't. THE language for beginners is Scheme, and DrScheme is the tool of choice for teaching or learning it. People use DrScheme for commercial development too. Second (distant) choice would be Python. 2009/12/20 Michael Turner > > That's what I'm wondering. I'm holding out for a possible Answer #3: > "Sure, at least if they are smart enough." > > I might have "smart enough" covered. I'm working on a project in the > overlap between cognitive science and linguistics. These people aren't > necessarily math-heavy (on the linguistics side, anyway), but they can > tolerate odd notations, abstruse jargon and fine conceptual distinctions > that would evoke only dread, if not nausea, in ordinary folk. > > I've been evaluating Erlang for this project in the only way I think > possible: after having identified what's important and what's not in a > language/system for this project, and seeing that Erlang roughly matches > up, I started writing modeling code. > > Here's where the matchup is clearly bad, from a lifecycle point of view: > Erlang is still a small minority language. Sure, it's possible that a > mini-gold-rush is starting for it, and if so, that's good for Erlang, > mid- to long-term. But in my experience, the sudden appearance of money > can make the programmer supply situation worse in research circles: > hackers in academia start getting head-hunted ferociously. What I'm > working on is likely to remain a lab creature for years, if it's viable > at all. Somebody besides me has got to be able to support it, > eventually if not sooner. So I'm thinking maybe the more adept users > might be good candidates for the role of programmers as well. > > But you see the problem: it might mean that Erlang is effectively their > first language. Maybe they had a little exposure in high school or an > elementary programming course in college. At most. And maybe that > experience even turned them off a little. > > What are the first-language learnability issues with Erlang? I'm poorly > qualified to think about this. Although I wouldn't say I learn > programming languages quickly, I don't have major blocks either. Over > the last 40 years, I've probably written something more significant > than "Hello, world" in more languages than I have fingers. When I run > across a term like "atom", I think, "probably lisp-like", and I'm > off to the races. I never really hacked Prolog, but having done it a > little helped a lot with with Erlang. Even Pascal helped: that nagging > little terminator-vs-separator distinction with semicolons and whatnot > had migrated up into my ulnar tendons since college (so *that's* why > they hurt sometimes!), but made it back down to my fingers pretty > quickly when called. So taking up Erlang in my mid-fifties is only > making me think, "Why didn't I start with it before my hair went > totally grey?" > > Maybe this isn't the best list for asking this question, because > probably most of you are like me anyway, in spirit if not in age. But I > can't think where else to ask. > > -michael turner > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From jilani@REDACTED Sun Dec 20 10:10:38 2009 From: jilani@REDACTED (Jilani Khaldi) Date: Sun, 20 Dec 2009 10:10:38 +0100 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? Message-ID: <4B2DEA0E.9070006@cheapnet.it> Why not Prolog? From wikipedia (http://en.wikipedia.org/wiki/Prolog) [Prolog is a general purpose logic programming language associated with artificial intelligence and computational linguistics. Prolog has its roots in formal logic, and unlike many other programming languages, Prolog is declarative: The program logic is expressed in terms of relations, represented as facts and rules. Execution is triggered by running queries over these relations.] Prolog has almost the same syntax of Erlang (the first Erlang interpreters have been written in Prolog!). There are many free Prolog interpreters and even native compilers. -- Jilani KHALDI From andrewmmc@REDACTED Sun Dec 20 10:21:06 2009 From: andrewmmc@REDACTED (andrew mmc) Date: Sun, 20 Dec 2009 10:21:06 +0100 Subject: [erlang-questions] Running Erlang on POWER5,6,7 vs Core 2, i7... In-Reply-To: <2a67d3ff0912192341y316beddre9ae90fa9923dfab@mail.gmail.com> References: <2a67d3ff0912192341y316beddre9ae90fa9923dfab@mail.gmail.com> Message-ID: If you are thinking about making a purchase, IBM will give you free access to their internal machines to allow you to make this comparison. Andrew On Sun, Dec 20, 2009 at 8:41 AM, G.S. wrote: > Anyone has any experience on running Erlang for highly distributed > (thousands or millions of processes) systems on POWER and i7 CPUs? and can > share their experience and comparisons? > > Regards, > -Gene > From egarrulo@REDACTED Sun Dec 20 10:35:53 2009 From: egarrulo@REDACTED (egarrulo) Date: Sun, 20 Dec 2009 10:35:53 +0100 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: References: Message-ID: <9bd8a08a0912200135k15284536w9ba01027f770fcd3@mail.gmail.com> Returning to your original question, teaching Erlang as a first language is neither stupid nor crazy. It's just not a sound decision. Forget the syntax, since it just scares away those used to C-like languages. When I got used to it, I realized that Erlang syntax is very consistent. However, when teaching a first programming language, syntax is not the main issue. A friendly environment is. My first programming language was C on Windows. Not the easiest language to learn, but thank to the IDE, the comprehensive library, examining a faulty program or checking out the documentation was a breeze. Therefore, please do not evaluate just the syntax of a language. Evaluate the environment instead. Put yourself in a newbie's shoes and ask yourself how would the environment help you when things will not work and when you'll have to learn, install and use a new library? Good luck! 2009/12/20 Michael Turner > > That's what I'm wondering. I'm holding out for a possible Answer #3: > "Sure, at least if they are smart enough." > > I might have "smart enough" covered. I'm working on a project in the > overlap between cognitive science and linguistics. These people aren't > necessarily math-heavy (on the linguistics side, anyway), but they can > tolerate odd notations, abstruse jargon and fine conceptual distinctions > that would evoke only dread, if not nausea, in ordinary folk. > > I've been evaluating Erlang for this project in the only way I think > possible: after having identified what's important and what's not in a > language/system for this project, and seeing that Erlang roughly matches > up, I started writing modeling code. > > Here's where the matchup is clearly bad, from a lifecycle point of view: > Erlang is still a small minority language. Sure, it's possible that a > mini-gold-rush is starting for it, and if so, that's good for Erlang, > mid- to long-term. But in my experience, the sudden appearance of money > can make the programmer supply situation worse in research circles: > hackers in academia start getting head-hunted ferociously. What I'm > working on is likely to remain a lab creature for years, if it's viable > at all. Somebody besides me has got to be able to support it, > eventually if not sooner. So I'm thinking maybe the more adept users > might be good candidates for the role of programmers as well. > > But you see the problem: it might mean that Erlang is effectively their > first language. Maybe they had a little exposure in high school or an > elementary programming course in college. At most. And maybe that > experience even turned them off a little. > > What are the first-language learnability issues with Erlang? I'm poorly > qualified to think about this. Although I wouldn't say I learn > programming languages quickly, I don't have major blocks either. Over > the last 40 years, I've probably written something more significant > than "Hello, world" in more languages than I have fingers. When I run > across a term like "atom", I think, "probably lisp-like", and I'm > off to the races. I never really hacked Prolog, but having done it a > little helped a lot with with Erlang. Even Pascal helped: that nagging > little terminator-vs-separator distinction with semicolons and whatnot > had migrated up into my ulnar tendons since college (so *that's* why > they hurt sometimes!), but made it back down to my fingers pretty > quickly when called. So taking up Erlang in my mid-fifties is only > making me think, "Why didn't I start with it before my hair went > totally grey?" > > Maybe this isn't the best list for asking this question, because > probably most of you are like me anyway, in spirit if not in age. But I > can't think where else to ask. > > -michael turner > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From egarrulo@REDACTED Sun Dec 20 10:41:28 2009 From: egarrulo@REDACTED (egarrulo) Date: Sun, 20 Dec 2009 10:41:28 +0100 Subject: Why hasn't Erlang a regular newsgroup? Message-ID: <9bd8a08a0912200141u75aaa1d3y8b92f50658f90819@mail.gmail.com> Hello, why hasn't Erlang a regular newsgroup instead of a mailing list? A newsgroup would be easier to check, without having to subscribe/unsubscribe, and a news reader would make easier to follow discussions. Thanks. From max.lapshin@REDACTED Sun Dec 20 11:09:53 2009 From: max.lapshin@REDACTED (Max Lapshin) Date: Sun, 20 Dec 2009 13:09:53 +0300 Subject: [erlang-questions] Why hasn't Erlang a regular newsgroup? In-Reply-To: <9bd8a08a0912200141u75aaa1d3y8b92f50658f90819@mail.gmail.com> References: <9bd8a08a0912200141u75aaa1d3y8b92f50658f90819@mail.gmail.com> Message-ID: Maybe, because it is impossible to read newsgroups from gmail interface? From ulf.wiger@REDACTED Sun Dec 20 11:12:24 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Sun, 20 Dec 2009 11:12:24 +0100 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: References: Message-ID: <4B2DF888.30007@erlang-consulting.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Michael Turner wrote: > That's what I'm wondering. I'm holding out for a possible Answer #3: > "Sure, at least if they are smart enough." Frank Huch used Erlang as a vehicle for teaching programming to high-school girls with no prior experience in programming or computer science. They took to it very well, and finished the one-week course by writing a distributed chat application. Not that this was unique to Erlang. It was a variant of the Kara program http://www.swisseduc.ch/compscience/karatojava/kara/ but Huch's opinion was that Erlang was a much better fit than Java, which was the language of the original Kara program. http://portal.acm.org/citation.cfm?id=1292534 BR, Ulf W -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkst+IgACgkQtqqFieqzed2K6gCdFYw5SGxamurdwaaMcqYTAe43 BJgAnAlH6qqNoOhC81M+Ns+fS7Or7X6M =xD8d -----END PGP SIGNATURE----- --------------------------------------------------- This is a domain disclaimer for erlang-consulting.com From egarrulo@REDACTED Sun Dec 20 11:18:32 2009 From: egarrulo@REDACTED (Elena) Date: Sun, 20 Dec 2009 02:18:32 -0800 (PST) Subject: Ignore this message, it's just a test. Message-ID: <6c3ec9e5-a3ef-4ded-b173-7414027402cb@c3g2000yqd.googlegroups.com> Ignore this message, it's just a test. From filippo.pacini@REDACTED Sun Dec 20 11:20:29 2009 From: filippo.pacini@REDACTED (filippo pacini) Date: Sun, 20 Dec 2009 11:20:29 +0100 Subject: [erlang-questions] Web Sockets on Yaws/ewgi In-Reply-To: <4B2CA30D.2010703@tmit.bme.hu> References: <523869a70912181440k7b0040ay9e2578024d3c4edc@mail.gmail.com> <4B2CA30D.2010703@tmit.bme.hu> Message-ID: Hi Zoltan, 2009/12/19 Zoltan Lajos Kis : > > May I ask you what is the reason of not using Erlang records in ewgi? You > seem to be reimplementing record handling there on purpose. > Using records would render most of your getter/setter macros and functions > unnecessary saving you a few hundred lines of code. > Also the API would be much more straightforward to use. At least for me :). > at the last EUC I talked with Hunter Morris about this. We both agreed that removing records from the implementation was probably not a good idea. We will put them back soon. The API interface however will remain at its place so that, as Davide said, code written using the APIS will be future proof. cheers, filippo From egarrulo@REDACTED Sun Dec 20 11:21:25 2009 From: egarrulo@REDACTED (egarrulo) Date: Sun, 20 Dec 2009 11:21:25 +0100 Subject: [erlang-questions] Why hasn't Erlang a regular newsgroup? In-Reply-To: References: <9bd8a08a0912200141u75aaa1d3y8b92f50658f90819@mail.gmail.com> Message-ID: <9bd8a08a0912200221q7fc3d007ld8798e32455ee1a1@mail.gmail.com> Well, I've just discovered I can effectively access this mailing-list from http://groups.google.com/group/erlang-programming Thanks 2009/12/20 Max Lapshin > Maybe, because it is impossible to read newsgroups from gmail interface? > From v@REDACTED Sun Dec 20 11:50:27 2009 From: v@REDACTED (Valentin Micic) Date: Sun, 20 Dec 2009 12:50:27 +0200 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: Message-ID: <20091220105039.A2D313D0D4A@mail.pharos-avantgard.com> Erlang as a First Language is neither crazy nor stupid. It's a consequence. V/ From erlang@REDACTED Sun Dec 20 12:56:24 2009 From: erlang@REDACTED (Illo de' Illis) Date: Sun, 20 Dec 2009 12:56:24 +0100 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: References: Message-ID: <07BCA22A-E5D5-4EDF-8706-E3FF15B91B76@trainedmonkeys.net> I don't think Mr.Turner needs advice on an alternative language, since he already found erlang to be suitable for the purpose of his class (and by the way I'd like to know in which way erlang is helpful when dealing with cognitive science in respect to other functional languages with distributed support). He's just asking whether teaching it to students who are mostly unaware of computer programming is reasonable. My very humble opinion is that the somewhat confused mixup of declarative paradigms and the clunky environment could both slow down the learning process and leave students with a bunch of methodological gaps in the way they relate to programming languages. I'd really love to hear Mr. Richard O'Keefe's point of view on the matter, though. From victor.sovetov@REDACTED Sun Dec 20 16:10:15 2009 From: victor.sovetov@REDACTED (Viktor Sovietov) Date: Sun, 20 Dec 2009 07:10:15 -0800 (PST) Subject: Running Erlang on POWER5,6,7 vs Core 2, i7... In-Reply-To: <2a67d3ff0912192341y316beddre9ae90fa9923dfab@mail.gmail.com> References: <2a67d3ff0912192341y316beddre9ae90fa9923dfab@mail.gmail.com> Message-ID: <1badf3d3-0d90-410d-9dba-b97b575a51a4@b2g2000yqi.googlegroups.com> Gene We have such experience (real-time monitoring and control system for HPC clusters and datacenters), but Erlang's scheme of nodes clustering won't work on really big installations. The current approach to nodes linking isn't very scalable at all, though. Sincerely, --Viktor On Dec 20, 9:41?am, "G.S." wrote: > Anyone has any experience on running Erlang for highly distributed > (thousands or millions of processes) systems on POWER and i7 CPUs? ?and can > share their experience and comparisons? > > Regards, > -Gene From jeraymond@REDACTED Sun Dec 20 17:12:32 2009 From: jeraymond@REDACTED (Jeremy Raymond) Date: Sun, 20 Dec 2009 11:12:32 -0500 Subject: [erlang-questions] Using Dialyzer on Ubuntu 9.10? In-Reply-To: <595970ad0912192054v3b3bc166m332bc6d53840c613@mail.gmail.com> References: <59da11980912180837n7f19f919la96e28ed4d592998@mail.gmail.com> <4B2BB337.1090004@cs.ntua.gr> <4B2CAFE1.9020403@elte.hu> <4B2CB35C.6030506@cs.ntua.gr> <595970ad0912192054v3b3bc166m332bc6d53840c613@mail.gmail.com> Message-ID: <59da11980912200812j4f9b5aacy6736f7ccaed5d393@mail.gmail.com> I've installed the Erlang packages with the erlang-dev ppa and the dialyzer is happy. I'd love to see the newer Erlang releases available also as you suggest in the bug comments. Is this much work to do? Also where would one locate the general information about the Ubuntu Erlang packages? I'd be great if the info on adding the Erlang dev ppa were available wherever the normal documentation is for this. Had these ppa been available earlier where would I have looked to know of it's existence? Where can I get info on updates? Thanks a lot. Your quick responses and support on this are much appreciated! On Sat, Dec 19, 2009 at 11:54 PM, Elliot Murphy wrote: > 2009/12/19 Kostis Sagonas : > > Lovei Laszlo wrote: > >> You have a point here, but using packaged software has its own > advantages > >> too, and Erlang packages in Debian are getting better and better. (Maybe > >> there will be packages built with debug_info sometime, who knows.) > > Hi Lovei! > > I made a PPA with the Ubuntu Erlang package rebuilt with debug info a > few minutes ago. > https://edge.launchpad.net/~erlang-dev/+archive/ppa > If you go to that page it will explain how to add the PPA to your > Ubuntu system, you should then be able to update and get a rebuilt > erlang package installed that included debug info. > > I have no experience using Dialyzer myself, so I haven't confirmed > that the package works although I expect it to. If you or someone else > can confirm that the package works and actually contains the debug > info I'd appreciate that. > > > In Debian yes. In Ubuntu not. Apparently, the Ubuntu people who decided > > distributing erlang without debug_info do not fully understand the > > consequences of their action (and their excuse is lame). Somebody who > cares > > about Ubuntu should tell them. > > Wow Kostis that's a rather rude comment. What is the lame excuse that > you are talking about? From my firsthand knowledge of the situation in > both Debian and Ubuntu as it evolved (and speaking as the manager of > the dev team that petitioned to have Erlang included in the default > Ubuntu install), the Ubuntu developers do understand the consequences, > which are that building a smaller runtime made the erlang packages > small enough that we could fit them and CouchDB onto the LiveCD and > ship CouchDB installed by default for all desktop Ubuntu installs. I > realize this creates an inconvenience for Erlang developers who aren't > building Erlang from source, and just never got around to setting up > an alternate PPA. I do care about making Erlang development easy on > Ubuntu (although I am not an official Ubuntu developer), which is why > I'm working on setting up this PPA at 11:45 PM on a saturday night. > > Jeremy, although I first noticed this discussion because of following > erlang-questions, I really appreciate you submitting that bug report > to Ubuntu and including all the details. I think the bug should be > closed as wontfix, and I hope the PPA that I set up helps solve the > problem. In fact, I'm open to working on getting newer releases of > Erlang into that or a similar PPA to make life even better for people > who are doing erlang development work on Ubuntu. My full response in > the bug is available here: > > https://bugs.edge.launchpad.net/ubuntu/+source/erlang/+bug/498558/comments/2 > > -- > Elliot Murphy | https://launchpad.net/~statik/ > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From tony@REDACTED Sun Dec 20 18:23:23 2009 From: tony@REDACTED (Tony Arcieri) Date: Sun, 20 Dec 2009 10:23:23 -0700 Subject: yecc: Behavior change when encountering valid-yet-incomplete token sequences? Message-ID: As far as I can tell, in a recent release of Erlang yecc's behavior changed when it encountered a sequence of tokens that is valid within the grammar, but it ran out of tokens before the constructs it's parsing are complete. In previous releases, you could identify the "need more tokens" state by the line number it returned with the error, which was 999999 when it ran out of tokens at the end of the buffer. It seems this is no longer the case? If I'm correct, what's the new way to identify the "need more tokens" state? -- Tony Arcieri Medioh! A Kudelski Brand From egarrulo@REDACTED Sun Dec 20 18:38:13 2009 From: egarrulo@REDACTED (Elena) Date: Sun, 20 Dec 2009 09:38:13 -0800 (PST) Subject: Why hasn't Erlang a regular newsgroup? In-Reply-To: <9bd8a08a0912200221q7fc3d007ld8798e32455ee1a1@mail.gmail.com> References: <9bd8a08a0912200141u75aaa1d3y8b92f50658f90819@mail.gmail.com> <9bd8a08a0912200221q7fc3d007ld8798e32455ee1a1@mail.gmail.com> Message-ID: However, your messages are discarded unless you are subscribed. Therefore, maybe this group is managed on a mailing-list to avoid spam (your messages would be ignored). On Dec 20, 11:21?am, egarrulo wrote: > Well, I've just discovered I can effectively access this mailing-list fromhttp://groups.google.com/group/erlang-programming > > Thanks > > 2009/12/20 Max Lapshin > > > > > Maybe, because it is impossible to read newsgroups from gmail interface? From tony@REDACTED Sun Dec 20 18:38:17 2009 From: tony@REDACTED (Tony Arcieri) Date: Sun, 20 Dec 2009 10:38:17 -0700 Subject: yecc: Behavior change when encountering valid-yet-incomplete token sequences? In-Reply-To: References: Message-ID: I'm wondering if this can be identified by the token at which the error occurred being nil (i.e. []) -- Tony Arcieri Medioh! A Kudelski Brand From klas.johansson@REDACTED Sun Dec 20 23:06:39 2009 From: klas.johansson@REDACTED (Klas Johansson) Date: Sun, 20 Dec 2009 23:06:39 +0100 Subject: [erlang-questions] Bug in epmd_srv.c? In-Reply-To: References: Message-ID: Hi, On Thu, Sep 3, 2009 at 11:24 PM, Dave Smith wrote: > Hi all, > > I've been working on a helper module to enable usage of epmd > for things other than just nodes (i.e. poor man's zeroconf > service). In the process, I've found some discrepancies in the > epmd documentation and server code. I _think_ there is a bug or > two there, but would appreciate validation by the OTP team -- > it could just be a lack of understanding on my part. :) > > First off, the docs for the distribution protocol state that > the ALIVE2_REQ has the field "LowestVersion" followed > by "HighestVersion". However, the implementation in > erl_epmd.erl has them reversed as does the documentation for > the PORT2_RESP packet. This is, I believe, a minor > documentation bug. Now I too have been bitten by this. This patch places the `highest version' field before the `lowest version' field in the docs, just as in the source code: git fetch git://github.com/klajo/otp.git epmd_alive2req_version_ordering > Secondly, in erts/epmd/src/epmd_srv.c:628 (R13B01), there is > the following line: > > offset += (strlen(node->extra)-1); > > Unfortunately, if the length of the extra field is zero, this > causes the last byte of the packet to disappear as it winds up > decrementing "offset". > > Reading through epmd, it looks like the expectation is that the > extra field is null-terminated --- but the docs make no mention > of it. This is somewhat odd to me as that field is prefixed > with a 2 byte length value in the protocol, so I see no reason > for the implementation to require the data to be a C string. Of > course, this may be for backwards compatibility purposes; it's > hard to know for sure. I stumbled upon this one as well and had a go at fixing it. Before the change I discovered that (according to docs, fields are a two-byte length followed by the value itself [1]): * <<0>> instead of <<0, 0>> was returned when extra was <<>> (truncated) * <<0, 4, 4, 1, 2>> instead of <<0, 4, 1, 2, 3, 4>> was returned when extra was <<1, 2, 3, 4>> (truncated and garbled; actually the second byte of the length is duplicated) The fix tries to address that. I'm not too sure about the fix though, since this is in some sense not a backwards compatible fix (since extra and it's length will be different). However, since the previous version truncated (and garbled) the "extra" field and erl_epmd.erl doesn't seem to care about it it might not be that big a deal. Perhaps for some other third-party libraries or other parts of Erlang/OTP (ei, jinterface, ...; I haven't checked)? Also, I'm not that confident in modifying the epmd... :-) I've attached a test case which illustrates the problem. Get the code here: git fetch git://github.com/klajo/otp.git epmd_port2resp_trunc_extra I'd be happy to hear from someone who's more well-versed in the epmd and the distribution protocol. Kind Regards, Klas [1] http://www.erlang.org/doc/apps/erts/erl_dist_protocol.html -------------- next part -------------- A non-text attachment was scrubbed... Name: epmd_extra.erl Type: application/octet-stream Size: 2656 bytes Desc: not available URL: From jarrod@REDACTED Mon Dec 21 00:21:47 2009 From: jarrod@REDACTED (Jarrod Roberson) Date: Sun, 20 Dec 2009 18:21:47 -0500 Subject: [erlang-questions] Why hasn't Erlang a regular newsgroup? In-Reply-To: <9bd8a08a0912200141u75aaa1d3y8b92f50658f90819@mail.gmail.com> References: <9bd8a08a0912200141u75aaa1d3y8b92f50658f90819@mail.gmail.com> Message-ID: if you HAVE to have an NNTP style interface then use Gmane. http://news.gmane.org/gmane.comp.lang.erlang.general From jarrod@REDACTED Mon Dec 21 00:22:54 2009 From: jarrod@REDACTED (Jarrod Roberson) Date: Sun, 20 Dec 2009 18:22:54 -0500 Subject: [erlang-questions] Why hasn't Erlang a regular newsgroup? In-Reply-To: <9bd8a08a0912200141u75aaa1d3y8b92f50658f90819@mail.gmail.com> References: <9bd8a08a0912200141u75aaa1d3y8b92f50658f90819@mail.gmail.com> Message-ID: http://dir.gmane.org/gmane.comp.lang.erlang.general From jarrod@REDACTED Mon Dec 21 01:55:03 2009 From: jarrod@REDACTED (Jarrod Roberson) Date: Sun, 20 Dec 2009 19:55:03 -0500 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: References: Message-ID: Actually Erlang as a first language is not that bad of an idea, especially if the only thing the person will ever support is that one application. Erlang is hard to learn for people coming from imperative C based syntax languages and especially those with decades of experience. 20 years of doing something a particular way is hard to UN-learn. If I had learned Erlang and functional programming first it would have been much easier to pickup, and would have made learning other imperative C-ish syntax languages "foreign" instead of the other way around. Lots of people that learn Erlang as a 5th or 6th or more language tend to judge the learning curve based on their Previous experience learning other languages. If you know C, then C++, Java, Python, Ruby, Perl, PHP or whatever is just learning a different syntax for the most part. Learning Erlang is also having to throw out a lot of stuff you "know" to learn a different paradigm of thinking on how to structure your decomposition of a problem into functional terms. From dizzyd@REDACTED Mon Dec 21 04:01:19 2009 From: dizzyd@REDACTED (Dave Smith) Date: Sun, 20 Dec 2009 20:01:19 -0700 Subject: [erlang-questions] Bug in epmd_srv.c? In-Reply-To: References: Message-ID: On Sun, Dec 20, 2009 at 3:06 PM, Klas Johansson wrote: > The fix tries to address that. ?I'm not too sure about the fix > though, since this is in some sense not a backwards compatible > fix (since extra and it's length will be different). ?However, > since the previous version truncated (and garbled) the "extra" > field and erl_epmd.erl doesn't seem to care about it it might not > be that big a deal. ?Perhaps for some other third-party libraries > or other parts of Erlang/OTP (ei, jinterface, ...; I haven't > checked)? ?Also, I'm not that confident in modifying the > epmd... :-) I've attached a test case which illustrates the > problem. ?Get the code here: It's been a while since I've looked at this, but at first glance it seems to me that while your patch solves the case where extra is a typical null-terminated string, it does not address the problem where extra has binary data with nulls sprinkled throughout. To deal with this, you'd need to add a field to track the length of extra (instead of depending on strlen) and also replace the strcpy on 627 to a memcpy. Hope that helps. :) I am very glad to see someone else looking at it. Extra would be quite useful to have working properly. D. From kika@REDACTED Mon Dec 21 07:03:51 2009 From: kika@REDACTED (Cyril Pertsev) Date: Mon, 21 Dec 2009 09:03:51 +0300 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: References: Message-ID: <4B2F0FC7.9090504@kikap.com> Jarrod Roberson wrote: > Actually Erlang as a first language is not that bad of an idea, especially > if the only thing the person will ever support is that one application. > Erlang is hard to learn for people coming from imperative C based syntax > languages and especially those with decades of experience. > 20 years of doing something a particular way is hard to UN-learn. I guess that this difficulty is greatly overestimated at times. I have 20 years of experience programming in C, C++, Perl and many other similar languages, I'm 40 years old (that's old) and I started coding a production application in Erlang just after I read Joe's book on a couple of long distance flights. And guess what, the application is pretty much successful, I did a lot of mistakes in the course of development, but I would have done them in any other language as well, just different. We're very small company developing very complex and ambitious product so I have to combine many management roles with the role of the developer and I found FP and Erlang in particular very well suited for people with ADD like me. You just don't need to remember about all possible consequences of, say, *p++ because a) there's no *p and b) there's no consequences except for the return value. Erlang is, in fact, a very good example of first time language, not because the language itself is so great, but because I teaches a very useful concept - MPI-based multiprocessing. > If I had learned Erlang and functional programming first it would have been > much easier to pickup, and would have made learning other imperative C-ish > syntax languages "foreign" instead of the other way around. I'd object here as well. Uninitiated programmer takes C++, learns template wizardry and carefully develops a complete incomprehensible mess in the code. FP programmer being forced to develop in C++ develops much less error prone and stable 'functional' C++ code (being still incomprehensible, though). My C++ habits improved after learning Erlang. My take at the answer to the subject line is 'crazy, but smart'. Best regards, Cyril > > Lots of people that learn Erlang as a 5th or 6th or more language tend to > judge the learning curve based on their Previous experience learning other > languages. > If you know C, then C++, Java, Python, Ruby, Perl, PHP or whatever is just > learning a different syntax for the most part. Learning Erlang is also > having to throw out a lot of stuff you "know" to learn a different paradigm > of thinking on how to structure your decomposition of a problem into > functional terms. > From klas.johansson@REDACTED Mon Dec 21 08:51:48 2009 From: klas.johansson@REDACTED (Klas Johansson) Date: Mon, 21 Dec 2009 08:51:48 +0100 Subject: [erlang-questions] Bug in epmd_srv.c? In-Reply-To: References: Message-ID: Hi Dave, On Mon, Dec 21, 2009 at 4:01 AM, Dave Smith wrote: > On Sun, Dec 20, 2009 at 3:06 PM, Klas Johansson > wrote: > >> The fix tries to address that. I'm not too sure about the fix >> though, since this is in some sense not a backwards compatible >> fix (since extra and it's length will be different). However, >> since the previous version truncated (and garbled) the "extra" >> field and erl_epmd.erl doesn't seem to care about it it might not >> be that big a deal. Perhaps for some other third-party libraries >> or other parts of Erlang/OTP (ei, jinterface, ...; I haven't >> checked)? Also, I'm not that confident in modifying the >> epmd... :-) I've attached a test case which illustrates the >> problem. Get the code here: > > It's been a while since I've looked at this, but at first glance it > seems to me that while your patch solves the case where extra is a > typical null-terminated string, it does not address the problem where > extra has binary data with nulls sprinkled throughout. To deal with > this, you'd need to add a field to track the length of extra (instead > of depending on strlen) and also replace the strcpy on 627 to a > memcpy. True. I've made a new version, which takes that into account. I introduced a new field into the Node/enode struct which remembers the length of the "extra" when a node is registered in the epmd, and uses that length together with a memcpy when building the PORT2_RESP. I'd love to hear from the Erlang/OTP team and their take on this. I can push it back to github later on today, if there are no other things to take into account. > Hope that helps. :) I am very glad to see someone else looking at it. > Extra would be quite useful to have working properly. :-) Thanks for your feedback. BR, Klas From erlang@REDACTED Mon Dec 21 10:15:45 2009 From: erlang@REDACTED (Joe Armstrong) Date: Mon, 21 Dec 2009 10:15:45 +0100 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: References: Message-ID: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> On Mon, Dec 21, 2009 at 1:55 AM, Jarrod Roberson wrote: > Actually Erlang as a first language is not that bad of an idea, especially > if the only thing the person will ever support is that one application. > Erlang is hard to learn for people coming from imperative C based syntax > languages and especially those with decades of experience. > 20 years of doing something a particular way is hard to UN-learn. How do you know Erlang is hard to learn - what evidence do you have for this statement? I have taught Erlang to a few hundred people, mostly with a C background. My experience was that my pupils did not find it hard to learn. In my experience I find that programmers are good in all languages or non. A good C programmer will become a good Erlang programmer or a good python programmer ... A bad C programmer will become a bad Erlang programmer and so on ... (this is actually a gross over-generalization, but is not bad as a first-order approximation of the truth) Having taught Erlang many times the stuff that is hard to learn is the details of the syntax - specifically getting the commas right, mixing up atoms with variables - but this is the same in *every* language - get the odd semicolon wrong in javascript and you can stare at the program for hours wondering what is wrong. On the other hand the *concepts* - immutable variables, pattern matching, as so on are easily grasped - people don't have problems here. People do have a problem with using processes, links and the philosophy of error handling since these concept do not exist (or are very primitive) in languages like C - this is the area where experience helps. As regards teaching beginners, it depends what kind of programs these beginners want to write. If you target a particular group of programmers and produce the right educational material this should be doable - the current Erlang books are specifically not targeted at beginners. When I wrote my book we targeted "A practicing Java programmer" - in fact we tried the text out on a few Java programmers to see if we got the level right. If I were writing a book for intended for complete beginners (ie the "first language" market) I'd make it a lot thinner and a lot shorter and miss out loads of details. My son did a C++ course at school when he was 16/17 ish - to my amazement the course book didn't even talk about objects - it was basically a sub-set of the C subset of C++, with a tiny bit of syntax tips so you could actually compile your programs. /Joe > > If I had learned Erlang and functional programming first it would have been > much easier to pickup, and would have made learning other imperative C-ish > syntax languages "foreign" instead of the other way around. > > Lots of people that learn Erlang as a 5th or 6th or more language tend to > judge the learning curve based on their Previous experience learning other > languages. > If you know C, then C++, Java, Python, Ruby, Perl, PHP or whatever is just > learning a different syntax for the most part. Learning Erlang is also > having to throw out a lot of stuff you "know" to learn a different paradigm > of thinking on how to structure your decomposition of a problem into > functional terms. > From clist@REDACTED Mon Dec 21 11:00:53 2009 From: clist@REDACTED (Angel Alvarez) Date: Mon, 21 Dec 2009 11:00:53 +0100 Subject: [erlang-questions] Bug in epmd_srv.c? In-Reply-To: References: Message-ID: <200912211100.53785.clist@uah.es> El Lunes, 21 de Diciembre de 2009 04:01:19 Dave Smith escribi?: > On Sun, Dec 20, 2009 at 3:06 PM, Klas Johansson > wrote: > > > The fix tries to address that. ?I'm not too sure about the fix > > though, since this is in some sense not a backwards compatible > > fix (since extra and it's length will be different). ?However, > > since the previous version truncated (and garbled) the "extra" > > field and erl_epmd.erl doesn't seem to care about it it might not > > be that big a deal. ?Perhaps for some other third-party libraries > > or other parts of Erlang/OTP (ei, jinterface, ...; I haven't > > checked)? ?Also, I'm not that confident in modifying the > > epmd... :-) I've attached a test case which illustrates the > > problem. ?Get the code here: > > It's been a while since I've looked at this, but at first glance it > seems to me that while your patch solves the case where extra is a > typical null-terminated string, it does not address the problem where > extra has binary data with nulls sprinkled throughout. To deal with > this, you'd need to add a field to track the length of extra (instead > of depending on strlen) and also replace the strcpy on 627 to a > memcpy. > > Hope that helps. :) I am very glad to see someone else looking at it. > Extra would be quite useful to have working properly. > > D. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > Why epmd is not erlang code? -- No imprima este correo si no es necesario. El medio ambiente est? en nuestras manos. __________________________________________ Clist UAH a.k.a Angel __________________________________________ MySQL5: Vale, corromper los datos de forma silente no era una buena idea despues de todo. From bgustavsson@REDACTED Mon Dec 21 12:06:49 2009 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Mon, 21 Dec 2009 12:06:49 +0100 Subject: [erlang-patches] Re: [erlang-questions] Bug in epmd_srv.c? In-Reply-To: References: Message-ID: <6672d0160912210306y43ebcc4dg63ea136b6a573bea@mail.gmail.com> On Sun, Dec 20, 2009 at 11:06 PM, Klas Johansson wrote: > Now I too have been bitten by this. This patch places the > `highest version' field before the `lowest version' field in the > docs, just as in the source code: > Thanks! I have applied your patch directly to the development branch (it will turn up later today in the git repository), with one minor change (referring to the next field for possible values no longer make sense, so I copied the line "The value in R6B and later is 5" from the other version number). >> Secondly, in erts/epmd/src/epmd_srv.c:628 (R13B01), there is >> the following line: >> >> offset += (strlen(node->extra)-1); [...] I'll wait for your updated version. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bgustavsson@REDACTED Mon Dec 21 12:15:18 2009 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Mon, 21 Dec 2009 12:15:18 +0100 Subject: [erlang-questions] Bug in epmd_srv.c? In-Reply-To: <200912211100.53785.clist@uah.es> References: <200912211100.53785.clist@uah.es> Message-ID: <6672d0160912210315n5d25f20dle79913ffdffe220e@mail.gmail.com> On Mon, Dec 21, 2009 at 11:00 AM, Angel Alvarez wrote: > Why epmd is not erlang code? I think the reason is that when epmd was originally written, Erlang did not have any libraries for accessing TCP/IP sockets (or if they existed, they were not efficient enough, because they used a port program, not a driver). The gen_tcp module and the inet_driver were implemented much later. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From leap@REDACTED Mon Dec 21 15:29:51 2009 From: leap@REDACTED (Michael Turner) Date: Mon, 21 Dec 2009 14:29:51 +0000 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> Message-ID: <3BHgSuhp.1261405791.5964000.leap@gol.com> I'm very encouraged by the interest in this topic, and by the diversity of the replies. They have already given me some interesting ideas for a strategy. I might allow a day or two before I write a summary and a response. For now, just to make a few points clear: (1) I won't be teaching a class. Anyway, that's not my plan. A modest website with tutorials and starter packages, with no promised support except to the researchers I'm working directly with -- that's the most I'm thinking about right now. Even teaching a class for that select few is not likely -- I'm on the other side of the world from them, and this is unfunded work. (2) Don't underestimate how hostile some of these people can be to the idea of programming at all. One researcher I'm corresponding with recently wrote me that he'd rather peel his skin off than write code. If you're having trouble understanding this perspective, here's a way to think about it: imagine you could work on your dream project, the kind of system you've always wanted to be creating. Earning 10% more than the highest hourly rate you've ever commanded. With your choice of programming environments. Got that image set? OK, there's a catch. You know that "choice of environments" I mentioned? Here it is: you can write it in Object-Oriented Cobol for an IBM AS/400 with a green-screen glass-tty terminal, or in Fortran 90 while telnetted from Windows 95 into a DEC VMS system. THAT's how some of these people would feel at the outset about any programming language, and an environment like the Erlang shell. -michael turner From jarrod@REDACTED Mon Dec 21 15:55:23 2009 From: jarrod@REDACTED (Jarrod Roberson) Date: Mon, 21 Dec 2009 09:55:23 -0500 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> References: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> Message-ID: On Mon, Dec 21, 2009 at 4:15 AM, Joe Armstrong wrote: > On Mon, Dec 21, 2009 at 1:55 AM, Jarrod Roberson > wrote: > > Actually Erlang as a first language is not that bad of an idea, > especially > > if the only thing the person will ever support is that one application. > > Erlang is hard to learn for people coming from imperative C based syntax > > languages and especially those with decades of experience. > > 20 years of doing something a particular way is hard to UN-learn. > > How do you know Erlang is hard to learn - what evidence do you have > for this statement? > my personal experience and the personal experience of friends of mine when we decided to teach ourselves Erlang and functional programming. Unlearning 25 years of imperative procedural thinking is not easy. I have had much success hacking at Erlang and asking questions here on the list only to confirm that the code I wrote is just Java in Erlang. It is really hard to un-learn what you "know how to do". My argument is that Erlang and functional programming would be easier to learn FIRST. I started out with BASIC and ASM on 6502's back in the mid-80's. I am 100% self-taught, having a mentor or teacher to ask questions interactively would probably lower the bar to functional programming would lower the bar to entry. All my friends that have a CS background unanimously say that LISP was the hardest course they took in school. Thinking in recursive pattern matching functional paradigms is hard for most people it seems. What would make learning Erlang much easier to learn on your own would be a "Thinking in Erlang" style book. As good as your book is Joe, and I have it and read it many times now, is it doesn't really teach me how to Think in functional terms. Something of a Rosetta stone of here is how you do something in Java/C++/Python, here is what the idiom is in Erlang would be great. As I figure stuff out, with the wonderful help of this group, I am posting about my "discoveries" on my blog. It is helping my friends follow along behind me and learn what I have learned from my perspective. From kika@REDACTED Mon Dec 21 16:19:36 2009 From: kika@REDACTED (Cyril Pertsev) Date: Mon, 21 Dec 2009 18:19:36 +0300 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: <3BHgSuhp.1261405791.5964000.leap@gol.com> References: <3BHgSuhp.1261405791.5964000.leap@gol.com> Message-ID: <4B2F9208.5070300@kikap.com> Michael Turner wrote: > of programming environments. Got that image set? OK, there's a catch. > You know that "choice of environments" I mentioned? Here it is: you > can write it in Object-Oriented Cobol for an IBM AS/400 with a > green-screen glass-tty terminal, or in Fortran 90 while telnetted from AS/400 is the one of the greatest systems in the world, given birth to many modern technologies, sometimes many years ahead of time. IMHO, people who say 'What?!? You want me to program in XXX? No way!" are not programmers, they're coders. And there's absolutely no point in teaching Erlang to them unless they have an immediate need in coding something in Erlang right next week. Whereas programmers solve problems using computers, explaining the solution to the computer using a language. There're less suitable languages for the problem and more suitable, but almost no bad or good languages. They're all good and bad. Personally, I'd love to write something in OOCobol for AS/400, despite the fact that I don't know Cobol :-) It might be a useful and fun experience. Best regards, Cyril From leap@REDACTED Mon Dec 21 16:42:34 2009 From: leap@REDACTED (Michael Turner) Date: Mon, 21 Dec 2009 15:42:34 +0000 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: <4B2F9208.5070300@kikap.com> Message-ID: This is off-topic but I thought I'd comment approvingly anyway: Cyril here is actually a nice combination of well-informed and open-minded. That AS/400 was architecturally visionary and conceptually sophisticated is a pretty well-kept IBM secret. As for OO COBOL, it might have been a better way to bring object orientation into the mainstream than C++ or even Java, since COBOL is actually a pretty accessible language for mere mortals, and there might still be more running COBOL in the world than any other language. Grace Murray Hopper would have approved of OO COBOL, I'm sure, and she was a revolutionary, and even the great grandmother of Open Source in a way. Kids these days -- they know nothing! I was just trying to start with average-hacker emotional reactions, whether they reflected prejudices or not. -michael turner On 12/21/2009, "Cyril Pertsev" wrote: >Michael Turner wrote: >> of programming environments. Got that image set? OK, there's a catch. >> You know that "choice of environments" I mentioned? Here it is: you >> can write it in Object-Oriented Cobol for an IBM AS/400 with a >> green-screen glass-tty terminal, or in Fortran 90 while telnetted from > >AS/400 is the one of the greatest systems in the world, given birth to >many modern technologies, sometimes many years ahead of time. > >IMHO, people who say 'What?!? You want me to program in XXX? No way!" >are not programmers, they're coders. And there's absolutely no point in >teaching Erlang to them unless they have an immediate need in coding >something in Erlang right next week. Whereas programmers solve problems >using computers, explaining the solution to the computer using a >language. There're less suitable languages for the problem and more >suitable, but almost no bad or good languages. They're all good and bad. > >Personally, I'd love to write something in OOCobol for AS/400, despite >the fact that I don't know Cobol :-) It might be a useful and fun >experience. > >Best regards, >Cyril > > > >________________________________________________________________ >erlang-questions mailing list. See http://www.erlang.org/faq.html >erlang-questions (at) erlang.org > > From toby@REDACTED Mon Dec 21 17:01:18 2009 From: toby@REDACTED (Toby Thain) Date: Mon, 21 Dec 2009 11:01:18 -0500 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: References: Message-ID: <6B634CE1-8284-45A4-B5FD-A2314F064A16@telegraphics.com.au> On 20-Dec-09, at 7:55 PM, Jarrod Roberson wrote: > Actually Erlang as a first language is not that bad of an idea, > especially > if the only thing the person will ever support is that one > application. > Erlang is hard to learn for people coming from imperative C based > syntax > languages and especially those with decades of experience. > 20 years of doing something a particular way is hard to UN-learn. > Data point: As somebody who's coded mainly C for 20 years - I did not find that at all. It took only 2 or 3 days to get well acquainted and start building something. The primitives and syntax are not difficult. I'd call it a breath of fresh air. As everybody says, it was mostly fun from that point forward. Compared to C-like imperative languages it is impressively less code (estimates of 1/4 to 1/10 seem quite realistic). The reduction in tedium in favour of expressiveness would seem strongly in Erlang's favour as a teaching language. --Toby > If I had learned Erlang and functional programming first it would > have been > much easier to pickup, and would have made learning other > imperative C-ish > syntax languages "foreign" instead of the other way around. > > Lots of people that learn Erlang as a 5th or 6th or more language > tend to > judge the learning curve based on their Previous experience > learning other > languages. > If you know C, then C++, Java, Python, Ruby, Perl, PHP or whatever > is just > learning a different syntax for the most part. Learning Erlang is also > having to throw out a lot of stuff you "know" to learn a different > paradigm > of thinking on how to structure your decomposition of a problem into > functional terms. From max.lapshin@REDACTED Mon Dec 21 17:09:30 2009 From: max.lapshin@REDACTED (Max Lapshin) Date: Mon, 21 Dec 2009 19:09:30 +0300 Subject: Erlang server and log rotating Message-ID: Hi. As erlyvideo is growing (bwt, it has moved to repo http://github.com/erlyvideo/erlyvideo and soon will work site http://erlyvideo.org), I meet new problems: logs and logrotating. I've been using runit for some time and found it very convenient: no need to daemonize program, its output is logged to some directory with automatic logrotation. It is very important issue: using runit, no need to setup logrotate and restart program: runit logger will rotate logs itself. I have not found, how to do it with erlang otp. How to rotate logs per-size and delete old ones? Second problem is, that I want to have not otp-style log, I need to log in apache-style. What is good practice to have logger, separate from error_logger? From ciprian.craciun@REDACTED Mon Dec 21 19:09:53 2009 From: ciprian.craciun@REDACTED (Ciprian Dorin, Craciun) Date: Mon, 21 Dec 2009 20:09:53 +0200 Subject: Function name macro (the counterpart of ?MODULE) Message-ID: <8e04b5820912211009v517552b0p7abb14c5459abf42@mail.gmail.com> Hy all! Maybe this question has been asked a thousand times, but please forgive and bare with me just one more time... :) So as predefined macros we have ?MODULE, ?FILE, and ?LINE... But there is no ?FUNCTION (that should give me the current function name). Now my question is: why isn't there any such macro? (I would guess that having such a macro is not so complicated...) And what can I do to obtain a similar functionality? Thanks, Ciprian. From g@REDACTED Mon Dec 21 19:22:36 2009 From: g@REDACTED (Garrett Smith) Date: Mon, 21 Dec 2009 12:22:36 -0600 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: References: Message-ID: On Sat, Dec 19, 2009 at 11:33 PM, Michael Turner wrote: > What are the first-language learnability issues with Erlang? ?I'm poorly > qualified to think about this. My college level intro course in Computer Science presented "algorithms" as a building block for the rest of the couse. We used Pascal. I was later at the University of Edinburgh where they used ML. The introductory phases in that course centered on functions, recursion, and logic. I think imperative languages are far more helpful in helping students grok the traditional "stack" of computers and software, at least moving from the language toward the hardware. This journey: Pascal -> C -> assembler -> microcode/chipset I think is very intuitive and doesn't distract the student with higher level abstractions early in the learning process. So if the student's goal is to move toward Von Neumann architectures, etc. I'd start with C or even basic. Those may seem like dated languages, but they're great starting places if you're next step is assembler. As a language for learning functional programming, I think Erlang is a great choice - because it's very both simple and extremely practical. Joe's book, as an example, shows how quickly you can get down to using the language to build cool little programs. One of my stumbling blocks in learning (and using) ML was that it didn't give me a sense of "writing software". I felt more like a mathematician or logician using a computer than a software developer. (I haven't kept up with ML - my experience was waay back in the day - so it may be very different today.) Erlang is being used by commercial and open source hackers to build *amazing* software. If you're approaching a student of computer science, you'd be hard pressed to find a functional language that provided a more immediate sense of gratification than Erlang - and IMO that should be a factor in deciding what to teach. Garrett From vasilij.savin@REDACTED Mon Dec 21 20:12:25 2009 From: vasilij.savin@REDACTED (Vasilij Savin) Date: Mon, 21 Dec 2009 21:12:25 +0200 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: References: Message-ID: Greetings, I do not think that teaching people C first is a good idea. C requires quite a mental leap towards understanding computer internals. Students have to grapple with a lot of C specifics, compared to learning how to program. I have heard opinions that Python could be a good language to be taught as first one, it is simple and friendly enough for newcomers. In Uppsala University, students are taught ML as the first programming language that is simple enough to learn in its entirety within one semester. I am quite convinced that functional programming is important to teach in the beginning of the career. It allows to write efficient and compact code. Recursion is usually just mentioned when learning C-like languages because it is practically impossible to use it in real applications. Recursion, tail-recursion, pattern matching are really powerful concepts that students should be taught as soon as possible. Just some insights from still a student. Regards, Vasilij Savin From torben.lehoff@REDACTED Mon Dec 21 20:44:04 2009 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Mon, 21 Dec 2009 20:44:04 +0100 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: References: Message-ID: Seasonal greetings from Denmark. I would like to second Vasilij based on my own track record. Back in 1992 at the Technical University of Denmark (DTU) at the Informatics line of study were taught SML in the first semester in the spirit of what later became a book: http://www.it.dtu.dk/introSML/ It allowed us to accomplish a lot more than when I years later taught Java to freshmen. Yes, you can use Java as a first language, but for a large portion of the students there will be major parts that are more or less Voodoo. To the defense of Java there is the ability to have fun with GUI, but it comes at the expense of having to live with half-baked understanding of programming and Java. After learning SML we finished the first semester by writing a parser, scanner and interpreter for a simple imperative language. That is simply so much above what can be accomplished with Java or similar languages. On this foundation we went on to learn some 10-15 different languages in 5 years since DTU at that time had not converted to mono-languaism (i.e., Java) WITHOUT any problems. I have yet to see similar ease of learning a new language for students starting with Java et al. Regarding unlearning imperative habbits: for some this can be quite hard. With Erlang you have to learn both functional programming and concurrency in order to write elegant programs or at least programs that does not inflict too much pain on yourself. As long as you think like an imperative person that is simply not easy to grasp. I would still encourage people to invest in the learning as it will make the code you write in other languages better! BTW: this holds true for any new paradigm you pick up, so even after seeing the light (i.e., learning Erlang) there are still things out there that should be learnt!! For newcomers to programming I would recommend something like the SML book above or Francesco and Simon's Erlang book. Other functional languages most likely have books that will do for them. A bonus would be to be able to write a GUI easily since that can be used to make some fun games which normally gets most people energised - I used that format when I taught Java at DTU and they sticked to that theme for 6 years! Rock'n'roll Erlang! Torben On Mon, Dec 21, 2009 at 20:12, Vasilij Savin wrote: > Greetings, > > I do not think that teaching people C first is a good idea. C requires > quite > a mental leap towards understanding computer internals. Students have to > grapple with a lot of C specifics, compared to learning how to program. I > have heard opinions that Python could be a good language to be taught as > first one, it is simple and friendly enough for newcomers. > > In Uppsala University, students are taught ML as the first programming > language that is simple enough to learn in its entirety within one > semester. > > I am quite convinced that functional programming is important to teach in > the beginning of the career. It allows to write efficient and compact code. > Recursion is usually just mentioned when learning C-like languages because > it is practically impossible to use it in real applications. > > Recursion, tail-recursion, pattern matching are really powerful concepts > that students should be taught as soon as possible. > > Just some insights from still a student. > > Regards, > Vasilij Savin > -- http://www.linkedin.com/in/torbenhoffmann From attila.r.nohl@REDACTED Mon Dec 21 21:09:49 2009 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Mon, 21 Dec 2009 21:09:49 +0100 Subject: [erlang-questions] Function name macro (the counterpart of ?MODULE) In-Reply-To: <8e04b5820912211009v517552b0p7abb14c5459abf42@mail.gmail.com> References: <8e04b5820912211009v517552b0p7abb14c5459abf42@mail.gmail.com> Message-ID: <401d3ba30912211209s50f5ed27oa6122d47131ff187@mail.gmail.com> 2009/12/21, Ciprian Dorin, Craciun : > Hy all! > > Maybe this question has been asked a thousand times, but please > forgive and bare with me just one more time... :) > > So as predefined macros we have ?MODULE, ?FILE, and ?LINE... But > there is no ?FUNCTION (that should give me the current function name). > > Now my question is: why isn't there any such macro? (I would guess > that having such a macro is not so complicated...) And what can I do > to obtain a similar functionality? I haven't tested, but you can try something like this: catch throw x, [{_, Fun, _} | _] = erlang:get_stacktrace(). From paul-trapexit@REDACTED Mon Dec 21 21:51:59 2009 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Mon, 21 Dec 2009 12:51:59 -0800 (PST) Subject: [erlang-questions] Function name macro (the counterpart of ?MODULE) In-Reply-To: <401d3ba30912211209s50f5ed27oa6122d47131ff187@mail.gmail.com> References: <8e04b5820912211009v517552b0p7abb14c5459abf42@mail.gmail.com> <401d3ba30912211209s50f5ed27oa6122d47131ff187@mail.gmail.com> Message-ID: On Mon, 21 Dec 2009, Attila Rajmund Nohl wrote: > 2009/12/21, Ciprian Dorin, Craciun : > > Hy all! > > > > Maybe this question has been asked a thousand times, but please > > forgive and bare with me just one more time... :) > > > > So as predefined macros we have ?MODULE, ?FILE, and ?LINE... But > > there is no ?FUNCTION (that should give me the current function name). > > > > Now my question is: why isn't there any such macro? (I would guess > > that having such a macro is not so complicated...) And what can I do > > to obtain a similar functionality? > > I haven't tested, but you can try something like this: > > catch throw x, > [{_, Fun, _} | _] = erlang:get_stacktrace(). for a solution without run-time overhead, you could write a parse transform which looked for a function call like _FUNCTION () and transformed it to a constant atom. ulf's ct_expand is easy to modify to do these kinds of things. -- p From kiszl@REDACTED Mon Dec 21 23:53:48 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Mon, 21 Dec 2009 23:53:48 +0100 Subject: [erlang-questions] Function name macro (the counterpart of ?MODULE) In-Reply-To: <8e04b5820912211009v517552b0p7abb14c5459abf42@mail.gmail.com> References: <8e04b5820912211009v517552b0p7abb14c5459abf42@mail.gmail.com> Message-ID: <4B2FFC7C.2060502@tmit.bme.hu> Hi Ciprian, The ?MODULE, ?FILE and ?LINE macros can be handled by simple text processing, without touching any Erlang syntax. ?FUNCTION would not be that simple... Anyway, as suggested, this can be done by using parse transforms. Below is a working version; others will hopefully fix my mistakes :) After compiling module z, you should get the expected results. Regards, Zoltan. --------- zt.hrl --------- -define(FUNCTION, '__function_macro__'). -define(ARITY, '__function_arity__'). --------- zt.erl --------- -export([parse_transform/2]). -include("zt.hrl"). parse_transform(AST, _Options) -> [parse(T) || T <- AST]. parse({function, _, FName, FArity, _} = T) -> erl_syntax_lib:map(fun(TE) -> parsemacro(FName, FArity, TE) end, T); parse(T) -> T. parsemacro(FName, FArity, T) -> erl_syntax:revert( case erl_syntax:type(T) of atom -> case erl_syntax:atom_value(T) of ?FUNCTION -> erl_syntax:atom(FName); ?ARITY -> erl_syntax:integer(FArity); _ -> T end; _ -> T end ). --------- z.erl --------- -module(z). -compile({parse_transform, zt}). -export([a/0, b/1, c/2]). -include("zt.hrl"). a() -> {?MODULE, ?FUNCTION, ?ARITY}. b(_X) -> {?MODULE, ?FUNCTION, ?ARITY}. c(_X, _Y) -> {?MODULE, ?FUNCTION, ?ARITY}. Ciprian Dorin, Craciun wrote: > Hy all! > > Maybe this question has been asked a thousand times, but please > forgive and bare with me just one more time... :) > > So as predefined macros we have ?MODULE, ?FILE, and ?LINE... But > there is no ?FUNCTION (that should give me the current function name). > > Now my question is: why isn't there any such macro? (I would guess > that having such a macro is not so complicated...) And what can I do > to obtain a similar functionality? > > Thanks, > Ciprian. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From caio.ariede@REDACTED Tue Dec 22 00:01:46 2009 From: caio.ariede@REDACTED (caio ariede) Date: Mon, 21 Dec 2009 21:01:46 -0200 Subject: Using match in guards Message-ID: <6a9ba5690912211501q72465230t4dc4f5e8bd7b736c@mail.gmail.com> In function guards we can use functions like is_string/1 and is_number/1. But I'm needing to check a generic type defined by {type, Value} but *in guards* like this: search(S) when N = {regex, _} -> ... I know that I can do that with search(S = {regex, _}), but my example was only for representing the problem. The main question is: there is a way for using match in guards? Or something like this? Caio Ariede http://caioariede.com/ From caio.ariede@REDACTED Tue Dec 22 00:02:55 2009 From: caio.ariede@REDACTED (caio ariede) Date: Mon, 21 Dec 2009 21:02:55 -0200 Subject: Using match in guards In-Reply-To: <6a9ba5690912211501q72465230t4dc4f5e8bd7b736c@mail.gmail.com> References: <6a9ba5690912211501q72465230t4dc4f5e8bd7b736c@mail.gmail.com> Message-ID: <6a9ba5690912211502y588b15f9p52ae0b9be1bae802@mail.gmail.com> Just correcting my example: search(S) when S = {regex, _} -> ... Caio Ariede http://caioariede.com/ On Mon, Dec 21, 2009 at 9:01 PM, caio ariede wrote: > In function guards we can use functions like is_string/1 and is_number/1. > > But I'm needing to check a generic type defined by {type, Value} but > *in guards* like this: > > search(S) when N = {regex, _} -> > ... > > I know that I can do that with search(S = {regex, _}), but my example > was only for representing the problem. > > The main question is: there is a way for using match in guards? Or > something like this? > > Caio Ariede > http://caioariede.com/ > From kiszl@REDACTED Tue Dec 22 00:07:17 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Tue, 22 Dec 2009 00:07:17 +0100 Subject: [erlang-questions] Re: Using match in guards In-Reply-To: <6a9ba5690912211502y588b15f9p52ae0b9be1bae802@mail.gmail.com> References: <6a9ba5690912211501q72465230t4dc4f5e8bd7b736c@mail.gmail.com> <6a9ba5690912211502y588b15f9p52ae0b9be1bae802@mail.gmail.com> Message-ID: <4B2FFFA5.4070407@tmit.bme.hu> search({regex, _} = S) -> ... Zoltan. caio ariede wrote: > Just correcting my example: > > search(S) when S = {regex, _} -> > ... > > Caio Ariede > http://caioariede.com/ > > > > On Mon, Dec 21, 2009 at 9:01 PM, caio ariede wrote: > >> In function guards we can use functions like is_string/1 and is_number/1. >> >> But I'm needing to check a generic type defined by {type, Value} but >> *in guards* like this: >> >> search(S) when N = {regex, _} -> >> ... >> >> I know that I can do that with search(S = {regex, _}), but my example >> was only for representing the problem. >> >> The main question is: there is a way for using match in guards? Or >> something like this? >> >> Caio Ariede >> http://caioariede.com/ >> >> > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From kiszl@REDACTED Tue Dec 22 00:10:33 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Tue, 22 Dec 2009 00:10:33 +0100 Subject: [erlang-questions] Re: Using match in guards In-Reply-To: <4B2FFFA5.4070407@tmit.bme.hu> References: <6a9ba5690912211501q72465230t4dc4f5e8bd7b736c@mail.gmail.com> <6a9ba5690912211502y588b15f9p52ae0b9be1bae802@mail.gmail.com> <4B2FFFA5.4070407@tmit.bme.hu> Message-ID: <4B300069.9000904@tmit.bme.hu> Sorry, sent it too early :) Wanted to ask for an example where this format cannot be used. Zoltan Lajos Kis wrote: > search({regex, _} = S) -> > ... > > Zoltan. > > caio ariede wrote: >> Just correcting my example: >> >> search(S) when S = {regex, _} -> >> ... >> >> Caio Ariede >> http://caioariede.com/ >> >> >> >> On Mon, Dec 21, 2009 at 9:01 PM, caio ariede >> wrote: >> >>> In function guards we can use functions like is_string/1 and >>> is_number/1. >>> >>> But I'm needing to check a generic type defined by {type, Value} but >>> *in guards* like this: >>> >>> search(S) when N = {regex, _} -> >>> ... >>> >>> I know that I can do that with search(S = {regex, _}), but my example >>> was only for representing the problem. >>> >>> The main question is: there is a way for using match in guards? Or >>> something like this? >>> >>> Caio Ariede >>> http://caioariede.com/ >>> >>> >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From dale@REDACTED Tue Dec 22 00:34:53 2009 From: dale@REDACTED (Dale Harvey) Date: Mon, 21 Dec 2009 23:34:53 +0000 Subject: [erlang-questions] Re: Using match in guards In-Reply-To: <4B300069.9000904@tmit.bme.hu> References: <6a9ba5690912211501q72465230t4dc4f5e8bd7b736c@mail.gmail.com> <6a9ba5690912211502y588b15f9p52ae0b9be1bae802@mail.gmail.com> <4B2FFFA5.4070407@tmit.bme.hu> <4B300069.9000904@tmit.bme.hu> Message-ID: you can use macros to clean up some of the checks, but you cant test for something thats impossible with a guard test -define(is_regex(A), (is_tuple(A) andalso (element(1, A) == regex))). search(S) when ?is_regex(S) -> 2009/12/21 Zoltan Lajos Kis > Sorry, sent it too early :) Wanted to ask for an example where this format > cannot be used. > > > Zoltan Lajos Kis wrote: > >> search({regex, _} = S) -> >> ... >> >> Zoltan. >> >> caio ariede wrote: >> >>> Just correcting my example: >>> >>> search(S) when S = {regex, _} -> >>> ... >>> >>> Caio Ariede >>> http://caioariede.com/ >>> >>> >>> >>> On Mon, Dec 21, 2009 at 9:01 PM, caio ariede >>> wrote: >>> >>> >>>> In function guards we can use functions like is_string/1 and >>>> is_number/1. >>>> >>>> But I'm needing to check a generic type defined by {type, Value} but >>>> *in guards* like this: >>>> >>>> search(S) when N = {regex, _} -> >>>> ... >>>> >>>> I know that I can do that with search(S = {regex, _}), but my example >>>> was only for representing the problem. >>>> >>>> The main question is: there is a way for using match in guards? Or >>>> something like this? >>>> >>>> Caio Ariede >>>> http://caioariede.com/ >>>> >>>> >>>> >>> >>> ________________________________________________________________ >>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>> erlang-questions (at) erlang.org >>> >>> >>> >> >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From klas.johansson@REDACTED Tue Dec 22 00:37:17 2009 From: klas.johansson@REDACTED (Klas Johansson) Date: Tue, 22 Dec 2009 00:37:17 +0100 Subject: [erlang-patches] Re: [erlang-questions] Bug in epmd_srv.c? In-Reply-To: <6672d0160912210306y43ebcc4dg63ea136b6a573bea@mail.gmail.com> References: <6672d0160912210306y43ebcc4dg63ea136b6a573bea@mail.gmail.com> Message-ID: 2009/12/21 Bj?rn Gustavsson : > On Sun, Dec 20, 2009 at 11:06 PM, Klas Johansson > wrote: >> Now I too have been bitten by this. This patch places the >> `highest version' field before the `lowest version' field in the >> docs, just as in the source code: >> > > Thanks! > > I have applied your patch directly to the development branch > (it will turn up later today in the git repository), with one minor > change (referring to the next field for possible values no longer > make sense, so I copied the line "The value in R6B and later is 5" > from the other version number). Ok, great! >>> Secondly, in erts/epmd/src/epmd_srv.c:628 (R13B01), there is >>> the following line: >>> >>> offset += (strlen(node->extra)-1); > [...] > > I'll wait for your updated version. I've amended my previous patch to incorporate the fix for the what-if-extra-contains-null-characters issue. Get it here: git fetch git://github.com/klajo/otp.git epmd_port2resp_trunc_extra I've also attached a new version of the erlang test case which tests the null issue as well. I'd be happy to hear what you think. BR, Klas -------------- next part -------------- A non-text attachment was scrubbed... Name: epmd_extra.erl Type: application/octet-stream Size: 2916 bytes Desc: not available URL: From rvirding@REDACTED Tue Dec 22 00:49:00 2009 From: rvirding@REDACTED (Robert Virding) Date: Tue, 22 Dec 2009 00:49:00 +0100 Subject: [erlang-questions] Using match in guards In-Reply-To: <6a9ba5690912211501q72465230t4dc4f5e8bd7b736c@mail.gmail.com> References: <6a9ba5690912211501q72465230t4dc4f5e8bd7b736c@mail.gmail.com> Message-ID: <3dbc6d1c0912211549m706b2398u43dc4926e3e97936@mail.gmail.com> No, you cannot do pattern matching in guards. It has been discussed and would be possible, but for now you can't. Robert 2009/12/22 caio ariede > In function guards we can use functions like is_string/1 and is_number/1. > > But I'm needing to check a generic type defined by {type, Value} but > *in guards* like this: > > search(S) when N = {regex, _} -> > ... > > I know that I can do that with search(S = {regex, _}), but my example > was only for representing the problem. > > The main question is: there is a way for using match in guards? Or > something like this? > > Caio Ariede > http://caioariede.com/ > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From caio.ariede@REDACTED Tue Dec 22 01:37:06 2009 From: caio.ariede@REDACTED (caio ariede) Date: Mon, 21 Dec 2009 22:37:06 -0200 Subject: [erlang-questions] Using match in guards In-Reply-To: <3dbc6d1c0912211549m706b2398u43dc4926e3e97936@mail.gmail.com> References: <6a9ba5690912211501q72465230t4dc4f5e8bd7b736c@mail.gmail.com> <3dbc6d1c0912211549m706b2398u43dc4926e3e97936@mail.gmail.com> Message-ID: <6a9ba5690912211637v3f9cc4c0y5079290b57b7b97f@mail.gmail.com> Very thanks Dale. test(N) when element(1, N) == regex -> ... ..do the trick! :) I think the is_tuple/1 is not really needed. Caio Ariede http://caioariede.com/ On Mon, Dec 21, 2009 at 9:49 PM, Robert Virding wrote: > No, you cannot do pattern matching in guards. > > It has been discussed and would be possible, but for now you can't. > > Robert > > 2009/12/22 caio ariede >> >> In function guards we can use functions like is_string/1 and is_number/1. >> >> But I'm needing to check a generic type defined by {type, Value} but >> *in guards* like this: >> >> search(S) when N = {regex, _} -> >> ... >> >> I know that I can do that with search(S = {regex, _}), but my example >> was only for representing the problem. >> >> The main question is: there is a way for using match in guards? Or >> something like this? >> >> Caio Ariede >> http://caioariede.com/ >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> > > From ngocdaothanh@REDACTED Tue Dec 22 03:00:44 2009 From: ngocdaothanh@REDACTED (Ngoc Dao) Date: Tue, 22 Dec 2009 11:00:44 +0900 Subject: [erlang-questions] Erlang server and log rotating In-Reply-To: References: Message-ID: <5c493e530912211800r496881d1je2be6bfaec8bd7bd@mail.gmail.com> Have you tried? http://github.com/ahmednawras/log4erl On Tue, Dec 22, 2009 at 1:09 AM, Max Lapshin wrote: > Hi. As erlyvideo is growing (bwt, it has moved to repo > http://github.com/erlyvideo/erlyvideo and soon will work site > http://erlyvideo.org), I meet new problems: > logs and logrotating. > > I've been using runit for some time and found it very convenient: no > need to daemonize program, its output is logged to some directory with > automatic logrotation. > It is very important issue: using runit, no need to setup logrotate > and restart program: runit logger will rotate logs itself. > > I have not found, how to do it with erlang otp. How to rotate logs > per-size and delete old ones? > > Second problem is, that I want to have not otp-style log, I need to > log in apache-style. What is good practice to have logger, separate > from error_logger? From yrashk@REDACTED Tue Dec 22 03:58:07 2009 From: yrashk@REDACTED (Yurii Rashkovskii) Date: Mon, 21 Dec 2009 18:58:07 -0800 Subject: amqpfs announcement Message-ID: <248588BE-50B9-448D-994D-75E3E47B23E4@gmail.com> Hi, I am happy to announce an availability of aqmpfs early version (I've been cooking it for a little bit more than a week). AMQPFS is a Filesystem as API that works through AMQPFS, all filesystem providers are available through AMQP bus and can be distributed in the network. What's the point? Why one may need this? Well, this project started as a way to integrate some third-party software while maintaining no real files or directories for it. For example, it could be used to serve configuration files, receive logs and such. Its use is virtually unlimited. Plus, it can also utilize multiple instances of providers for the same path which leads us to interesting fault tolerance and availability algorithms. Would be glad to know if anybody else will find it useful. It is available at http://github.com/scallable/amqpfs Please note that it is very immature and pretty much undocumented. Feel free to contact me (yrashk on FreeNode IRC or yrashk at gmail.com by e-mail). Cheers, Yurii. From mjtruog@REDACTED Tue Dec 22 04:42:14 2009 From: mjtruog@REDACTED (Michael Truog) Date: Mon, 21 Dec 2009 19:42:14 -0800 Subject: [erlang-questions] Re: Using match in guards In-Reply-To: <6a9ba5690912211502y588b15f9p52ae0b9be1bae802@mail.gmail.com> References: <6a9ba5690912211501q72465230t4dc4f5e8bd7b736c@mail.gmail.com> <6a9ba5690912211502y588b15f9p52ae0b9be1bae802@mail.gmail.com> Message-ID: <4B304016.70100@gmail.com> You would need to use erlang:length/1 and erlang:element/2 to get this logic in a guard. Keep in mind that erlang:length/1 is the only guard function that is O(N), the others are O(1). caio ariede wrote: > Just correcting my example: > > search(S) when S = {regex, _} -> > ... > > Caio Ariede > http://caioariede.com/ > > > > On Mon, Dec 21, 2009 at 9:01 PM, caio ariede wrote: > >> In function guards we can use functions like is_string/1 and is_number/1. >> >> But I'm needing to check a generic type defined by {type, Value} but >> *in guards* like this: >> >> search(S) when N = {regex, _} -> >> ... >> >> I know that I can do that with search(S = {regex, _}), but my example >> was only for representing the problem. >> >> The main question is: there is a way for using match in guards? Or >> something like this? >> >> Caio Ariede >> http://caioariede.com/ >> >> > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > > From elliot.murphy@REDACTED Tue Dec 22 04:53:11 2009 From: elliot.murphy@REDACTED (Elliot Murphy) Date: Mon, 21 Dec 2009 22:53:11 -0500 Subject: [erlang-questions] Using Dialyzer on Ubuntu 9.10? In-Reply-To: <59da11980912200812j4f9b5aacy6736f7ccaed5d393@mail.gmail.com> References: <59da11980912180837n7f19f919la96e28ed4d592998@mail.gmail.com> <4B2BB337.1090004@cs.ntua.gr> <4B2CAFE1.9020403@elte.hu> <4B2CB35C.6030506@cs.ntua.gr> <595970ad0912192054v3b3bc166m332bc6d53840c613@mail.gmail.com> <59da11980912200812j4f9b5aacy6736f7ccaed5d393@mail.gmail.com> Message-ID: <595970ad0912211953m1542ead2ve8b93c5425cb63f3@mail.gmail.com> On Sun, Dec 20, 2009 at 11:12 AM, Jeremy Raymond wrote: > I've installed the Erlang packages with the erlang-dev ppa and the dialyzer > is happy. I'd love to see the newer Erlang releases available also as you > suggest in the bug comments. Is this much work to do? A bit of work, but worth it I think, especially since all the work Sergei is doing in debian can be reused. In the last day or two Sergei uploaded r13b3 to debian. Tonight i merged that to Ubuntu Lucid, and asked for a review (since I'm not an Ubuntu developer I can propose changes but they have to be reviewed and uploaded by an Ubuntu core dev). I also built r13b3 for Karmic (9.10), and it's testbuilding in my personal PPA now: https://edge.launchpad.net/~statik/+archive/ppa/+packages If that works ok it can be copied to the erlang-dev PPA I showed you earlier. > Also where would one locate the general information about the Ubuntu Erlang > packages? I'd be great if the info on adding the Erlang dev ppa were > available wherever the normal documentation is for this. Had these ppa been > available earlier where would I have looked to know of it's existence? Where > can I get info on updates? Thats a good question. I just created https://wiki.ubuntu.com/Erlang with some basic info on it, you are welcome to extend this page as you see fit. > Thanks a lot. Your quick responses and support on this are much?appreciated! I'm happy to help. None of us working on Ubuntu have time to do everything we want to do, so it's always nice to be able to fix something quickly and help make things better. Since so much cool software is being written in Erlang now, we definitely need more people to learn how to package Erlang software for both Debian and Ubuntu - if anyone wants to get involved, it would be most welcome. -elliot From cowboymathu@REDACTED Tue Dec 22 06:09:03 2009 From: cowboymathu@REDACTED (MAthuvathanan Mou.) Date: Tue, 22 Dec 2009 11:09:03 +0600 Subject: Erlang Mode in E Text Editor Message-ID: <90b4299d0912212109o2ebc8585t69e46b8893ae3c60@mail.gmail.com> Hi all, I started to use E Text editor which is Windows version of TextMate. I found in a Trapexit Discussion that E Text editor supports erlang too. I don't have clear idea of it. But I couldn't find a bundle for erlang in this editor. Can anyone please direct me how to enable erlang mode in E Text editor. P.S : I have been using UltraEdit for months but fascinated by some features of E Text Editor. Thanks, -- Mathuvathanan Mou. From leap@REDACTED Tue Dec 22 06:46:05 2009 From: leap@REDACTED (Michael Turner) Date: Tue, 22 Dec 2009 05:46:05 +0000 Subject: Erlide packageability (was Re: "Erlang as a First Language" -- crazy? or juststupid?) In-Reply-To: <9bd8a08a0912200009u7bc3c3f9y62198c9c783bdc49@mail.gmail.com> Message-ID: On 12/20/2009, "egarrulo" wrote: >Erlang is not suitable for beginners. The language is simple enough, however tool support and API documentation aren't..... Not to get ahead of myself, and notwithstanding egarrulo's implication further on that Erlang would be, at best, a distant third place runner in this sweepstakes .... Last night, I made a first stab at getting Erlide. Because I started late, I got stalled. I *could* push it all the way through (right Java download, right Eclipse download, right Erlide version, everything set properly ....). And maybe I will. For now, however, I have to say: the target audience I'm thinking of would probably find all this a lot more trouble than I would, and I already find it a lot of trouble. Of course, I could tell my target audience "Just use your favorite editor". But you know what? Most mere mortals wouldn't know what I meant. Mortals use word processors, PowerPoint (and sometimes graphics and page layout). And as egarrulo implies, people tend to like having One Good Window for what they're focusing on. Tabbed browsers show that's what they want even when they have ADD. So I'm wondering: Could Erlide be put together on a one-click install CD? Or even better: a one-click over-the-web install? Of course, this issue also invokes a recursion in my initial question: "Eclipse as a First IDE" - pure madness? or just unadulterated idiocy? I actually wouldn't know, not having used it. I just use vim. Because I am a caveman who eats his own head lice. -michael turner >2009/12/20 Michael Turner > >> >> That's what I'm wondering. I'm holding out for a possible Answer #3: >> "Sure, at least if they are smart enough." >> >> I might have "smart enough" covered. I'm working on a project in the >> overlap between cognitive science and linguistics. These people aren't >> necessarily math-heavy (on the linguistics side, anyway), but they can >> tolerate odd notations, abstruse jargon and fine conceptual distinctions >> that would evoke only dread, if not nausea, in ordinary folk. >> >> I've been evaluating Erlang for this project in the only way I think >> possible: after having identified what's important and what's not in a >> language/system for this project, and seeing that Erlang roughly matches >> up, I started writing modeling code. >> >> Here's where the matchup is clearly bad, from a lifecycle point of view: >> Erlang is still a small minority language. Sure, it's possible that a >> mini-gold-rush is starting for it, and if so, that's good for Erlang, >> mid- to long-term. But in my experience, the sudden appearance of money >> can make the programmer supply situation worse in research circles: >> hackers in academia start getting head-hunted ferociously. What I'm >> working on is likely to remain a lab creature for years, if it's viable >> at all. Somebody besides me has got to be able to support it, >> eventually if not sooner. So I'm thinking maybe the more adept users >> might be good candidates for the role of programmers as well. >> >> But you see the problem: it might mean that Erlang is effectively their >> first language. Maybe they had a little exposure in high school or an >> elementary programming course in college. At most. And maybe that >> experience even turned them off a little. >> >> What are the first-language learnability issues with Erlang? I'm poorly >> qualified to think about this. Although I wouldn't say I learn >> programming languages quickly, I don't have major blocks either. Over >> the last 40 years, I've probably written something more significant >> than "Hello, world" in more languages than I have fingers. When I run >> across a term like "atom", I think, "probably lisp-like", and I'm >> off to the races. I never really hacked Prolog, but having done it a >> little helped a lot with with Erlang. Even Pascal helped: that nagging >> little terminator-vs-separator distinction with semicolons and whatnot >> had migrated up into my ulnar tendons since college (so *that's* why >> they hurt sometimes!), but made it back down to my fingers pretty >> quickly when called. So taking up Erlang in my mid-fifties is only >> making me think, "Why didn't I start with it before my hair went >> totally grey?" >> >> Maybe this isn't the best list for asking this question, because >> probably most of you are like me anyway, in spirit if not in age. But I >> can't think where else to ask. >> >> -michael turner >> >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> > > From toby@REDACTED Tue Dec 22 08:05:39 2009 From: toby@REDACTED (Toby Thain) Date: Tue, 22 Dec 2009 02:05:39 -0500 Subject: [erlang-questions] Erlide packageability (was Re: "Erlang as a First Language" -- crazy? or juststupid?) In-Reply-To: References: Message-ID: <30FBBAB0-0C43-4225-959C-8EB126F6B7A1@telegraphics.com.au> On 22-Dec-09, at 12:46 AM, Michael Turner wrote: > ... > "Eclipse as a First IDE" - pure madness? or just unadulterated > idiocy? > > I actually wouldn't know, not having used it. I just use vim. > Because > I am a caveman who eats his own head lice. I use vi and Eclipse, the former usually for system admin and the latter for coding (any language from Assembler to PHP). Eclipse can present a reasonably simple face and GUI editors are going to be much more familiar than vi keystrokes -- as you say, people get familiar with things like Word. Eclipse also has good VCS integration, if that's a factor. --Toby > > -michael turner From bgustavsson@REDACTED Tue Dec 22 09:16:42 2009 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Tue, 22 Dec 2009 09:16:42 +0100 Subject: [erlang-patches] Re: [erlang-questions] Bug in epmd_srv.c? In-Reply-To: References: <6672d0160912210306y43ebcc4dg63ea136b6a573bea@mail.gmail.com> Message-ID: <6672d0160912220016w7f8120edg28ce2b29d56b5a42@mail.gmail.com> 2009/12/22 Klas Johansson : > I've amended my previous patch to incorporate the fix for the > what-if-extra-contains-null-characters issue. ?Get it here: > > ? git fetch git://github.com/klajo/otp.git epmd_port2resp_trunc_extra Thanks! Included in 'pu'. Is there any special reason to fix this bug? I mean, besides fixing a bug, is there anything that will work better or something that now will be possible to do that was not possible to do before, or does it increase security? If the answer to any of those questions is "yes", it would be good to mention it in the commit message. > I've also attached a new version of the erlang test case which > tests the null issue as well. It would be nice if you could turn that code into a test case. >?I'd be happy to hear what you think. We will come back to you next year. Unless we uncover any backward-compatibility issues or other problems, this fix should make it into R13B04. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From max.lapshin@REDACTED Tue Dec 22 09:18:47 2009 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 22 Dec 2009 11:18:47 +0300 Subject: [erlang-questions] Erlang server and log rotating In-Reply-To: <5c493e530912211800r496881d1je2be6bfaec8bd7bd@mail.gmail.com> References: <5c493e530912211800r496881d1je2be6bfaec8bd7bd@mail.gmail.com> Message-ID: Oh, thank you, I will take a look. From clist@REDACTED Tue Dec 22 09:45:47 2009 From: clist@REDACTED (Angel Alvarez) Date: Tue, 22 Dec 2009 09:45:47 +0100 Subject: [erlang-questions] Re: Using match in guards In-Reply-To: <6a9ba5690912211502y588b15f9p52ae0b9be1bae802@mail.gmail.com> References: <6a9ba5690912211501q72465230t4dc4f5e8bd7b736c@mail.gmail.com> <6a9ba5690912211502y588b15f9p52ae0b9be1bae802@mail.gmail.com> Message-ID: <200912220945.47358.clist@uah.es> El Martes, 22 de Diciembre de 2009 00:02:55 caio ariede escribi?: > Just correcting my example: > > search(S) when S = {regex, _} -> PAttern matching? search(S={regex,_}) -> .... /Angel > ... > > Caio Ariede > http://caioariede.com/ > > > > On Mon, Dec 21, 2009 at 9:01 PM, caio ariede wrote: > > In function guards we can use functions like is_string/1 and is_number/1. > > > > But I'm needing to check a generic type defined by {type, Value} but > > *in guards* like this: > > > > search(S) when N = {regex, _} -> > > ... > > > > I know that I can do that with search(S = {regex, _}), but my example > > was only for representing the problem. > > > > The main question is: there is a way for using match in guards? Or > > something like this? > > > > Caio Ariede > > http://caioariede.com/ > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > -- No imprima este correo si no es necesario. El medio ambiente est? en nuestras manos. __________________________________________ Clist UAH a.k.a Angel __________________________________________ El Universo es una de esas cosas que sucede de vez en cuando... From bengt.kleberg@REDACTED Tue Dec 22 09:51:31 2009 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 22 Dec 2009 09:51:31 +0100 Subject: [erlang-questions] Re: Using match in guards In-Reply-To: <200912220945.47358.clist@uah.es> References: <6a9ba5690912211501q72465230t4dc4f5e8bd7b736c@mail.gmail.com> <6a9ba5690912211502y588b15f9p52ae0b9be1bae802@mail.gmail.com> <200912220945.47358.clist@uah.es> Message-ID: <1261471892.7469.10.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Greetings, It makes more sense (and works in the Erlang shell) to write the match in this order: {regex, _} = S bengt On Tue, 2009-12-22 at 09:45 +0100, Angel Alvarez wrote: > El Martes, 22 de Diciembre de 2009 00:02:55 caio ariede escribi?: > > Just correcting my example: > > > > search(S) when S = {regex, _} -> > > PAttern matching? > > search(S={regex,_}) -> .... > > > /Angel > > > > > ... > > > > Caio Ariede > > http://caioariede.com/ > > > > > > > > On Mon, Dec 21, 2009 at 9:01 PM, caio ariede wrote: > > > In function guards we can use functions like is_string/1 and is_number/1. > > > > > > But I'm needing to check a generic type defined by {type, Value} but > > > *in guards* like this: > > > > > > search(S) when N = {regex, _} -> > > > ... > > > > > > I know that I can do that with search(S = {regex, _}), but my example > > > was only for representing the problem. > > > > > > The main question is: there is a way for using match in guards? Or > > > something like this? > > > > > > Caio Ariede > > > http://caioariede.com/ > > > > > > > ________________________________________________________________ > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > erlang-questions (at) erlang.org > > > > > > > From egarrulo@REDACTED Tue Dec 22 10:04:10 2009 From: egarrulo@REDACTED (egarrulo) Date: Tue, 22 Dec 2009 09:04:10 +0000 Subject: Erlide packageability (was Re: "Erlang as a First Language" -- crazy? or juststupid?) In-Reply-To: References: <9bd8a08a0912200009u7bc3c3f9y62198c9c783bdc49@mail.gmail.com> Message-ID: <9bd8a08a0912220104l390e0849r98adbf9129b46b10@mail.gmail.com> 2009/12/22 Michael Turner "Eclipse as a First IDE" - pure madness? or just unadulterated idiocy? > Yes, THAT would be pure madness. I've never understood that "IDE". Maybe I'm not smart enough, however I don't know any developer who uses it on a daily basis and knows how it works. I occasionally use it because I have to. OTOH, I've not had any issues with Visual Studio, Borland's IDEs, Emacs; or any other IDE I've just given a shot, for that matter. From vasilij.savin@REDACTED Tue Dec 22 10:44:06 2009 From: vasilij.savin@REDACTED (Vasilij Savin) Date: Tue, 22 Dec 2009 11:44:06 +0200 Subject: [erlang-questions] Re: Erlide packageability (was Re: "Erlang as a First Language" -- crazy? or juststupid?) In-Reply-To: <9bd8a08a0912220104l390e0849r98adbf9129b46b10@mail.gmail.com> References: <9bd8a08a0912200009u7bc3c3f9y62198c9c783bdc49@mail.gmail.com> <9bd8a08a0912220104l390e0849r98adbf9129b46b10@mail.gmail.com> Message-ID: Greetings, During our last project, I was single person using ErlIDE in team of ten. Most people opted for Emacs and 2 people picked vim. I used ErlIDE because I have used Eclipse extensively during my Java years and I came to like it. However, the general quality is not there yet. I managed to install it without a snap, but the feeling I got is that Emacs has somewhat better support for Erlang than ErlIDE. Later on, I switched to pure text editor (my x64 Linux could not run Eclipse for some vague reason) without much pain. The main advantages ErlIDE gave me was syntax checking, I could ensure that my module did not have any syntax errors before compiling and code templates. Otherwise, it gave no significant benefit. Granted, perhaps my Erlang experience is too small-scale, but I got feeling Erlang needs IDE less than Java, because it is more compact. One would be insane to try coding serious Java project in text editor. Regards, Vasilij Savin From jan.koum@REDACTED Tue Dec 22 11:07:23 2009 From: jan.koum@REDACTED (Jan Koum) Date: Tue, 22 Dec 2009 02:07:23 -0800 Subject: epmd IP binding Message-ID: <7c29a2a40912220207vd444a45o911c6fab04749e95@mail.gmail.com> hi there, (hopefully this is correct list for this question.) our freebsd box has multiple interfaces with multiple IP addresses. is it possible to bind epmd to a specific IP address instead of *:4369? thanks, -- yan From attila.r.nohl@REDACTED Tue Dec 22 12:18:37 2009 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Tue, 22 Dec 2009 12:18:37 +0100 Subject: Ternary operator used as assert Message-ID: <401d3ba30912220318v20dd0ee1p11013754a73c3098@mail.gmail.com> Hello! There was a recent thread here about how to implement a C-style "?:" code in Erlang. My code would look something like this in C: strlen(X)==0 ? OK : return X[0]; My very naive generic Erlang implementation is this: assert(true, Val, _) -> Val; assert(false, _, Val) -> Val. And the call would be this: assert(X == [], ok, hd(X)). Of course, this doesn't work if the list X is actually empty. The hd(X) is evaluated even if the X list is empty and the code crashes. This is a big difference to the C code where the "else" branch is not executed. Is there an elegant, one liner solution? From kiszl@REDACTED Tue Dec 22 12:41:59 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Tue, 22 Dec 2009 12:41:59 +0100 Subject: [erlang-questions] Ternary operator used as assert In-Reply-To: <401d3ba30912220318v20dd0ee1p11013754a73c3098@mail.gmail.com> References: <401d3ba30912220318v20dd0ee1p11013754a73c3098@mail.gmail.com> Message-ID: <4B30B087.6090200@tmit.bme.hu> You can wrap the return values in functions: assert(true, F, _) -> F(); assert(false, _, F) -> F(). assert(X == [], fun() -> ok end, fun() -> hd(X) end). A macro can also be used for the wrapping: -define(ASSERT(EXPR, T, F), assert(EXPR, fun() -> T end, fun() -> F end)). ?ASSERT(X == [], ok, hd(X)). Apparently the compiler will emit warnings for hd(X). Nevertheless, the code works. Regards, Zoltan. Attila Rajmund Nohl wrote: > Hello! > > There was a recent thread here about how to implement a C-style "?:" > code in Erlang. My code would look something like this in C: > > strlen(X)==0 ? OK : return X[0]; > > My very naive generic Erlang implementation is this: > > assert(true, Val, _) -> > Val; > assert(false, _, Val) -> > Val. > > And the call would be this: > > assert(X == [], ok, hd(X)). > > Of course, this doesn't work if the list X is actually empty. The > hd(X) is evaluated even if the X list is empty and the code crashes. > This is a big difference to the C code where the "else" branch is not > executed. Is there an elegant, one liner solution? > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From caio.ariede@REDACTED Tue Dec 22 12:58:10 2009 From: caio.ariede@REDACTED (caio ariede) Date: Tue, 22 Dec 2009 09:58:10 -0200 Subject: [erlang-questions] Re: Using match in guards In-Reply-To: <1261471892.7469.10.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> References: <6a9ba5690912211501q72465230t4dc4f5e8bd7b736c@mail.gmail.com> <6a9ba5690912211502y588b15f9p52ae0b9be1bae802@mail.gmail.com> <200912220945.47358.clist@uah.es> <1261471892.7469.10.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Message-ID: <6a9ba5690912220358sccdf08apab01e2bd41759906@mail.gmail.com> Thanks for all replies, but I needed something *in guards*. (not S = {regex, _}) Is a very strict behavior, so just element(1, S) == regex _sugested by Dale Harvey_, did the trick. search(S) when element(1, S) == regex -> ... Caio Ariede http://caioariede.com/ On Tue, Dec 22, 2009 at 6:51 AM, Bengt Kleberg wrote: > Greetings, > > It makes more sense (and works in the Erlang shell) to write the match > in this order: > > ?{regex, _} = S > > > bengt > > On Tue, 2009-12-22 at 09:45 +0100, Angel Alvarez wrote: >> El Martes, 22 de Diciembre de 2009 00:02:55 caio ariede escribi?: >> > Just correcting my example: >> > >> > search(S) when S = {regex, _} -> >> >> PAttern matching? >> >> search(S={regex,_}) -> .... >> >> >> /Angel >> >> >> >> > ... >> > >> > Caio Ariede >> > http://caioariede.com/ >> > >> > >> > >> > On Mon, Dec 21, 2009 at 9:01 PM, caio ariede wrote: >> > > In function guards we can use functions like is_string/1 and is_number/1. >> > > >> > > But I'm needing to check a generic type defined by {type, Value} but >> > > *in guards* like this: >> > > >> > > search(S) when N = {regex, _} -> >> > > ... >> > > >> > > I know that I can do that with search(S = {regex, _}), but my example >> > > was only for representing the problem. >> > > >> > > The main question is: there is a way for using match in guards? Or >> > > something like this? >> > > >> > > Caio Ariede >> > > http://caioariede.com/ >> > > >> > >> > ________________________________________________________________ >> > erlang-questions mailing list. See http://www.erlang.org/faq.html >> > erlang-questions (at) erlang.org >> > >> > >> >> >> > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From rvirding@REDACTED Tue Dec 22 13:12:38 2009 From: rvirding@REDACTED (Robert Virding) Date: Tue, 22 Dec 2009 13:12:38 +0100 Subject: [erlang-questions] Ternary operator used as assert In-Reply-To: <4B30B087.6090200@tmit.bme.hu> References: <401d3ba30912220318v20dd0ee1p11013754a73c3098@mail.gmail.com> <4B30B087.6090200@tmit.bme.hu> Message-ID: <3dbc6d1c0912220412k59ff273cie31e3b1e8247907f@mail.gmail.com> A better alternative would be a macro: -define(ASSERT(TEST,TRUE,FALSE), case TEST of true -> TRUE; false -> FALSE end). which shouldn't create any compiler warning/errors unless either TRUE or FALSE contains code which is not always valid. Using 'if' is an alternative if the test is a guard test. Robert 2009/12/22 Zoltan Lajos Kis > You can wrap the return values in functions: > > assert(true, F, _) -> F(); > assert(false, _, F) -> F(). > > assert(X == [], fun() -> ok end, fun() -> hd(X) end). > > > A macro can also be used for the wrapping: > > -define(ASSERT(EXPR, T, F), assert(EXPR, fun() -> T end, fun() -> F end)). > > ?ASSERT(X == [], ok, hd(X)). > > Apparently the compiler will emit warnings for hd(X). Nevertheless, the > code works. > > Regards, > Zoltan. > > > Attila Rajmund Nohl wrote: > >> Hello! >> >> There was a recent thread here about how to implement a C-style "?:" >> code in Erlang. My code would look something like this in C: >> >> strlen(X)==0 ? OK : return X[0]; >> >> My very naive generic Erlang implementation is this: >> >> assert(true, Val, _) -> >> Val; >> assert(false, _, Val) -> >> Val. >> >> And the call would be this: >> >> assert(X == [], ok, hd(X)). >> >> Of course, this doesn't work if the list X is actually empty. The >> hd(X) is evaluated even if the X list is empty and the code crashes. >> This is a big difference to the C code where the "else" branch is not >> executed. Is there an elegant, one liner solution? >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> >> > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From egarrulo@REDACTED Tue Dec 22 13:37:31 2009 From: egarrulo@REDACTED (egarrulo) Date: Tue, 22 Dec 2009 12:37:31 +0000 Subject: Erlide packageability (was Re: "Erlang as a First Language" -- crazy? or juststupid?) In-Reply-To: References: <9bd8a08a0912200009u7bc3c3f9y62198c9c783bdc49@mail.gmail.com> Message-ID: <9bd8a08a0912220437r22cc5eedm2baf58beadd5e359@mail.gmail.com> 2009/12/22 Michael Turner > > Of course, I could tell my target audience "Just use your favorite > editor". I wouldn't tell a beginner to use an editor to develop anything. A language lacking an IDE - and by "IDE" I mean an editor with syntax-highlighting and interaction with language's compiler and source-level debugger, at least - such language is not worth learning, IMHO. I've done that in the past... never again. So I'm wondering: Could Erlide be put together on a one-click install > CD? Or even better: a one-click over-the-web install? > Yes, it can. You don't need an install, a (compressed) folder would suffice. Just setup your Eclipse+Erlide installation, add a JRE and write a shell script to launch the behemoth. That would be a couple hundreds of megabytes, but it would work. From egarrulo@REDACTED Tue Dec 22 13:39:38 2009 From: egarrulo@REDACTED (egarrulo) Date: Tue, 22 Dec 2009 12:39:38 +0000 Subject: Proper environment setting to compile Distel on Windows? In-Reply-To: <9bd8a08a0912180327i7a2b888er3666684d2ed2110f@mail.gmail.com> References: <9bd8a08a0912180327i7a2b888er3666684d2ed2110f@mail.gmail.com> Message-ID: <9bd8a08a0912220439l5216c43bj247ae0922b2ded8b@mail.gmail.com> It ended up not being an issue about environment. Build was just missing "ebin" subdirectory. Built everything using MSYS' toolchain. Thanks. From kostis@REDACTED Tue Dec 22 15:01:35 2009 From: kostis@REDACTED (Kostis Sagonas) Date: Tue, 22 Dec 2009 16:01:35 +0200 Subject: [erlang-questions] Re: Using match in guards In-Reply-To: <6a9ba5690912220358sccdf08apab01e2bd41759906@mail.gmail.com> References: <6a9ba5690912211501q72465230t4dc4f5e8bd7b736c@mail.gmail.com> <6a9ba5690912211502y588b15f9p52ae0b9be1bae802@mail.gmail.com> <200912220945.47358.clist@uah.es> <1261471892.7469.10.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> <6a9ba5690912220358sccdf08apab01e2bd41759906@mail.gmail.com> Message-ID: <4B30D13F.3020108@cs.ntua.gr> caio ariede wrote: > Thanks for all replies, but I needed something *in guards*. (not S = {regex, _}) > > Is a very strict behavior, so just element(1, S) == regex _sugested by > Dale Harvey_, did the trick. > > search(S) when element(1, S) == regex -> ... Well, glad that you are happy with this solution, I am not sure what you meant by "a very strict behavior". Note that the above test is not semantically equivalent to what you initially told us you want to check, namely that S is a 2-tuple tagged with the atom 'regexp'. For example, the following call passes the element test: search({regexp, foo, {gazonk, 42}, bar}) Kostis From anton.krasovsky@REDACTED Tue Dec 22 15:16:49 2009 From: anton.krasovsky@REDACTED (Anton Krasovsky) Date: Tue, 22 Dec 2009 14:16:49 +0000 Subject: [erlang-questions] Imagemagick erlang port In-Reply-To: <523869a70912181419h159a6c2i110c598c4c8a5254@mail.gmail.com> References: <45d8e23d0912180849r1788178as425c6ce1e02a5936@mail.gmail.com> <46167e6a0912180924m2e9446fep3b991d5a5105035a@mail.gmail.com> <523869a70912181419h159a6c2i110c598c4c8a5254@mail.gmail.com> Message-ID: <46167e6a0912220616p46bd9e3pfbb6f7e77d597c31@mail.gmail.com> How do you run ImageMagick then, if not using command-line? Regards, Anton 2009/12/18 Davide Marqu?s : > The Zotonic CMS (http://zotonic.com/) has some modules (z_media_preview.erl, > z_media_preview_server.erl) to interface with ImageMagick. > The code is a bit "web-biased" but you should be able to extract the bits > you want (I started this process but haven't had time to complete it - I'll > send you the files anyway). > > On Fri, Dec 18, 2009 at 5:24 PM, Anton Krasovsky > wrote: >> >> I'm using graphicsmagick as well, with temp files and os:cmd(). Would >> be interesting to see something more flexible, the command line >> interface is a bit limiting. >> >> Regards, >> Anton >> >> On Fri, Dec 18, 2009 at 5:04 PM, Koener Antoine >> wrote: >> > Hi, >> > >> > On Dec 18, 2009, at 17:49 , Senthilkumar Peelikkampatti wrote: >> > >> >> Hi, >> >> ? ? ?I found image magick driver for so many other ?languages but >> >> not able to find one for Erlang :-) >> >> For those not familiar with ImageMagick, it is image manipulation tool >> >> which converts one format to another and also does somany other >> >> things. Moer here http://imagemagick.com/script/index.php. >> > >> > You should look at >> > graphic magick >> > >> > http://www.graphicsmagick.org/benchmarks.html >> > >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> > > From egarrulo@REDACTED Tue Dec 22 15:53:55 2009 From: egarrulo@REDACTED (egarrulo) Date: Tue, 22 Dec 2009 14:53:55 +0000 Subject: http:request: cannot connect behind proxy? In-Reply-To: <9bd8a08a0912180721h77200f4ey7af893fb0cb57bf@mail.gmail.com> References: <9bd8a08a0912180721h77200f4ey7af893fb0cb57bf@mail.gmail.com> Message-ID: <9bd8a08a0912220653y6bcfd597m28a61cd62481130@mail.gmail.com> Nevermind. Today is working, who knows why. Well, after a Windows system restore... Thanks. 2009/12/18 egarrulo > Hello, > > I'm trying to get a HTML document and I'm behind a proxy, but my request > keeps timing out. I'm following directions found at > http://erlang.mirror.su.se/documentation/doc-5.7.3/lib/inets-5.1.3/doc/html/http_client.html > > Here is the code: > > -module (test). > -compile([export_all]). > -define (URL, "http://www.google.it"). > > main()-> > inets:start(), > http:set_options([{proxy, {{"10.249.69.41", 8080}, ["localhost"]}}]), > { ok, {_Status, _Headers, Body }} = http:request (?URL). > > Tested on Erlang-R13B01 + Windows XP. > > Any help? > > Thanks. > From thomasl_erlang@REDACTED Tue Dec 22 15:00:44 2009 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 22 Dec 2009 06:00:44 -0800 (PST) Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: <3BHgSuhp.1261405791.5964000.leap@gol.com> References: <3BHgSuhp.1261405791.5964000.leap@gol.com> Message-ID: <696205.60605.qm@web111413.mail.gq1.yahoo.com> ----- Original Message ---- > (2) Don't underestimate how hostile some of these people can be to the > idea of programming at all. One researcher I'm corresponding with > recently wrote me that he'd rather peel his skin off than write code. Clearly, you will need to get them started and productive pretty quickly. I find the erlang shell reasonably friendly to experimentation, casual testing and bottom-up development, which can be helpful. Show them how to use the shell, invoke functions, print answers, figure out what exceptions mean, etc, and it serves more like a calculator than a programming language. Unfortunately, the shell has its many limitations, so you'll then have to show them modules and compilation to really get going. Unless they are comfortable with unix and programming, I'd avoid include-files and unix make files as far as possible so that they can stay with just the shell a bit longer. > ... IBM AS/400 ... (I've never seen or used as AS/400 but I _have_ paid cold hard cash for Soltis, "Inside the AS/400". I blame an unhealthy interest in computer architecture :-) Best, Thomas From rvirding@REDACTED Tue Dec 22 16:13:28 2009 From: rvirding@REDACTED (Robert Virding) Date: Tue, 22 Dec 2009 16:13:28 +0100 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: <3BHgSuhp.1261405791.5964000.leap@gol.com> References: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> <3BHgSuhp.1261405791.5964000.leap@gol.com> Message-ID: <3dbc6d1c0912220713k66c18773o2c498d1523e616b7@mail.gmail.com> 2009/12/21 Michael Turner > > ... > You know that "choice of environments" I mentioned? Here it is: you > can write it in Object-Oriented Cobol for an IBM AS/400 with a > green-screen glass-tty terminal, or in Fortran 90 while telnetted from > Windows 95 into a DEC VMS system. THAT's how some of these people > would feel at the outset about any programming language, and an > environment like the Erlang shell. > I've programmed Fortran on VAX/VMS, even before I had an Emacs on it. What's the problem? Seriously, I think if you are that hung up on an IDE-based environment you've got problems anyway. In one sense having a very simple and basic environment may actually be easier to use just because it is so simple and basic which can make it easier to see and understand what is going on. Robert From nesrait@REDACTED Tue Dec 22 16:44:42 2009 From: nesrait@REDACTED (=?ISO-8859-1?Q?Davide_Marqu=EAs?=) Date: Tue, 22 Dec 2009 15:44:42 +0000 Subject: [erlang-questions] Imagemagick erlang port In-Reply-To: <46167e6a0912220616p46bd9e3pfbb6f7e77d597c31@mail.gmail.com> References: <45d8e23d0912180849r1788178as425c6ce1e02a5936@mail.gmail.com> <46167e6a0912180924m2e9446fep3b991d5a5105035a@mail.gmail.com> <523869a70912181419h159a6c2i110c598c4c8a5254@mail.gmail.com> <46167e6a0912220616p46bd9e3pfbb6f7e77d597c31@mail.gmail.com> Message-ID: <523869a70912220744g4f885f2eqa540bf92682ca237@mail.gmail.com> Hi Anton, 2009/12/22 Anton Krasovsky > How do you run ImageMagick then, if not using command-line? > I'm not using it yet, but it seems the z_media_preview_server module also uses os:cmd(). Cheers, Davide :) From caio.ariede@REDACTED Tue Dec 22 16:48:05 2009 From: caio.ariede@REDACTED (caio ariede) Date: Tue, 22 Dec 2009 13:48:05 -0200 Subject: [erlang-questions] Re: Using match in guards In-Reply-To: <4B30D13F.3020108@cs.ntua.gr> References: <6a9ba5690912211501q72465230t4dc4f5e8bd7b736c@mail.gmail.com> <6a9ba5690912211502y588b15f9p52ae0b9be1bae802@mail.gmail.com> <200912220945.47358.clist@uah.es> <1261471892.7469.10.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> <6a9ba5690912220358sccdf08apab01e2bd41759906@mail.gmail.com> <4B30D13F.3020108@cs.ntua.gr> Message-ID: <6a9ba5690912220748x3fa8fbfbm8692268c10d00a34@mail.gmail.com> The values {regex, Value} are generated through a syntax transformation, with a grammar parsing. So, it's not possible to get something like {regex, Value, foo, bar}. I just need to check if it's a tuple and the first value is an atom named "regex". The element/1 do this. Thanks for concern :) Caio Ariede http://caioariede.com/ On Tue, Dec 22, 2009 at 12:01 PM, Kostis Sagonas wrote: > caio ariede wrote: >> >> Thanks for all replies, but I needed something *in guards*. (not S = >> {regex, _}) >> >> Is a very strict behavior, so just element(1, S) == regex _sugested by >> Dale Harvey_, did the trick. >> >> search(S) when element(1, S) == regex -> ... > > Well, glad that you are happy with this solution, I am not sure what you > meant by "a very strict behavior". ?Note that the above test is not > semantically equivalent to what you initially told us you want to check, > namely that S is a 2-tuple tagged with the atom 'regexp'. > > For example, the following call passes the element test: > > ? ? ? ?search({regexp, foo, {gazonk, 42}, bar}) > > Kostis > From senthilkumar.peelikkampatti@REDACTED Tue Dec 22 18:20:45 2009 From: senthilkumar.peelikkampatti@REDACTED (Senthilkumar Peelikkampatti) Date: Tue, 22 Dec 2009 11:20:45 -0600 Subject: [erlang-questions] Imagemagick erlang port In-Reply-To: <523869a70912220744g4f885f2eqa540bf92682ca237@mail.gmail.com> References: <45d8e23d0912180849r1788178as425c6ce1e02a5936@mail.gmail.com> <46167e6a0912180924m2e9446fep3b991d5a5105035a@mail.gmail.com> <523869a70912181419h159a6c2i110c598c4c8a5254@mail.gmail.com> <46167e6a0912220616p46bd9e3pfbb6f7e77d597c31@mail.gmail.com> <523869a70912220744g4f885f2eqa540bf92682ca237@mail.gmail.com> Message-ID: <45d8e23d0912220920v764a31dfg53f5b5e66c4e6130@mail.gmail.com> Thanks for the information, I am actually using port_command and it is perfectly working for certain flow. I really wanted to do is call like normal erlang module by sending Binary content and receieve the converted binary response. It is kind of possible with IM convert tool which supports stdin/stdout but not working in OS X or Windows. I also raised this issue with another thread titled "open_port issue". Currently I am using filesystem to store and retrieve the source and converted as temporary workspace and actually I am storing the Data into KV store. So it is kind of redundant for me to store/mange temp workspace and my picture/photo size is not big enough to have tmp workspace. Also thanks for sharing GM. I am going to explore more and try to see if it fits my requirement. 2009/12/22 Davide Marqu?s : > Hi Anton, > > 2009/12/22 Anton Krasovsky > >> How do you run ImageMagick then, if not using command-line? >> > > I'm not using it yet, but it seems the z_media_preview_server module also > uses os:cmd(). > > Cheers, > Davide :) > -- Regards, Senthilkumar Peelikkampatti, http://pmsenthilkumar.blogspot.com/ From jarrod@REDACTED Tue Dec 22 18:41:30 2009 From: jarrod@REDACTED (Jarrod Roberson) Date: Tue, 22 Dec 2009 12:41:30 -0500 Subject: [erlang-questions] Erlide packageability (was Re: "Erlang as a First Language" -- crazy? or juststupid?) In-Reply-To: References: <9bd8a08a0912200009u7bc3c3f9y62198c9c783bdc49@mail.gmail.com> Message-ID: the lastest version of ErlIDE at this time fixed a lot of bugs. I use it exclusively for Erlang development, the syntax highlight especially the help with code sense and when to use ; vs , vs . vs nothing is invaluable. It compiles all the .erl files the background on lost focus of the tab, and helps keep your code neat and clean. you can get a self contained version of Eclipse, install the ErlIDE plugin and just zip it up. Then all you need to do to "install" it is unzip it. I highly recommend it after using the NetBeans Erlang plugin for about a year. From senthilkumar.peelikkampatti@REDACTED Tue Dec 22 18:57:19 2009 From: senthilkumar.peelikkampatti@REDACTED (Senthilkumar Peelikkampatti) Date: Tue, 22 Dec 2009 11:57:19 -0600 Subject: Reusing function in the module Message-ID: <45d8e23d0912220957n5ce80c66g3377524c9a6c3ee7@mail.gmail.com> I wanted to know what are the ways by which we can reuse functions with pure functional sense. Is that good to use extends (http://www.erlang.org/euc/07/papers/1700Carlsson.pdf) These are my requirements I have mod1.erl, mod2.erl etc mod1.erl - has different falovor of save and its utility functions mod2.erl - has update and its utility functions mod3.erl -- has same functions as mod1 but few more functions specific to itself. It is normally solved by either composition or inheritance in OOP. Borrowing a leaf from Joe's book (page 47-49), I can use pattern matching to do that. Here I need to club everything together and use different varient of pattern for variance of functionality. Is there any other way? -- Regards, Senthilkumar Peelikkampatti, http://pmsenthilkumar.blogspot.com/ From max.lapshin@REDACTED Tue Dec 22 19:12:25 2009 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 22 Dec 2009 21:12:25 +0300 Subject: [erlang-questions] Erlang server and log rotating In-Reply-To: References: <5c493e530912211800r496881d1je2be6bfaec8bd7bd@mail.gmail.com> Message-ID: It is excelent tool! Does right what I need. From g@REDACTED Tue Dec 22 19:21:51 2009 From: g@REDACTED (Garrett Smith) Date: Tue, 22 Dec 2009 12:21:51 -0600 Subject: [erlang-questions] Erlide packageability (was Re: "Erlang as a First Language" -- crazy? or juststupid?) In-Reply-To: References: <9bd8a08a0912200009u7bc3c3f9y62198c9c783bdc49@mail.gmail.com> Message-ID: On Mon, Dec 21, 2009 at 11:46 PM, Michael Turner wrote: > > On 12/20/2009, "egarrulo" wrote: >>Erlang is not suitable for beginners. The language is simple enough, however tool support and API documentation aren't..... -snip- > Of course, I could tell my target audience "Just use your favorite > editor". ?But you know what? ?Most mere mortals wouldn't know what I > meant. ?Mortals use word processors, PowerPoint (and sometimes graphics > and page layout). ?And as egarrulo implies, people tend to like having > One Good Window for what they're focusing on. ?Tabbed browsers show > that's what they want even when they have ADD. > > So I'm wondering: Could Erlide be put together on a one-click install > CD? ?Or even better: a one-click over-the-web install? If you just want to teach the language, any editor that supports syntax highlighting for Erlang should be fine. You are talking about a full featured functional language - anyone using Erlang really should be more than capable of figuring out how to use a text editor. Sheesh :) > Of course, this issue also invokes a recursion in my initial question: > > ?"Eclipse as a First IDE" - pure madness? or just unadulterated idiocy? If you were teaching Java, Eclipse would almost certainly be the right tool. I haven't played around with ErlIDE for a while, but I hear it's making rapid progress - so Eclipse could be a win for early Erlang developers. Were it me, I'd probably just pick a simple editor (e.g. on Windows, Programmers Notepad - http://www.pnotepad.org) and offer that as an option for anyone tempted to use Word ;) Simple "make" batch files for builds will work fine for student projects. Garrett From bestglide@REDACTED Tue Dec 22 20:50:08 2009 From: bestglide@REDACTED (David Best) Date: Tue, 22 Dec 2009 11:50:08 -0800 (PST) Subject: gen_event question Message-ID: I have a process A which maintains some state and also fires events (generally state change notifications) using a gen_event process V. Enter process B which needs to atomically get the current state of A and add a handler to V. This is easily done by including B's event handler in a message to A which will add the handler and pass the state in the Handler:init/1 Args. The complication is that I want to use add_sup_handler/3, but this will link to A instead of B. Any suggestions? From vincent.dephily@REDACTED Tue Dec 22 20:54:32 2009 From: vincent.dephily@REDACTED (Vincent de Phily) Date: Tue, 22 Dec 2009 20:54:32 +0100 Subject: [job] Erlang job in Paris Message-ID: <200912222054.33117.vincent.dephily@mobile-devices.fr> Hello, this job offer is from a company building telematics and connected navigation devices. This is a well-established and fast-moving company, with a diversity of exciting projects to work on. We use Erlang/OTP as one of the cornerstones of our comunication platform, where erlang's stability and scalability are very important. We are currently moving on to add components like ejabberd, rabbitmq, and couchdb into the mix alongside our in-house software. The applicant should have good knowledge of OTP, network, servers, and general enthusiasm for IT. The job is based in Paris (Villejuif), but working remotely most of the time is possible. Looking forward to receiving your CV in my mailbox (vincent.dephily@REDACTED devices.fr). Regards. -- Vincent de Phily Mobile Devices +33 (0) 142 119 325 +353 (0) 85 710 6320 Warning This message (and any associated files) is intended only for the use of its intended recipient and may contain information that is confidential, subject to copyright or constitutes a trade secret. If you are not the intended recipient you are hereby notified that any dissemination, copying or distribution of this message, or files associated with this message, is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer. Any views or opinions presented are solely those of the author vincent.dephily@REDACTED and do not necessarily represent those of the company. Although the company has taken reasonable precautions to ensure no viruses are present in this email, the company cannot accept responsibility for any loss or damage arising from the use of this email or attachments. From egarrulo@REDACTED Tue Dec 22 21:20:37 2009 From: egarrulo@REDACTED (egarrulo) Date: Tue, 22 Dec 2009 21:20:37 +0100 Subject: [erlang-questions] Erlide packageability (was Re: "Erlang as a First Language" -- crazy? or juststupid?) In-Reply-To: References: <9bd8a08a0912200009u7bc3c3f9y62198c9c783bdc49@mail.gmail.com> Message-ID: <9bd8a08a0912221220y2aae0982j9bdcd3626a846359@mail.gmail.com> 2009/12/22 Garrett Smith > If you just want to teach the language, any editor that supports > syntax highlighting for Erlang should be fine. You are talking about a > full featured functional language - anyone using Erlang really should > be more than capable of figuring out how to use a text editor. Sheesh > :) > Why should a newbie be fine with just a syntax-highlighting editor? Newbies do need more help from tools, not less. I maintain that an easy way to compile and run projects and a source-level debugger are vital. If you want to keep it basic, you could setup an IDE with Emacs+ErlangMode+Distel and adjust it to your needs (no need to learn Emacs for that). From egarrulo@REDACTED Tue Dec 22 21:36:28 2009 From: egarrulo@REDACTED (egarrulo) Date: Tue, 22 Dec 2009 21:36:28 +0100 Subject: [erlang-questions] Erlide packageability (was Re: "Erlang as a First Language" -- crazy? or juststupid?) In-Reply-To: <9bd8a08a0912221220y2aae0982j9bdcd3626a846359@mail.gmail.com> References: <9bd8a08a0912200009u7bc3c3f9y62198c9c783bdc49@mail.gmail.com> <9bd8a08a0912221220y2aae0982j9bdcd3626a846359@mail.gmail.com> Message-ID: <9bd8a08a0912221236q78ccefd6r20a7112167bc9130@mail.gmail.com> 2009/12/22 egarrulo > If you want to keep it basic, you could setup an IDE with > Emacs+ErlangMode+Distel and adjust it to your needs (no need to learn Emacs > for that). > Forgot: add FlymakeErlang too the soup (live syntax checking). From mjtruog@REDACTED Wed Dec 23 01:28:25 2009 From: mjtruog@REDACTED (Michael Truog) Date: Tue, 22 Dec 2009 16:28:25 -0800 Subject: [erlang-questions] Re: Using match in guards In-Reply-To: <4B304016.70100@gmail.com> References: <6a9ba5690912211501q72465230t4dc4f5e8bd7b736c@mail.gmail.com> <6a9ba5690912211502y588b15f9p52ae0b9be1bae802@mail.gmail.com> <4B304016.70100@gmail.com> Message-ID: <4B316429.6060807@gmail.com> Despite the death of the thread, I must correct myself and say "erlang:tuple_size/1 and erlang:element/2" since erlang:length/1 is for lists. I assume tuple_size/1 is O(1)... have not checked the code, but with a length 2 tuple it doesn't really matter anyway :-) Michael Truog wrote: > You would need to use erlang:length/1 and erlang:element/2 to get this > logic in a guard. Keep in mind that erlang:length/1 is the only guard > function that is O(N), the others are O(1). > > > caio ariede wrote: > >> Just correcting my example: >> >> search(S) when S = {regex, _} -> >> ... >> >> Caio Ariede >> http://caioariede.com/ >> >> >> >> On Mon, Dec 21, 2009 at 9:01 PM, caio ariede wrote: >> >> >>> In function guards we can use functions like is_string/1 and is_number/1. >>> >>> But I'm needing to check a generic type defined by {type, Value} but >>> *in guards* like this: >>> >>> search(S) when N = {regex, _} -> >>> ... >>> >>> I know that I can do that with search(S = {regex, _}), but my example >>> was only for representing the problem. >>> >>> The main question is: there is a way for using match in guards? Or >>> something like this? >>> >>> Caio Ariede >>> http://caioariede.com/ >>> >>> >>> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> >> >> > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > > From max.lapshin@REDACTED Wed Dec 23 08:41:31 2009 From: max.lapshin@REDACTED (Max Lapshin) Date: Wed, 23 Dec 2009 10:41:31 +0300 Subject: Designing protocol library Message-ID: Hi everyone, I need help: I want to extract RTMP encode/decode library from erlyvideo, but I still don't have clear idea, how would it look like. There are two ideas: 1) RTMP library just as HTTP mode of socket should be able to work with sockets in active mode (send subscriber messages) and should maintain its internal state 2) RTMP library should be useable as "pure functional" decoding methods just like erlang:decode_packet It seems for me, that API must look like: Pure functional part: -type(rtmp_state, opaque). -type(rtmp_message, ...). decode(State::rtmp_state(), Data::binary()) -> {NewState::rtmp_state(), Message::rtmp_message(), Rest::binary()} | {State::rtmp_state(), Data::binary()}. encode(State::rtmp_state(), Message::rtmp_message()) -> {NewState::rtmp_state(), Data::binary()}. It is very important to track state, because RTMP is very, very stateful protocol: each incoming message change RTMP decoder state. Active socket part: type(socket(), port()). type(rtmp_mode(), active|passive|once). type(rtmp_socket, {socket = socket(), state = rtmp_state(), consumer = pid(), mode = rtmp_mode()}). connect(Socket::socket()) -> RTMP::rtmp_socket() ???method for client connection to RTMP server accept(Socket::socket()) -> RTMP::rtmp_socket()?? method for server accepting new RTMP connection from client setopts(RTMP::rtmp_socket(), [{active, true} | {active, once} | passive]).?? the same as mode for HTTP socket send(RTMP::rtmp_socket(), Message::rtmp_message()}?? it is very important to send this message through API, because sending outside messages also modifies state of RTMP encoder Now, RTMP socket will send messages to opener: 1) {rtmp, RTMP, connected}?? after encrypted handshake passes, this message is sent to server side and to client side 2) {rtmp, RTMP, Message::rtmp_message()} 3) {rtmp, RTMP, disconnected} Is such API clear? From bengt.kleberg@REDACTED Wed Dec 23 09:07:32 2009 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 23 Dec 2009 09:07:32 +0100 Subject: [erlang-questions] Reusing function in the module In-Reply-To: <45d8e23d0912220957n5ce80c66g3377524c9a6c3ee7@mail.gmail.com> References: <45d8e23d0912220957n5ce80c66g3377524c9a6c3ee7@mail.gmail.com> Message-ID: <1261555652.6853.6.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Greetings, Is it your intention that you should have a single interface module to all of the functionality in mod1.erl, mod2.erl etc? bengt On Tue, 2009-12-22 at 11:57 -0600, Senthilkumar Peelikkampatti wrote: > I wanted to know what are the ways by which we can reuse functions > with pure functional sense. Is that good to use extends > (http://www.erlang.org/euc/07/papers/1700Carlsson.pdf) > > These are my requirements > I have mod1.erl, mod2.erl etc > > mod1.erl - has different falovor of save and its utility functions > mod2.erl - has update and its utility functions > mod3.erl -- has same functions as mod1 but few more functions specific > to itself. It is normally solved by either composition or inheritance > in OOP. Borrowing a leaf from Joe's book (page 47-49), I can use > pattern matching to do that. Here I need to club everything together > and use different varient of pattern for variance of functionality. > Is there any other way? > > From gordon@REDACTED Wed Dec 23 09:28:45 2009 From: gordon@REDACTED (Gordon Guthrie) Date: Wed, 23 Dec 2009 08:28:45 +0000 Subject: Edinburgh/Scotland Erlang Masterclass/Erlounge Message-ID: Folks There will be an Erlang Architecture Masterclass and an Erlounge in Edinburgh in January. Online registration is at: http://nl16.tiny.hn/ Cheers Gordon From leap@REDACTED Wed Dec 23 09:45:01 2009 From: leap@REDACTED (Michael Turner) Date: Wed, 23 Dec 2009 08:45:01 +0000 Subject: No subject In-Reply-To: <9bd8a08a0912221220y2aae0982j9bdcd3626a846359@mail.gmail.com> Message-ID: <2DDWwrXL.1261557901.3782100.leap@gol.com> On 12/22/2009, "egarrulo" wrote: > From leap@REDACTED Wed Dec 23 09:55:24 2009 From: leap@REDACTED (Michael Turner) Date: Wed, 23 Dec 2009 08:55:24 +0000 Subject: Emacs as Erlang IDE for newbies In-Reply-To: <9bd8a08a0912221220y2aae0982j9bdcd3626a846359@mail.gmail.com> Message-ID: 2009/12/22 Garrett Smith > If you just want to teach the language, any editor that supports > syntax highlighting for Erlang should be fine. You are talking about a > full featured functional language - anyone using Erlang really should > be more than capable of figuring out how to use a text editor. Sheesh > :) > egarrulo: Why should a newbie be fine with just a syntax-highlighting editor? Newbies do need more help from tools, not less. I maintain that an easy way to compile and run projects and a source-level debugger are vital. me: I'm starting to think that's the best choice for now -- no need to call it an editor, just say "here's a program that helps you write, change and run Erlang programs." Later on, they might realize they were tricked into learning something about this thing called an "editor". egarrulo: If you want to keep it basic, you could setup an IDE with Emacs+ErlangMode+Distel and adjust it to your needs (no need to learn Emacs for that). I'm considering throwing FlymakeErlang and Wrangler in, too. On the face of it, Wrangler might seem a strange choice -- for, surely, refactoring tools are for Real Programmers? But maybe not. Maybe beginners should have them at the beginning. Some common refactorings are very simple, like "change this function name everywhere." I wish I'd had that when I was starting out. As for Flymake, I really don't buy this idea that syntax error messages from the Erlang shell are now adequately clear. Hardly a day goes by that I don't have to peel myself off the ceiling, shouting, "'Syntax error before: &'?! Be specific!" I want to know more. And so will noobs. -michael turner From egarrulo@REDACTED Wed Dec 23 10:09:34 2009 From: egarrulo@REDACTED (egarrulo) Date: Wed, 23 Dec 2009 09:09:34 +0000 Subject: Emacs as Erlang IDE for newbies In-Reply-To: References: <9bd8a08a0912221220y2aae0982j9bdcd3626a846359@mail.gmail.com> Message-ID: <9bd8a08a0912230109u563b7e39nf37f16473608f053@mail.gmail.com> 2009/12/23 Michael Turner > > Why should a newbie be fine with just a syntax-highlighting editor? > Newbies > do need more help from tools, not less. I maintain that an easy way to > compile and run projects and a source-level debugger are vital. > > me: > I'm starting to think that's the best choice for now -- no need to call > it an editor, just say "here's a program that helps you write, change > and run Erlang programs." > Bravo! That would be a smart move ;-) Indeed, who cares about editors? They just need "a program that helps /them/ write, change and run Erlang programs." On the face of it, Wrangler might seem a strange choice -- for, surely, > refactoring tools are for Real Programmers? But maybe not. Maybe > beginners should have them at the beginning. Some common refactorings > are very simple, like "change this function name everywhere." I wish > I'd had that when I was starting out. > Agreed. > As for Flymake, I really don't buy this idea that syntax error messages > from the Erlang shell are now adequately clear. Hardly a day goes by > that I don't have to peel myself off the ceiling, shouting, "'Syntax > error before: &'?! Be specific!" I want to know more. > > And so will noobs. > That's not a wrong thought. I've suggested Emacs because, besides its uncluttered interface, you could tailor its configuration and its packages' ones to suit your needs, exposing as much functionality as you wish. From clist@REDACTED Wed Dec 23 13:04:26 2009 From: clist@REDACTED (Angel Alvarez) Date: Wed, 23 Dec 2009 13:04:26 +0100 Subject: Another erlang performance test =?iso-8859-1?q?=BFWho_needs_a_lot_of_heap?= space? Message-ID: <200912231304.26570.clist@uah.es> Hi lists ive just found http://timyang.net/programming/c-erlang-java-performance/ this guy tried the erlang test with: erl +K true +h 99999 +P 99999 -smp enable +S 2:1 -s ehttpd Still erlang shines IMHO versus java or Go but i think +h 99999 is far from correct Who needs 99999 bytes of heap just for return a simple hello word http result? On 1 CPU i think erlang would be faster with a more conservative heap. (Now He is just measuring unused heap copy back and forth..) Waht dou you think ? -- No imprima este correo si no es necesario. El medio ambiente est? en nuestras manos. __________________________________________ Clist UAH a.k.a Angel __________________________________________ Artista -- (internet) --> Usuario final. As? los artistas cobran m?s y dicen menos paridas sobre lo que creen que es la pirater?a. From caio.ariede@REDACTED Wed Dec 23 13:10:07 2009 From: caio.ariede@REDACTED (caio ariede) Date: Wed, 23 Dec 2009 10:10:07 -0200 Subject: [erlang-questions] Reusing function in the module In-Reply-To: <1261555652.6853.6.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> References: <45d8e23d0912220957n5ce80c66g3377524c9a6c3ee7@mail.gmail.com> <1261555652.6853.6.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Message-ID: <6a9ba5690912230410o2b4969dbmb207452a02d8bdc6@mail.gmail.com> Can you exemplify the "pattern matching way"? Caio Ariede http://caioariede.com/ On Wed, Dec 23, 2009 at 6:07 AM, Bengt Kleberg wrote: > Greetings, > > Is it your intention that you should have a single interface module to > all of the functionality in mod1.erl, mod2.erl etc? > > > bengt > > > On Tue, 2009-12-22 at 11:57 -0600, Senthilkumar Peelikkampatti wrote: >> I wanted to know what are the ways by which we can reuse functions >> with pure functional sense. Is that good to use extends >> (http://www.erlang.org/euc/07/papers/1700Carlsson.pdf) >> >> These are my requirements >> I have mod1.erl, mod2.erl etc >> >> mod1.erl - has different falovor of save and its utility functions >> mod2.erl - has update and its utility functions >> mod3.erl -- has same functions as mod1 but few more functions specific >> to itself. It is normally solved by either composition or inheritance >> in OOP. Borrowing a leaf from Joe's book (page 47-49), I can use >> pattern matching to do that. Here I need to club everything together >> and use different varient of pattern for variance of functionality. >> Is there any other way? >> >> > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From litaocheng@REDACTED Wed Dec 23 13:38:53 2009 From: litaocheng@REDACTED (litao cheng) Date: Wed, 23 Dec 2009 20:38:53 +0800 Subject: =?UTF-8?Q?Re=3A_=5Berlang=2Dquestions=5D_Another_erlang_performance_te?= =?UTF-8?Q?st_=C2=BFWho_needs_a_lot_of_heap_space=3F?= In-Reply-To: <200912231304.26570.clist@uah.es> References: <200912231304.26570.clist@uah.es> Message-ID: the author use +h 99999 just for that benchmark. it's set the min heap size for process, with this option the http process will not involve garbage collect, so the performance will be more satisfied. that's all. you can also use +h 88888, this heap size for that simple http echo process is enough. Best Regards litao cheng On Wed, Dec 23, 2009 at 8:04 PM, Angel Alvarez wrote: > Hi lists > > ive just found > > http://timyang.net/programming/c-erlang-java-performance/ > > > > this guy tried the erlang test with: > > erl +K true +h 99999 +P 99999 -smp enable +S 2:1 -s ehttpd > > Still erlang shines IMHO versus java or Go but i think +h 99999 is far from > correct > > Who needs 99999 bytes of heap just for return a simple hello word http > result? > > On 1 CPU i think erlang would be faster with a more conservative heap. (Now > He is just measuring unused heap copy back and forth..) > > Waht dou you think ? > > > > -- > No imprima este correo si no es necesario. El medio ambiente est? en > nuestras manos. > __________________________________________ > > Clist UAH a.k.a Angel > __________________________________________ > Artista -- (internet) --> Usuario final. As? los artistas cobran m?s y > dicen menos paridas sobre lo que creen que es la pirater?a. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From kiszl@REDACTED Wed Dec 23 13:54:06 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Wed, 23 Dec 2009 13:54:06 +0100 Subject: =?ISO-8859-1?Q?Re=3A_=5Berlang-questions=5D_Another_erlang?= =?ISO-8859-1?Q?_performance_test_=BFWho_needs_a_lot_of_h?= =?ISO-8859-1?Q?eap_space=3F?= In-Reply-To: <200912231304.26570.clist@uah.es> References: <200912231304.26570.clist@uah.es> Message-ID: <4B3212EE.5010501@tmit.bme.hu> Strange things going on there... he only starts one online scheduler, yet spawns two acceptor loops. Also he does not use scheduler binding, even though he has two schedulers for eight cores... Angel Alvarez wrote: > Hi lists > > ive just found > > http://timyang.net/programming/c-erlang-java-performance/ > > > > this guy tried the erlang test with: > > erl +K true +h 99999 +P 99999 -smp enable +S 2:1 -s ehttpd > > Still erlang shines IMHO versus java or Go but i think +h 99999 is far from correct > > Who needs 99999 bytes of heap just for return a simple hello word http result? > > On 1 CPU i think erlang would be faster with a more conservative heap. (Now He is just measuring unused heap copy back and forth..) > > Waht dou you think ? > > > > From clist@REDACTED Wed Dec 23 14:05:02 2009 From: clist@REDACTED (Angel Alvarez) Date: Wed, 23 Dec 2009 14:05:02 +0100 Subject: [erlang-questions] Another erlang performance test =?iso-8859-1?q?=BFWho_needs_a_lot_of_heap?= space? In-Reply-To: <4B3212EE.5010501@tmit.bme.hu> References: <200912231304.26570.clist@uah.es> <4B3212EE.5010501@tmit.bme.hu> Message-ID: <200912231405.02664.clist@uah.es> El Mi?rcoles, 23 de Diciembre de 2009 13:54:06 Zoltan Lajos Kis escribi?: > Strange things going on there... he only starts one online scheduler, > yet spawns two acceptor loops. > Also he does not use scheduler binding, even though he has two > schedulers for eight cores... > Yeah! meny obscure point that deserve clarification. Also ive seen many test where the erlang VM is treated like a mere runtime and not like the pseudo OS that is. > > Angel Alvarez wrote: > > Hi lists > > > > ive just found > > > > http://timyang.net/programming/c-erlang-java-performance/ > > > > > > > > this guy tried the erlang test with: > > > > erl +K true +h 99999 +P 99999 -smp enable +S 2:1 -s ehttpd > > > > Still erlang shines IMHO versus java or Go but i think +h 99999 is far from correct > > > > Who needs 99999 bytes of heap just for return a simple hello word http result? > > > > On 1 CPU i think erlang would be faster with a more conservative heap. (Now He is just measuring unused heap copy back and forth..) > > > > Waht dou you think ? > > > > > > > > > > -- No imprima este correo si no es necesario. El medio ambiente est? en nuestras manos. __________________________________________ Clist UAH a.k.a Angel __________________________________________ Sex is a battle, love is war. From rtrlists@REDACTED Wed Dec 23 14:58:11 2009 From: rtrlists@REDACTED (Robert Raschke) Date: Wed, 23 Dec 2009 13:58:11 +0000 Subject: [erlang-questions] Erlide packageability (was Re: "Erlang as a First Language" -- crazy? or juststupid?) In-Reply-To: <9bd8a08a0912221236q78ccefd6r20a7112167bc9130@mail.gmail.com> References: <9bd8a08a0912200009u7bc3c3f9y62198c9c783bdc49@mail.gmail.com> <9bd8a08a0912221220y2aae0982j9bdcd3626a846359@mail.gmail.com> <9bd8a08a0912221236q78ccefd6r20a7112167bc9130@mail.gmail.com> Message-ID: <6a3ae47e0912230558m14827982i572651700673c189@mail.gmail.com> If writing code is too hard, try Scratch (http://scratch.mit.edu/), the modern day Logo. But otherwise, programming is a mostly textual thing. So a good editor that suits one's personality is pretty important (I also mean IDEs, as they include an editor). And I get the distinct impression there are two definitions of "programming" floating about: assemble something from libraries (the handyman approach) vs. build a system according to design rules (the engineering approach). The latter has always been "too hard". Shame that SW tends not to kill people, otherwise, we'd be much further along the road most other engineering practices have gone down. But maybe it's just the "youth" of the profession ... me cynical? surely not ;-) Robby From clist@REDACTED Wed Dec 23 15:00:33 2009 From: clist@REDACTED (Angel Alvarez) Date: Wed, 23 Dec 2009 15:00:33 +0100 Subject: [erlang-questions] Another erlang performance test =?utf-8?q?=C2=BFWho_needs_a_lot_of_heap?= space? In-Reply-To: References: <200912231304.26570.clist@uah.es> <200912231404.56872.clist@uah.es> Message-ID: <200912231500.34462.clist@uah.es> ive attached a quick mod of ehttpd.erl (its named ehttpd2) just printing process_info one the acceptors... it seems that is far from the 80k.... sinosuke@REDACTED:~/Documents/Personal/Erlang/Code> erl Erlang R13B03 (erts-5.7.4) [source] [rq:1] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.7.4 (abort with ^G) 1> ehttpd2:start(). ehttpd ready with 1 schedulers on port 8888 Acceptor (1): Memory Info: [{registered_name,acceptor_1},{current_function,{ehttpd2,accept,2}},{initial_call,{ehttpd2,accept,2}},{status,running},{message_queue_len,0},{messages,[]},{links,[<0.33.0>]},{dictionary,[]},{trap_exit,false},{error_handler,error_handler},{priority,normal},{group_leader,<0.26.0>},{total_heap_size,233},{heap_size,233},{stack_size,3},{reductions,3},{garbage_collection,[{fullsweep_after,65535},{minor_gcs,0}]},{suspending,[]}] Just a few hit from the broser the acceptor seems to no use more memory... Acceptor (1): Memory Info: [{registered_name,acceptor_1},{current_function,{ehttpd2,accept,2}},{initial_call,{ehttpd2,accept,2}},{status,running},{message_queue_len,0},{messages,[]},{links,[<0.33.0>,#Port<0.515>]},{dictionary,[]},{trap_exit,false},{error_handler,error_handler},{priority,normal},{group_leader,<0.26.0>},{total_heap_size,754},{heap_size,377},{stack_size,3},{reductions,429},{garbage_collection,[{fullsweep_after,65535},{minor_gcs,2}]},{suspending,[]}] Acceptor (1): Memory Info: [{registered_name,acceptor_1},{current_function,{ehttpd2,accept,2}},{initial_call,{ehttpd2,accept,2}},{status,running},{message_queue_len,0},{messages,[]},{links,[<0.33.0>,#Port<0.516>]},{dictionary,[]},{trap_exit,false},{error_handler,error_handler},{priority,normal},{group_leader,<0.26.0>},{total_heap_size,754},{heap_size,377},{stack_size,3},{reductions,635},{garbage_collection,[{fullsweep_after,65535},{minor_gcs,3}]},{suspending,[]}] Acceptor (1): Memory Info: [{registered_name,acceptor_1},{current_function,{ehttpd2,accept,2}},{initial_call,{ehttpd2,accept,2}},{status,running},{message_queue_len,0},{messages,[]},{links,[<0.33.0>,#Port<0.517>]},{dictionary,[]},{trap_exit,false},{error_handler,error_handler},{priority,normal},{group_leader,<0.26.0>},{total_heap_size,754},{heap_size,377},{stack_size,3},{reductions,840},{garbage_collection,[{fullsweep_after,65535},{minor_gcs,4}]},{suspending,[]}] Acceptor (1): Memory Info: [{registered_name,acceptor_1},{current_function,{ehttpd2,accept,2}},{initial_call,{ehttpd2,accept,2}},{status,running},{message_queue_len,0},{messages,[]},{links,[<0.33.0>,#Port<0.518>]},{dictionary,[]},{trap_exit,false},{error_handler,error_handler},{priority,normal},{group_leader,<0.26.0>},{total_heap_size,754},{heap_size,377},{stack_size,3},{reductions,1058},{garbage_collection,[{fullsweep_after,65535},{minor_gcs,6}]},{suspending,[]}] Acceptor (1): Memory Info: [{registered_name,acceptor_1},{current_function,{ehttpd2,accept,2}},{initial_call,{ehttpd2,accept,2}},{status,running},{message_queue_len,0},{messages,[]},{links,[<0.33.0>,#Port<0.519>]},{dictionary,[]},{trap_exit,false},{error_handler,error_handler},{priority,normal},{group_leader,<0.26.0>},{total_heap_size,754},{heap_size,377},{stack_size,3},{reductions,1263},{garbage_collection,[{fullsweep_after,65535},{minor_gcs,7}]},{suspending,[]}] Still i dont know how the workers will do but when measuring againts 100 or more process the continous copying of 80k of mostly unused heaps is not fair to compare againts a optimzed matured nginx. The more concurrency you add more overhead on the erlang side... Why slow down erlang with useless oversized heaps? Just to keep java on the trends? :-P or helping the Go "monster Mix of paradigms"... Still erlang rules... El Mi?rcoles, 23 de Diciembre de 2009 litao cheng escribi?: > hi Angel Alvarez, yes I also think the 80 K is too big. > I hope someone will give us some high performance principles. > :) > > On Wed, Dec 23, 2009 at 9:04 PM, Angel Alvarez wrote: > > > El Mi?rcoles, 23 de Diciembre de 2009 litao cheng escribi?: > > > the author use +h 99999 just for that benchmark. it's set the min heap > > size > > > for process, with this option > > > the http process will not involve garbage collect, so the performance > > will > > > be more satisfied. that's all. > > > you can also use +h 88888, this heap size for that simple http echo > > process > > > is enough. > > ~80 K for a process stil is overkill. Erlang procceses can be very > > ligthweigth. I dont know but ill try to see whts's the bare minimun > > for an acceptor loop. I thinks around 16k is still more than needed.... > > > > Any erlang gurus can enligthen us? > > > > I put the code here just for brevity (Seems to use some starge patch) > > > > -module(ehttpd). > > -compile(export_all). > > start() -> > > start(8888). > > start(Port) -> > > N = erlang:system_info(schedulers), > > listen(Port, N), > > io:format(?ehttpd ready with ~b schedulers on port ~b~n?, [N, Port]), > > register(?MODULE, self()), > > receive Any -> io:format(?~p~n?, [Any]) end. %% to stop: ehttpd!stop. > > listen(Port, N) -> > > Opts = [{active, false}, > > binary, > > {backlog, 256}, > > {packet, http_bin}, > > {raw,6,9,<<1:32/native>>}, %defer accept > > %%{delay_send,true}, > > %%{nodelay,true}, > > {reuseaddr, true}], > > {ok, S} = gen_tcp:listen(Port, Opts), > > Spawn = fun(I) -> > > register(list_to_atom(?acceptor_? ++ integer_to_list(I)), > > spawn_opt(?MODULE, accept, [S, I], [link, {scheduler, I}])) > > end, > > lists:foreach(Spawn, lists:seq(1, N)). > > accept(S, I) -> > > case gen_tcp:accept(S) of > > {ok, Socket} -> spawn_opt(?MODULE, loop, [Socket], [{scheduler, I}]); > > Error -> erlang:error(Error) > > end, > > accept(S, I). > > loop(S) -> > > case gen_tcp:recv(S, 0) of > > {ok, http_eoh} -> > > Response = <<"HTTP/1.1 200 OK\r\nContent-Length: 12\r\n\r\nhello > > world!">>, > > gen_tcp:send(S, Response), > > gen_tcp:close(S), > > ok; > > {ok, _Data} -> > > loop(S); > > Error -> > > Error > > end. > > > > > > Best Regards > > > litao cheng > > > > > > On Wed, Dec 23, 2009 at 8:04 PM, Angel Alvarez wrote: > > > > > > > Hi lists > > > > > > > > ive just found > > > > > > > > http://timyang.net/programming/c-erlang-java-performance/ > > > > > > > > > > > > > > > > this guy tried the erlang test with: > > > > > > > > erl +K true +h 99999 +P 99999 -smp enable +S 2:1 -s ehttpd > > > > > > > > Still erlang shines IMHO versus java or Go but i think +h 99999 is far > > from > > > > correct > > > > > > > > Who needs 99999 bytes of heap just for return a simple hello word http > > > > result? > > > > > > > > On 1 CPU i think erlang would be faster with a more conservative heap. > > (Now > > > > He is just measuring unused heap copy back and forth..) > > > > > > > > Waht dou you think ? > > > > > > > > > > > > > > > > -- > > > > No imprima este correo si no es necesario. El medio ambiente est? en > > > > nuestras manos. > > > > __________________________________________ > > > > > > > > Clist UAH a.k.a Angel > > > > __________________________________________ > > > > Artista -- (internet) --> Usuario final. As? los artistas cobran m?s y > > > > dicen menos paridas sobre lo que creen que es la pirater?a. > > > > > > > > ________________________________________________________________ > > > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > > > erlang-questions (at) erlang.org > > > > > > > > > > > > > > > > > > > -- > > No imprima este correo si no es necesario. El medio ambiente est? en > > nuestras manos. > > __________________________________________ > > > > Clist UAH a.k.a Angel > > __________________________________________ > > If debugging is the process of removing bugs, then programming must be the > > process of putting them in. Dijkstra. > > > -- Agua para todo? No, Agua para Todos. ->>----------------------------------------------- Clist UAH a.k.a Angel ---------------------------------[www.uah.es]-<<-- No le dar?a Cocacola Zero, ni a mi peor enemigo. Para eso est? el gas Mostaza que es mas piadoso. -------------- next part -------------- -module(ehttpd2). -compile(export_all). start() -> start(8888). start(Port) -> N = erlang:system_info(schedulers), listen(Port, N), io:format("ehttpd ready with ~b schedulers on port ~b~n", [N, Port]), register(?MODULE, self()), receive Any -> io:format("~p~n", [Any]) end. %% to stop: ehttpd!stop. listen(Port, N) -> Opts = [{active, false}, binary, {backlog, 256}, {packet, http_bin}, {raw,6,9,<<1:32/native>>}, %defer accept %%{delay_send,true}, %%{nodelay,true}, {reuseaddr, true}], {ok, S} = gen_tcp:listen(Port, Opts), Spawn = fun(I) -> register(list_to_atom("acceptor_" ++ integer_to_list(I)), spawn_opt(?MODULE, accept, [S, I], [link, {scheduler, I}])) end, lists:foreach(Spawn, lists:seq(1, N)). accept(S, I) -> io:format("Acceptor (~w):~nMemory Info:~n~w~n", [I,erlang:process_info(self())]), case gen_tcp:accept(S) of {ok, Socket} -> spawn_opt(?MODULE, loop, [Socket], [{scheduler, I}]); Error -> erlang:error(Error) end, accept(S, I). loop(S) -> case gen_tcp:recv(S, 0) of {ok, http_eoh} -> Response = <<"HTTP/1.1 200 OK\r\nContent-Length: 12\r\n\r\nhello world!">>, gen_tcp:send(S, Response), gen_tcp:close(S), ok; {ok, _Data} -> loop(S); Error -> Error end. From rapsey@REDACTED Wed Dec 23 15:53:56 2009 From: rapsey@REDACTED (Rapsey) Date: Wed, 23 Dec 2009 15:53:56 +0100 Subject: [erlang-questions] Designing protocol library In-Reply-To: References: Message-ID: <97619b170912230653m78cad644p1fd7e1e8b1ce8d01@mail.gmail.com> Do you need such a deep API? RTMP is basically RPC + audio/video. So whoever uses it, that is what he will be doing. I would put RTMP in its own process, you send messages to it to call functions tho whomever you are communicating and the RTMP process sends you messages when the other side is calling you. Same thing with audio/video. Have you thought about how RTMPT would fit into your design? It's a layer on top of RTMP and if you plan on doing RTMPE, that is a layer in between. With RTMPT you have X amount of sockets open to your RTMP session, if your RTMP state is anything but a simple PID to the RTMP session process, you will have a very hard time implementing it. Sergej On Wed, Dec 23, 2009 at 8:41 AM, Max Lapshin wrote: > Hi everyone, I need help: I want to extract RTMP encode/decode library > from erlyvideo, but I still don't have clear idea, how would it look > like. > > There are two ideas: > 1) RTMP library just as HTTP mode of socket should be able to work > with sockets in active mode (send subscriber messages) and should > maintain its internal state > 2) RTMP library should be useable as "pure functional" decoding > methods just like erlang:decode_packet > > It seems for me, that API must look like: > > Pure functional part: > > -type(rtmp_state, opaque). > -type(rtmp_message, ...). > > decode(State::rtmp_state(), Data::binary()) -> > {NewState::rtmp_state(), Message::rtmp_message(), Rest::binary()} | > {State::rtmp_state(), Data::binary()}. > > encode(State::rtmp_state(), Message::rtmp_message()) -> > {NewState::rtmp_state(), Data::binary()}. > > It is very important to track state, because RTMP is very, very > stateful protocol: each incoming message change RTMP decoder state. > > > Active socket part: > > type(socket(), port()). > type(rtmp_mode(), active|passive|once). > type(rtmp_socket, {socket = socket(), state = rtmp_state(), consumer = > pid(), mode = rtmp_mode()}). > connect(Socket::socket()) -> RTMP::rtmp_socket() ? method for client > connection to RTMP server > accept(Socket::socket()) -> RTMP::rtmp_socket() ? method for server > accepting new RTMP connection from client > setopts(RTMP::rtmp_socket(), [{active, true} | {active, once} | > passive]). ? the same as mode for HTTP socket > send(RTMP::rtmp_socket(), Message::rtmp_message()} ? it is very > important to send this message through API, because sending outside > messages also modifies state of RTMP encoder > > Now, RTMP socket will send messages to opener: > > 1) {rtmp, RTMP, connected} ? after encrypted handshake passes, this > message is sent to server side and to client side > 2) {rtmp, RTMP, Message::rtmp_message()} > 3) {rtmp, RTMP, disconnected} > > > > Is such API clear? > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From steve.e.123@REDACTED Wed Dec 23 17:48:02 2009 From: steve.e.123@REDACTED (Steve) Date: Wed, 23 Dec 2009 11:48:02 -0500 Subject: Distributed application logging Message-ID: <4B3249C2.30302@gmail.com> I'm hoping someone might shed some light on the best/easiest way to do distributed application event logging. In my app I have master node, two failover master nodes, and then a set of nodes that are coordinated by the master node and communicate with the master node via global fully qualified names. Each node will run its own application instance, vm and hardware. My goal is to log all standard sasl events which are generated on the local nodes (alarms, errors, progress and supervisor reports) to the central master node. The way I currently do this is to 1) register a global event manager on the central node and 2) send local sasl events to this global manager. I have a log_mf_h handler on the central node which I use to manage the global log. This code exists as its own application alongside my main application so I can get progress reports about the main application starting, etc. This all works pretty well. The only "problem" is that log_mf_h and rb don't say much about the node that generated the event. Pids are of course there, and I know I can get node info from a pid via node/1. I can probably send my own reports to log_mf_h or create my own round robin log that contains reports with info about the nodes. But I'd rather get the most out of what's already there in erlang if I can being a big fan of not reinventing the wheel. So... I guess my question is: am I on the right track more or less, or have I missed something in the docs/libs or my app design that would help me? Thanks in advance. Steve From vances@REDACTED Wed Dec 23 18:36:40 2009 From: vances@REDACTED (Vance Shipley) Date: Wed, 23 Dec 2009 12:36:40 -0500 Subject: [erlang-questions] Re: Erlide packageability (was Re: "Erlang as a First Language" -- crazy? or juststupid?) In-Reply-To: <9bd8a08a0912220437r22cc5eedm2baf58beadd5e359@mail.gmail.com> References: <9bd8a08a0912200009u7bc3c3f9y62198c9c783bdc49@mail.gmail.com> <9bd8a08a0912220437r22cc5eedm2baf58beadd5e359@mail.gmail.com> Message-ID: <20091223173640.GC10904@h216-235-12-174.host.egate.net> On Tue, Dec 22, 2009 at 12:37:31PM +0000, egarrulo wrote: } I wouldn't tell a beginner to use an editor to develop anything. A language } lacking an IDE - and by "IDE" I mean an editor with syntax-highlighting and } interaction with language's compiler and source-level debugger, at least - } such language is not worth learning, IMHO. You are representative of all that is wrong with today's workforce. I wouldn't let a first year student anywhere near an "IDE". -- -Vance From jarrod@REDACTED Wed Dec 23 18:45:51 2009 From: jarrod@REDACTED (Jarrod Roberson) Date: Wed, 23 Dec 2009 12:45:51 -0500 Subject: [erlang-questions] Re: Erlide packageability (was Re: "Erlang as a First Language" -- crazy? or juststupid?) In-Reply-To: <20091223173640.GC10904@h216-235-12-174.host.egate.net> References: <9bd8a08a0912200009u7bc3c3f9y62198c9c783bdc49@mail.gmail.com> <9bd8a08a0912220437r22cc5eedm2baf58beadd5e359@mail.gmail.com> <20091223173640.GC10904@h216-235-12-174.host.egate.net> Message-ID: On Wed, Dec 23, 2009 at 12:36 PM, Vance Shipley wrote: > On Tue, Dec 22, 2009 at 12:37:31PM +0000, egarrulo wrote: > } I wouldn't tell a beginner to use an editor to develop anything. A > language > } lacking an IDE - and by "IDE" I mean an editor with syntax-highlighting > and > } interaction with language's compiler and source-level debugger, at least > - > } such language is not worth learning, IMHO. > > You are representative of all that is wrong with today's workforce. > I wouldn't let a first year student anywhere near an "IDE". > > -- > -Vance > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > so all the people that I used to work with that used Windows Notepad exclusively to do Java development are productivity GODS in your opinion? From vances@REDACTED Wed Dec 23 18:48:56 2009 From: vances@REDACTED (Vance Shipley) Date: Wed, 23 Dec 2009 12:48:56 -0500 Subject: [erlang-questions] Re: Erlide packageability (was Re: "Erlang as a First Language" -- crazy? or juststupid?) In-Reply-To: References: <9bd8a08a0912200009u7bc3c3f9y62198c9c783bdc49@mail.gmail.com> <9bd8a08a0912220437r22cc5eedm2baf58beadd5e359@mail.gmail.com> <20091223173640.GC10904@h216-235-12-174.host.egate.net> Message-ID: <20091223174856.GE10904@h216-235-12-174.host.egate.net> On Wed, Dec 23, 2009 at 12:45:51PM -0500, Jarrod Roberson wrote: } so all the people that I used to work with that used Windows Notepad } exclusively to do Java development are productivity GODS in your opinion? At least they knew what they were doing. -- -Vance From malcolm@REDACTED Wed Dec 23 18:49:39 2009 From: malcolm@REDACTED (Dowse, Malcolm) Date: Wed, 23 Dec 2009 17:49:39 -0000 Subject: More general record syntax? Message-ID: <14DFD46F55E79E45A9FCA338BCE11C4411481A@UKLHREXCL02.activision.com> Hello, I had an idea about how Erlang's record syntax could be extended. And as far as I can tell, nobody has ever suggested it. So I was wondering what people think.. As most of us know, records in Erlang are just a handy syntactic wrapper for tuples. But, the way I see it, the atom that identifies the record is used in two different ways. At compile-time, it is associated with a list of named fields and their defaults. And at run-time it's the first element of a tuple. My idea was to allow two different atoms for the two uses. The syntax could be something like this: #compile_time_atom/run_time_atom{field1 = val1, field2 = val2, ...} So, given a record -record(r, {n, m}). #r/t{n = 3, m = 4} would evaluate to {t, 3, 4}. #r{n = 1, m = 2} would mean #r/r{n = 1, m = 2}, which would evaluate to {r, 1, 2}. pattern matching would work too: #r/rn{n = N} = {rn, 0, 0}. Also, to make it even more powerful the run-time atom could probably also be a variable (though I can't imagine it being used very often): #r/Rec{n = N, m = M} = {rec_name, 3, 4} The main reason I'd find the above change useful is that when hot-upgrading a gen_server, the state record definition can change. Since you can't have two different record definitions (old and new) with the same name, you have to go mucking around with the internal tuple representation of the record. For example, in the old style you would write code like this: -record(state, {a, b, c}). % -record(state, {a, b}). %OLD % ... code_change(_OldVsn, {state, A, B}, _Extra) -> {noreply, #state{a = A, b = B, c = 0}}. Whereas with the newer syntax, it would be: -record(state, {a, b, c}). -record(old_state, {a, b}). % ... code_change(_OldVsn, #old_state/state{a = A, b = B}, _Extra) -> {noreply, #state{a = A, b = B, c = 0}}. This example is really simple, but with field defaults and nested records it could get much more error-prone. Any thoughts? Malcolm From jarrod@REDACTED Wed Dec 23 19:00:55 2009 From: jarrod@REDACTED (Jarrod Roberson) Date: Wed, 23 Dec 2009 13:00:55 -0500 Subject: [erlang-questions] Re: Erlide packageability (was Re: "Erlang as a First Language" -- crazy? or juststupid?) In-Reply-To: <20091223174856.GE10904@h216-235-12-174.host.egate.net> References: <9bd8a08a0912200009u7bc3c3f9y62198c9c783bdc49@mail.gmail.com> <9bd8a08a0912220437r22cc5eedm2baf58beadd5e359@mail.gmail.com> <20091223173640.GC10904@h216-235-12-174.host.egate.net> <20091223174856.GE10904@h216-235-12-174.host.egate.net> Message-ID: On Wed, Dec 23, 2009 at 12:48 PM, Vance Shipley wrote: > On Wed, Dec 23, 2009 at 12:45:51PM -0500, Jarrod Roberson wrote: > } so all the people that I used to work with that used Windows Notepad > } exclusively to do Java development are productivity GODS in your > opinion? > > At least they knew what they were doing. > > -- > -Vance > if you call writing C code in Java knowing what they were doing, then they did. it was some of the most hideous anti-Java and anti-OO that I have ever seen. I guess you want someone that only knows how to use a torch and a hammer to work on your car as well? From vasilij.savin@REDACTED Wed Dec 23 19:17:19 2009 From: vasilij.savin@REDACTED (Vasilij Savin) Date: Wed, 23 Dec 2009 20:17:19 +0200 Subject: [erlang-questions] Re: Erlide packageability (was Re: "Erlang as a First Language" -- crazy? or juststupid?) In-Reply-To: <9bd8a08a0912220437r22cc5eedm2baf58beadd5e359@mail.gmail.com> References: <9bd8a08a0912200009u7bc3c3f9y62198c9c783bdc49@mail.gmail.com> <9bd8a08a0912220437r22cc5eedm2baf58beadd5e359@mail.gmail.com> Message-ID: Greetings, On Tue, Dec 22, 2009 at 2:37 PM, egarrulo wrote: > I wouldn't tell a beginner to use an editor to develop anything. A language > lacking an IDE - and by "IDE" I mean an editor with syntax-highlighting and > interaction with language's compiler and source-level debugger, at least - > such language is not worth learning, IMHO. I've done that in the past... > never again. > I do not see a problem running make file by hand. Also, debugger is not as useful in developing distributed or concurrent systems due to violation of real time properties, so that is irrelevant for Erlang I believe. Why does Java need Eclipse or like, because it is hugely complicated language. The names are too long to remember, there are hundreds of classes to sift through even in mid-sized project. You need tools to combat that complexity. There is no way around if you want to develop in OO way. At least as far as my experience goes, Erlang is much more compact and laconic language compared to Java. Some things would be really nice, like syntax highlighting and checking online, as function completion, but you can survive programming Erlang in text editor, but doing so in Java would be madness. Also, you learn language not because of tool support, but if it allows to express your intentions more clearly in machine-understandable way. That is why we have myriads of languages for different domains. Tool support comes once there is considerable market for them. In my opinion, tool support is currently coming to Erlang as it becomes more popular and mainstream (hopefully). Regards, Vasilij Savin From jan.koum@REDACTED Wed Dec 23 19:19:58 2009 From: jan.koum@REDACTED (Jan Koum) Date: Wed, 23 Dec 2009 10:19:58 -0800 Subject: backing up stopped node? Message-ID: <7c29a2a40912231019v781f18a8u78f67f7f1ebf1c6d@mail.gmail.com> hi there, we use ejabberd which uses both erlang and mnesia. what is the best way to backup mnesia database without having the node running? in other words, we don't want to run 'ejabberdctl backup' on a live and heavily loaded ejabberd server. so we want to do 'ejabberdctl stop' first -- however, after we stop the node, we obviously can't run 'ejabberdctl backup' against it. is there a simple solution/workaround to this? thanks. -- yan From max.lapshin@REDACTED Wed Dec 23 19:42:45 2009 From: max.lapshin@REDACTED (Max Lapshin) Date: Wed, 23 Dec 2009 21:42:45 +0300 Subject: [erlang-questions] Designing protocol library In-Reply-To: <97619b170912230653m78cad644p1fd7e1e8b1ce8d01@mail.gmail.com> References: <97619b170912230653m78cad644p1fd7e1e8b1ce8d01@mail.gmail.com> Message-ID: On Wed, Dec 23, 2009 at 5:53 PM, Rapsey wrote: > Do you need such a deep API? RTMP is basically RPC + audio/video. So whoever > uses it, that is what he will be doing. > I would put RTMP in its own process, you send messages to it to call > functions tho whomever you are communicating and the RTMP process sends you > messages when the other side is calling you. Same thing with audio/video. > Why deep? Two parts: active socket handler, that tracks state of channels and send high level messages to consumer and testable pure part, that decodes/encodes protocol. I've implemented this refactoring and soon will release this library. From kagato@REDACTED Wed Dec 23 22:14:13 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Wed, 23 Dec 2009 13:14:13 -0800 Subject: [erlang-questions] Distributed application logging In-Reply-To: <4B3249C2.30302@gmail.com> References: <4B3249C2.30302@gmail.com> Message-ID: I would write my own log handler that wrapped log_mf_h and recovered the node info when the event was received. Basically, just insert yourself and add the information you want. On Dec 23, 2009, at 8:48 AM, Steve wrote: > I'm hoping someone might shed some light on the best/easiest way to do distributed application event logging. > > In my app I have master node, two failover master nodes, and then a set of nodes that are coordinated by the master node and communicate with the master node via global fully qualified names. Each node will run its own application instance, vm and hardware. > > My goal is to log all standard sasl events which are generated on the local nodes (alarms, errors, progress and supervisor reports) to the central master node. > > The way I currently do this is to 1) register a global event manager on the central node and 2) send local sasl events to this global manager. I have a log_mf_h handler on the central node which I use to manage the global log. This code exists as its own application alongside my main application so I can get progress reports about the main application starting, etc. > > This all works pretty well. The only "problem" is that log_mf_h and rb don't say much about the node that generated the event. Pids are of course there, and I know I can get node info from a pid via node/1. I can probably send my own reports to log_mf_h or create my own round robin log that contains reports with info about the nodes. But I'd rather get the most out of what's already there in erlang if I can being a big fan of not reinventing the wheel. > > So... I guess my question is: am I on the right track more or less, or have I missed something in the docs/libs or my app design that would help me? > > Thanks in advance. > > Steve > > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > -- Jayson Vantuyl kagato@REDACTED From dbarker@REDACTED Wed Dec 23 21:29:20 2009 From: dbarker@REDACTED (Deryk Barker) Date: Wed, 23 Dec 2009 12:29:20 -0800 Subject: [erlang-questions] Re: Emacs as Erlang IDE for newbies In-Reply-To: <9bd8a08a0912230109u563b7e39nf37f16473608f053@mail.gmail.com> References: <9bd8a08a0912221220y2aae0982j9bdcd3626a846359@mail.gmail.com> <9bd8a08a0912230109u563b7e39nf37f16473608f053@mail.gmail.com> Message-ID: <4B327DA0.2010305@camosun.bc.ca> egarrulo wrote: > 2009/12/23 Michael Turner > >> Why should a newbie be fine with just a syntax-highlighting editor? >> Newbies >> do need more help from tools, not less. I maintain that an easy way to >> compile and run projects and a source-level debugger are vital. >> >> me: >> I'm starting to think that's the best choice for now -- no need to call >> it an editor, just say "here's a program that helps you write, change >> and run Erlang programs." >> >> > > Bravo! That would be a smart move ;-) > > Indeed, who cares about editors? They just need "a program that helps /them/ > write, change > and run Erlang programs." > > On the face of it, Wrangler might seem a strange choice -- for, surely, > >> refactoring tools are for Real Programmers? But maybe not. Maybe >> beginners should have them at the beginning. Some common refactorings >> are very simple, like "change this function name everywhere." I wish >> I'd had that when I was starting out. >> >> > > Agreed. > > > >> As for Flymake, I really don't buy this idea that syntax error messages >> from the Erlang shell are now adequately clear. Hardly a day goes by >> that I don't have to peel myself off the ceiling, shouting, "'Syntax >> error before: &'?! Be specific!" I want to know more. >> >> And so will noobs. >> >> > > That's not a wrong thought. > > I've suggested Emacs because, besides its uncluttered interface, you could > tailor its configuration and its packages' ones to suit your needs, exposing > as much functionality as you wish. > > Could someone inform a not-quite-noob (I'll have more thoughts on all of this when I've finished my ****** marking of final exams) let me know where to find flymake and wrangler; this is the first I've heard of either and they sound very interesting. deryk barker --- |Deryk Barker, Computer Science Dept. | Music does not have to be understood| |Camosun College, Victoria, BC, Canada| It has to be listened to. | |email: dbarker@REDACTED | | |phone: +1 250 370 4452 | Hermann Scherchen. | From dale@REDACTED Wed Dec 23 22:58:21 2009 From: dale@REDACTED (Dale Harvey) Date: Wed, 23 Dec 2009 21:58:21 +0000 Subject: [erlang-questions] Re: Emacs as Erlang IDE for newbies In-Reply-To: <4B327DA0.2010305@camosun.bc.ca> References: <9bd8a08a0912221220y2aae0982j9bdcd3626a846359@mail.gmail.com> <9bd8a08a0912230109u563b7e39nf37f16473608f053@mail.gmail.com> <4B327DA0.2010305@camosun.bc.ca> Message-ID: erlware mode has flymake mode integrated, http://github.com/erlware/erlware-mode and wrangler is available from http://www.cs.kent.ac.uk/projects/forse/ (+no_error_module_mismatch might need to be added to the erlc in flymake.sh for erlware mode, seems to be on a different version from mine) 2009/12/23 Deryk Barker > egarrulo wrote: > >> 2009/12/23 Michael Turner >> >> >>> Why should a newbie be fine with just a syntax-highlighting editor? >>> Newbies >>> do need more help from tools, not less. I maintain that an easy way to >>> compile and run projects and a source-level debugger are vital. >>> >>> me: >>> I'm starting to think that's the best choice for now -- no need to call >>> it an editor, just say "here's a program that helps you write, change >>> and run Erlang programs." >>> >>> >>> >> >> Bravo! That would be a smart move ;-) >> >> Indeed, who cares about editors? They just need "a program that helps >> /them/ >> write, change >> and run Erlang programs." >> >> On the face of it, Wrangler might seem a strange choice -- for, surely, >> >> >>> refactoring tools are for Real Programmers? But maybe not. Maybe >>> beginners should have them at the beginning. Some common refactorings >>> are very simple, like "change this function name everywhere." I wish >>> I'd had that when I was starting out. >>> >>> >>> >> >> Agreed. >> >> >> >> >>> As for Flymake, I really don't buy this idea that syntax error messages >>> from the Erlang shell are now adequately clear. Hardly a day goes by >>> that I don't have to peel myself off the ceiling, shouting, "'Syntax >>> error before: &'?! Be specific!" I want to know more. >>> >>> And so will noobs. >>> >>> >>> >> >> That's not a wrong thought. >> >> I've suggested Emacs because, besides its uncluttered interface, you could >> tailor its configuration and its packages' ones to suit your needs, >> exposing >> as much functionality as you wish. >> >> >> > Could someone inform a not-quite-noob (I'll have more thoughts on all of > this when I've finished my ****** marking of final exams) let me know where > to find flymake and wrangler; this is the first I've heard of either and > they sound very interesting. > > deryk barker > --- > |Deryk Barker, Computer Science Dept. | Music does not have to be > understood| > |Camosun College, Victoria, BC, Canada| It has to be listened to. > | > |email: dbarker@REDACTED | > | > |phone: +1 250 370 4452 | Hermann Scherchen. > | > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From gleber.p@REDACTED Wed Dec 23 23:42:29 2009 From: gleber.p@REDACTED (Gleb Peregud) Date: Wed, 23 Dec 2009 23:42:29 +0100 Subject: [erlang-questions] backing up stopped node? In-Reply-To: <7c29a2a40912231019v781f18a8u78f67f7f1ebf1c6d@mail.gmail.com> References: <7c29a2a40912231019v781f18a8u78f67f7f1ebf1c6d@mail.gmail.com> Message-ID: <14f0e3620912231442q16d6c30aud41119e32d9e3225@mail.gmail.com> You can use the following commands: erl $CTLNODENAME -noinput -noshell -eval "rpc:call($NODE, application, stop, [ejabberd])." -s init stop erl $CTLNODENAME -noinput -noshell -eval "rpc:call($NODE, mnesia, backup, [\"/path/to/backup\"])." -s init stop erl $CTLNODENAME -noinput -noshell -eval "rpc:call($NODE, application, start, [ejabberd])." -s init stop First command stops ejabberd inside Erlang VM, but leaves mnesia running. Second command backups mnesia schema to /path/to/backup Third command starts ejabberd back. Of couse make sure to replace $CTLNODENAME with appropriate "-sname ejabberd_ctl_node" or "-name ejabberd_ctl_node", depending on the mode ejabberd is running (with default params first one should work). $NODE should be node name of ejabberd server On Wed, Dec 23, 2009 at 19:19, Jan Koum wrote: > hi there, > > we use ejabberd which uses both erlang and mnesia. ?what is the best way to > backup mnesia database without having the node running? > > in other words, we don't want to run 'ejabberdctl backup' on a live and > heavily loaded ejabberd server. so we want to do 'ejabberdctl stop' first -- > however, after we stop the node, we obviously can't run 'ejabberdctl backup' > against it. ?is there a simple solution/workaround to this? > > thanks. > > -- yan > -------------- next part -------------- A non-text attachment was scrubbed... Name: patch_ctl_app.patch Type: text/x-diff Size: 476 bytes Desc: not available URL: From g@REDACTED Thu Dec 24 00:23:41 2009 From: g@REDACTED (Garrett Smith) Date: Wed, 23 Dec 2009 17:23:41 -0600 Subject: [erlang-questions] More general record syntax? In-Reply-To: <14DFD46F55E79E45A9FCA338BCE11C4411481A@UKLHREXCL02.activision.com> References: <14DFD46F55E79E45A9FCA338BCE11C4411481A@UKLHREXCL02.activision.com> Message-ID: On Wed, Dec 23, 2009 at 11:49 AM, Dowse, Malcolm wrote: -snip- > My idea was to allow two different atoms for the two uses. The syntax > could be something like this: > > #compile_time_atom/run_time_atom{field1 = val1, field2 = val2, ...} Ugh, and I thought it was painful to read *before* the enhancement ;) > The main reason I'd find the above change useful is that when > hot-upgrading a gen_server, the state record definition can change. > Since you can't have two different record definitions (old and new) with > the same name, you have to go mucking around with the internal tuple > representation of the record. You also run into this when Mnesia - any time you need to modify a record definition, you have to go though a painful mucking process. I haven't seen a particularly clean way to do this, so I'm curious what others think here. Personally, I'd like a way to convert tuples from one record def to another. E.g. -record(foo, {field1, field2}). -record(foo_v1, {field1}). upgrade(Foo_v1) -> #foo(Foo_v1, foo_v1) Since this would be a compile time conversion, I've introduced some hackish "cast" syntax. Not pretty, but you get the idea -- I want a foo record and I provide a tuple that complies with the foo_v1 definition. The first item in the tuple would be ignored since we're interested in mapping field values to tuple locations and don't care about the original record type. This doesn't solve pattern matching, but you can always include a version field in your record defs. It has the advantage of providing a trivial way to transform record tuples. Garrett From kiszl@REDACTED Thu Dec 24 00:39:51 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Thu, 24 Dec 2009 00:39:51 +0100 Subject: [erlang-questions] More general record syntax? In-Reply-To: References: <14DFD46F55E79E45A9FCA338BCE11C4411481A@UKLHREXCL02.activision.com> Message-ID: <4B32AA47.4010809@tmit.bme.hu> I would be lying if I said I understood Malcolm's proposal :) My only problem with records is that they are not versioned. That could simply be solved by adding a version field to records. For example: definition: -record(rec, "0.1", {field1 = a, field2 = b}). referral: #rec("0.1"){field1 = F} (if there is only one version of the record in the given context, the version could be omitted) representation: {rec, "0.1", a, b} This way code change could look like: code_change(_OldVsn, #rec("0.1"){a = A, b = B}, _Extra) -> {noreply, #rec("0.2"){a = A, b = B, c = 0}}. and would even work for upgrading from unversioned to versioned records. Regards, Zoltan. Garrett Smith wrote: > On Wed, Dec 23, 2009 at 11:49 AM, Dowse, Malcolm wrote: > > -snip- > > >> My idea was to allow two different atoms for the two uses. The syntax >> could be something like this: >> >> #compile_time_atom/run_time_atom{field1 = val1, field2 = val2, ...} >> > > Ugh, and I thought it was painful to read *before* the enhancement ;) > > >> The main reason I'd find the above change useful is that when >> hot-upgrading a gen_server, the state record definition can change. >> Since you can't have two different record definitions (old and new) with >> the same name, you have to go mucking around with the internal tuple >> representation of the record. >> > > You also run into this when Mnesia - any time you need to modify a > record definition, you have to go though a painful mucking process. I > haven't seen a particularly clean way to do this, so I'm curious what > others think here. > > Personally, I'd like a way to convert tuples from one record def to > another. E.g. > > -record(foo, {field1, field2}). > -record(foo_v1, {field1}). > > upgrade(Foo_v1) -> > #foo(Foo_v1, foo_v1) > > Since this would be a compile time conversion, I've introduced some > hackish "cast" syntax. Not pretty, but you get the idea -- I want a > foo record and I provide a tuple that complies with the foo_v1 > definition. The first item in the tuple would be ignored since we're > interested in mapping field values to tuple locations and don't care > about the original record type. > > This doesn't solve pattern matching, but you can always include a > version field in your record defs. It has the advantage of providing a > trivial way to transform record tuples. > > Garrett > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From max.lapshin@REDACTED Thu Dec 24 01:05:58 2009 From: max.lapshin@REDACTED (Max Lapshin) Date: Thu, 24 Dec 2009 03:05:58 +0300 Subject: [erlang-questions] Designing protocol library In-Reply-To: References: <97619b170912230653m78cad644p1fd7e1e8b1ce8d01@mail.gmail.com> Message-ID: I've done it and extracted RTMP from erlyvideo. You may take a look at an example rtmp client, made with erlang-rtmp: http://github.com/erlyvideo/erlang-rtmp/blob/master/contrib/rtmp_bench From g@REDACTED Thu Dec 24 01:15:21 2009 From: g@REDACTED (Garrett Smith) Date: Wed, 23 Dec 2009 18:15:21 -0600 Subject: [erlang-questions] More general record syntax? In-Reply-To: <4B32AA47.4010809@tmit.bme.hu> References: <14DFD46F55E79E45A9FCA338BCE11C4411481A@UKLHREXCL02.activision.com> <4B32AA47.4010809@tmit.bme.hu> Message-ID: (switching to top-post) I'm leery of changing the record definition syntax, in particular making it more complicated. If you want to version a record, it's pretty easy to add you own field. One other thought... I typically appreciate badrecord errors when I get them, but these conversion cases might be helped by a more lax check. This syntax: Foo#~foo_v1.field1 (again, making stuff up) says to use the Foo tuple as if it were a foo_v1 record. The check might simply be that there are at least as many tuple values as field defs in foo_v1. Basically it's an unsafe cast. This syntax: Foo#~foo_v1{field1=bar} would return Foo as its original record type with the updated field value. The value tuple location would be identified by the position of field1 in foo_v1, obviously. This syntax: Foo#~foo_v1#foo would return Foo converted to the foo record format using Foo as if it were actually foo_v1. (As far as my "keep the syntax simple" ideals, I've clearly failed :) Regarding record conversion: - Provide a lax record checking syntax that ignores the record type (first tuple item) and complains only when the tuple value count (ignoring the first item) is less than the field count in the specified record type. - Provide a way to coerce a tuple of an alleged type (regardless of the actual record type) into another record type. The conversion would be based on matching field names between the two record definitions. (Btw, if this has been discussed before, my apologies - this seems fundamental enough to have been an issue for quite a while. Perhaps there's already a straight forward solution to record conversion that doesn't require modifying the language.) Garrett On Wed, Dec 23, 2009 at 5:39 PM, Zoltan Lajos Kis wrote: > I would be lying if I said I understood Malcolm's proposal :) > My only problem with records is that they are not versioned. That could > simply be solved by adding a version field to records. For example: > > definition: ? -record(rec, "0.1", {field1 = a, field2 = b}). > referral: ? #rec("0.1"){field1 = F} ? (if there is only one version of the > record in the given context, the version could be omitted) > representation: ? {rec, "0.1", a, b} > > This way code change could look like: > > code_change(_OldVsn, #rec("0.1"){a = A, b = B}, _Extra) -> > ?{noreply, #rec("0.2"){a = A, b = B, c = 0}}. > > and would even work for upgrading from unversioned to versioned records. > > Regards, > Zoltan. > > > Garrett Smith wrote: >> >> On Wed, Dec 23, 2009 at 11:49 AM, Dowse, Malcolm >> wrote: >> >> -snip- >> >> >>> >>> My idea was to allow two different atoms for the two uses. The syntax >>> could be something like this: >>> >>> #compile_time_atom/run_time_atom{field1 = val1, field2 = val2, ...} >>> >> >> Ugh, and I thought it was painful to read *before* the enhancement ;) >> >> >>> >>> The main reason I'd find the above change useful is that when >>> hot-upgrading a gen_server, the state record definition can change. >>> Since you can't have two different record definitions (old and new) with >>> the same name, you have to go mucking around with the internal tuple >>> representation of the record. >>> >> >> You also run into this when Mnesia - any time you need to modify a >> record definition, you have to go though a painful mucking process. I >> haven't seen a particularly clean way to do this, so I'm curious what >> others think here. >> >> Personally, I'd like a way to convert tuples from one record def to >> another. E.g. >> >> ?-record(foo, {field1, field2}). >> ?-record(foo_v1, {field1}). >> >> ?upgrade(Foo_v1) -> >> ? ? ?#foo(Foo_v1, foo_v1) >> >> Since this would be a compile time conversion, I've introduced some >> hackish "cast" syntax. Not pretty, but you get the idea -- I want a >> foo record and I provide a tuple that complies with the foo_v1 >> definition. The first item in the tuple would be ignored since we're >> interested in mapping field values to tuple locations and don't care >> about the original record type. >> >> This doesn't solve pattern matching, but you can always include a >> version field in your record defs. It has the advantage of providing a >> trivial way to transform record tuples. >> >> Garrett >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> > > From mfidelman@REDACTED Thu Dec 24 01:28:27 2009 From: mfidelman@REDACTED (Miles Fidelman) Date: Wed, 23 Dec 2009 19:28:27 -0500 Subject: Erlang as a First Language Message-ID: <4B32B5AB.9010200@meetinghouse.net> Michael Turner wrote: > I'm working on a project in the > overlap between cognitive science and linguistics. These people aren't > necessarily math-heavy (on the linguistics side, anyway), but they can > tolerate odd notations, abstruse jargon and fine conceptual distinctions > that would evoke only dread, if not nausea, in ordinary folk. and later: > (1) I won't be teaching a class. Anyway, that's not my plan. A modest > website with tutorials and starter packages, with no promised support > except to the researchers I'm working directly with -- that's the most > I'm thinking about right now. Even teaching a class for that select > few is not likely -- I'm on the other side of the world from them, and > this is unfunded work. > > (2) Don't underestimate how hostile some of these people can be to the > idea of programming at all. One researcher I'm corresponding with > recently wrote me that he'd rather peel his skin off than write code. > If you're having trouble understanding this perspective, here's a way > to think about it: imagine you could work on your dream project, the > kind of system you've always wanted to be creating. Earning 10% more > than the highest hourly rate you've ever commanded. With your choice > of programming environments. Got that image set? OK, there's a catch. > You know that "choice of environments" I mentioned? Here it is: you > can write it in Object-Oriented Cobol for an IBM AS/400 with a > green-screen glass-tty terminal, or in Fortran 90 while telnetted from > Windows 95 into a DEC VMS system. THAT's how some of these people > would feel at the outset about any programming language, and an > environment like the Erlang shell. I think this really captures the essence of the question: If a. You're starting with non-programmers, and, b. You're working on a cognitive science application that is inherently massively concurrent, then I'd think you're better off with Erlang than pretty much any other language (really, what else is there for massive concurrency). This is really the question of whether to use a discipline-specific language vs. a generic one. With complicated problems, the hard part is getting one's head around the problem - choice of language should be dictated on what makes that easy. Miles Fidelman -- In theory, there is no difference between theory and practice. In practice, there is. .... Yogi Berra -- In theory, there is no difference between theory and practice. In practice, there is. .... Yogi Berra From kenji.rikitake@REDACTED Thu Dec 24 02:27:14 2009 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Thu, 24 Dec 2009 10:27:14 +0900 Subject: [erlang-questions] epmd IP binding In-Reply-To: <7c29a2a40912220207vd444a45o911c6fab04749e95@mail.gmail.com> References: <7c29a2a40912220207vd444a45o911c6fab04749e95@mail.gmail.com> Message-ID: <20091224012714.GA64281@k2r.org> In the message <7c29a2a40912220207vd444a45o911c6fab04749e95@REDACTED> dated Tue, Dec 22, 2009 at 02:06:59AM -0800, Jan Koum writes: > our freebsd box has multiple interfaces with multiple IP addresses. is it > possible to bind epmd to a specific IP address instead of *:4369? thanks, You cannot, without modifying epmd. (see SET_ADDR_ANY macro in erts/epmd/src/epmd_int.h and the bind() system call of erts/epmd/src/epmd_srv.c (for R13B03)) I think being able to bind() to a specific IP address is an essential function, especially running Erlang on a gateway box between multiple networks. The code would be relatively simple. One of the issues is how to specify the address, for both IPv4 and IPv6. Kenji Rikitake From kenji.rikitake@REDACTED Thu Dec 24 02:41:38 2009 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Thu, 24 Dec 2009 10:41:38 +0900 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: <3dbc6d1c0912220713k66c18773o2c498d1523e616b7@mail.gmail.com> References: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> <3BHgSuhp.1261405791.5964000.leap@gol.com> <3dbc6d1c0912220713k66c18773o2c498d1523e616b7@mail.gmail.com> Message-ID: <20091224014138.GB64281@k2r.org> In the message <3dbc6d1c0912220713k66c18773o2c498d1523e616b7@REDACTED> dated Tue, Dec 22, 2009 at 04:13:04PM +0100, Robert Virding writes: > I've programmed Fortran on VAX/VMS, even before I had an Emacs on it. What's > the problem? I've programmed BLISS-32, MACRO-32, VAX C and of course the command scripts on VAX/VMS without Emacs (though I had the EVE editor, which was much easier to use than EDT - in VMS V5.4 in 1990-1991). Syntax coloring is nice (and I'm writing this message in Emacs 22), and other assistance goodies may help writing code, but after all you need to read the code by yourself anyway. And if a person doesn't like the act of programming just because of that, so be it; most of programming is still a tedious work of writing non-WYSIWYG sentences. > Seriously, I think if you are that hung up on an IDE-based environment > you've got problems anyway. In one sense having a very simple and basic > environment may actually be easier to use just because it is so simple and > basic which can make it easier to see and understand what is going on. +1. On Atmel AVR C(++) programming, I decided I'd rather use the good old Make-error-and-retry method than depending on the AVR IDE environment. > Robert Kenji Rikitake From dimavs@REDACTED Thu Dec 24 03:58:16 2009 From: dimavs@REDACTED (Dmitri Sosnik) Date: Thu, 24 Dec 2009 13:58:16 +1100 (EST) Subject: [erlang-questions] Re: Emacs as Erlang IDE for newbies In-Reply-To: References: <9bd8a08a0912221220y2aae0982j9bdcd3626a846359@mail.gmail.com> <9bd8a08a0912230109u563b7e39nf37f16473608f053@mail.gmail.com> <4B327DA0.2010305@camosun.bc.ca> Message-ID: Flymake is a part of emacs 23. On Wed, 23 Dec 2009, Dale Harvey wrote: > erlware mode has flymake mode integrated, > http://github.com/erlware/erlware-mode > > and wrangler is available from > http://www.cs.kent.ac.uk/projects/forse/ > > (+no_error_module_mismatch might need to be added to the erlc in flymake.sh > for erlware mode, seems to be on a different version from mine) From egarrulo@REDACTED Thu Dec 24 11:46:43 2009 From: egarrulo@REDACTED (egarrulo) Date: Thu, 24 Dec 2009 11:46:43 +0100 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: <3dbc6d1c0912220713k66c18773o2c498d1523e616b7@mail.gmail.com> References: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> <3BHgSuhp.1261405791.5964000.leap@gol.com> <3dbc6d1c0912220713k66c18773o2c498d1523e616b7@mail.gmail.com> Message-ID: <9bd8a08a0912240246p7da4c4b8p8aeb99d7a326214d@mail.gmail.com> 2009/12/22 Robert Virding > I've programmed Fortran on VAX/VMS, even before I had an Emacs on it. > What's > the problem? > Would you throw away all your Emacs goodies and go back to that? That's the problem. From rtrlists@REDACTED Thu Dec 24 12:15:06 2009 From: rtrlists@REDACTED (Robert Raschke) Date: Thu, 24 Dec 2009 11:15:06 +0000 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: <9bd8a08a0912240246p7da4c4b8p8aeb99d7a326214d@mail.gmail.com> References: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> <3BHgSuhp.1261405791.5964000.leap@gol.com> <3dbc6d1c0912220713k66c18773o2c498d1523e616b7@mail.gmail.com> <9bd8a08a0912240246p7da4c4b8p8aeb99d7a326214d@mail.gmail.com> Message-ID: <6a3ae47e0912240315j11dcaa18r6a322264e07ddf4e@mail.gmail.com> On Thu, Dec 24, 2009 at 10:46 AM, egarrulo wrote: > 2009/12/22 Robert Virding > > > I've programmed Fortran on VAX/VMS, even before I had an Emacs on it. > > What's > > the problem? > > > > Would you throw away all your Emacs goodies and go back to that? > > That's the problem. > I understand that tools like IDEs are "nice to have", but they are not programming. About 80-90% of programming is thinking time. If it is not, then you are experimenting, not designing and writing a system! Experimentation can be valuable step when you are building a system, no doubt. But when it gets to the nitty gritty, no amount of experimentation will get you a solution; no matter how "productive" your tools may make you feel. When learning to program, a lot of what you do is experimentation, so an IDE can be helpful. But only if you also learn that this is not enough! Robby From mfidelman@REDACTED Thu Dec 24 13:34:51 2009 From: mfidelman@REDACTED (Miles Fidelman) Date: Thu, 24 Dec 2009 07:34:51 -0500 Subject: Erlang as a First Language Message-ID: <4B335FEB.30801@meetinghouse.net> Michael Turner wrote: > I'm working on a project in the > overlap between cognitive science and linguistics. These people aren't > necessarily math-heavy (on the linguistics side, anyway), but they can > tolerate odd notations, abstruse jargon and fine conceptual distinctions > that would evoke only dread, if not nausea, in ordinary folk. and later: > (1) I won't be teaching a class. Anyway, that's not my plan. A modest > website with tutorials and starter packages, with no promised support > except to the researchers I'm working directly with -- that's the most > I'm thinking about right now. Even teaching a class for that select > few is not likely -- I'm on the other side of the world from them, and > this is unfunded work. > > (2) Don't underestimate how hostile some of these people can be to the > idea of programming at all. One researcher I'm corresponding with > recently wrote me that he'd rather peel his skin off than write code. > If you're having trouble understanding this perspective, here's a way > to think about it: imagine you could work on your dream project, the > kind of system you've always wanted to be creating. Earning 10% more > than the highest hourly rate you've ever commanded. With your choice > of programming environments. Got that image set? OK, there's a catch. > You know that "choice of environments" I mentioned? Here it is: you > can write it in Object-Oriented Cobol for an IBM AS/400 with a > green-screen glass-tty terminal, or in Fortran 90 while telnetted from > Windows 95 into a DEC VMS system. THAT's how some of these people > would feel at the outset about any programming language, and an > environment like the Erlang shell. I think this really captures the essence of the question: If a. You're starting with non-programmers, and, b. You're working on a cognitive science application that is inherently massively concurrent, then I'd think you're better off with Erlang than pretty much any other language (really, what else is there for massive concurrency). This is really the question of whether to use a discipline-specific language vs. a generic one. With complicated problems, the hard part is getting one's head around the problem - choice of language should be dictated on what makes that easy. Miles Fidelman -- In theory, there is no difference between theory and practice. In practice, there is. .... Yogi Berra -- In theory, there is no difference between theory and practice. In practice, there is. .... Yogi Berra -- In theory, there is no difference between theory and practice. In practice, there is. .... Yogi Berra From egarrulo@REDACTED Thu Dec 24 14:11:44 2009 From: egarrulo@REDACTED (egarrulo) Date: Thu, 24 Dec 2009 14:11:44 +0100 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: <6a3ae47e0912240315j11dcaa18r6a322264e07ddf4e@mail.gmail.com> References: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> <3BHgSuhp.1261405791.5964000.leap@gol.com> <3dbc6d1c0912220713k66c18773o2c498d1523e616b7@mail.gmail.com> <9bd8a08a0912240246p7da4c4b8p8aeb99d7a326214d@mail.gmail.com> <6a3ae47e0912240315j11dcaa18r6a322264e07ddf4e@mail.gmail.com> Message-ID: <9bd8a08a0912240511v14c3bd14g29b6661985507453@mail.gmail.com> 2009/12/24 Robert Raschke > > I understand that tools like IDEs are "nice to have", but they are not > programming. > > About 80-90% of programming is thinking time. If it is not, then you are > experimenting, not designing and writing a system! > I would agree if we were talking about skilled programmers. When you're learning a new language, the amount of twiddling vs designing is much more. Your understanding of how your program work is limited, and no matter how long you stare at your misbehaving code, you will have a difficult time understanding what and where it's breaking. Maybe I have this opinion because my first language has been C, and learning it without a source level debugger would have been much less efficient. What I've observed is that once people become proficient at a skill, they usually forget how things can be difficult for a newcomer. OTOH, a huge IDE would be overkill, and would hamper learning. That's why I've not recommended using Eclipse. From max.lapshin@REDACTED Thu Dec 24 14:25:28 2009 From: max.lapshin@REDACTED (Max Lapshin) Date: Thu, 24 Dec 2009 16:25:28 +0300 Subject: [erlang-questions] Designing protocol library In-Reply-To: References: <97619b170912230653m78cad644p1fd7e1e8b1ce8d01@mail.gmail.com> Message-ID: And, Sergey, You can take a look at rtmpt support. It is working and rather convenient. From toby@REDACTED Thu Dec 24 18:40:42 2009 From: toby@REDACTED (Toby Thain) Date: Thu, 24 Dec 2009 12:40:42 -0500 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: <9bd8a08a0912240511v14c3bd14g29b6661985507453@mail.gmail.com> References: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> <3BHgSuhp.1261405791.5964000.leap@gol.com> <3dbc6d1c0912220713k66c18773o2c498d1523e616b7@mail.gmail.com> <9bd8a08a0912240246p7da4c4b8p8aeb99d7a326214d@mail.gmail.com> <6a3ae47e0912240315j11dcaa18r6a322264e07ddf4e@mail.gmail.com> <9bd8a08a0912240511v14c3bd14g29b6661985507453@mail.gmail.com> Message-ID: On 24-Dec-09, at 8:11 AM, egarrulo wrote: > 2009/12/24 Robert Raschke > >> >> I understand that tools like IDEs are "nice to have", but they are >> not >> programming. >> >> About 80-90% of programming is thinking time. If it is not, then >> you are >> experimenting, not designing and writing a system! >> > > I would agree if we were talking about skilled programmers. When > you're > learning a new language, the amount of twiddling vs designing is > much more. > Your understanding of how your program work is limited, and no > matter how > long you stare at your misbehaving code, you will have a difficult > time > understanding what and where it's breaking. But this discipline is important even for proficient programmers. Why not develop it at the same time... > Maybe I have this opinion > because my first language has been C, and learning it without a > source level > debugger Mostly, I learned C without a computer to run it on. Just a copy of K&R. I still don't use source level debuggers, 24 years later. > would have been much less efficient. What I've observed is that > once people become proficient at a skill, they usually forget how > things can > be difficult for a newcomer. And if you learn by, and become accustomed to, source level debugging, would you not atrophy skills such as auditing code by eye and reasoning about it statically, and become tool reliant? That's OK, I guess - it's just a different work style. --Toby > > OTOH, a huge IDE would be overkill, and would hamper learning. > That's why > I've not recommended using Eclipse. From kenji.rikitake@REDACTED Fri Dec 25 01:31:52 2009 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Fri, 25 Dec 2009 09:31:52 +0900 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: <9bd8a08a0912240246p7da4c4b8p8aeb99d7a326214d@mail.gmail.com> References: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> <3BHgSuhp.1261405791.5964000.leap@gol.com> <3dbc6d1c0912220713k66c18773o2c498d1523e616b7@mail.gmail.com> <9bd8a08a0912240246p7da4c4b8p8aeb99d7a326214d@mail.gmail.com> Message-ID: <20091225003152.GA81838@k2r.org> In the message <9bd8a08a0912240246p7da4c4b8p8aeb99d7a326214d@REDACTED> dated Thu, Dec 24, 2009 at 11:46:19AM +0100, egarrulo writes: > Would you throw away all your Emacs goodies and go back to that? If I didn't have to write Japanese (or even I have to), I'll stick to vim (solely for the multi-level undo feature which BSD nvi doesn't have - so vi is enough). Note that I will not claim which is better or not; I rather want to tell you need to get the things done anyway even if you haven't got the tools you want. And I've written my PhD thesis in English without Emacs :) (I'm writing this using Emacs BTW.) I think automatic indentation is essential for editing the code of most of the programming languages including Erlang, C, awk, Perl, Python, or whatever too. I still rarely use source code debuggers unless to analyze a coredump file for the stack trace. I'd rather review the source code myself and simulate how it works to find out what I did wrong when debugging. One very good thing about Erlang is that all variables are only assigned ONCE; this will make the debugging much easier. And I suggest you to read the "10. The more talented somebody is, the less they need the props." section of the Web page in the following URL. Having a better toolset does not necessarily guarantee you can do much better work. http://gapingvoid.com/books/ Just a thought. Regards, Kenji Rikitake From rvirding@REDACTED Fri Dec 25 01:54:39 2009 From: rvirding@REDACTED (Robert Virding) Date: Fri, 25 Dec 2009 01:54:39 +0100 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: <9bd8a08a0912240246p7da4c4b8p8aeb99d7a326214d@mail.gmail.com> References: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> <3BHgSuhp.1261405791.5964000.leap@gol.com> <3dbc6d1c0912220713k66c18773o2c498d1523e616b7@mail.gmail.com> <9bd8a08a0912240246p7da4c4b8p8aeb99d7a326214d@mail.gmail.com> Message-ID: <3dbc6d1c0912241654g235f4d82iab0601e8d9e75f8@mail.gmail.com> 2009/12/24 egarrulo > 2009/12/22 Robert Virding > > I've programmed Fortran on VAX/VMS, even before I had an Emacs on it. >> What's >> the problem? >> > > Would you throw away all your Emacs goodies and go back to that? > > That's the problem. > No, my point was rather that you take what you can get and work it. It doesn't mean that you can't try and improve your tools, I was a member of a group who implemented an emacs look-alike for VAX/VMS and Dec-10. But I do think that refusing to learn and use a language because it doesn't have an IDE is rather stupid, it is not really that difficult to do it yourself. Also I tend to be skeptical of "intelligent" systems that try to help me. I often find that if such systems don't get it really right they are usually a hindrance as you then have to work around them. I have nothing against getting help but I prefer its workings to be transparent so you can understand what it does and can use it efficiently. Robert P.S. For a real experience you should try editing lisp without an editor which knows lisp indentation. From erlang@REDACTED Fri Dec 25 01:56:05 2009 From: erlang@REDACTED (Illo de' Illis) Date: Fri, 25 Dec 2009 01:56:05 +0100 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: References: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> <3BHgSuhp.1261405791.5964000.leap@gol.com> <3dbc6d1c0912220713k66c18773o2c498d1523e616b7@mail.gmail.com> <9bd8a08a0912240246p7da4c4b8p8aeb99d7a326214d@mail.gmail.com> <6a3ae47e0912240315j11dcaa18r6a322264e07ddf4e@mail.gmail.com> <9bd8a08a0912240511v14c3bd14g29b6661985507453@mail.gmail.com> Message-ID: <1245E835-509F-47E9-B156-36D6BA005613@trainedmonkeys.net> On Dec 24, 2009, at 6:40 PM, Toby Thain wrote: [...] > Mostly, I learned C without a computer to run it on. Just a copy of K&R. I still don't use source level debuggers, 24 years later. > [...] > And if you learn by, and become accustomed to, source level debugging, would you not atrophy skills such as auditing code by eye and reasoning about it statically, and become tool reliant? > > That's OK, I guess - it's just a different work style. Glad to see my thoughts shared by someone else. I've worked on big projects for almost every existing platform (OS/400, MVS, HOST, Plan9 ...) coding on a plethora of languages with lots of different screen-oriented editors (seu, sam, mostly vim on *nix derivatives, no syntax highlighting whatsoever), and I've found my lack of dependence on external tools such as context-sensitive editors, IDEs, RADs and source debuggers to be definitely positive. I'm unquestionably not a genius, but I can look at a source and spot the bug most often than not, and I believe it should be a featured shared by every programmer. I also agree with a previous poster on the fact that IDEs and RADs are (unless complex UIs are involved) mostly the consequence of syntactically confusing programming languages with lots of incoherently long-named library functions. What I often see is programmers who keep on coding mostly by using cut&paste and function/prototype completion, and debug on a bovine trial-and-error basis with their powerful debuggers. After one year this way they still cannot remember most of the functions they regularly use, which is sad. Ciao, Illo. PS: I'm somewhat fanatical, but I believe function/arguments completion to be the root of all evil -- even if I couldn't do without it when programming with laughably-long-constructs-based languages. From leap@REDACTED Fri Dec 25 06:59:17 2009 From: leap@REDACTED (Michael Turner) Date: Fri, 25 Dec 2009 05:59:17 +0000 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: <20091225003152.GA81838@k2r.org> Message-ID: On 12/25/2009, "Kenji Rikitake" wrote: >One very good thing about Erlang is that all variables are only assigned >ONCE; this will make the debugging much easier. There's another good thing about Erlang assignment: it's not really assignment. Which is good, because assignment is a pretty weird concept. We just forgot. Years ago, I has a girlfriend who was not exactly bad at math (we were in the same differential equations course; she was scoring higher on the tests). She knew nothing about computers, though. She pointed out something she was sure was an error in a FORTRAN program I was writing: X = X+1 To her, this was impossible. I tried to explain assignment, but I think she was still puzzled in the end. Erlang "assignment" is really more like a kind of equation solving. To the extent that people new to programming have any mathematical intuitions or skills they might bring to bear on learning the skill, Erlang would seem to be a better match to what they learned in their basic algebra classes. -michael turner On 12/25/2009, "Kenji Rikitake" wrote: >In the message <9bd8a08a0912240246p7da4c4b8p8aeb99d7a326214d@REDACTED> >dated Thu, Dec 24, 2009 at 11:46:19AM +0100, >egarrulo writes: >> Would you throw away all your Emacs goodies and go back to that? > >If I didn't have to write Japanese (or even I have to), I'll stick to >vim (solely for the multi-level undo feature which BSD nvi doesn't have >- so vi is enough). Note that I will not claim which is better or not; I >rather want to tell you need to get the things done anyway even if you >haven't got the tools you want. And I've written my PhD thesis in >English without Emacs :) (I'm writing this using Emacs BTW.) > >I think automatic indentation is essential for editing the code of most >of the programming languages including Erlang, C, awk, Perl, Python, or >whatever too. > >I still rarely use source code debuggers unless to analyze a coredump >file for the stack trace. I'd rather review the source code myself and >simulate how it works to find out what I did wrong when debugging. > >One very good thing about Erlang is that all variables are only assigned >ONCE; this will make the debugging much easier. > >And I suggest you to read the "10. The more talented somebody is, the >less they need the props." section of the Web page in the following URL. >Having a better toolset does not necessarily guarantee you can do much >better work. > >http://gapingvoid.com/books/ > >Just a thought. > >Regards, >Kenji Rikitake > >________________________________________________________________ >erlang-questions mailing list. See http://www.erlang.org/faq.html >erlang-questions (at) erlang.org > > From max.lapshin@REDACTED Fri Dec 25 11:37:20 2009 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 25 Dec 2009 13:37:20 +0300 Subject: edoc only specific modules Message-ID: Hi, I want to document erlang-rtmp library and have problems: I need to document only specific modules (there are 7 of them in library and 4 are hidden). I cannot understand, what must I do, to tell edoc to hide unrequired modules. From ssyeoh@REDACTED Sat Dec 26 12:31:24 2009 From: ssyeoh@REDACTED (ssyeoh) Date: Sat, 26 Dec 2009 03:31:24 -0800 (PST) Subject: Common Test questions Message-ID: <02b00857-cd8c-47e3-a741-766cda5d32a3@d20g2000yqh.googlegroups.com> hi, I have two questions concerning common test (CT). 1. How do I test an application on node A with common test running on another node, B (using erlang distribution) ? One way might be to wrap all function calls in the test suite in RPC, but is there a way CT would automatically do that ? 2. I would like to test a side effect function (e.g. write to file) after EVERY test case. Is there a way to plug this function into CT (through CT APIs) so that it would be automatically called after each test case ? thanks merry christmas /ssyeoh From vasilij.savin@REDACTED Sat Dec 26 12:42:05 2009 From: vasilij.savin@REDACTED (Vasilij Savin) Date: Sat, 26 Dec 2009 13:42:05 +0200 Subject: [erlang-questions] Common Test questions In-Reply-To: <02b00857-cd8c-47e3-a741-766cda5d32a3@d20g2000yqh.googlegroups.com> References: <02b00857-cd8c-47e3-a741-766cda5d32a3@d20g2000yqh.googlegroups.com> Message-ID: Greetings, I can not answer first one. Though if I recall correctly, you need to run CT on node under test, or have ssh access to shuttle or something like that. However, answer to second question is to put that function in after_test_case function. Then it is guaranteed to be called after every test case. It is worth mentioning "that after_" prefixed functions are usually expected to perform clean up, not perform testing. Therefore such solution could hinder later readability, unless it is well-documented. Regards, Vasilij Savin On Sat, Dec 26, 2009 at 1:31 PM, ssyeoh wrote: > hi, > I have two questions concerning common test (CT). > > 1. How do I test an application on node A with common test running on > another node, B (using erlang distribution) ? One way might be to wrap > all function calls in the test suite in RPC, but is there a way CT > would automatically do that ? > > 2. I would like to test a side effect function (e.g. write to file) > after EVERY test case. Is there a way to plug this function into CT > (through CT APIs) so that it would be automatically called after each > test case ? > > thanks > merry christmas > > /ssyeoh > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From max.lapshin@REDACTED Sat Dec 26 23:32:17 2009 From: max.lapshin@REDACTED (Max Lapshin) Date: Sun, 27 Dec 2009 01:32:17 +0300 Subject: Erlang RTMP library Message-ID: Hi, at least I have extracted RTMP library from erlyvideo, it has documentation located at http://erlyvideo.org/rtmp/ and repository at http://github.com/erlyvideo/erlang-rtmp/ I think, that I've found a good balance between "library is pure functional and cannot do anything practical" and "library keeps a lot of state inside and isn't suitable for using in other projects". There is a test client in examples, made from this library as a demonstration, that it can be used not only in erlyvideo project, but in other, for example in clients. From rapsey@REDACTED Sun Dec 27 08:12:09 2009 From: rapsey@REDACTED (Rapsey) Date: Sun, 27 Dec 2009 08:12:09 +0100 Subject: [erlang-questions] Erlang RTMP library In-Reply-To: References: Message-ID: <97619b170912262312t451fdb8ch3820914f9230e72c@mail.gmail.com> There is one performance issue with the way it is designed: State#rtmp_socket{buffer = <> This will cause binary to be reallocated and copied with every change. Sergej On Sat, Dec 26, 2009 at 11:32 PM, Max Lapshin wrote: > Hi, at least I have extracted RTMP library from erlyvideo, it has > documentation located at http://erlyvideo.org/rtmp/ and > repository at http://github.com/erlyvideo/erlang-rtmp/ > > I think, that I've found a good balance between "library is pure > functional and cannot do anything practical" and > "library keeps a lot of state inside and isn't suitable for using in > other projects". > > There is a test client in examples, made from this library as a > demonstration, that it can be used not only in erlyvideo project, > but in other, for example in clients. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From max.lapshin@REDACTED Sun Dec 27 10:42:54 2009 From: max.lapshin@REDACTED (Max Lapshin) Date: Sun, 27 Dec 2009 12:42:54 +0300 Subject: [erlang-questions] Erlang RTMP library In-Reply-To: <97619b170912262312t451fdb8ch3820914f9230e72c@mail.gmail.com> References: <97619b170912262312t451fdb8ch3820914f9230e72c@mail.gmail.com> Message-ID: On Sun, Dec 27, 2009 at 10:12 AM, Rapsey wrote: > There is one performance issue with the way it is designed: > > State#rtmp_socket{buffer = <> > > This will cause binary to be reallocated and copied with every change. As it is told in documentation, it may be optimized when there is enough space in Buffer binary. And I don't understand, how to do it better: if use list and iolist_to_binary, so I will have to make each time list and glue it, because data must be checked on each incoming tcp message. And how do You do? From rapsey@REDACTED Sun Dec 27 11:34:46 2009 From: rapsey@REDACTED (Rapsey) Date: Sun, 27 Dec 2009 11:34:46 +0100 Subject: [erlang-questions] Erlang RTMP library In-Reply-To: References: <97619b170912262312t451fdb8ch3820914f9230e72c@mail.gmail.com> Message-ID: <97619b170912270234n49b17bd8i19420008a4323709@mail.gmail.com> On Sun, Dec 27, 2009 at 10:42 AM, Max Lapshin wrote: > On Sun, Dec 27, 2009 at 10:12 AM, Rapsey wrote: > > There is one performance issue with the way it is designed: > > > > State#rtmp_socket{buffer = <> > > > > This will cause binary to be reallocated and copied with every change. > > As it is told in documentation, it may be optimized when there is > enough space in Buffer binary. > And I don't understand, how to do it better: if use list and > iolist_to_binary, so I will have > to make each time list and glue it, because data must be checked on > each incoming tcp message. > > > And how do You do? > Well I don't need a very general purpose solution. I'm not fully clear on how you implemented it, I am rather busy at the moment to look into it. I have a RTMP process and its implementation (and state) is not visible from outside. You send messages to it and receive responses back. Sergej From max.lapshin@REDACTED Sun Dec 27 17:15:39 2009 From: max.lapshin@REDACTED (Max Lapshin) Date: Sun, 27 Dec 2009 19:15:39 +0300 Subject: [erlang-questions] Erlang RTMP library In-Reply-To: <97619b170912270234n49b17bd8i19420008a4323709@mail.gmail.com> References: <97619b170912262312t451fdb8ch3820914f9230e72c@mail.gmail.com> <97619b170912270234n49b17bd8i19420008a4323709@mail.gmail.com> Message-ID: On Sun, Dec 27, 2009 at 1:34 PM, Rapsey wrote: > Well I don't need a very general purpose solution. I'm not fully clear on > how you implemented it, I am rather busy at the moment to look into it. > I have a RTMP process and its implementation (and state) is not visible from > outside. You send messages to it and receive responses back. > As far as I understand, there are two solutions to buffer incoming binary data: 1) append binary chunks to one big binary 2) accumulate in list and then iolist_to_binary(lists:reverse()) From max.lapshin@REDACTED Sun Dec 27 17:18:13 2009 From: max.lapshin@REDACTED (Max Lapshin) Date: Sun, 27 Dec 2009 19:18:13 +0300 Subject: [erlang-questions] edoc only specific modules In-Reply-To: <4B375EEB.5000505@gmail.com> References: <4B375EEB.5000505@gmail.com> Message-ID: Yes, I've missed this in documentation, but thanks. Now I've got next question: how to generate documentation in style of http://erldocs.com/R13B03/ ? I want the same templates for http://erlyvideo.org/rtmp and also I want to add custom code to documentation (DISQUS comments). The insertion of custom code is possible via external tools, but how to make new-style documentation? From dmitrii@REDACTED Sun Dec 27 18:11:20 2009 From: dmitrii@REDACTED (Dmitrii Dimandt) Date: Sun, 27 Dec 2009 19:11:20 +0200 Subject: [ANN] http://erlanger.ru/ Message-ID: This is to announce that http://erlanger.ru/ is finally online and fully operational :) http://erlanger.ru/ will now replace http://erlang.dmitriid.com/ as the primary Russian site for Erlang-related news, articles and so on, so update your bookmarks, if it was bookmarked :) From dale@REDACTED Sun Dec 27 18:33:59 2009 From: dale@REDACTED (Dale Harvey) Date: Sun, 27 Dec 2009 17:33:59 +0000 Subject: [erlang-questions] edoc only specific modules In-Reply-To: References: <4B375EEB.5000505@gmail.com> Message-ID: erldocs isnt the new style official documentation, its one of my personal projects, the new style official docs are up at http://demo.erlang.org/doc/ with modules documented with edoc, you can generate the xml file that is used to generate the documentation with docb_gen http://erldocs.com/R13B03/docbuilder/docb_gen.html?search=docb&i=3#module/1 the code to generate the erldocs style documentation with the xml sources is in http://github.com/daleharvey/erldocs.com right now its only convenient for the otp layout, but ill make it easier to include personal libraries soon, right now you can do git clone git://github.com/daleharvey/erldocs.com.git $cd src $erl >c(erldocs). >erldocs:all("/home/myname/myproj", "/home/myname/output", "/home/myname/erldocs/static", "Yay My Project"). where annoyingly it expects myproj/lib/myapp/doc/src to contain the xml files mentioned above. Ill make this all a bunch easier sometime soon, give me an email if you want a hand. to add disqus comments you can edit http://github.com/daleharvey/erldocs.com/blob/master/static/erldocs.tpl (comments is also on my wishlist) I believe the some of the build tools for the official erlang documentation have been released in R13B03 but I havent had any luck with them. Cheers Dale 2009/12/27 Max Lapshin > Yes, I've missed this in documentation, but thanks. Now I've got next > question: how to generate documentation in style of > http://erldocs.com/R13B03/ ? I want the same templates for > http://erlyvideo.org/rtmp and also I want to add custom code > to documentation (DISQUS comments). > > The insertion of custom code is possible via external tools, but how > to make new-style documentation? > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From max.lapshin@REDACTED Sun Dec 27 18:35:07 2009 From: max.lapshin@REDACTED (Max Lapshin) Date: Sun, 27 Dec 2009 20:35:07 +0300 Subject: [erlang-questions] edoc only specific modules In-Reply-To: References: <4B375EEB.5000505@gmail.com> Message-ID: Thank you a lot for this explanation! From egarrulo@REDACTED Mon Dec 28 00:01:35 2009 From: egarrulo@REDACTED (egarrulo) Date: Mon, 28 Dec 2009 00:01:35 +0100 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: References: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> <3BHgSuhp.1261405791.5964000.leap@gol.com> <3dbc6d1c0912220713k66c18773o2c498d1523e616b7@mail.gmail.com> <9bd8a08a0912240246p7da4c4b8p8aeb99d7a326214d@mail.gmail.com> <6a3ae47e0912240315j11dcaa18r6a322264e07ddf4e@mail.gmail.com> <9bd8a08a0912240511v14c3bd14g29b6661985507453@mail.gmail.com> Message-ID: <9bd8a08a0912271501l751f078br13b33f8c808e5f53@mail.gmail.com> 2009/12/24 Toby Thain > >> Mostly, I learned C without a computer to run it on. Just a copy of K&R. Same here ^_^ (albeit with a different book). I still don't use source level debuggers, 24 years later. In his "Writing Solid Code", Steve Maguire recommends running all new code through a source level debugger to check things are going the way you think they should. After reading that book, even if I'm able to understand code by staring at it, I routinely run my code through a source level debugger. This habit has allowed me to deeply understand some intricacies of C/C++ (I again stress that C/C++ have lots of pitfalls compared to Erlang). I maintain that a source level debugger - just like other program analysis tools - allows you to inspect a live program thus understand it at deeper levels, therefore it is an invaluable aid in learning/teaching. Some people maintain that source level debuggers are close to useless, however, as soon as a program starts misbehaving, you could see them cluttering it with printing statements to inspect its activity, that is: doing what a source level debugger would do much better. If, however, you really can do fine and fast without debuggers - I've never seen such a programmer - then by all means go for it. > And if you learn by, and become accustomed to, source level debugging, > would you not atrophy skills such as auditing code by eye and reasoning > about it statically, and become tool reliant? > Maybe. Can you still make math without a calculator? That depends on whether you have kept honed such skills. When a program misbehaves, I usually stare at its code first. From egarrulo@REDACTED Mon Dec 28 00:22:45 2009 From: egarrulo@REDACTED (egarrulo) Date: Mon, 28 Dec 2009 00:22:45 +0100 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: <3dbc6d1c0912241654g235f4d82iab0601e8d9e75f8@mail.gmail.com> References: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> <3BHgSuhp.1261405791.5964000.leap@gol.com> <3dbc6d1c0912220713k66c18773o2c498d1523e616b7@mail.gmail.com> <9bd8a08a0912240246p7da4c4b8p8aeb99d7a326214d@mail.gmail.com> <3dbc6d1c0912241654g235f4d82iab0601e8d9e75f8@mail.gmail.com> Message-ID: <9bd8a08a0912271522q77643490i9230a4c8747f6424@mail.gmail.com> 2009/12/25 Robert Virding > > But I do think that refusing to learn and use a language because it doesn't > have an IDE is rather stupid, it is not really that difficult to do it > yourself. > *It is* if you are a newbie both at programming and at using related tools. Unlike some people who call an IDE any editor with syntax-highlighting which allows you to run a compiler, I call an IDE at least an editor with syntax-highlighting which allows you to run a compiler *and* single step and debug your programs at source level. > > Also I tend to be skeptical of "intelligent" systems that try to help me. I > often find that if such systems don't get it really right they are usually a > hindrance as you then have to work around them. I have nothing against > getting help but I prefer its workings to be transparent so you can > understand what it does and can use it efficiently. > I do agree wholeheartedly (that's why I cannot stand Eclipse). Let's just not forget we all started bicycling with training wheels, and crawled before walking (again, that's why I've suggested Emacs as IDE). From rvirding@REDACTED Mon Dec 28 02:09:25 2009 From: rvirding@REDACTED (Robert Virding) Date: Mon, 28 Dec 2009 02:09:25 +0100 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: <9bd8a08a0912271522q77643490i9230a4c8747f6424@mail.gmail.com> References: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> <3BHgSuhp.1261405791.5964000.leap@gol.com> <3dbc6d1c0912220713k66c18773o2c498d1523e616b7@mail.gmail.com> <9bd8a08a0912240246p7da4c4b8p8aeb99d7a326214d@mail.gmail.com> <3dbc6d1c0912241654g235f4d82iab0601e8d9e75f8@mail.gmail.com> <9bd8a08a0912271522q77643490i9230a4c8747f6424@mail.gmail.com> Message-ID: <3dbc6d1c0912271709h7cfbc976t50c730a5f94a3c12@mail.gmail.com> 2009/12/28 egarrulo > > I do agree wholeheartedly (that's why I cannot stand Eclipse). Let's just > not forget we all started bicycling with training wheels, and crawled before > walking (again, that's why I've suggested Emacs as IDE). > While I most likely crawled before walking (can't remember myself) I never had training wheels on my first bicycle. It worked quite well but it did make stopping "interesting" until I was tall enough to reach the ground. :-) Robert From lloy0076@REDACTED Mon Dec 28 00:36:19 2009 From: lloy0076@REDACTED (David Lloyd) Date: Mon, 28 Dec 2009 10:06:19 +1030 Subject: IDE Bashing (Was Re: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid?) In-Reply-To: <9bd8a08a0912271522q77643490i9230a4c8747f6424@mail.gmail.com> References: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> <3BHgSuhp.1261405791.5964000.leap@gol.com> <3dbc6d1c0912220713k66c18773o2c498d1523e616b7@mail.gmail.com> <9bd8a08a0912240246p7da4c4b8p8aeb99d7a326214d@mail.gmail.com> <3dbc6d1c0912241654g235f4d82iab0601e8d9e75f8@mail.gmail.com> <9bd8a08a0912271522q77643490i9230a4c8747f6424@mail.gmail.com> Message-ID: <6FFFBE3D-6B9A-4BD2-908E-ACFB5D6D0ADF@adam.com.au> Hey People, IDEs are simply a tool - nothing less and nothing more; a good programmer doesn't really need one. Programming is an art form that doesn't need tools. However some programmers or artisans find the right tools useful to them and other people, who are not programmers, find that with tools they can be somewhat successful at programming but may not ever become a true artist or Michalangelo. Don't bash IDEs in general - they, like Erlang itself - have their uses. Remember: you don't NEED Erlang to be a good programmer either - programming is an art not defined by the language (which is the tool) one is using. Just as art can be poetry, painting, sculpture or even modern art that baffles the imagination. It's far better to ask, "When is it appropriate to use this tool (Erlang, this particular IDE)?" imho. DSL From toby@REDACTED Mon Dec 28 05:50:22 2009 From: toby@REDACTED (Toby Thain) Date: Sun, 27 Dec 2009 23:50:22 -0500 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: <9bd8a08a0912271501l751f078br13b33f8c808e5f53@mail.gmail.com> References: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> <3BHgSuhp.1261405791.5964000.leap@gol.com> <3dbc6d1c0912220713k66c18773o2c498d1523e616b7@mail.gmail.com> <9bd8a08a0912240246p7da4c4b8p8aeb99d7a326214d@mail.gmail.com> <6a3ae47e0912240315j11dcaa18r6a322264e07ddf4e@mail.gmail.com> <9bd8a08a0912240511v14c3bd14g29b6661985507453@mail.gmail.com> <9bd8a08a0912271501l751f078br13b33f8c808e5f53@mail.gmail.com> Message-ID: <429AF2F3-7DB2-4846-B88D-B9D2D799AAB2@telegraphics.com.au> On 27-Dec-09, at 6:01 PM, egarrulo wrote: > 2009/12/24 Toby Thain > ... > > And if you learn by, and become accustomed to, source level > debugging, would you not atrophy skills such as auditing code by > eye and reasoning about it statically, and become tool reliant? > > Maybe. Can you still make math without a calculator? That depends > on whether you have kept honed such skills. I cultivate the habit of using pencil and paper instead of a calculator for that reason. > When a program misbehaves, I usually stare at its code first. > Also a habit to be cultivated. --Toby From toby@REDACTED Mon Dec 28 05:54:49 2009 From: toby@REDACTED (Toby Thain) Date: Sun, 27 Dec 2009 23:54:49 -0500 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: <9bd8a08a0912271522q77643490i9230a4c8747f6424@mail.gmail.com> References: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> <3BHgSuhp.1261405791.5964000.leap@gol.com> <3dbc6d1c0912220713k66c18773o2c498d1523e616b7@mail.gmail.com> <9bd8a08a0912240246p7da4c4b8p8aeb99d7a326214d@mail.gmail.com> <3dbc6d1c0912241654g235f4d82iab0601e8d9e75f8@mail.gmail.com> <9bd8a08a0912271522q77643490i9230a4c8747f6424@mail.gmail.com> Message-ID: <82E3B865-154B-4DC3-BEF0-E9AEE11651D9@telegraphics.com.au> On 27-Dec-09, at 6:22 PM, egarrulo wrote: > 2009/12/25 Robert Virding > >> >> But I do think that refusing to learn and use a language because >> it doesn't >> have an IDE is rather stupid, it is not really that difficult to >> do it >> yourself. >> > > *It is* if you are a newbie both at programming and at using > related tools. > Unlike some people who call an IDE any editor with syntax- > highlighting which > allows you to run a compiler, I call an IDE at least an editor with > syntax-highlighting which allows you to run a compiler *and* single > step and > debug your programs at source level. > > >> >> Also I tend to be skeptical of "intelligent" systems that try to >> help me. I >> often find that if such systems don't get it really right they are >> usually a >> hindrance as you then have to work around them. I have nothing >> against >> getting help but I prefer its workings to be transparent so you can >> understand what it does and can use it efficiently. >> > > I do agree wholeheartedly (that's why I cannot stand Eclipse). > Let's just > not forget we all started bicycling with training wheels, and > crawled before > walking (again, that's why I've suggested Emacs as IDE). Then we all now seem to be in agreement that source level debuggers, IDEs, fancy editors or even a computer are entirely optional as learning aids. --Toby From vasilij.savin@REDACTED Mon Dec 28 06:20:15 2009 From: vasilij.savin@REDACTED (Vasilij Savin) Date: Mon, 28 Dec 2009 07:20:15 +0200 Subject: [erlang-questions] IDE Bashing (Was Re: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid?) In-Reply-To: <6FFFBE3D-6B9A-4BD2-908E-ACFB5D6D0ADF@adam.com.au> References: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> <3BHgSuhp.1261405791.5964000.leap@gol.com> <3dbc6d1c0912220713k66c18773o2c498d1523e616b7@mail.gmail.com> <9bd8a08a0912240246p7da4c4b8p8aeb99d7a326214d@mail.gmail.com> <3dbc6d1c0912241654g235f4d82iab0601e8d9e75f8@mail.gmail.com> <9bd8a08a0912271522q77643490i9230a4c8747f6424@mail.gmail.com> <6FFFBE3D-6B9A-4BD2-908E-ACFB5D6D0ADF@adam.com.au> Message-ID: Greetings, Disclaimer: It feels like Art vs Craft/Engineering flame bait. My apologies, if it was not the intention. As long as Programming is art, I can agree that you do not need tools. But that is only possible if one is developing small programmes in his leisure time. Once Programming is a craft or profession, you NEED Good tools, or you will never get your job done. Building anything remotely complicated calls for discipline and proper tools. Building summerhouse can be done spontaneously and for fun. Building cathedral is totally different matter. Regards, Vasilij Savin On Mon, Dec 28, 2009 at 1:36 AM, David Lloyd wrote: > > Hey People, > > IDEs are simply a tool - nothing less and nothing more; a good programmer > doesn't really need one. > > Programming is an art form that doesn't need tools. > > However some programmers or artisans find the right tools useful to them > and other people, who are not programmers, find that with tools they can be > somewhat successful at programming but may not ever become a true artist or > Michalangelo. > > Don't bash IDEs in general - they, like Erlang itself - have their uses. > > Remember: you don't NEED Erlang to be a good programmer either - > programming is an art not defined by the language (which is the tool) one is > using. Just as art can be poetry, painting, sculpture or even modern art > that baffles the imagination. > > It's far better to ask, "When is it appropriate to use this tool (Erlang, > this particular IDE)?" imho. > > DSL > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From erlang@REDACTED Mon Dec 28 15:37:24 2009 From: erlang@REDACTED (Illo de' Illis) Date: Mon, 28 Dec 2009 15:37:24 +0100 Subject: [erlang-questions] IDE Bashing (Was Re: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid?) In-Reply-To: References: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> <3BHgSuhp.1261405791.5964000.leap@gol.com> <3dbc6d1c0912220713k66c18773o2c498d1523e616b7@mail.gmail.com> <9bd8a08a0912240246p7da4c4b8p8aeb99d7a326214d@mail.gmail.com> <3dbc6d1c0912241654g235f4d82iab0601e8d9e75f8@mail.gmail.com> <9bd8a08a0912271522q77643490i9230a4c8747f6424@mail.gmail.com> <6FFFBE3D-6B9A-4BD2-908E-ACFB5D6D0ADF@adam.com.au> Message-ID: <758153C2-804D-4546-AB58-A445508FD820@trainedmonkeys.net> On Dec 28, 2009, at 6:20 AM, Vasilij Savin wrote: > [...] > Once Programming is a craft or profession, you NEED Good tools, or you will > never get your job done. Building anything remotely complicated calls for > discipline and proper tools. Come on! How would you call an entire PKI written ground-up in C and Python without using any GPLed library (most notably OpenSSL or cryptlib)? I mean, every cryptographic algorithm rewritten, the whole ASN.1 engine, X.509 and PKCS and stuff. My colleagues and I used vim, make, gcc, python, binutils. I won't bore you with the countless projects I've been involved in, but I assure you that your statement is questionable. A job can actually be done when people are skilled, no matter the tools. Ciao, Illo. From waterding@REDACTED Mon Dec 28 16:55:50 2009 From: waterding@REDACTED (Aeolus) Date: Mon, 28 Dec 2009 16:55:50 +0100 Subject: reading config value from system env in common test Message-ID: Hello everyone, Merry Christmas to all! As a newbie to Erlang, I wonder if common test could read config value directly from system shell instead of from a config file. Actually there is one mentioned in the doc, "CT_INCLUDE_PATH", but maybe we could have more like CT_SUITE_PATH, CT_LOG_PATH. Thx. //Aeolus From steve.e.123@REDACTED Mon Dec 28 17:49:17 2009 From: steve.e.123@REDACTED (Steve) Date: Mon, 28 Dec 2009 11:49:17 -0500 Subject: [erlang-questions] Distributed application logging In-Reply-To: References: <4B3249C2.30302@gmail.com> Message-ID: <4B38E18D.8070809@gmail.com> Thanks Jayson. That seems to be working fine. It's easy to add the node information to the head of a sasl report. So if I get an event like this at the local node {error_report, Gleader, {Pid, Type, Report}}, I just change it to {error_report, Gleader, {Pid, Type, [{at_node, node(Pid)} | Report]}} before I send it via gen_event:notify to the global master node event handler. Then on the master node I can use rb to navigate my log that gets generated by attaching a log_mf_h handler to my global event manager. Then I can just grep on the node using rb:grep/1. This meets my requirement of "easy". :) It would be great to know if anyone else has thoughts on distributed application event logging. Steve Jayson Vantuyl wrote: > I would write my own log handler that wrapped log_mf_h and recovered the node info when the event was received. Basically, just insert yourself and add the information you want. > > On Dec 23, 2009, at 8:48 AM, Steve wrote: > >> I'm hoping someone might shed some light on the best/easiest way to do distributed application event logging. >> >> In my app I have master node, two failover master nodes, and then a set of nodes that are coordinated by the master node and communicate with the master node via global fully qualified names. Each node will run its own application instance, vm and hardware. >> >> My goal is to log all standard sasl events which are generated on the local nodes (alarms, errors, progress and supervisor reports) to the central master node. >> >> The way I currently do this is to 1) register a global event manager on the central node and 2) send local sasl events to this global manager. I have a log_mf_h handler on the central node which I use to manage the global log. This code exists as its own application alongside my main application so I can get progress reports about the main application starting, etc. >> >> This all works pretty well. The only "problem" is that log_mf_h and rb don't say much about the node that generated the event. Pids are of course there, and I know I can get node info from a pid via node/1. I can probably send my own reports to log_mf_h or create my own round robin log that contains reports with info about the nodes. But I'd rather get the most out of what's already there in erlang if I can being a big fan of not reinventing the wheel. >> >> So... I guess my question is: am I on the right track more or less, or have I missed something in the docs/libs or my app design that would help me? >> >> Thanks in advance. >> >> Steve >> From jarrod@REDACTED Mon Dec 28 18:43:51 2009 From: jarrod@REDACTED (Jarrod Roberson) Date: Mon, 28 Dec 2009 12:43:51 -0500 Subject: [erlang-questions] IDE Bashing (Was Re: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid?) In-Reply-To: <758153C2-804D-4546-AB58-A445508FD820@trainedmonkeys.net> References: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> <3BHgSuhp.1261405791.5964000.leap@gol.com> <3dbc6d1c0912220713k66c18773o2c498d1523e616b7@mail.gmail.com> <9bd8a08a0912240246p7da4c4b8p8aeb99d7a326214d@mail.gmail.com> <3dbc6d1c0912241654g235f4d82iab0601e8d9e75f8@mail.gmail.com> <9bd8a08a0912271522q77643490i9230a4c8747f6424@mail.gmail.com> <6FFFBE3D-6B9A-4BD2-908E-ACFB5D6D0ADF@adam.com.au> <758153C2-804D-4546-AB58-A445508FD820@trainedmonkeys.net> Message-ID: On Mon, Dec 28, 2009 at 9:37 AM, Illo de' Illis wrote: > > A job can actually be done when people are skilled, no matter the tools. > > Ciao, > Illo. > > you can dig a ditch with a plastic spoon but that doesn't make it the right thing to do. Most people that bash IDE's and other productivity tools do it because they don't understand the productivity side of things and lots of times use the argument, "I don't have time to learn XXX". What I have to say is "I don't have time to NOT learn the tools". I mean would you pay someone to dig you a ditch by the hour with a plastic spoon, because he doesn't believe that "real" ditch diggers need to use tools and doesn't have the time to learn how to use a backhoe? Or would you rather pay a fraction of those hours to the guy that isn't skilled with the spoon and uses a backhoe to dig the same ditch for a fraction of the price? From g@REDACTED Mon Dec 28 19:04:12 2009 From: g@REDACTED (Garrett Smith) Date: Mon, 28 Dec 2009 12:04:12 -0600 Subject: [erlang-questions] IDE Bashing (Was Re: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid?) In-Reply-To: References: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> <3BHgSuhp.1261405791.5964000.leap@gol.com> <3dbc6d1c0912220713k66c18773o2c498d1523e616b7@mail.gmail.com> <9bd8a08a0912240246p7da4c4b8p8aeb99d7a326214d@mail.gmail.com> <3dbc6d1c0912241654g235f4d82iab0601e8d9e75f8@mail.gmail.com> <9bd8a08a0912271522q77643490i9230a4c8747f6424@mail.gmail.com> <6FFFBE3D-6B9A-4BD2-908E-ACFB5D6D0ADF@adam.com.au> <758153C2-804D-4546-AB58-A445508FD820@trainedmonkeys.net> Message-ID: On Mon, Dec 28, 2009 at 11:43 AM, Jarrod Roberson wrote: > On Mon, Dec 28, 2009 at 9:37 AM, Illo de' Illis > wrote: > >> >> ? A job can actually be done when people are skilled, no matter the tools. >> >> Ciao, >> Illo. >> >> > you can dig a ditch with a plastic spoon but that doesn't make it the right > thing to do. Most people that bash IDE's and other productivity tools do it > because they don't understand the productivity side of things and lots of > times use the argument, "I don't have time to learn XXX". What I have to say > is "I don't have time to NOT learn the tools". This is a reasonable point, but it is generally applicable to a lot of things that impact developer productivity: languages, libraries, architectures, methodologies, etc. I think we ought to give a bit more credit to our fellow software developers and trust that they can work out their own tool chain based on their inclinations and common sense. It's pointless to debate which approach to tooling is better as this is both a personal choice and an iterative journey. Garrett From vladdu55@REDACTED Mon Dec 28 19:14:37 2009 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 28 Dec 2009 19:14:37 +0100 Subject: Fwd: [erlang-questions] IDE Bashing (Was Re: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid?) In-Reply-To: <95be1d3b0912281014r49e21cffhe7dc8283211f3d7c@mail.gmail.com> References: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> <3BHgSuhp.1261405791.5964000.leap@gol.com> <3dbc6d1c0912220713k66c18773o2c498d1523e616b7@mail.gmail.com> <9bd8a08a0912240246p7da4c4b8p8aeb99d7a326214d@mail.gmail.com> <3dbc6d1c0912241654g235f4d82iab0601e8d9e75f8@mail.gmail.com> <9bd8a08a0912271522q77643490i9230a4c8747f6424@mail.gmail.com> <6FFFBE3D-6B9A-4BD2-908E-ACFB5D6D0ADF@adam.com.au> <758153C2-804D-4546-AB58-A445508FD820@trainedmonkeys.net> <95be1d3b0912281014r49e21cffhe7dc8283211f3d7c@mail.gmail.com> Message-ID: <95be1d3b0912281014r35adaae4m19905b71a0ee8739@mail.gmail.com> On Mon, Dec 28, 2009 at 15:37, Illo de' Illis wrote: > A job can actually be done when people are skilled, no matter the tools. There are theories claiming that Renaissance painters used photographic methods (for example, http://beta.dawn.com/wps/wcm/connect/dawn-content-library/dawn/news/art-culture/renaissance-painter-may-have-used-photography-nf), does that make their work less beautiful? I think not. Would David's statue have been less of a masterpiece if Michelangelo had used an ultrasound chisel? Or more of one if he had only used a steel needle? I think not. What would have been different are other things: the author's bragging rights (of course, it's more of a feat to paint Mona Lisa with one's fingers instead of brushes), the effort (time, money) required to complete a piece of work. (This from the standpoint that the end results in all the alternative cases are identical). So the first question is "what do I want to achieve?" and then "how do I do it best?". The answer depends on many variables, so all answers may be right or wrong depending on the circumstances. best regards, Vlad From erlang@REDACTED Mon Dec 28 20:42:20 2009 From: erlang@REDACTED (Illo de' Illis) Date: Mon, 28 Dec 2009 20:42:20 +0100 Subject: [erlang-questions] IDE Bashing (Was Re: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid?) In-Reply-To: References: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> <3BHgSuhp.1261405791.5964000.leap@gol.com> <3dbc6d1c0912220713k66c18773o2c498d1523e616b7@mail.gmail.com> <9bd8a08a0912240246p7da4c4b8p8aeb99d7a326214d@mail.gmail.com> <3dbc6d1c0912241654g235f4d82iab0601e8d9e75f8@mail.gmail.com> <9bd8a08a0912271522q77643490i9230a4c8747f6424@mail.gmail.com> <6FFFBE3D-6B9A-4BD2-908E-ACFB5D6D0ADF@adam.com.au> <758153C2-804D-4546-AB58-A445508FD820@trainedmonkeys.net> Message-ID: <2B8955C3-B8BD-43D5-81C0-2DAB96C1A574@trainedmonkeys.net> On Dec 28, 2009, at 6:43 PM, Jarrod Roberson wrote: > [...] > I mean would you pay someone to dig you a ditch by the hour with a plastic > spoon, because he doesn't believe that "real" ditch diggers need to use > tools and doesn't have the time to learn how to use a backhoe? I would pay someone who does it _right_ and in the time I need it to be done, _no matter the tools he would use_. In fact, I'd happily accept a complete-function-calls-for-me, cut-and-paste-here-and-there, google-to-find-answers and debug-till-it-works programmer if results would be on par with my needs. I'm not against tools, backhoes[1] included. I'm against tools that make you dumber, and present IDE/RADs often do[2]. Ciao, Illo. [1] and I'm sure you do agree with me when I say that a developing environment with a good shell, a bunch of supporting tools and a well-configured vim or emacs is a hell of a backhoe. [2] when they don't crash. From mononcqc@REDACTED Tue Dec 29 02:12:34 2009 From: mononcqc@REDACTED (Fred Hebert) Date: Mon, 28 Dec 2009 20:12:34 -0500 Subject: [erlang-questions] IDE Bashing (Was Re: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid?) In-Reply-To: <2B8955C3-B8BD-43D5-81C0-2DAB96C1A574@trainedmonkeys.net> References: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> <3dbc6d1c0912220713k66c18773o2c498d1523e616b7@mail.gmail.com> <9bd8a08a0912240246p7da4c4b8p8aeb99d7a326214d@mail.gmail.com> <3dbc6d1c0912241654g235f4d82iab0601e8d9e75f8@mail.gmail.com> <9bd8a08a0912271522q77643490i9230a4c8747f6424@mail.gmail.com> <6FFFBE3D-6B9A-4BD2-908E-ACFB5D6D0ADF@adam.com.au> <758153C2-804D-4546-AB58-A445508FD820@trainedmonkeys.net> <2B8955C3-B8BD-43D5-81C0-2DAB96C1A574@trainedmonkeys.net> Message-ID: <8b9ee55b0912281712q613338d0tb8c8396bcd07071d@mail.gmail.com> Am I alone to think that lots of people organize their work in different manners? People will draw graphs on paper, take notes on an empty file or a sheet, organize stuff in tables, explore files with grep or whatever search facility they have, use their IDEs, use code skeletons or auto-completion, etc. I'm usually annoyed by programmers' frequent search for one true way? to do things. Most of us have different ways to organize our thoughts when writing texts, emails, preparing daily tasks (like groceries and whatnot), do math, etc. Why would it be necessary for everyone to either use an IDE or use none? We've got a bunch of languages all adapted to the task at hand. We also have a bunch of tools adapted to different manners to organize thoughts. I'm having trouble grasping why some if not most of us often have a hard time accepting different people might do things differently to achieve good results. Why should anyone care about the tools the others use, as long as the code is right, clean and maintainable? From do.chuan@REDACTED Tue Dec 29 04:17:45 2009 From: do.chuan@REDACTED (douchuan) Date: Tue, 29 Dec 2009 11:17:45 +0800 Subject: ERlang and DVB Message-ID: <4B3974D9.9000603@gmail.com> Interactive TV is becoming a importand field. Has Erlang set foot on the field? ITV or DVB Server Server mainly related issues: Collation of information, code/decode, transmission, server must be scalable. Ok, Erlang is good at code?decode and make server easy to expand. >From a historical point of view, the rise of each of these areas can trigger a Technological revolution, such as the operating system, gave birth to C / C + +, the Internet gave birth to Java / JavaScript / Python / Ruby ...... What kind of role Erlang can play in ITV? Ref Books: Interactive TV Standards (mainly about Java). From max.lapshin@REDACTED Tue Dec 29 06:27:24 2009 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 29 Dec 2009 08:27:24 +0300 Subject: [erlang-questions] ERlang and DVB In-Reply-To: <4B3974D9.9000603@gmail.com> References: <4B3974D9.9000603@gmail.com> Message-ID: What exactly do you want to do with DVB? Currently you can use some capture software + VLC to transcode + erlyvideo to restream video to internet, but it seems that you want something else. From rapsey@REDACTED Tue Dec 29 08:26:41 2009 From: rapsey@REDACTED (Rapsey) Date: Tue, 29 Dec 2009 08:26:41 +0100 Subject: [erlang-questions] ERlang and DVB In-Reply-To: <4B3974D9.9000603@gmail.com> References: <4B3974D9.9000603@gmail.com> Message-ID: <97619b170912282326q1ec3679fh3991cd30084eb4e6@mail.gmail.com> 2009/12/29 douchuan > Interactive TV is becoming a importand field. > Has Erlang set foot on the field? > > Yes but not open source. Sergej From do.chuan@REDACTED Tue Dec 29 08:49:11 2009 From: do.chuan@REDACTED (douchuan) Date: Tue, 29 Dec 2009 15:49:11 +0800 Subject: [erlang-questions] ERlang and DVB In-Reply-To: <97619b170912282326q1ec3679fh3991cd30084eb4e6@mail.gmail.com> References: <4B3974D9.9000603@gmail.com> <97619b170912282326q1ec3679fh3991cd30084eb4e6@mail.gmail.com> Message-ID: <4B39B477.2010306@gmail.com> Rapsey ??: > 2009/12/29 douchuan > > >> Interactive TV is becoming a importand field. >> Has Erlang set foot on the field? >> >> >> > Yes but not open source. > > > thx. ok, You means Erlang is quite qualified for the work. I feel up to doing study. > Sergej > > From bengt.kleberg@REDACTED Tue Dec 29 10:33:11 2009 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 29 Dec 2009 10:33:11 +0100 Subject: [erlang-questions] IDE Bashing (Was Re: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid?) In-Reply-To: <8b9ee55b0912281712q613338d0tb8c8396bcd07071d@mail.gmail.com> References: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> <3dbc6d1c0912220713k66c18773o2c498d1523e616b7@mail.gmail.com> <9bd8a08a0912240246p7da4c4b8p8aeb99d7a326214d@mail.gmail.com> <3dbc6d1c0912241654g235f4d82iab0601e8d9e75f8@mail.gmail.com> <9bd8a08a0912271522q77643490i9230a4c8747f6424@mail.gmail.com> <6FFFBE3D-6B9A-4BD2-908E-ACFB5D6D0ADF@adam.com.au> <758153C2-804D-4546-AB58-A445508FD820@trainedmonkeys.net> <2B8955C3-B8BD-43D5-81C0-2DAB96C1A574@trainedmonkeys.net> <8b9ee55b0912281712q613338d0tb8c8396bcd07071d@mail.gmail.com> Message-ID: <1262079191.7577.8.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Greetings, I care about how long time it takes to write the correct, clean and maintainable code mentioned below. If an IDE makes it possible to make the same code faster, then an IDE is a good idea. It is also necessary to add the time needed to learn the IDE, but if that time can be amortized over several projects it could still be a good idea. bengt On Mon, 2009-12-28 at 20:12 -0500, Fred Hebert wrote: > Am I alone to think that lots of people organize their work in different > manners? People will draw graphs on paper, take notes on an empty file or a > sheet, organize stuff in tables, explore files with grep or whatever search > facility they have, use their IDEs, use code skeletons or auto-completion, > etc. > > I'm usually annoyed by programmers' frequent search for one true way? to do > things. Most of us have different ways to organize our thoughts when writing > texts, emails, preparing daily tasks (like groceries and whatnot), do math, > etc. Why would it be necessary for everyone to either use an IDE or use > none? We've got a bunch of languages all adapted to the task at hand. We > also have a bunch of tools adapted to different manners to organize > thoughts. > > I'm having trouble grasping why some if not most of us often have a hard > time accepting different people might do things differently to achieve good > results. Why should anyone care about the tools the others use, as long as > the code is right, clean and maintainable? From egarrulo@REDACTED Tue Dec 29 10:50:33 2009 From: egarrulo@REDACTED (egarrulo) Date: Tue, 29 Dec 2009 09:50:33 +0000 Subject: [erlang-questions] IDE Bashing (Was Re: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid?) In-Reply-To: <8b9ee55b0912281712q613338d0tb8c8396bcd07071d@mail.gmail.com> References: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> <9bd8a08a0912240246p7da4c4b8p8aeb99d7a326214d@mail.gmail.com> <3dbc6d1c0912241654g235f4d82iab0601e8d9e75f8@mail.gmail.com> <9bd8a08a0912271522q77643490i9230a4c8747f6424@mail.gmail.com> <6FFFBE3D-6B9A-4BD2-908E-ACFB5D6D0ADF@adam.com.au> <758153C2-804D-4546-AB58-A445508FD820@trainedmonkeys.net> <2B8955C3-B8BD-43D5-81C0-2DAB96C1A574@trainedmonkeys.net> <8b9ee55b0912281712q613338d0tb8c8396bcd07071d@mail.gmail.com> Message-ID: <9bd8a08a0912290150u6fa9ceeh54ac43bd010681a1@mail.gmail.com> 2009/12/29 Fred Hebert > Am I alone to think that lots of people organize their work in different > manners? People will draw graphs on paper, take notes on an empty file or a > sheet, organize stuff in tables, explore files with grep or whatever search > facility they have, use their IDEs, use code skeletons or auto-completion, > etc. > > I'm usually annoyed by programmers' frequent search for one true way? to do > things. Most of us have different ways to organize our thoughts when > writing > texts, emails, preparing daily tasks (like groceries and whatnot), do math, > etc. Why would it be necessary for everyone to either use an IDE or use > none? We've got a bunch of languages all adapted to the task at hand. We > also have a bunch of tools adapted to different manners to organize > thoughts. > > I'm having trouble grasping why some if not most of us often have a hard > time accepting different people might do things differently to achieve good > results. Why should anyone care about the tools the others use, as long as > the code is right, clean and maintainable? > I don't think people are against IDEs in general. They are against inflexible, slow and monolithic tools, that is what current IDEs are (if you think Eclipse is flexible, then try Emacs). Working your way by using tinier tools can be more productive than having to warp your way around bigger tools. Experience you gain by using tinier tools adds up and will stay with you, whilst experience you gain by using a monolithic IDE could become useless with your IDE's next version. When I upgraded from Visual Studio 6 to Visual Studio .NET, all my handy macros became useless. When I had to develop Java code, all my experience with Visual Studio was close to useless. From attila.r.nohl@REDACTED Tue Dec 29 11:36:32 2009 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Tue, 29 Dec 2009 11:36:32 +0100 Subject: [erlang-questions] ERlang and DVB In-Reply-To: <4B3974D9.9000603@gmail.com> References: <4B3974D9.9000603@gmail.com> Message-ID: <401d3ba30912290236q76d91464y3856708865a96dfa@mail.gmail.com> 2009/12/29, douchuan : > Interactive TV is becoming a importand field. > Has Erlang set foot on the field? > > ITV or DVB Server Server mainly related issues: > Collation of information, code/decode, transmission, server must be > scalable. > Ok, Erlang is good at code?decode Why would you think that? I'm not sure about what kind of coding/decoding is done in digital TV, but I guess it involves lots of mathematical operations and this is not exactly the strong point of Erlang (or generally interpreted languages). As far as I know, even the AXD301 uses the linked-in (i.e. written in C) megaco_flex_scanner for performance reasons - and that's just text parsing, no expensive mathematical operations. From max.lapshin@REDACTED Tue Dec 29 11:38:57 2009 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 29 Dec 2009 13:38:57 +0300 Subject: [erlang-questions] ERlang and DVB In-Reply-To: <401d3ba30912290236q76d91464y3856708865a96dfa@mail.gmail.com> References: <4B3974D9.9000603@gmail.com> <401d3ba30912290236q76d91464y3856708865a96dfa@mail.gmail.com> Message-ID: 2009/12/29 Attila Rajmund Nohl : > Why would you think that? I'm not sure about what kind of > coding/decoding is done in digital TV, but I guess it involves lots of > mathematical operations and this is not exactly the strong point of > Erlang (or generally interpreted languages). As far as I know, even > the AXD301 uses the linked-in (i.e. written in C) megaco_flex_scanner > for performance reasons - and that's just text parsing, no expensive > mathematical operations. It is very easy to write MPEG TS demultiplexor on Erlang, but of course it is insane two write video decoder. From rapsey@REDACTED Tue Dec 29 11:54:02 2009 From: rapsey@REDACTED (Rapsey) Date: Tue, 29 Dec 2009 11:54:02 +0100 Subject: [erlang-questions] ERlang and DVB In-Reply-To: References: <4B3974D9.9000603@gmail.com> <401d3ba30912290236q76d91464y3856708865a96dfa@mail.gmail.com> Message-ID: <97619b170912290254u17a2cf43wafcf7236d3266017@mail.gmail.com> On Tue, Dec 29, 2009 at 11:38 AM, Max Lapshin wrote: > 2009/12/29 Attila Rajmund Nohl : > > > Why would you think that? I'm not sure about what kind of > > coding/decoding is done in digital TV, but I guess it involves lots of > > mathematical operations and this is not exactly the strong point of > > Erlang (or generally interpreted languages). As far as I know, even > > the AXD301 uses the linked-in (i.e. written in C) megaco_flex_scanner > > for performance reasons - and that's just text parsing, no expensive > > mathematical operations. > > It is very easy to write MPEG TS demultiplexor on Erlang, but of > course it is insane two write video decoder. > > Right. Erlang is fantastic for muxers,demuxers and parsers. Encoding/decoding is a job for linked-in drivers or NIFs. Sergej From dave.smith.to@REDACTED Tue Dec 29 17:36:48 2009 From: dave.smith.to@REDACTED (Dave Smith) Date: Tue, 29 Dec 2009 11:36:48 -0500 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: <3BHgSuhp.1261405791.5964000.leap@gol.com> References: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> <3BHgSuhp.1261405791.5964000.leap@gol.com> Message-ID: <5ea453f90912290836s74644130y81d0514559de196b@mail.gmail.com> It seems to me that the system being proposed should strive to hide as much of the imperative code as possible, regardless of the language used. If you can build a framework that would allow the end user to write essentially "everything" as declarations, then the value of an IDE or source level debugger are reduced. The frameworks that I have worked on are in the business/financial domain, and I find that constructing a framework that allows the business rules to be written as predicates or patterns that can simply be "plugged-in" to the framework is the best approach. I would start by determining whether this approach is sufficient for your needs. If it is, I think the IDE/debugger debate become moot, and it will drastically reduce the learning curve for your "non-programmer" users. And if this declarative approach does work for you, you'd be better selecting a language that is more declarative (such as a functional language). This can be done in a an OO/imperative language such as Java, but this would typically mean creating a class for every rule that implements some common interface, which could mean a lot of boiler-plate. If you are disposed to provide more deails about the projects requirements and goals, I'd be happy to elaborate. --DS > > From garry@REDACTED Tue Dec 29 18:32:47 2009 From: garry@REDACTED (Garry Hodgson) Date: Tue, 29 Dec 2009 12:32:47 -0500 Subject: [erlang-questions] IDE Bashing (Was Re: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid?) In-Reply-To: <8b9ee55b0912281712q613338d0tb8c8396bcd07071d@mail.gmail.com> References: <9b08084c0912210115j2fc50bf8h31f581aa9b05cd59@mail.gmail.com> <3dbc6d1c0912220713k66c18773o2c498d1523e616b7@mail.gmail.com> <9bd8a08a0912240246p7da4c4b8p8aeb99d7a326214d@mail.gmail.com> <3dbc6d1c0912241654g235f4d82iab0601e8d9e75f8@mail.gmail.com> <9bd8a08a0912271522q77643490i9230a4c8747f6424@mail.gmail.com> <6FFFBE3D-6B9A-4BD2-908E-ACFB5D6D0ADF@adam.com.au> <758153C2-804D-4546-AB58-A445508FD820@trainedmonkeys.net> <2B8955C3-B8BD-43D5-81C0-2DAB96C1A574@trainedmonkeys.net> <8b9ee55b0912281712q613338d0tb8c8396bcd07071d@mail.gmail.com> Message-ID: <4B3A3D3F.7070407@research.att.com> Fred Hebert wrote: > I'm having trouble grasping why some if not most of us often have a hard > time accepting different people might do things differently to achieve good > results. Why should anyone care about the tools the others use, as long as > the code is right, clean and maintainable? welcome to the internet. http://xkcd.com/386/ -- Garry Hodgson AT&T Chief Security Office (CSO) "This e-mail and any files transmitted with it are AT&T property, are confidential, and are intended solely for the use of the individual or entity to whom this e-mail is addressed. If you are not one of the named recipient(s) or otherwise have reason to believe that you have received this message in error, please notify the sender and delete this message immediately from your computer. Any other use, retention, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited." From B.Candler@REDACTED Tue Dec 29 18:55:01 2009 From: B.Candler@REDACTED (Brian Candler) Date: Tue, 29 Dec 2009 17:55:01 +0000 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: <9bd8a08a0912271522q77643490i9230a4c8747f6424@mail.gmail.com> References: <9bd8a08a0912271522q77643490i9230a4c8747f6424@mail.gmail.com> Message-ID: <20091229175501.GC5430@uk.tiscali.com> On Mon, Dec 28, 2009 at 12:22:45AM +0100, egarrulo wrote: > I do agree wholeheartedly (that's why I cannot stand Eclipse). Let's just > not forget we all started bicycling with training wheels, and crawled before > walking (again, that's why I've suggested Emacs as IDE). I agree with the training wheels analogy, except that starting with Emacs would be like learning to fly a 747 before picking up the bicycle :-) From dstamat@REDACTED Tue Dec 29 18:58:52 2009 From: dstamat@REDACTED (Dylan Stamat) Date: Tue, 29 Dec 2009 09:58:52 -0800 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: <20091229175501.GC5430@uk.tiscali.com> References: <9bd8a08a0912271522q77643490i9230a4c8747f6424@mail.gmail.com> <20091229175501.GC5430@uk.tiscali.com> Message-ID: <6E6F6B01-9F11-4464-A5FD-FD6A7F491594@elctech.com> > I agree with the training wheels analogy, except that starting with Emacs > would be like learning to fly a 747 before picking up the bicycle :-) http://xkcd.com/378/ In all seriousness, I'd love to see this thread die a nice silent death :) These wars have been fought time after time, since the birth of the internet. I like reading lists in non-digest form, but when threads like this start, my MUA starts weeping. On Dec 29, 2009, at 9:55 AM, Brian Candler wrote: > On Mon, Dec 28, 2009 at 12:22:45AM +0100, egarrulo wrote: >> I do agree wholeheartedly (that's why I cannot stand Eclipse). Let's just >> not forget we all started bicycling with training wheels, and crawled before >> walking (again, that's why I've suggested Emacs as IDE). > > I agree with the training wheels analogy, except that starting with Emacs > would be like learning to fly a 747 before picking up the bicycle :-) > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From jarrod@REDACTED Tue Dec 29 18:59:01 2009 From: jarrod@REDACTED (Jarrod Roberson) Date: Tue, 29 Dec 2009 12:59:01 -0500 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: <20091229175501.GC5430@uk.tiscali.com> References: <9bd8a08a0912271522q77643490i9230a4c8747f6424@mail.gmail.com> <20091229175501.GC5430@uk.tiscali.com> Message-ID: On Tue, Dec 29, 2009 at 12:55 PM, Brian Candler wrote: > On Mon, Dec 28, 2009 at 12:22:45AM +0100, egarrulo wrote: > > I do agree wholeheartedly (that's why I cannot stand Eclipse). Let's just > > not forget we all started bicycling with training wheels, and crawled > before > > walking (again, that's why I've suggested Emacs as IDE). > > I agree with the training wheels analogy, except that starting with Emacs > would be like learning to fly a 747 before picking up the bicycle :-) > > I would propose more like flying the space shuttle than a 747 even :-) From v@REDACTED Tue Dec 29 22:08:06 2009 From: v@REDACTED (Valentin Micic) Date: Tue, 29 Dec 2009 23:08:06 +0200 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: Message-ID: <20091229210824.080063D0D4A@mail.pharos-avantgard.com> > would be like learning to fly a 747 before picking up the bicycle :-) Why does it have to be a 747? Why not Airbus? From rapsey@REDACTED Tue Dec 29 22:22:19 2009 From: rapsey@REDACTED (Rapsey) Date: Tue, 29 Dec 2009 22:22:19 +0100 Subject: [Erlyaws-list] Using egeoip with Yaws In-Reply-To: References: Message-ID: <97619b170912291322h47789573x70af63abacb68a86@mail.gmail.com> Put the beam and .app files from egeoip to a directory where you want it, add it with ebin_dir in yaws configuration. Use a runmod to start egeoip as an application. Sergej On Tue, Dec 29, 2009 at 9:40 PM, Hank Knight wrote: > This is my first day using Erlang/Yaws and I doubt I will ever choose > to develop using Apache/PHP again. > > I need to tell my website visitors what city, region and country I > think they are from. I understand this can be done with erlang using > egeoip. > http://code.google.com/p/egeoip/ > http://egeoip.googlecode.com/svn/trunk/egeoip/ > > However I haven't a clue how to make egeoip work with Yaws. > > > out(Arg) -> > {html, "I think you are from {get_location_with_egeoip}"}. > > > > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and > easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev > _______________________________________________ > Erlyaws-list mailing list > Erlyaws-list@REDACTED > https://lists.sourceforge.net/lists/listinfo/erlyaws-list > From rvirding@REDACTED Tue Dec 29 22:40:51 2009 From: rvirding@REDACTED (Robert Virding) Date: Tue, 29 Dec 2009 22:40:51 +0100 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: <20091229175501.GC5430@uk.tiscali.com> References: <9bd8a08a0912271522q77643490i9230a4c8747f6424@mail.gmail.com> <20091229175501.GC5430@uk.tiscali.com> Message-ID: <3dbc6d1c0912291340v56ea4321t1ae5a499af505c79@mail.gmail.com> 2009/12/29 Brian Candler > On Mon, Dec 28, 2009 at 12:22:45AM +0100, egarrulo wrote: > > I do agree wholeheartedly (that's why I cannot stand Eclipse). Let's just > > not forget we all started bicycling with training wheels, and crawled > before > > walking (again, that's why I've suggested Emacs as IDE). > > I agree with the training wheels analogy, except that starting with Emacs > would be like learning to fly a 747 before picking up the bicycle :-) > I can't agree here. The threshhold to start using emacs is very low, there is nothing which forces you to use more than the about 10 basic commands you need. The ceiling, however, is somewhere out in space. Sometimes I wonder if the problem beginners have with emacs is that the knowledge of the existence of all those other commands frightens them. Seriously I can't give an objective comment here as I have used emacs for almost 30 years and can't remember not knowing it. The key strokes sit in my fingers. :-) Robert From vasilij.savin@REDACTED Tue Dec 29 22:52:19 2009 From: vasilij.savin@REDACTED (Vasilij Savin) Date: Tue, 29 Dec 2009 23:52:19 +0200 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: <3dbc6d1c0912291340v56ea4321t1ae5a499af505c79@mail.gmail.com> References: <9bd8a08a0912271522q77643490i9230a4c8747f6424@mail.gmail.com> <20091229175501.GC5430@uk.tiscali.com> <3dbc6d1c0912291340v56ea4321t1ae5a499af505c79@mail.gmail.com> Message-ID: Just some thoughts from Emacs newbie. The main problem for me was that I had to unlearn a lot of shortcuts I was used to take for granted (Ctrl S/X/C/V/Q). There is no worse shock to start using new application that has totally "non-conventional" shortcuts. This throws new converts totally off-balance. Still, I am willing to give Emacs another try. Regards, Vasilij Savin On Tue, Dec 29, 2009 at 11:40 PM, Robert Virding wrote: > 2009/12/29 Brian Candler > > > On Mon, Dec 28, 2009 at 12:22:45AM +0100, egarrulo wrote: > > > I do agree wholeheartedly (that's why I cannot stand Eclipse). Let's > just > > > not forget we all started bicycling with training wheels, and crawled > > before > > > walking (again, that's why I've suggested Emacs as IDE). > > > > I agree with the training wheels analogy, except that starting with Emacs > > would be like learning to fly a 747 before picking up the bicycle :-) > > > > I can't agree here. The threshhold to start using emacs is very low, there > is nothing which forces you to use more than the about 10 basic commands > you > need. The ceiling, however, is somewhere out in space. Sometimes I wonder > if > the problem beginners have with emacs is that the knowledge of the > existence > of all those other commands frightens them. > > Seriously I can't give an objective comment here as I have used emacs for > almost 30 years and can't remember not knowing it. The key strokes sit in > my > fingers. :-) > > Robert > From dale@REDACTED Tue Dec 29 22:53:45 2009 From: dale@REDACTED (Dale Harvey) Date: Tue, 29 Dec 2009 21:53:45 +0000 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: <3dbc6d1c0912291340v56ea4321t1ae5a499af505c79@mail.gmail.com> References: <9bd8a08a0912271522q77643490i9230a4c8747f6424@mail.gmail.com> <20091229175501.GC5430@uk.tiscali.com> <3dbc6d1c0912291340v56ea4321t1ae5a499af505c79@mail.gmail.com> Message-ID: as someone who tried to avoid emacs for a good amount of years and have recently started using it all the time, the main reason I didnt use emacs is because ctrl+c, ctrl+v, ctrl+z didnt work, not the availability of other commands 2009/12/29 Robert Virding > 2009/12/29 Brian Candler > > > On Mon, Dec 28, 2009 at 12:22:45AM +0100, egarrulo wrote: > > > I do agree wholeheartedly (that's why I cannot stand Eclipse). Let's > just > > > not forget we all started bicycling with training wheels, and crawled > > before > > > walking (again, that's why I've suggested Emacs as IDE). > > > > I agree with the training wheels analogy, except that starting with Emacs > > would be like learning to fly a 747 before picking up the bicycle :-) > > > > I can't agree here. The threshhold to start using emacs is very low, there > is nothing which forces you to use more than the about 10 basic commands > you > need. The ceiling, however, is somewhere out in space. Sometimes I wonder > if > the problem beginners have with emacs is that the knowledge of the > existence > of all those other commands frightens them. > > Seriously I can't give an objective comment here as I have used emacs for > almost 30 years and can't remember not knowing it. The key strokes sit in > my > fingers. :-) > > Robert > From rvirding@REDACTED Tue Dec 29 23:16:34 2009 From: rvirding@REDACTED (Robert Virding) Date: Tue, 29 Dec 2009 23:16:34 +0100 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: References: <9bd8a08a0912271522q77643490i9230a4c8747f6424@mail.gmail.com> <20091229175501.GC5430@uk.tiscali.com> <3dbc6d1c0912291340v56ea4321t1ae5a499af505c79@mail.gmail.com> Message-ID: <3dbc6d1c0912291416p7c003ecl8b80a75fdee5842d@mail.gmail.com> 2009/12/29 Dale Harvey > as someone who tried to avoid emacs for a good amount of years and have > recently started using it all the time, the main reason I didnt use emacs is > because ctrl+c, ctrl+v, ctrl+z didnt work, not the availability of other > commands > Ah well, I never had that problem. I learnt the emacs ctrl commands *before* the others became common. I still can't get used to the c/v/z commands and keep yanking things in when I want to scroll down. Robert From seancribbs@REDACTED Tue Dec 29 23:23:14 2009 From: seancribbs@REDACTED (Sean Cribbs) Date: Tue, 29 Dec 2009 17:23:14 -0500 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: <3dbc6d1c0912291416p7c003ecl8b80a75fdee5842d@mail.gmail.com> References: <9bd8a08a0912271522q77643490i9230a4c8747f6424@mail.gmail.com> <20091229175501.GC5430@uk.tiscali.com> <3dbc6d1c0912291340v56ea4321t1ae5a499af505c79@mail.gmail.com> <3dbc6d1c0912291416p7c003ecl8b80a75fdee5842d@mail.gmail.com> Message-ID: <4B3A8152.9000406@gmail.com> On 12/29/09 5:16 PM, Robert Virding wrote: > 2009/12/29 Dale Harvey > > >> as someone who tried to avoid emacs for a good amount of years and have >> recently started using it all the time, the main reason I didnt use emacs is >> because ctrl+c, ctrl+v, ctrl+z didnt work, not the availability of other >> commands >> >> > Ah well, I never had that problem. I learnt the emacs ctrl commands *before* > the others became common. I still can't get used to the c/v/z commands and > keep yanking things in when I want to scroll down. > > Robert > > The worst for me is when I hit M-w to copy something out of some other application and it closes the window instead! (on OS/X) Sean From juanjo@REDACTED Wed Dec 30 00:08:38 2009 From: juanjo@REDACTED (Juan Jose Comellas) Date: Tue, 29 Dec 2009 20:08:38 -0300 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: References: <9bd8a08a0912271522q77643490i9230a4c8747f6424@mail.gmail.com> <20091229175501.GC5430@uk.tiscali.com> <3dbc6d1c0912291340v56ea4321t1ae5a499af505c79@mail.gmail.com> Message-ID: <1c3be50f0912291508h26f3651dsc024508c6d99158@mail.gmail.com> That can easily be solved by using the cua module (cua-mode). I ended modifying the Emacs configuration when I started using it to support the normal copy/cut/paste key bindings and those used for cursor movement (C-Left; C-Right; etc.). On Tue, Dec 29, 2009 at 6:52 PM, Vasilij Savin wrote: > Just some thoughts from Emacs newbie. The main problem for me was that I > had > to unlearn a lot of shortcuts I was used to take for granted (Ctrl > S/X/C/V/Q). There is no worse shock to start using new application that has > totally "non-conventional" shortcuts. This throws new converts totally > off-balance. > > Still, I am willing to give Emacs another try. > > Regards, > Vasilij Savin > > > On Tue, Dec 29, 2009 at 11:40 PM, Robert Virding > wrote: > > > 2009/12/29 Brian Candler > > > > > On Mon, Dec 28, 2009 at 12:22:45AM +0100, egarrulo wrote: > > > > I do agree wholeheartedly (that's why I cannot stand Eclipse). Let's > > just > > > > not forget we all started bicycling with training wheels, and crawled > > > before > > > > walking (again, that's why I've suggested Emacs as IDE). > > > > > > I agree with the training wheels analogy, except that starting with > Emacs > > > would be like learning to fly a 747 before picking up the bicycle :-) > > > > > > > I can't agree here. The threshhold to start using emacs is very low, > there > > is nothing which forces you to use more than the about 10 basic commands > > you > > need. The ceiling, however, is somewhere out in space. Sometimes I wonder > > if > > the problem beginners have with emacs is that the knowledge of the > > existence > > of all those other commands frightens them. > > > > Seriously I can't give an objective comment here as I have used emacs for > > almost 30 years and can't remember not knowing it. The key strokes sit in > > my > > fingers. :-) > > > > Robert > > > From navaneethanit@REDACTED Wed Dec 30 05:58:44 2009 From: navaneethanit@REDACTED (Navaneethan) Date: Tue, 29 Dec 2009 20:58:44 -0800 Subject: How to setup Message-ID: <4dde26ad0912292058l5fc80ae0s90022f73f5fdeb19@mail.gmail.com> Hi, How to configure beebole to create erlang webapplication in ubuntu? ,Ultimately i want to create a web application using erlang? what i need to do? How to practice itself? can any one hand me? -- regards, NavTux It blogs @ http://navaspot.wordpress.com From leap@REDACTED Wed Dec 30 11:03:04 2009 From: leap@REDACTED (Michael Turner) Date: Wed, 30 Dec 2009 10:03:04 +0000 Subject: Continuing this thread much longer -- crazy? Or just crazy? Message-ID: I think we've drifted somewhat from the topic I started. Mea culpa -- I forked it into an IDE-for-Erlang discussion, and my subject line perhaps lent itself to eventual flaming on almost religious topic in software engineering, from high level methodology to the One True Editor. Still, there have been a number of good points brought up, and I'll probably summarize soon, perhaps writing some of you privately first to make sure I'm not misrepresenting your point of view. My tentative conclusions at this point: - Erlang as a first language is a concept that ought to be tried. - The IDE-for-Erlang issue, if I address it at all in my tutorial materials, might be deferred until after I've had a chance to test the idea out on some willing subjects. - Configuring Emacs with Erlang tool support still seems worth pursuing and trying out on the target audience at some point relatively soon (on the order of months). - Eclipse looks more distant. Perhaps because it's written in Java, I've long felt that professional Java programmers are its de facto target audience, even if it's nominally language-agnostic. My target audience isn't professional programmers at all. Just to be sure: my idea was really to teach Erlang to cognitive scientists and cognitive linguists, so that they could support their own modeling efforts. It was not to turn them into full-fledged software engineers. (Issues of GUI and DBMS support might be farmed out to people writing in other languages and interfacing to the researchers' models.) My initial subject line didn't express this qualification very well, but I was hoping people would read the rest of my e-mail for context, and (lucky me) a number of you actually did. If you'd like to continue discussion of Emacs as great/good/stupid/evil, or about how only a poor craftsman blames his tools, or about how you learned C++ just from reading a reference manual for it on a desert island, then got a compiler for it running after you discovered an old Ukrainian Ural 666 Mark II running aboard a Soviet freighter that had run aground on the other side of the island, whose crew had long since been rescued, your compiler being implemented by writing it out in machine code, in tiny chalk numerals, on some blackboards in the captain's cabin, after which you toggled it in through the front panel ... well, be my guest. But with a new and unrelated subject line, please. -michael turner From egarrulo@REDACTED Wed Dec 30 11:12:23 2009 From: egarrulo@REDACTED (egarrulo) Date: Wed, 30 Dec 2009 10:12:23 +0000 Subject: [erlang-questions] Continuing this thread much longer -- crazy? Or just crazy? In-Reply-To: References: Message-ID: <9bd8a08a0912300212u5d645d87t8193a85e59f76fe4@mail.gmail.com> What a nonsense. 2009/12/30 Michael Turner > > I think we've drifted somewhat from the topic I started. Mea culpa -- I > forked it into an IDE-for-Erlang discussion, and my subject line perhaps > lent itself to eventual flaming on almost religious topic in software > engineering, from high level methodology to the One True Editor. > > Still, there have been a number of good points brought up, and I'll > probably summarize soon, perhaps writing some of you privately first to > make sure I'm not misrepresenting your point of view. My tentative > conclusions at this point: > > - Erlang as a first language is a concept that ought to be tried. > > - The IDE-for-Erlang issue, if I address it at all in my tutorial > materials, might be deferred until after I've had a chance to test the > idea out on some willing subjects. > > - Configuring Emacs with Erlang tool support still seems worth pursuing > and trying out on the target audience at some point relatively soon (on > the order of months). > > - Eclipse looks more distant. Perhaps because it's written in Java, > I've long felt that professional Java programmers are its de facto > target audience, even if it's nominally language-agnostic. My target > audience isn't professional programmers at all. > > Just to be sure: my idea was really to teach Erlang to cognitive > scientists and cognitive linguists, so that they could support their own > modeling efforts. It was not to turn them into full-fledged software > engineers. (Issues of GUI and DBMS support might be farmed out to > people writing in other languages and interfacing to the researchers' > models.) My initial subject line didn't express this qualification > very well, but I was hoping people would read the rest of my e-mail for > context, and (lucky me) a number of you actually did. > > If you'd like to continue discussion of Emacs as great/good/stupid/evil, > or about how only a poor craftsman blames his tools, or about how you > learned C++ just from reading a reference manual for it on a desert > island, then got a compiler for it running after you discovered an old > Ukrainian Ural 666 Mark II running aboard a Soviet freighter that had > run aground on the other side of the island, whose crew had long since > been rescued, your compiler being implemented by writing it out in > machine code, in tiny chalk numerals, on some blackboards in the > captain's cabin, after which you toggled it in through the front panel > ... well, be my guest. But with a new and unrelated subject line, > please. > > -michael turner > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From vasilij.savin@REDACTED Wed Dec 30 11:21:48 2009 From: vasilij.savin@REDACTED (Vasilij Savin) Date: Wed, 30 Dec 2009 12:21:48 +0200 Subject: [erlang-questions] Continuing this thread much longer -- crazy? Or just crazy? In-Reply-To: References: Message-ID: Hej Michael, It looks like a very good summary to me. Regards, Vasilij Savin On Wed, Dec 30, 2009 at 12:03 PM, Michael Turner wrote: > > I think we've drifted somewhat from the topic I started. Mea culpa -- I > forked it into an IDE-for-Erlang discussion, and my subject line perhaps > lent itself to eventual flaming on almost religious topic in software > engineering, from high level methodology to the One True Editor. > > Still, there have been a number of good points brought up, and I'll > probably summarize soon, perhaps writing some of you privately first to > make sure I'm not misrepresenting your point of view. My tentative > conclusions at this point: > > - Erlang as a first language is a concept that ought to be tried. > > - The IDE-for-Erlang issue, if I address it at all in my tutorial > materials, might be deferred until after I've had a chance to test the > idea out on some willing subjects. > > - Configuring Emacs with Erlang tool support still seems worth pursuing > and trying out on the target audience at some point relatively soon (on > the order of months). > > - Eclipse looks more distant. Perhaps because it's written in Java, > I've long felt that professional Java programmers are its de facto > target audience, even if it's nominally language-agnostic. My target > audience isn't professional programmers at all. > > Just to be sure: my idea was really to teach Erlang to cognitive > scientists and cognitive linguists, so that they could support their own > modeling efforts. It was not to turn them into full-fledged software > engineers. (Issues of GUI and DBMS support might be farmed out to > people writing in other languages and interfacing to the researchers' > models.) My initial subject line didn't express this qualification > very well, but I was hoping people would read the rest of my e-mail for > context, and (lucky me) a number of you actually did. > > If you'd like to continue discussion of Emacs as great/good/stupid/evil, > or about how only a poor craftsman blames his tools, or about how you > learned C++ just from reading a reference manual for it on a desert > island, then got a compiler for it running after you discovered an old > Ukrainian Ural 666 Mark II running aboard a Soviet freighter that had > run aground on the other side of the island, whose crew had long since > been rescued, your compiler being implemented by writing it out in > machine code, in tiny chalk numerals, on some blackboards in the > captain's cabin, after which you toggled it in through the front panel > ... well, be my guest. But with a new and unrelated subject line, > please. > > -michael turner > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From erlang@REDACTED Wed Dec 30 11:39:53 2009 From: erlang@REDACTED (Illo de' Illis) Date: Wed, 30 Dec 2009 11:39:53 +0100 Subject: [erlang-questions] Continuing this thread much longer -- crazy? Or just crazy? In-Reply-To: References: Message-ID: <2D89609D-9F96-4699-9471-ABAF12F0C94E@trainedmonkeys.net> On Dec 30, 2009, at 11:03 AM, Michael Turner wrote: > [...] If you'd like to continue discussion of Emacs as great/good/stupid/evil, > or about how only a poor craftsman blames his tools, or about how you > learned C++ just from reading a reference manual for it on a desert > island [...] _Real_ programmers refuse to learn C++. Such a poorly implemented and bloated programming language. Please, stick with erlang. Ciao, Illo. From egarrulo@REDACTED Wed Dec 30 11:46:23 2009 From: egarrulo@REDACTED (egarrulo) Date: Wed, 30 Dec 2009 10:46:23 +0000 Subject: [erlang-questions] Continuing this thread much longer -- crazy? Or just crazy? In-Reply-To: <2D89609D-9F96-4699-9471-ABAF12F0C94E@trainedmonkeys.net> References: <2D89609D-9F96-4699-9471-ABAF12F0C94E@trainedmonkeys.net> Message-ID: <9bd8a08a0912300246h3cbb75b6i9794eb75f6a11fc@mail.gmail.com> What C++ got right is resource collection and primitive types abstraction. Never seen a language where you could implement a smart pointer. 2009/12/30 Illo de' Illis > On Dec 30, 2009, at 11:03 AM, Michael Turner wrote: > > [...] If you'd like to continue discussion of Emacs as > great/good/stupid/evil, > > or about how only a poor craftsman blames his tools, or about how you > > learned C++ just from reading a reference manual for it on a desert > > island [...] > > _Real_ programmers refuse to learn C++. Such a poorly implemented and > bloated programming language. Please, stick with erlang. > > Ciao, > Illo. > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From vasilij.savin@REDACTED Wed Dec 30 12:04:36 2009 From: vasilij.savin@REDACTED (Vasilij Savin) Date: Wed, 30 Dec 2009 13:04:36 +0200 Subject: [erlang-questions] How to setup In-Reply-To: <4dde26ad0912292058l5fc80ae0s90022f73f5fdeb19@mail.gmail.com> References: <4dde26ad0912292058l5fc80ae0s90022f73f5fdeb19@mail.gmail.com> Message-ID: Greetings, I am not sure I understand what specifically are you trying to do? If you want to learn about Erlang web applications, you should google for erlang web frameworks, there are few. I.e Nitrogen framework ( http://nitrogen-erlang.tumblr.com/) Regarding beebole, I am not sure it is a right tool for this job. Regards, Vasilij Savin On Wed, Dec 30, 2009 at 6:58 AM, Navaneethan wrote: > Hi, > > How to configure beebole to create erlang webapplication in ubuntu? > ,Ultimately i want to create a web application using erlang? what i need to > do? How to practice itself? > can any one hand me? > > -- > regards, > > NavTux > > It blogs @ http://navaspot.wordpress.com > From taruti@REDACTED Wed Dec 30 15:22:20 2009 From: taruti@REDACTED (Taru Karttunen) Date: Wed, 30 Dec 2009 16:22:20 +0200 Subject: Callbacks with record name == module name Message-ID: <1262182431-sup-4989@oz.taruti.net> Hello Is it sensible to write code with callbacks for different "object" types like: foo(Id) -> {ok, V} = myapp_get_by_id(Id), (element(1,V)):foo(V). Or is there a more idiomatic way of handling this? - Taru Karttunen From kiszl@REDACTED Wed Dec 30 16:54:40 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Wed, 30 Dec 2009 16:54:40 +0100 Subject: [erlang-questions] Callbacks with record name == module name In-Reply-To: <1262182431-sup-4989@oz.taruti.net> References: <1262182431-sup-4989@oz.taruti.net> Message-ID: <4B3B77C0.8030508@tmit.bme.hu> You could abstract away the parts where you are getting into the guts. foo(Id) -> {ok, V} = myapp_get_by_id(Id), Class = class_of(V), Class:foo(V). class_of(V) -> element(1,V). You can also give parametrized modules a try. It has a more OO L&F. foo(Id) -> Obj = get_obj_by_id(Id), Obj:foo(). get_obj_by_id(Id) -> {ok, V} = myapp_get_by_id(Id), Class = class_of(V), Class:new(V). Z. Taru Karttunen wrote: > Hello > > Is it sensible to write code with callbacks for different "object" > types like: > > foo(Id) -> > {ok, V} = myapp_get_by_id(Id), > (element(1,V)):foo(V). > > Or is there a more idiomatic way of handling this? > > - Taru Karttunen > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From kunthar@REDACTED Wed Dec 30 17:07:49 2009 From: kunthar@REDACTED (Kunthar) Date: Wed, 30 Dec 2009 18:07:49 +0200 Subject: [erlang-questions] "Erlang as a First Language" -- crazy? or just stupid? In-Reply-To: <1c3be50f0912291508h26f3651dsc024508c6d99158@mail.gmail.com> References: <9bd8a08a0912271522q77643490i9230a4c8747f6424@mail.gmail.com> <20091229175501.GC5430@uk.tiscali.com> <3dbc6d1c0912291340v56ea4321t1ae5a499af505c79@mail.gmail.com> <1c3be50f0912291508h26f3651dsc024508c6d99158@mail.gmail.com> Message-ID: <9a09ca9a0912300807y2924ad1ejc68a572c58dd16c6@mail.gmail.com> Happy new year to all; http://www.youtube.com/watch?v=1-b2RybNvek On Wed, Dec 30, 2009 at 1:08 AM, Juan Jose Comellas wrote: > That can easily be solved by using the cua module (cua-mode). I ended > modifying the Emacs configuration when I started using it to support the > normal copy/cut/paste key bindings and those used for cursor movement > (C-Left; C-Right; etc.). > > > On Tue, Dec 29, 2009 at 6:52 PM, Vasilij Savin wrote: > >> Just some thoughts from Emacs newbie. The main problem for me was that I >> had >> to unlearn a lot of shortcuts I was used to take for granted (Ctrl >> S/X/C/V/Q). There is no worse shock to start using new application that has >> totally "non-conventional" shortcuts. This throws new converts totally >> off-balance. >> >> Still, I am willing to give Emacs another try. >> >> Regards, >> Vasilij Savin >> >> >> On Tue, Dec 29, 2009 at 11:40 PM, Robert Virding >> wrote: >> >> > 2009/12/29 Brian Candler >> > >> > > On Mon, Dec 28, 2009 at 12:22:45AM +0100, egarrulo wrote: >> > > > I do agree wholeheartedly (that's why I cannot stand Eclipse). Let's >> > just >> > > > not forget we all started bicycling with training wheels, and crawled >> > > before >> > > > walking (again, that's why I've suggested Emacs as IDE). >> > > >> > > I agree with the training wheels analogy, except that starting with >> Emacs >> > > would be like learning to fly a 747 before picking up the bicycle :-) >> > > >> > >> > I can't agree here. The threshhold to start using emacs is very low, >> there >> > is nothing which forces you to use more than the about 10 basic commands >> > you >> > need. The ceiling, however, is somewhere out in space. Sometimes I wonder >> > if >> > the problem beginners have with emacs is that the knowledge of the >> > existence >> > of all those other commands frightens them. >> > >> > Seriously I can't give an objective comment here as I have used emacs for >> > almost 30 years and can't remember not knowing it. The key strokes sit in >> > my >> > fingers. :-) >> > >> > Robert >> > >> > From caio.ariede@REDACTED Wed Dec 30 17:46:27 2009 From: caio.ariede@REDACTED (caio ariede) Date: Wed, 30 Dec 2009 14:46:27 -0200 Subject: [erlang-questions] Callbacks with record name == module name In-Reply-To: <4B3B77C0.8030508@tmit.bme.hu> References: <1262182431-sup-4989@oz.taruti.net> <4B3B77C0.8030508@tmit.bme.hu> Message-ID: <6a9ba5690912300846k66cf836y9246cf414633e225@mail.gmail.com> Or just apply foo(Id) -> {ok, V} = myapp_get_by_id(Id), apply(element(1,V), foo, [V]). Caio Ariede http://caioariede.com/ On Wed, Dec 30, 2009 at 1:54 PM, Zoltan Lajos Kis wrote: > You could abstract away the parts where you are getting into the guts. > > foo(Id) -> > ?{ok, V} = myapp_get_by_id(Id), > ?Class = class_of(V), > ?Class:foo(V). > > class_of(V) -> > ?element(1,V). > > You can also give parametrized modules a try. It has a more OO L&F. > > foo(Id) -> > ?Obj = get_obj_by_id(Id), > ?Obj:foo(). > > get_obj_by_id(Id) -> > ?{ok, V} = myapp_get_by_id(Id), > ?Class = class_of(V), > ?Class:new(V). > > Z. > > Taru Karttunen wrote: >> >> Hello >> >> Is it sensible to write code with callbacks for different "object" >> types like: >> >> foo(Id) -> >> ?{ok, V} = myapp_get_by_id(Id), >> ?(element(1,V)):foo(V). >> >> Or is there a more idiomatic way of handling this? >> >> - Taru Karttunen >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From jan.koum@REDACTED Thu Dec 31 04:03:38 2009 From: jan.koum@REDACTED (Jan Koum) Date: Wed, 30 Dec 2009 19:03:38 -0800 Subject: mnesia node table copy shortcut? Message-ID: <7c29a2a40912301903i7b34720at55eb8365ad955c3@mail.gmail.com> hi folks, is there a shortcut which would let me copy all the tables from one node to another node in a single command? right now when i bring up a new node, i have to do: mnesia:add_table_copy(table1a, node(), ram_copies), mnesia:add_table_copy(table1b, node(), ram_copies), ... mnesia:add_table_copy(table2a, node(), disc_copies), mnesia:add_table_copy(table2b, node(), disc_copies), .... mnesia:add_table_copy(table3a, node(), disc_only_copies), mnesia:add_table_copy(table3b, node(), disc_only_copies). i came across this shortcut on the web while searching for answer, but it copies ALL tables into XYZ Tabs = mnesia:system_info(tables) -- [schema], [mnesia:add_table_copy(Tab,node(), XYZ) || Tab <- Tabs]. is there a way to modify above command to copy all ram_copies table as ram_copies, disc_copies table as disc_copies, and disc_only_copies as disc_only_copies? thanks and happy new years, -- yan From vinayakapawar@REDACTED Thu Dec 31 05:44:52 2009 From: vinayakapawar@REDACTED (Vinayak Pawar) Date: Thu, 31 Dec 2009 10:14:52 +0530 Subject: [erlang-questions] mnesia node table copy shortcut? In-Reply-To: <7c29a2a40912301903i7b34720at55eb8365ad955c3@mail.gmail.com> References: <7c29a2a40912301903i7b34720at55eb8365ad955c3@mail.gmail.com> Message-ID: <23237d040912302044p63c4c178l56d4a694512a3aee@mail.gmail.com> Like this? Node = % node to copy these tables StorageType = fun(T) -> mnesia:table_info(T, storage_type) end, Tabs = mnesia:system_info(local_tables) -- [schema], [mnesia:add_table_copy(Tab, Node, StorageType(Tab)) || Tab <- Tabs]. On Thu, Dec 31, 2009 at 8:33 AM, Jan Koum wrote: > hi folks, > > is there a shortcut which would let me copy all the tables from one node to > another node in a single command? right now when i bring up a new node, i > have to do: > > mnesia:add_table_copy(table1a, node(), ram_copies), > mnesia:add_table_copy(table1b, node(), ram_copies), > ... > mnesia:add_table_copy(table2a, node(), disc_copies), > mnesia:add_table_copy(table2b, node(), disc_copies), > .... > mnesia:add_table_copy(table3a, node(), disc_only_copies), > mnesia:add_table_copy(table3b, node(), disc_only_copies). > > i came across this shortcut on the web while searching for answer, but it > copies ALL tables into XYZ > > Tabs = mnesia:system_info(tables) -- [schema], > [mnesia:add_table_copy(Tab,node(), XYZ) || Tab <- Tabs]. > > is there a way to modify above command to copy all ram_copies table as > ram_copies, disc_copies table as disc_copies, and disc_only_copies as > disc_only_copies? thanks and happy new years, > > -- yan >